mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 16:19:23 +00:00
LibWeb: Factor out canvas serialization algorihtm
Factor out canvas serialization algorihtm from HTMLCanvasElement to seperate file. This makes it usable by other things too.
This commit is contained in:
parent
8ef7df2a95
commit
49500ac386
Notes:
github-actions[bot]
2025-06-30 15:47:56 +00:00
Author: https://github.com/Totto16
Commit: 49500ac386
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3788
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/tcl3
4 changed files with 68 additions and 34 deletions
23
Libraries/LibWeb/HTML/Canvas/SerializeBitmap.h
Normal file
23
Libraries/LibWeb/HTML/Canvas/SerializeBitmap.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Ladybird contributors
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
struct SerializeBitmapResult {
|
||||
ByteBuffer buffer;
|
||||
StringView mime_type;
|
||||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#a-serialisation-of-the-bitmap-as-a-file
|
||||
ErrorOr<SerializeBitmapResult> serialize_bitmap(Gfx::Bitmap const& bitmap, StringView type, Optional<double> quality);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue