mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
LibWeb: Add {,de}serialization steps for ImageData
This commit is contained in:
committed by
Shannon Booth
parent
5b4644d198
commit
6941b63890
Notes:
github-actions[bot]
2025-05-08 14:13:01 +00:00
Author: https://github.com/kennethmyhra Commit: https://github.com/LadybirdBrowser/ladybird/commit/6941b638903 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4596 Reviewed-by: https://github.com/shannonbooth ✅
@@ -66,6 +66,24 @@
|
||||
println(`instanceOf DOMException: ${domException instanceof DOMException}`);
|
||||
println(`DOMException: ${domException.message} - ${domException.name}`);
|
||||
|
||||
const data = new Uint8ClampedArray([
|
||||
255, 0, 0, 255,
|
||||
0, 255, 0, 255,
|
||||
0, 0, 255, 255,
|
||||
255, 255, 0, 255
|
||||
]);
|
||||
const imageData = structuredClone(new ImageData(data, 2, 2));
|
||||
println(`instanceOf ImageData: ${imageData instanceof ImageData}`);
|
||||
println(`ImageData.width: ${imageData.width}`);
|
||||
println(`ImageData.height: ${imageData.height}`);
|
||||
for (let i = 0; i < imageData.data.length; i += 4) {
|
||||
const r = imageData.data[i];
|
||||
const g = imageData.data[i + 1];
|
||||
const b = imageData.data[i + 2];
|
||||
const a = imageData.data[i + 3];
|
||||
println(`${r}, ${g}, ${b}, ${a}`);
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user