Name |
loadPixels()加载像素 |
Examples |
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[] |
- 本文固定链接: http://iprocessing.cn/2017/08/09/loadpixels加载像素/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表