MCPcopy Create free account
hub / github.com/benfry/processing4 / image

Method image

core/src/processing/core/PGraphics.java:3905–3922  ·  view source on GitHub ↗

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

(PImage img, float a, float b)

Source from the content-addressed store, hash-verified

3903 * @see PGraphics#alpha(int)
3904 */
3905 public void image(PImage img, float a, float b) {
3906 // Starting in release 0144, image errors are simply ignored.
3907 // loadImageAsync() sets width and height to -1 when loading fails.
3908 if (img.width == -1 || img.height == -1) return;
3909
3910 if (imageMode == CORNER || imageMode == CORNERS) {
3911 imageImpl(img,
3912 a, b, a+img.width, b+img.height,
3913 0, 0, img.width, img.height);
3914
3915 } else if (imageMode == CENTER) {
3916 float x1 = a - (img.width >> 1);
3917 float y1 = b - (img.height >> 1);
3918 imageImpl(img,
3919 x1, y1, x1+img.width, y1+img.height,
3920 0, 0, img.width, img.height);
3921 }
3922 }
3923
3924 /**
3925 * @param c width to display the image by default

Callers

nothing calls this directly

Calls 1

imageImplMethod · 0.95

Tested by

no test coverage detected