grlib.h
Go to the documentation of this file.
1 
2 
3 #ifndef __GRLIB_H__
4 #define __GRLIB_H__
5 
6 #define NDEBUG
7 #include "assert.h"
8 
9 //*****************************************************************************
10 //
13 //
14 //*****************************************************************************
15 
16 //*****************************************************************************
17 //
18 // If building with a C++ compiler, make all of the definitions in this header
19 // have a C binding.
20 //
21 //*****************************************************************************
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif
26 
27 //*****************************************************************************
28 //
30 //
31 //*****************************************************************************
32 typedef struct
33 {
34  //
36  //
37  unsigned char BPP;
38 
39  //
41  //
42  unsigned int XSize;
43 
44  //
46  //
47  unsigned int YSize;
48 
49  //
51  //
52 
53  unsigned int NumColors;
54 
55  //
57  //
58  const unsigned long * pPalette;
59 
60  //
62  //
63  const unsigned char * pPixel;
64 }
65 tImage;
66 
67 //*****************************************************************************
68 //
72 //
73 //*****************************************************************************
74 typedef struct
75 {
76  //
78  //
79  short sXMin;
80 
81  //
83  //
84  short sYMin;
85 
86  //
88  //
89  short sXMax;
90 
91  //
93  //
94  short sYMax;
95 }
97 
98 //*****************************************************************************
99 //
101 //
102 //*****************************************************************************
103 typedef struct
104 {
105  //
107  //
108  long lSize;
109 
110  //
112  //
114 
115  //
117  //
118  unsigned short usWidth;
119 
120  //
122  //
123  unsigned short usHeight;
124 
125  //
127  //
128  void (*pfnPixelDraw)(void *pvDisplayData, int lX, int lY,
129  unsigned int ulValue);
130 
131  //
133  //
134  void (*pfnPixelDrawMultiple)(void *pvDisplayData, int lX, int lY,
135  int lX0, int lCount, int lBPP,
136  const unsigned char *pucData,
137  const unsigned int *pucPalette);
138 
139  //
141  //
142  void (*pfnLineDrawH)(void *pvDisplayData, int lX1, int lX2, int lY,
143  unsigned int ulValue);
144 
145  //
147  //
148  void (*pfnLineDrawV)(void *pvDisplayData, int lX, int lY1, int lY2,
149  unsigned int ulValue);
150 
151  //
153  //
154  void (*pfnRectFill)(void *pvDisplayData, const tRectangle *pRect,
155  unsigned int ulValue);
156 
157  //
160  //
161  unsigned int (*pfnColorTranslate)(void *pvDisplayData,
162  unsigned long ulValue);
163 
164  //
167  //
168  void (*pfnFlush)(void *pvDisplayData);
169 
170  //
173  //
174  void (*pfnClearDisplay)(void *pvDisplayData, unsigned int ulValue);
175 }
176 tDisplay;
177 
178 //*****************************************************************************
179 //
181 //
182 //*****************************************************************************
183 typedef struct
184 {
185  //
188  //
189  unsigned char ucFormat;
190 
191  //
195  //
196  unsigned char ucMaxWidth;
197 
198  //
201  //
202  unsigned char ucHeight;
203 
204  //
208  //
209  unsigned char ucBaseline;
210 
211  //
213  //
214  unsigned short pusOffset[96];
215 
216  //
218  //
219  const unsigned char *pucData;
220 }
221 tFont;
222 
223 //*****************************************************************************
224 //
233 //
234 //*****************************************************************************
235 typedef struct
236 {
237  //
240  //
241  unsigned char ucFormat;
242 
243  //
247  //
248  unsigned char ucMaxWidth;
249 
250  //
253  //
254  unsigned char ucHeight;
255 
256  //
260  //
261  unsigned char ucBaseline;
262 
263  //
266  //
267  unsigned char ucFirst;
268 
269  //
272  //
273  unsigned char ucLast;
274 
275  //
278  //
279  const unsigned short *pusOffset;
280 
281  //
283  //
284  const unsigned char *pucData;
285 }
286 tFontEx;
287 
288 //*****************************************************************************
289 //
291 //
292 //*****************************************************************************
293 #define FONT_FMT_UNCOMPRESSED 0x00
294 
295 //*****************************************************************************
296 //
298 //
299 //*****************************************************************************
300 #define FONT_FMT_PIXEL_RLE 0x01
301 
302 //*****************************************************************************
303 //
306 //
307 //*****************************************************************************
308 #define FONT_EX_MARKER 0x80
309 
310 //*****************************************************************************
311 //
314 //
315 //*****************************************************************************
316 #define FONT_FMT_EX_UNCOMPRESSED (FONT_FMT_UNCOMPRESSED | FONT_EX_MARKER)
317 
318 //*****************************************************************************
319 //
322 //
323 //*****************************************************************************
324 #define FONT_FMT_EX_PIXEL_RLE (FONT_FMT_PIXEL_RLE | FONT_EX_MARKER)
325 
326 //*****************************************************************************
327 //
330 //
331 //*****************************************************************************
332 #define AUTO_STRING_LENGTH -1
333 
334 //*****************************************************************************
335 //
338 //
339 //*****************************************************************************
340 #define OPAQUE_TEXT 1
341 
342 //*****************************************************************************
343 //
346 //
347 //*****************************************************************************
348 #define TRANSPARENT_TEXT 0
349 
350 //*****************************************************************************
351 //
354 //
355 //*****************************************************************************
356 #define IMAGE_FMT_1BPP_UNCOMP 0x01
357 
358 //*****************************************************************************
359 //
362 //
363 //*****************************************************************************
364 #define IMAGE_FMT_2BPP_UNCOMP 0x02
365 
366 //*****************************************************************************
367 //
370 //
371 //*****************************************************************************
372 #define IMAGE_FMT_4BPP_UNCOMP 0x04
373 
374 //*****************************************************************************
375 //
378 //
379 //*****************************************************************************
380 #define IMAGE_FMT_8BPP_UNCOMP 0x08
381 
382 //*****************************************************************************
383 //
386 //
387 //*****************************************************************************
388 #define IMAGE_FMT_1BPP_COMP_RLE4 0x41
389 
390 //*****************************************************************************
391 //
394 //
395 //*****************************************************************************
396 #define IMAGE_FMT_2BPP_COMP_RLE4 0x42
397 
398 //*****************************************************************************
399 //
402 //
403 //*****************************************************************************
404 #define IMAGE_FMT_4BPP_COMP_RLE4 0x44
405 
406 //*****************************************************************************
407 //
410 //
411 //*****************************************************************************
412 #define IMAGE_FMT_1BPP_COMP_RLE8 0x81
413 
414 //*****************************************************************************
415 //
418 //
419 //*****************************************************************************
420 #define IMAGE_FMT_2BPP_COMP_RLE8 0x82
421 
422 //*****************************************************************************
423 //
426 //
427 //*****************************************************************************
428 #define IMAGE_FMT_4BPP_COMP_RLE8 0x84
429 
430 //*****************************************************************************
431 //
434 //
435 //*****************************************************************************
436 #define IMAGE_FMT_8BPP_COMP_RLE8 0x88
437 
438 //*****************************************************************************
439 //
442 //
443 //*****************************************************************************
444 #define IMAGE_FMT_8BPP_COMP_RLEBLEND 0x28
445 
446 
447 //*****************************************************************************
448 //
451 //
452 //*****************************************************************************
453 typedef struct
454 {
455  //
457  //
458  long lSize;
459 
460  //
462  //
464 
465  //
467  //
469 
470  //
472  //
473  unsigned long ulForeground;
474 
475  //
477  //
478  unsigned long ulBackground;
479 
480  //
482  //
483  const tFont *pFont;
484 }
485 tContext;
486 
487 //*****************************************************************************
488 //
498 //
499 //*****************************************************************************
500 #define GrContextBackgroundSet(pContext, ulValue) \
501  do \
502  { \
503  tContext *pC = pContext; \
504  pC->ulBackground = DpyColorTranslate(pC->pDisplay, ulValue); \
505  } \
506  while(0)
507 
508 //*****************************************************************************
509 //
521 //
522 //*****************************************************************************
523 #define GrContextBackgroundSetTranslated(pContext, ulValue) \
524  do \
525  { \
526  tContext *pC = pContext; \
527  pC->ulBackground = ulValue; \
528  } \
529  while(0)
530 
531 //*****************************************************************************
532 //
541 //
542 //*****************************************************************************
543 #define GrContextDpyWidthGet(pContext) \
544  (DpyWidthGet((pContext)->pDisplay))
545 
546 //*****************************************************************************
547 //
556 //
557 //*****************************************************************************
558 #define GrContextDpyHeightGet(pContext) \
559  (DpyHeightGet((pContext)->pDisplay))
560 
561 //*****************************************************************************
562 //
573 //
574 //*****************************************************************************
575 #define GrContextFontSet(pContext, pFnt) \
576  do \
577  { \
578  tContext *pC = pContext; \
579  const tFont *pF = pFnt; \
580  pC->pFont = pF; \
581  } \
582  while(0)
583 
584 //*****************************************************************************
585 //
595 //
596 //*****************************************************************************
597 #define GrContextForegroundSet(pContext, ulValue) \
598  do \
599  { \
600  tContext *pC = pContext; \
601  pC->ulForeground = DpyColorTranslate(pC->pDisplay, ulValue); \
602  } \
603  while(0)
604 
605 //*****************************************************************************
606 //
618 //
619 //*****************************************************************************
620 #define GrContextForegroundSetTranslated(pContext, ulValue) \
621  do \
622  { \
623  tContext *pC = pContext; \
624  pC->ulForeground = ulValue; \
625  } \
626  while(0)
627 
628 //*****************************************************************************
629 //
640 //
641 //*****************************************************************************
642 #define GrFlush(pContext) \
643  do \
644  { \
645  const tContext *pC = pContext; \
646  DpyFlush(pC->pDisplay); \
647  } \
648  while(0)
649 
650 
651 //*****************************************************************************
652 //
660 //
661 //*****************************************************************************
662 #define GrClearDisplay(pContext) \
663  do \
664  { \
665  const tContext *pC = pContext; \
666  DpyClearDisplay(pC->pDisplay,pC->ulBackground ); \
667  } \
668  while(0)
669 
670 //*****************************************************************************
671 //
682 //
683 //*****************************************************************************
684 #define GrFontBaselineGet(pFont) \
685  ((pFont)->ucBaseline)
686 
687 //*****************************************************************************
688 //
698 //
699 //*****************************************************************************
700 #define GrFontHeightGet(pFont) \
701  ((pFont)->ucHeight)
702 
703 //*****************************************************************************
704 //
713 //
714 //*****************************************************************************
715 #define GrFontMaxWidthGet(pFont) \
716  ((pFont)->ucMaxWidth)
717 
718 //*****************************************************************************
719 //
729 //
730 //*****************************************************************************
731 #define GrImageColorsGet(pImage) \
732  pImage->NumColors
733 //*****************************************************************************
734 //
742 //
743 //*****************************************************************************
744 #define GrImageHeightGet(pImage) \
745  pImage->YSize
746 
747 //*****************************************************************************
748 //
756 //
757 //*****************************************************************************
758 #define GrImageWidthGet(pImage) \
759  pImage->XSize
760 
761 //*****************************************************************************
762 //
772 //
773 //*****************************************************************************
774 #define GrOffScreen1BPPSize(lWidth, lHeight) \
775  (5 + (((lWidth + 7) / 8) * lHeight))
776 
777 //*****************************************************************************
778 //
788 //
789 //*****************************************************************************
790 #define GrOffScreen4BPPSize(lWidth, lHeight) \
791  (6 + (16 * 3) + (((lWidth + 1) / 2) * lHeight))
792 
793 //*****************************************************************************
794 //
804 //
805 //*****************************************************************************
806 #define GrOffScreen8BPPSize(lWidth, lHeight) \
807  (6 + (256 * 3) + (lWidth * lHeight))
808 
809 //*****************************************************************************
810 //
820 //
821 //*****************************************************************************
822 #define GrPixelDraw(pContext, lX, lY) \
823  do \
824  { \
825  const tContext *pC = pContext; \
826  if((lX >= pC->sClipRegion.sXMin) && \
827  (lX <= pC->sClipRegion.sXMax) && \
828  (lY >= pC->sClipRegion.sYMin) && \
829  (lY <= pC->sClipRegion.sYMax)) \
830  { \
831  DpyPixelDraw(pC->pDisplay, lX, lY, pC->ulForeground); \
832  } \
833  } \
834  while(0)
835 
836 //*****************************************************************************
837 //
848 //
849 //*****************************************************************************
850 #define GrStringBaselineGet(pContext) \
851  ((pContext)->pFont->ucBaseline)
852 
853 //*****************************************************************************
854 //
876 //
877 //*****************************************************************************
878 #define GrStringDrawCentered(pContext, pcString, lLength, lX, lY, bOpaque) \
879  do \
880  { \
881  const tContext *pC = pContext; \
882  const char *pcStr = pcString; \
883  \
884  GrStringDraw(pC, pcStr, lLength, \
885  (lX) - (GrStringWidthGet(pC, pcStr, lLength) / 2), \
886  (lY) - (pC->pFont->ucBaseline / 2), bOpaque); \
887  } \
888  while(0)
889 
890 //*****************************************************************************
891 //
904 //
905 //*****************************************************************************
906 #define GrStringHeightGet(pContext) \
907  ((pContext)->pFont->ucHeight)
908 
909 //*****************************************************************************
910 //
921 //
922 //*****************************************************************************
923 #define GrStringMaxWidthGet(pContext) \
924  ((pContext)->pFont->ucMaxWidth)
925 
926 //*****************************************************************************
927 //
928 // A set of color definitions. This set is the subset of the X11 colors (from
929 // rgb.txt) that are supported by typical web browsers.
930 //
931 //*****************************************************************************
932 #define ClrAliceBlue 0x00F0F8FF
933 #define ClrAntiqueWhite 0x00FAEBD7
934 #define ClrAqua 0x0000FFFF
935 #define ClrAquamarine 0x007FFFD4
936 #define ClrAzure 0x00F0FFFF
937 #define ClrBeige 0x00F5F5DC
938 #define ClrBisque 0x00FFE4C4
939 #define ClrBlack 0x00000000
940 #define ClrBlanchedAlmond 0x00FFEBCD
941 #define ClrBlue 0x000000FF
942 #define ClrBlueViolet 0x008A2BE2
943 #define ClrBrown 0x00A52A2A
944 #define ClrBurlyWood 0x00DEB887
945 #define ClrCadetBlue 0x005F9EA0
946 #define ClrChartreuse 0x007FFF00
947 #define ClrChocolate 0x00D2691E
948 #define ClrCoral 0x00FF7F50
949 #define ClrCornflowerBlue 0x006495ED
950 #define ClrCornsilk 0x00FFF8DC
951 #define ClrCrimson 0x00DC143C
952 #define ClrCyan 0x0000FFFF
953 #define ClrDarkBlue 0x0000008B
954 #define ClrDarkCyan 0x00008B8B
955 #define ClrDarkGoldenrod 0x00B8860B
956 #define ClrDarkGray 0x00A9A9A9
957 #define ClrDarkGreen 0x00006400
958 #define ClrDarkKhaki 0x00BDB76B
959 #define ClrDarkMagenta 0x008B008B
960 #define ClrDarkOliveGreen 0x00556B2F
961 #define ClrDarkOrange 0x00FF8C00
962 #define ClrDarkOrchid 0x009932CC
963 #define ClrDarkRed 0x008B0000
964 #define ClrDarkSalmon 0x00E9967A
965 #define ClrDarkSeaGreen 0x008FBC8F
966 #define ClrDarkSlateBlue 0x00483D8B
967 #define ClrDarkSlateGray 0x002F4F4F
968 #define ClrDarkTurquoise 0x0000CED1
969 #define ClrDarkViolet 0x009400D3
970 #define ClrDeepPink 0x00FF1493
971 #define ClrDeepSkyBlue 0x0000BFFF
972 #define ClrDimGray 0x00696969
973 #define ClrDodgerBlue 0x001E90FF
974 #define ClrFireBrick 0x00B22222
975 #define ClrFloralWhite 0x00FFFAF0
976 #define ClrForestGreen 0x00228B22
977 #define ClrFuchsia 0x00FF00FF
978 #define ClrGainsboro 0x00DCDCDC
979 #define ClrGhostWhite 0x00F8F8FF
980 #define ClrGold 0x00FFD700
981 #define ClrGoldenrod 0x00DAA520
982 #define ClrGray 0x00808080
983 #define ClrGreen 0x00008000
984 #define ClrGreenYellow 0x00ADFF2F
985 #define ClrHoneydew 0x00F0FFF0
986 #define ClrHotPink 0x00FF69B4
987 #define ClrIndianRed 0x00CD5C5C
988 #define ClrIndigo 0x004B0082
989 #define ClrIvory 0x00FFFFF0
990 #define ClrKhaki 0x00F0E68C
991 #define ClrLavender 0x00E6E6FA
992 #define ClrLavenderBlush 0x00FFF0F5
993 #define ClrLawnGreen 0x007CFC00
994 #define ClrLemonChiffon 0x00FFFACD
995 #define ClrLightBlue 0x00ADD8E6
996 #define ClrLightCoral 0x00F08080
997 #define ClrLightCyan 0x00E0FFFF
998 #define ClrLightGoldenrodYellow 0x00FAFAD2
999 #define ClrLightGreen 0x0090EE90
1000 #define ClrLightGrey 0x00D3D3D3
1001 #define ClrLightPink 0x00FFB6C1
1002 #define ClrLightSalmon 0x00FFA07A
1003 #define ClrLightSeaGreen 0x0020B2AA
1004 #define ClrLightSkyBlue 0x0087CEFA
1005 #define ClrLightSlateGray 0x00778899
1006 #define ClrLightSteelBlue 0x00B0C4DE
1007 #define ClrLightYellow 0x00FFFFE0
1008 #define ClrLime 0x0000FF00
1009 #define ClrLimeGreen 0x0032CD32
1010 #define ClrLinen 0x00FAF0E6
1011 #define ClrMagenta 0x00FF00FF
1012 #define ClrMaroon 0x00800000
1013 #define ClrMediumAquamarine 0x0066CDAA
1014 #define ClrMediumBlue 0x000000CD
1015 #define ClrMediumOrchid 0x00BA55D3
1016 #define ClrMediumPurple 0x009370DB
1017 #define ClrMediumSeaGreen 0x003CB371
1018 #define ClrMediumSlateBlue 0x007B68EE
1019 #define ClrMediumSpringGreen 0x0000FA9A
1020 #define ClrMediumTurquoise 0x0048D1CC
1021 #define ClrMediumVioletRed 0x00C71585
1022 #define ClrMidnightBlue 0x00191970
1023 #define ClrMintCream 0x00F5FFFA
1024 #define ClrMistyRose 0x00FFE4E1
1025 #define ClrMoccasin 0x00FFE4B5
1026 #define ClrNavajoWhite 0x00FFDEAD
1027 #define ClrNavy 0x00000080
1028 #define ClrOldLace 0x00FDF5E6
1029 #define ClrOlive 0x00808000
1030 #define ClrOliveDrab 0x006B8E23
1031 #define ClrOrange 0x00FFA500
1032 #define ClrOrangeRed 0x00FF4500
1033 #define ClrOrchid 0x00DA70D6
1034 #define ClrPaleGoldenrod 0x00EEE8AA
1035 #define ClrPaleGreen 0x0098FB98
1036 #define ClrPaleTurquoise 0x00AFEEEE
1037 #define ClrPaleVioletRed 0x00DB7093
1038 #define ClrPapayaWhip 0x00FFEFD5
1039 #define ClrPeachPuff 0x00FFDAB9
1040 #define ClrPeru 0x00CD853F
1041 #define ClrPink 0x00FFC0CB
1042 #define ClrPlum 0x00DDA0DD
1043 #define ClrPowderBlue 0x00B0E0E6
1044 #define ClrPurple 0x00800080
1045 #define ClrRed 0x00FF0000
1046 #define ClrRosyBrown 0x00BC8F8F
1047 #define ClrRoyalBlue 0x004169E1
1048 #define ClrSaddleBrown 0x008B4513
1049 #define ClrSalmon 0x00FA8072
1050 #define ClrSandyBrown 0x00F4A460
1051 #define ClrSeaGreen 0x002E8B57
1052 #define ClrSeashell 0x00FFF5EE
1053 #define ClrSienna 0x00A0522D
1054 #define ClrSilver 0x00C0C0C0
1055 #define ClrSkyBlue 0x0087CEEB
1056 #define ClrSlateBlue 0x006A5ACD
1057 #define ClrSlateGray 0x00708090
1058 #define ClrSnow 0x00FFFAFA
1059 #define ClrSpringGreen 0x0000FF7F
1060 #define ClrSteelBlue 0x004682B4
1061 #define ClrTan 0x00D2B48C
1062 #define ClrTeal 0x00008080
1063 #define ClrThistle 0x00D8BFD8
1064 #define ClrTomato 0x00FF6347
1065 #define ClrTurquoise 0x0040E0D0
1066 #define ClrViolet 0x00EE82EE
1067 #define ClrWheat 0x00F5DEB3
1068 #define ClrWhite 0x00FFFFFF
1069 #define ClrWhiteSmoke 0x00F5F5F5
1070 #define ClrYellow 0x00FFFF00
1071 #define ClrYellowGreen 0x009ACD32
1072 #define ClrBlack 0x00000000
1073 
1074 //*****************************************************************************
1075 //
1076 // Masks and shifts to aid in color format translation by drivers.
1077 //
1078 //*****************************************************************************
1079 #define ClrRedMask 0x00FF0000
1080 #define ClrRedShift 16
1081 #define ClrGreenMask 0x0000FF00
1082 #define ClrGreenShift 8
1083 #define ClrBlueMask 0x000000FF
1084 #define ClrBlueShift 0
1085 
1086 //*****************************************************************************
1087 //
1088 // Prototypes for the predefined fonts in the graphics library. ..Cm.. is the
1089 // computer modern font, which is a serif font. ..Cmsc.. is the computer
1090 // modern small-caps font, which is also a serif font. ..Cmss.. is the
1091 // computer modern sans-serif font.
1092 //
1093 //*****************************************************************************
1094 extern const tFont g_sFontCm12;
1095 extern const tFont g_sFontCm12b;
1096 extern const tFont g_sFontCm12i;
1097 extern const tFont g_sFontCm14;
1098 extern const tFont g_sFontCm14b;
1099 extern const tFont g_sFontCm14i;
1100 extern const tFont g_sFontCm16;
1101 extern const tFont g_sFontCm16b;
1102 extern const tFont g_sFontCm16i;
1103 extern const tFont g_sFontCm18;
1104 extern const tFont g_sFontCm18b;
1105 extern const tFont g_sFontCm18i;
1106 extern const tFont g_sFontCm20;
1107 extern const tFont g_sFontCm20b;
1108 extern const tFont g_sFontCm20i;
1109 extern const tFont g_sFontCm22;
1110 extern const tFont g_sFontCm22b;
1111 extern const tFont g_sFontCm22i;
1112 extern const tFont g_sFontCm24;
1113 extern const tFont g_sFontCm24b;
1114 extern const tFont g_sFontCm24i;
1115 extern const tFont g_sFontCm26;
1116 extern const tFont g_sFontCm26b;
1117 extern const tFont g_sFontCm26i;
1118 extern const tFont g_sFontCm28;
1119 extern const tFont g_sFontCm28b;
1120 extern const tFont g_sFontCm28i;
1121 extern const tFont g_sFontCm30;
1122 extern const tFont g_sFontCm30b;
1123 extern const tFont g_sFontCm30i;
1124 extern const tFont g_sFontCm32;
1125 extern const tFont g_sFontCm32b;
1126 extern const tFont g_sFontCm32i;
1127 extern const tFont g_sFontCm34;
1128 extern const tFont g_sFontCm34b;
1129 extern const tFont g_sFontCm34i;
1130 extern const tFont g_sFontCm36;
1131 extern const tFont g_sFontCm36b;
1132 extern const tFont g_sFontCm36i;
1133 extern const tFont g_sFontCm38;
1134 extern const tFont g_sFontCm38b;
1135 extern const tFont g_sFontCm38i;
1136 extern const tFont g_sFontCm40;
1137 extern const tFont g_sFontCm40b;
1138 extern const tFont g_sFontCm40i;
1139 extern const tFont g_sFontCm42;
1140 extern const tFont g_sFontCm42b;
1141 extern const tFont g_sFontCm42i;
1142 extern const tFont g_sFontCm44;
1143 extern const tFont g_sFontCm44b;
1144 extern const tFont g_sFontCm44i;
1145 extern const tFont g_sFontCm46;
1146 extern const tFont g_sFontCm46b;
1147 extern const tFont g_sFontCm46i;
1148 extern const tFont g_sFontCm48;
1149 extern const tFont g_sFontCm48b;
1150 extern const tFont g_sFontCm48i;
1151 extern const tFont g_sFontCmsc12;
1152 extern const tFont g_sFontCmsc14;
1153 extern const tFont g_sFontCmsc16;
1154 extern const tFont g_sFontCmsc18;
1155 extern const tFont g_sFontCmsc20;
1156 extern const tFont g_sFontCmsc22;
1157 extern const tFont g_sFontCmsc24;
1158 extern const tFont g_sFontCmsc26;
1159 extern const tFont g_sFontCmsc28;
1160 extern const tFont g_sFontCmsc30;
1161 extern const tFont g_sFontCmsc32;
1162 extern const tFont g_sFontCmsc34;
1163 extern const tFont g_sFontCmsc36;
1164 extern const tFont g_sFontCmsc38;
1165 extern const tFont g_sFontCmsc40;
1166 extern const tFont g_sFontCmsc42;
1167 extern const tFont g_sFontCmsc44;
1168 extern const tFont g_sFontCmsc46;
1169 extern const tFont g_sFontCmsc48;
1170 extern const tFont g_sFontCmss12;
1171 extern const tFont g_sFontCmss12b;
1172 extern const tFont g_sFontCmss12i;
1173 extern const tFont g_sFontCmss14;
1174 extern const tFont g_sFontCmss14b;
1175 extern const tFont g_sFontCmss14i;
1176 extern const tFont g_sFontCmss16;
1177 extern const tFont g_sFontCmss16b;
1178 extern const tFont g_sFontCmss16i;
1179 extern const tFont g_sFontCmss18;
1180 extern const tFont g_sFontCmss18b;
1181 extern const tFont g_sFontCmss18i;
1182 extern const tFont g_sFontCmss20;
1183 extern const tFont g_sFontCmss20b;
1184 extern const tFont g_sFontCmss20i;
1185 extern const tFont g_sFontCmss22;
1186 extern const tFont g_sFontCmss22b;
1187 extern const tFont g_sFontCmss22i;
1188 extern const tFont g_sFontCmss24;
1189 extern const tFont g_sFontCmss24b;
1190 extern const tFont g_sFontCmss24i;
1191 extern const tFont g_sFontCmss26;
1192 extern const tFont g_sFontCmss26b;
1193 extern const tFont g_sFontCmss26i;
1194 extern const tFont g_sFontCmss28;
1195 extern const tFont g_sFontCmss28b;
1196 extern const tFont g_sFontCmss28i;
1197 extern const tFont g_sFontCmss30;
1198 extern const tFont g_sFontCmss30b;
1199 extern const tFont g_sFontCmss30i;
1200 extern const tFont g_sFontCmss32;
1201 extern const tFont g_sFontCmss32b;
1202 extern const tFont g_sFontCmss32i;
1203 extern const tFont g_sFontCmss34;
1204 extern const tFont g_sFontCmss34b;
1205 extern const tFont g_sFontCmss34i;
1206 extern const tFont g_sFontCmss36;
1207 extern const tFont g_sFontCmss36b;
1208 extern const tFont g_sFontCmss36i;
1209 extern const tFont g_sFontCmss38;
1210 extern const tFont g_sFontCmss38b;
1211 extern const tFont g_sFontCmss38i;
1212 extern const tFont g_sFontCmss40;
1213 extern const tFont g_sFontCmss40b;
1214 extern const tFont g_sFontCmss40i;
1215 extern const tFont g_sFontCmss42;
1216 extern const tFont g_sFontCmss42b;
1217 extern const tFont g_sFontCmss42i;
1218 extern const tFont g_sFontCmss44;
1219 extern const tFont g_sFontCmss44b;
1220 extern const tFont g_sFontCmss44i;
1221 extern const tFont g_sFontCmss46;
1222 extern const tFont g_sFontCmss46b;
1223 extern const tFont g_sFontCmss46i;
1224 extern const tFont g_sFontCmss48;
1225 extern const tFont g_sFontCmss48b;
1226 extern const tFont g_sFontCmss48i;
1227 extern const tFont g_sFontCmtt12;
1228 extern const tFont g_sFontCmtt14;
1229 extern const tFont g_sFontCmtt16;
1230 extern const tFont g_sFontCmtt18;
1231 extern const tFont g_sFontCmtt20;
1232 extern const tFont g_sFontCmtt22;
1233 extern const tFont g_sFontCmtt24;
1234 extern const tFont g_sFontCmtt26;
1235 extern const tFont g_sFontCmtt28;
1236 extern const tFont g_sFontCmtt30;
1237 extern const tFont g_sFontCmtt32;
1238 extern const tFont g_sFontCmtt34;
1239 extern const tFont g_sFontCmtt36;
1240 extern const tFont g_sFontCmtt38;
1241 extern const tFont g_sFontCmtt40;
1242 extern const tFont g_sFontCmtt42;
1243 extern const tFont g_sFontCmtt44;
1244 extern const tFont g_sFontCmtt46;
1245 extern const tFont g_sFontCmtt48;
1246 extern const tFont g_sFontFixed6x8;
1247 
1248 //*****************************************************************************
1249 //
1250 // Language identifiers supported by the string table processing functions.
1251 //
1252 //*****************************************************************************
1253 #define GrLangZhPRC 0x0804 // Chinese (PRC)
1254 #define GrLangZhTW 0x0404 // Chinese (Taiwan)
1255 #define GrLangEnUS 0x0409 // English (United States)
1256 #define GrLangEnUK 0x0809 // English (United Kingdom)
1257 #define GrLangEnAUS 0x0C09 // English (Australia)
1258 #define GrLangEnCA 0x1009 // English (Canada)
1259 #define GrLangEnNZ 0x1409 // English (New Zealand)
1260 #define GrLangFr 0x040C // French (Standard)
1261 #define GrLangDe 0x0407 // German (Standard)
1262 #define GrLangHi 0x0439 // Hindi
1263 #define GrLangIt 0x0410 // Italian (Standard)
1264 #define GrLangJp 0x0411 // Japanese
1265 #define GrLangKo 0x0412 // Korean
1266 #define GrLangEsMX 0x080A // Spanish (Mexico)
1267 #define GrLangEsSP 0x0C0A // Spanish (Spain)
1268 #define GrLangSwKE 0x0441 // Swahili (Kenya)
1269 #define GrLangUrIN 0x0820 // Urdu (India)
1270 #define GrLangUrPK 0x0420 // Urdu (Pakistan)
1271 
1272 //*****************************************************************************
1273 //
1287 //
1288 //*****************************************************************************
1289 #define DpyColorTranslate(pDisplay, ulValue) \
1290  ((pDisplay)->pfnColorTranslate((pDisplay)->pvDisplayData, ulValue))
1291 
1292 //*****************************************************************************
1293 //
1302 //
1303 //*****************************************************************************
1304 #define DpyFlush(pDisplay) \
1305  do \
1306  { \
1307  const tDisplay *pD = pDisplay; \
1308  pD->pfnFlush(pD->pvDisplayData); \
1309  } \
1310  while(0)
1311 
1312 //*****************************************************************************
1313 //
1323 //
1324 //*****************************************************************************
1325 #define DpyClearDisplay(pDisplay, ulValue) \
1326  do \
1327  { \
1328  const tDisplay *pD = pDisplay; \
1329  pD->pfnClearDisplay(pD->pvDisplayData, ulValue); \
1330  } \
1331  while(0)
1332 
1333 //*****************************************************************************
1334 //
1343 //
1344 //*****************************************************************************
1345 #define DpyHeightGet(pDisplay) \
1346  ((pDisplay)->usHeight)
1347 
1348 //*****************************************************************************
1349 //
1364 //
1365 //*****************************************************************************
1366 #define DpyLineDrawH(pDisplay, lX1, lX2, lY, ulValue) \
1367  do \
1368  { \
1369  const tDisplay *pD = pDisplay; \
1370  pD->pfnLineDrawH(pD->pvDisplayData, lX1, lX2, lY, ulValue); \
1371  } \
1372  while(0)
1373 
1374 //*****************************************************************************
1375 //
1390 //
1391 //*****************************************************************************
1392 #define DpyLineDrawV(pDisplay, lX, lY1, lY2, ulValue) \
1393  do \
1394  { \
1395  const tDisplay *pD = pDisplay; \
1396  pD->pfnLineDrawV(pD->pvDisplayData, lX, lY1, lY2, ulValue); \
1397  } \
1398  while(0)
1399 
1400 //*****************************************************************************
1401 //
1414 //
1415 //*****************************************************************************
1416 #define DpyPixelDraw(pDisplay, lX, lY, ulValue) \
1417  do \
1418  { \
1419  const tDisplay *pD = pDisplay; \
1420  pD->pfnPixelDraw(pD->pvDisplayData, lX, lY, ulValue); \
1421  } \
1422  while(0)
1423 
1424 //*****************************************************************************
1425 //
1447 //
1448 //*****************************************************************************
1449 #define DpyPixelDrawMultiple(pDisplay, lX, lY, lX0, lCount, lBPP, pucData, \
1450  pucPalette) \
1451  do \
1452  { \
1453  const tDisplay *pD = pDisplay; \
1454  pD->pfnPixelDrawMultiple(pD->pvDisplayData, lX, lY, lX0, lCount, \
1455  lBPP, pucData, pucPalette); \
1456  } \
1457  while(0)
1458 
1459 //*****************************************************************************
1460 //
1474 //
1475 //*****************************************************************************
1476 #define DpyRectFill(pDisplay, pRect, ulValue) \
1477  do \
1478  { \
1479  const tDisplay *pD = pDisplay; \
1480  pD->pfnRectFill(pD->pvDisplayData, pRect, ulValue); \
1481  } \
1482  while(0)
1483 
1484 //*****************************************************************************
1485 //
1494 //
1495 //*****************************************************************************
1496 #define DpyWidthGet(pDisplay) \
1497  ((pDisplay)->usWidth)
1498 
1499 //*****************************************************************************
1500 //
1512 //
1513 //*****************************************************************************
1514 #define GrRectContainsPoint(pRect, lX, lY) \
1515  ((((lX) >= (pRect)->sXMin) && ((lX) <= (pRect)->sXMax) && \
1516  ((lY) >= (pRect)->sYMin) && ((lY) <= (pRect)->sYMax)) ? 1 : 0)
1517 
1518 //*****************************************************************************
1519 //
1520 // Prototypes for the graphics library functions.
1521 //
1522 //*****************************************************************************
1523 extern void GrCircleDraw(const tContext *pContext, long lX, long lY,
1524  long lRadius);
1525 extern void GrCircleFill(const tContext *pContext, long lX, long lY,
1526  long lRadius);
1527 extern void GrContextClipRegionSet(tContext *pContext, tRectangle *pRect);
1528 extern void GrContextInit(tContext *pContext, const tDisplay *pDisplay);
1529 extern void GrImageDraw(const tContext *pContext,
1530  const tImage *pBitmap, int lX, int lY);
1531 extern void GrLineDraw(const tContext *pContext, long lX1, long lY1, long lX2,
1532  long lY2);
1533 extern void GrLineDrawH(const tContext *pContext, long lX1, long lX2, long lY);
1534 extern void GrLineDrawV(const tContext *pContext, long lX, long lY1, long lY2);
1535 extern void GrRectDraw(const tContext *pContext, const tRectangle *pRect);
1536 extern void GrRectFill(const tContext *pContext, const tRectangle *pRect);
1537 extern void GrStringDraw(const tContext *pContext, const char *pcString,
1538  long lLength, long lX, long lY,
1539  unsigned long bOpaque);
1540 extern long GrStringWidthGet(const tContext *pContext, const char *pcString,
1541  long lLength);
1542 extern long GrRectOverlapCheck(tRectangle *psRect1, tRectangle *psRect2);
1543 extern long GrRectIntersectGet(tRectangle *psRect1, tRectangle *psRect2,
1544  tRectangle *psIntersect);
1545 
1546 //*****************************************************************************
1547 //
1548 // Mark the end of the C bindings section for C++ compilers.
1549 //
1550 //*****************************************************************************
1551 #ifdef __cplusplus
1552 }
1553 #endif
1554 
1555 //*****************************************************************************
1556 //
1557 // Close the Doxygen group.
1559 //
1560 //*****************************************************************************
1561 
1562 #endif // __GRLIB_H__

Copyright 2013, Texas Instruments Incorporated