Index 0 drawn as white

Archives Forums/Blitz3D Bug Reports/Index 0 drawn as white

WolRon(Posted 2005) [#1]
I found that palleted images (8 bit or less) seem to have a problem with the color at index 0 being drawn as white regardless of what color it is or whether or not it's even the Mask color.
I get the same results in B3D or B+
Graphics 1024, 768

image = LoadImage("any_8_bit_or_less_image.png")
;MaskImage image, 0, 0, 0

DrawImage image, 0, 0
WaitKey()
End
In fact, the entire image could be (say) black and it will still be drawn as white if the black color is index 0.

My specs:
Win XP Media Center Edition Ver 2002 w/ SP2
Nvidia GeForce FX 5700LE
DirectX 9.0c (4.09.0000.0904)
Blitz 3D 1.87
BlitzPlus 1.41


Matty(Posted 2005) [#2]
I tried it on my old machine (Win98SE Geforce 2 MX) and couldn't reproduce it. This is what I did:

Create Image in Irfanview- 32x32 pixels with 256colors (8bpp). Image is all black (default background color).

using code above nothing seemed to appear. I regularly use 256 color bitmaps and have not had this problem. Is this what you mean or am I doing something different than you?


WolRon(Posted 2005) [#3]
Upon furthur inspection, it only appears to occur with .png files (which is what I normally use). I tried the same thing with .bmp and .pcx file formats but had no problem.

I don't remember having problems in the past, but I couldn't say for a fact that it wasn't happening. It may just be that I didn't notice...


Matty(Posted 2005) [#4]
I just tried the same thing with the image I made in Irfanview but with it converted to a png file and the image was black as normal. Maybe it has something to do with the software you are creating the png file in? A long time ago (in the old blitzbasic days) I used to export image strips from darkbasic as 16bit bitmaps (if you set the graphics depth to 16bit any screenshots you saved were 16bit...) and if I loaded them as an imageanimstrip they were shifted to the right for each frame by about half a frame's width.

I'd be happy to try testing this with one of your png files if you want to send me one to my email address in profile.


Matty(Posted 2005) [#5]
Got your email WolRon, not sure if you received my reply.

The image appears as a white box on my pc too, although it also appears as a white box in my email (firefox browser) but appears black in irfanview or any other image editing program. If I save your image as an 8bpp png with irfanview it appears black, as it should, but is 8 bytes larger.