Canvasity.drawImage

Draw an image onto the canvas.

The position of the rectangle that the image is drawn to is affected by the current transform at the time of drawing, and the image will be resampled as needed (with the filtering always clamping to the edges of the image). The drawing is also affected by the shadow, global alpha, global compositing operation settings, and by the clip region. The current path is not affected by drawing an image. The image data, which should be in top to bottom rows of contiguous pixels from left to right, is not retained and it is safe to change or destroy it after this call. The width and height must both be positive and the width and/or the height to scale to may be negative but not zero. Otherwise, or if the image pointer is null, or the current transform is not invertible, this does nothing.

Note: to use a small piece of a larger image, reduce the width and height, and offset the image pointer while keeping the stride.

Parameters

image const(ubyte)*

Unpremultiplied sRGB RGBA8 image data.

width int

Width of the image in pixels.

height int

Height of the image in pixels.

stride int

Bytes between the start of each image row.

x float

Horizontal coordinate to draw the corner at.

y float

Vertical coordinate to draw the corner at.

to_width float

Width to scale the image to.

to_height float

Height to scale the image to.

Meta