Transparency in DirectDraw
-
I'm developing an animated game. For various reasons, we port the version to use
DirectDraw
interfaces. I'm having a hard time to draw bitmaps with transparent white parts. I'm doing this to every bitmap:// Set the color key for this bitmap.
//
// Whatever color is at entry 255 in the palette will be the
// transparent color for blits. This color is black unless
// you used the DDPCAPS_ALLOW256 flag when the palette was
// createdDDCOLORKEY ddck;
ddck.dwColorSpaceLowValue = 0x00 /* 0xff */;
ddck.dwColorSpaceHighValue = 0x00 /* 0xff */;// lpDDSSomeBitmapSurface is a DirectDraw surface with a
// bitmap loaded into it. This needs to be done for each
// surface containing a bitmap.
lpDDSSomeBitmapSurface->SetColorKey( DDCKEY_SRCBLT, &ddck );But it doesn't make it. Is it something to do with palettes ?
-
I'm developing an animated game. For various reasons, we port the version to use
DirectDraw
interfaces. I'm having a hard time to draw bitmaps with transparent white parts. I'm doing this to every bitmap:// Set the color key for this bitmap.
//
// Whatever color is at entry 255 in the palette will be the
// transparent color for blits. This color is black unless
// you used the DDPCAPS_ALLOW256 flag when the palette was
// createdDDCOLORKEY ddck;
ddck.dwColorSpaceLowValue = 0x00 /* 0xff */;
ddck.dwColorSpaceHighValue = 0x00 /* 0xff */;// lpDDSSomeBitmapSurface is a DirectDraw surface with a
// bitmap loaded into it. This needs to be done for each
// surface containing a bitmap.
lpDDSSomeBitmapSurface->SetColorKey( DDCKEY_SRCBLT, &ddck );But it doesn't make it. Is it something to do with palettes ?
Hanan888 wrote:
ddck.dwColorSpaceLowValue = 0x00 /* 0xff */;ddck.dwColorSpaceHighValue = 0x00 /* 0xff */;
Hanan888 wrote:
But it doesn't make it.
Means, it transparent blitting is not happening? possibly you are setting the palette index as 0x00 which may not contain the white color. why don't you use 0xff only and set the color white in the palette entry at 0xff when the palette is created.