RT1050 GUI demo using emWin library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GUI_Private.h Source File

GUI_Private.h

00001 /*********************************************************************
00002 *                SEGGER Microcontroller GmbH & Co. KG                *
00003 *        Solutions for real time microcontroller applications        *
00004 **********************************************************************
00005 *                                                                    *
00006 *        (c) 1996 - 2016  SEGGER Microcontroller GmbH & Co. KG       *
00007 *                                                                    *
00008 *        Internet: www.segger.com    Support:  support@segger.com    *
00009 *                                                                    *
00010 **********************************************************************
00011 
00012 ** emWin V5.38 - Graphical user interface for embedded applications **
00013 All  Intellectual Property rights  in the Software belongs to  SEGGER.
00014 emWin is protected by  international copyright laws.  Knowledge of the
00015 source code may not be used to write a similar product.  This file may
00016 only be used in accordance with the following terms:
00017 
00018 The software has been licensed to  NXP Semiconductors USA, Inc.  whose
00019 registered  office  is  situated  at 411 E. Plumeria Drive, San  Jose,
00020 CA 95134, USA  solely for  the  purposes  of  creating  libraries  for
00021 NXPs M0, M3/M4 and  ARM7/9 processor-based  devices,  sublicensed  and
00022 distributed under the terms and conditions of the NXP End User License
00023 Agreement.
00024 Full source code is available at: www.segger.com
00025 
00026 We appreciate your understanding and fairness.
00027 ----------------------------------------------------------------------
00028 Licensing information
00029 
00030 Licensor:                 SEGGER Microcontroller Systems LLC
00031 Licensed to:              NXP Semiconductors, 1109 McKay Dr, M/S 76, San Jose, CA 95131, USA
00032 Licensed SEGGER software: emWin
00033 License number:           GUI-00186
00034 License model:            emWin License Agreement, dated August 20th 2011
00035 Licensed product:         -
00036 Licensed platform:        NXP's ARM 7/9, Cortex-M0,M3,M4
00037 Licensed number of seats: -
00038 ----------------------------------------------------------------------
00039 File        : GUI_Private.h
00040 Purpose     : GUI internal declarations
00041 ---------------------------END-OF-HEADER------------------------------
00042 */
00043 
00044 #ifndef GUI_PRIVATE_H
00045 #define GUI_PRIVATE_H
00046 
00047 #include "GUI.h"
00048 #include "LCD_Protected.h"
00049 #include "GUI_Debug.h"
00050 #if GUI_WINSUPPORT
00051   #include "WM_GUI.h"
00052 #endif
00053 
00054 #if defined(__cplusplus)
00055 extern "C" {     /* Make sure we have C-declarations in C++ programs */
00056 #endif
00057 
00058 /*********************************************************************
00059 *
00060 *       Defaults for config switches
00061 *
00062 **********************************************************************
00063 
00064   The config switches below do not affect the interface in GUI.h and
00065   are therefor not required to be in GUI.h.
00066 */
00067 
00068 /* Short address area.
00069    For  most compilers, this is "near" or "__near"
00070    We do not use this except for some CPUs which we know to always have some
00071    near memory, because the GUI_Context and some other data will be declared
00072    to be in this short address (near) memory area as it has a major effect
00073    on performance.
00074    Please define in GUIConf.h (if you want to use it)
00075 */
00076 #ifndef GUI_SADDR
00077   #define GUI_SADDR
00078 #endif
00079 
00080 #ifndef GUI_DEFAULT_FONT
00081   #define GUI_DEFAULT_FONT    &GUI_Font6x8
00082 #endif
00083 
00084 #ifndef GUI_DEFAULT_CURSOR
00085   #define GUI_DEFAULT_CURSOR  &GUI_CursorArrowM
00086 #endif
00087 
00088 #ifndef GUI_DEFAULT_BKCOLOR
00089   #define GUI_DEFAULT_BKCOLOR GUI_BLACK
00090 #endif
00091 
00092 #ifndef GUI_DEFAULT_COLOR
00093   #define GUI_DEFAULT_COLOR   GUI_WHITE
00094 #endif
00095 
00096 /*********************************************************************
00097 *
00098 *       Angles
00099 *
00100 **********************************************************************
00101 */
00102 #define GUI_45DEG  512
00103 #define GUI_90DEG  (2 * GUI_45DEG)
00104 #define GUI_180DEG (4 * GUI_45DEG)
00105 #define GUI_360DEG (8 * GUI_45DEG)
00106 
00107 
00108 /*********************************************************************
00109 *
00110 *       Locking checks
00111 *
00112 **********************************************************************
00113 */
00114 #if defined (WIN32) && defined (_DEBUG) && GUI_OS
00115   #define GUI_ASSERT_LOCK()    GUITASK_AssertLock()
00116   #define GUI_ASSERT_NO_LOCK() GUITASK_AssertNoLock()
00117   void GUITASK_AssertLock(void);
00118   void GUITASK_AssertNoLock(void);
00119 #else
00120   #define GUI_ASSERT_LOCK()
00121   #define GUI_ASSERT_NO_LOCK()
00122 #endif
00123 
00124 /*********************************************************************
00125 *
00126 *       Division tables
00127 *
00128 **********************************************************************
00129 */
00130 extern const U8 GUI__aConvert_15_255[(1 << 4)];
00131 extern const U8 GUI__aConvert_31_255[(1 << 5)];
00132 extern const U8 GUI__aConvert_63_255[(1 << 6)];
00133 extern const U8 GUI__aConvert_255_15[(1 << 8)];
00134 extern const U8 GUI__aConvert_255_31[(1 << 8)];
00135 extern const U8 GUI__aConvert_255_63[(1 << 8)];
00136 
00137 /*********************************************************************
00138 *
00139 *       Usage internals
00140 *
00141 **********************************************************************
00142 */
00143 typedef GUI_HMEM GUI_USAGE_Handle;
00144 typedef struct tsUSAGE_APIList tUSAGE_APIList;
00145 typedef struct GUI_Usage GUI_USAGE;
00146 #define GUI_USAGE_h GUI_USAGE_Handle
00147 
00148 
00149 
00150 typedef GUI_USAGE_h tUSAGE_CreateCompatible(GUI_USAGE * p);
00151 typedef void        tUSAGE_AddPixel        (GUI_USAGE * p, int x, int y);
00152 typedef void        tUSAGE_AddHLine        (GUI_USAGE * p, int x0, int y0, int len);
00153 typedef void        tUSAGE_Clear           (GUI_USAGE * p);
00154 typedef void        tUSAGE_Delete          (GUI_USAGE_h h);
00155 typedef int         tUSAGE_GetNextDirty    (GUI_USAGE * p, int * pxOff, int yOff);
00156 #define GUI_USAGE_LOCK_H(h) ((GUI_USAGE *)GUI_LOCK_H(h))
00157 
00158 
00159 void GUI_USAGE_DecUseCnt(GUI_USAGE_Handle  hUsage);
00160 
00161 GUI_USAGE_Handle GUI_USAGE_BM_Create(int x0, int y0, int xsize, int ysize, int Flags);
00162 void    GUI_USAGE_Select(GUI_USAGE_Handle hUsage);
00163 void    GUI_USAGE_AddRect(GUI_USAGE * pUsage, int x0, int y0, int xSize, int ySize);
00164 #define GUI_USAGE_AddPixel(p, x,y)            p->pAPI->pfAddPixel(p,x,y)
00165 #define GUI_USAGE_AddHLine(p,x,y,len)         p->pAPI->pfAddHLine(p,x,y,len)
00166 #define GUI_USAGE_Clear(p)                    p->pAPI->pfClear(p)
00167 #define GUI_USAGE_Delete(p)                   p->pAPI->pfDelete(p)
00168 #define GUI_USAGE_GetNextDirty(p,pxOff, yOff) p->pAPI->pfGetNextDirty(p,pxOff, yOff)
00169 
00170 struct tsUSAGE_APIList {
00171   tUSAGE_AddPixel         * pfAddPixel;
00172   tUSAGE_AddHLine         * pfAddHLine;
00173   tUSAGE_Clear            * pfClear;
00174   tUSAGE_CreateCompatible * pfCreateCompatible;
00175   tUSAGE_Delete           * pfDelete;
00176   tUSAGE_GetNextDirty     * pfGetNextDirty;
00177 } ;
00178 
00179 struct GUI_Usage {
00180   I16P x0, y0, XSize, YSize;
00181   const tUSAGE_APIList * pAPI;
00182   I16 UseCnt;
00183 };
00184 
00185 
00186 /*********************************************************************
00187 *
00188 *       GUI_MEMDEV
00189 *
00190 **********************************************************************
00191 */
00192 #if GUI_SUPPORT_MEMDEV
00193 
00194 typedef struct {
00195   GUI_DEVICE * pDevice;
00196   I16P                   x0, y0, XSize, YSize;
00197   unsigned               BytesPerLine;
00198   unsigned               BitsPerPixel;
00199   GUI_HMEM               hUsage;
00200 } GUI_MEMDEV;
00201 
00202 #define      GUI_MEMDEV_LOCK_H(h) ((GUI_MEMDEV *)GUI_LOCK_H(h))
00203 
00204 void         GUI_MEMDEV__CopyFromLCD (GUI_MEMDEV_Handle hMem);
00205 void         GUI_MEMDEV__GetRect     (GUI_RECT * pRect);
00206 unsigned     GUI_MEMDEV__Color2Index (LCD_COLOR Color);
00207 LCD_COLOR    GUI_MEMDEV__Index2Color (int Index);
00208 unsigned int GUI_MEMDEV__GetIndexMask(void);
00209 void         GUI_MEMDEV__SetAlphaCallback(unsigned(* pcbSetAlpha)(U8));
00210 
00211 GUI_MEMDEV_Handle GUI_MEMDEV__CreateFixed(int x0, int y0, int xSize, int ySize, int Flags,
00212                                           const GUI_DEVICE_API     * pDeviceAPI,
00213                                           const LCD_API_COLOR_CONV * pColorConvAPI);
00214 
00215 void              GUI_MEMDEV__DrawSizedAt        (GUI_MEMDEV_Handle hMem, int xPos, int yPos, int xSize, int ySize);
00216 GUI_MEMDEV_Handle GUI_MEMDEV__GetEmptyCopy32     (GUI_MEMDEV_Handle hMem, int * pxSize, int * pySize, int * pxPos, int * pyPos);
00217 void              GUI_MEMDEV__ReadLine           (int x0, int y, int x1, LCD_PIXELINDEX * pBuffer);
00218 void              GUI_MEMDEV__WriteToActiveAlpha (GUI_MEMDEV_Handle hMem,int x, int y);
00219 void              GUI_MEMDEV__WriteToActiveAt    (GUI_MEMDEV_Handle hMem,int x, int y);
00220 void              GUI_MEMDEV__WriteToActiveOpaque(GUI_MEMDEV_Handle hMem,int x, int y);
00221 void            * GUI_MEMDEV__XY2PTR             (int x,int y);
00222 void            * GUI_MEMDEV__XY2PTREx           (GUI_MEMDEV * pDev, int x,int y);
00223 void              GUI_MEMDEV__BlendColor32       (GUI_MEMDEV_Handle hMem, U32 BlendColor, U8 BlendIntens);
00224 
00225 unsigned GUI__AlphaPreserveTrans(int OnOff);
00226 
00227 extern unsigned GUI_MEMDEV__TimePerFrame;
00228 
00229 #define GUI_TIME_PER_FRAME (GUI_TIMER_TIME)GUI_MEMDEV__TimePerFrame
00230 
00231 #define GUI_POS_AUTO -4095   /* Position value for auto-pos */
00232 
00233 #endif
00234 
00235 
00236 /*********************************************************************
00237 *
00238 *       LCD_HL_ level defines
00239 *
00240 **********************************************************************
00241 */
00242 #define LCD_HL_DrawHLine             GUI_pContext->pLCD_HL->pfDrawHLine
00243 #define LCD_HL_DrawPixel             GUI_pContext->pLCD_HL->pfDrawPixel
00244 
00245 
00246 /*********************************************************************
00247 *
00248 *       Helper functions
00249 *
00250 **********************************************************************
00251 */
00252 #define GUI_ZEROINIT(Obj) GUI_MEMSET(Obj, 0, sizeof(Obj))
00253 int  GUI_cos(int angle);
00254 int  GUI_sin(int angle);
00255 extern const U32 GUI_Pow10[10];
00256 
00257 /* Multi-touch */
00258 void GUI_MTOUCH__ManagePID(int OnOff);
00259 
00260 /* Anti-aliased drawing */
00261 int  GUI_AA_Init       (int x0, int x1);
00262 int  GUI_AA_Init_HiRes (int x0, int x1);
00263 void GUI_AA_Exit       (void);
00264 I16  GUI_AA_HiRes2Pixel(int HiRes);
00265 
00266 void GL_FillCircleAA_HiRes (int x0, int y0, int r);
00267 void GL_FillEllipseAA_HiRes(int x0, int y0, int rx, int ry);
00268 
00269 void GUI_AA__DrawCharAA2(int x0, int y0, int XSize, int YSize, int BytesPerLine, const U8 * pData);
00270 void GUI_AA__DrawCharAA4(int x0, int y0, int XSize, int YSize, int BytesPerLine, const U8 * pData);
00271 void GUI_AA__DrawCharAA8(int x0, int y0, int XSize, int YSize, int BytesPerLine, const U8 * pData);
00272 
00273 /* Alpha blending helper functions */
00274 #define GUI_ALPHABLENDING_DONE  (1 << 0)
00275 
00276 int      GUI__GetAlphaBuffer    (U32 ** ppCurrent, U32 ** ppConvert, U32 ** ppData, int * pVXSizeMax);
00277 int      GUI__AllocAlphaBuffer  (int AllocDataBuffer);
00278 U32    * GUI__DoAlphaBlending   (int x, int y, U32 * pData, int xSize, tLCDDEV_Index2Color * pfIndex2Color_DEV, int * pDone);
00279 unsigned GUI__SetAlphaBufferSize(int xSize);
00280 
00281 /* System independent font routines */
00282 int        GUI_SIF__GetCharDistX       (U16P c, int * pSizeX);
00283 void       GUI_SIF__GetFontInfo        (const GUI_FONT * pFont, GUI_FONTINFO * pfi);
00284 char       GUI_SIF__IsInFont           (const GUI_FONT * pFont, U16 c);
00285 const U8 * GUI_SIF__GetpCharInfo       (const GUI_FONT * pFont, U16P c, unsigned SizeOfCharInfo);
00286 int        GUI_SIF__GetNumCharAreas    (const GUI_FONT * pFont);
00287 int        GUI_SIF__GetCharDistX_ExtFrm(U16P c, int * pSizeX);
00288 void       GUI_SIF__GetFontInfo_ExtFrm (const GUI_FONT * pFont, GUI_FONTINFO * pfi);
00289 char       GUI_SIF__IsInFont_ExtFrm    (const GUI_FONT * pFont, U16 c);
00290 int        GUI_SIF__GetCharInfo_ExtFrm (U16P c, GUI_CHARINFO_EXT * pInfo);
00291 void       GUI_SIF__ClearLine_ExtFrm   (const char * s, int Len);
00292 
00293 /* External binary font routines */
00294 int        GUI_XBF__GetOff       (const GUI_XBF_DATA * pXBF_Data, unsigned c, U32 * pOff);
00295 int        GUI_XBF__GetOffAndSize(const GUI_XBF_DATA * pXBF_Data, unsigned c, U32 * pOff, U16 * pSize);
00296 int        GUI_XBF__GetCharDistX (U16P c, int * pSizeX);
00297 void       GUI_XBF__GetFontInfo  (const GUI_FONT * pFont, GUI_FONTINFO * pInfo);
00298 char       GUI_XBF__IsInFont     (const GUI_FONT * pFont, U16 c);
00299 int        GUI_XBF__GetCharInfo  (U16P c, GUI_CHARINFO_EXT * pInfo);
00300 void       GUI_XBF__ClearLine    (const char * s, int Len);
00301 
00302 /* Conversion routines */
00303 void GUI_AddHex     (U32 v, U8 Len, char ** ps);
00304 void GUI_AddBin     (U32 v, U8 Len, char ** ps);
00305 void GUI_AddDecMin  (I32 v, char ** ps);
00306 void GUI_AddDec     (I32 v, U8 Len, char ** ps);
00307 void GUI_AddDecShift(I32 v, U8 Len, U8 Shift, char ** ps);
00308 long GUI_AddSign    (long v, char ** ps);
00309 int  GUI_Long2Len   (I32 v);
00310 
00311 #define GUI_UC__GetCharSize(sText)  GUI_pUC_API->pfGetCharSize(sText)
00312 #define GUI_UC__GetCharCode(sText)  GUI_pUC_API->pfGetCharCode(sText)
00313 
00314 int   GUI_UC__CalcSizeOfChar   (U16 Char);
00315 U16   GUI_UC__GetCharCodeInc   (const char ** ps);
00316 int   GUI_UC__NumChars2NumBytes(const char * s, int NumChars);
00317 int   GUI_UC__NumBytes2NumChars(const char * s, int NumBytes);
00318 
00319 int  GUI__GetLineNumChars  (const char * s, int MaxNumChars);
00320 int  GUI__GetNumChars      (const char * s);
00321 int  GUI__GetOverlap       (U16 Char);
00322 int  GUI__GetLineDistX     (const char * s, int Len);
00323 int  GUI__GetFontSizeY     (void);
00324 int  GUI__HandleEOLine     (const char ** ps);
00325 void GUI__DispLine         (const char * s, int Len, const GUI_RECT * pr);
00326 void GUI__AddSpaceHex      (U32 v, U8 Len, char ** ps);
00327 void GUI__CalcTextRect     (const char * pText, const GUI_RECT * pTextRectIn, GUI_RECT * pTextRectOut, int TextAlign);
00328 
00329 void GUI__ClearTextBackground(int xDist, int yDist);
00330 
00331 int  GUI__WrapGetNumCharsDisp       (const char * pText, int xSize, GUI_WRAPMODE WrapMode);
00332 int  GUI__WrapGetNumCharsToNextLine (const char * pText, int xSize, GUI_WRAPMODE WrapMode);
00333 int  GUI__WrapGetNumBytesToNextLine (const char * pText, int xSize, GUI_WRAPMODE WrapMode);
00334 void GUI__memset    (U8  * p, U8 Fill, int NumBytes);
00335 void GUI__memset16  (U16 * p, U16 Fill, int NumWords);
00336 int  GUI__strlen    (const char * s);
00337 int  GUI__strcmp    (const char * s0, const char * s1);
00338 int  GUI__strcmp_hp (GUI_HMEM hs0, const char * s1);
00339 
00340 /* Get cursor position */
00341 int  GUI__GetCursorPosX     (const char * s, int Index, int MaxNumChars);
00342 int  GUI__GetCursorPosChar  (const char * s, int x, int NumCharsToNextLine);
00343 U16  GUI__GetCursorCharacter(const char * s, int Index, int MaxNumChars, int * pIsRTL);
00344 
00345 /* Arabic support (tbd) */
00346 U16  GUI__GetPresentationForm     (U16 Char, U16 Next, U16 Prev, int * pIgnoreNext, const char * s);
00347 int  GUI__IsArabicCharacter       (U16 c);
00348 
00349 /* BiDi support */
00350 int  GUI__BIDI_Log2Vis           (const char * s, int NumChars, char * pBuffer, int BufferSize);
00351 int  GUI__BIDI_GetCursorPosX     (const char * s, int NumChars, int Index);
00352 int  GUI__BIDI_GetCursorPosChar  (const char * s, int NumChars, int x);
00353 U16  GUI__BIDI_GetLogChar        (const char * s, int NumChars, int Index);
00354 int  GUI__BIDI_GetCharDir        (const char * s, int NumChars, int Index);
00355 int  GUI__BIDI_IsNSM             (U16 Char);
00356 U16  GUI__BIDI_GetCursorCharacter(const char * s, int Index, int MaxNumChars, int * pIsRTL);
00357 int  GUI__BIDI_GetWordWrap       (const char * s, int xSize, int * pxDist);
00358 int  GUI__BIDI_GetCharWrap       (const char * s, int xSize);
00359 
00360 #if (GUI_USE_BIDI2)
00361 
00362 #define GUI__BIDI_Log2Vis            GUI__BIDI2_Log2Vis
00363 #define GUI__BIDI_GetCursorPosX      GUI__BIDI2_GetCursorPosX
00364 #define GUI__BIDI_GetCursorPosChar   GUI__BIDI2_GetCursorPosChar
00365 #define GUI__BIDI_GetLogChar         GUI__BIDI2_GetLogChar
00366 #define GUI__BIDI_GetCharDir         GUI__BIDI2_GetCharDir
00367 #define GUI__BIDI_IsNSM              GUI__BIDI2_IsNSM
00368 #define GUI__BIDI_GetCursorCharacter GUI__BIDI2_GetCursorCharacter
00369 #define GUI__BIDI_GetWordWrap        GUI__BIDI2_GetWordWrap
00370 #define GUI__BIDI_GetCharWrap        GUI__BIDI2_GetCharWrap
00371 #define GUI__BIDI_SetBaseDir         GUI__BIDI2_SetBaseDir
00372 #define GUI__BIDI_GetBaseDir         GUI__BIDI2_GetBaseDir
00373 
00374 int  GUI__BIDI_Log2Vis           (const char * s, int NumChars, char * pBuffer, int BufferSize);
00375 int  GUI__BIDI_GetCursorPosX     (const char * s, int NumChars, int Index);
00376 int  GUI__BIDI_GetCursorPosChar  (const char * s, int NumChars, int x);
00377 U16  GUI__BIDI_GetLogChar        (const char * s, int NumChars, int Index);
00378 int  GUI__BIDI_GetCharDir        (const char * s, int NumChars, int Index);
00379 int  GUI__BIDI_IsNSM             (U16 Char);
00380 U16  GUI__BIDI_GetCursorCharacter(const char * s, int Index, int MaxNumChars, int * pIsRTL);
00381 int  GUI__BIDI_GetWordWrap       (const char * s, int xSize, int * pxDist);
00382 int  GUI__BIDI_GetCharWrap       (const char * s, int xSize);
00383 void GUI__BIDI_SetBaseDir        (int Dir);
00384 int  GUI__BIDI_GetBaseDir        (void);
00385 
00386 #else
00387 
00388 #define GUI__BIDI_SetBaseDir
00389 #define GUI__BIDI_GetBaseDir
00390 
00391 #endif
00392 
00393 const char * GUI__BIDI_Log2VisBuffered(const char * s, int * pMaxNumChars);
00394 
00395 extern int GUI__BIDI_Enabled;
00396 
00397 extern int (* _pfGUI__BIDI_Log2Vis         )(const char * s, int NumChars, char * pBuffer, int BufferSize);
00398 extern int (* _pfGUI__BIDI_GetCursorPosX   )(const char * s, int NumChars, int Index);
00399 extern int (* _pfGUI__BIDI_GetCursorPosChar)(const char * s, int NumChars, int x);
00400 extern U16 (* _pfGUI__BIDI_GetLogChar      )(const char * s, int NumChars, int Index);
00401 extern int (* _pfGUI__BIDI_GetCharDir      )(const char * s, int NumChars, int Index);
00402 extern int (* _pfGUI__BIDI_IsNSM           )(U16 Char);
00403 
00404 /* BiDi-related function pointers */
00405 extern const char * (* GUI_CharLine_pfLog2Vis)(const char * s, int * pMaxNumChars);
00406 
00407 extern int (* GUI__GetCursorPos_pfGetPosX)     (const char * s, int MaxNumChars, int Index);
00408 extern int (* GUI__GetCursorPos_pfGetPosChar)  (const char * s, int MaxNumChars, int x);
00409 extern U16 (* GUI__GetCursorPos_pfGetCharacter)(const char * s, int MaxNumChars, int Index, int * pIsRTL);
00410 
00411 extern int (* GUI__Wrap_pfGetWordWrap)(const char * s, int xSize, int * pxDist);
00412 extern int (* GUI__Wrap_pfGetCharWrap)(const char * s, int xSize);
00413 
00414 /* Proportional  font support */
00415 const GUI_FONT_PROP * GUIPROP__FindChar(const GUI_FONT_PROP * pProp, U16P c);
00416 
00417 /* Extended proportional font support */
00418 const GUI_FONT_PROP_EXT * GUIPROP_EXT__FindChar(const GUI_FONT_PROP_EXT * pPropExt, U16P c);
00419 void  GUIPROP_EXT__DispLine      (const char * s, int Len);
00420 void  GUIPROP_EXT__ClearLine     (const char * s, int Len);
00421 void  GUIPROP_EXT__SetfpClearLine(void (* fpClearLine)(const char * s, int Len));
00422 
00423 /* Reading data routines */
00424 U16 GUI__Read16(const U8 ** ppData);
00425 U32 GUI__Read32(const U8 ** ppData);
00426 
00427 /* Virtual screen support */
00428 void GUI__GetOrg(int * px, int * py);
00429 void GUI__SetOrgHook(void(* pfHook)(int x, int y));
00430 
00431 /* Timer support */
00432 int              GUI_TIMER__IsActive       (void);
00433 GUI_TIMER_TIME   GUI_TIMER__GetPeriod      (void);
00434 GUI_TIMER_HANDLE GUI_TIMER__GetNextTimer   (GUI_TIMER_HANDLE hTimer, U32 * pContext);
00435 GUI_TIMER_HANDLE GUI_TIMER__GetFirstTimer  (U32 * pContext);
00436 GUI_TIMER_HANDLE GUI_TIMER__GetNextTimerLin(GUI_TIMER_HANDLE hTimer, U32 * pContext);
00437 
00438 /* Get function pointers for color conversion */
00439 tLCDDEV_Index2Color * GUI_GetpfIndex2ColorEx(int LayerIndex);
00440 tLCDDEV_Color2Index * GUI_GetpfColor2IndexEx(int LayerIndex);
00441 
00442 int GUI_GetBitsPerPixelEx(int LayerIndex);
00443 
00444 LCD_PIXELINDEX * LCD_GetpPalConvTable        (const LCD_LOGPALETTE * pLogPal);
00445 LCD_PIXELINDEX * LCD_GetpPalConvTableUncached(const LCD_LOGPALETTE * pLogPal);
00446 LCD_PIXELINDEX * LCD_GetpPalConvTableBM      (const LCD_LOGPALETTE * pLogPal, const GUI_BITMAP * pBitmap, int LayerIndex);
00447 
00448 /* Setting a function for converting a color palette to an array of index values */
00449 void GUI_SetFuncGetpPalConvTable(LCD_PIXELINDEX * (* pFunc)(const LCD_LOGPALETTE * pLogPal, const GUI_BITMAP * pBitmap, int LayerIndex));
00450 
00451 /*********************************************************************
00452 *
00453 *       Format definitions used by streamed bitmaps
00454 *
00455 *   IMPORTANT: DO NOT CHANGE THESE VALUES!
00456 *   THEY HAVE TO CORRESPOND TO THE DEFINITIONS WITHIN THE CODE OF THE BITMAPCONVERTER!
00457 */
00458 #define GUI_STREAM_FORMAT_INDEXED    100 /* DO NOT CHANGE */
00459 #define GUI_STREAM_FORMAT_RLE4       6   /* DO NOT CHANGE */
00460 #define GUI_STREAM_FORMAT_RLE8       7   /* DO NOT CHANGE */
00461 #define GUI_STREAM_FORMAT_565        8   /* DO NOT CHANGE */
00462 #define GUI_STREAM_FORMAT_M565       9   /* DO NOT CHANGE */
00463 #define GUI_STREAM_FORMAT_555        10  /* DO NOT CHANGE */
00464 #define GUI_STREAM_FORMAT_M555       11  /* DO NOT CHANGE */
00465 #define GUI_STREAM_FORMAT_RLE16      12  /* DO NOT CHANGE */
00466 #define GUI_STREAM_FORMAT_RLEM16     13  /* DO NOT CHANGE */
00467 #define GUI_STREAM_FORMAT_8888       16  /* DO NOT CHANGE */
00468 #define GUI_STREAM_FORMAT_RLE32      15  /* DO NOT CHANGE */
00469 #define GUI_STREAM_FORMAT_24         17  /* DO NOT CHANGE */
00470 #define GUI_STREAM_FORMAT_RLEALPHA   18  /* DO NOT CHANGE */
00471 #define GUI_STREAM_FORMAT_444_12     19  /* DO NOT CHANGE */
00472 #define GUI_STREAM_FORMAT_M444_12    20  /* DO NOT CHANGE */
00473 #define GUI_STREAM_FORMAT_444_12_1   21  /* DO NOT CHANGE */
00474 #define GUI_STREAM_FORMAT_M444_12_1  22  /* DO NOT CHANGE */
00475 #define GUI_STREAM_FORMAT_444_16     23  /* DO NOT CHANGE */
00476 #define GUI_STREAM_FORMAT_M444_16    24  /* DO NOT CHANGE */
00477 #define GUI_STREAM_FORMAT_A555       25  /* DO NOT CHANGE */
00478 #define GUI_STREAM_FORMAT_AM555      26  /* DO NOT CHANGE */
00479 #define GUI_STREAM_FORMAT_A565       27  /* DO NOT CHANGE */
00480 #define GUI_STREAM_FORMAT_AM565      28  /* DO NOT CHANGE */
00481 #define GUI_STREAM_FORMAT_M8888I     29  /* DO NOT CHANGE */
00482 
00483 
00484 void GUI__ReadHeaderFromStream  (GUI_BITMAP_STREAM * pBitmapHeader, const U8 * pData);
00485 void GUI__CreateBitmapFromStream(const GUI_BITMAP_STREAM * pBitmapHeader, const void * pData, GUI_BITMAP * pBMP, GUI_LOGPALETTE * pPAL, const GUI_BITMAP_METHODS * pMethods);
00486 
00487 /* Cache management */
00488 int GUI__ManageCache  (int Cmd);
00489 int GUI__ManageCacheEx(int LayerIndex, int Cmd);
00490 
00491 /*********************************************************************
00492 *
00493 *       2d - GL
00494 *
00495 **********************************************************************
00496 */
00497 void GL_DispChar         (U16 c);
00498 void GL_DrawArc          (int x0, int y0, int rx, int ry, int a0, int a1);
00499 void GL_DrawBitmap       (const GUI_BITMAP * pBM, int x0, int y0);
00500 void GL_DrawCircle       (int x0, int y0, int r);
00501 void GL_DrawEllipse      (int x0, int y0, int rx, int ry, int w);
00502 void GL_DrawHLine        (int y0, int x0, int x1);
00503 void GL_DrawPolygon      (const GUI_POINT * pPoints, int NumPoints, int x0, int y0);
00504 void GL_DrawPoint        (int x,  int y);
00505 void GL_DrawLine1        (int x0, int y0, int x1, int y1);
00506 void GL_DrawLine1Ex      (int x0, int y0, int x1, int y1, unsigned * pPixelCnt);
00507 void GL_DrawLineRel      (int dx, int dy);
00508 void GL_DrawLineTo       (int x,  int y);
00509 void GL_DrawLineToEx     (int x,  int y, unsigned * pPixelCnt);
00510 void GL_DrawLine         (int x0, int y0, int x1, int y1);
00511 void GL_DrawLineEx       (int x0, int y0, int x1, int y1, unsigned * pPixelCnt);
00512 void GL_MoveTo           (int x,  int y);
00513 void GL_FillCircle       (int x0, int y0, int r);
00514 void GL_FillCircleAA     (int x0, int y0, int r);
00515 void GL_FillEllipse      (int x0, int y0, int rx, int ry);
00516 void GL_FillPolygon      (const GUI_POINT * pPoints, int NumPoints, int x0, int y0);
00517 void GL_SetDefault       (void);
00518 
00519 
00520 /*********************************************************************
00521 *
00522 *       Callback pointers for dynamic linkage
00523 *
00524 **********************************************************************
00525 Dynamic linkage pointers reduces configuration hassles.
00526 */
00527 typedef int  GUI_tfTimer(void);
00528 typedef int  WM_tfHandlePID(void);
00529 
00530 
00531 /*********************************************************************
00532 *
00533 *       Cursors
00534 *
00535 **********************************************************************
00536 */
00537 extern GUI_CONST_STORAGE unsigned char  GUI_Pixels_ArrowS[45];
00538 extern GUI_CONST_STORAGE unsigned char  GUI_Pixels_ArrowM[60];
00539 extern GUI_CONST_STORAGE unsigned char  GUI_Pixels_ArrowL[150];
00540 extern GUI_CONST_STORAGE unsigned char  GUI_Pixels_CrossS[33];
00541 extern GUI_CONST_STORAGE unsigned char  GUI_Pixels_CrossM[126];
00542 extern GUI_CONST_STORAGE unsigned char  GUI_Pixels_CrossL[248];
00543 extern GUI_CONST_STORAGE unsigned char  GUI_PixelsHeaderM[5 * 17];
00544 
00545 extern GUI_CONST_STORAGE GUI_LOGPALETTE GUI_CursorPal;
00546 extern GUI_CONST_STORAGE GUI_LOGPALETTE GUI_CursorPalI;
00547 
00548 
00549 /*********************************************************************
00550 *
00551 *       Text rotation
00552 *
00553 **********************************************************************
00554 */
00555 extern GUI_RECT  GUI_RectDispString; /* Used by LCD_Rotate...() and GUI_DispStringInRect() */
00556 
00557 /*********************************************************************
00558 *
00559 *       Flag for setting transparency for 'EXT' fonts
00560 *
00561 **********************************************************************
00562 */
00563 extern U8 GUI__CharHasTrans;
00564 
00565 /*********************************************************************
00566 *
00567 *       Multitasking support
00568 *
00569 **********************************************************************
00570 */
00571 extern int GUITASK__EntranceCnt;
00572 
00573 /*********************************************************************
00574 *
00575 *       Bitmap related functions
00576 *
00577 **********************************************************************
00578 */
00579 
00580 int       GUI_GetBitmapPixelIndex(const GUI_BITMAP * pBMP, unsigned x, unsigned y);
00581 GUI_COLOR GUI_GetBitmapPixelColor(const GUI_BITMAP * pBMP, unsigned x, unsigned y);
00582 int       GUI_GetBitmapPixelIndexEx(int BitsPerPixel, int BytesPerLine, const U8 * pData, unsigned x, unsigned y);
00583 
00584 void      GUI__DrawBitmap16bpp (int x0, int y0, int xsize, int ysize, const U8 * pPixel, const LCD_LOGPALETTE * pLogPal, int xMag, int yMag, tLCDDEV_Index2Color * pfIndex2Color, const LCD_API_COLOR_CONV * pColorConvAPI);
00585 void      GUI__DrawBitmapA16bpp(int x0, int y0, int xSize, int ySize, const U8 * pPixel, const LCD_LOGPALETTE * pLogPal, int xMag, int yMag, tLCDDEV_Index2Color * pfIndex2Color);
00586 void      GUI__SetPixelAlpha   (int x, int y, U8 Alpha, LCD_COLOR Color);
00587 LCD_COLOR GUI__MixColors       (LCD_COLOR Color, LCD_COLOR BkColor, U8 Intens);
00588 void      GUI__MixColorsBulk   (U32 * pFG, U32 * pBG, U32 * pDst, unsigned OffFG, unsigned OffBG, unsigned OffDest, unsigned xSize, unsigned ySize, U8 Intens);
00589 
00590 extern const GUI_UC_ENC_APILIST GUI_UC_None;
00591 
00592 /*********************************************************************
00593 *
00594 *       LCDDEV_L0_xxx
00595 *
00596 **********************************************************************
00597 */
00598 #define LCDDEV_L0_Color2Index         GUI__apDevice[GUI_pContext->SelLayer]->pColorConvAPI->pfColor2Index
00599 #define LCDDEV_L0_Index2Color         GUI__apDevice[GUI_pContext->SelLayer]->pColorConvAPI->pfIndex2Color
00600 
00601 #define LCDDEV_L0_DrawBitmap          GUI__apDevice[GUI_pContext->SelLayer]->pDeviceAPI->pfDrawBitmap
00602 #define LCDDEV_L0_DrawHLine           GUI__apDevice[GUI_pContext->SelLayer]->pDeviceAPI->pfDrawHLine
00603 #define LCDDEV_L0_DrawVLine           GUI__apDevice[GUI_pContext->SelLayer]->pDeviceAPI->pfDrawVLine
00604 #define LCDDEV_L0_DrawPixel           GUI__apDevice[GUI_pContext->SelLayer]->pDeviceAPI->pfDrawPixel
00605 #define LCDDEV_L0_FillRect            GUI__apDevice[GUI_pContext->SelLayer]->pDeviceAPI->pfFillRect
00606 #define LCDDEV_L0_GetPixel            GUI__apDevice[GUI_pContext->SelLayer]->pDeviceAPI->pfGetPixel
00607 #define LCDDEV_L0_GetRect             GUI__apDevice[GUI_pContext->SelLayer]->pDeviceAPI->pfGetRect
00608 #define LCDDEV_L0_GetPixelIndex       GUI__apDevice[GUI_pContext->SelLayer]->pDeviceAPI->pfGetPixelIndex
00609 #define LCDDEV_L0_SetPixelIndex       GUI__apDevice[GUI_pContext->SelLayer]->pDeviceAPI->pfSetPixelIndex
00610 #define LCDDEV_L0_XorPixel            GUI__apDevice[GUI_pContext->SelLayer]->pDeviceAPI->pfXorPixel
00611 #define LCDDEV_L0_GetDevFunc          GUI__apDevice[GUI_pContext->SelLayer]->pDeviceAPI->pfGetDevFunc
00612 
00613 void LCD_ReadRect  (int x0, int y0, int x1, int y1, LCD_PIXELINDEX * pBuffer, GUI_DEVICE * pDevice);
00614 void GUI_ReadRect  (int x0, int y0, int x1, int y1, LCD_PIXELINDEX * pBuffer, GUI_DEVICE * pDevice);
00615 void GUI_ReadRectEx(int x0, int y0, int x1, int y1, LCD_PIXELINDEX * pBuffer, GUI_DEVICE * pDevice);
00616 
00617 void LCD_ReadRectNoClip(int x0, int y0, int x1, int y1, LCD_PIXELINDEX * pBuffer, GUI_DEVICE * pDevice);
00618 
00619 /*********************************************************************
00620 *
00621 *       Internal color management
00622 *
00623 **********************************************************************
00624 */
00625 typedef struct {
00626   void         (* pfSetColor)   (LCD_COLOR Index);
00627   void         (* pfSetBkColor) (LCD_COLOR Index);
00628   LCD_DRAWMODE (* pfSetDrawMode)(LCD_DRAWMODE dm);
00629 } LCD_SET_COLOR_API;
00630 
00631 extern const LCD_SET_COLOR_API * LCD__pSetColorAPI;
00632 
00633 #define LCD__SetBkColorIndex(Index) (*GUI_pContext->LCD_pBkColorIndex = Index)
00634 #define LCD__SetColorIndex(Index)   (*GUI_pContext->LCD_pColorIndex   = Index)
00635 #define LCD__GetBkColorIndex()      (*GUI_pContext->LCD_pBkColorIndex)
00636 #define LCD__GetColorIndex()        (*GUI_pContext->LCD_pColorIndex)
00637 
00638 /* The following 2 defines are only required for compatibility to older versions of the TTF library */
00639 #define LCD_BKCOLORINDEX (*GUI_pContext->LCD_pBkColorIndex)
00640 #define LCD_COLORINDEX   (*GUI_pContext->LCD_pColorIndex)
00641 
00642 /*********************************************************************
00643 *
00644 *       EXTERNs for GL_CORE
00645 *
00646 **********************************************************************
00647 */
00648 extern const GUI_FONT * GUI__pFontDefault;
00649 extern GUI_COLOR        GUI__ColorDefault;
00650 extern GUI_COLOR        GUI__BkColorDefault;
00651 
00652 extern GUI_SADDR GUI_CONTEXT * GUI_pContext;
00653 
00654 extern GUI_DEVICE * GUI__apDevice[GUI_NUM_LAYERS];
00655 
00656 //
00657 // Function pointer for converting a palette containing a color array into an index array
00658 //
00659 extern LCD_PIXELINDEX * (* GUI_pfGetpPalConvTable)(const LCD_LOGPALETTE * pLogPal, const GUI_BITMAP * pBitmap, int LayerIndex);
00660 
00661 //
00662 // Function pointer for mixing up 2 colors
00663 //
00664 extern LCD_COLOR (* GUI__pfMixColors)(LCD_COLOR Color, LCD_COLOR BkColor, U8 Intens);
00665 
00666 //
00667 // Function pointer for mixing up arrays of colors
00668 //
00669 extern void (* GUI__pfMixColorsBulk)(U32 * pFG, U32 * pBG, U32 * pDst, unsigned OffFG, unsigned OffBG, unsigned OffDest, unsigned xSize, unsigned ySize, U8 Intens);
00670 
00671 //
00672 // Function pointer for mixing color and gamma values
00673 //
00674 extern LCD_COLOR (* LCD_AA_pfMixColors16)(LCD_COLOR Color, LCD_COLOR BkColor, U8 Intens);
00675 
00676 //
00677 // Function pointer for drawing alpha memory devices
00678 //
00679 extern GUI_DRAWMEMDEV_FUNC   * GUI__pfDrawAlphaMemdevFunc;
00680 
00681 //
00682 // Function pointer for drawing alpha bitmaps
00683 //
00684 extern GUI_DRAWBITMAP32_FUNC * GUI__pfDrawAlphaBitmapFunc;
00685 
00686 //
00687 // API list to be used for MultiBuffering
00688 //
00689 extern const GUI_MULTIBUF_API    GUI_MULTIBUF_APIList;
00690 extern const GUI_MULTIBUF_API    GUI_MULTIBUF_APIListMasked;
00691 extern const GUI_MULTIBUF_API_EX GUI_MULTIBUF_APIListEx;
00692 
00693 #ifdef  GL_CORE_C
00694   #define GUI_EXTERN
00695 #else
00696   #define GUI_EXTERN extern
00697 #endif
00698 
00699 GUI_EXTERN   void (* GUI_pfExecAnimations)(void);
00700 GUI_EXTERN   int  (* GUI_pfUpdateSoftLayer)(void);
00701 
00702 GUI_EXTERN   void (* GUI_pfAfterInitHook)(void);
00703 
00704 #ifdef WIN32
00705   GUI_EXTERN void (* GUI_pfSoftlayerGetPixel)(int x, int y, void * p);
00706 #endif
00707 
00708 GUI_EXTERN void (* GUI_pfHookMTOUCH)(const GUI_MTOUCH_STATE * pState);
00709 
00710 GUI_EXTERN const GUI_UC_ENC_APILIST * GUI_pUC_API; /* Unicode encoding API */
00711 
00712 GUI_EXTERN GUI_SADDR char             GUI_DecChar;
00713 GUI_EXTERN           GUI_tfTimer    * GUI_pfTimerExec;
00714 GUI_EXTERN           WM_tfHandlePID * WM_pfHandlePID;
00715 GUI_EXTERN   void (* GUI_pfDispCharStyle)(U16 Char);
00716 
00717 GUI_EXTERN           int GUI__BufferSize; // Required buffer size in pixels for alpha blending and/or antialiasing
00718 GUI_EXTERN           int GUI_AA__ClipX0;  // x0-clipping value for AA module
00719 
00720 GUI_EXTERN           I8  GUI__aNumBuffers[GUI_NUM_LAYERS]; // Number of buffers used per layer
00721 GUI_EXTERN           U8  GUI__PreserveTrans;
00722 GUI_EXTERN           U8  GUI__IsInitialized;
00723 
00724 GUI_EXTERN           U8  GUI__NumLayersInUse;
00725 GUI_EXTERN           U32 GUI__LayerMask;
00726 
00727 #if GUI_SUPPORT_ROTATION
00728   GUI_EXTERN const tLCD_APIList * GUI_pLCD_APIList; /* Used for rotating text */
00729 #endif
00730 
00731 GUI_EXTERN I16 GUI_OrgX, GUI_OrgY;
00732 
00733 #undef GUI_EXTERN
00734 
00735 #if defined(__cplusplus)
00736 }
00737 #endif
00738 
00739 #endif /* GUI_PRIVATE_H */
00740 
00741 /*************************** End of file ****************************/