[Previous]
[Bookset]
[Next]

PhMakeTransBitmap()

Create a transparency mask for an image

Synopsis:

int PhMakeTransBitmap( PhImage_t *image,
                       PgColor_t trans_color );

Description:

This function creates a transparent bitmap or transparency mask for the given image, provided there isn't one already.

The trans_color argument is the color in the image's palette to be made transparent. If more than one entry in the palette contains this color, the first one found is used. You can pass an index into the palette as trans_color by ORing it with Pg_INDEX_COLOR. For example:

if ( PhMakeTransBitmap( my_image, 
                        n | Pg_INDEX_COLOR ) == 0 )
{
    ...
}

The resulting bitmap is stored in the mask_bm member of the PhImage_t structure. This function sets the image's Ph_RELEASE_TRANSPARENCY_MASK flag.


Note: This function currently supports only Pg_IMAGE_PALETTE_NIBBLE and Pg_IMAGE_PALETTE_BYTE images.

To draw the image using the transparency mask, use PgDrawTImage().

Returns:

0
Success
-1
An error occurred

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PgDrawTImage(), PhImage_t


[Previous]
[Bookset]
[Next]