22 class ImageShapeAttributes :
public Serializable
25 static constexpr unsigned char DefaultThickness = 2;
31 unsigned char thickness = DefaultThickness;
33 ImageShapeAttributes(
RGBA color,
unsigned char lw) noexcept
34 :
rgba(std::move(color))
40 : rgba(std::move(color))
44 explicit ImageShapeAttributes(RGB color) noexcept
45 : rgba(std::move(color))
51 writer.Write(
"c",
rgba);
67 bool operator!=(
const ImageShapeAttributes& c)
const
73#if defined SWIGPYTHON || defined SWIGRUBY
77 static const ImageShapeAttributes ShapesInnoBlue = ImageShapeAttributes(Colors::InnoBlue);
78 static const ImageShapeAttributes ShapesWhite = ImageShapeAttributes(Colors::White);
79 static const ImageShapeAttributes ShapesLightGray = ImageShapeAttributes(Colors::LightGray);
96 Shapes(
const Shapes&) =
delete;
97 Shapes(Shapes&&) =
delete;
98 Shapes& operator=(
const Shapes&) =
delete;
99 Shapes& operator=(Shapes&&) =
delete;
108 class ImageShapeDrawer
130 ImageShapeDrawer() =
default;
131 ImageShapeDrawer(
const ImageShapeDrawer&) =
delete;
132 ImageShapeDrawer(ImageShapeDrawer&&) =
delete;
133 ImageShapeDrawer& operator=(
const ImageShapeDrawer&) =
delete;
134 ImageShapeDrawer& operator=(ImageShapeDrawer&&) =
delete;
135 virtual ~ImageShapeDrawer() =
default;
151 ImageShape() =
default;
152 ImageShape(
const ImageShape&) =
delete;
153 ImageShape(ImageShape&&) =
delete;
154 ImageShape& operator=(
const ImageShape&) =
delete;
155 ImageShape& operator=(ImageShape&&) =
delete;
156 virtual ~ImageShape() =
default;
173 drawer.DrawRectangle(rect, a);
182 : rect(std::move(rectangle))
205 for (
const auto& r : rectangles)
208 rectangleShape.DrawIn(drawer);
218 : rectangles(std::move(r))
224 std::vector<Rectangle> rectangles;
241 drawer.DrawCircle(circ, a);
250 : circ(std::move(circle))
264 class LineShape final :
public ImageShape
273 drawer.DrawLine(ln, a);
282 : ln(std::move(line))
CircleShape(Circle circle, ImageShapeAttributes attr)
Constructor sets given circle for drawing.
Definition ImageShape.h:248
void DrawIn(ImageShapeDrawer &drawer) const final
It draws circle in ImageShapeDrawer.
Definition ImageShape.h:238
It holds circle dimensions.
Definition ImageAttribute.h:691
It holds shape attributes such as color and line width.
Definition ImageShape.h:22
void WriteTo(Writer &writer) const final
Write itself into writer.
Definition ImageShape.h:48
unsigned char thickness
Line thickness in pixels.
Definition ImageShape.h:30
RGBA rgba
RGBA color.
Definition ImageShape.h:28
It is used by ImageShape to draw its shape.
Definition ImageShape.h:108
virtual void DrawLine(const Line &line, const ImageShapeAttributes &attr)=0
Draws line.
virtual void DrawRectangle(const Rectangle &rectangle, const ImageShapeAttributes &attr)=0
Draws rectangle.
virtual void DrawCircle(const Circle &circle, const ImageShapeAttributes &attr)=0
Draws circle.
virtual void DrawIn(ImageShapeDrawer &drawer) const =0
It draws shape in ImageShapeDrawer.
void DrawIn(ImageShapeDrawer &drawer) const final
It draws line in ImageShapeDrawer.
Definition ImageShape.h:270
LineShape(Line line, ImageShapeAttributes attr)
Constructor sets given line for drawing.
Definition ImageShape.h:280
It holds line points.
Definition ImageAttribute.h:615
It holds RGB color with transparency.
Definition ImageAttribute.h:908
It holds rectangle and draws it.
Definition ImageShape.h:163
RectangleShape(Rectangle rectangle, ImageShapeAttributes attr)
Constructor sets given rectangle for drawing.
Definition ImageShape.h:180
void DrawIn(ImageShapeDrawer &drawer) const final
It draws rectangle in ImageShapeDrawer.
Definition ImageShape.h:170
It holds rectangle vertexes, width, height.
Definition ImageAttribute.h:357
RectanglesShape(std::vector< Rectangle > r, ImageShapeAttributes attr)
Construct a new Rectangles object.
Definition ImageShape.h:216
void DrawIn(ImageShapeDrawer &drawer) const final
It draws all rectangles at once in ImageShapeDrawer.
Definition ImageShape.h:202
Provides interface for serialization of all classes.
Definition Writer.h:164