Next: , Previous: , Up: Simple Image Processing   [Contents][Index]


37.7.2 Tint

Tint as implemented in the Forms Library emulates the effect of looking at an image through a piece of colored glass. You can specify the color and transparency of the glass:

int flimage_tint(FL_IMAGE *im, unsigned int packed, double opacity);

where the parameter packed is a packed RGB color, specifying the color of the glass. opacity specifies how much the color of the image is absorbed by the glass. A value of 0 means the glass is totally transparent, i.e., the glass has no effect3, while a value of 1.0 means total opaqueness, i.e., all you see is the color of the glass. Any value between these two extremes results in a color that is a combination of the pixel color and the glass color. For example, to tint a part of the image bluish, you can set packed to FL_PACK(0,0,200) and use an opacity of 018.

Tint is most useful in cases where you want to put some annotations on the image, but do not want to use a uniform and opaque background that completely obscures the image behind. By using tint, you can have a background that provides some contrast to the text, yet not obscures the image beneath completely.

Tint operation uses the subimage settings.


Footnotes

(18)

Strictly speaking, a piece of glass that is totally transparent can’t have colors.