I need a little help from an experienced GAPIDraw user.
I have an offscreen bitmap I use to cache image data (tiles). Some of the tiles contain a transparent color set as RGB(1,1,1). The data that is stored on the cache comes from PNG files that are loaded as needed. The PNG files are 256 color indexed images, and are initially loaded into their own surface and then a portion is blit and cached on the caching surface.
The caching bitmap has the color key set to RGB(1,1,1) for use as a source blit surface. The images I load do not have their color key set, and when I blit them to the cache image I do not set the blit flags to 0.
The problem I'm seeing is that in some cases, the blit from the PNG surface to the cache is not replicating the the RGB(1,1,1) transparent color stored in the original png files.
The problem appears to only be on images that contain 2 colors. I have tile set images that contain mask data, and this mask data is either RGB(0,0,0) or RGB(1,1,1). So the images have only 2 colors. On these images, the RGB(0,0,0) is not getting rendered, nor is the mask color RGB(1,1,1). It appears to treat the entire image as transparent RGB(1,1,1).
If I turn off the GDBLTFAST_KEYSRC parameter, the entire tile renders as RGB(0,0,0) (if I do a screen grab an examine the pixels) However, 0,0,0 is not set to transparent in any of my code.
The palette has RGB(0,0,0) as palette index 0, and RGB(1,1,1) as palette index 1.
I use the same RGB(1,1,1) color in other tiles that have more colors and it appears to work just fine as the transparent pixels are not drawn.
I assume this is a problem with my PNG file, or an issue with GAPIDraw thinking that palette index 0 is always transparent, which is not true.
Could anyone give me some suggestions on how to get around this issue? I'm thinking about just storing the 2 colors PNG's as 16 bit images instead of paletted images and see if that works, but of course I'm trying to save space when they are decompressed and 8 bit palettes are the way to go for this.
I'm using NETPBM utils with a perl script to convert/scale the original artwork to PNG's from BMP's and so far it has worked well.
Also, I'm doing my testing/debugging on a Windows XP PC.
If you know of this problem and a solution, a response would be much appreciated.
Thanks,
Byron
I have an offscreen bitmap I use to cache image data (tiles). Some of the tiles contain a transparent color set as RGB(1,1,1). The data that is stored on the cache comes from PNG files that are loaded as needed. The PNG files are 256 color indexed images, and are initially loaded into their own surface and then a portion is blit and cached on the caching surface.
The caching bitmap has the color key set to RGB(1,1,1) for use as a source blit surface. The images I load do not have their color key set, and when I blit them to the cache image I do not set the blit flags to 0.
The problem I'm seeing is that in some cases, the blit from the PNG surface to the cache is not replicating the the RGB(1,1,1) transparent color stored in the original png files.
The problem appears to only be on images that contain 2 colors. I have tile set images that contain mask data, and this mask data is either RGB(0,0,0) or RGB(1,1,1). So the images have only 2 colors. On these images, the RGB(0,0,0) is not getting rendered, nor is the mask color RGB(1,1,1). It appears to treat the entire image as transparent RGB(1,1,1).
If I turn off the GDBLTFAST_KEYSRC parameter, the entire tile renders as RGB(0,0,0) (if I do a screen grab an examine the pixels) However, 0,0,0 is not set to transparent in any of my code.
The palette has RGB(0,0,0) as palette index 0, and RGB(1,1,1) as palette index 1.
I use the same RGB(1,1,1) color in other tiles that have more colors and it appears to work just fine as the transparent pixels are not drawn.
I assume this is a problem with my PNG file, or an issue with GAPIDraw thinking that palette index 0 is always transparent, which is not true.
Could anyone give me some suggestions on how to get around this issue? I'm thinking about just storing the 2 colors PNG's as 16 bit images instead of paletted images and see if that works, but of course I'm trying to save space when they are decompressed and 8 bit palettes are the way to go for this.
I'm using NETPBM utils with a perl script to convert/scale the original artwork to PNG's from BMP's and so far it has worked well.
Also, I'm doing my testing/debugging on a Windows XP PC.
If you know of this problem and a solution, a response would be much appreciated.
Thanks,
Byron