首页 > 文档 > pixels[]像素数组
2017
08-09

pixels[]像素数组

Name

pixels[]像素数组

   

Examples

pixels[]像素数组 - 第1张  | Processing编程艺术pixels[]像素数组 - 第2张  | Processing编程艺术pixels[]像素数组 - 第3张  | Processing编程艺术

color pink = color(255, 102, 204);

loadPixels();

for (int i = 0; i < (width*height/2)-width/2; i++) {

pixels[i] = pink;

}

updatePixels();

Description

Array containing the values for all the pixels in the display window. These values are of the color datatype. This array is the size of the display window. For example, if the image is 100×100 pixels, there will be 10000 values and if the window is 200×300 pixels, there will be 60000 values.

Before accessing this array, the data must loaded with the loadPixels() function. Failure to do so may result in a NullPointerException. Subsequent changes to the display window will not be reflected in pixels until loadPixels() is called again. After pixels has been modified, the updatePixels()function must be run to update the content of the display window.

数组, 其中包含显示窗口中所有像素的值。这些值是颜色数据类型。此数组是显示窗口的大小。例如, 如果图像是100×100 像素, 将有10000, 如果窗口是200×300 像素, 将有60000值。

 

在访问此数组之前, 数据必须用 loadPixels () 函数加载。如果不这样做, 可能会导致异常。对显示窗口的后续更改将不会以像素为单位反映, 直到再次调用 loadPixels ()。修改像素后, 必须运行 updatePixels () 函数来更新显示窗口的内容。

Related

loadPixels()
updatePixels()
get()
set()
PImage



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

留下一个回复

你的email不会被公开。