Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Get transparent color from a GIF
Ref. No. QNX.000009884
Category(ies) Development
Issue How do we determine the transparent color of an image when using PxLoadImage()?
Is it possible to do that in the HTML widget?

Solution The current GIF loader does not allow you to determine the transparent color.
However, you can specify a color that will get substituted in for the transparent color by doing the following:
x09- set the PX_TRANSPARENT bit in the flags member of the PxMethods_t that gets passed into PxLoadImage
x09- set the transparent member of the PxMethods_t struct to a suitable color for the transparency mask (e.g. PgRGB(255, 255, 0) for a nice bright yellow).

Once the GIF has been loaded, you can use PhMakeTransBitmap() to create a transparency bitmap for the image (using the color you specified earlier, PgRGB(255, 255, 0)) and then render the transparency image with PgDrawTImage().