grlib.h
Go to the documentation of this file.
00001 /* --COPYRIGHT--,BSD
00002  * Copyright (c) 2012, Texas Instruments Incorporated
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * *  Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  *
00012  * *  Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  *
00016  * *  Neither the name of Texas Instruments Incorporated nor the names of
00017  *    its contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00021  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00022  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00023  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00024  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00026  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00027  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00028  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00029  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00030  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  * --/COPYRIGHT--*/
00032 
00033 
00034 #ifndef __GRLIB_H__
00035 #define __GRLIB_H__
00036 
00037 //*****************************************************************************
00038 //
00041 //
00042 //*****************************************************************************
00043 
00044 //*****************************************************************************
00045 //
00046 // If building with a C++ compiler, make all of the definitions in this header
00047 // have a C binding.
00048 //
00049 //*****************************************************************************
00050 #ifdef __cplusplus
00051 extern "C"
00052 {
00053 #endif
00054 
00055 //*****************************************************************************
00056 //
00058 //
00059 //*****************************************************************************
00060 typedef struct 
00061 {
00062     //
00064     //
00065     unsigned char BPP; 
00066     
00067     //
00069     //
00070     unsigned int XSize;  
00071   
00072     //
00074     //
00075     unsigned int YSize;               
00076     
00077     //
00079     //
00080     
00081     unsigned int NumColors;     
00082     
00083     //
00085     //
00086     const unsigned long * pPalette;   
00087     
00088     //
00090     //
00091     const unsigned char * pPixel;     
00092 }
00093 tImage;
00094 
00095 //*****************************************************************************
00096 //
00100 //
00101 //*****************************************************************************
00102 typedef struct
00103 {
00104     //
00106     //
00107     short sXMin;
00108 
00109     //
00111     //
00112     short sYMin;
00113 
00114     //
00116     //
00117     short sXMax;
00118 
00119     //
00121     //
00122     short sYMax;
00123 }
00124 tRectangle;
00125 
00126 //*****************************************************************************
00127 //
00129 //
00130 //*****************************************************************************
00131 typedef struct
00132 {
00133     //
00135     //
00136     long lSize;
00137 
00138     //
00140     //
00141     void *pvDisplayData;
00142 
00143     //
00145     //
00146     unsigned short usWidth;
00147 
00148     //
00150     //
00151     unsigned short usHeight;
00152 
00153     //
00155     //
00156     void (*pfnPixelDraw)(void *pvDisplayData, int lX, int lY,
00157                          unsigned int ulValue);
00158 
00159     //
00161     //
00162     void (*pfnPixelDrawMultiple)(void *pvDisplayData, int lX, int lY,
00163                                  int lX0, int lCount, int lBPP,
00164                                  const unsigned char *pucData,
00165                                  const unsigned int *pucPalette);
00166     
00167     //
00169     //
00170     void (*pfnLineDrawH)(void *pvDisplayData, int lX1, int lX2, int lY,
00171                          unsigned int ulValue);
00172 
00173     //
00175     //
00176     void (*pfnLineDrawV)(void *pvDisplayData, int lX, int lY1, int lY2,
00177                          unsigned int ulValue);
00178 
00179     //
00181     //
00182     void (*pfnRectFill)(void *pvDisplayData, const tRectangle *pRect,
00183                         unsigned int ulValue);
00184 
00185     //
00188     //
00189     unsigned int (*pfnColorTranslate)(void *pvDisplayData,
00190                                        unsigned long ulValue);
00191 
00192     //
00195     //
00196     void (*pfnFlush)(void *pvDisplayData);
00197 
00198     //
00201     //
00202     void (*pfnClearDisplay)(void *pvDisplayData, unsigned char ucValue);
00203 }
00204 tDisplay;
00205 
00206 //*****************************************************************************
00207 //
00209 //
00210 //*****************************************************************************
00211 typedef struct
00212 {
00213     //
00216     //
00217     unsigned char ucFormat;
00218 
00219     //
00223     //
00224     unsigned char ucMaxWidth;
00225 
00226     //
00229     //
00230     unsigned char ucHeight;
00231 
00232     //
00236     //
00237     unsigned char ucBaseline;
00238 
00239     //
00241     //
00242     unsigned short pusOffset[96];
00243 
00244     //
00246     //
00247     const unsigned char *pucData;
00248 }
00249 tFont;
00250 
00251 //*****************************************************************************
00252 //
00261 //
00262 //*****************************************************************************
00263 typedef struct
00264 {
00265     //
00268     //
00269     unsigned char ucFormat;
00270 
00271     //
00275     //
00276     unsigned char ucMaxWidth;
00277 
00278     //
00281     //
00282     unsigned char ucHeight;
00283 
00284     //
00288     //
00289     unsigned char ucBaseline;
00290 
00291     //
00294     //
00295     unsigned char ucFirst;
00296 
00297     //
00300     //
00301     unsigned char ucLast;
00302 
00303     //
00306     //
00307     const unsigned short *pusOffset;
00308 
00309     //
00311     //
00312     const unsigned char *pucData;
00313 }
00314 tFontEx;
00315 
00316 //*****************************************************************************
00317 //
00319 //
00320 //*****************************************************************************
00321 #define FONT_FMT_UNCOMPRESSED   0x00
00322 
00323 //*****************************************************************************
00324 //
00326 //
00327 //*****************************************************************************
00328 #define FONT_FMT_PIXEL_RLE      0x01
00329 
00330 //*****************************************************************************
00331 //
00334 //
00335 //*****************************************************************************
00336 #define FONT_EX_MARKER          0x80
00337 
00338 //*****************************************************************************
00339 //
00342 //
00343 //*****************************************************************************
00344 #define FONT_FMT_EX_UNCOMPRESSED   (FONT_FMT_UNCOMPRESSED | FONT_EX_MARKER)
00345 
00346 //*****************************************************************************
00347 //
00350 //
00351 //*****************************************************************************
00352 #define FONT_FMT_EX_PIXEL_RLE      (FONT_FMT_PIXEL_RLE | FONT_EX_MARKER)
00353 
00354 //*****************************************************************************
00355 //
00358 //
00359 //*****************************************************************************
00360 #define IMAGE_FMT_1BPP_UNCOMP   0x01
00361 
00362 //*****************************************************************************
00363 //
00366 //
00367 //*****************************************************************************
00368 #define IMAGE_FMT_2BPP_UNCOMP   0x02
00369 
00370 //*****************************************************************************
00371 //
00374 //
00375 //*****************************************************************************
00376 #define IMAGE_FMT_4BPP_UNCOMP   0x04
00377 
00378 //*****************************************************************************
00379 //
00382 //
00383 //*****************************************************************************
00384 #define IMAGE_FMT_8BPP_UNCOMP   0x08
00385 
00386 //*****************************************************************************
00387 //
00390 //
00391 //*****************************************************************************
00392 #define IMAGE_FMT_1BPP_COMP_RLE4     0x41
00393 
00394 //*****************************************************************************
00395 //
00398 //
00399 //*****************************************************************************
00400 #define IMAGE_FMT_2BPP_COMP_RLE4     0x42
00401 
00402 //*****************************************************************************
00403 //
00406 //
00407 //*****************************************************************************
00408 #define IMAGE_FMT_4BPP_COMP_RLE4     0x44
00409 
00410 //*****************************************************************************
00411 //
00414 //
00415 //*****************************************************************************
00416 #define IMAGE_FMT_1BPP_COMP_RLE8     0x81
00417 
00418 //*****************************************************************************
00419 //
00422 //
00423 //*****************************************************************************
00424 #define IMAGE_FMT_2BPP_COMP_RLE8     0x82
00425 
00426 //*****************************************************************************
00427 //
00430 //
00431 //*****************************************************************************
00432 #define IMAGE_FMT_4BPP_COMP_RLE8     0x84
00433 
00434 //*****************************************************************************
00435 //
00438 //
00439 //*****************************************************************************
00440 #define IMAGE_FMT_8BPP_COMP_RLE8     0x88
00441 
00442 //*****************************************************************************
00443 //
00446 //
00447 //*****************************************************************************
00448 #define IMAGE_FMT_8BPP_COMP_RLEBLEND     0x28
00449 
00450 
00451 //*****************************************************************************
00452 //
00455 //
00456 //*****************************************************************************
00457 typedef struct
00458 {
00459     //
00461     //
00462     long lSize;
00463 
00464     //
00466     //
00467     const tDisplay *pDisplay;
00468 
00469     //
00471     //
00472     tRectangle sClipRegion;
00473 
00474     //
00476     //
00477     unsigned long ulForeground;
00478 
00479     //
00481     //
00482     unsigned long ulBackground;
00483 
00484     //
00486     //
00487     const tFont *pFont;
00488 }
00489 tContext;
00490 
00491 //*****************************************************************************
00492 //
00502 //
00503 //*****************************************************************************
00504 #define GrContextBackgroundSet(pContext, ulValue)                        \
00505         do                                                               \
00506         {                                                                \
00507             tContext *pC = pContext;                                     \
00508             pC->ulBackground = DpyColorTranslate(pC->pDisplay, ulValue); \
00509         }                                                                \
00510         while(0)
00511 
00512 //*****************************************************************************
00513 //
00525 //
00526 //*****************************************************************************
00527 #define GrContextBackgroundSetTranslated(pContext, ulValue) \
00528         do                                                  \
00529         {                                                   \
00530             tContext *pC = pContext;                        \
00531             pC->ulBackground = ulValue;                     \
00532         }                                                   \
00533         while(0)
00534 
00535 //*****************************************************************************
00536 //
00545 //
00546 //*****************************************************************************
00547 #define GrContextDpyWidthGet(pContext)      \
00548         (DpyWidthGet((pContext)->pDisplay))
00549 
00550 //*****************************************************************************
00551 //
00560 //
00561 //*****************************************************************************
00562 #define GrContextDpyHeightGet(pContext)      \
00563         (DpyHeightGet((pContext)->pDisplay))
00564 
00565 //*****************************************************************************
00566 //
00577 //
00578 //*****************************************************************************
00579 #define GrContextFontSet(pContext, pFnt) \
00580         do                               \
00581         {                                \
00582             tContext *pC = pContext;     \
00583             const tFont *pF = pFnt;      \
00584             pC->pFont = pF;              \
00585         }                                \
00586         while(0)
00587 
00588 //*****************************************************************************
00589 //
00599 //
00600 //*****************************************************************************
00601 #define GrContextForegroundSet(pContext, ulValue)                        \
00602         do                                                               \
00603         {                                                                \
00604             tContext *pC = pContext;                                     \
00605             pC->ulForeground = DpyColorTranslate(pC->pDisplay, ulValue); \
00606         }                                                                \
00607         while(0)
00608 
00609 //*****************************************************************************
00610 //
00622 //
00623 //*****************************************************************************
00624 #define GrContextForegroundSetTranslated(pContext, ulValue) \
00625         do                                                  \
00626         {                                                   \
00627             tContext *pC = pContext;                        \
00628             pC->ulForeground = ulValue;                     \
00629         }                                                   \
00630         while(0)
00631 
00632 //*****************************************************************************
00633 //
00644 //
00645 //*****************************************************************************
00646 #define GrFlush(pContext)                  \
00647         do                                 \
00648         {                                  \
00649             const tContext *pC = pContext; \
00650             DpyFlush(pC->pDisplay);        \
00651         }                                  \
00652         while(0)
00653 
00654 
00655 //*****************************************************************************
00656 //
00664 //
00665 //*****************************************************************************
00666 #define GrClearDisplay(pContext)           \
00667         do                                 \
00668         {                                  \
00669             const tContext *pC = pContext; \
00670             DpyClearDisplay(pC->pDisplay,pC->ulBackground ); \
00671         }                                  \
00672         while(0)
00673 
00674 //*****************************************************************************
00675 //
00686 //
00687 //*****************************************************************************
00688 #define GrFontBaselineGet(pFont) \
00689         ((pFont)->ucBaseline)
00690 
00691 //*****************************************************************************
00692 //
00702 //
00703 //*****************************************************************************
00704 #define GrFontHeightGet(pFont) \
00705         ((pFont)->ucHeight)
00706 
00707 //*****************************************************************************
00708 //
00717 //
00718 //*****************************************************************************
00719 #define GrFontMaxWidthGet(pFont) \
00720         ((pFont)->ucMaxWidth)
00721 
00722 //*****************************************************************************
00723 //
00733 //
00734 //*****************************************************************************
00735 #define GrImageColorsGet(pImage)           \
00736         pImage->NumColors
00737 //*****************************************************************************
00738 //
00746 //
00747 //*****************************************************************************
00748 #define GrImageHeightGet(pImage)          \
00749         pImage->YSize
00750 
00751 //*****************************************************************************
00752 //
00760 //
00761 //*****************************************************************************
00762 #define GrImageWidthGet(pImage)           \
00763         pImage->XSize
00764 
00765 //*****************************************************************************
00766 //
00776 //
00777 //*****************************************************************************
00778 #define GrOffScreen1BPPSize(lWidth, lHeight) \
00779         (5 + (((lWidth + 7) / 8) * lHeight))
00780 
00781 //*****************************************************************************
00782 //
00792 //
00793 //*****************************************************************************
00794 #define GrOffScreen4BPPSize(lWidth, lHeight)            \
00795         (6 + (16 * 3) + (((lWidth + 1) / 2) * lHeight))
00796 
00797 //*****************************************************************************
00798 //
00808 //
00809 //*****************************************************************************
00810 #define GrOffScreen8BPPSize(lWidth, lHeight) \
00811         (6 + (256 * 3) + (lWidth * lHeight))
00812 
00813 //*****************************************************************************
00814 //
00824 //
00825 //*****************************************************************************
00826 #define GrPixelDraw(pContext, lX, lY)                                 \
00827         do                                                            \
00828         {                                                             \
00829             const tContext *pC = pContext;                            \
00830             if((lX >= pC->sClipRegion.sXMin) &&                       \
00831                (lX <= pC->sClipRegion.sXMax) &&                       \
00832                (lY >= pC->sClipRegion.sYMin) &&                       \
00833                (lY <= pC->sClipRegion.sYMax))                         \
00834             {                                                         \
00835                 DpyPixelDraw(pC->pDisplay, lX, lY, pC->ulForeground); \
00836             }                                                         \
00837         }                                                             \
00838         while(0)
00839 
00840 //*****************************************************************************
00841 //
00852 //
00853 //*****************************************************************************
00854 #define GrStringBaselineGet(pContext)   \
00855         ((pContext)->pFont->ucBaseline)
00856 
00857 //*****************************************************************************
00858 //
00880 //
00881 //*****************************************************************************
00882 #define GrStringDrawCentered(pContext, pcString, lLength, lX, lY, bOpaque)  \
00883         do                                                                  \
00884         {                                                                   \
00885             const tContext *pC = pContext;                                  \
00886             const char *pcStr = pcString;                                   \
00887                                                                             \
00888             GrStringDraw(pC, pcStr, lLength,                                \
00889                          (lX) - (GrStringWidthGet(pC, pcStr, lLength) / 2), \
00890                          (lY) - (pC->pFont->ucBaseline / 2), bOpaque);      \
00891         }                                                                   \
00892         while(0)
00893 
00894 //*****************************************************************************
00895 //
00908 //
00909 //*****************************************************************************
00910 #define GrStringHeightGet(pContext)   \
00911         ((pContext)->pFont->ucHeight)
00912 
00913 //*****************************************************************************
00914 //
00925 //
00926 //*****************************************************************************
00927 #define GrStringMaxWidthGet(pContext)   \
00928         ((pContext)->pFont->ucMaxWidth)
00929 
00930 //*****************************************************************************
00931 //
00932 // A set of color definitions.  This set is the subset of the X11 colors (from
00933 // rgb.txt) that are supported by typical web browsers.
00934 //
00935 //*****************************************************************************
00936 #define ClrAliceBlue            0x00F0F8FF
00937 #define ClrAntiqueWhite         0x00FAEBD7
00938 #define ClrAqua                 0x0000FFFF
00939 #define ClrAquamarine           0x007FFFD4
00940 #define ClrAzure                0x00F0FFFF
00941 #define ClrBeige                0x00F5F5DC
00942 #define ClrBisque               0x00FFE4C4
00943 #define ClrBlack                0x00000000
00944 #define ClrBlanchedAlmond       0x00FFEBCD
00945 #define ClrBlue                 0x000000FF
00946 #define ClrBlueViolet           0x008A2BE2
00947 #define ClrBrown                0x00A52A2A
00948 #define ClrBurlyWood            0x00DEB887
00949 #define ClrCadetBlue            0x005F9EA0
00950 #define ClrChartreuse           0x007FFF00
00951 #define ClrChocolate            0x00D2691E
00952 #define ClrCoral                0x00FF7F50
00953 #define ClrCornflowerBlue       0x006495ED
00954 #define ClrCornsilk             0x00FFF8DC
00955 #define ClrCrimson              0x00DC143C
00956 #define ClrCyan                 0x0000FFFF
00957 #define ClrDarkBlue             0x0000008B
00958 #define ClrDarkCyan             0x00008B8B
00959 #define ClrDarkGoldenrod        0x00B8860B
00960 #define ClrDarkGray             0x00A9A9A9
00961 #define ClrDarkGreen            0x00006400
00962 #define ClrDarkKhaki            0x00BDB76B
00963 #define ClrDarkMagenta          0x008B008B
00964 #define ClrDarkOliveGreen       0x00556B2F
00965 #define ClrDarkOrange           0x00FF8C00
00966 #define ClrDarkOrchid           0x009932CC
00967 #define ClrDarkRed              0x008B0000
00968 #define ClrDarkSalmon           0x00E9967A
00969 #define ClrDarkSeaGreen         0x008FBC8F
00970 #define ClrDarkSlateBlue        0x00483D8B
00971 #define ClrDarkSlateGray        0x002F4F4F
00972 #define ClrDarkTurquoise        0x0000CED1
00973 #define ClrDarkViolet           0x009400D3
00974 #define ClrDeepPink             0x00FF1493
00975 #define ClrDeepSkyBlue          0x0000BFFF
00976 #define ClrDimGray              0x00696969
00977 #define ClrDodgerBlue           0x001E90FF
00978 #define ClrFireBrick            0x00B22222
00979 #define ClrFloralWhite          0x00FFFAF0
00980 #define ClrForestGreen          0x00228B22
00981 #define ClrFuchsia              0x00FF00FF
00982 #define ClrGainsboro            0x00DCDCDC
00983 #define ClrGhostWhite           0x00F8F8FF
00984 #define ClrGold                 0x00FFD700
00985 #define ClrGoldenrod            0x00DAA520
00986 #define ClrGray                 0x00808080
00987 #define ClrGreen                0x00008000
00988 #define ClrGreenYellow          0x00ADFF2F
00989 #define ClrHoneydew             0x00F0FFF0
00990 #define ClrHotPink              0x00FF69B4
00991 #define ClrIndianRed            0x00CD5C5C
00992 #define ClrIndigo               0x004B0082
00993 #define ClrIvory                0x00FFFFF0
00994 #define ClrKhaki                0x00F0E68C
00995 #define ClrLavender             0x00E6E6FA
00996 #define ClrLavenderBlush        0x00FFF0F5
00997 #define ClrLawnGreen            0x007CFC00
00998 #define ClrLemonChiffon         0x00FFFACD
00999 #define ClrLightBlue            0x00ADD8E6
01000 #define ClrLightCoral           0x00F08080
01001 #define ClrLightCyan            0x00E0FFFF
01002 #define ClrLightGoldenrodYellow 0x00FAFAD2
01003 #define ClrLightGreen           0x0090EE90
01004 #define ClrLightGrey            0x00D3D3D3
01005 #define ClrLightPink            0x00FFB6C1
01006 #define ClrLightSalmon          0x00FFA07A
01007 #define ClrLightSeaGreen        0x0020B2AA
01008 #define ClrLightSkyBlue         0x0087CEFA
01009 #define ClrLightSlateGray       0x00778899
01010 #define ClrLightSteelBlue       0x00B0C4DE
01011 #define ClrLightYellow          0x00FFFFE0
01012 #define ClrLime                 0x0000FF00
01013 #define ClrLimeGreen            0x0032CD32
01014 #define ClrLinen                0x00FAF0E6
01015 #define ClrMagenta              0x00FF00FF
01016 #define ClrMaroon               0x00800000
01017 #define ClrMediumAquamarine     0x0066CDAA
01018 #define ClrMediumBlue           0x000000CD
01019 #define ClrMediumOrchid         0x00BA55D3
01020 #define ClrMediumPurple         0x009370DB
01021 #define ClrMediumSeaGreen       0x003CB371
01022 #define ClrMediumSlateBlue      0x007B68EE
01023 #define ClrMediumSpringGreen    0x0000FA9A
01024 #define ClrMediumTurquoise      0x0048D1CC
01025 #define ClrMediumVioletRed      0x00C71585
01026 #define ClrMidnightBlue         0x00191970
01027 #define ClrMintCream            0x00F5FFFA
01028 #define ClrMistyRose            0x00FFE4E1
01029 #define ClrMoccasin             0x00FFE4B5
01030 #define ClrNavajoWhite          0x00FFDEAD
01031 #define ClrNavy                 0x00000080
01032 #define ClrOldLace              0x00FDF5E6
01033 #define ClrOlive                0x00808000
01034 #define ClrOliveDrab            0x006B8E23
01035 #define ClrOrange               0x00FFA500
01036 #define ClrOrangeRed            0x00FF4500
01037 #define ClrOrchid               0x00DA70D6
01038 #define ClrPaleGoldenrod        0x00EEE8AA
01039 #define ClrPaleGreen            0x0098FB98
01040 #define ClrPaleTurquoise        0x00AFEEEE
01041 #define ClrPaleVioletRed        0x00DB7093
01042 #define ClrPapayaWhip           0x00FFEFD5
01043 #define ClrPeachPuff            0x00FFDAB9
01044 #define ClrPeru                 0x00CD853F
01045 #define ClrPink                 0x00FFC0CB
01046 #define ClrPlum                 0x00DDA0DD
01047 #define ClrPowderBlue           0x00B0E0E6
01048 #define ClrPurple               0x00800080
01049 #define ClrRed                  0x00FF0000
01050 #define ClrRosyBrown            0x00BC8F8F
01051 #define ClrRoyalBlue            0x004169E1
01052 #define ClrSaddleBrown          0x008B4513
01053 #define ClrSalmon               0x00FA8072
01054 #define ClrSandyBrown           0x00F4A460
01055 #define ClrSeaGreen             0x002E8B57
01056 #define ClrSeashell             0x00FFF5EE
01057 #define ClrSienna               0x00A0522D
01058 #define ClrSilver               0x00C0C0C0
01059 #define ClrSkyBlue              0x0087CEEB
01060 #define ClrSlateBlue            0x006A5ACD
01061 #define ClrSlateGray            0x00708090
01062 #define ClrSnow                 0x00FFFAFA
01063 #define ClrSpringGreen          0x0000FF7F
01064 #define ClrSteelBlue            0x004682B4
01065 #define ClrTan                  0x00D2B48C
01066 #define ClrTeal                 0x00008080
01067 #define ClrThistle              0x00D8BFD8
01068 #define ClrTomato               0x00FF6347
01069 #define ClrTurquoise            0x0040E0D0
01070 #define ClrViolet               0x00EE82EE
01071 #define ClrWheat                0x00F5DEB3
01072 #define ClrWhite                0x00FFFFFF
01073 #define ClrWhiteSmoke           0x00F5F5F5
01074 #define ClrYellow               0x00FFFF00
01075 #define ClrYellowGreen          0x009ACD32
01076 #define ClrBlack                0x00000000
01077 
01078 //*****************************************************************************
01079 //
01080 // Masks and shifts to aid in color format translation by drivers.
01081 //
01082 //*****************************************************************************
01083 #define ClrRedMask              0x00FF0000
01084 #define ClrRedShift             16
01085 #define ClrGreenMask            0x0000FF00
01086 #define ClrGreenShift           8
01087 #define ClrBlueMask             0x000000FF
01088 #define ClrBlueShift            0
01089 
01090 //*****************************************************************************
01091 //
01092 // Prototypes for the predefined fonts in the graphics library.  ..Cm.. is the
01093 // computer modern font, which is a serif font.  ..Cmsc.. is the computer
01094 // modern small-caps font, which is also a serif font.  ..Cmss.. is the
01095 // computer modern sans-serif font.
01096 //
01097 //*****************************************************************************
01098 extern const tFont g_sFontCm12;
01099 extern const tFont g_sFontCm12b;
01100 extern const tFont g_sFontCm12i;
01101 extern const tFont g_sFontCm14;
01102 extern const tFont g_sFontCm14b;
01103 extern const tFont g_sFontCm14i;
01104 extern const tFont g_sFontCm16;
01105 extern const tFont g_sFontCm16b;
01106 extern const tFont g_sFontCm16i;
01107 extern const tFont g_sFontCm18;
01108 extern const tFont g_sFontCm18b;
01109 extern const tFont g_sFontCm18i;
01110 extern const tFont g_sFontCm20;
01111 extern const tFont g_sFontCm20b;
01112 extern const tFont g_sFontCm20i;
01113 extern const tFont g_sFontCm22;
01114 extern const tFont g_sFontCm22b;
01115 extern const tFont g_sFontCm22i;
01116 extern const tFont g_sFontCm24;
01117 extern const tFont g_sFontCm24b;
01118 extern const tFont g_sFontCm24i;
01119 extern const tFont g_sFontCm26;
01120 extern const tFont g_sFontCm26b;
01121 extern const tFont g_sFontCm26i;
01122 extern const tFont g_sFontCm28;
01123 extern const tFont g_sFontCm28b;
01124 extern const tFont g_sFontCm28i;
01125 extern const tFont g_sFontCm30;
01126 extern const tFont g_sFontCm30b;
01127 extern const tFont g_sFontCm30i;
01128 extern const tFont g_sFontCm32;
01129 extern const tFont g_sFontCm32b;
01130 extern const tFont g_sFontCm32i;
01131 extern const tFont g_sFontCm34;
01132 extern const tFont g_sFontCm34b;
01133 extern const tFont g_sFontCm34i;
01134 extern const tFont g_sFontCm36;
01135 extern const tFont g_sFontCm36b;
01136 extern const tFont g_sFontCm36i;
01137 extern const tFont g_sFontCm38;
01138 extern const tFont g_sFontCm38b;
01139 extern const tFont g_sFontCm38i;
01140 extern const tFont g_sFontCm40;
01141 extern const tFont g_sFontCm40b;
01142 extern const tFont g_sFontCm40i;
01143 extern const tFont g_sFontCm42;
01144 extern const tFont g_sFontCm42b;
01145 extern const tFont g_sFontCm42i;
01146 extern const tFont g_sFontCm44;
01147 extern const tFont g_sFontCm44b;
01148 extern const tFont g_sFontCm44i;
01149 extern const tFont g_sFontCm46;
01150 extern const tFont g_sFontCm46b;
01151 extern const tFont g_sFontCm46i;
01152 extern const tFont g_sFontCm48;
01153 extern const tFont g_sFontCm48b;
01154 extern const tFont g_sFontCm48i;
01155 extern const tFont g_sFontCmsc12;
01156 extern const tFont g_sFontCmsc14;
01157 extern const tFont g_sFontCmsc16;
01158 extern const tFont g_sFontCmsc18;
01159 extern const tFont g_sFontCmsc20;
01160 extern const tFont g_sFontCmsc22;
01161 extern const tFont g_sFontCmsc24;
01162 extern const tFont g_sFontCmsc26;
01163 extern const tFont g_sFontCmsc28;
01164 extern const tFont g_sFontCmsc30;
01165 extern const tFont g_sFontCmsc32;
01166 extern const tFont g_sFontCmsc34;
01167 extern const tFont g_sFontCmsc36;
01168 extern const tFont g_sFontCmsc38;
01169 extern const tFont g_sFontCmsc40;
01170 extern const tFont g_sFontCmsc42;
01171 extern const tFont g_sFontCmsc44;
01172 extern const tFont g_sFontCmsc46;
01173 extern const tFont g_sFontCmsc48;
01174 extern const tFont g_sFontCmss12;
01175 extern const tFont g_sFontCmss12b;
01176 extern const tFont g_sFontCmss12i;
01177 extern const tFont g_sFontCmss14;
01178 extern const tFont g_sFontCmss14b;
01179 extern const tFont g_sFontCmss14i;
01180 extern const tFont g_sFontCmss16;
01181 extern const tFont g_sFontCmss16b;
01182 extern const tFont g_sFontCmss16i;
01183 extern const tFont g_sFontCmss18;
01184 extern const tFont g_sFontCmss18b;
01185 extern const tFont g_sFontCmss18i;
01186 extern const tFont g_sFontCmss20;
01187 extern const tFont g_sFontCmss20b;
01188 extern const tFont g_sFontCmss20i;
01189 extern const tFont g_sFontCmss22;
01190 extern const tFont g_sFontCmss22b;
01191 extern const tFont g_sFontCmss22i;
01192 extern const tFont g_sFontCmss24;
01193 extern const tFont g_sFontCmss24b;
01194 extern const tFont g_sFontCmss24i;
01195 extern const tFont g_sFontCmss26;
01196 extern const tFont g_sFontCmss26b;
01197 extern const tFont g_sFontCmss26i;
01198 extern const tFont g_sFontCmss28;
01199 extern const tFont g_sFontCmss28b;
01200 extern const tFont g_sFontCmss28i;
01201 extern const tFont g_sFontCmss30;
01202 extern const tFont g_sFontCmss30b;
01203 extern const tFont g_sFontCmss30i;
01204 extern const tFont g_sFontCmss32;
01205 extern const tFont g_sFontCmss32b;
01206 extern const tFont g_sFontCmss32i;
01207 extern const tFont g_sFontCmss34;
01208 extern const tFont g_sFontCmss34b;
01209 extern const tFont g_sFontCmss34i;
01210 extern const tFont g_sFontCmss36;
01211 extern const tFont g_sFontCmss36b;
01212 extern const tFont g_sFontCmss36i;
01213 extern const tFont g_sFontCmss38;
01214 extern const tFont g_sFontCmss38b;
01215 extern const tFont g_sFontCmss38i;
01216 extern const tFont g_sFontCmss40;
01217 extern const tFont g_sFontCmss40b;
01218 extern const tFont g_sFontCmss40i;
01219 extern const tFont g_sFontCmss42;
01220 extern const tFont g_sFontCmss42b;
01221 extern const tFont g_sFontCmss42i;
01222 extern const tFont g_sFontCmss44;
01223 extern const tFont g_sFontCmss44b;
01224 extern const tFont g_sFontCmss44i;
01225 extern const tFont g_sFontCmss46;
01226 extern const tFont g_sFontCmss46b;
01227 extern const tFont g_sFontCmss46i;
01228 extern const tFont g_sFontCmss48;
01229 extern const tFont g_sFontCmss48b;
01230 extern const tFont g_sFontCmss48i;
01231 extern const tFont g_sFontCmtt12;
01232 extern const tFont g_sFontCmtt14;
01233 extern const tFont g_sFontCmtt16;
01234 extern const tFont g_sFontCmtt18;
01235 extern const tFont g_sFontCmtt20;
01236 extern const tFont g_sFontCmtt22;
01237 extern const tFont g_sFontCmtt24;
01238 extern const tFont g_sFontCmtt26;
01239 extern const tFont g_sFontCmtt28;
01240 extern const tFont g_sFontCmtt30;
01241 extern const tFont g_sFontCmtt32;
01242 extern const tFont g_sFontCmtt34;
01243 extern const tFont g_sFontCmtt36;
01244 extern const tFont g_sFontCmtt38;
01245 extern const tFont g_sFontCmtt40;
01246 extern const tFont g_sFontCmtt42;
01247 extern const tFont g_sFontCmtt44;
01248 extern const tFont g_sFontCmtt46;
01249 extern const tFont g_sFontCmtt48;
01250 extern const tFont g_sFontFixed6x8;
01251 
01252 //*****************************************************************************
01253 //
01254 // Language identifiers supported by the string table processing functions.
01255 //
01256 //*****************************************************************************
01257 #define GrLangZhPRC             0x0804      // Chinese (PRC)
01258 #define GrLangZhTW              0x0404      // Chinese (Taiwan)
01259 #define GrLangEnUS              0x0409      // English (United States)
01260 #define GrLangEnUK              0x0809      // English (United Kingdom)
01261 #define GrLangEnAUS             0x0C09      // English (Australia)
01262 #define GrLangEnCA              0x1009      // English (Canada)
01263 #define GrLangEnNZ              0x1409      // English (New Zealand)
01264 #define GrLangFr                0x040C      // French (Standard)
01265 #define GrLangDe                0x0407      // German (Standard)
01266 #define GrLangHi                0x0439      // Hindi
01267 #define GrLangIt                0x0410      // Italian (Standard)
01268 #define GrLangJp                0x0411      // Japanese
01269 #define GrLangKo                0x0412      // Korean
01270 #define GrLangEsMX              0x080A      // Spanish (Mexico)
01271 #define GrLangEsSP              0x0C0A      // Spanish (Spain)
01272 #define GrLangSwKE              0x0441      // Swahili (Kenya)
01273 #define GrLangUrIN              0x0820      // Urdu (India)
01274 #define GrLangUrPK              0x0420      // Urdu (Pakistan)
01275 
01276 //*****************************************************************************
01277 //
01291 //
01292 //*****************************************************************************
01293 #define DpyColorTranslate(pDisplay, ulValue)                                \
01294         ((pDisplay)->pfnColorTranslate((pDisplay)->pvDisplayData, ulValue))
01295 
01296 //*****************************************************************************
01297 //
01306 //
01307 //*****************************************************************************
01308 #define DpyFlush(pDisplay)                               \
01309         do                                   \
01310         {                                    \
01311             const tDisplay *pD = pDisplay;   \
01312             pD->pfnFlush(pD->pvDisplayData); \
01313         }                                    \
01314         while(0)
01315 
01316 //*****************************************************************************
01317 //
01327 //
01328 //*****************************************************************************
01329 #define DpyClearDisplay(pDisplay, ulValue)                   \
01330         do                                          \
01331         {                                           \
01332             const tDisplay *pD = pDisplay;          \
01333             pD->pfnClearDisplay(pD->pvDisplayData, ulValue); \
01334         }                                           \
01335         while(0)
01336 
01337 //*****************************************************************************
01338 //
01347 //
01348 //*****************************************************************************
01349 #define DpyHeightGet(pDisplay) \
01350         ((pDisplay)->usHeight)
01351 
01352 //*****************************************************************************
01353 //
01368 //
01369 //*****************************************************************************
01370 #define DpyLineDrawH(pDisplay, lX1, lX2, lY, ulValue)                   \
01371         do                                                              \
01372         {                                                               \
01373             const tDisplay *pD = pDisplay;                              \
01374             pD->pfnLineDrawH(pD->pvDisplayData, lX1, lX2, lY, ulValue); \
01375         }                                                               \
01376         while(0)
01377 
01378 //*****************************************************************************
01379 //
01394 //
01395 //*****************************************************************************
01396 #define DpyLineDrawV(pDisplay, lX, lY1, lY2, ulValue)                   \
01397         do                                                              \
01398         {                                                               \
01399             const tDisplay *pD = pDisplay;                              \
01400             pD->pfnLineDrawV(pD->pvDisplayData, lX, lY1, lY2, ulValue); \
01401         }                                                               \
01402         while(0)
01403 
01404 //*****************************************************************************
01405 //
01418 //
01419 //*****************************************************************************
01420 #define DpyPixelDraw(pDisplay, lX, lY, ulValue)                   \
01421         do                                                        \
01422         {                                                         \
01423             const tDisplay *pD = pDisplay;                        \
01424             pD->pfnPixelDraw(pD->pvDisplayData, lX, lY, ulValue); \
01425         }                                                         \
01426         while(0)
01427 
01428 //*****************************************************************************
01429 //
01451 //
01452 //*****************************************************************************
01453 #define DpyPixelDrawMultiple(pDisplay, lX, lY, lX0, lCount, lBPP, pucData,   \
01454                              pucPalette)                                     \
01455         do                                                                   \
01456         {                                                                    \
01457             const tDisplay *pD = pDisplay;                                   \
01458             pD->pfnPixelDrawMultiple(pD->pvDisplayData, lX, lY, lX0, lCount, \
01459                                      lBPP, pucData, pucPalette);             \
01460         }                                                                    \
01461         while(0)
01462 
01463 //*****************************************************************************
01464 //
01478 //
01479 //*****************************************************************************
01480 #define DpyRectFill(pDisplay, pRect, ulValue)                   \
01481         do                                                      \
01482         {                                                       \
01483             const tDisplay *pD = pDisplay;                      \
01484             pD->pfnRectFill(pD->pvDisplayData, pRect, ulValue); \
01485         }                                                       \
01486         while(0)
01487 
01488 //*****************************************************************************
01489 //
01498 //
01499 //*****************************************************************************
01500 #define DpyWidthGet(pDisplay) \
01501         ((pDisplay)->usWidth)
01502 
01503 //*****************************************************************************
01504 //
01516 //
01517 //*****************************************************************************
01518 #define GrRectContainsPoint(pRect, lX, lY)                                  \
01519             ((((lX) >= (pRect)->sXMin) && ((lX) <= (pRect)->sXMax) &&       \
01520               ((lY) >= (pRect)->sYMin) && ((lY) <= (pRect)->sYMax)) ? 1 : 0)
01521 
01522 //*****************************************************************************
01523 //
01524 // Prototypes for the graphics library functions.
01525 //
01526 //*****************************************************************************
01527 extern void GrCircleDraw(const tContext *pContext, long lX, long lY,
01528                          long lRadius);
01529 extern void GrCircleFill(const tContext *pContext, long lX, long lY,
01530                          long lRadius);
01531 extern void GrContextClipRegionSet(tContext *pContext, tRectangle *pRect);
01532 extern void GrContextInit(tContext *pContext, const tDisplay *pDisplay);
01533 extern void GrImageDraw(const tContext *pContext,
01534                         const tImage *pBitmap, int lX, int lY);
01535 extern void GrLineDraw(const tContext *pContext, long lX1, long lY1, long lX2,
01536                        long lY2);
01537 extern void GrLineDrawH(const tContext *pContext, long lX1, long lX2, long lY);
01538 extern void GrLineDrawV(const tContext *pContext, long lX, long lY1, long lY2);
01539 extern void GrRectDraw(const tContext *pContext, const tRectangle *pRect);
01540 extern void GrRectFill(const tContext *pContext, const tRectangle *pRect);
01541 extern void GrStringDraw(const tContext *pContext, const char *pcString,
01542                          long lLength, long lX, long lY,
01543                          unsigned long bOpaque);
01544 extern long GrStringWidthGet(const tContext *pContext, const char *pcString,
01545                              long lLength);
01546 extern long GrRectOverlapCheck(tRectangle *psRect1, tRectangle *psRect2);
01547 extern long GrRectIntersectGet(tRectangle *psRect1, tRectangle *psRect2,
01548                                tRectangle *psIntersect);
01549 
01550 //*****************************************************************************
01551 //
01552 // Mark the end of the C bindings section for C++ compilers.
01553 //
01554 //*****************************************************************************
01555 #ifdef __cplusplus
01556 }
01557 #endif
01558 
01559 //*****************************************************************************
01560 //
01561 // Close the Doxygen group.
01563 //
01564 //*****************************************************************************
01565 
01566 #endif // __GRLIB_H__

Copyright 2012, Texas Instruments Incorporated