Name |
fill()填充颜色 |
||||||||||||
Examples |
fill(153); rect(30, 20, 55, 55);
fill(204, 102, 0); rect(30, 20, 55, 55); |
||||||||||||
Description |
Sets the color used to fill shapes. For example, if you run fill(204, 102, 0), all subsequent shapes will be filled with orange. This color is either specified in terms of the RGB or HSB color depending on the current colorMode(). The default color space is RGB, with each value in the range from 0 to 255. 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. To change the color of an image or a texture, use tint(). 设置用于填充形状的颜色。例如, 如果您运行填充 (204、102、0), 则所有后续形状都将用橙色填充。此颜色根据当前 colorMode () 的 RGB 或 HSB 颜色指定。默认的颜色空间是 RGB, 每个值的范围从0到255。
使用十六进制表示法指定颜色时, 在值之前使用 “#” 或 “0x” (例如, CCFFAA 或 0xFFCCFFAA)。# 语法使用六位数字来指定颜色 (就像通常在 HTML 和 CSS 中指定颜色一样)。当使用以 “0x” 开头的十六进制符号时, 必须用八字符指定十六进制值。前两个字符定义了 alpha 分量, 其余部分定义了红色、绿色和蓝色分量。
“灰色” 参数的值必须小于或等于 colorMode () 指定的当前最大值。默认最大值为255。
要更改图像或纹理的颜色, 请使用淡色 ()。 |
||||||||||||
Syntax |
fill(rgb) fill(rgb, alpha) fill(gray) fill(gray, alpha) fill(v1, v2, v3) fill(v1, v2, v3, alpha) |
||||||||||||
Parameters |
|
||||||||||||
Returns |
void |
||||||||||||
Related |
noFill() |
- 本文固定链接: http://iprocessing.cn/2017/08/08/fill填充颜色/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表