readPixels Method


readPixels(rect, selector, receiver, excludeNonLocatable?)

Capture selected data about each pixel within a rectangular region of this Viewport.

readPixels(rect: ViewRect, selector: Pixel.Selector, receiver: Pixel.Receiver, excludeNonLocatable?: boolean): void

@note The Pixel.Buffer supplied to the receiver function becomes invalid once that function exits. Do not store a reference to it.

Parameter Type Description
rect ViewRect The area of the viewport's contents to read. The origin specifies the upper-left corner. Must lie entirely within the viewport's dimensions. This input viewport is specified using CSS pixels not device pixels.
selector Pixel.Selector Specifies which aspect(s) of data to read.
receiver Pixel.Receiver A function accepting a Pixel.Buffer object from which the selected data can be retrieved, or receiving undefined if the viewport has been disposed, the rect is out of bounds, or some other error. The pixels received will be device pixels, not CSS pixels. See devicePixelRatio and cssPixelsToDevicePixels.
excludeNonLocatable boolean If true, geometry with the "non-locatable" flag set will not be drawn.

Returns - void



readPixels(args)

Capture selected data about each pixel within a rectangular region of this viewport.

readPixels(args: ReadPixelsArgs): void

@note The Pixel.Buffer supplied to receiver becomes invalid once that function exits. Do not store a reference to it.

Parameter Type Description
args ReadPixelsArgs  

Returns - void


Defined in

Last Updated: 21 December, 2024