Image() function with 4 points

Hello,

Texturing a QUAD:

PShape qd;
PImage img;

void setup() 
  {
  size(200, 200, P2D);
  img = loadImage("https://cdn.theatlantic.com/thumbor/jb3UdKqcmt1JleWOqNj8UWRxcFk=/0x591:2832x2184/976x549/media/img/mt/2017/10/Pict1_Ursinia_calendulifolia/original.jpg");
 
  qd = createShape(QUAD, 50, 50, 170, 70, 150, 150, 30, 170);
  qd.setTexture(img);
  shape(qd, 0, 0);
  noLoop();
  }

image

References:
https://processing.org/tutorials/pshape < Example at end of tutorial

:)

3 Likes