Implementing Transparency

You can implement transparency when doing any of the following:

Defining a Region

Defining a region in an image makes it possible to treat the area outside the region as transparent. The PaintRegion method paints only the region that is defined for an image. The CombineFastCommand class combines only the area inside the region.

You can define a region in a number of ways, including by specifying a color. For example, if a transparent color is defined for an image, you can create a region that omits pixels of that color. For details, refer to Creating a Region.

Using the Region

After a region is defined, you can create a mask from it using the CreateMaskFromRegion method, which you can save in the alpha channel of a 16-bit or 32-bit file. Refer to the SetAlphaImage method for an example of how to save a region in an alpha channel.

When specifying a transparent color, use the Windows PALETTEINDEX macro to refer to a particular palette index (where the RasterColor value is >= 0x01000000). Using a palette index for transparency allows that same RGB value to be used as one of the colors in the palette, without being interpreted as transparent.

Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Imaging, Medical, and Document