1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 00:37:35 +00:00

PixelPaint: Correctly apply flip/rotate/crop to layers' alpha mask

-Layer now has methods for flip/rotate/crop, which are responsible
for handling the alpha mask.
-Fixed crash when the display image size is out of sync with
the content image size.
-Changed API for setting content and mask image in Layer. Now, both
must be set at the same time, and it can result in an error if
you provide mismatched dimensions.
This commit is contained in:
Andrew Smith 2022-03-12 12:48:05 -06:00 committed by Andreas Kling
parent 03342876b8
commit 297e095755
3 changed files with 42 additions and 21 deletions

View file

@ -53,8 +53,11 @@ public:
String const& name() const { return m_name; }
void set_name(String);
void set_content_bitmap(NonnullRefPtr<Gfx::Bitmap> bitmap);
void set_mask_bitmap(NonnullRefPtr<Gfx::Bitmap> bitmap);
void flip(Gfx::Orientation orientation);
void rotate(Gfx::RotationDirection direction);
void crop(Gfx::IntRect const& rect);
ErrorOr<void> try_set_bitmaps(NonnullRefPtr<Gfx::Bitmap> content, RefPtr<Gfx::Bitmap> mask);
void did_modify_bitmap(Gfx::IntRect const& = {});