1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibGfx: Add methods to serialise and deserialise a Bitmap

Unlike `to_shared_buffer()` and co, these methods do *not* require extra
metadata about the bitmap.
This commit is contained in:
AnotherTest 2020-11-07 23:07:03 +03:30 committed by Andreas Kling
parent e23daa90a3
commit 705ad670f3
2 changed files with 101 additions and 6 deletions

View file

@ -94,6 +94,7 @@ public:
static RefPtr<Bitmap> load_from_file(const StringView& path);
static RefPtr<Bitmap> create_with_shared_buffer(BitmapFormat, NonnullRefPtr<SharedBuffer>&&, const IntSize&);
static RefPtr<Bitmap> create_with_shared_buffer(BitmapFormat, NonnullRefPtr<SharedBuffer>&&, const IntSize&, const Vector<RGBA32>& palette);
static RefPtr<Bitmap> create_from_serialized_byte_buffer(ByteBuffer&& buffer);
static bool is_path_a_supported_image_format(const StringView& path)
{
#define __ENUMERATE_IMAGE_FORMAT(Name, Ext) \
@ -110,6 +111,7 @@ public:
RefPtr<Gfx::Bitmap> rotated(Gfx::RotationDirection) const;
RefPtr<Gfx::Bitmap> flipped(Gfx::Orientation) const;
RefPtr<Bitmap> to_bitmap_backed_by_shared_buffer() const;
ByteBuffer serialize_to_byte_buffer() const;
ShareableBitmap to_shareable_bitmap(pid_t peer_pid = -1) const;