Displaying Transparent Images

Snowbound Software’s RasterMasterTM for Windows includes the ability to display transparent GIF images. To display a transparent GIF image, you can use the IMG_display_bitmap_transp() and the IMGLOW_get_transp_color() functions. The IMG_display_bitmap_transp() function displays the foreground color for a GIF image. The IMGLOW_get_transp_color() returns the background color for GIF images if this information is available in the header.

IMG_display_bitmap_transp()

This function displays transparent GIF images. It only draws the foreground color when displaying. It does not draw the background color. To get the background color from an image, use the IMGLOW_get_transp_color() function. See the IMGLOW_get_transp_color() function below for more information.

The IMG_display_bitmap_transp() function compares each pixel to the background color passed in and does not draw foreground pixels that are identical.

Note: A negative value indicates an error. See the imgerr.h file.

Syntax

int IMG_display_bitmap_transp (int imghandle, IMGPORT hdc, int xpos, int ypos, int width, int height, int tcolor);

Remark

The table below lists the IMG_display_bitmap_transp function variable descriptions.

Variable

Description

imghandle

Standard image handle obtained from a decompress function such asIMG_decompress_bitmap()

hdc

Windows device context to display

hwnd

Handle of window within which to enable scroll bars

xpos

Starting X coordinate for display of image

ypos

Starting Y coordinate for display of image

width

Horizontal width to display image

height

Vertical height to display image

tcolor

Background color of image to ignore

 
   

Returns

Integer

 

IMGLOW_get_transp_color ()

This function returns the background color for GIF images if this information is available in the header. It returns 1 byte or a NO_TCOLOR_FOUND error message if not available.

Note: A negative value indicates an error. See the imgerr.h file.

 

Syntax

int IMGLOW_get_transp_color (int imghandle);

 

Remark

The table below lists the IMGLOW_get_transp_color function variable description.

Variable

Description

imghandle

Standard image handle obtained from a decompress function such asIMG_decompress_bitmap()

 
   

Returns

Integer

Category:

Online Demo