首页 > 文档 > smooth()平滑函数
2017
07-03

smooth()平滑函数

17.smooth()

Name名称):smooth()//平滑函数

Examples例子):

 

void setup() {

  size(100, 100);

  smooth(2);

  noStroke();

}

void draw() {

  background(0);

  ellipse(30, 48, 36, 36);

  ellipse(70, 48, 36, 36);

}

 

Description描述):Draws all geometry with smooth (anti-aliased) edges. This behavior is the default, so smooth() only needs to be used when a program needs to set the smoothing in a different way. The level parameter increases the level of smoothness. This is the level of over sampling applied to the graphics buffer.

用光滑的(抗锯齿)边缘绘制所有的几何图形。这种行为是默认的,所以只有当程序需要以不同的方式设置平滑时,才需要使用smooth ()。层次参数增加了平滑度。这是应用于图形缓冲区的超过采样的级别。

With the P2D and P3D renderers, smooth(2) is the default, this is called “2x anti-aliasing.” The code smooth(4) is used for 4x anti-aliasing and smooth(8) is specified for 8x anti-aliasing. The maximum anti-aliasing level is determined by the hardware of the machine that is running the software, so smooth(4) and smooth(8) will not work with every computer.

使用P2D和P3D渲染器,smooth (2)是默认的,这称为“2x反混叠”。代码smooth (4)用于4x反混叠和smooth (8),用于8x抗锯齿。最大的抗混叠水平是由运行软件的机器的硬件来决定的,因此smooth (4)和smooth (8)将不适用于每台计算机。

The default renderer uses smooth(3) by default. This is bicubic smoothing. The other option for the default renderer is smooth(2), which is bilinear smoothing.

默认渲染器默认使用smooth (3)。这是双三次的平滑。默认渲染器的另一个选项是smooth (2),即双线性平滑。

With Processing 3.0, smooth() is different than before. It was common to use smooth() and noSmooth() to turn on and off antialiasing within a sketch. Now, because of how the software has changed, smooth() can only be set once within a sketch. It can be used either at the top of a sketch without a setup(), or after the size() function when used in a sketch with setup(). The noSmooth() function also follows the same rules.

处理3.0时,smooth()与以前不同。使用smooth()和nosmooth()来开启和关闭草图中的反锯齿是很常见的。现在,由于软件的变化,smooth()只能在草图中设置一次。它可以在没有size()的草图的顶部使用,或者在使用setup()的草图中使用size()函数之后。nosmooth()函数也遵循相同的规则。

 

Syntax(语法):smooth(level)

Parameters (参数):level——either 2, 3, 4, or 8 depending on the renderer 2、3、4或8取决于渲染器

Returns返回值):Void(

Related相关函数):noSmooth()

 

 

 

 

 

 

 

 



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

留下一个回复

你的email不会被公开。