Release package version 0.0.04
All checks were successful
CI / build (push) Successful in 23s

Support for render ImageBitmap
This commit is contained in:
Andrey Kernichniy 2026-03-14 18:16:22 +07:00
parent 3c3b13e22f
commit c0150f85fa
5 changed files with 40 additions and 19 deletions

View file

@ -92,11 +92,20 @@ export class Canvas2DRenderer implements IRenderer {
this._context.globalCompositeOperation = dn.blendMode as GlobalCompositeOperation;
this._artist.setTransform(dn.transform);
this._artist.drawImage(
dn.source,
{ x: dn.rectangle.x, y: dn.rectangle.y },
{ width: dn.rectangle.width, height: dn.rectangle.height },
);
if (dn.source instanceof HTMLImageElement) {
this._artist.drawImage(
dn.source,
{ x: dn.rectangle.x, y: dn.rectangle.y },
{ width: dn.rectangle.width, height: dn.rectangle.height },
);
} else if (dn.source instanceof ImageBitmap) {
this._artist.drawImage2(
dn.source,
{ x: dn.rectangle.x, y: dn.rectangle.y },
{ width: dn.rectangle.width, height: dn.rectangle.height },
);
}
this._context.restore();
}
if (isRectangleDrawObject(leaf)) {