Name

CRC.createImageData() — creates a new ImageData object

Synopsis

ImageData createImageData(w, h)
ImageData createImageData(ImageData data)

Arguments

w, h

The desired ImageData width and height, in CSS pixels

data

An existing ImageData object that specifies the size of the ImageData to be created

Returns

A newly created ImageData object that has the specified width and height or has the same size as data.

Description

Returns a new ImageData object with the specified width and height or the same dimensions as data. All pixels within this new ImageData object are initialized to transparent black (all color components and alpha are 0).

The w and h arguments specify image dimensions in CSS pixels. Implementations are allowed to map single CSS pixels to more than one underlying device pixel. The width and height properties of the returned ImageData object specify the image dimensions in device pixels, and these values may not match the w and h arguments.

Get Canvas Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.