PICSimLab - Programmable IC Simulator Laboratory 0.9.3
PICSimLab - API
Loading...
Searching...
No Matches
draw.h
1/* ########################################################################
2
3 PICSimLab - Programmable IC Simulator Laboratory
4
5 ########################################################################
6
7 Copyright (c) : 2010-2026 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_DELETE,
52 CC_FREEBITMAP,
53 CC_GETBITMAPSIZE,
54 CC_LOADIMAGE,
55 CC_CREATEIMAGE,
56 CC_ARC,
57 CC_ELLIPTICARC,
58 CC_LINES,
59 CC_LAST
60};
61
62#define CC_FONTWEIGHT_BOLD 92
63
64#define CC_ALIGN_LEFT 0x0000
65#define CC_ALIGN_RIGHT 0x0200
66#define CC_ALIGN_CENTER_VERTICAL 0x0800
67#define CC_ALIGN_CENTER 0x0900
68
69#include <string>
70
71#include "board.h"
72
73typedef struct {
74 int x, y, width, height;
75} Rect_t;
76
77typedef struct {
78 int x, y;
79} Point_t;
80
81typedef struct {
82 int partn;
83 PICSimLabCanvasCmd cmd;
84 union {
85 struct {
86 const double sx;
87 const double sy;
88 const int angle;
89 } Init;
90 struct {
91 const double sx;
92 const double sy;
93 } ChangeScale;
94 struct {
95 } End;
96 struct {
97 const int BitmapId;
98 const double xs;
99 const double ys;
100 } SetBitmap;
101 struct {
102 const unsigned int r;
103 const unsigned int g;
104 const unsigned int b;
105 } SetColor;
106 struct {
107 const unsigned int r;
108 const unsigned int g;
109 const unsigned int b;
110 } SetFgColor;
111 struct {
112 const unsigned int r;
113 const unsigned int g;
114 const unsigned int b;
115 } SetBgColor;
116 struct {
117 const int pointsize;
118 } SetFontSize;
119 struct {
120 const int weight;
121 } SetFontWeight;
122 struct {
123 const unsigned int lwidth;
124 } SetLineWidth;
125 struct {
126 float x;
127 float y;
128 } Point;
129 struct {
130 float x1;
131 float y1;
132 float x2;
133 float y2;
134 } Line;
135 struct {
136 const bool filled;
137 float x;
138 float y;
139 const float width;
140 const float height;
141 } Rectangle;
142 struct {
143 const bool filled;
144 float x;
145 float y;
146 const float radius;
147 } Circle;
148 struct {
149 const char* str;
150 float x;
151 float y;
152 const float angle;
153 } RotatedText;
154 struct {
155 const char* str;
156 const Rect_t rect;
157 const unsigned int align;
158 } TextOnRect;
159 struct {
160 const bool filled;
161 const Point_t* points;
162 const int npoints;
163 } Polygon;
164 struct {
165 const int BitmapId;
166 float x;
167 float y;
168 } PutBitmap;
169 struct {
170 unsigned int* r;
171 unsigned int* g;
172 unsigned int* b;
173 } GetBgColor;
174 struct {
175 const int BitmapId;
176 } Create;
177 struct {
178 } Destroy;
179 struct {
180 } Delete;
181 struct {
182 const int BitmapId;
183 } FreeBitmap;
184 struct {
185 const int BitmapId;
186 unsigned int* w;
187 unsigned int* h;
188 } GetBitmapSize;
189 struct {
190 const char* fname;
191 const float scale;
192 const int usealpha;
193 const int orientation;
194 } LoadImage;
195 struct {
196 const unsigned int width;
197 const unsigned int height;
198 const float scale;
199 const int usealpha;
200 const int orientation;
201 } CreateImage;
202 struct {
203 bool filled;
204 float x1;
205 float y1;
206 float x2;
207 float y2;
208 float xc;
209 float yc;
210 } Arc;
211 struct {
212 bool filled;
213 float x;
214 float y;
215 float width;
216 float height;
217 double start;
218 double end;
219 } EllipticArc;
220 struct {
221 const Point_t* points;
222 const int npoints;
223 } Lines;
224 };
226
227typedef int (*CanvasCmd_ft)(const CanvasCmd_t);
228
229// Draw Functions
230void DrawLED(int partn, CanvasCmd_ft CanvasCmd, const output_t* output);
231void DrawSlider(int partn, CanvasCmd_ft CanvasCmd, const output_t* output, const unsigned char pos,
232 const std::string val, const int FontPointSize);
233void DrawPotentiometer(int partn, CanvasCmd_ft CanvasCmd, const output_t* output, const unsigned char pos,
234 const std::string val, const int FontPointSize);
235
236#endif // PCANVACMD_H
Definition draw.h:81
Definition draw.h:77
Definition draw.h:73
output map struct
Definition board.h:68