首页 > 文档 > fill()填充颜色
2017
08-08

fill()填充颜色

Name

fill()填充颜色

   

Examples

fill()填充颜色 - 第1张  | Processing编程艺术fill()填充颜色 - 第2张  | Processing编程艺术fill()填充颜色 - 第3张  | Processing编程艺术

fill(153);

rect(30, 20, 55, 55);

fill()填充颜色 - 第4张  | Processing编程艺术fill()填充颜色 - 第5张  | Processing编程艺术fill()填充颜色 - 第6张  | Processing编程艺术

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().

设置用于填充形状的颜色。例如, 如果您运行填充 (2041020), 则所有后续形状都将用橙色填充。此颜色根据当前 colorMode () RGB HSB 颜色指定。默认的颜色空间是 RGB, 每个值的范围从0255

 

使用十六进制表示法指定颜色时, 在值之前使用 “#” “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

rgb

int: color variable or hex value

颜色变量或十六进制值

alpha

float: opacity of the fill

填充的不透明度

gray

float: number specifying 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

noFill()
stroke()
noStroke()
tint()
background()
colorMode()



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

留下一个回复

你的email不会被公开。