首页 > 文档 > createImage()创建图像
2017
08-08

createImage()创建图像

Name

createImage()创建图像

   

Examples

createImage()创建图像 - 第1张  | Processing编程艺术createImage()创建图像 - 第2张  | Processing编程艺术createImage()创建图像 - 第3张  | Processing编程艺术

PImage img = createImage(66, 66, RGB);

img.loadPixels();

for (int i = 0; i < img.pixels.length; i++) {

img.pixels[i] = color(0, 90, 102);

}

img.updatePixels();

image(img, 17, 17);

createImage()创建图像 - 第4张  | Processing编程艺术createImage()创建图像 - 第5张  | Processing编程艺术createImage()创建图像 - 第6张  | Processing编程艺术

PImage img = createImage(66, 66, ARGB);

img.loadPixels();

for (int i = 0; i < img.pixels.length; i++) {

img.pixels[i] = color(0, 90, 102, i % img.width * 2);

}

img.updatePixels();

image(img, 17, 17);

image(img, 34, 34);

Description

Creates a new PImage (the datatype for storing images). This provides a fresh buffer of pixels to play with. Set the size of the buffer with the width and height parameters. The format parameter defines how the pixels are stored. See the PImage reference for more information. 

Be sure to include all three parameters, specifying only the width and height (but no format) will produce a strange error. 

Advanced users please note that createImage() should be used instead of the syntax new PImage().

创建新的 PImage (用于存储图像的数据类型)。这提供了一个新的像素缓冲区来播放。使用宽度和高度参数设置缓冲区的大小。格式参数定义像素的存储方式。有关更多信息, 请参见 PImage 参考。

 

确保包含所有三参数, 只指定宽度和高度 (但没有格式) 将产生一个奇怪的错误。

 

高级用户请注意, 应使用 createImage () 代替语法新 PImage ()

Syntax

createImage(w, h, format)

Parameters

w

int: width in pixels

宽度 (以像素为单位)

h

int: height in pixels

高度 (以像素为单位)

format

int: Either RGB, ARGB, ALPHA (grayscale alpha channel)

RGBARGBalpha (灰度 alpha 通道)

Returns

PImage

Related

PImage
PGraphics



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

留下一个回复

你的email不会被公开。