stroke()

本参考资料用于Processing 3.0+。 如果你使用的是前一版本,请在使用软件帮助菜单内的参考资料。. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

名称

stroke()

示例
 stroke(153);

rect(30, 20, 55, 55);

 stroke(204, 102, 0);

rect(30, 20, 55, 55);

描述 Sets the color used to draw lines and borders around shapes. 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.

When drawing in 2D with the default renderer, you may need hint(ENABLE_STROKE_PURE) to improve drawing quality (at the expense of performance). See the hint() documentation for more details.

语法
stroke(rgb) stroke(rgb, alpha) stroke(gray) stroke(gray, alpha) stroke(v1, v2, v3) stroke(v1, v2, v3, alpha)
参数
rgb int: color value in hexadecimal notation
alpha float: opacity of the stroke
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)
返回值 void
相关 noStroke()
strokeWeight()
strokeJoin()
strokeCap()
fill()
noFill()
tint()
background()
colorMode()

Updated on October 2, 2018 05:02:09pm EDT

stroke()