Name | tint() |
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Examples | // @pjs preload must be used to preload the image /* @pjs preload="laDefense.jpg"; */ PImage b; b = loadImage("laDefense.jpg"); image(b, 0, 0); // Tint blue tint(0, 153, 204); image(b, 50, 0); // @pjs preload must be used to preload the image /* @pjs preload="laDefense.jpg"; */ PImage b; b = loadImage("laDefense.jpg"); image(b, 0, 0); // Tint blue and set transparency tint(0, 153, 204, 126); image(b, 50, 0); |
||||||||||||||
Description | Sets the fill value for displaying images. Images can be tinted to specified colors or made transparent by setting the alpha.
To make an image transparent, but not change it's color, use white as the tint color and specify an alpha value. For instance, tint(255, 128) will make an image 50% transparent (unless colorMode() has been used). When using hexadecimal notation to specify a color, use "#" or "0x" before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six digits to specify a color (the way colors are specified in HTML and CSS). When using the hexadecimal notation starting with "0x", the hexadecimal value must be specified with eight characters; the first two characters define the alpha component and the remainder the red, green, and blue components. The value for the parameter "gray" must be less than or equal to the current maximum value as specified by colorMode(). The default maximum value is 255. The tint() method is also used to control the coloring of textures in 3D. |
||||||||||||||
Syntax | tint(gray) tint(gray, alpha) tint(value1, value2, value3) tint(value1, value2, value3, alpha) tint(color) tint(color, alpha) tint(hex) tint(hex, alpha) |
||||||||||||||
Parameters |
|
||||||||||||||
Usage | Web & Application | ||||||||||||||
Related | noTint()
image() |