1 |
610 |
jeremybenn |
//*****************************************************************************
|
2 |
|
|
//
|
3 |
|
|
// grlib.h - Prototypes for the low level primitives provided by the graphics
|
4 |
|
|
// library.
|
5 |
|
|
//
|
6 |
|
|
// Copyright (c) 2007-2008 Luminary Micro, Inc. All rights reserved.
|
7 |
|
|
//
|
8 |
|
|
// Software License Agreement
|
9 |
|
|
//
|
10 |
|
|
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
|
11 |
|
|
// exclusively on LMI's microcontroller products.
|
12 |
|
|
//
|
13 |
|
|
// The software is owned by LMI and/or its suppliers, and is protected under
|
14 |
|
|
// applicable copyright laws. All rights are reserved. You may not combine
|
15 |
|
|
// this software with "viral" open-source software in order to form a larger
|
16 |
|
|
// program. Any use in violation of the foregoing restrictions may subject
|
17 |
|
|
// the user to criminal sanctions under applicable laws, as well as to civil
|
18 |
|
|
// liability for the breach of the terms and conditions of this license.
|
19 |
|
|
//
|
20 |
|
|
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
21 |
|
|
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
22 |
|
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
23 |
|
|
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
24 |
|
|
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
25 |
|
|
//
|
26 |
|
|
// This is part of revision 2523 of the Stellaris Graphics Library.
|
27 |
|
|
//
|
28 |
|
|
//*****************************************************************************
|
29 |
|
|
|
30 |
|
|
#ifndef __GRLIB_H__
|
31 |
|
|
#define __GRLIB_H__
|
32 |
|
|
|
33 |
|
|
//*****************************************************************************
|
34 |
|
|
//
|
35 |
|
|
//! \addtogroup primitives_api
|
36 |
|
|
//! @{
|
37 |
|
|
//
|
38 |
|
|
//*****************************************************************************
|
39 |
|
|
|
40 |
|
|
//*****************************************************************************
|
41 |
|
|
//
|
42 |
|
|
// If building with a C++ compiler, make all of the definitions in this header
|
43 |
|
|
// have a C binding.
|
44 |
|
|
//
|
45 |
|
|
//*****************************************************************************
|
46 |
|
|
#ifdef __cplusplus
|
47 |
|
|
extern "C"
|
48 |
|
|
{
|
49 |
|
|
#endif
|
50 |
|
|
|
51 |
|
|
//*****************************************************************************
|
52 |
|
|
//
|
53 |
|
|
//! This structure defines the extents of a rectangle. All points greater than
|
54 |
|
|
//! or equal to the minimum and less than or equal to the maximum are part of
|
55 |
|
|
//! the rectangle.
|
56 |
|
|
//
|
57 |
|
|
//*****************************************************************************
|
58 |
|
|
typedef struct
|
59 |
|
|
{
|
60 |
|
|
//
|
61 |
|
|
//! The minimum X coordinate of the rectangle.
|
62 |
|
|
//
|
63 |
|
|
short sXMin;
|
64 |
|
|
|
65 |
|
|
//
|
66 |
|
|
//! The minimum Y coordinate of the rectangle.
|
67 |
|
|
//
|
68 |
|
|
short sYMin;
|
69 |
|
|
|
70 |
|
|
//
|
71 |
|
|
//! The maximum X coordinate of the rectangle.
|
72 |
|
|
//
|
73 |
|
|
short sXMax;
|
74 |
|
|
|
75 |
|
|
//
|
76 |
|
|
//! The maximum Y coordinate of the rectangle.
|
77 |
|
|
//
|
78 |
|
|
short sYMax;
|
79 |
|
|
}
|
80 |
|
|
tRectangle;
|
81 |
|
|
|
82 |
|
|
//*****************************************************************************
|
83 |
|
|
//
|
84 |
|
|
//! This structure defines the characteristics of a display driver.
|
85 |
|
|
//
|
86 |
|
|
//*****************************************************************************
|
87 |
|
|
typedef struct
|
88 |
|
|
{
|
89 |
|
|
//
|
90 |
|
|
//! The size of this structure.
|
91 |
|
|
//
|
92 |
|
|
long lSize;
|
93 |
|
|
|
94 |
|
|
//
|
95 |
|
|
//! A pointer to display driver-specific data.
|
96 |
|
|
//
|
97 |
|
|
void *pvDisplayData;
|
98 |
|
|
|
99 |
|
|
//
|
100 |
|
|
//! The width of this display.
|
101 |
|
|
//
|
102 |
|
|
unsigned short usWidth;
|
103 |
|
|
|
104 |
|
|
//
|
105 |
|
|
//! The height of this display.
|
106 |
|
|
//
|
107 |
|
|
unsigned short usHeight;
|
108 |
|
|
|
109 |
|
|
//
|
110 |
|
|
//! A pointer to the function to draw a pixel on this display.
|
111 |
|
|
//
|
112 |
|
|
void (*pfnPixelDraw)(void *pvDisplayData, long lX, long lY,
|
113 |
|
|
unsigned long ulValue);
|
114 |
|
|
|
115 |
|
|
//
|
116 |
|
|
//! A pointer to the function to draw multiple pixels on this display.
|
117 |
|
|
//
|
118 |
|
|
void (*pfnPixelDrawMultiple)(void *pvDisplayData, long lX, long lY,
|
119 |
|
|
long lX0, long lCount, long lBPP,
|
120 |
|
|
const unsigned char *pucData,
|
121 |
|
|
const unsigned char *pucPalette);
|
122 |
|
|
|
123 |
|
|
//
|
124 |
|
|
//! A pointer to the function to draw a horizontal line on this display.
|
125 |
|
|
//
|
126 |
|
|
void (*pfnLineDrawH)(void *pvDisplayData, long lX1, long lX2, long lY,
|
127 |
|
|
unsigned long ulValue);
|
128 |
|
|
|
129 |
|
|
//
|
130 |
|
|
//! A pointer to the function to draw a vertical line on this display.
|
131 |
|
|
//
|
132 |
|
|
void (*pfnLineDrawV)(void *pvDisplayData, long lX, long lY1, long lY2,
|
133 |
|
|
unsigned long ulValue);
|
134 |
|
|
|
135 |
|
|
//
|
136 |
|
|
//! A pointer to the function to draw a filled rectangle on this display.
|
137 |
|
|
//
|
138 |
|
|
void (*pfnRectFill)(void *pvDisplayData, const tRectangle *pRect,
|
139 |
|
|
unsigned long ulValue);
|
140 |
|
|
|
141 |
|
|
//
|
142 |
|
|
//! A pointer to the function to translate 24-bit RGB colors to
|
143 |
|
|
//! display-specific colors.
|
144 |
|
|
//
|
145 |
|
|
unsigned long (*pfnColorTranslate)(void *pvDisplayData,
|
146 |
|
|
unsigned long ulValue);
|
147 |
|
|
|
148 |
|
|
//
|
149 |
|
|
//! A pointer to the function to flush any cached drawing operations on
|
150 |
|
|
//! this display.
|
151 |
|
|
//
|
152 |
|
|
void (*pfnFlush)(void *pvDisplayData);
|
153 |
|
|
}
|
154 |
|
|
tDisplay;
|
155 |
|
|
|
156 |
|
|
//*****************************************************************************
|
157 |
|
|
//
|
158 |
|
|
//! This structure describes a font used for drawing text onto the screen.
|
159 |
|
|
//
|
160 |
|
|
//*****************************************************************************
|
161 |
|
|
typedef struct
|
162 |
|
|
{
|
163 |
|
|
//
|
164 |
|
|
//! The format of the font. Can be one of FONT_FMT_UNCOMPRESSED or
|
165 |
|
|
//! FONT_FMT_PIXEL_RLE.
|
166 |
|
|
//
|
167 |
|
|
unsigned char ucFormat;
|
168 |
|
|
|
169 |
|
|
//
|
170 |
|
|
//! The maximum width of a character; this is the width of the widest
|
171 |
|
|
//! character in the font, though any individual character may be narrower
|
172 |
|
|
//! than this width.
|
173 |
|
|
//
|
174 |
|
|
unsigned char ucMaxWidth;
|
175 |
|
|
|
176 |
|
|
//
|
177 |
|
|
//! The height of the character cell; this may be taller than the font data
|
178 |
|
|
//! for the characters (to provide inter-line spacing).
|
179 |
|
|
//
|
180 |
|
|
unsigned char ucHeight;
|
181 |
|
|
|
182 |
|
|
//
|
183 |
|
|
//! The offset between the top of the character cell and the baseline of
|
184 |
|
|
//! the glyph. The baseline is the bottom row of a capital letter, below
|
185 |
|
|
//! which only the descenders of the lower case letters occur.
|
186 |
|
|
//
|
187 |
|
|
unsigned char ucBaseline;
|
188 |
|
|
|
189 |
|
|
//
|
190 |
|
|
//! The offset within pucData to the data for each character in the font.
|
191 |
|
|
//
|
192 |
|
|
unsigned short pusOffset[96];
|
193 |
|
|
|
194 |
|
|
//
|
195 |
|
|
//! A pointer to the data for the font.
|
196 |
|
|
//
|
197 |
|
|
const unsigned char *pucData;
|
198 |
|
|
}
|
199 |
|
|
tFont;
|
200 |
|
|
|
201 |
|
|
//*****************************************************************************
|
202 |
|
|
//
|
203 |
|
|
//! Indicates that the font data is stored in an uncompressed format.
|
204 |
|
|
//
|
205 |
|
|
//*****************************************************************************
|
206 |
|
|
#define FONT_FMT_UNCOMPRESSED 0x00
|
207 |
|
|
|
208 |
|
|
//*****************************************************************************
|
209 |
|
|
//
|
210 |
|
|
//! Indicates that the font data is stored using a pixel-based RLE format.
|
211 |
|
|
//
|
212 |
|
|
//*****************************************************************************
|
213 |
|
|
#define FONT_FMT_PIXEL_RLE 0x01
|
214 |
|
|
|
215 |
|
|
//*****************************************************************************
|
216 |
|
|
//
|
217 |
|
|
//! Indicates that the image data is not compressed and represents each pixel
|
218 |
|
|
//! with a single bit.
|
219 |
|
|
//
|
220 |
|
|
//*****************************************************************************
|
221 |
|
|
#define IMAGE_FMT_1BPP_UNCOMP 0x01
|
222 |
|
|
|
223 |
|
|
//*****************************************************************************
|
224 |
|
|
//
|
225 |
|
|
//! Indicates that the image data is not compressed and represents each pixel
|
226 |
|
|
//! with four bits.
|
227 |
|
|
//
|
228 |
|
|
//*****************************************************************************
|
229 |
|
|
#define IMAGE_FMT_4BPP_UNCOMP 0x04
|
230 |
|
|
|
231 |
|
|
//*****************************************************************************
|
232 |
|
|
//
|
233 |
|
|
//! Indicates that the image data is not compressed and represents each pixel
|
234 |
|
|
//! with eight bits.
|
235 |
|
|
//
|
236 |
|
|
//*****************************************************************************
|
237 |
|
|
#define IMAGE_FMT_8BPP_UNCOMP 0x08
|
238 |
|
|
|
239 |
|
|
//*****************************************************************************
|
240 |
|
|
//
|
241 |
|
|
//! Indicates that the image data is compressed and represents each pixel with
|
242 |
|
|
//! a single bit.
|
243 |
|
|
//
|
244 |
|
|
//*****************************************************************************
|
245 |
|
|
#define IMAGE_FMT_1BPP_COMP 0x81
|
246 |
|
|
|
247 |
|
|
//*****************************************************************************
|
248 |
|
|
//
|
249 |
|
|
//! Indicates that the image data is compressed and represents each pixel with
|
250 |
|
|
//! four bits.
|
251 |
|
|
//
|
252 |
|
|
//*****************************************************************************
|
253 |
|
|
#define IMAGE_FMT_4BPP_COMP 0x84
|
254 |
|
|
|
255 |
|
|
//*****************************************************************************
|
256 |
|
|
//
|
257 |
|
|
//! Indicates that the image data is compressed and represents each pixel with
|
258 |
|
|
//! eight bits.
|
259 |
|
|
//
|
260 |
|
|
//*****************************************************************************
|
261 |
|
|
#define IMAGE_FMT_8BPP_COMP 0x88
|
262 |
|
|
|
263 |
|
|
//*****************************************************************************
|
264 |
|
|
//
|
265 |
|
|
//! This structure defines a drawing context to be used to draw onto the
|
266 |
|
|
//! screen. Multiple drawing contexts may exist at any time.
|
267 |
|
|
//
|
268 |
|
|
//*****************************************************************************
|
269 |
|
|
typedef struct
|
270 |
|
|
{
|
271 |
|
|
//
|
272 |
|
|
//! The size of this structure.
|
273 |
|
|
//
|
274 |
|
|
long lSize;
|
275 |
|
|
|
276 |
|
|
//
|
277 |
|
|
//! The screen onto which drawing operations are performed.
|
278 |
|
|
//
|
279 |
|
|
const tDisplay *pDisplay;
|
280 |
|
|
|
281 |
|
|
//
|
282 |
|
|
//! The clipping region to be used when drawing onto the screen.
|
283 |
|
|
//
|
284 |
|
|
tRectangle sClipRegion;
|
285 |
|
|
|
286 |
|
|
//
|
287 |
|
|
//! The color used to draw primitives onto the screen.
|
288 |
|
|
//
|
289 |
|
|
unsigned long ulForeground;
|
290 |
|
|
|
291 |
|
|
//
|
292 |
|
|
//! The background color used to draw primitives onto the screen.
|
293 |
|
|
//
|
294 |
|
|
unsigned long ulBackground;
|
295 |
|
|
|
296 |
|
|
//
|
297 |
|
|
//! The font used to render text onto the screen.
|
298 |
|
|
//
|
299 |
|
|
const tFont *pFont;
|
300 |
|
|
}
|
301 |
|
|
tContext;
|
302 |
|
|
|
303 |
|
|
//*****************************************************************************
|
304 |
|
|
//
|
305 |
|
|
//! Sets the background color to be used.
|
306 |
|
|
//!
|
307 |
|
|
//! \param pContext is a pointer to the drawing context to modify.
|
308 |
|
|
//! \param ulValue is the 24-bit RGB color to be used.
|
309 |
|
|
//!
|
310 |
|
|
//! This function sets the background color to be used for drawing operations
|
311 |
|
|
//! in the specified drawing context.
|
312 |
|
|
//!
|
313 |
|
|
//! \return None.
|
314 |
|
|
//
|
315 |
|
|
//*****************************************************************************
|
316 |
|
|
#define GrContextBackgroundSet(pContext, ulValue) \
|
317 |
|
|
do \
|
318 |
|
|
{ \
|
319 |
|
|
tContext *pC = pContext; \
|
320 |
|
|
pC->ulBackground = DpyColorTranslate(pC->pDisplay, ulValue); \
|
321 |
|
|
} \
|
322 |
|
|
while(0)
|
323 |
|
|
|
324 |
|
|
//*****************************************************************************
|
325 |
|
|
//
|
326 |
|
|
//! Sets the background color to be used.
|
327 |
|
|
//!
|
328 |
|
|
//! \param pContext is a pointer to the drawing context to modify.
|
329 |
|
|
//! \param ulValue is the display driver-specific color to be used.
|
330 |
|
|
//!
|
331 |
|
|
//! This function sets the background color to be used for drawing operations
|
332 |
|
|
//! in the specified drawing context, using a color that has been previously
|
333 |
|
|
//! translated to a driver-specific color (for example, via
|
334 |
|
|
//! DpyColorTranslate()).
|
335 |
|
|
//!
|
336 |
|
|
//! \return None.
|
337 |
|
|
//
|
338 |
|
|
//*****************************************************************************
|
339 |
|
|
#define GrContextBackgroundSetTranslated(pContext, ulValue) \
|
340 |
|
|
do \
|
341 |
|
|
{ \
|
342 |
|
|
tContext *pC = pContext; \
|
343 |
|
|
pC->ulBackground = ulValue; \
|
344 |
|
|
} \
|
345 |
|
|
while(0)
|
346 |
|
|
|
347 |
|
|
//*****************************************************************************
|
348 |
|
|
//
|
349 |
|
|
//! Gets the width of the display being used by this drawing context.
|
350 |
|
|
//!
|
351 |
|
|
//! \param pContext is a pointer to the drawing context to query.
|
352 |
|
|
//!
|
353 |
|
|
//! This function returns the width of the display that is being used by this
|
354 |
|
|
//! drawing context.
|
355 |
|
|
//!
|
356 |
|
|
//! \return Returns the width of the display in pixels.
|
357 |
|
|
//
|
358 |
|
|
//*****************************************************************************
|
359 |
|
|
#define GrContextDpyWidthGet(pContext) \
|
360 |
|
|
(DpyWidthGet((pContext)->pDisplay))
|
361 |
|
|
|
362 |
|
|
//*****************************************************************************
|
363 |
|
|
//
|
364 |
|
|
//! Gets the height of the display being used by this drawing context.
|
365 |
|
|
//!
|
366 |
|
|
//! \param pContext is a pointer to the drawing context to query.
|
367 |
|
|
//!
|
368 |
|
|
//! This function returns the height of the display that is being used by this
|
369 |
|
|
//! drawing context.
|
370 |
|
|
//!
|
371 |
|
|
//! \return Returns the height of the display in pixels.
|
372 |
|
|
//
|
373 |
|
|
//*****************************************************************************
|
374 |
|
|
#define GrContextDpyHeightGet(pContext) \
|
375 |
|
|
(DpyHeightGet((pContext)->pDisplay))
|
376 |
|
|
|
377 |
|
|
//*****************************************************************************
|
378 |
|
|
//
|
379 |
|
|
//! Sets the font to be used.
|
380 |
|
|
//!
|
381 |
|
|
//! \param pContext is a pointer to the drawing context to modify.
|
382 |
|
|
//! \param pFnt is a pointer to the font to be used.
|
383 |
|
|
//!
|
384 |
|
|
//! This function sets the font to be used for string drawing operations in the
|
385 |
|
|
//! specified drawing context.
|
386 |
|
|
//!
|
387 |
|
|
//! \return None.
|
388 |
|
|
//
|
389 |
|
|
//*****************************************************************************
|
390 |
|
|
#define GrContextFontSet(pContext, pFnt) \
|
391 |
|
|
do \
|
392 |
|
|
{ \
|
393 |
|
|
tContext *pC = pContext; \
|
394 |
|
|
const tFont *pF = pFnt; \
|
395 |
|
|
pC->pFont = pF; \
|
396 |
|
|
} \
|
397 |
|
|
while(0)
|
398 |
|
|
|
399 |
|
|
//*****************************************************************************
|
400 |
|
|
//
|
401 |
|
|
//! Sets the foreground color to be used.
|
402 |
|
|
//!
|
403 |
|
|
//! \param pContext is a pointer to the drawing context to modify.
|
404 |
|
|
//! \param ulValue is the 24-bit RGB color to be used.
|
405 |
|
|
//!
|
406 |
|
|
//! This function sets the color to be used for drawing operations in the
|
407 |
|
|
//! specified drawing context.
|
408 |
|
|
//!
|
409 |
|
|
//! \return None.
|
410 |
|
|
//
|
411 |
|
|
//*****************************************************************************
|
412 |
|
|
#define GrContextForegroundSet(pContext, ulValue) \
|
413 |
|
|
do \
|
414 |
|
|
{ \
|
415 |
|
|
tContext *pC = pContext; \
|
416 |
|
|
pC->ulForeground = DpyColorTranslate(pC->pDisplay, ulValue); \
|
417 |
|
|
} \
|
418 |
|
|
while(0)
|
419 |
|
|
|
420 |
|
|
//*****************************************************************************
|
421 |
|
|
//
|
422 |
|
|
//! Sets the foreground color to be used.
|
423 |
|
|
//!
|
424 |
|
|
//! \param pContext is a pointer to the drawing context to modify.
|
425 |
|
|
//! \param ulValue is the display driver-specific color to be used.
|
426 |
|
|
//!
|
427 |
|
|
//! This function sets the foreground color to be used for drawing operations
|
428 |
|
|
//! in the specified drawing context, using a color that has been previously
|
429 |
|
|
//! translated to a driver-specific color (for example, via
|
430 |
|
|
//! DpyColorTranslate()).
|
431 |
|
|
//!
|
432 |
|
|
//! \return None.
|
433 |
|
|
//
|
434 |
|
|
//*****************************************************************************
|
435 |
|
|
#define GrContextForegroundSetTranslated(pContext, ulValue) \
|
436 |
|
|
do \
|
437 |
|
|
{ \
|
438 |
|
|
tContext *pC = pContext; \
|
439 |
|
|
pC->ulForeground = ulValue; \
|
440 |
|
|
} \
|
441 |
|
|
while(0)
|
442 |
|
|
|
443 |
|
|
//*****************************************************************************
|
444 |
|
|
//
|
445 |
|
|
//! Flushes any cached drawing operations.
|
446 |
|
|
//!
|
447 |
|
|
//! \param pContext is a pointer to the drawing context to use.
|
448 |
|
|
//!
|
449 |
|
|
//! This function flushes any cached drawing operations. For display drivers
|
450 |
|
|
//! that draw into a local frame buffer before writing to the actual display,
|
451 |
|
|
//! calling this function will cause the display to be updated to match the
|
452 |
|
|
//! contents of the local frame buffer.
|
453 |
|
|
//!
|
454 |
|
|
//! \return None.
|
455 |
|
|
//
|
456 |
|
|
//*****************************************************************************
|
457 |
|
|
#define GrFlush(pContext) \
|
458 |
|
|
do \
|
459 |
|
|
{ \
|
460 |
|
|
const tContext *pC = pContext; \
|
461 |
|
|
DpyFlush(pC->pDisplay); \
|
462 |
|
|
} \
|
463 |
|
|
while(0)
|
464 |
|
|
|
465 |
|
|
//*****************************************************************************
|
466 |
|
|
//
|
467 |
|
|
//! Gets the baseline of a font.
|
468 |
|
|
//!
|
469 |
|
|
//! \param pFont is a pointer to the font to query.
|
470 |
|
|
//!
|
471 |
|
|
//! This function determines the baseline position of a font. The baseline is
|
472 |
|
|
//! the offset between the top of the font and the bottom of the capital
|
473 |
|
|
//! letters. The only font data that exists below the baseline are the
|
474 |
|
|
//! descenders on some lower-case letters (such as ``y'').
|
475 |
|
|
//!
|
476 |
|
|
//! \return Returns the baseline of the font, in pixels.
|
477 |
|
|
//
|
478 |
|
|
//*****************************************************************************
|
479 |
|
|
#define GrFontBaselineGet(pFont) \
|
480 |
|
|
((pFont)->ucBaseline)
|
481 |
|
|
|
482 |
|
|
//*****************************************************************************
|
483 |
|
|
//
|
484 |
|
|
//! Gets the height of a font.
|
485 |
|
|
//!
|
486 |
|
|
//! \param pFont is a pointer to the font to query.
|
487 |
|
|
//!
|
488 |
|
|
//! This function determines the height of a font. The height is the offset
|
489 |
|
|
//! between the top of the font and the bottom of the font, including any
|
490 |
|
|
//! ascenders and descenders.
|
491 |
|
|
//!
|
492 |
|
|
//! \return Returns the height of the font, in pixels.
|
493 |
|
|
//
|
494 |
|
|
//*****************************************************************************
|
495 |
|
|
#define GrFontHeightGet(pFont) \
|
496 |
|
|
((pFont)->ucHeight)
|
497 |
|
|
|
498 |
|
|
//*****************************************************************************
|
499 |
|
|
//
|
500 |
|
|
//! Gets the maximum width of a font.
|
501 |
|
|
//!
|
502 |
|
|
//! \param pFont is a pointer to the font to query.
|
503 |
|
|
//!
|
504 |
|
|
//! This function determines the maximum width of a font. The maximum width is
|
505 |
|
|
//! the width of the widest individual character in the font.
|
506 |
|
|
//!
|
507 |
|
|
//! \return Returns the maximum width of the font, in pixels.
|
508 |
|
|
//
|
509 |
|
|
//*****************************************************************************
|
510 |
|
|
#define GrFontMaxWidthGet(pFont) \
|
511 |
|
|
((pFont)->ucMaxWidth)
|
512 |
|
|
|
513 |
|
|
//*****************************************************************************
|
514 |
|
|
//
|
515 |
|
|
//! Gets the number of colors in an image.
|
516 |
|
|
//!
|
517 |
|
|
//! \param pucImage is a pointer to the image to query.
|
518 |
|
|
//!
|
519 |
|
|
//! This function determines the number of colors in the palette of an image.
|
520 |
|
|
//! This is only valid for 4bpp and 8bpp images; 1bpp images do not contain a
|
521 |
|
|
//! palette.
|
522 |
|
|
//!
|
523 |
|
|
//! \return Returns the number of colors in the image.
|
524 |
|
|
//
|
525 |
|
|
//*****************************************************************************
|
526 |
|
|
#define GrImageColorsGet(pucImage) \
|
527 |
|
|
(((unsigned char *)pucImage)[5] + 1)
|
528 |
|
|
|
529 |
|
|
//*****************************************************************************
|
530 |
|
|
//
|
531 |
|
|
//! Gets the height of an image.
|
532 |
|
|
//!
|
533 |
|
|
//! \param pucImage is a pointer to the image to query.
|
534 |
|
|
//!
|
535 |
|
|
//! This function determines the height of an image in pixels.
|
536 |
|
|
//!
|
537 |
|
|
//! \return Returns the height of the image in pixels.
|
538 |
|
|
//
|
539 |
|
|
//*****************************************************************************
|
540 |
|
|
#define GrImageHeightGet(pucImage) \
|
541 |
|
|
(*(unsigned short *)(pucImage + 3))
|
542 |
|
|
|
543 |
|
|
//*****************************************************************************
|
544 |
|
|
//
|
545 |
|
|
//! Gets the width of an image.
|
546 |
|
|
//!
|
547 |
|
|
//! \param pucImage is a pointer to the image to query.
|
548 |
|
|
//!
|
549 |
|
|
//! This function determines the width of an image in pixels.
|
550 |
|
|
//!
|
551 |
|
|
//! \return Returns the width of the image in pixels.
|
552 |
|
|
//
|
553 |
|
|
//*****************************************************************************
|
554 |
|
|
#define GrImageWidthGet(pucImage) \
|
555 |
|
|
(*(unsigned short *)(pucImage + 1))
|
556 |
|
|
|
557 |
|
|
//*****************************************************************************
|
558 |
|
|
//
|
559 |
|
|
//! Determines the size of the buffer for a 1 BPP off-screen image.
|
560 |
|
|
//!
|
561 |
|
|
//! \param lWidth is the width of the image in pixels.
|
562 |
|
|
//! \param lHeight is the height of the image in pixels.
|
563 |
|
|
//!
|
564 |
|
|
//! This function determines the size of the memory buffer required to hold a
|
565 |
|
|
//! 1 BPP off-screen image of the specified geometry.
|
566 |
|
|
//!
|
567 |
|
|
//! \return Returns the number of bytes required by the image.
|
568 |
|
|
//
|
569 |
|
|
//*****************************************************************************
|
570 |
|
|
#define GrOffScreen1BPPSize(lWidth, lHeight) \
|
571 |
|
|
(5 + (((lWidth + 7) / 8) * lHeight))
|
572 |
|
|
|
573 |
|
|
//*****************************************************************************
|
574 |
|
|
//
|
575 |
|
|
//! Determines the size of the buffer for a 4 BPP off-screen image.
|
576 |
|
|
//!
|
577 |
|
|
//! \param lWidth is the width of the image in pixels.
|
578 |
|
|
//! \param lHeight is the height of the image in pixels.
|
579 |
|
|
//!
|
580 |
|
|
//! This function determines the size of the memory buffer required to hold a
|
581 |
|
|
//! 4 BPP off-screen image of the specified geometry.
|
582 |
|
|
//!
|
583 |
|
|
//! \return Returns the number of bytes required by the image.
|
584 |
|
|
//
|
585 |
|
|
//*****************************************************************************
|
586 |
|
|
#define GrOffScreen4BPPSize(lWidth, lHeight) \
|
587 |
|
|
(6 + (16 * 3) + (((lWidth + 1) / 2) * lHeight))
|
588 |
|
|
|
589 |
|
|
//*****************************************************************************
|
590 |
|
|
//
|
591 |
|
|
//! Determines the size of the buffer for an 8 BPP off-screen image.
|
592 |
|
|
//!
|
593 |
|
|
//! \param lWidth is the width of the image in pixels.
|
594 |
|
|
//! \param lHeight is the height of the image in pixels.
|
595 |
|
|
//!
|
596 |
|
|
//! This function determines the size of the memory buffer required to hold an
|
597 |
|
|
//! 8 BPP off-screen image of the specified geometry.
|
598 |
|
|
//!
|
599 |
|
|
//! \return Returns the number of bytes required by the image.
|
600 |
|
|
//
|
601 |
|
|
//*****************************************************************************
|
602 |
|
|
#define GrOffScreen8BPPSize(lWidth, lHeight) \
|
603 |
|
|
(6 + (256 * 3) + (lWidth * lHeight))
|
604 |
|
|
|
605 |
|
|
//*****************************************************************************
|
606 |
|
|
//
|
607 |
|
|
//! Draws a pixel.
|
608 |
|
|
//!
|
609 |
|
|
//! \param pContext is a pointer to the drawing context to use.
|
610 |
|
|
//! \param lX is the X coordinate of the pixel.
|
611 |
|
|
//! \param lY is the Y coordinate of the pixel.
|
612 |
|
|
//!
|
613 |
|
|
//! This function draws a pixel if it resides within the clipping region.
|
614 |
|
|
//!
|
615 |
|
|
//! \return None.
|
616 |
|
|
//
|
617 |
|
|
//*****************************************************************************
|
618 |
|
|
#define GrPixelDraw(pContext, lX, lY) \
|
619 |
|
|
do \
|
620 |
|
|
{ \
|
621 |
|
|
const tContext *pC = pContext; \
|
622 |
|
|
if((lX >= pC->sClipRegion.sXMin) && \
|
623 |
|
|
(lX <= pC->sClipRegion.sXMax) && \
|
624 |
|
|
(lY >= pC->sClipRegion.sYMin) && \
|
625 |
|
|
(lY <= pC->sClipRegion.sYMax)) \
|
626 |
|
|
{ \
|
627 |
|
|
DpyPixelDraw(pC->pDisplay, lX, lY, pC->ulForeground); \
|
628 |
|
|
} \
|
629 |
|
|
} \
|
630 |
|
|
while(0)
|
631 |
|
|
|
632 |
|
|
//*****************************************************************************
|
633 |
|
|
//
|
634 |
|
|
//! Gets the baseline of a string.
|
635 |
|
|
//!
|
636 |
|
|
//! \param pContext is a pointer to the drawing context to query.
|
637 |
|
|
//!
|
638 |
|
|
//! This function determines the baseline position of a string. The baseline
|
639 |
|
|
//! is the offset between the top of the string and the bottom of the capital
|
640 |
|
|
//! letters. The only string data that exists below the baseline are the
|
641 |
|
|
//! descenders on some lower-case letters (such as ``y'').
|
642 |
|
|
//!
|
643 |
|
|
//! \return Returns the baseline of the string, in pixels.
|
644 |
|
|
//
|
645 |
|
|
//*****************************************************************************
|
646 |
|
|
#define GrStringBaselineGet(pContext) \
|
647 |
|
|
((pContext)->pFont->ucBaseline)
|
648 |
|
|
|
649 |
|
|
//*****************************************************************************
|
650 |
|
|
//
|
651 |
|
|
//! Draws a centered string.
|
652 |
|
|
//!
|
653 |
|
|
//! \param pContext is a pointer to the drawing context to use.
|
654 |
|
|
//! \param pcString is a pointer to the string to be drawn.
|
655 |
|
|
//! \param lLength is the number of characters from the string that should be
|
656 |
|
|
//! drawn on the screen.
|
657 |
|
|
//! \param lX is the X coordinate of the center of the string position on the
|
658 |
|
|
//! screen.
|
659 |
|
|
//! \param lY is the Y coordinate of the center of the string position on the
|
660 |
|
|
//! screen.
|
661 |
|
|
//! \param bOpaque is \b true if the background of each character should be
|
662 |
|
|
//! drawn and \b false if it should not (leaving the background as is).
|
663 |
|
|
//!
|
664 |
|
|
//! This function draws a string of test on the screen centered upon the
|
665 |
|
|
//! provided position. The \e lLength parameter allows a portion of the
|
666 |
|
|
//! string to be examined without having to insert a NULL character at the
|
667 |
|
|
//! stopping point (which would not be possible if the string was located in
|
668 |
|
|
//! flash); specifying a length of -1 will cause the entire string to be
|
669 |
|
|
//! rendered (subject to clipping).
|
670 |
|
|
//!
|
671 |
|
|
//! \return None.
|
672 |
|
|
//
|
673 |
|
|
//*****************************************************************************
|
674 |
|
|
#define GrStringDrawCentered(pContext, pcString, lLength, lX, lY, bOpaque) \
|
675 |
|
|
do \
|
676 |
|
|
{ \
|
677 |
|
|
const tContext *pC = pContext; \
|
678 |
|
|
const char *pcStr = pcString; \
|
679 |
|
|
\
|
680 |
|
|
GrStringDraw(pC, pcStr, lLength, \
|
681 |
|
|
(lX) - (GrStringWidthGet(pC, pcStr, lLength) / 2), \
|
682 |
|
|
(lY) - (pC->pFont->ucBaseline / 2), bOpaque); \
|
683 |
|
|
} \
|
684 |
|
|
while(0)
|
685 |
|
|
|
686 |
|
|
//*****************************************************************************
|
687 |
|
|
//
|
688 |
|
|
//! Gets the height of a string.
|
689 |
|
|
//!
|
690 |
|
|
//! \param pContext is a pointer to the drawing context to query.
|
691 |
|
|
//!
|
692 |
|
|
//! This function determines the height of a string. The height is the offset
|
693 |
|
|
//! between the top of the string and the bottom of the string, including any
|
694 |
|
|
//! ascenders and descenders. Note that this will not account for the case
|
695 |
|
|
//! where the string in question does not have any characters that use
|
696 |
|
|
//! descenders but the font in the drawing context does contain characters with
|
697 |
|
|
//! descenders.
|
698 |
|
|
//!
|
699 |
|
|
//! \return Returns the height of the string, in pixels.
|
700 |
|
|
//
|
701 |
|
|
//*****************************************************************************
|
702 |
|
|
#define GrStringHeightGet(pContext) \
|
703 |
|
|
((pContext)->pFont->ucHeight)
|
704 |
|
|
|
705 |
|
|
//*****************************************************************************
|
706 |
|
|
//
|
707 |
|
|
//! Gets the maximum width of a character in a string.
|
708 |
|
|
//!
|
709 |
|
|
//! \param pContext is a pointer to the drawing context to query.
|
710 |
|
|
//!
|
711 |
|
|
//! This function determines the maximum width of a character in a string. The
|
712 |
|
|
//! maximum width is the width of the widest individual character in the font
|
713 |
|
|
//! used to render the string, which may be wider than the widest character
|
714 |
|
|
//! that is used to render a particular string.
|
715 |
|
|
//!
|
716 |
|
|
//! \return Returns the maximum width of a character in a string, in pixels.
|
717 |
|
|
//
|
718 |
|
|
//*****************************************************************************
|
719 |
|
|
#define GrStringMaxWidthGet(pContext) \
|
720 |
|
|
((pContext)->pFont->ucMaxWidth)
|
721 |
|
|
|
722 |
|
|
//*****************************************************************************
|
723 |
|
|
//
|
724 |
|
|
// A set of color definitions. This set is the subset of the X11 colors (from
|
725 |
|
|
// rgb.txt) that are supported by typical web browsers.
|
726 |
|
|
//
|
727 |
|
|
//*****************************************************************************
|
728 |
|
|
#define ClrAliceBlue 0x00F0F8FF
|
729 |
|
|
#define ClrAntiqueWhite 0x00FAEBD7
|
730 |
|
|
#define ClrAqua 0x0000FFFF
|
731 |
|
|
#define ClrAquamarine 0x007FFFD4
|
732 |
|
|
#define ClrAzure 0x00F0FFFF
|
733 |
|
|
#define ClrBeige 0x00F5F5DC
|
734 |
|
|
#define ClrBisque 0x00FFE4C4
|
735 |
|
|
#define ClrBlack 0x00000000
|
736 |
|
|
#define ClrBlanchedAlmond 0x00FFEBCD
|
737 |
|
|
#define ClrBlue 0x000000FF
|
738 |
|
|
#define ClrBlueViolet 0x008A2BE2
|
739 |
|
|
#define ClrBrown 0x00A52A2A
|
740 |
|
|
#define ClrBurlyWood 0x00DEB887
|
741 |
|
|
#define ClrCadetBlue 0x005F9EA0
|
742 |
|
|
#define ClrChartreuse 0x007FFF00
|
743 |
|
|
#define ClrChocolate 0x00D2691E
|
744 |
|
|
#define ClrCoral 0x00FF7F50
|
745 |
|
|
#define ClrCornflowerBlue 0x006495ED
|
746 |
|
|
#define ClrCornsilk 0x00FFF8DC
|
747 |
|
|
#define ClrCrimson 0x00DC143C
|
748 |
|
|
#define ClrCyan 0x0000FFFF
|
749 |
|
|
#define ClrDarkBlue 0x0000008B
|
750 |
|
|
#define ClrDarkCyan 0x00008B8B
|
751 |
|
|
#define ClrDarkGoldenrod 0x00B8860B
|
752 |
|
|
#define ClrDarkGray 0x00A9A9A9
|
753 |
|
|
#define ClrDarkGreen 0x00006400
|
754 |
|
|
#define ClrDarkKhaki 0x00BDB76B
|
755 |
|
|
#define ClrDarkMagenta 0x008B008B
|
756 |
|
|
#define ClrDarkOliveGreen 0x00556B2F
|
757 |
|
|
#define ClrDarkOrange 0x00FF8C00
|
758 |
|
|
#define ClrDarkOrchid 0x009932CC
|
759 |
|
|
#define ClrDarkRed 0x008B0000
|
760 |
|
|
#define ClrDarkSalmon 0x00E9967A
|
761 |
|
|
#define ClrDarkSeaGreen 0x008FBC8F
|
762 |
|
|
#define ClrDarkSlateBlue 0x00483D8B
|
763 |
|
|
#define ClrDarkSlateGray 0x002F4F4F
|
764 |
|
|
#define ClrDarkTurquoise 0x0000CED1
|
765 |
|
|
#define ClrDarkViolet 0x009400D3
|
766 |
|
|
#define ClrDeepPink 0x00FF1493
|
767 |
|
|
#define ClrDeepSkyBlue 0x0000BFFF
|
768 |
|
|
#define ClrDimGray 0x00696969
|
769 |
|
|
#define ClrDodgerBlue 0x001E90FF
|
770 |
|
|
#define ClrFireBrick 0x00B22222
|
771 |
|
|
#define ClrFloralWhite 0x00FFFAF0
|
772 |
|
|
#define ClrForestGreen 0x00228B22
|
773 |
|
|
#define ClrFuchsia 0x00FF00FF
|
774 |
|
|
#define ClrGainsboro 0x00DCDCDC
|
775 |
|
|
#define ClrGhostWhite 0x00F8F8FF
|
776 |
|
|
#define ClrGold 0x00FFD700
|
777 |
|
|
#define ClrGoldenrod 0x00DAA520
|
778 |
|
|
#define ClrGray 0x00808080
|
779 |
|
|
#define ClrGreen 0x00008000
|
780 |
|
|
#define ClrGreenYellow 0x00ADFF2F
|
781 |
|
|
#define ClrHoneydew 0x00F0FFF0
|
782 |
|
|
#define ClrHotPink 0x00FF69B4
|
783 |
|
|
#define ClrIndianRed 0x00CD5C5C
|
784 |
|
|
#define ClrIndigo 0x004B0082
|
785 |
|
|
#define ClrIvory 0x00FFFFF0
|
786 |
|
|
#define ClrKhaki 0x00F0E68C
|
787 |
|
|
#define ClrLavender 0x00E6E6FA
|
788 |
|
|
#define ClrLavenderBlush 0x00FFF0F5
|
789 |
|
|
#define ClrLawnGreen 0x007CFC00
|
790 |
|
|
#define ClrLemonChiffon 0x00FFFACD
|
791 |
|
|
#define ClrLightBlue 0x00ADD8E6
|
792 |
|
|
#define ClrLightCoral 0x00F08080
|
793 |
|
|
#define ClrLightCyan 0x00E0FFFF
|
794 |
|
|
#define ClrLightGoldenrodYellow 0x00FAFAD2
|
795 |
|
|
#define ClrLightGreen 0x0090EE90
|
796 |
|
|
#define ClrLightGrey 0x00D3D3D3
|
797 |
|
|
#define ClrLightPink 0x00FFB6C1
|
798 |
|
|
#define ClrLightSalmon 0x00FFA07A
|
799 |
|
|
#define ClrLightSeaGreen 0x0020B2AA
|
800 |
|
|
#define ClrLightSkyBlue 0x0087CEFA
|
801 |
|
|
#define ClrLightSlateGray 0x00778899
|
802 |
|
|
#define ClrLightSteelBlue 0x00B0C4DE
|
803 |
|
|
#define ClrLightYellow 0x00FFFFE0
|
804 |
|
|
#define ClrLime 0x0000FF00
|
805 |
|
|
#define ClrLimeGreen 0x0032CD32
|
806 |
|
|
#define ClrLinen 0x00FAF0E6
|
807 |
|
|
#define ClrMagenta 0x00FF00FF
|
808 |
|
|
#define ClrMaroon 0x00800000
|
809 |
|
|
#define ClrMediumAquamarine 0x0066CDAA
|
810 |
|
|
#define ClrMediumBlue 0x000000CD
|
811 |
|
|
#define ClrMediumOrchid 0x00BA55D3
|
812 |
|
|
#define ClrMediumPurple 0x009370DB
|
813 |
|
|
#define ClrMediumSeaGreen 0x003CB371
|
814 |
|
|
#define ClrMediumSlateBlue 0x007B68EE
|
815 |
|
|
#define ClrMediumSpringGreen 0x0000FA9A
|
816 |
|
|
#define ClrMediumTurquoise 0x0048D1CC
|
817 |
|
|
#define ClrMediumVioletRed 0x00C71585
|
818 |
|
|
#define ClrMidnightBlue 0x00191970
|
819 |
|
|
#define ClrMintCream 0x00F5FFFA
|
820 |
|
|
#define ClrMistyRose 0x00FFE4E1
|
821 |
|
|
#define ClrMoccasin 0x00FFE4B5
|
822 |
|
|
#define ClrNavajoWhite 0x00FFDEAD
|
823 |
|
|
#define ClrNavy 0x00000080
|
824 |
|
|
#define ClrOldLace 0x00FDF5E6
|
825 |
|
|
#define ClrOlive 0x00808000
|
826 |
|
|
#define ClrOliveDrab 0x006B8E23
|
827 |
|
|
#define ClrOrange 0x00FFA500
|
828 |
|
|
#define ClrOrangeRed 0x00FF4500
|
829 |
|
|
#define ClrOrchid 0x00DA70D6
|
830 |
|
|
#define ClrPaleGoldenrod 0x00EEE8AA
|
831 |
|
|
#define ClrPaleGreen 0x0098FB98
|
832 |
|
|
#define ClrPaleTurquoise 0x00AFEEEE
|
833 |
|
|
#define ClrPaleVioletRed 0x00DB7093
|
834 |
|
|
#define ClrPapayaWhip 0x00FFEFD5
|
835 |
|
|
#define ClrPeachPuff 0x00FFDAB9
|
836 |
|
|
#define ClrPeru 0x00CD853F
|
837 |
|
|
#define ClrPink 0x00FFC0CB
|
838 |
|
|
#define ClrPlum 0x00DDA0DD
|
839 |
|
|
#define ClrPowderBlue 0x00B0E0E6
|
840 |
|
|
#define ClrPurple 0x00800080
|
841 |
|
|
#define ClrRed 0x00FF0000
|
842 |
|
|
#define ClrRosyBrown 0x00BC8F8F
|
843 |
|
|
#define ClrRoyalBlue 0x004169E1
|
844 |
|
|
#define ClrSaddleBrown 0x008B4513
|
845 |
|
|
#define ClrSalmon 0x00FA8072
|
846 |
|
|
#define ClrSandyBrown 0x00F4A460
|
847 |
|
|
#define ClrSeaGreen 0x002E8B57
|
848 |
|
|
#define ClrSeashell 0x00FFF5EE
|
849 |
|
|
#define ClrSienna 0x00A0522D
|
850 |
|
|
#define ClrSilver 0x00C0C0C0
|
851 |
|
|
#define ClrSkyBlue 0x0087CEEB
|
852 |
|
|
#define ClrSlateBlue 0x006A5ACD
|
853 |
|
|
#define ClrSlateGray 0x00708090
|
854 |
|
|
#define ClrSnow 0x00FFFAFA
|
855 |
|
|
#define ClrSpringGreen 0x0000FF7F
|
856 |
|
|
#define ClrSteelBlue 0x004682B4
|
857 |
|
|
#define ClrTan 0x00D2B48C
|
858 |
|
|
#define ClrTeal 0x00008080
|
859 |
|
|
#define ClrThistle 0x00D8BFD8
|
860 |
|
|
#define ClrTomato 0x00FF6347
|
861 |
|
|
#define ClrTurquoise 0x0040E0D0
|
862 |
|
|
#define ClrViolet 0x00EE82EE
|
863 |
|
|
#define ClrWheat 0x00F5DEB3
|
864 |
|
|
#define ClrWhite 0x00FFFFFF
|
865 |
|
|
#define ClrWhiteSmoke 0x00F5F5F5
|
866 |
|
|
#define ClrYellow 0x00FFFF00
|
867 |
|
|
#define ClrYellowGreen 0x009ACD32
|
868 |
|
|
|
869 |
|
|
//*****************************************************************************
|
870 |
|
|
//
|
871 |
|
|
// Masks and shifts to aid in color format translation by drivers.
|
872 |
|
|
//
|
873 |
|
|
//*****************************************************************************
|
874 |
|
|
#define ClrRedMask 0x00FF0000
|
875 |
|
|
#define ClrRedShift 16
|
876 |
|
|
#define ClrGreenMask 0x0000FF00
|
877 |
|
|
#define ClrGreenShift 8
|
878 |
|
|
#define ClrBlueMask 0x000000FF
|
879 |
|
|
#define ClrBlueShift 0
|
880 |
|
|
|
881 |
|
|
//*****************************************************************************
|
882 |
|
|
//
|
883 |
|
|
// Prototypes for the predefined fonts in the graphics library. ..Cm.. is the
|
884 |
|
|
// computer modern font, which is a serif font. ..Cmsc.. is the computer
|
885 |
|
|
// modern small-caps font, which is also a serif font. ..Cmss.. is the
|
886 |
|
|
// computer modern sans-serif font.
|
887 |
|
|
//
|
888 |
|
|
//*****************************************************************************
|
889 |
|
|
extern const tFont g_sFontCm12;
|
890 |
|
|
extern const tFont g_sFontCm12b;
|
891 |
|
|
extern const tFont g_sFontCm12i;
|
892 |
|
|
extern const tFont g_sFontCm14;
|
893 |
|
|
extern const tFont g_sFontCm14b;
|
894 |
|
|
extern const tFont g_sFontCm14i;
|
895 |
|
|
extern const tFont g_sFontCm16;
|
896 |
|
|
extern const tFont g_sFontCm16b;
|
897 |
|
|
extern const tFont g_sFontCm16i;
|
898 |
|
|
extern const tFont g_sFontCm18;
|
899 |
|
|
extern const tFont g_sFontCm18b;
|
900 |
|
|
extern const tFont g_sFontCm18i;
|
901 |
|
|
extern const tFont g_sFontCm20;
|
902 |
|
|
extern const tFont g_sFontCm20b;
|
903 |
|
|
extern const tFont g_sFontCm20i;
|
904 |
|
|
extern const tFont g_sFontCm22;
|
905 |
|
|
extern const tFont g_sFontCm22b;
|
906 |
|
|
extern const tFont g_sFontCm22i;
|
907 |
|
|
extern const tFont g_sFontCm24;
|
908 |
|
|
extern const tFont g_sFontCm24b;
|
909 |
|
|
extern const tFont g_sFontCm24i;
|
910 |
|
|
extern const tFont g_sFontCm26;
|
911 |
|
|
extern const tFont g_sFontCm26b;
|
912 |
|
|
extern const tFont g_sFontCm26i;
|
913 |
|
|
extern const tFont g_sFontCm28;
|
914 |
|
|
extern const tFont g_sFontCm28b;
|
915 |
|
|
extern const tFont g_sFontCm28i;
|
916 |
|
|
extern const tFont g_sFontCm30;
|
917 |
|
|
extern const tFont g_sFontCm30b;
|
918 |
|
|
extern const tFont g_sFontCm30i;
|
919 |
|
|
extern const tFont g_sFontCm32;
|
920 |
|
|
extern const tFont g_sFontCm32b;
|
921 |
|
|
extern const tFont g_sFontCm32i;
|
922 |
|
|
extern const tFont g_sFontCm34;
|
923 |
|
|
extern const tFont g_sFontCm34b;
|
924 |
|
|
extern const tFont g_sFontCm34i;
|
925 |
|
|
extern const tFont g_sFontCm36;
|
926 |
|
|
extern const tFont g_sFontCm36b;
|
927 |
|
|
extern const tFont g_sFontCm36i;
|
928 |
|
|
extern const tFont g_sFontCm38;
|
929 |
|
|
extern const tFont g_sFontCm38b;
|
930 |
|
|
extern const tFont g_sFontCm38i;
|
931 |
|
|
extern const tFont g_sFontCm40;
|
932 |
|
|
extern const tFont g_sFontCm40b;
|
933 |
|
|
extern const tFont g_sFontCm40i;
|
934 |
|
|
extern const tFont g_sFontCm42;
|
935 |
|
|
extern const tFont g_sFontCm42b;
|
936 |
|
|
extern const tFont g_sFontCm42i;
|
937 |
|
|
extern const tFont g_sFontCm44;
|
938 |
|
|
extern const tFont g_sFontCm44b;
|
939 |
|
|
extern const tFont g_sFontCm44i;
|
940 |
|
|
extern const tFont g_sFontCm46;
|
941 |
|
|
extern const tFont g_sFontCm46b;
|
942 |
|
|
extern const tFont g_sFontCm46i;
|
943 |
|
|
extern const tFont g_sFontCm48;
|
944 |
|
|
extern const tFont g_sFontCm48b;
|
945 |
|
|
extern const tFont g_sFontCm48i;
|
946 |
|
|
extern const tFont g_sFontCmsc12;
|
947 |
|
|
extern const tFont g_sFontCmsc14;
|
948 |
|
|
extern const tFont g_sFontCmsc16;
|
949 |
|
|
extern const tFont g_sFontCmsc18;
|
950 |
|
|
extern const tFont g_sFontCmsc20;
|
951 |
|
|
extern const tFont g_sFontCmsc22;
|
952 |
|
|
extern const tFont g_sFontCmsc24;
|
953 |
|
|
extern const tFont g_sFontCmsc26;
|
954 |
|
|
extern const tFont g_sFontCmsc28;
|
955 |
|
|
extern const tFont g_sFontCmsc30;
|
956 |
|
|
extern const tFont g_sFontCmsc32;
|
957 |
|
|
extern const tFont g_sFontCmsc34;
|
958 |
|
|
extern const tFont g_sFontCmsc36;
|
959 |
|
|
extern const tFont g_sFontCmsc38;
|
960 |
|
|
extern const tFont g_sFontCmsc40;
|
961 |
|
|
extern const tFont g_sFontCmsc42;
|
962 |
|
|
extern const tFont g_sFontCmsc44;
|
963 |
|
|
extern const tFont g_sFontCmsc46;
|
964 |
|
|
extern const tFont g_sFontCmsc48;
|
965 |
|
|
extern const tFont g_sFontCmss12;
|
966 |
|
|
extern const tFont g_sFontCmss12b;
|
967 |
|
|
extern const tFont g_sFontCmss12i;
|
968 |
|
|
extern const tFont g_sFontCmss14;
|
969 |
|
|
extern const tFont g_sFontCmss14b;
|
970 |
|
|
extern const tFont g_sFontCmss14i;
|
971 |
|
|
extern const tFont g_sFontCmss16;
|
972 |
|
|
extern const tFont g_sFontCmss16b;
|
973 |
|
|
extern const tFont g_sFontCmss16i;
|
974 |
|
|
extern const tFont g_sFontCmss18;
|
975 |
|
|
extern const tFont g_sFontCmss18b;
|
976 |
|
|
extern const tFont g_sFontCmss18i;
|
977 |
|
|
extern const tFont g_sFontCmss20;
|
978 |
|
|
extern const tFont g_sFontCmss20b;
|
979 |
|
|
extern const tFont g_sFontCmss20i;
|
980 |
|
|
extern const tFont g_sFontCmss22;
|
981 |
|
|
extern const tFont g_sFontCmss22b;
|
982 |
|
|
extern const tFont g_sFontCmss22i;
|
983 |
|
|
extern const tFont g_sFontCmss24;
|
984 |
|
|
extern const tFont g_sFontCmss24b;
|
985 |
|
|
extern const tFont g_sFontCmss24i;
|
986 |
|
|
extern const tFont g_sFontCmss26;
|
987 |
|
|
extern const tFont g_sFontCmss26b;
|
988 |
|
|
extern const tFont g_sFontCmss26i;
|
989 |
|
|
extern const tFont g_sFontCmss28;
|
990 |
|
|
extern const tFont g_sFontCmss28b;
|
991 |
|
|
extern const tFont g_sFontCmss28i;
|
992 |
|
|
extern const tFont g_sFontCmss30;
|
993 |
|
|
extern const tFont g_sFontCmss30b;
|
994 |
|
|
extern const tFont g_sFontCmss30i;
|
995 |
|
|
extern const tFont g_sFontCmss32;
|
996 |
|
|
extern const tFont g_sFontCmss32b;
|
997 |
|
|
extern const tFont g_sFontCmss32i;
|
998 |
|
|
extern const tFont g_sFontCmss34;
|
999 |
|
|
extern const tFont g_sFontCmss34b;
|
1000 |
|
|
extern const tFont g_sFontCmss34i;
|
1001 |
|
|
extern const tFont g_sFontCmss36;
|
1002 |
|
|
extern const tFont g_sFontCmss36b;
|
1003 |
|
|
extern const tFont g_sFontCmss36i;
|
1004 |
|
|
extern const tFont g_sFontCmss38;
|
1005 |
|
|
extern const tFont g_sFontCmss38b;
|
1006 |
|
|
extern const tFont g_sFontCmss38i;
|
1007 |
|
|
extern const tFont g_sFontCmss40;
|
1008 |
|
|
extern const tFont g_sFontCmss40b;
|
1009 |
|
|
extern const tFont g_sFontCmss40i;
|
1010 |
|
|
extern const tFont g_sFontCmss42;
|
1011 |
|
|
extern const tFont g_sFontCmss42b;
|
1012 |
|
|
extern const tFont g_sFontCmss42i;
|
1013 |
|
|
extern const tFont g_sFontCmss44;
|
1014 |
|
|
extern const tFont g_sFontCmss44b;
|
1015 |
|
|
extern const tFont g_sFontCmss44i;
|
1016 |
|
|
extern const tFont g_sFontCmss46;
|
1017 |
|
|
extern const tFont g_sFontCmss46b;
|
1018 |
|
|
extern const tFont g_sFontCmss46i;
|
1019 |
|
|
extern const tFont g_sFontCmss48;
|
1020 |
|
|
extern const tFont g_sFontCmss48b;
|
1021 |
|
|
extern const tFont g_sFontCmss48i;
|
1022 |
|
|
extern const tFont g_sFontFixed6x8;
|
1023 |
|
|
|
1024 |
|
|
//*****************************************************************************
|
1025 |
|
|
//
|
1026 |
|
|
//! Translates a 24-bit RGB color to a display driver-specific color.
|
1027 |
|
|
//!
|
1028 |
|
|
//! \param pDisplay is the pointer to the display driver structure for the
|
1029 |
|
|
//! display to operate upon.
|
1030 |
|
|
//! \param ulValue is the 24-bit RGB color. The least-significant byte is the
|
1031 |
|
|
//! blue channel, the next byte is the green channel, and the third byte is the
|
1032 |
|
|
//! red channel.
|
1033 |
|
|
//!
|
1034 |
|
|
//! This function translates a 24-bit RGB color into a value that can be
|
1035 |
|
|
//! written into the display's frame buffer in order to reproduce that color,
|
1036 |
|
|
//! or the closest possible approximation of that color.
|
1037 |
|
|
//!
|
1038 |
|
|
//! \return Returns the display-driver specific color.
|
1039 |
|
|
//
|
1040 |
|
|
//*****************************************************************************
|
1041 |
|
|
#define DpyColorTranslate(pDisplay, ulValue) \
|
1042 |
|
|
((pDisplay)->pfnColorTranslate((pDisplay)->pvDisplayData, ulValue))
|
1043 |
|
|
|
1044 |
|
|
//*****************************************************************************
|
1045 |
|
|
//
|
1046 |
|
|
//! Flushes cached drawing operations.
|
1047 |
|
|
//!
|
1048 |
|
|
//! \param pDisplay is the pointer to the display driver structure for the
|
1049 |
|
|
//! display to operate upon.
|
1050 |
|
|
//!
|
1051 |
|
|
//! This function flushes any cached drawing operations on a display.
|
1052 |
|
|
//!
|
1053 |
|
|
//! \return None.
|
1054 |
|
|
//
|
1055 |
|
|
//*****************************************************************************
|
1056 |
|
|
#define DpyFlush(pDisplay) \
|
1057 |
|
|
do \
|
1058 |
|
|
{ \
|
1059 |
|
|
const tDisplay *pD = pDisplay; \
|
1060 |
|
|
pD->pfnFlush(pD->pvDisplayData); \
|
1061 |
|
|
} \
|
1062 |
|
|
while(0)
|
1063 |
|
|
|
1064 |
|
|
//*****************************************************************************
|
1065 |
|
|
//
|
1066 |
|
|
//! Gets the height of the display.
|
1067 |
|
|
//!
|
1068 |
|
|
//! \param pDisplay is a pointer to the display driver structure for the
|
1069 |
|
|
//! display to query.
|
1070 |
|
|
//!
|
1071 |
|
|
//! This function determines the height of the display.
|
1072 |
|
|
//!
|
1073 |
|
|
//! \return Returns the height of the display in pixels.
|
1074 |
|
|
//
|
1075 |
|
|
//*****************************************************************************
|
1076 |
|
|
#define DpyHeightGet(pDisplay) \
|
1077 |
|
|
((pDisplay)->usHeight)
|
1078 |
|
|
|
1079 |
|
|
//*****************************************************************************
|
1080 |
|
|
//
|
1081 |
|
|
//! Draws a horizontal line on a display.
|
1082 |
|
|
//!
|
1083 |
|
|
//! \param pDisplay is the pointer to the display driver structure for the
|
1084 |
|
|
//! display to operate upon.
|
1085 |
|
|
//! \param lX1 is the starting X coordinate of the line.
|
1086 |
|
|
//! \param lX2 is the ending X coordinate of the line.
|
1087 |
|
|
//! \param lY is the Y coordinate of the line.
|
1088 |
|
|
//! \param ulValue is the color to draw the line.
|
1089 |
|
|
//!
|
1090 |
|
|
//! This function draws a horizontal line on a display. This assumes that
|
1091 |
|
|
//! clipping has already been performed, and that both end points of the line
|
1092 |
|
|
//! are within the extents of the display.
|
1093 |
|
|
//!
|
1094 |
|
|
//! \return None.
|
1095 |
|
|
//
|
1096 |
|
|
//*****************************************************************************
|
1097 |
|
|
#define DpyLineDrawH(pDisplay, lX1, lX2, lY, ulValue) \
|
1098 |
|
|
do \
|
1099 |
|
|
{ \
|
1100 |
|
|
const tDisplay *pD = pDisplay; \
|
1101 |
|
|
pD->pfnLineDrawH(pD->pvDisplayData, lX1, lX2, lY, ulValue); \
|
1102 |
|
|
} \
|
1103 |
|
|
while(0)
|
1104 |
|
|
|
1105 |
|
|
//*****************************************************************************
|
1106 |
|
|
//
|
1107 |
|
|
//! Draws a vertical line on a display.
|
1108 |
|
|
//!
|
1109 |
|
|
//! \param pDisplay is the pointer to the display driver structure for the
|
1110 |
|
|
//! display to operate upon.
|
1111 |
|
|
//! \param lX is the X coordinate of the line.
|
1112 |
|
|
//! \param lY1 is the starting Y coordinate of the line.
|
1113 |
|
|
//! \param lY2 is the ending Y coordinate of the line.
|
1114 |
|
|
//! \param ulValue is the color to draw the line.
|
1115 |
|
|
//!
|
1116 |
|
|
//! This function draws a vertical line on a display. This assumes that
|
1117 |
|
|
//! clipping has already been performed, and that both end points of the line
|
1118 |
|
|
//! are within the extents of the display.
|
1119 |
|
|
//!
|
1120 |
|
|
//! \return None.
|
1121 |
|
|
//
|
1122 |
|
|
//*****************************************************************************
|
1123 |
|
|
#define DpyLineDrawV(pDisplay, lX, lY1, lY2, ulValue) \
|
1124 |
|
|
do \
|
1125 |
|
|
{ \
|
1126 |
|
|
const tDisplay *pD = pDisplay; \
|
1127 |
|
|
pD->pfnLineDrawV(pD->pvDisplayData, lX, lY1, lY2, ulValue); \
|
1128 |
|
|
} \
|
1129 |
|
|
while(0)
|
1130 |
|
|
|
1131 |
|
|
//*****************************************************************************
|
1132 |
|
|
//
|
1133 |
|
|
//! Draws a pixel on a display.
|
1134 |
|
|
//!
|
1135 |
|
|
//! \param pDisplay is the pointer to the display driver structure for the
|
1136 |
|
|
//! display to operate upon.
|
1137 |
|
|
//! \param lX is the X coordinate of the pixel.
|
1138 |
|
|
//! \param lY is the Y coordinate of the pixel.
|
1139 |
|
|
//! \param ulValue is the color to draw the pixel.
|
1140 |
|
|
//!
|
1141 |
|
|
//! This function draws a pixel on a display. This assumes that clipping has
|
1142 |
|
|
//! already been performed.
|
1143 |
|
|
//!
|
1144 |
|
|
//! \return None.
|
1145 |
|
|
//
|
1146 |
|
|
//*****************************************************************************
|
1147 |
|
|
#define DpyPixelDraw(pDisplay, lX, lY, ulValue) \
|
1148 |
|
|
do \
|
1149 |
|
|
{ \
|
1150 |
|
|
const tDisplay *pD = pDisplay; \
|
1151 |
|
|
pD->pfnPixelDraw(pD->pvDisplayData, lX, lY, ulValue); \
|
1152 |
|
|
} \
|
1153 |
|
|
while(0)
|
1154 |
|
|
|
1155 |
|
|
//*****************************************************************************
|
1156 |
|
|
//
|
1157 |
|
|
//! Draws a horizontal sequence of pixels on a display.
|
1158 |
|
|
//!
|
1159 |
|
|
//! \param pDisplay is the pointer to the display driver structure for the
|
1160 |
|
|
//! display to operate upon.
|
1161 |
|
|
//! \param lX is the X coordinate of the first pixel.
|
1162 |
|
|
//! \param lY is the Y coordinate of the first pixel.
|
1163 |
|
|
//! \param lX0 is sub-pixel offset within the pixel data, which is valid for 1
|
1164 |
|
|
//! or 4 bit per pixel formats.
|
1165 |
|
|
//! \param lCount is the number of pixels to draw.
|
1166 |
|
|
//! \param lBPP is the number of bits per pixel; must be 1, 4, or 8.
|
1167 |
|
|
//! \param pucData is a pointer to the pixel data. For 1 and 4 bit per pixel
|
1168 |
|
|
//! formats, the most significant bit(s) represent the left-most pixel.
|
1169 |
|
|
//! \param pucPalette is a pointer to the palette used to draw the pixels.
|
1170 |
|
|
//!
|
1171 |
|
|
//! This function draws a horizontal sequence of pixels on a display, using the
|
1172 |
|
|
//! supplied palette. For 1 bit per pixel format, the palette contains
|
1173 |
|
|
//! pre-translated colors; for 4 and 8 bit per pixel formats, the palette
|
1174 |
|
|
//! contains 24-bit RGB values that must be translated before being written to
|
1175 |
|
|
//! the display.
|
1176 |
|
|
//!
|
1177 |
|
|
//! \return None.
|
1178 |
|
|
//
|
1179 |
|
|
//*****************************************************************************
|
1180 |
|
|
#define DpyPixelDrawMultiple(pDisplay, lX, lY, lX0, lCount, lBPP, pucData, \
|
1181 |
|
|
pucPalette) \
|
1182 |
|
|
do \
|
1183 |
|
|
{ \
|
1184 |
|
|
const tDisplay *pD = pDisplay; \
|
1185 |
|
|
pD->pfnPixelDrawMultiple(pD->pvDisplayData, lX, lY, lX0, lCount, \
|
1186 |
|
|
lBPP, pucData, pucPalette); \
|
1187 |
|
|
} \
|
1188 |
|
|
while(0)
|
1189 |
|
|
|
1190 |
|
|
//*****************************************************************************
|
1191 |
|
|
//
|
1192 |
|
|
//! Fills a rectangle on a display.
|
1193 |
|
|
//!
|
1194 |
|
|
//! \param pDisplay is the pointer to the display driver structure for the
|
1195 |
|
|
//! display to operate upon.
|
1196 |
|
|
//! \param pRect is a pointer to the structure describing the rectangle to
|
1197 |
|
|
//! fill.
|
1198 |
|
|
//! \param ulValue is the color to fill the rectangle.
|
1199 |
|
|
//!
|
1200 |
|
|
//! This function fills a rectangle on the display. This assumes that clipping
|
1201 |
|
|
//! has already been performed, and that all sides of the rectangle are within
|
1202 |
|
|
//! the extents of the display.
|
1203 |
|
|
//!
|
1204 |
|
|
//! \return None.
|
1205 |
|
|
//
|
1206 |
|
|
//*****************************************************************************
|
1207 |
|
|
#define DpyRectFill(pDisplay, pRect, ulValue) \
|
1208 |
|
|
do \
|
1209 |
|
|
{ \
|
1210 |
|
|
const tDisplay *pD = pDisplay; \
|
1211 |
|
|
pD->pfnRectFill(pD->pvDisplayData, pRect, ulValue); \
|
1212 |
|
|
} \
|
1213 |
|
|
while(0)
|
1214 |
|
|
|
1215 |
|
|
//*****************************************************************************
|
1216 |
|
|
//
|
1217 |
|
|
//! Gets the width of the display.
|
1218 |
|
|
//!
|
1219 |
|
|
//! \param pDisplay is a pointer to the display driver structure for the
|
1220 |
|
|
//! display to query.
|
1221 |
|
|
//!
|
1222 |
|
|
//! This function determines the width of the display.
|
1223 |
|
|
//!
|
1224 |
|
|
//! \return Returns the width of the display in pixels.
|
1225 |
|
|
//
|
1226 |
|
|
//*****************************************************************************
|
1227 |
|
|
#define DpyWidthGet(pDisplay) \
|
1228 |
|
|
((pDisplay)->usWidth)
|
1229 |
|
|
|
1230 |
|
|
//*****************************************************************************
|
1231 |
|
|
//
|
1232 |
|
|
// Prototypes for the graphics library functions.
|
1233 |
|
|
//
|
1234 |
|
|
//*****************************************************************************
|
1235 |
|
|
extern void GrCircleDraw(const tContext *pContext, long lX, long lY,
|
1236 |
|
|
long lRadius);
|
1237 |
|
|
extern void GrCircleFill(const tContext *pContext, long lX, long lY,
|
1238 |
|
|
long lRadius);
|
1239 |
|
|
extern void GrContextClipRegionSet(tContext *pContext, tRectangle *pRect);
|
1240 |
|
|
extern void GrContextInit(tContext *pContext, const tDisplay *pDisplay);
|
1241 |
|
|
extern void GrImageDraw(const tContext *pContext,
|
1242 |
|
|
const unsigned char *pucImage, long lX, long lY);
|
1243 |
|
|
extern void GrLineDraw(const tContext *pContext, long lX1, long lY1, long lX2,
|
1244 |
|
|
long lY2);
|
1245 |
|
|
extern void GrLineDrawH(const tContext *pContext, long lX1, long lX2, long lY);
|
1246 |
|
|
extern void GrLineDrawV(const tContext *pContext, long lX, long lY1, long lY2);
|
1247 |
|
|
extern void GrOffScreen1BPPInit(tDisplay *pDisplay, unsigned char *pucImage,
|
1248 |
|
|
long lWidth, long lHeight);
|
1249 |
|
|
extern void GrOffScreen4BPPInit(tDisplay *pDisplay, unsigned char *pucImage,
|
1250 |
|
|
long lWidth, long lHeight);
|
1251 |
|
|
extern void GrOffScreen4BPPPaletteSet(tDisplay *pDisplay,
|
1252 |
|
|
unsigned long *pulPalette,
|
1253 |
|
|
unsigned long ulOffset,
|
1254 |
|
|
unsigned long ulCount);
|
1255 |
|
|
extern void GrOffScreen8BPPInit(tDisplay *pDisplay, unsigned char *pucImage,
|
1256 |
|
|
long lWidth, long lHeight);
|
1257 |
|
|
extern void GrOffScreen8BPPPaletteSet(tDisplay *pDisplay,
|
1258 |
|
|
unsigned long *pulPalette,
|
1259 |
|
|
unsigned long ulOffset,
|
1260 |
|
|
unsigned long ulCount);
|
1261 |
|
|
extern void GrRectDraw(const tContext *pContext, const tRectangle *pRect);
|
1262 |
|
|
extern void GrRectFill(const tContext *pContext, const tRectangle *pRect);
|
1263 |
|
|
extern void GrStringDraw(const tContext *pContext, const char *pcString,
|
1264 |
|
|
long lLength, long lX, long lY,
|
1265 |
|
|
unsigned long bOpaque);
|
1266 |
|
|
extern long GrStringWidthGet(const tContext *pContext, const char *pcString,
|
1267 |
|
|
long lLength);
|
1268 |
|
|
|
1269 |
|
|
//*****************************************************************************
|
1270 |
|
|
//
|
1271 |
|
|
// Mark the end of the C bindings section for C++ compilers.
|
1272 |
|
|
//
|
1273 |
|
|
//*****************************************************************************
|
1274 |
|
|
#ifdef __cplusplus
|
1275 |
|
|
}
|
1276 |
|
|
#endif
|
1277 |
|
|
|
1278 |
|
|
//*****************************************************************************
|
1279 |
|
|
//
|
1280 |
|
|
// Close the Doxygen group.
|
1281 |
|
|
//! @}
|
1282 |
|
|
//
|
1283 |
|
|
//*****************************************************************************
|
1284 |
|
|
|
1285 |
|
|
#endif // __GRLIB_H__
|