diff options
author | Tobias Christiansen <tobyase@serenityos.org> | 2021-09-03 18:46:11 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-04 03:29:09 +0200 |
commit | 508d56318931c0d6a3fd077ac2dc9f83bbfe612b (patch) | |
tree | c6c6622463638ce495bbb4f2139fc02aeae37333 /Userland/Applications/PixelPaint/Image.h | |
parent | b3f53a0b5a6cb7019f02dd73883435cbb7e1cb1e (diff) | |
download | serenity-508d56318931c0d6a3fd077ac2dc9f83bbfe612b.zip |
PixelPaint: Add ProjectLoader to abstract away opening of files
This new class will open and parse files (either images directly or .pp
project files) and one can get the parsed Image as well as other
information from it.
This patch removes a bunch of 'try_create_from..." methods from Image in
favor of using the ProjectLoader.
The only json_metadata that is available are Guides for now.
Diffstat (limited to 'Userland/Applications/PixelPaint/Image.h')
-rw-r--r-- | Userland/Applications/PixelPaint/Image.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Userland/Applications/PixelPaint/Image.h b/Userland/Applications/PixelPaint/Image.h index 13430df761..1ffa9d382e 100644 --- a/Userland/Applications/PixelPaint/Image.h +++ b/Userland/Applications/PixelPaint/Image.h @@ -46,10 +46,10 @@ protected: class Image : public RefCounted<Image> { public: static RefPtr<Image> try_create_with_size(Gfx::IntSize const&); - static Result<NonnullRefPtr<Image>, String> try_create_from_fd_and_close(int fd, String const& file_path); - static Result<NonnullRefPtr<Image>, String> try_create_from_path(String const& file_path); - static RefPtr<Image> try_create_from_bitmap(NonnullRefPtr<Gfx::Bitmap>); static Result<NonnullRefPtr<Image>, String> try_create_from_pixel_paint_json(JsonObject const&); + static RefPtr<Image> try_create_from_bitmap(NonnullRefPtr<Gfx::Bitmap>); + + static RefPtr<Gfx::Bitmap> try_decode_bitmap(const ByteBuffer& bitmap_data); // This generates a new Bitmap with the final image (all layers composed according to their attributes.) RefPtr<Gfx::Bitmap> try_compose_bitmap(Gfx::BitmapFormat format) const; @@ -103,10 +103,6 @@ public: private: explicit Image(Gfx::IntSize const&); - static Result<NonnullRefPtr<Image>, String> try_create_from_pixel_paint_fd(int fd, String const& file_path); - static Result<NonnullRefPtr<Image>, String> try_create_from_pixel_paint_path(String const& file_path); - static Result<NonnullRefPtr<Image>, String> try_create_from_pixel_paint_file(Core::File& file, String const& file_path); - void did_change(Gfx::IntRect const& modified_rect = {}); void did_change_rect(); void did_modify_layer_stack(); |