Is it possible to draw an image to an arbitrary quadrilateral in the canvas 2d API?
I see drawImage lets me draw to a rectangle.
ctx.drawImage(someImage, x, y, width, height);
and rotate lets me rotate it.
ctx.rotate(angle);
ctx.drawImage(someImage, ...);
But is it possible to choose an arbitrary 4 points to map the original 4 points of the image rectangle too?
drawImageTo4Points(
image,
topLeftX, topLeftY, // location to place the topLeft of the image
topRightX, topRightY, // location to place the topRight of the image
bottomLeftX, bottomLeftY, // location to place the bottomLeft of the image
bottomRightX, bottomRightY); // location to place the bottomRight of the image