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

PixelPaint: Include Guides in the ImageEditor

The ImageEditor knows about its Guides, how to draw them and exposes
ways to manipulate them.
This commit is contained in:
Tobias Christiansen 2021-08-01 15:54:26 +02:00 committed by Ali Mohammad Pur
parent 7e01d06226
commit a717caa4b7
2 changed files with 21 additions and 1 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include "Guide.h"
#include "Image.h"
#include "Selection.h"
#include <LibGUI/Frame.h>
@ -38,6 +39,12 @@ public:
bool undo();
bool redo();
void add_guide(NonnullRefPtr<Guide> guide) { m_guides.append(guide); }
void remove_guide(Guide const& guide)
{
m_guides.remove_first_matching([&](auto& entry) { return &guide == entry.ptr(); });
}
void layers_did_change();
Layer* layer_at_editor_position(Gfx::IntPoint const&);
@ -77,6 +84,8 @@ public:
Gfx::FloatPoint image_position_to_editor_position(Gfx::IntPoint const&) const;
Gfx::FloatPoint editor_position_to_image_position(Gfx::IntPoint const&) const;
NonnullRefPtrVector<Guide> const& guides() const { return m_guides; }
private:
explicit ImageEditor(NonnullRefPtr<Image>);
@ -106,6 +115,8 @@ private:
RefPtr<Layer> m_active_layer;
OwnPtr<GUI::UndoStack> m_undo_stack;
NonnullRefPtrVector<Guide> m_guides;
Tool* m_active_tool { nullptr };
Color m_primary_color { Color::Black };