ImageGear for C and C++ on Linux v18.8 - Updated
IG_dspl_transparency_set
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Display Functions > IG_dspl_transparency_set

This function sets the transparency options.

Declaration:

 
Copy Code
AT_ERRCOUNT  ACCUAPI  IG_dspl_transparency_set(
        [IN] HIGEAR hIGear,
        [IN] DWORD dwGrpID,
        [IN] AT_MODE nTranspMode,
        [IN] const LPAT_RGB lpTranspColor,
        [IN] HIGEAR hIMask,
        [IN] const LPAT_RECTANGLE lpMaskRect,
        [IN] const LPAT_POINT lpMaskLocation
);

Arguments:

Name Type Description
hIGear HIGEAR ImageGear handle of image.
dwGrpID DWORD Identifier of the group in which to set transparency options.
nTranspMode AT_MODE New value of TranspMode to set. Possible value may be:
  • IG_DSPL_TRANSPARENCY_NONE,
or a combination of one of the following flags:
  • IG_DSPL_TRANSPARENCY_COLOR
  • IG_DSPL_TRANSPARENCY_MASK
  • IG_DSPL_TRANSPMASK_STRETCH_TO_IMAGE
and one of these flags:
  • IG_DSPL_TRANSPMASK_LOCATE_TO_IMAGE
  • IG_DSPL_TRANSPMASK_LOCATE_TO_CLIPRECT
  • IG_DSPL_TRANSPMASK_LOCATE_ABSOLUTE
lpTranspColor const LPAT_RGB New value of TranspColor to set. If NULL, then this parameter is ignored.
hIMask HIGEAR New value of TranspMask option to set. Please note that the image is not deleted and the application code is responsible for removing the old value of this option.
lpMaskRect const LPAT_RECTANGLE New value of MaskRect option to set. If NULL, then this parameter is ignored. An empty rectangle is possible.
lpMaskLocation const LPAT_POINT New value of MaskLocation option to set. If NULL, then this parameter is ignored.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Example:

 
Copy Code
HIGEAR           hIGear;        /* HIGEAR handle of image  */
DWORD           nGrpID;        /* display group identifier  */
AT_MODE          nTranspMode;    /* transparency mode  */
AT_RGB          TranspColor;    /* transparency color */
HIGEAR          hIMask;         /* transparent mask   */
 ...
/* enable transparent color and mask with default mask rectangle and location oriented and
scaled with main image */ 
nTranspMode =
IG_DSPL_TRANSPARENCY_COLOR|IG_DSPL_TRANSPARENCY_MASK|IG_DSPL_TRANSPMASK_STRETCH_TO_IMAGE|
IG_DSPL_TRANSPMASK_LOCATE_TO_IMAGE;
/* set transparent color to white */
TranspColor.r = TranspColor.g = TranspColor.b = 255;
IG_dspl_transparency_set( hIGear, nGrpID, nTranspMode, &TranspColor, hIMask, NULL, NULL );
 ...

Remarks:

This function sets the transparency only for image displaying. For saving image with transparency mask use function IG_display_transparent_set().