1// Aseprite
2// Copyright (C) 2020 Igara Studio S.A.
3// Copyright (C) 2001-2016 David Capello
4//
5// This program is distributed under the terms of
6// the End-User License Agreement for Aseprite.
7
8#ifndef APP_TOOLS_TOOL_POINT_SHAPE_H_INCLUDED
9#define APP_TOOLS_TOOL_POINT_SHAPE_H_INCLUDED
10#pragma once
11
12#include "app/tools/stroke.h"
13#include "gfx/rect.h"
14
15namespace app {
16 namespace tools {
17 class ToolLoop;
18
19 // Converts a point to a shape to be drawn
20 class PointShape {
21 public:
22 virtual ~PointShape() { }
23 virtual bool isPixel() { return false; }
24 virtual bool isTile() { return false; }
25 virtual bool isFloodFill() { return false; }
26 virtual bool isSpray() { return false; }
27 virtual void preparePointShape(ToolLoop* loop) { }
28
29 // The x, y position must be relative to the cel/src/dst image origin.
30 virtual void transformPoint(ToolLoop* loop, const Stroke::Pt& pt) = 0;
31 virtual void getModifiedArea(ToolLoop* loop, int x, int y, gfx::Rect& area) = 0;
32
33 protected:
34 // Calls loop->getInk()->inkHline() function for each horizontal-scanline
35 // that should be drawn (applying the "tiled" mode loop->getTiledMode())
36 static void doInkHline(int x1, int y, int x2, ToolLoop* loop);
37 };
38
39 } // namespace tools
40} // namespace app
41
42#endif // APP_TOOLS_TOOL_POINT_SHAPE_H_INCLUDED
43