首页 > 文档 > image()图像函数
2017
08-08

image()图像函数

Name

image()图像函数

   

Examples

image()图像函数 - 第1张  | Processing编程艺术image()图像函数 - 第2张  | Processing编程艺术image()图像函数 - 第3张  | Processing编程艺术

PImage img;

 

void setup() {

// Images must be in the “data” directory to load correctly

img = loadImage(“laDefense.jpg”);

}

 

void draw() {

image(img, 0, 0);

}

image()图像函数 - 第4张  | Processing编程艺术image()图像函数 - 第5张  | Processing编程艺术image()图像函数 - 第6张  | Processing编程艺术

PImage img;

 

void setup() {

// Images must be in the “data” directory to load correctly

img = loadImage(“laDefense.jpg”);

}

 

void draw() {

image(img, 0, 0);

image(img, 0, 0, width/2, height/2);

}

Description

The image() function draws an image to the display window. Images must be in the sketch’s “data” directory to load correctly. Select “Add file…” from the “Sketch” menu to add the image to the data directory, or just drag the image file onto the sketch window. Processing currently works with GIF, JPEG, and PNG images. 

The img parameter specifies the image to display and by default the a and b parameters define the location of its upper-left corner. The image is displayed at its original size unless the c and dparameters specify a different size. The imageMode() function can be used to change the way these parameters draw the image.

The color of an image may be modified with the tint() function. This function will maintain transparency for GIF and PNG images.

图像 () 函数将图像绘制到显示窗口。图像必须在草图的数据目录中才能正确加载。从草绘菜单中选择添加文件…” 将图像添加到数据目录, 或者只将图像文件拖到草绘窗口中。当前处理的工作是 GIFJPEG PNG 图像。

 

img 参数指定要显示的图像, 默认情况下, a b 参数定义其左上角的位置。除非 c d 参数指定不同的大小, 否则图像将以原始大小显示。imageMode () 函数可用于更改这些参数绘制图像的方式。

 

图像的颜色可以使用淡色 () 函数进行修改。此函数将保持 GIF PNG 图像的透明度。

Syntax

image(img, a, b)

image(img, a, b, c, d)

Parameters

img

PImage: the image to display

要显示的图像

a

float: x-coordinate of the image by default

默认情况下图像的 x 坐标

b

float: y-coordinate of the image by default

默认情况下图像的 y 坐标

c

float: width to display the image by default

默认情况下显示图像的宽度

d

float: height to display the image by default

默认情况下显示图像的高度

Returns

void

Related

loadImage()
PImage
imageMode()
tint()
background()
alpha()



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

留下一个回复

你的email不会被公开。