Skip to content

CanvasRenderingContext2d.get_image_data argument is float#1920

Merged
guybedford merged 2 commits into
wasm-bindgen:mainfrom
poccariswet:master
Feb 20, 2026
Merged

CanvasRenderingContext2d.get_image_data argument is float#1920
guybedford merged 2 commits into
wasm-bindgen:mainfrom
poccariswet:master

Conversation

@poccariswet

@poccariswet poccariswet commented Dec 18, 2019

Copy link
Copy Markdown
Contributor

issue #1917

according to the spec it should be i32 .

 ImageData getImageData(long sx, long sy, long sw, long sh);

It also fix putImageData

@alexcrichton alexcrichton added breaking-change Tracking breaking changes for the next major version bump (if ever) web-sys Issues related to the `web-sys` crate labels Dec 18, 2019
@alexcrichton

Copy link
Copy Markdown
Contributor

Thanks for this! This is unfortunately a breaking change though and once that others are probably already relying on, so I've tagged this for the next breaking release of web-sys.

@poccariswet

Copy link
Copy Markdown
Contributor Author

@alexcrichton
Will this request be merged in the next major version release?

@alexcrichton

Copy link
Copy Markdown
Contributor

Indeed!

@guybedford guybedford removed the breaking-change Tracking breaking changes for the next major version bump (if ever) label Feb 19, 2026
@guybedford

Copy link
Copy Markdown
Contributor

I've rebased this, and altered the approach to use the unstable merge functionality for web-sys so it will be available behind the web_sys_unstable_apis cfg. This way we can land it now and stabilize for the next web-sys major.

Per the HTML spec, getImageData and putImageData should use long (i32)
for coordinates, not double (f64). This adds spec-compliant methods
under the unstable feature flag.

Closes wasm-bindgen#1917
Co-authored-by: poccariswet <poccariswet@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

web-sys Issues related to the `web-sys` crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants