AbstractProtectedconstructorCreates a new image with the given size.
The image width in pixels.
The image height in pixels.
Protected ReadonlyheightThe image height in pixels.
Protected ReadonlywidthThe image width in pixels.
Draws the image onto the given rendering context.
The rendering context to draw the image to.
Optional horizontal target position. Defaults to 0.
Optional vertical target position. Defaults to 0.
AbstractgetReturns the RGBA color at the specified position.
The horizontal pixel position.
The vertical pixel position.
The RGBA color at the specified position.
RangeError if coordinates are outside of the image boundaries.
The image height in pixels.
The image width in pixels.
Resets the given canvas to the image size and fills the canvas with the image. This does not create a new canvas so any canvas implementation can be used and existing canvas objects can be re-used.
In a browser you do this:
const canvas = image.toCanvas(document.createElement("canvas"))`;
In Node.js (with node-canvas) you do this:
import { createCanvas} from "canvas";
const canvas = image.toCanvas(createCanvas());
The canvas to reset and fill.
The passed canvas for method chaining.
Copies the opaque pixels of this image into the given image data and returns the modified image data.
The image data to copy the opaque pixels of this image to.
The image data.
Base class for all images.