summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint/Image.h
diff options
context:
space:
mode:
authorTobias Christiansen <tobyase@serenityos.org>2021-09-03 18:46:11 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-04 03:29:09 +0200
commit508d56318931c0d6a3fd077ac2dc9f83bbfe612b (patch)
treec6c6622463638ce495bbb4f2139fc02aeae37333 /Userland/Applications/PixelPaint/Image.h
parentb3f53a0b5a6cb7019f02dd73883435cbb7e1cb1e (diff)
downloadserenity-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.h10
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();