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

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. :^)
This commit is contained in:
Andreas Kling 2022-08-23 21:33:52 +02:00
parent 5ded6904d8
commit 34a09bbb54
5 changed files with 83 additions and 0 deletions

View file

@ -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: