LibWeb: Implement HTML::ImageBitmap creation from HTML::ImageData

This commit is contained in:
ayeteadoe 2025-06-22 01:15:23 -07:00 committed by Andrew Kaster
commit 81ccb655b4
Notes: github-actions[bot] 2025-06-30 16:08:53 +00:00
7 changed files with 120 additions and 14 deletions

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<body>
<script src="../include.js"></script>
<script>
let canvas = document.createElement("canvas");
canvas.width = 20;
canvas.height = 20;
let ctx = canvas.getContext("2d");
ctx.fillStyle = "rgb(42, 110, 96)";
ctx.fillRect(0, 0, 10, 10);
let imageData = ctx.getImageData(0, 0, 20, 20);
asyncTest(async done => {
try {
const bitmap = await createImageBitmap(imageData);
println(`[Success]: ${bitmap}`);
} catch (err) {
println(`[ Error ]: ${err}`);
}
done();
});
</script>
</body>