Skip to content

Fixed data type used in CanvasRenderingContext2D and ImageData#55

Merged
LostBeard merged 1 commit intoLostBeard:mainfrom
Swizzy:main
Nov 3, 2025
Merged

Fixed data type used in CanvasRenderingContext2D and ImageData#55
LostBeard merged 1 commit intoLostBeard:mainfrom
Swizzy:main

Conversation

@Swizzy
Copy link
Copy Markdown
Contributor

@Swizzy Swizzy commented Nov 2, 2025

I've corrected the data type used throughout CanvasRenderingContext2D and the related ImageData class so it's all Double like it should be (number in TypeScript/Javascript is equivalent to Double, not int).

Making these changes i noticed there were some additional overloads with double for some methods that lacked the full XML documentation so i removed them, there was also a overload that was less descriptive i chose to remove in favor of the more informational version.

NOTE: these are breaking changes (binary level but also partially the removal of some overloads causing some parameters to change their names potentially).

…s all Double like it should be.

Removed now redundant overloads in favor of the more descriptive variants.
@LostBeard
Copy link
Copy Markdown
Owner

That is awesome.

I had used MDN which lacks specific number type information for those methods. To verify your changes I searched for better w3 specs for those 2 classes and found: w3.org/canvasrenderingcontext2d and whatwg.org/ImageData.

The only issue I see is that the spec for ImageData uses uint for width and height in its constructor and you changed it to double.

@Swizzy
Copy link
Copy Markdown
Contributor Author

Swizzy commented Nov 3, 2025

That means we would need to cast it to uint in the CanvasRenderingContext2D when constructing those objects - i'll look into it further, only reason i changed that class was to fix compiler errors after adjusting all of the CanvasRenderingContext2D class methods.

@LostBeard LostBeard merged commit e91024b into LostBeard:main Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants