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

PixelPaint: Add a Selection class (ImageEditor has a Selection)

This will represent a complex, region-based selection in the future.
For now though, it's just a simple rectangle. :^)
This commit is contained in:
Andreas Kling 2021-06-14 17:36:18 +02:00
parent 96b52f13e4
commit 1b897ec561
6 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGfx/Rect.h>
namespace PixelPaint {
class ImageEditor;
// Coordinates are image-relative.
class Selection {
public:
Selection() { }
bool is_empty() const { return m_rect.is_empty(); }
void clear() { m_rect = {}; }
void set(Gfx::IntRect const& rect) { m_rect = rect; }
void paint(Gfx::Painter&, ImageEditor const&);
private:
Gfx::IntRect m_rect;
};
}