image()

Image / Loading & Displaying

Description

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

NameTypeDescription
imgPImage*the image to display
xfloatx-coordinate
yfloaty-coordinate
wfloatwidth (optional)
hfloatheight (optional)

Returns

void

Related

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); }