首页 > 文档 > loadPixels()加载像素
2017
08-09

loadPixels()加载像素

Name

loadPixels()加载像素

   

Examples

loadPixels()加载像素 - 第1张  | Processing编程艺术loadPixels()加载像素 - 第2张  | Processing编程艺术loadPixels()加载像素 - 第3张  | Processing编程艺术

int halfImage = width*height/2;

PImage myImage = loadImage(“apples.jpg”);

image(myImage, 0, 0);

 

loadPixels();

for (int i = 0; i < halfImage; i++) {

pixels[i+halfImage] = pixels[i];

}

updatePixels();

Description

Loads a snapshot of the current display window into the pixels[] array. This function must always be called before reading from or writing to pixels[]. Subsequent changes to the display window will not be reflected in pixels until loadPixels() is called again.

Certain renderers may or may not seem to require loadPixels() or updatePixels(). However, the rule is that any time you want to manipulate the pixels[] array, you must have previously called loadPixels(), and after changes have been made, call updatePixels(). Even if the renderer may not seem to use this function in the current Processing release, this will always be subject to change.

将当前显示窗口的快照加载到像素 [] 数组中。在读取或写入像素 [] 之前, 必须始终调用此函数。对显示窗口的后续更改将不会以像素为单位反映, 直到再次调用 loadPixels ()

 

某些器可能或可能不需要 loadPixels () updatePixels ()。但是, 规则是, 每当您要操作像素 [] 数组时, 必须事先调用 loadPixels (), 并且在进行更改之后, 调用 updatePixels ()。即使渲染器在当前的处理版本中似乎没有使用这个函数, 这也会随时发生变化。

Syntax

loadPixels()

Returns

void

Related

pixels[]
updatePixels()



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

留下一个回复

你的email不会被公开。