image()
Image / Loading & DisplayingDescription
Displays an image at the given position. Optionally specify width and height.
Syntax
void image(PImage* img, float x, float y)
void image(PImage* img, float x, float y, float w, float h)
Parameters
| Name | Type | Description |
|---|---|---|
| img | PImage* | the image to display |
| x | float | x-coordinate |
| y | float | y-coordinate |
| w | float | width (optional) |
| h | float | height (optional) |
Returns
voidRelated
Under the Hood
From Processing.h:
void image(PImage* img, float x, float y);
void image(PImage* img, float x, float y, float w, float h);
void image(const PImage& img, float x, float y);
void image(const PImage& img, float x, float y, float w, float h);
void image(const PImage* img, float x, float y) { if(img) image(*img,x,y); }
void image(const PImage* img, float x, float y) { if(img) image(*img,x,y);
void image(const PImage* img, float x, float y, float w, float h) { if(img) image(*img,x,y,w,h); }
void image(const PImage* img, float x, float y, float w, float h) { if(img) image(*img,x,y,w,h);
void image(PGraphics& pg, float x, float y);
void image(PGraphics& pg, float x, float y, float w, float h);
void image(PGraphics* pg, float x, float y) { if (pg) image(*pg, x, y); }
void image(PGraphics* pg, float x, float y) { if (pg) image(*pg, x, y);
void image(PGraphics* pg, float x, float y, float w, float h) { if (pg) image(*pg, x, y, w, h); }
void image(PGraphics* pg, float x, float y, float w, float h) { if (pg) image(*pg, x, y, w, h);
Under the Hood
From Processing.cpp:
void PApplet::image(PGraphics& pg, float x, float y){ drawPGraphicsRect(pg,x,y,(float)pg.width,(float)pg.height); }
void PApplet::image(PGraphics& pg, float x, float y, float w, float h){ drawPGraphicsRect(pg,x,y,w,h); }
void PApplet::image(PImage* img, float x, float y) {
if(!img || img->width==0 || img->height==0) return;
drawImage_impl(img, x, y, (float)img->width, (float)img->height);
}
void PApplet::image(PImage* img, float x, float y, float w, float h) {
if(!img || img->width==0 || img->height==0) return;
drawImage_impl(img, x, y, w, h);
}