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