PICSimLab - Programmable IC Simulator Laboratory 0.9.2
PICSimLab - API
Loading...
Searching...
No Matches
draw.h
1/* ########################################################################
2
3 PICSimLab - Programmable IC Simulator Laboratory
4
5 ########################################################################
6
7 Copyright (c) : 2010-2024 Luis Claudio GambĂ´a Lopes <lcgamboa@yahoo.com>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23 For e-mail suggestions : lcgamboa@yahoo.com
24 ######################################################################## */
25
26#ifndef PCANVACMD_H
27#define PCANVACMD_H
28
29enum PICSimLabCanvasCmd {
30 CC_INIT,
31 CC_CHANGESCALE,
32 CC_END,
33 CC_SETBITMAP,
34 CC_SETCOLOR,
35 CC_SETFGCOLOR,
36 CC_SETBGCOLOR,
37 CC_SETFONTSIZE,
38 CC_SETFONTWEIGHT,
39 CC_SETLINEWIDTH,
40 CC_POINT,
41 CC_LINE,
42 CC_RECTANGLE,
43 CC_CIRCLE,
44 CC_ROTATEDTEXT,
45 CC_TEXTONRECT,
46 CC_POLYGON,
47 CC_PUTBITMAP,
48 CC_GETBGCOLOR,
49 CC_CREATE,
50 CC_DESTROY,
51 CC_FREEBITMAP,
52 CC_GETBITMAPSIZE,
53 CC_LOADIMAGE,
54 CC_CREATEIMAGE,
55 CC_ARC,
56 CC_ELLIPTICARC,
57 CC_LINES,
58 CC_LAST
59};
60
61#define CC_FONTWEIGHT_BOLD 92
62
63#define CC_ALIGN_LEFT 0x0000
64#define CC_ALIGN_RIGHT 0x0200
65#define CC_ALIGN_CENTER_VERTICAL 0x0800
66#define CC_ALIGN_CENTER 0x0900
67
68#include <string>
69
70#include "board.h"
71
72typedef struct {
73 int x, y, width, height;
74} Rect_t;
75
76typedef struct {
77 int x, y;
78} Point_t;
79
80typedef struct {
81 PICSimLabCanvasCmd cmd;
82 union {
83 struct {
84 const double sx;
85 const double sy;
86 const int angle;
87 } Init;
88 struct {
89 const double sx;
90 const double sy;
91 } ChangeScale;
92 struct {
93 } End;
94 struct {
95 const int BitmapId;
96 const double xs;
97 const double ys;
98 } SetBitmap;
99 struct {
100 const unsigned int r;
101 const unsigned int g;
102 const unsigned int b;
103 } SetColor;
104 struct {
105 const unsigned int r;
106 const unsigned int g;
107 const unsigned int b;
108 } SetFgColor;
109 struct {
110 const unsigned int r;
111 const unsigned int g;
112 const unsigned int b;
113 } SetBgColor;
114 struct {
115 const int pointsize;
116 } SetFontSize;
117 struct {
118 const int weight;
119 } SetFontWeight;
120 struct {
121 const unsigned int lwidth;
122 } SetLineWidth;
123 struct {
124 float x;
125 float y;
126 } Point;
127 struct {
128 float x1;
129 float y1;
130 float x2;
131 float y2;
132 } Line;
133 struct {
134 const bool filled;
135 float x;
136 float y;
137 const float width;
138 const float height;
139 } Rectangle;
140 struct {
141 const bool filled;
142 float x;
143 float y;
144 const float radius;
145 } Circle;
146 struct {
147 const char* str;
148 float x;
149 float y;
150 const float angle;
151 } RotatedText;
152 struct {
153 const char* str;
154 const Rect_t rect;
155 const unsigned int align;
156 } TextOnRect;
157 struct {
158 const bool filled;
159 const Point_t* points;
160 const int npoints;
161 } Polygon;
162 struct {
163 const int BitmapId;
164 float x;
165 float y;
166 } PutBitmap;
167 struct {
168 unsigned int* r;
169 unsigned int* g;
170 unsigned int* b;
171 } GetBgColor;
172 struct {
173 const int BitmapId;
174 } Create;
175 struct {
176 } Destroy;
177 struct {
178 const int BitmapId;
179 } FreeBitmap;
180 struct {
181 const int BitmapId;
182 unsigned int* w;
183 unsigned int* h;
184 } GetBitmapSize;
185 struct {
186 const char* fname;
187 const float scale;
188 const int usealpha;
189 const int orientation;
190 } LoadImage;
191 struct {
192 const unsigned int width;
193 const unsigned int height;
194 const float scale;
195 const int usealpha;
196 const int orientation;
197 } CreateImage;
198 struct {
199 bool filled;
200 float x1;
201 float y1;
202 float x2;
203 float y2;
204 float xc;
205 float yc;
206 } Arc;
207 struct {
208 bool filled;
209 float x;
210 float y;
211 float width;
212 float height;
213 double start;
214 double end;
215 } EllipticArc;
216 struct {
217 const Point_t* points;
218 const int npoints;
219 } Lines;
220 };
222
223typedef int (*CanvasCmd_ft)(CanvasCmd_t);
224
225// Draw Functions
226void DrawLED(CanvasCmd_ft CanvasCmd, const output_t* output);
227void DrawSlider(CanvasCmd_ft CanvasCmd, const output_t* output, const unsigned char pos, const std::string val,
228 const int FontPointSize);
229void DrawPotentiometer(CanvasCmd_ft CanvasCmd, const output_t* output, const unsigned char pos, const std::string val,
230 const int FontPointSize);
231
232#endif // PCANVACMD_H
Definition draw.h:80
Definition draw.h:76
Definition draw.h:72
output map struct
Definition board.h:68