Skip to content

Support BitmapData.drawScaled on JavaScript - #1380

Open
snowyukitty wants to merge 1 commit into
HeapsIO:masterfrom
snowyukitty:fix/bitmapdata-js-drawscaled
Open

snowyukitty wants to merge 1 commit into
HeapsIO:masterfrom
snowyukitty:fix/bitmapdata-js-drawscaled

Conversation

@snowyukitty

Copy link
Copy Markdown

Fixes #1211.

BitmapData.drawScaled() and its draw() wrapper throw Not implemented on JavaScript. Add Canvas2D drawing with source cropping, smooth or nearest-neighbor scaling, default alpha compositing, and None replacement. Replacement is clipped to the destination rectangle so transparent pixels do not erase the rest of the bitmap, including when the source and destination overlap. Other blend modes are explicitly rejected, and rectangle bounds follow the existing HashLink implementation.

Add a BitmapDataDraw sample with pixel checks for transparent replacement, background preservation, overlapping self-copy, and alpha compositing. It runs through the existing sample build generator.

Validation:

  • Haxe 4.3.7: haxe all.hxml from the repository root and haxe all.hxml from samples/ pass, including the new sample's JavaScript, HashLink and DirectX12 builds.
  • Haxe 4.3.3 with Chromium 149 and WebKit 26.5: 11 pixel checks per browser cover both methods, cropping, offsets, smoothing, transparency, self-copy, bounds, unsupported blend modes, and context state. The unmodified base fails these checks; the candidate passes all 22.
  • Chromium 149: the new sample initializes and renders successfully, including its pixel assertions.
  • Firefox runtime validation was skipped after browser startup timed out in the isolated environment. HashLink/DirectX runtime rendering was not exercised.

This branch has not been deployed

No deployments
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.

BitmapData drawScaled "Not implemented" Runtime Error (JS)

1 participant