Search processing.org:

Reference for Processing version 1.0.1+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name

### tint()

Examples

    PImage b;
    b = loadImage("laDefense.jpg");
    image(b, 0, 0);
    // Tint blue
    tint(0, 153, 204);
    image(b, 50, 0);

    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

gray | int or float: any valid number
alpha | int or float: opacity of the image
value1 | int or float: red or hue value
value2 | int or float: green or saturation value
value3 | int or float: blue or brightness value
color | color: any value of the color datatype
hex | int: color value in hexadecimal notation (i.e. #FFCC00 or 0xFFFFCC00)

Returns | None
Usage | Web & Application
Related | noTint() image()

Updated on November 22, 2008 08:39:25pm PST