首页 > 文档 > tint()设置图像填充色
2017
08-09

tint()设置图像填充色

Name

tint()设置图像填充色

   

Examples

tint()设置图像填充色 - 第1张  | Processing编程艺术tint()设置图像填充色 - 第2张  | Processing编程艺术tint()设置图像填充色 - 第3张  | Processing编程艺术

PImage img;

img = loadImage(“laDefense.jpg”);

image(img, 0, 0);

tint(0, 153, 204); // Tint blue

image(img, 50, 0);

tint()设置图像填充色 - 第4张  | Processing编程艺术tint()设置图像填充色 - 第5张  | Processing编程艺术tint()设置图像填充色 - 第6张  | Processing编程艺术

PImage img;

img = loadImage(“laDefense.jpg”);

image(img, 0, 0);

tint(0, 153, 204, 126); // Tint blue and set transparency

image(img, 50, 0);

tint()设置图像填充色 - 第7张  | Processing编程艺术tint()设置图像填充色 - 第8张  | Processing编程艺术tint()设置图像填充色 - 第9张  | Processing编程艺术

PImage img;

img = loadImage(“laDefense.jpg”);

image(img, 0, 0);

tint(255, 126); // Apply transparency without changing color

image(img, 50, 0);

Description

Sets the fill value for displaying images. Images can be tinted to specified colors or made transparent by including an alpha value.

To apply transparency to an image without affecting its color, use white as the tint color and specify an alpha value. For instance, tint(255, 128) will make an image 50% transparent (assuming the default alpha range of 0-255, which can be changed with colorMode()). 

When using hexadecimal notation to specify a color, use “#” or “0x” before the values (e.g., #CCFFAA or 0xFFCCFFAA). The # syntax uses six digits to specify a color (just as colors are typically 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 define the red, green, and blue components. 

The value for the gray parameter must be less than or equal to the current maximum value as specified by colorMode(). The default maximum value is 255. 

The tint() function is also used to control the coloring of textures in 3D.

设置显示图像的填充值。图像可以着色为指定的颜色, 或通过包含 alpha 值使其透明。

 

若要对图像应用透明度而不影响其颜色, 请使用白色作为淡色颜色并指定 alpha 值。例如, 淡色 (255128) 将使图像50% 透明 (假设默认的 alpha 范围为 0-255, 可以用 colorMode () 进行更改)

 

使用十六进制表示法指定颜色时, 在值之前使用 “#” “0x” (例如, CCFFAA 0xFFCCFFAA)# 语法使用六位数字来指定颜色 (就像通常在 HTML CSS 中指定颜色一样)。当使用以 “0x” 开头的十六进制符号时, 必须用八字符指定十六进制值。前两个字符定义了 alpha 分量, 其余部分定义了红色、绿色和蓝色分量。

 

灰色参数的值必须小于或等于 colorMode () 指定的当前最大值。默认最大值为255

 

淡色 () 函数也用于在3D 中控制纹理的着色。

Syntax

tint(rgb)

tint(rgb, alpha)

tint(gray)

tint(gray, alpha)

tint(v1, v2, v3)

tint(v1, v2, v3, alpha)

Parameters

rgb

int: color value in hexadecimal notation

十六进制表示法中的颜色值

alpha

float: opacity of the image

 图像的不透明度

gray

float: specifies a value between white and black

指定介于白色和黑色之间的值

v1

float: red or hue value (depending on current color mode)

红色或色相值 (取决于当前颜色模式)

v2

float: green or saturation value (depending on current color mode)

绿色或色相值 (取决于当前颜色模式)

v3

float: blue or brightness value (depending on current color mode)

蓝色或色相值 (取决于当前颜色模式)

Returns

void

Related

noTint()
image()



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。