About Opacity

Appendix ››
Parent Previous Next

About Opacity

Opacity is the way M!Image implements transparency.
Every pixel in an image has an opacity value in the range from 0 to 255.
A pixel becomes fully transparent when it's opacity value is 0 and fully opaque when it's opacity value is 255.
Values between 1 and 254 let a pixel become semi transparent.

Have a look at the following two images:

Without Opacity

With Opacity

As you can see, the shade is realized through opacity - the color of the shade pixels is black!

Max. Opacity

Beside the "normal" opacity, M!Image let you define the max. opacity of an image with MImgSetMaxOpacity. The max. opacity doesn't modify the pixel's opacity values. When an image is drawn, M!Image compares a pixel's opacity value with the max. opacity value. When the max. opacity value is less than the pixel's opacity value, the pixel is drawn with the max. opacity value, otherwise the pixel is drawn with it's own opacity value.

Transparent Color

Additionally, M!Image let you define the transparent color of an image with MImgSetTranspColor. The pixels that match this color are fully transparent. Please consider that the transparent color has priority. That means that the opacity value of an pixel is ignored if it's color matches the transparent color.

Created with the Personal Edition of HelpNDoc: Benefits of a Help Authoring Tool