Logo
MSP Graphics Library
grlib.h
1 #include <stdint.h>
2 #include <stdbool.h>
3 
4 #ifndef __GRLIB_H__
5 #define __GRLIB_H__
6 
7 #define NDEBUG
8 #include "assert.h"
9 
10 //*****************************************************************************
11 //
14 //
15 //*****************************************************************************
16 
17 //*****************************************************************************
18 //
19 // If building with a C++ compiler, make all of the definitions in this header
20 // have a C binding.
21 //
22 //*****************************************************************************
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27 
28 //*****************************************************************************
29 //
30 // Make sure min and max are defined.
31 //
32 //*****************************************************************************
33 #ifndef min
34 #define min(a, b) (((a) < (b)) ? (a) : (b))
35 #endif
36 
37 #ifndef max
38 #define max(a, b) (((a) < (b)) ? (b) : (a))
39 #endif
40 
41 //*****************************************************************************
42 //
44 //
45 //*****************************************************************************
46 typedef struct Graphics_Image
47 {
48  uint8_t bPP;
49  uint16_t xSize;
50  uint16_t ySize;
51  uint16_t numColors;
52  const uint32_t * pPalette;
53  const uint8_t * pPixel;
55 
56 //*****************************************************************************
57 //
61 //
62 //*****************************************************************************
63 typedef struct Graphics_Rectangle
64 {
65  int16_t xMin;
66  int16_t yMin;
67  int16_t xMax;
68  int16_t yMax;
70 
71 
72 typedef struct Graphics_Display Graphics_Display;
73 
74 //*****************************************************************************
75 //
77 //
78 //*****************************************************************************
80 {
81  //
83  //
84  void (*const pfnPixelDraw)(const Graphics_Display *pDisplay, int16_t lX, int16_t lY,
85  uint16_t ulValue);
86 
87  //
89  //
90  void (*const pfnPixelDrawMultiple)(const Graphics_Display *pDisplay, int16_t lX, int16_t lY,
91  int16_t lX0, int16_t lCount, int16_t lBPP,
92  const uint8_t *pucData,
93  const uint32_t *pucPalette);
94 
95  //
97  //
98  void (*const pfnLineDrawH)(const Graphics_Display *pDisplay, int16_t lX1, int16_t lX2, int16_t lY,
99  uint16_t ulValue);
100 
101  //
103  //
104  void (*const pfnLineDrawV)(const Graphics_Display *pDisplay, int16_t lX, int16_t lY1, int16_t lY2,
105  uint16_t ulValue);
106 
107  //
109  //
110  void (*const pfnRectFill)(const Graphics_Display *pDisplay, const Graphics_Rectangle *pRect,
111  uint16_t ulValue);
112 
113  //
116  //
117  uint32_t (*const pfnColorTranslate)(const Graphics_Display *pDisplay,
118  uint32_t ulValue);
119 
120  //
123  //
124  void (*const pfnFlush)(const Graphics_Display *pDisplay);
125 
126  //
129  //
130  void (*const pfnClearDisplay)(const Graphics_Display *pDisplay, uint16_t ulValue);
131 }
133 
134 
135 //*****************************************************************************
136 //
138 //
139 //*****************************************************************************
141 {
142  int32_t size;
143  void *displayData;
144  uint16_t width;
145  uint16_t heigth;
147 };
148 
149 //*****************************************************************************
150 //
152 //
153 //*****************************************************************************
154 typedef struct Graphics_Font
155 {
156  uint8_t format;
157  uint8_t maxWidth;
158  uint8_t height;
159  uint8_t baseline;
160  uint16_t offset[96];
161  const uint8_t *data;
162 } Graphics_Font;
163 
164 //*****************************************************************************
165 //
174 //
175 //*****************************************************************************
176 typedef struct Graphics_FontEx
177 {
178  uint8_t format;
179  uint8_t maxWidth;
180  uint8_t height;
181  uint8_t baseline;
182  uint8_t first;
183  uint8_t last;
184  const uint16_t *offset;
185  const uint8_t *data;
187 
188 //*****************************************************************************
189 //
192 //
193 //*****************************************************************************
194 typedef struct Graphics_Context
195 {
196  int32_t size;
199  uint32_t foreground;
200  uint32_t background;
203 
204 //*****************************************************************************
205 //
206 // Deprecated struct names. These definitions ensure backwards compatibility
207 // but new code should avoid using deprecated struct names since these will
208 // be removed at some point in the future.
209 //
210 //*****************************************************************************
211 #define ClrAliceBlue GRAPHICS_COLOR_ALICE_BLUE
212 #define ClrAntiqueWhite GRAPHICS_COLOR_ANTIQUE_WHITE
213 #define ClrAqua GRAPHICS_COLOR_AQUA
214 #define ClrAquamarine GRAPHICS_COLOR_AQUAMARINE
215 #define ClrAzure GRAPHICS_COLOR_AZURE
216 #define ClrBeige GRAPHICS_COLOR_BEIGE
217 #define ClrBisque GRAPHICS_COLOR_BISQUE
218 #define ClrBlack GRAPHICS_COLOR_BLACK
219 #define ClrBlanchedAlmond GRAPHICS_COLOR_BLANCHED_ALMOND
220 #define ClrBlue GRAPHICS_COLOR_BLUE
221 #define ClrBlueViolet GRAPHICS_COLOR_BLUE_VIOLET
222 #define ClrBrown GRAPHICS_COLOR_BROWN
223 #define ClrBurlyWood GRAPHICS_COLOR_BURLY_WOOD
224 #define ClrCadetBlue GRAPHICS_COLOR_CADET_BLUE
225 #define ClrChartreuse GRAPHICS_COLOR_CHARTREUSE
226 #define ClrChocolate GRAPHICS_COLOR_CHOCOLATE
227 #define ClrCoral GRAPHICS_COLOR_CORAL
228 #define ClrCornflowerBlue GRAPHICS_COLOR_CORNFLOWER_BLUE
229 #define ClrCornsilk GRAPHICS_COLOR_CORNSILK
230 #define ClrCrimson GRAPHICS_COLOR_CRIMSON
231 #define ClrCyan GRAPHICS_COLOR_CYAN
232 #define ClrDarkBlue GRAPHICS_COLOR_DARK_BLUE
233 #define ClrDarkCyan GRAPHICS_COLOR_DARK_CYAN
234 #define ClrDarkGoldenrod GRAPHICS_COLOR_DARK_GOLDENROD
235 #define ClrDarkGray GRAPHICS_COLOR_DARK_GRAY
236 #define ClrDarkGreen GRAPHICS_COLOR_DARK_GREEN
237 #define ClrDarkKhaki GRAPHICS_COLOR_DARK_KHAKI
238 #define ClrDarkMagenta GRAPHICS_COLOR_DARK_MAGENTA
239 #define ClrDarkOliveGreen GRAPHICS_COLOR_DARK_OLIVE_GREEN
240 #define ClrDarkOrange GRAPHICS_COLOR_DARK_ORANGE
241 #define ClrDarkOrchid GRAPHICS_COLOR_DARK_ORCHID
242 #define ClrDarkRed GRAPHICS_COLOR_DARK_RED
243 #define ClrDarkSalmon GRAPHICS_COLOR_DARK_SALMON
244 #define ClrDarkSeaGreen GRAPHICS_COLOR_DARK_SEA_GREEN
245 #define ClrDarkSlateBlue GRAPHICS_COLOR_DARK_SLATE_BLUE
246 #define ClrDarkSlateGray GRAPHICS_COLOR_DARK_SLATE_GRAY
247 #define ClrDarkTurquoise GRAPHICS_COLOR_DARK_TURQUOISE
248 #define ClrDarkViolet GRAPHICS_COLOR_DARK_VIOLET
249 #define ClrDeepPink GRAPHICS_COLOR_DEEP_PINK
250 #define ClrDeepSkyBlue GRAPHICS_COLOR_DEEP_SKY_BLUE
251 #define ClrDimGray GRAPHICS_COLOR_DIM_GRAY
252 #define ClrDodgerBlue GRAPHICS_COLOR_DODGER_BLUE
253 #define ClrFireBrick GRAPHICS_COLOR_FIRE_BRICK
254 #define ClrFloralWhite GRAPHICS_COLOR_FLORAL_WHITE
255 #define ClrForestGreen GRAPHICS_COLOR_FOREST_GREEN
256 #define ClrFuchsia GRAPHICS_COLOR_FUCHSIA
257 #define ClrGainsboro GRAPHICS_COLOR_GAINSBORO
258 #define ClrGhostWhite GRAPHICS_COLOR_GHOST_WHITE
259 #define ClrGold GRAPHICS_COLOR_GOLD
260 #define ClrGoldenrod GRAPHICS_COLOR_GOLDENRON
261 #define ClrGray GRAPHICS_COLOR_GRAY
262 #define ClrGreen GRAPHICS_COLOR_GREEN
263 #define ClrGreenYellow GRAPHICS_COLOR_GREEN_YELLOW
264 #define ClrHoneydew GRAPHICS_COLOR_HONEYDEW
265 #define ClrHotPink GRAPHICS_COLOR_HOT_PINK
266 #define ClrIndianRed GRAPHICS_COLOR_INDIAN_RED
267 #define ClrIndigo GRAPHICS_COLOR_INDIGO
268 #define ClrIvory GRAPHICS_COLOR_IVORY
269 #define ClrKhaki GRAPHICS_COLOR_KHAKI
270 #define ClrLavender GRAPHICS_COLOR_LAVENDER
271 #define ClrLavenderBlush GRAPHICS_COLOR_LAVENDER_BLUSH
272 #define ClrLawnGreen GRAPHICS_COLOR_LAWN_GREEN
273 #define ClrLemonChiffon GRAPHICS_COLOR_LEMON_CHIFFON
274 #define ClrLightBlue GRAPHICS_COLOR_LIGHT_BLUE
275 #define ClrLightCoral GRAPHICS_COLOR_LIGHT_CORAL
276 #define ClrLightCyan GRAPHICS_COLOR_LIGHT_CYAN
277 #define ClrLightGoldenrodYellow GRAPHICS_COLOR_LIGHT_GOLDENRON_YELLOW
278 #define ClrLightGreen GRAPHICS_COLOR_LIGHT_GREEN
279 #define ClrLightGrey GRAPHICS_COLOR_LIGHT_GRAY
280 #define ClrLightPink GRAPHICS_COLOR_LIGHT_PINK
281 #define ClrLightSalmon GRAPHICS_COLOR_LIGHT_SALMON
282 #define ClrLightSeaGreen GRAPHICS_COLOR_LIGHT_SEA_GREEN
283 #define ClrLightSkyBlue GRAPHICS_COLOR_LIGHT_SKY_BLUE
284 #define ClrLightSlateGray GRAPHICS_COLOR_LIGHT_SLATE_GRAY
285 #define ClrLightSteelBlue GRAPHICS_COLOR_LIGHT_STEEL_BLUE
286 #define ClrLightYellow GRAPHICS_COLOR_LIGHT_YELLOW
287 #define ClrLime GRAPHICS_COLOR_LIME
288 #define ClrLimeGreen GRAPHICS_COLOR_LIME_GREEN
289 #define ClrLinen GRAPHICS_COLOR_LINEN
290 #define ClrMagenta GRAPHICS_COLOR_MAGENTA
291 #define ClrMaroon GRAPHICS_COLOR_MAROON
292 #define ClrMediumAquamarine GRAPHICS_COLOR_MEDIUM_AQUAMARINE
293 #define ClrMediumBlue GRAPHICS_COLOR_MEDIUM_BLUE
294 #define ClrMediumOrchid GRAPHICS_COLOR_MEDIUM_ORCHID
295 #define ClrMediumPurple GRAPHICS_COLOR_MEDIUM_PURPLE
296 #define ClrMediumSeaGreen GRAPHICS_COLOR_MEDIUM_SEA_GREEN
297 #define ClrMediumSlateBlue GRAPHICS_COLOR_MEDIUM_SLATE_BLUE
298 #define ClrMediumSpringGreen GRAPHICS_COLOR_MEDIUM_SPRING_GREEN
299 #define ClrMediumTurquoise GRAPHICS_COLOR_MEDIUM_TURQUOISE
300 #define ClrMediumVioletRed GRAPHICS_COLOR_MEDIUM_VIOLET_RED
301 #define ClrMidnightBlue GRAPHICS_COLOR_MIGNIGHT_BLUE
302 #define ClrMintCream GRAPHICS_COLOR_MINT_CREAM
303 #define ClrMistyRose GRAPHICS_COLOR_MISTY_ROSE
304 #define ClrMoccasin GRAPHICS_COLOR_MOCCASIN
305 #define ClrNavajoWhite GRAPHICS_COLOR_NAVAJO_WHITE
306 #define ClrNavy GRAPHICS_COLOR_NAVY
307 #define ClrOldLace GRAPHICS_COLOR_OLD_LACE
308 #define ClrOlive GRAPHICS_COLOR_OLIVE
309 #define ClrOliveDrab GRAPHICS_COLOR_OLIVE_DRAB
310 #define ClrOrange GRAPHICS_COLOR_ORANGE
311 #define ClrOrangeRed GRAPHICS_COLOR_ORANGE_RED
312 #define ClrOrchid GRAPHICS_COLOR_ORCHID
313 #define ClrPaleGoldenrod GRAPHICS_COLOR_PALE_GOLDENRON
314 #define ClrPaleGreen GRAPHICS_COLOR_PALE_GREEN
315 #define ClrPaleTurquoise GRAPHICS_COLOR_PALE_TURQUOISE
316 #define ClrPaleVioletRed GRAPHICS_COLOR_PALE_VIOLET_RED
317 #define ClrPapayaWhip GRAPHICS_COLOR_PAPAYA_WHIP
318 #define ClrPeachPuff GRAPHICS_COLOR_PEACH_PUFF
319 #define ClrPeru GRAPHICS_COLOR_PERU
320 #define ClrPink GRAPHICS_COLOR_PINK
321 #define ClrPlum GRAPHICS_COLOR_PLUM
322 #define ClrPowderBlue GRAPHICS_COLOR_POWDER_BLUE
323 #define ClrPurple GRAPHICS_COLOR_PURPLE
324 #define ClrRed GRAPHICS_COLOR_RED
325 #define ClrRosyBrown GRAPHICS_COLOR_ROSY_BROWN
326 #define ClrRoyalBlue GRAPHICS_COLOR_ROYAL_BLUE
327 #define ClrSaddleBrown GRAPHICS_COLOR_SADDLE_BROWN
328 #define ClrSalmon GRAPHICS_COLOR_SALMON
329 #define ClrSandyBrown GRAPHICS_COLOR_SANDY_BROWN
330 #define ClrSeaGreen GRAPHICS_COLOR_SEA_GREEN
331 #define ClrSeashell GRAPHICS_COLOR_SEASHELL
332 #define ClrSienna GRAPHICS_COLOR_SIENNA
333 #define ClrSilver GRAPHICS_COLOR_SILVER
334 #define ClrSkyBlue GRAPHICS_COLOR_SKY_BLUE
335 #define ClrSlateBlue GRAPHICS_COLOR_SLATE_BLUE
336 #define ClrSlateGray GRAPHICS_COLOR_SLATE_GRAY
337 #define ClrSnow GRAPHICS_COLOR_SNOW
338 #define ClrSpringGreen GRAPHICS_COLOR_SPRING_GREEN
339 #define ClrSteelBlue GRAPHICS_COLOR_STEEL_BLUE
340 #define ClrTan GRAPHICS_COLOR_TAN
341 #define ClrTeal GRAPHICS_COLOR_TEAL
342 #define ClrThistle GRAPHICS_COLOR_THISTLE
343 #define ClrTomato GRAPHICS_COLOR_TOMATO
344 #define ClrTurquoise GRAPHICS_COLOR_TURQUOISE
345 #define ClrViolet GRAPHICS_COLOR_VIOLET
346 #define ClrWheat GRAPHICS_COLOR_WHEAT
347 #define ClrWhite GRAPHICS_COLOR_WHITE
348 #define ClrWhiteSmoke GRAPHICS_COLOR_WHITE_SMOKE
349 #define ClrYellow GRAPHICS_COLOR_YELLOW
350 #define ClrYellowGreen GRAPHICS_COLOR_YELLOW_GREEN
351 #define ClrBlack GRAPHICS_COLOR_BLACK
352 #define FONT_FMT_UNCOMPRESSED GRAPHICS_FONT_FMT_UNCOMPRESSED
353 #define FONT_FMT_PIXEL_RLE GRAPHICS_FONT_FMT_PIXEL_RLE
354 #define FONT_EX_MARKER GRAPHICS_FONT_EX_MARKER
355 #define FONT_FMT_EX_UNCOMPRESSED GRAPHICS_FONT_FMT_EX_UNCOMPRESSED
356 #define FONT_FMT_EX_PIXEL_RLE GRAPHICS_FONT_FMT_EX_PIXEL_RLE
357 #define AUTO_STRING_LENGTH GRAPHICS_AUTO_STRING_LENGTH
358 #define OPAQUE_TEXT GRAPHICS_OPAQUE_TEXT
359 #define TRANSPARENT_TEXT GRAPHICS_TRANSPARENT_TEXT
360 #define IMAGE_FMT_1BPP_UNCOMP GRAPHICS_IMAGE_FMT_1BPP_UNCOMP
361 #define IMAGE_FMT_2BPP_UNCOMP GRAPHICS_IMAGE_FMT_2BPP_UNCOMP
362 #define IMAGE_FMT_4BPP_UNCOMP GRAPHICS_IMAGE_FMT_4BPP_UNCOMP
363 #define IMAGE_FMT_8BPP_UNCOMP GRAPHICS_IMAGE_FMT_8BPP_UNCOMP
364 #define IMAGE_FMT_1BPP_COMP_RLE4 GRAPHICS_IMAGE_FMT_1BPP_COMP_RLE4
365 #define IMAGE_FMT_2BPP_UNCOMP GRAPHICS_IMAGE_FMT_2BPP_UNCOMP
366 #define IMAGE_FMT_4BPP_COMP_RLE4 GRAPHICS_IMAGE_FMT_4BPP_COMP_RLE4
367 #define IMAGE_FMT_1BPP_COMP_RLE7 GRAPHICS_IMAGE_FMT_1BPP_COMP_RLE7
368 #define IMAGE_FMT_1BPP_COMP_RLE8 GRAPHICS_IMAGE_FMT_1BPP_COMP_RLE8
369 #define IMAGE_FMT_2BPP_COMP_RLE8 GRAPHICS_IMAGE_FMT_2BPP_COMP_RLE8
370 #define IMAGE_FMT_4BPP_COMP_RLE8 GRAPHICS_IMAGE_FMT_4BPP_COMP_RLE8
371 #define IMAGE_FMT_8BPP_COMP_RLE8 GRAPHICS_IMAGE_FMT_8BPP_COMP_RLE8
372 #define IMAGE_FMT_8BPP_COMP_RLEBLEND GRAPHICS_IMAGE_FMT_8BPP_COMP_RLEBLEND
373 #define tFontEx Graphics_FontEx
374 #define tFont Graphics_Font
375 #define tDisplay Graphics_Display
376 #define tRectangle Graphics_Rectangle
377 #define tImage Graphics_Image
378 #define tContext Graphics_Context
379 #define sXMax xMax
380 #define sXMin xMin
381 #define sYMax yMax
382 #define sYMin yMin
383 
384 //*****************************************************************************
385 //
386 // Deprecated function names. These definitions ensure backwards compatibility
387 // but new code should avoid using deprecated function names since these will
388 // be removed at some point in the future.
389 //
390 //*****************************************************************************
391 #define GrCircleDraw Graphics_drawCircle
392 #define GrCircleFill Graphics_fillCircle
393 #define GrContextClipRegionSet Graphics_setClipRegion
394 #define GrContextInit Graphics_initContext
395 #define GrImageDraw Graphics_drawImage
396 #define GrLineDraw Graphics_drawLine
397 #define GrLineDrawH Graphics_drawLineH
398 #define GrLineDrawV Graphics_drawLineV
399 #define GrRectDraw Graphics_drawRectangle
400 #define GrRectFill Graphics_fillRectangle
401 #define GrStringDraw Graphics_drawString
402 #define GrStringWidthGet Graphics_getStringWidth
403 #define GrRectOverlapCheck Graphics_isOverlappingRectangle
404 #define GrRectIntersectGet Graphics_getRectangleIntersection
405 #define GrContextBackgroundSet Graphics_setBackgroundColor
406 #define GrContextBackgroundSetTranslated \
407  Graphics_setBackgroundColorTranslated
408 #define GrContextDpyWidthGet Graphics_getDisplayWidth
409 #define GrContextDpyHeightGet Graphics_getDisplayHeight
410 #define GrContextFontSet Graphics_setFont
411 #define GrContextForegroundSet Graphics_setForegroundColor
412 #define GrContextForegroundSetTranslated \
413  Graphics_setForegroundColorTranslated
414 #define GrFlush Graphics_flushBuffer
415 #define GrClearDisplay Graphics_clearDisplay
416 #define GrFontBaselineGet Graphics_getFontBaseline
417 #define GrFontHeightGet Graphics_getFontHeight
418 #define GrFontMaxWidthGet Graphics_getFontMaxWidth
419 #define GrImageColorsGet Graphics_getImageColors
420 #define GrImageHeightGet Graphics_getImageHeight
421 #define GrImageWidthGet Graphics_getImageWidth
422 #define GrOffScreen1BPPSize \
423  Graphics_getOffscreen1BppImageSize
424 #define GrOffScreen4BPPSize \
425  Graphics_getOffscreen4BppImageSize
426 #define GrOffScreen8BPPSize \
427  Graphics_getOffscreen8BppImageSize
428 #define GrPixelDraw Graphics_drawPixel
429 #define GrStringBaselineGet Graphics_getStringBaseline
430 #define GrStringDrawCentered Graphics_drawStringCentered
431 #define GrStringHeightGet Graphics_getStringHeight
432 #define GrStringMaxWidthGet Graphics_getStringMaxWidth
433 #define DpyColorTranslate Graphics_translateColorOnDisplay
434 #define DpyFlush Graphics_flushOnDisplay
435 #define DpyClearDisplay Graphics_clearDisplayOnDisplay
436 #define DpyHeightGet Graphics_getHeightOfDisplay
437 #define DpyLineDrawH \
438  Graphics_drawHorizontalLineOnDisplay
439 #define DpyLineDrawV Graphics_drawVerticalLineOnDisplay
440 #define DpyPixelDraw Graphics_drawPixelOnDisplay
441 #define DpyPixelDrawMultiple \
442  Graphics_drawMultiplePixelsOnDisplay
443 #define DpyRectFill Graphics_fillRectangleOnDisplay
444 #define DpyWidthGet Graphics_getWidthOfDisplay
445 #define GrRectContainsPoint Graphics_isPointWithinRectangle
446 
447 //*****************************************************************************
448 //
450 //
451 //*****************************************************************************
452 #define GRAPHICS_FONT_FMT_UNCOMPRESSED 0x00
453 
454 //*****************************************************************************
455 //
457 //
458 //*****************************************************************************
459 #define GRAPHICS_FONT_FMT_PIXEL_RLE 0x01
460 
461 //*****************************************************************************
462 //
465 //
466 //*****************************************************************************
467 #define GRAPHICS_FONT_EX_MARKER 0x80
468 
469 //*****************************************************************************
470 //
473 //
474 //*****************************************************************************
475 #define GRAPHICS_FONT_FMT_EX_UNCOMPRESSED (FONT_FMT_UNCOMPRESSED | \
476  FONT_EX_MARKER)
477 
478 //*****************************************************************************
479 //
482 //
483 //*****************************************************************************
484 #define GRAPHICS_FONT_FMT_EX_PIXEL_RLE (FONT_FMT_PIXEL_RLE | \
485  FONT_EX_MARKER)
486 
487 //*****************************************************************************
488 //
491 //
492 //*****************************************************************************
493 #define GRAPHICS_AUTO_STRING_LENGTH -1
494 
495 //*****************************************************************************
496 //
499 //
500 //*****************************************************************************
501 #define GRAPHICS_OPAQUE_TEXT 1
502 
503 //*****************************************************************************
504 //
507 //
508 //*****************************************************************************
509 #define GRAPHICS_TRANSPARENT_TEXT 0
510 
511 //*****************************************************************************
512 //
515 //
516 //*****************************************************************************
517 #define GRAPHICS_IMAGE_FMT_1BPP_UNCOMP 0x01
518 
519 //*****************************************************************************
520 //
523 //
524 //*****************************************************************************
525 #define GRAPHICS_IMAGE_FMT_2BPP_UNCOMP 0x02
526 
527 //*****************************************************************************
528 //
531 //
532 //*****************************************************************************
533 #define GRAPHICS_IMAGE_FMT_4BPP_UNCOMP 0x04
534 
535 //*****************************************************************************
536 //
539 //
540 //*****************************************************************************
541 #define GRAPHICS_IMAGE_FMT_8BPP_UNCOMP 0x08
542 
543 //*****************************************************************************
544 //
547 //
548 //*****************************************************************************
549 #define GRAPHICS_IMAGE_FMT_1BPP_COMP_RLE4 0x41
550 
551 //*****************************************************************************
552 //
555 //
556 //*****************************************************************************
557 #define GRAPHICS_IMAGE_FMT_2BPP_COMP_RLE4 0x42
558 
559 //*****************************************************************************
560 //
563 //
564 //*****************************************************************************
565 #define GRAPHICS_IMAGE_FMT_4BPP_COMP_RLE4 0x44
566 
567 //*****************************************************************************
568 //
571 //
572 //*****************************************************************************
573 #define GRAPHICS_IMAGE_FMT_1BPP_COMP_RLE7 0x71
574 
575 //*****************************************************************************
576 //
579 //
580 //*****************************************************************************
581 #define GRAPHICS_IMAGE_FMT_1BPP_COMP_RLE8 0x81
582 
583 //*****************************************************************************
584 //
587 //
588 //*****************************************************************************
589 #define GRAPHICS_IMAGE_FMT_2BPP_COMP_RLE8 0x82
590 
591 //*****************************************************************************
592 //
595 //
596 //*****************************************************************************
597 #define GRAPHICS_IMAGE_FMT_4BPP_COMP_RLE8 0x84
598 
599 //*****************************************************************************
600 //
603 //
604 //*****************************************************************************
605 #define GRAPHICS_IMAGE_FMT_8BPP_COMP_RLE8 0x88
606 
607 //*****************************************************************************
608 //
611 //
612 //*****************************************************************************
613 #define GRAPHICS_IMAGE_FMT_8BPP_COMP_RLEBLEND 0x28
614 
615 //*****************************************************************************
616 //
617 // A set of color definitions. This set is the subset of the X11 colors (from
618 // rgb.txt) that are supported by typical web browsers.
619 //
620 //*****************************************************************************
621 #define GRAPHICS_COLOR_ALICE_BLUE 0x00F0F8FF
622 #define GRAPHICS_COLOR_ANTIQUE_WHITE 0x00FAEBD7
623 #define GRAPHICS_COLOR_AQUA 0x0000FFFF
624 #define GRAPHICS_COLOR_AQUAMARINE 0x007FFFD4
625 #define GRAPHICS_COLOR_AZURE 0x00F0FFFF
626 #define GRAPHICS_COLOR_BEIGE 0x00F5F5DC
627 #define GRAPHICS_COLOR_BISQUE 0x00FFE4C4
628 #define GRAPHICS_COLOR_BLACK 0x00000000
629 #define GRAPHICS_COLOR_BLANCHED_ALMOND 0x00FFEBCD
630 #define GRAPHICS_COLOR_BLUE 0x000000FF
631 #define GRAPHICS_COLOR_BLUE_VIOLET 0x008A2BE2
632 #define GRAPHICS_COLOR_BROWN 0x00A52A2A
633 #define GRAPHICS_COLOR_BURLY_WOOD 0x00DEB887
634 #define GRAPHICS_COLOR_CADET_BLUE 0x005F9EA0
635 #define GRAPHICS_COLOR_CHARTREUSE 0x007FFF00
636 #define GRAPHICS_COLOR_CHOCOLATE 0x00D2691E
637 #define GRAPHICS_COLOR_CORAL 0x00FF7F50
638 #define GRAPHICS_COLOR_CORNFLOWER_BLUE 0x006495ED
639 #define GRAPHICS_COLOR_CORNSILK 0x00FFF8DC
640 #define GRAPHICS_COLOR_CRIMSON 0x00DC143C
641 #define GRAPHICS_COLOR_CYAN 0x0000FFFF
642 #define GRAPHICS_COLOR_DARK_BLUE 0x0000008B
643 #define GRAPHICS_COLOR_DARK_CYAN 0x00008B8B
644 #define GRAPHICS_COLOR_DARK_GOLDENROD 0x00B8860B
645 #define GRAPHICS_COLOR_DARK_GRAY 0x00A9A9A9
646 #define GRAPHICS_COLOR_DARK_GREEN 0x00006400
647 #define GRAPHICS_COLOR_DARK_KHAKI 0x00BDB76B
648 #define GRAPHICS_COLOR_DARK_MAGENTA 0x008B008B
649 #define GRAPHICS_COLOR_DARK_OLIVE_GREEN 0x00556B2F
650 #define GRAPHICS_COLOR_DARK_ORANGE 0x00FF8C00
651 #define GRAPHICS_COLOR_DARK_ORCHID 0x009932CC
652 #define GRAPHICS_COLOR_DARK_RED 0x008B0000
653 #define GRAPHICS_COLOR_DARK_SALMON 0x00E9967A
654 #define GRAPHICS_COLOR_DARK_SEA_GREEN 0x008FBC8F
655 #define GRAPHICS_COLOR_DARK_SLATE_BLUE 0x00483D8B
656 #define GRAPHICS_COLOR_DARK_SLATE_GRAY 0x002F4F4F
657 #define GRAPHICS_COLOR_DARK_TURQUOISE 0x0000CED1
658 #define GRAPHICS_COLOR_DARK_VIOLET 0x009400D3
659 #define GRAPHICS_COLOR_DEEP_PINK 0x00FF1493
660 #define GRAPHICS_COLOR_DEEP_SKY_BLUE 0x0000BFFF
661 #define GRAPHICS_COLOR_DIM_GRAY 0x00696969
662 #define GRAPHICS_COLOR_DODGER_BLUE 0x001E90FF
663 #define GRAPHICS_COLOR_FIRE_BRICK 0x00B22222
664 #define GRAPHICS_COLOR_FLORAL_WHITE 0x00FFFAF0
665 #define GRAPHICS_COLOR_FOREST_GREEN 0x00228B22
666 #define GRAPHICS_COLOR_FUCHSIA 0x00FF00FF
667 #define GRAPHICS_COLOR_GAINSBORO 0x00DCDCDC
668 #define GRAPHICS_COLOR_GHOST_WHITE 0x00F8F8FF
669 #define GRAPHICS_COLOR_GOLD 0x00FFD700
670 #define GRAPHICS_COLOR_GOLDENRON 0x00DAA520
671 #define GRAPHICS_COLOR_GRAY 0x00808080
672 #define GRAPHICS_COLOR_GREEN 0x00008000
673 #define GRAPHICS_COLOR_GREEN_YELLOW 0x00ADFF2F
674 #define GRAPHICS_COLOR_HONEYDEW 0x00F0FFF0
675 #define GRAPHICS_COLOR_HOT_PINK 0x00FF69B4
676 #define GRAPHICS_COLOR_INDIAN_RED 0x00CD5C5C
677 #define GRAPHICS_COLOR_INDIGO 0x004B0082
678 #define GRAPHICS_COLOR_IVORY 0x00FFFFF0
679 #define GRAPHICS_COLOR_KHAKI 0x00F0E68C
680 #define GRAPHICS_COLOR_LAVENDER 0x00E6E6FA
681 #define GRAPHICS_COLOR_LAVENDER_BLUSH 0x00FFF0F5
682 #define GRAPHICS_COLOR_LAWN_GREEN 0x007CFC00
683 #define GRAPHICS_COLOR_LEMON_CHIFFON 0x00FFFACD
684 #define GRAPHICS_COLOR_LIGHT_BLUE 0x00ADD8E6
685 #define GRAPHICS_COLOR_LIGHT_CORAL 0x00F08080
686 #define GRAPHICS_COLOR_LIGHT_CYAN 0x00E0FFFF
687 #define GRAPHICS_COLOR_LIGHT_GOLDENRON_YELLOW 0x00FAFAD2
688 #define GRAPHICS_COLOR_LIGHT_GREEN 0x0090EE90
689 #define GRAPHICS_COLOR_LIGHT_GRAY 0x00D3D3D3
690 #define GRAPHICS_COLOR_LIGHT_PINK 0x00FFB6C1
691 #define GRAPHICS_COLOR_LIGHT_SALMON 0x00FFA07A
692 #define GRAPHICS_COLOR_LIGHT_SEA_GREEN 0x0020B2AA
693 #define GRAPHICS_COLOR_LIGHT_SKY_BLUE 0x0087CEFA
694 #define GRAPHICS_COLOR_LIGHT_SLATE_GRAY 0x00778899
695 #define GRAPHICS_COLOR_LIGHT_STEEL_BLUE 0x00B0C4DE
696 #define GRAPHICS_COLOR_LIGHT_YELLOW 0x00FFFFE0
697 #define GRAPHICS_COLOR_LIME 0x0000FF00
698 #define GRAPHICS_COLOR_LIME_GREEN 0x0032CD32
699 #define GRAPHICS_COLOR_LINEN 0x00FAF0E6
700 #define GRAPHICS_COLOR_MAGENTA 0x00FF00FF
701 #define GRAPHICS_COLOR_MAROON 0x00800000
702 #define GRAPHICS_COLOR_MEDIUM_AQUAMARINE 0x0066CDAA
703 #define GRAPHICS_COLOR_MEDIUM_BLUE 0x000000CD
704 #define GRAPHICS_COLOR_MEDIUM_ORCHID 0x00BA55D3
705 #define GRAPHICS_COLOR_MEDIUM_PURPLE 0x009370DB
706 #define GRAPHICS_COLOR_MEDIUM_SEA_GREEN 0x003CB371
707 #define GRAPHICS_COLOR_MEDIUM_SLATE_BLUE 0x007B68EE
708 #define GRAPHICS_COLOR_MEDIUM_SPRING_GREEN 0x0000FA9A
709 #define GRAPHICS_COLOR_MEDIUM_TURQUOISE 0x0048D1CC
710 #define GRAPHICS_COLOR_MEDIUM_VIOLET_RED 0x00C71585
711 #define GRAPHICS_COLOR_MIGNIGHT_BLUE 0x00191970
712 #define GRAPHICS_COLOR_MINT_CREAM 0x00F5FFFA
713 #define GRAPHICS_COLOR_MISTY_ROSE 0x00FFE4E1
714 #define GRAPHICS_COLOR_MOCCASIN 0x00FFE4B5
715 #define GRAPHICS_COLOR_NAVAJO_WHITE 0x00FFDEAD
716 #define GRAPHICS_COLOR_NAVY 0x00000080
717 #define GRAPHICS_COLOR_OLD_LACE 0x00FDF5E6
718 #define GRAPHICS_COLOR_OLIVE 0x00808000
719 #define GRAPHICS_COLOR_OLIVE_DRAB 0x006B8E23
720 #define GRAPHICS_COLOR_ORANGE 0x00FFA500
721 #define GRAPHICS_COLOR_ORANGE_RED 0x00FF4500
722 #define GRAPHICS_COLOR_ORCHID 0x00DA70D6
723 #define GRAPHICS_COLOR_PALE_GOLDENRON 0x00EEE8AA
724 #define GRAPHICS_COLOR_PALE_GREEN 0x0098FB98
725 #define GRAPHICS_COLOR_PALE_TURQUOISE 0x00AFEEEE
726 #define GRAPHICS_COLOR_PALE_VIOLET_RED 0x00DB7093
727 #define GRAPHICS_COLOR_PAPAYA_WHIP 0x00FFEFD5
728 #define GRAPHICS_COLOR_PEACH_PUFF 0x00FFDAB9
729 #define GRAPHICS_COLOR_PERU 0x00CD853F
730 #define GRAPHICS_COLOR_PINK 0x00FFC0CB
731 #define GRAPHICS_COLOR_PLUM 0x00DDA0DD
732 #define GRAPHICS_COLOR_POWDER_BLUE 0x00B0E0E6
733 #define GRAPHICS_COLOR_PURPLE 0x00800080
734 #define GRAPHICS_COLOR_RED 0x00FF0000
735 #define GRAPHICS_COLOR_ROSY_BROWN 0x00BC8F8F
736 #define GRAPHICS_COLOR_ROYAL_BLUE 0x004169E1
737 #define GRAPHICS_COLOR_SADDLE_BROWN 0x008B4513
738 #define GRAPHICS_COLOR_SALMON 0x00FA8072
739 #define GRAPHICS_COLOR_SANDY_BROWN 0x00F4A460
740 #define GRAPHICS_COLOR_SEA_GREEN 0x002E8B57
741 #define GRAPHICS_COLOR_SEASHELL 0x00FFF5EE
742 #define GRAPHICS_COLOR_SIENNA 0x00A0522D
743 #define GRAPHICS_COLOR_SILVER 0x00C0C0C0
744 #define GRAPHICS_COLOR_SKY_BLUE 0x0087CEEB
745 #define GRAPHICS_COLOR_SLATE_BLUE 0x006A5ACD
746 #define GRAPHICS_COLOR_SLATE_GRAY 0x00708090
747 #define GRAPHICS_COLOR_SNOW 0x00FFFAFA
748 #define GRAPHICS_COLOR_SPRING_GREEN 0x0000FF7F
749 #define GRAPHICS_COLOR_STEEL_BLUE 0x004682B4
750 #define GRAPHICS_COLOR_TAN 0x00D2B48C
751 #define GRAPHICS_COLOR_TEAL 0x00008080
752 #define GRAPHICS_COLOR_THISTLE 0x00D8BFD8
753 #define GRAPHICS_COLOR_TOMATO 0x00FF6347
754 #define GRAPHICS_COLOR_TURQUOISE 0x0040E0D0
755 #define GRAPHICS_COLOR_VIOLET 0x00EE82EE
756 #define GRAPHICS_COLOR_WHEAT 0x00F5DEB3
757 #define GRAPHICS_COLOR_WHITE 0x00FFFFFF
758 #define GRAPHICS_COLOR_WHITE_SMOKE 0x00F5F5F5
759 #define GRAPHICS_COLOR_YELLOW 0x00FFFF00
760 #define GRAPHICS_COLOR_YELLOW_GREEN 0x009ACD32
761 #define GRAPHICS_COLOR_BLACK 0x00000000
762 
763 //*****************************************************************************
764 //
765 // Masks and shifts to aid in color format translation by drivers.
766 //
767 //*****************************************************************************
768 #define ClrRedMask 0x00FF0000
769 #define ClrRedShift 16
770 #define ClrGreenMask 0x0000FF00
771 #define ClrGreenShift 8
772 #define ClrBlueMask 0x000000FF
773 #define ClrBlueShift 0
774 
775 //*****************************************************************************
776 //
777 // Prototypes for the predefined fonts in the graphics library. ..Cm.. is the
778 // computer modern font, which is a serif font. ..Cmsc.. is the computer
779 // modern small-caps font, which is also a serif font. ..Cmss.. is the
780 // computer modern sans-serif font.
781 //
782 //*****************************************************************************
783 extern const Graphics_Font g_sFontCm12;
784 extern const Graphics_Font g_sFontCm12b;
785 extern const Graphics_Font g_sFontCm12i;
786 extern const Graphics_Font g_sFontCm14;
787 extern const Graphics_Font g_sFontCm14b;
788 extern const Graphics_Font g_sFontCm14i;
789 extern const Graphics_Font g_sFontCm16;
790 extern const Graphics_Font g_sFontCm16b;
791 extern const Graphics_Font g_sFontCm16i;
792 extern const Graphics_Font g_sFontCm18;
793 extern const Graphics_Font g_sFontCm18b;
794 extern const Graphics_Font g_sFontCm18i;
795 extern const Graphics_Font g_sFontCm20;
796 extern const Graphics_Font g_sFontCm20b;
797 extern const Graphics_Font g_sFontCm20i;
798 extern const Graphics_Font g_sFontCm22;
799 extern const Graphics_Font g_sFontCm22b;
800 extern const Graphics_Font g_sFontCm22i;
801 extern const Graphics_Font g_sFontCm24;
802 extern const Graphics_Font g_sFontCm24b;
803 extern const Graphics_Font g_sFontCm24i;
804 extern const Graphics_Font g_sFontCm26;
805 extern const Graphics_Font g_sFontCm26b;
806 extern const Graphics_Font g_sFontCm26i;
807 extern const Graphics_Font g_sFontCm28;
808 extern const Graphics_Font g_sFontCm28b;
809 extern const Graphics_Font g_sFontCm28i;
810 extern const Graphics_Font g_sFontCm30;
811 extern const Graphics_Font g_sFontCm30b;
812 extern const Graphics_Font g_sFontCm30i;
813 extern const Graphics_Font g_sFontCm32;
814 extern const Graphics_Font g_sFontCm32b;
815 extern const Graphics_Font g_sFontCm32i;
816 extern const Graphics_Font g_sFontCm34;
817 extern const Graphics_Font g_sFontCm34b;
818 extern const Graphics_Font g_sFontCm34i;
819 extern const Graphics_Font g_sFontCm36;
820 extern const Graphics_Font g_sFontCm36b;
821 extern const Graphics_Font g_sFontCm36i;
822 extern const Graphics_Font g_sFontCm38;
823 extern const Graphics_Font g_sFontCm38b;
824 extern const Graphics_Font g_sFontCm38i;
825 extern const Graphics_Font g_sFontCm40;
826 extern const Graphics_Font g_sFontCm40b;
827 extern const Graphics_Font g_sFontCm40i;
828 extern const Graphics_Font g_sFontCm42;
829 extern const Graphics_Font g_sFontCm42b;
830 extern const Graphics_Font g_sFontCm42i;
831 extern const Graphics_Font g_sFontCm44;
832 extern const Graphics_Font g_sFontCm44b;
833 extern const Graphics_Font g_sFontCm44i;
834 extern const Graphics_Font g_sFontCm46;
835 extern const Graphics_Font g_sFontCm46b;
836 extern const Graphics_Font g_sFontCm46i;
837 extern const Graphics_Font g_sFontCm48;
838 extern const Graphics_Font g_sFontCm48b;
839 extern const Graphics_Font g_sFontCm48i;
840 extern const Graphics_Font g_sFontCmsc12;
841 extern const Graphics_Font g_sFontCmsc14;
842 extern const Graphics_Font g_sFontCmsc16;
843 extern const Graphics_Font g_sFontCmsc18;
844 extern const Graphics_Font g_sFontCmsc20;
845 extern const Graphics_Font g_sFontCmsc22;
846 extern const Graphics_Font g_sFontCmsc24;
847 extern const Graphics_Font g_sFontCmsc26;
848 extern const Graphics_Font g_sFontCmsc28;
849 extern const Graphics_Font g_sFontCmsc30;
850 extern const Graphics_Font g_sFontCmsc32;
851 extern const Graphics_Font g_sFontCmsc34;
852 extern const Graphics_Font g_sFontCmsc36;
853 extern const Graphics_Font g_sFontCmsc38;
854 extern const Graphics_Font g_sFontCmsc40;
855 extern const Graphics_Font g_sFontCmsc42;
856 extern const Graphics_Font g_sFontCmsc44;
857 extern const Graphics_Font g_sFontCmsc46;
858 extern const Graphics_Font g_sFontCmsc48;
859 extern const Graphics_Font g_sFontCmss12;
860 extern const Graphics_Font g_sFontCmss12b;
861 extern const Graphics_Font g_sFontCmss12i;
862 extern const Graphics_Font g_sFontCmss14;
863 extern const Graphics_Font g_sFontCmss14b;
864 extern const Graphics_Font g_sFontCmss14i;
865 extern const Graphics_Font g_sFontCmss16;
866 extern const Graphics_Font g_sFontCmss16b;
867 extern const Graphics_Font g_sFontCmss16i;
868 extern const Graphics_Font g_sFontCmss18;
869 extern const Graphics_Font g_sFontCmss18b;
870 extern const Graphics_Font g_sFontCmss18i;
871 extern const Graphics_Font g_sFontCmss20;
872 extern const Graphics_Font g_sFontCmss20b;
873 extern const Graphics_Font g_sFontCmss20i;
874 extern const Graphics_Font g_sFontCmss22;
875 extern const Graphics_Font g_sFontCmss22b;
876 extern const Graphics_Font g_sFontCmss22i;
877 extern const Graphics_Font g_sFontCmss24;
878 extern const Graphics_Font g_sFontCmss24b;
879 extern const Graphics_Font g_sFontCmss24i;
880 extern const Graphics_Font g_sFontCmss26;
881 extern const Graphics_Font g_sFontCmss26b;
882 extern const Graphics_Font g_sFontCmss26i;
883 extern const Graphics_Font g_sFontCmss28;
884 extern const Graphics_Font g_sFontCmss28b;
885 extern const Graphics_Font g_sFontCmss28i;
886 extern const Graphics_Font g_sFontCmss30;
887 extern const Graphics_Font g_sFontCmss30b;
888 extern const Graphics_Font g_sFontCmss30i;
889 extern const Graphics_Font g_sFontCmss32;
890 extern const Graphics_Font g_sFontCmss32b;
891 extern const Graphics_Font g_sFontCmss32i;
892 extern const Graphics_Font g_sFontCmss34;
893 extern const Graphics_Font g_sFontCmss34b;
894 extern const Graphics_Font g_sFontCmss34i;
895 extern const Graphics_Font g_sFontCmss36;
896 extern const Graphics_Font g_sFontCmss36b;
897 extern const Graphics_Font g_sFontCmss36i;
898 extern const Graphics_Font g_sFontCmss38;
899 extern const Graphics_Font g_sFontCmss38b;
900 extern const Graphics_Font g_sFontCmss38i;
901 extern const Graphics_Font g_sFontCmss40;
902 extern const Graphics_Font g_sFontCmss40b;
903 extern const Graphics_Font g_sFontCmss40i;
904 extern const Graphics_Font g_sFontCmss42;
905 extern const Graphics_Font g_sFontCmss42b;
906 extern const Graphics_Font g_sFontCmss42i;
907 extern const Graphics_Font g_sFontCmss44;
908 extern const Graphics_Font g_sFontCmss44b;
909 extern const Graphics_Font g_sFontCmss44i;
910 extern const Graphics_Font g_sFontCmss46;
911 extern const Graphics_Font g_sFontCmss46b;
912 extern const Graphics_Font g_sFontCmss46i;
913 extern const Graphics_Font g_sFontCmss48;
914 extern const Graphics_Font g_sFontCmss48b;
915 extern const Graphics_Font g_sFontCmss48i;
916 extern const Graphics_Font g_sFontCmtt12;
917 extern const Graphics_Font g_sFontCmtt14;
918 extern const Graphics_Font g_sFontCmtt16;
919 extern const Graphics_Font g_sFontCmtt18;
920 extern const Graphics_Font g_sFontCmtt20;
921 extern const Graphics_Font g_sFontCmtt22;
922 extern const Graphics_Font g_sFontCmtt24;
923 extern const Graphics_Font g_sFontCmtt26;
924 extern const Graphics_Font g_sFontCmtt28;
925 extern const Graphics_Font g_sFontCmtt30;
926 extern const Graphics_Font g_sFontCmtt32;
927 extern const Graphics_Font g_sFontCmtt34;
928 extern const Graphics_Font g_sFontCmtt36;
929 extern const Graphics_Font g_sFontCmtt38;
930 extern const Graphics_Font g_sFontCmtt40;
931 extern const Graphics_Font g_sFontCmtt42;
932 extern const Graphics_Font g_sFontCmtt44;
933 extern const Graphics_Font g_sFontCmtt46;
934 extern const Graphics_Font g_sFontCmtt48;
935 extern const Graphics_Font g_sFontFixed6x8;
936 
937 //*****************************************************************************
938 //
939 // Language identifiers supported by the string table processing functions.
940 //
941 //*****************************************************************************
942 #define GrLangZhPRC 0x0804 // Chinese (PRC)
943 #define GrLangZhTW 0x0404 // Chinese (Taiwan)
944 #define GrLangEnUS 0x0409 // English (United States)
945 #define GrLangEnUK 0x0809 // English (United Kingdom)
946 #define GrLangEnAUS 0x0C09 // English (Australia)
947 #define GrLangEnCA 0x1009 // English (Canada)
948 #define GrLangEnNZ 0x1409 // English (New Zealand)
949 #define GrLangFr 0x040C // French (Standard)
950 #define GrLangDe 0x0407 // German (Standard)
951 #define GrLangHi 0x0439 // Hindi
952 #define GrLangIt 0x0410 // Italian (Standard)
953 #define GrLangJp 0x0411 // Japanese
954 #define GrLangKo 0x0412 // Korean
955 #define GrLangEsMX 0x080A // Spanish (Mexico)
956 #define GrLangEsSP 0x0C0A // Spanish (Spain)
957 #define GrLangSwKE 0x0441 // Swahili (Kenya)
958 #define GrLangUrIN 0x0820 // Urdu (India)
959 #define GrLangUrPK 0x0420 // Urdu (Pakistan)
960 
961 //*****************************************************************************
962 //
963 // Prototypes for the graphics library functions.
964 //
965 //*****************************************************************************
966 
967 //*****************************************************************************
968 //
981 //
982 //*****************************************************************************
983 extern void Graphics_drawCircle(const Graphics_Context *context,
984  int32_t x,
985  int32_t y,
986  int32_t lRadius);
987 extern void Graphics_fillCircle(const Graphics_Context *context,
988  int32_t x,
989  int32_t y,
990  int32_t lRadius);
991 extern void Graphics_setClipRegion(Graphics_Context *context,
992  Graphics_Rectangle *rect);
993 extern void Graphics_initContext(Graphics_Context *context,
994  Graphics_Display *display,
995  const Graphics_Display_Functions *pFxns);
996 extern void Graphics_drawImage(const Graphics_Context *context,
997  const Graphics_Image *pBitmap,
998  int16_t x,
999  int16_t y);
1000 extern void Graphics_drawLine(const Graphics_Context *context,
1001  int32_t x1,
1002  int32_t y1,
1003  int32_t x2,
1004  int32_t y2);
1005 extern void Graphics_drawLineH(const Graphics_Context *context,
1006  int32_t x1,
1007  int32_t x2,
1008  int32_t y);
1009 extern void Graphics_drawLineV(const Graphics_Context *context,
1010  int32_t x,
1011  int32_t y1,
1012  int32_t y2);
1013 extern void Graphics_drawRectangle(const Graphics_Context *context,
1014  const Graphics_Rectangle *rect);
1015 extern void Graphics_fillRectangle(const Graphics_Context *context,
1016  const Graphics_Rectangle *rect);
1017 extern void Graphics_drawString(const Graphics_Context *context,
1018  int8_t *string,
1019  int32_t lLength,
1020  int32_t x,
1021  int32_t y,
1022  bool opaque);
1023 extern int32_t Graphics_getStringWidth(const Graphics_Context *context,
1024  const int8_t *string,
1025  int32_t lLength);
1026 extern int32_t Graphics_isOverlappingRectangle(Graphics_Rectangle *psRect1,
1027  Graphics_Rectangle *psRect2);
1028 extern int32_t Graphics_getRectangleIntersection(
1029  Graphics_Rectangle *psRect1,
1030  Graphics_Rectangle *psRect2,
1032  psIntersect);
1033 extern void Graphics_setBackgroundColor(Graphics_Context *context,
1034  int32_t value);
1035 extern uint16_t Graphics_getDisplayWidth(Graphics_Context *context);
1036 extern uint16_t Graphics_getDisplayHeight(Graphics_Context *context);
1037 extern void Graphics_setFont(Graphics_Context *context,
1038  const Graphics_Font *font);
1039 extern uint8_t Graphics_getFontBaseline(const Graphics_Font *font);
1040 extern void Graphics_setForegroundColor(Graphics_Context *context,
1041  int32_t value);
1043  int32_t value);
1044 extern uint8_t Graphics_getFontHeight(const Graphics_Font *font);
1045 extern uint8_t Graphics_getFontMaxWidth(const Graphics_Font *font);
1046 extern uint16_t Graphics_getImageColors(const Graphics_Image *image);
1047 extern uint16_t Graphics_getImageHeight(const Graphics_Image *image);
1048 extern uint16_t Graphics_getImageWidth(const Graphics_Image *image);
1049 extern uint32_t Graphics_getOffscreen1BppImageSize(uint16_t width,
1050  uint16_t height);
1051 extern uint32_t Graphics_getOffscreen4BppImageSize(uint16_t width,
1052  uint16_t height);
1053 extern uint32_t Graphics_getOffScreen8BPPSize(uint16_t width,
1054  uint16_t height);
1055 extern void Graphics_drawStringCentered(const Graphics_Context *context,
1056  int8_t *string,
1057  int32_t length,
1058  int32_t x,
1059  int32_t y,
1060  bool opaque);
1061 extern uint8_t Graphics_getStringHeight(const Graphics_Context *context);
1062 extern uint8_t Graphics_getStringMaxWidth(const Graphics_Context *context);
1063 extern uint8_t Graphics_getStringBaseline(const Graphics_Context *context);
1064 extern uint32_t Graphics_translateColorOnDisplay(
1065  const Graphics_Display *display,
1066  uint32_t value);
1068  const Graphics_Display *display,
1069  uint16_t x1,
1070  uint16_t x2,
1071  uint16_t y,
1072  uint32_t value);
1073 extern void Graphics_drawVerticalLineOnDisplay(const Graphics_Display *display,
1074  uint16_t x,
1075  uint16_t y1,
1076  uint16_t y2,
1077  uint16_t value);
1078 extern void Graphics_fillRectangleOnDisplay(const Graphics_Display *display,
1079  const Graphics_Rectangle *rect,
1080  uint16_t value);
1081 extern void Graphics_flushOnDisplay(const Graphics_Display *display);
1082 extern void Graphics_drawPixel(const Graphics_Context *context,
1083  uint16_t x,
1084  uint16_t y);
1085 extern void Graphics_clearDisplay(const Graphics_Context *context);
1086 extern uint16_t Graphics_getHeightOfDisplay(const Graphics_Display *display);
1087 extern void Graphics_flushBuffer(const Graphics_Context *context);
1088 extern uint16_t Graphics_getWidthOfDisplay(const Graphics_Display *display);
1089 extern bool Graphics_isPointWithinRectangle(const Graphics_Rectangle *rect,
1090  uint16_t x,
1091  uint16_t y);
1092 extern void Graphics_drawPixelOnDisplay(const Graphics_Display *display,
1093  uint16_t x,
1094  uint16_t y,
1095  uint16_t value);
1096 extern void Graphics_clearDisplayOnDisplay(const Graphics_Display *display,
1097  uint16_t value);
1099  const Graphics_Display *display,
1100  uint16_t x,
1101  uint16_t y,
1102  uint16_t x0,
1103  uint16_t count,
1104  uint16_t bPP,
1105  const uint8_t *data,
1106  const uint32_t *pucPalette);
1107 extern void Graphics_initOffscreen1BppImage(Graphics_Display *display,
1108  uint8_t *image,
1109  int32_t width,
1110  int32_t height);
1111 extern void Graphics_initOffscreen4BppImage(Graphics_Display *display,
1112  uint8_t *image,
1113  int32_t width,
1114  int32_t height);
1115 extern void Graphics_setOffscreen4BppPalette(Graphics_Display *display,
1116  uint32_t *ppalette,
1117  uint32_t offset,
1118  uint32_t count);
1119 extern void Graphics_initOffscreen8BppImage(Graphics_Display *display,
1120  uint8_t *image,
1121  int32_t width,
1122  int32_t height);
1123 extern void Graphics_setOffscreen8BppPalette(Graphics_Display *display,
1124  uint32_t *ppalette,
1125  uint32_t offset,
1126  uint32_t count);
1127 
1128 //*****************************************************************************
1129 //
1130 // Mark the end of the C bindings section for C++ compilers.
1131 //
1132 //*****************************************************************************
1133 #ifdef __cplusplus
1134 }
1135 #endif
1136 
1137 //*****************************************************************************
1138 //
1139 // Close the Doxygen group.
1141 //
1142 //*****************************************************************************
1143 
1144 #endif // __GRLIB_H__
const uint8_t * data
A pointer to the data for the font.
Definition: grlib.h:185
const uint32_t * pPalette
Pointer to Palette.
Definition: grlib.h:52
uint8_t Graphics_getStringMaxWidth(const Graphics_Context *context)
Definition: string.c:801
void Graphics_drawLine(const Graphics_Context *context, int32_t x1, int32_t y1, int32_t x2, int32_t y2)
Definition: line.c:442
uint16_t width
The width of this display.
Definition: grlib.h:144
uint16_t offset[96]
The offset within data to the data for each character in the font.
Definition: grlib.h:160
void Graphics_setBackgroundColor(Graphics_Context *context, int32_t value)
Definition: context.c:138
uint8_t last
The codepoint number representing the last character encoded in the font.
Definition: grlib.h:183
void(*const pfnFlush)(const Graphics_Display *pDisplay)
Definition: grlib.h:124
void Graphics_drawStringCentered(const Graphics_Context *context, int8_t *string, int32_t length, int32_t x, int32_t y, bool opaque)
Definition: string.c:753
void Graphics_drawString(const Graphics_Context *context, int8_t *string, int32_t lLength, int32_t x, int32_t y, bool opaque)
Definition: string.c:179
This structure defines the characteristics of a display driver.
Definition: grlib.h:140
uint32_t Graphics_getOffScreen8BPPSize(uint16_t width, uint16_t height)
Definition: image.c:408
uint32_t Graphics_getOffscreen1BppImageSize(uint16_t width, uint16_t height)
Definition: image.c:370
void Graphics_drawHorizontalLineOnDisplay(const Graphics_Display *display, uint16_t x1, uint16_t x2, uint16_t y, uint32_t value)
Definition: display.c:91
uint8_t baseline
The offset between the top of the character cell and the baseline of the glyph. The baseline is the b...
Definition: grlib.h:181
void Graphics_setForegroundColorTranslated(Graphics_Context *context, int32_t value)
Definition: context.c:243
int32_t Graphics_getRectangleIntersection(Graphics_Rectangle *psRect1, Graphics_Rectangle *psRect2, Graphics_Rectangle *psIntersect)
Definition: rectangle.c:224
uint16_t Graphics_getWidthOfDisplay(const Graphics_Display *display)
Definition: context.c:409
uint32_t foreground
The color used to draw primitives onto the screen.
Definition: grlib.h:199
uint16_t numColors
Number of Colors in Palette.
Definition: grlib.h:51
int16_t yMin
The minimum Y coordinate of the rectangle.
Definition: grlib.h:66
uint16_t heigth
The height of this display.
Definition: grlib.h:145
int32_t size
The size of this structure.
Definition: grlib.h:196
void Graphics_drawLineV(const Graphics_Context *context, int32_t x, int32_t y1, int32_t y2)
Definition: line.c:114
void(*const pfnLineDrawV)(const Graphics_Display *pDisplay, int16_t lX, int16_t lY1, int16_t lY2, uint16_t ulValue)
A pointer to the function to draw a vertical line on this display.
Definition: grlib.h:104
uint8_t height
The height of the character cell; this may be taller than the font data for the characters (to provid...
Definition: grlib.h:180
bool Graphics_isPointWithinRectangle(const Graphics_Rectangle *rect, uint16_t x, uint16_t y)
Definition: rectangle.c:274
const Graphics_Display * display
The screen onto which drawing operations are performed.
Definition: grlib.h:197
This structure defines the characteristics of a Bitmap Image.
Definition: grlib.h:46
void * displayData
A pointer to display driver-specific data.
Definition: grlib.h:143
void Graphics_setForegroundColor(Graphics_Context *context, int32_t value)
Definition: context.c:221
void Graphics_clearDisplayOnDisplay(const Graphics_Display *display, uint16_t value)
Definition: display.c:204
uint32_t Graphics_translateColorOnDisplay(const Graphics_Display *display, uint32_t value)
Definition: display.c:168
void Graphics_clearDisplay(const Graphics_Context *context)
Definition: context.c:365
uint16_t xSize
xSize
Definition: grlib.h:49
uint8_t Graphics_getFontHeight(const Graphics_Font *font)
Definition: context.c:262
uint8_t format
The format of the font. Can be one of FONT_FMT_EX_UNCOMPRESSED or FONT_FMT_EX_PIXEL_RLE.
Definition: grlib.h:178
const uint16_t * offset
A pointer to a table containing the offset within data to the data for each character in the font...
Definition: grlib.h:184
void(*const pfnLineDrawH)(const Graphics_Display *pDisplay, int16_t lX1, int16_t lX2, int16_t lY, uint16_t ulValue)
A pointer to the function to draw a horizontal line on this display.
Definition: grlib.h:98
Graphics_Rectangle clipRegion
The clipping region to be used when drawing onto the screen.
Definition: grlib.h:198
uint8_t format
The format of the font. Can be one of FONT_FMT_UNCOMPRESSED or FONT_FMT_PIXEL_RLE.
Definition: grlib.h:156
void(*const pfnPixelDraw)(const Graphics_Display *pDisplay, int16_t lX, int16_t lY, uint16_t ulValue)
A pointer to the function to draw a pixel on this display.
Definition: grlib.h:84
uint8_t height
The height of the character cell; this may be taller than the font data for the characters (to provid...
Definition: grlib.h:158
void(*const pfnPixelDrawMultiple)(const Graphics_Display *pDisplay, int16_t lX, int16_t lY, int16_t lX0, int16_t lCount, int16_t lBPP, const uint8_t *pucData, const uint32_t *pucPalette)
A pointer to the function to draw multiple pixels on this display.
Definition: grlib.h:90
uint16_t Graphics_getHeightOfDisplay(const Graphics_Display *display)
Definition: context.c:330
int16_t xMin
The minimum X coordinate of the rectangle.
Definition: grlib.h:65
uint16_t ySize
ySize
Definition: grlib.h:50
int32_t size
The size of this structure.
Definition: grlib.h:142
Definition: grlib.h:194
void Graphics_drawRectangle(const Graphics_Context *context, const Graphics_Rectangle *rect)
Definition: rectangle.c:25
void Graphics_flushOnDisplay(const Graphics_Display *display)
Definition: display.c:186
void(*const pfnClearDisplay)(const Graphics_Display *pDisplay, uint16_t ulValue)
Definition: grlib.h:130
uint32_t Graphics_getOffscreen4BppImageSize(uint16_t width, uint16_t height)
Definition: image.c:389
const Graphics_Font * font
The font used to render text onto the screen.
Definition: grlib.h:201
uint16_t Graphics_getDisplayWidth(Graphics_Context *context)
Definition: context.c:296
uint16_t Graphics_getDisplayHeight(Graphics_Context *context)
Definition: context.c:313
uint32_t background
The background color used to draw primitives onto the screen.
Definition: grlib.h:200
uint8_t baseline
The offset between the top of the character cell and the baseline of the glyph. The baseline is the b...
Definition: grlib.h:159
uint16_t Graphics_getImageWidth(const Graphics_Image *image)
Definition: image.c:352
void Graphics_drawVerticalLineOnDisplay(const Graphics_Display *display, uint16_t x, uint16_t y1, uint16_t y2, uint16_t value)
Definition: display.c:118
void Graphics_drawCircle(const Graphics_Context *context, int32_t x, int32_t y, int32_t lRadius)
Definition: circle.c:26
This structure defines the implementation of a display driver.
Definition: grlib.h:79
void Graphics_fillRectangleOnDisplay(const Graphics_Display *display, const Graphics_Rectangle *rect, uint16_t value)
Definition: display.c:144
void Graphics_drawLineH(const Graphics_Context *context, int32_t x1, int32_t x2, int32_t y)
Definition: line.c:29
void Graphics_drawPixel(const Graphics_Context *context, uint16_t x, uint16_t y)
Definition: context.c:383
int16_t yMax
The maximum Y coordinate of the rectangle.
Definition: grlib.h:68
uint8_t bPP
Bits per pixel and Compressed/Uncompressed.
Definition: grlib.h:48
const Graphics_Display_Functions * pFxns
Implementation of this display.
Definition: grlib.h:146
void Graphics_initContext(Graphics_Context *context, Graphics_Display *display, const Graphics_Display_Functions *pFxns)
Definition: context.c:28
uint8_t maxWidth
The maximum width of a character; this is the width of the widest character in the font...
Definition: grlib.h:179
void Graphics_setFont(Graphics_Context *context, const Graphics_Font *font)
Definition: context.c:181
void Graphics_drawImage(const Graphics_Context *context, const Graphics_Image *pBitmap, int16_t x, int16_t y)
Definition: image.c:72
void Graphics_fillCircle(const Graphics_Context *context, int32_t x, int32_t y, int32_t lRadius)
Definition: circle.c:292
uint8_t Graphics_getStringBaseline(const Graphics_Context *context)
Definition: string.c:723
uint32_t(*const pfnColorTranslate)(const Graphics_Display *pDisplay, uint32_t ulValue)
Definition: grlib.h:117
uint8_t Graphics_getFontBaseline(const Graphics_Font *font)
Definition: context.c:203
void(*const pfnRectFill)(const Graphics_Display *pDisplay, const Graphics_Rectangle *pRect, uint16_t ulValue)
A pointer to the function to draw a filled rectangle on this display.
Definition: grlib.h:110
uint16_t Graphics_getImageHeight(const Graphics_Image *image)
Definition: image.c:336
const uint8_t * data
A pointer to the data for the font.
Definition: grlib.h:161
int16_t xMax
The maximum X coordinate of the rectangle.
Definition: grlib.h:67
uint8_t maxWidth
The maximum width of a character; this is the width of the widest character in the font...
Definition: grlib.h:157
uint8_t Graphics_getStringHeight(const Graphics_Context *context)
Definition: string.c:782
Definition: grlib.h:63
uint8_t Graphics_getFontMaxWidth(const Graphics_Font *font)
Definition: context.c:279
This structure describes a font used for drawing text onto the screen.
Definition: grlib.h:154
uint16_t Graphics_getImageColors(const Graphics_Image *image)
Definition: image.c:320
void Graphics_flushBuffer(const Graphics_Context *context)
Definition: context.c:349
int32_t Graphics_getStringWidth(const Graphics_Context *context, const int8_t *string, int32_t lLength)
Definition: string.c:59
Definition: grlib.h:176
void Graphics_setClipRegion(Graphics_Context *context, Graphics_Rectangle *rect)
Definition: context.c:90
void Graphics_drawMultiplePixelsOnDisplay(const Graphics_Display *display, uint16_t x, uint16_t y, uint16_t x0, uint16_t count, uint16_t bPP, const uint8_t *data, const uint32_t *pucPalette)
Definition: display.c:60
void Graphics_fillRectangle(const Graphics_Context *context, const Graphics_Rectangle *rect)
Definition: rectangle.c:96
void Graphics_drawPixelOnDisplay(const Graphics_Display *display, uint16_t x, uint16_t y, uint16_t value)
Definition: display.c:27
uint8_t first
The codepoint number representing the first character encoded in the font.
Definition: grlib.h:182
const uint8_t * pPixel
Pointer to pixel data;.
Definition: grlib.h:53