readPixels Method
Read selected data about each pixel within a rectangular region of this Viewport.
readPixels(rect: ViewRect, selector: Pixel.Selector, receiver: Pixel.Receiver, excludeNonLocatable: boolean = false): 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 Viewport.devicePixelRatio and Viewport.cssPixelsToDevicePixels. |
excludeNonLocatable | boolean | If true, geometry with the "non-locatable" flag set will not be drawn. |
Returns - void
Defined in
- core/frontend/src/Viewport.ts Line 2502
Last Updated: 20 June, 2023