-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Describe the bug
When directly extracting getImageData from the canvas, the devicePixelRatio calculations aren't considered and the result is improperly sized.
To Reproduce
https://codehs.com/sandbox/andy/device-pixel-ratio
Steps to reproduce the behavior:
- On a device with >1 devicePixelRatio, extract imagedata using
__graphics__.getContext().getImageData() - Create a new WebImage and set its image data to the extracted data with
setImageData - The WebImage only contains a 1/n * 1/n portion of the ImageData, where n is the devicepixelratio
Expected behavior
I'd like getImageData to only ever return a value the size of the perceived canvas (after css downscaling).
I think a method like getImageData() (not on context, just global) that performs the devicePixelRatio scaling would be helpful. This is advanced functionality, but something to think about.
Metadata
Metadata
Assignees
Labels
No labels