首页 > 文档 > beginContour()开始负形状
2017
08-01

beginContour()开始负形状

Name

beginContour()开始负形状

   

Examples

beginContour()开始负形状 - 第1张  | Processing编程艺术beginContour()开始负形状 - 第2张  | Processing编程艺术beginContour()开始负形状 - 第3张  | Processing编程艺术

size(100, 100);

translate(50, 50);

stroke(255, 0, 0);

beginShape();

// Exterior part of shape, clockwise winding

vertex(-40, -40);

vertex(40, -40);

vertex(40, 40);

vertex(-40, 40);

// Interior part of shape, counter-clockwise winding

beginContour();

vertex(-20, -20);

vertex(-20, 20);

vertex(20, 20);

vertex(20, -20);

endContour();

endShape(CLOSE);

Description

Use the beginContour() and endContour() function to create negative shapes within shapes such as the center of the letter ‘O’. beginContour() begins recording vertices for the shape and endContour() stops recording. The vertices that define a negative shape must “wind” in the opposite direction from the exterior shape. First draw vertices for the exterior shape in clockwise order, then for internal shapes, draw vertices counterclockwise.

These functions can only be used within a beginShape()/endShape() pair and transformations such as translate()rotate(), and scale() do not work within a beginContour()/endContour() pair. It is also not possible to use other shapes, such as ellipse()or rect() within.

使用 beginContour () endContour () 函数在形状 (如字母 “o” 的中心) 内创建负形状。beginContour () 开始记录形状的顶点, endContour () 停止录制。定义负形状的顶点必须与外部形状相反的方向。首先以顺时针顺序绘制外部形状的顶点, 然后对内部形状进行逆时针绘制顶点。

 

这些函数只能在 beginShape ()/endShape () 对中使用, 而转换 (如平移 ()、旋转 () 和缩放 () beginContour ()/endContour () 对中不起作用。也不可能使用其他形状, 如椭圆 () 或矩形 ()

Syntax

beginContour()

Returns

void



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

留下一个回复

你的email不会被公开。