1// Aseprite
2// Copyright (C) 2020-2022 Igara Studio S.A.
3// Copyright (C) 2001-2018 David Capello
4//
5// This program is distributed under the terms of
6// the End-User License Agreement for Aseprite.
7
8#ifndef APP_UI_EDITOR_EDITOR_DECORATOR_H_INCLUDED
9#define APP_UI_EDITOR_EDITOR_DECORATOR_H_INCLUDED
10#pragma once
11
12#include "gfx/color.h"
13#include "gfx/rect.h"
14
15namespace gfx {
16 class Region;
17}
18
19namespace doc {
20 class Image;
21}
22
23namespace ui {
24 class Graphics;
25}
26
27namespace app {
28 class Editor;
29 class EditorDecorator;
30
31 using namespace doc;
32
33 // EditorPostRender is an interface used to draw elements in the
34 // editor's area. It's implemented by the editor and used by a
35 // EditorDecorator.
36 class EditorPostRender {
37 public:
38 virtual ~EditorPostRender() { }
39 virtual Editor* getEditor() = 0;
40 virtual ui::Graphics* getGraphics() = 0;
41 virtual void drawLine(gfx::Color color, int x1, int y1, int x2, int y2) = 0;
42 virtual void drawRect(gfx::Color color, const gfx::Rect& rc) = 0;
43 virtual void fillRect(gfx::Color color, const gfx::Rect& rc) = 0;
44 };
45
46 // Used by editor's states to pre- and post-render customized
47 // decorations depending of the state (e.g. SelectBoxState draws the
48 // selected bounds/canvas area).
49 class EditorDecorator {
50 public:
51 virtual ~EditorDecorator() { }
52 virtual void postRenderDecorator(EditorPostRender* render) = 0;
53 virtual void getInvalidDecoratoredRegion(Editor* editor, gfx::Region& region) = 0;
54 };
55
56} // namespace app
57
58#endif // APP_UI_EDITOR_EDITOR_DECORATOR_H_INCLUDED
59