首页 > 文档 > updatePixels()更新像素点
2017
08-09

updatePixels()更新像素点

Name

updatePixels()更新像素点

   

Examples

updatePixels()更新像素点 - 第1张  | Processing编程艺术updatePixels()更新像素点 - 第2张  | Processing编程艺术updatePixels()更新像素点 - 第3张  | Processing编程艺术

PImage img = loadImage(“rockies.jpg”);

image(img, 0, 0);

int halfImage = img.width * img.height/2;

loadPixels();

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

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

}

updatePixels();

Description

Updates the display window with the data in the pixels[] array. Use in conjunction with loadPixels(). If you’re only reading pixels from the array, there’s no need to call updatePixels()— updating is only necessary to apply changes. 

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 first call 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. 

Currently, while none of the renderers use the additional parameters to updatePixels(), this may be implemented in the future.

用像素 [] 数组中的数据更新显示窗口。与 loadPixels () 一起使用。如果您只从数组中读取像素, 则无需调用 updatePixels ()-更新只需要应用更改。

 

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

 

当前, 虽然没有器使用附加参数到 updatePixels (), 但这可能在将来实现。

Syntax

updatePixels()

Returns

void

Related

loadPixels()
pixels[]



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

留下一个回复

你的email不会被公开。