Libraries/Graphics/src/include/Graphics/Drawing/Command.h
Go to the documentation of this file.
1 /****
2  * Command.h
3  *
4  * Copyright 2021 mikee47 <mike@sillyhouse.net>
5  *
6  * This file is part of the Sming-Graphics Library
7  *
8  * This library is free software: you can redistribute it and/or modify it under the terms of the
9  * GNU General Public License as published by the Free Software Foundation, version 3 or later.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with this library.
16  * If not, see <https://www.gnu.org/licenses/>.
17  *
18  * @author: May 2021 - mikee47 <mike@sillyhouse.net>
19  *
20  ****/
21 
22 #pragma once
23 
24 #include <WString.h>
25 
26 namespace Graphics
27 {
28 namespace Drawing
29 {
56 // Command, arg, description
57 #define GRAPHICS_DRAWING_COMMAND_MAP(XX) \
58  XX(reset, "", "Reset registers to default") \
59  XX(push, "", "Push all registers to stack") \
60  XX(pop, "", "Pop all registers from stack") \
61  XX(storePen, "id", "Store penColor and width to slot") \
62  XX(storeBrush, "id", "Store brushColor to slot") \
63  XX(incx, "pt2", "++x2") \
64  XX(decx, "pt2", "--x2") \
65  XX(incy, "pt2", "++y2") \
66  XX(decy, "pt2", "--y2") \
67  XX(move, "pt1, pt2", "Set pt2 = pt1") \
68  XX(setPixel, "pt2", "Set pixel colour") \
69  XX(line, "pt1, pt2, penId", "Draw line") \
70  XX(lineto, "pt1, pt2, penId", "Draw line then set pt1 = pt2") \
71  XX(drawRect, "pt1, pt2, radius, penId", "Draw rect with optional rounded corners") \
72  XX(fillRect, "pt1, pt2, radius, brushId", "Fill rect with optional rounded corners") \
73  XX(drawEllipse, "pt1, pt2, penId", "Draw ellipse within rectangle") \
74  XX(fillEllipse, "pt1, pt2, brushId", "Fill ellipse within rectangle") \
75  XX(drawArc, "pt1, pt2, startAngle, endAngle, penId", "Draw arc within rectangle from startAngle -> endAngle") \
76  XX(fillArc, "pt1, pt2, startAngle, endAngle, brushId", "Fill arc within rectangle from startAngle -> endAngle") \
77  XX(drawCircle, "pt2, radius, penId", "Draw circle centred at pt2 with radius") \
78  XX(fillCircle, "pt2, radius, brushId", "Draw circle centred at pt2 with radius") \
79  XX(beginSub, "id", "Start a subroutine") \
80  XX(endSub, "", "End a subroutine") \
81  XX(call, "id", "Call a subroutine") \
82  XX(drawText, "id", "Draw text asset from offset to length")
83 
84 enum class Command : uint8_t {
85 #define XX(cmd, args, desc) cmd,
87 #undef XX
88 };
89 
90 } // namespace Drawing
91 } // namespace Graphics
92 
#define GRAPHICS_DRAWING_COMMAND_MAP(XX)
Drawing operations.
Definition: Libraries/Graphics/src/include/Graphics/Drawing/Command.h:95
Command
Definition: Libraries/Graphics/src/include/Graphics/Drawing/Command.h:122
The String class.
Definition: WString.h:136
String toString(Graphics::Drawing::Command cmd)
Definition: Virtual.h:30