diff options
author | Andreas Kling <kling@serenityos.org> | 2022-08-23 21:33:52 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-08-23 22:39:27 +0200 |
commit | 34a09bbb5410b866e35bb03fcb489a61f4b262b3 (patch) | |
tree | e69f7aeeab726ae14637019f38012cde7a2a5050 /Userland/Applications/PixelPaint/Image.h | |
parent | 5ded6904d8e9b1453548b196f39d09dc20ba3e2b (diff) | |
download | serenity-34a09bbb5410b866e35bb03fcb489a61f4b262b3.zip |
PixelPaint: Add simple "Crop Image to Content" feature
This command finds the smallest non-empty content bounding rect
by looking for the outermost non-transparent pixels in the image,
and then crops the image to that rect.
It's implemented in a pretty naive way, but it's a start. :^)
Diffstat (limited to 'Userland/Applications/PixelPaint/Image.h')
-rw-r--r-- | Userland/Applications/PixelPaint/Image.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Applications/PixelPaint/Image.h b/Userland/Applications/PixelPaint/Image.h index 91ca62612b..c5b5dd49e8 100644 --- a/Userland/Applications/PixelPaint/Image.h +++ b/Userland/Applications/PixelPaint/Image.h @@ -99,6 +99,8 @@ public: void crop(Gfx::IntRect const& rect); void resize(Gfx::IntSize const& new_size, Gfx::Painter::ScalingMode scaling_mode); + Optional<Gfx::IntRect> nonempty_content_bounding_rect() const; + Color color_at(Gfx::IntPoint const& point) const; private: |