1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 07:38:10 +00:00

PixelPaint: Display an error message if exporting to PNG/BMP fails

This commit is contained in:
Andreas Kling 2021-06-15 11:30:34 +02:00
parent ba807c2d44
commit 91100f2f94
3 changed files with 53 additions and 27 deletions

View file

@ -41,6 +41,9 @@ public:
static Result<NonnullRefPtr<Image>, String> try_create_from_file(String const& file_path);
static RefPtr<Image> try_create_from_bitmap(NonnullRefPtr<Gfx::Bitmap>);
// This generates a new Bitmap with the final image (all layers composed according to their attributes.)
RefPtr<Gfx::Bitmap> try_compose_bitmap() const;
size_t layer_count() const { return m_layers.size(); }
Layer const& layer(size_t index) const { return m_layers.at(index); }
Layer& layer(size_t index) { return m_layers.at(index); }
@ -52,10 +55,10 @@ public:
RefPtr<Image> take_snapshot() const;
void restore_snapshot(Image const&);
void paint_into(GUI::Painter&, Gfx::IntRect const& dest_rect);
void paint_into(GUI::Painter&, Gfx::IntRect const& dest_rect) const;
Result<void, String> write_to_file(String const& file_path) const;
void export_bmp(String const& file_path);
void export_png(String const& file_path);
Result<void, String> export_bmp_to_file(String const& file_path);
Result<void, String> export_png_to_file(String const& file_path);
void move_layer_to_front(Layer&);
void move_layer_to_back(Layer&);