首页 > 文档 > imageMode()图像模式
2017
08-08

imageMode()图像模式

Name

imageMode()图像模式

   

Examples

imageMode()图像模式 - 第1张  | Processing编程艺术imageMode()图像模式 - 第2张  | Processing编程艺术imageMode()图像模式 - 第3张  | Processing编程艺术

PImage img;

 

void setup() {

img = loadImage(“laDefense.jpg”);

}

 

void draw() {

imageMode(CORNER);

image(img, 10, 10, 50, 50); // Draw image using CORNER mode

}

imageMode()图像模式 - 第4张  | Processing编程艺术imageMode()图像模式 - 第5张  | Processing编程艺术imageMode()图像模式 - 第6张  | Processing编程艺术

PImage img;

 

void setup() {

img = loadImage(“laDefense.jpg”);

}

 

void draw() {

imageMode(CORNERS);

image(img, 10, 10, 90, 40); // Draw image using CORNERS mode

}

imageMode()图像模式 - 第7张  | Processing编程艺术imageMode()图像模式 - 第8张  | Processing编程艺术imageMode()图像模式 - 第9张  | Processing编程艺术

PImage img;

 

void setup() {

img = loadImage(“laDefense.jpg”);

}

 

void draw() {

imageMode(CENTER);

image(img, 50, 50, 80, 80); // Draw image using CENTER mode

}

Description

Modifies the location from which images are drawn by changing the way in which parameters given to image() are intepreted.

The default mode is imageMode(CORNER), which interprets the second and third parameters of image() as the upper-left corner of the image. If two additional parameters are specified, they are used to set the image’s width and height.

imageMode(CORNERS) interprets the second and third parameters of image() as the location of one corner, and the fourth and fifth parameters as the opposite corner.

imageMode(CENTER) interprets the second and third parameters of image() as the image’s center point. If two additional parameters are specified, they are used to set the image’s width and height.

The parameter must be written in ALL CAPS because Processing is a case-sensitive language.

通过更改给图像 () intepreted 的参数的方式修改绘制图像的位置。

 

默认模式为 imageMode (), 它将图像的第二和第三个参数 () 解释为图像的左上角。如果指定了两个附加参数, 则使用它们来设置图像的宽度和高度。

 

imageMode () 将图像的第二和第三个参数 () 解释为一个角的位置, 第四和第五参数为相反的角。

 

imageMode (中心) 将图像的第二和第三个参数解释为图像的中心点。如果指定了两个附加参数, 则使用它们来设置图像的宽度和高度。

 

该参数必须以所有大写形式写入, 因为处理是一种 case-sensitive 的语言。

Syntax

imageMode(mode)

Parameters

mode

int: either CORNER, CORNERS, or CENTER

 

角、多个角、中心

Returns

void

Related

loadImage()
PImage
image()
background()



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

留下一个回复

你的email不会被公开。