Py5Graphics.image_mode()

Py5Graphics.image_mode()#

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

Description#

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

The default mode is image_mode(CORNER), which interprets the second and third parameters of Py5Graphics.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.

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

image_mode(CENTER) interprets the second and third parameters of Py5Graphics.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 Python is a case-sensitive language.

This method is the same as image_mode() but linked to a Py5Graphics object. To see example code for how it can be used, see image_mode().

Underlying Processing method: PGraphics.imageMode

Signatures#

image_mode(
    mode: int,  # either CORNER, CORNERS, or CENTER
    /,
) -> None

Updated on March 06, 2023 02:49:26am UTC