Name |
image()图像函数 |
||||||||||
Examples |
PImage img;
void setup() { // Images must be in the “data” directory to load correctly img = loadImage(“laDefense.jpg”); }
void draw() { image(img, 0, 0); }
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. 图像 () 函数将图像绘制到显示窗口。图像必须在草图的 “数据” 目录中才能正确加载。从 “草绘” 菜单中选择 “添加文件…” 将图像添加到数据目录, 或者只将图像文件拖到 “草绘” 窗口中。当前处理的工作是 GIF、JPEG 和 PNG 图像。
img 参数指定要显示的图像, 默认情况下, a 和 b 参数定义其左上角的位置。除非 c 和 d 参数指定不同的大小, 否则图像将以原始大小显示。imageMode () 函数可用于更改这些参数绘制图像的方式。
图像的颜色可以使用淡色 () 函数进行修改。此函数将保持 GIF 和 PNG 图像的透明度。 |
||||||||||
Syntax |
image(img, a, b) image(img, a, b, c, d) |
||||||||||
Parameters |
|
||||||||||
Returns |
void |
||||||||||
Related |
loadImage() |
- 本文固定链接: http://iprocessing.cn/2017/08/08/image图像函数/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表