RT1050 GUI demo using emWin library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LCD.h Source File

LCD.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        : LCD.h
00040 Purpose     : Declares LCD interface functions
00041 ----------------------------------------------------------------------
00042 */
00043 
00044 #ifndef LCD_H
00045 #define LCD_H
00046 
00047 #include "GUI_ConfDefaults.h" /* Used for GUI_CONST_STORAGE */
00048 #include "Global.h"
00049 
00050 #if defined(__cplusplus)
00051 extern "C" {     /* Make sure we have C-declarations in C++ programs */
00052 #endif
00053 
00054 /*********************************************************************
00055 *
00056 *       Basic type defines
00057 *
00058 * The follwing are defines for types used in the LCD-driver and the
00059 * GUI layers on top of that. Since "C" does not provide data types of
00060 * fixed length which are identical on all platforms, this is done here.
00061 * For most 16/32 controllers, the settings will work fine. However, if
00062 * you have similar defines in other sections of your program, you might
00063 * want to change or relocate these defines, e.g. in a TYPE.h file.
00064 */
00065 #define I16P I16              /*   signed 16 bits OR MORE ! */
00066 #define U16P U16              /* unsigned 16 bits OR MORE ! */
00067 
00068 /*********************************************************************
00069 *
00070 *       Settings for windows simulation
00071 *
00072 * Some settings in the configuration may conflict with the values required
00073 * in the Simulation. This is why we ignore the target settings for data
00074 * types and use the correct settings for the simulation.
00075 * (U32 could be defined as long, which would yield a 64 bit type on
00076 * the PC)
00077 */
00078 #ifdef WIN32
00079   #pragma warning( disable : 4244 )  // Disable warning messages in simulation
00080   #pragma warning( disable : 4761 )  // Disable warning "integral size mismatch in argument; conversion supplied"
00081 #endif
00082 
00083 /*********************************************************************
00084 *
00085 *       Constants
00086 */
00087 #define LCD_ERR0 (0x10)
00088 #define LCD_ERR_CONTROLLER_NOT_FOUND (LCD_ERR0+1)
00089 #define LCD_ERR_MEMORY               (LCD_ERR0+2)
00090 
00091 /*********************************************************************
00092 *
00093 *       Drawing modes
00094 */
00095 #define LCD_DRAWMODE_NORMAL (0)
00096 #define LCD_DRAWMODE_XOR    (1<<0)
00097 #define LCD_DRAWMODE_TRANS  (1<<1)
00098 #define LCD_DRAWMODE_REV    (1<<2)
00099 
00100 /*********************************************************************
00101 *
00102 *       Typedefs
00103 */
00104 typedef int LCD_DRAWMODE;
00105 typedef U32 LCD_COLOR;
00106 
00107 /*********************************************************************
00108 *
00109 *       Data structures
00110 */
00111 typedef struct { I16P x,y; } GUI_POINT;
00112 typedef struct { I16 x0,y0,x1,y1; } LCD_RECT;
00113 
00114 typedef struct {
00115   int              NumEntries;
00116   char             HasTrans;
00117   const LCD_COLOR * pPalEntries;
00118 } LCD_LOGPALETTE;
00119 
00120 /* This is used for the simulation only ! */
00121 typedef struct {
00122   int x,y;
00123   unsigned char KeyStat;
00124 } LCD_tMouseState;
00125 
00126 typedef struct {
00127   int               NumEntries;
00128   const LCD_COLOR * pPalEntries;
00129 } LCD_PHYSPALETTE;
00130 
00131 /*********************************************************************
00132 *
00133 *       LCD_L0_... color conversion
00134 */
00135 typedef LCD_COLOR      tLCDDEV_Index2Color  (LCD_PIXELINDEX Index);
00136 typedef LCD_PIXELINDEX tLCDDEV_Color2Index  (LCD_COLOR Color);
00137 typedef LCD_PIXELINDEX tLCDDEV_GetIndexMask (void);
00138 
00139 typedef void tLCDDEV_Index2ColorBulk(void * pIndex, LCD_COLOR * pColor, U32 NumItems, U8 SizeOfIndex);
00140 typedef void tLCDDEV_Color2IndexBulk(LCD_COLOR * pColor, void * pIndex, U32 NumItems, U8 SizeOfIndex);
00141 
00142 /*********************************************************************
00143 *
00144 *       Color conversion API tables
00145 */
00146 typedef struct {
00147   tLCDDEV_Color2Index  * pfColor2Index;
00148   tLCDDEV_Index2Color  * pfIndex2Color;
00149   tLCDDEV_GetIndexMask * pfGetIndexMask;
00150   int NoAlpha;
00151   tLCDDEV_Color2IndexBulk * pfColor2IndexBulk;
00152   tLCDDEV_Index2ColorBulk * pfIndex2ColorBulk;
00153 } LCD_API_COLOR_CONV;
00154 
00155 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_0;
00156 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_1;
00157 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_1_2;
00158 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_1_4;
00159 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_1_5;
00160 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_1_8;
00161 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_1_16;
00162 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_1_24;
00163 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_2;
00164 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_4;
00165 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_5;
00166 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_6;
00167 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_8;
00168 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_16;
00169 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_1616I;
00170 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_111;
00171 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_222;
00172 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_233;
00173 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_323;
00174 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_332;
00175 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_444_12;
00176 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_444_12_1;
00177 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_444_16;
00178 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_555;
00179 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_565;
00180 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_556;
00181 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_655;
00182 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_666;
00183 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_666_9;
00184 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_822216;
00185 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_84444;
00186 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_8666;
00187 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_8666_1;
00188 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_88666I;
00189 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_888;
00190 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_8888;
00191 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M111;
00192 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M1555I;
00193 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M222;
00194 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M233;
00195 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M323;
00196 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M332;
00197 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M4444I;
00198 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M444_12;
00199 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M444_12_1;
00200 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M444_16;
00201 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M555;
00202 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M565;
00203 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M556;
00204 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M655;
00205 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M666;
00206 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M666_9;
00207 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M8565;
00208 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M888;
00209 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M8888;
00210 extern const LCD_API_COLOR_CONV LCD_API_ColorConv_M8888I;
00211 
00212 #define GUICC_0         &LCD_API_ColorConv_0
00213 #define GUICC_1         &LCD_API_ColorConv_1
00214 #define GUICC_1_2       &LCD_API_ColorConv_1_2
00215 #define GUICC_1_4       &LCD_API_ColorConv_1_4
00216 #define GUICC_1_5       &LCD_API_ColorConv_1_5
00217 #define GUICC_1_8       &LCD_API_ColorConv_1_8
00218 #define GUICC_1_16      &LCD_API_ColorConv_1_16
00219 #define GUICC_1_24      &LCD_API_ColorConv_1_24
00220 #define GUICC_2         &LCD_API_ColorConv_2
00221 #define GUICC_4         &LCD_API_ColorConv_4
00222 #define GUICC_5         &LCD_API_ColorConv_5
00223 #define GUICC_6         &LCD_API_ColorConv_6
00224 #define GUICC_8         &LCD_API_ColorConv_8
00225 #define GUICC_16        &LCD_API_ColorConv_16
00226 #define GUICC_1616I     &LCD_API_ColorConv_1616I
00227 #define GUICC_111       &LCD_API_ColorConv_111
00228 #define GUICC_222       &LCD_API_ColorConv_222
00229 #define GUICC_233       &LCD_API_ColorConv_233
00230 #define GUICC_323       &LCD_API_ColorConv_323
00231 #define GUICC_332       &LCD_API_ColorConv_332
00232 #define GUICC_M4444I    &LCD_API_ColorConv_M4444I
00233 #define GUICC_444_12    &LCD_API_ColorConv_444_12
00234 #define GUICC_444_12_1  &LCD_API_ColorConv_444_12_1
00235 #define GUICC_444_16    &LCD_API_ColorConv_444_16
00236 #define GUICC_555       &LCD_API_ColorConv_555
00237 #define GUICC_565       &LCD_API_ColorConv_565
00238 #define GUICC_556       &LCD_API_ColorConv_556
00239 #define GUICC_655       &LCD_API_ColorConv_655
00240 #define GUICC_666       &LCD_API_ColorConv_666
00241 #define GUICC_666_9     &LCD_API_ColorConv_666_9
00242 #define GUICC_822216    &LCD_API_ColorConv_822216
00243 #define GUICC_84444     &LCD_API_ColorConv_84444
00244 #define GUICC_8666      &LCD_API_ColorConv_8666
00245 #define GUICC_8666_1    &LCD_API_ColorConv_8666_1
00246 #define GUICC_88666I    &LCD_API_ColorConv_88666I
00247 #define GUICC_888       &LCD_API_ColorConv_888
00248 #define GUICC_8888      &LCD_API_ColorConv_8888
00249 #define GUICC_M111      &LCD_API_ColorConv_M111
00250 #define GUICC_M1555I    &LCD_API_ColorConv_M1555I
00251 #define GUICC_M222      &LCD_API_ColorConv_M222
00252 #define GUICC_M233      &LCD_API_ColorConv_M233
00253 #define GUICC_M323      &LCD_API_ColorConv_M323
00254 #define GUICC_M332      &LCD_API_ColorConv_M332
00255 #define GUICC_M444_12   &LCD_API_ColorConv_M444_12
00256 #define GUICC_M444_12_1 &LCD_API_ColorConv_M444_12_1
00257 #define GUICC_M444_16   &LCD_API_ColorConv_M444_16
00258 #define GUICC_M555      &LCD_API_ColorConv_M555
00259 #define GUICC_M565      &LCD_API_ColorConv_M565
00260 #define GUICC_M556      &LCD_API_ColorConv_M556
00261 #define GUICC_M655      &LCD_API_ColorConv_M655
00262 #define GUICC_M666      &LCD_API_ColorConv_M666
00263 #define GUICC_M666_9    &LCD_API_ColorConv_M666_9
00264 #define GUICC_M8565     &LCD_API_ColorConv_M8565
00265 #define GUICC_M888      &LCD_API_ColorConv_M888
00266 #define GUICC_M8888     &LCD_API_ColorConv_M8888
00267 #define GUICC_M8888I    &LCD_API_ColorConv_M8888I
00268 
00269 void GUICC_M1555I_SetCustColorConv(tLCDDEV_Color2IndexBulk * pfColor2IndexBulk, tLCDDEV_Index2ColorBulk * pfIndex2ColorBulk);
00270 void GUICC_M565_SetCustColorConv  (tLCDDEV_Color2IndexBulk * pfColor2IndexBulk, tLCDDEV_Index2ColorBulk * pfIndex2ColorBulk);
00271 void GUICC_M4444I_SetCustColorConv(tLCDDEV_Color2IndexBulk * pfColor2IndexBulk, tLCDDEV_Index2ColorBulk * pfIndex2ColorBulk);
00272 void GUICC_M888_SetCustColorConv  (tLCDDEV_Color2IndexBulk * pfColor2IndexBulk, tLCDDEV_Index2ColorBulk * pfIndex2ColorBulk);
00273 void GUICC_M8888I_SetCustColorConv(tLCDDEV_Color2IndexBulk * pfColor2IndexBulk, tLCDDEV_Index2ColorBulk * pfIndex2ColorBulk);
00274 
00275 /*********************************************************************
00276 *
00277 *       Compatibility defines for older versions
00278 */
00279 #define GUI_COLOR_CONV_1    GUICC_1
00280 #define GUI_COLOR_CONV_2    GUICC_2
00281 #define GUI_COLOR_CONV_4    GUICC_4
00282 #define GUI_COLOR_CONV_8666 GUICC_8666
00283 #define GUI_COLOR_CONV_888  GUICC_888
00284 #define GUI_COLOR_CONV_8888 GUICC_8888
00285 #define GUI_COLOR_CONV_565  GUICC_565
00286 #define GUI_COLOR_CONV_M565 GUICC_M565
00287 
00288 /*********************************************************************
00289 *
00290 *       LCDDEV function table
00291 *
00292 *  Below the routines which need to in an LCDDEV routine table are
00293 *  defined. All of these routines have to be in the low-level driver
00294 *  (LCD_L0) or in the memory device which can be used to replace the
00295 *  driver.
00296 *  The one exception to this is the SetClipRect routine, which would
00297 *  be identical for all drivers and is therefor contained in the
00298 *  level above (LCD).
00299 */
00300 typedef void         tLCDDEV_DrawPixel    (int x, int y);
00301 typedef void         tLCDDEV_DrawHLine    (int x0, int y0,  int x1);
00302 typedef void         tLCDDEV_DrawVLine    (int x , int y0,  int y1);
00303 typedef void         tLCDDEV_FillRect     (int x0, int y0, int x1, int y1);
00304 typedef unsigned int tLCDDEV_GetPixelIndex(int x, int y);
00305 typedef void         tLCDDEV_SetPixelIndex(int x, int y, int ColorIndex);
00306 typedef void         tLCDDEV_XorPixel     (int x, int y);
00307 typedef void         tLCDDEV_FillPolygon  (const GUI_POINT * pPoints, int NumPoints, int x0, int y0);
00308 typedef void         tLCDDEV_FillPolygonAA(const GUI_POINT * pPoints, int NumPoints, int x0, int y0);
00309 typedef void         tLCDDEV_GetRect      (LCD_RECT * pRect);
00310 typedef int          tLCDDEV_Init         (void);
00311 typedef void         tLCDDEV_On           (void);
00312 typedef void         tLCDDEV_Off          (void);
00313 typedef void         tLCDDEV_SetLUTEntry  (U8 Pos, LCD_COLOR color);
00314 typedef void *       tLCDDEV_GetDevFunc   (int Index);
00315 typedef I32          tLCDDEV_GetDevProp   (int Index);
00316 typedef void         tLCDDEV_SetOrg       (int x, int y);
00317 
00318 /*********************************************************************
00319 *
00320 *       Memory device API tables
00321 */
00322 typedef struct GUI_DEVICE     GUI_DEVICE;
00323 typedef struct GUI_DEVICE_API GUI_DEVICE_API;
00324 
00325 typedef void tLCDDEV_DrawBitmap   (int x0, int y0, int xsize, int ysize,
00326                        int BitsPerPixel, int BytesPerLine,
00327                        const U8 * pData, int Diff,
00328                        const void * pTrans);   /* Really LCD_PIXELINDEX, but is void to avoid compiler warnings */
00329 #define GUI_MEMDEV_APILIST_1  &GUI_MEMDEV_DEVICE_1
00330 #define GUI_MEMDEV_APILIST_8  &GUI_MEMDEV_DEVICE_8
00331 #define GUI_MEMDEV_APILIST_16 &GUI_MEMDEV_DEVICE_16
00332 #define GUI_MEMDEV_APILIST_32 &GUI_MEMDEV_DEVICE_32
00333 
00334 /*********************************************************************
00335 *
00336 *       Defines for device capabilities
00337 *
00338 * The following is the list of device capabilities which can, but do
00339 * not have to be implemented in the driver. This way the driver can be
00340 * enhanced in the future without affecting the driver interface,
00341 * keeping older drivers compatible.
00342 * More DevCaps can always be added in the future, as older drivers
00343 * are guaranteed to return 0 for all unimplemented features or queries.
00344 *
00345 * The values below define the legal parameters to the LCD_GetDeviceCaps
00346 * and the LCD_GetpCapFunc routines.
00347 */
00348 
00349 #define LCD_DEVCAP_XSIZE             0x01    /* Quest horiz. res. of display */
00350 #define LCD_DEVCAP_YSIZE             0x02    /* Quest vert. res. of display */
00351 #define LCD_DEVCAP_VXSIZE            0x03    /* Quest vert. res. of virtual disp.*/
00352 #define LCD_DEVCAP_VYSIZE            0x04    /* Quest vert. res. of virtual disp.*/
00353 #define LCD_DEVCAP_XORG              0x05    /* X-origin ... usually 0 */
00354 #define LCD_DEVCAP_YORG              0x06    /* Y-origin ... usually 0 */
00355 #define LCD_DEVCAP_CONTROLLER        0x07    /* LCD Controller (Numerical) */
00356 #define LCD_DEVCAP_BITSPERPIXEL      0x08    /* Bits per pixel ... 1/2/4/8 */
00357 #define LCD_DEVCAP_NUMCOLORS         0x09    /* Quest number of colors */
00358 #define LCD_DEVCAP_XMAG              0x0A
00359 #define LCD_DEVCAP_YMAG              0x0B
00360 #define LCD_DEVCAP_MIRROR_X          0x0C
00361 #define LCD_DEVCAP_MIRROR_Y          0x0D
00362 #define LCD_DEVCAP_SWAP_XY           0x0E
00363 #define LCD_DEVCAP_SWAP_RB           0x0F
00364 
00365 int LCD_GetXSizeMax(void);
00366 int LCD_GetYSizeMax(void);
00367 int LCD_GetVXSizeMax(void);
00368 int LCD_GetVYSizeMax(void);
00369 int LCD_GetBitsPerPixelMax(void);
00370 void LCD_SetDisplaySize(int xSizeDisplay, int ySizeDisplay);
00371 int LCD_GetXSizeDisplay(void);
00372 int LCD_GetYSizeDisplay(void);
00373 
00374 int LCD_GetXSizeEx          (int LayerIndex);
00375 int LCD_GetYSizeEx          (int LayerIndex);
00376 int LCD_GetVXSizeEx         (int LayerIndex);
00377 int LCD_GetVYSizeEx         (int LayerIndex);
00378 int LCD_GetBitsPerPixelEx   (int LayerIndex);
00379 U32 LCD_GetNumColorsEx      (int LayerIndex);
00380 int LCD_GetXMagEx           (int LayerIndex);
00381 int LCD_GetYMagEx           (int LayerIndex);
00382 int LCD_GetMirrorXEx        (int LayerIndex);
00383 int LCD_GetMirrorYEx        (int LayerIndex);
00384 int LCD_GetSwapXYEx         (int LayerIndex);
00385 int LCD_GetReversLUTEx      (int LayerIndex);
00386 int LCD_GetPhysColorsInRAMEx(int LayerIndex);
00387 
00388 int LCD_GetXSize            (void);
00389 int LCD_GetYSize            (void);
00390 int LCD_GetVXSize           (void);
00391 int LCD_GetVYSize           (void);
00392 int LCD_GetBitsPerPixel     (void);
00393 U32 LCD_GetNumColors        (void);
00394 int LCD_GetXMag             (void);
00395 int LCD_GetYMag             (void);
00396 int LCD_GetMirrorX          (void);
00397 int LCD_GetMirrorY          (void);
00398 int LCD_GetSwapXY           (void);
00399 int LCD_GetReversLUT        (void);
00400 int LCD_GetPhysColorsInRAM  (void);
00401 
00402 I32 LCD__GetBPP      (U32 IndexMask);
00403 I32 LCD__GetBPPDevice(U32 IndexMask);
00404 
00405 tLCDDEV_Index2Color * LCD_GetpfIndex2ColorEx(int LayerIndex);
00406 tLCDDEV_Color2Index * LCD_GetpfColor2IndexEx(int LayerIndex);
00407 
00408 tLCDDEV_Color2Index * LCD_GetpfColor2Index(void);
00409 
00410 int LCD_GetNumLayers(void);
00411 
00412 LCD_COLOR * LCD_GetPalette  (void);
00413 LCD_COLOR * LCD_GetPaletteEx(int LayerIndex);
00414 
00415 void (* LCD_GetDevFunc(int LayerIndex, int Item))(void);
00416 
00417 /*********************************************************************
00418 *
00419 *       Values for requesting and setting function pointers (display driver)
00420 */
00421                                        /* Request of a function pointer for... */
00422 #define LCD_DEVFUNC_READRECT      0x01 /* ...reading a rectangular display area */
00423 #define LCD_DEVFUNC_SETALPHA      0x02 /* ...setting the alpha blending factor */
00424 #define LCD_DEVFUNC_SETPOS        0x03 /* ...setting the layer position */
00425 #define LCD_DEVFUNC_GETPOS        0x04 /* ...getting the layer position */
00426 #define LCD_DEVFUNC_SETSIZE       0x05 /* ...setting the layer size */
00427 #define LCD_DEVFUNC_SETVIS        0x06 /* ...setting the visibility of a layer */
00428 #define LCD_DEVFUNC_24BPP         0x07 /* ...drawing 24bpp bitmaps */
00429 #define LCD_DEVFUNC_NEXT_PIXEL    0x08 /* ...drawing a bitmap pixel by pixel */
00430 #define LCD_DEVFUNC_SET_VRAM_ADDR 0x09 /* ...setting the VRAM address */
00431 #define LCD_DEVFUNC_SET_VSIZE     0x0A /* ...setting the VRAM size */
00432 #define LCD_DEVFUNC_SET_SIZE      0x0B /* ...setting the display size */
00433 #define LCD_DEVFUNC_INIT          0x0C /* ...initializing the display controller */
00434 #define LCD_DEVFUNC_CONTROLCACHE  0x0D /* ...controlling the cache */
00435 #define LCD_DEVFUNC_ON            0x0E /* ...switching the display on */
00436 #define LCD_DEVFUNC_OFF           0x0F /* ...switching the display off */
00437 #define LCD_DEVFUNC_SETLUTENTRY   0x10 /* ...setting a LUT entry */
00438 #define LCD_DEVFUNC_FILLPOLY      0x11 /* ...filling a polygon */
00439 #define LCD_DEVFUNC_FILLPOLYAA    0x12 /* ...filling an antialiased polygon */
00440 #define LCD_DEVFUNC_ALPHAMODE     0x13 /* ...setting the alpha blending mode */
00441 #define LCD_DEVFUNC_CHROMAMODE    0x14 /* ...setting the chroma blending mode */
00442 #define LCD_DEVFUNC_CHROMA        0x15 /* ...setting the chroma values */
00443 #define LCD_DEVFUNC_SETFUNC       0x16 /* ...setting a function pointer */
00444 #define LCD_DEVFUNC_REFRESH       0x17 /* ...refreshing the display */
00445 #define LCD_DEVFUNC_SETRECT       0x18 /* ...setting the drawing rectangle */
00446                                        /* Setting a function pointer for... */
00447 #define LCD_DEVFUNC_FILLRECT      0x19 /* ...filling a rectangular area */
00448 #define LCD_DEVFUNC_DRAWBMP_1BPP  0x20 /* ...drawing a 1bpp bitmap */
00449 #define LCD_DEVFUNC_COPYBUFFER    0x21 /* ...copying complete frame buffers */
00450 #define LCD_DEVFUNC_SHOWBUFFER    0x22 /* ...shows the given buffer */
00451 #define LCD_DEVFUNC_COPYRECT      0x23 /* ...filling a rectangular area */
00452 #define LCD_DEVFUNC_DRAWBMP_16BPP 0x24 /* ...drawing a 16bpp bitmap */
00453 #define LCD_DEVFUNC_DRAWBMP_8BPP  0x25 /* ...drawing a 8bpp bitmap */
00454 #define LCD_DEVFUNC_READPIXEL     0x26 /* ...reading a pixel index */
00455 #define LCD_DEVFUNC_READMPIXELS   0x27 /* ...reading multiple pixel indices */
00456 #define LCD_DEVFUNC_DRAWBMP_32BPP 0x28 /* ...drawing a 32bpp bitmap */
00457 
00458 /*********************************************************************
00459 *
00460 *       Values for requesting function pointers (memory devices)
00461 */
00462                                           /* Request of a function pointer for... */
00463 #define MEMDEV_DEVFUNC_WRITETOACTIVE 0x16 /* ...writing the memory device */
00464 
00465 /*********************************************************************
00466 *
00467 *       Values for requesting data
00468 */
00469                                        /* Request pointer to... */
00470 #define LCD_DEVDATA_MEMDEV        0x01 /* ...default memory device API */
00471 #define LCD_DEVDATA_PHYSPAL       0x02 /* ...physical palette */
00472 
00473 /*********************************************************************
00474 *
00475 *       Structures for passing data to LCD_X_DisplayDriver()
00476 */
00477 typedef struct {
00478   void * pVRAM;
00479 } LCD_X_SETVRAMADDR_INFO;
00480 
00481 typedef struct {
00482   int xPos, yPos;
00483 } LCD_X_SETORG_INFO;
00484 
00485 typedef struct {
00486   LCD_COLOR Color;
00487   U8 Pos;
00488 } LCD_X_SETLUTENTRY_INFO;
00489 
00490 typedef struct {
00491   int xSize, ySize;
00492 } LCD_X_SETSIZE_INFO;
00493 
00494 typedef struct {
00495   int xPos, yPos;
00496   int xLen, yLen;
00497   int BytesPerPixel;
00498   U32 Off;
00499 } LCD_X_SETPOS_INFO;
00500 
00501 typedef struct {
00502   int Alpha;
00503 } LCD_X_SETALPHA_INFO;
00504 
00505 typedef struct {
00506   int OnOff;
00507 } LCD_X_SETVIS_INFO;
00508 
00509 typedef struct {
00510   int AlphaMode;
00511 } LCD_X_SETALPHAMODE_INFO;
00512 
00513 typedef struct {
00514   int ChromaMode;
00515 } LCD_X_SETCHROMAMODE_INFO;
00516 
00517 typedef struct {
00518   LCD_COLOR ChromaMin;
00519   LCD_COLOR ChromaMax;
00520 } LCD_X_SETCHROMA_INFO;
00521 
00522 typedef struct {
00523   int Index;
00524 } LCD_X_SHOWBUFFER_INFO;
00525 
00526 /*********************************************************************
00527 *
00528 *       Commands for LCD_X_DisplayDriver()
00529 */
00530 #define LCD_X_INITCONTROLLER 0x01 /* Initializing the display controller */
00531 #define LCD_X_SETVRAMADDR    0x02 /* Setting the video RAM address */
00532 #define LCD_X_SETORG         0x03 /* Setting the origin within a layer */
00533 #define LCD_X_SETLUTENTRY    0x04 /* Setting an entry of the LUT */
00534 #define LCD_X_ON             0x05 /* Switching the display on */
00535 #define LCD_X_OFF            0x06 /* Switching the display off */
00536 #define LCD_X_SETSIZE        0x07 /* Setting the layer size */
00537 #define LCD_X_SETPOS         0x08 /* Setting the layer position */
00538 #define LCD_X_SETVIS         0x09 /* Setting the visibility of a layer */
00539 #define LCD_X_SETALPHA       0x0A /* Setting the alpha value of the layer */
00540 #define LCD_X_SETALPHAMODE   0x0B /* Setting the alpha blending mode */
00541 #define LCD_X_SETCHROMAMODE  0x0C /* Setting the chroma blending mode */
00542 #define LCD_X_SETCHROMA      0x0D /* Setting the chroma values */
00543 #define LCD_X_SHOWBUFFER     0x0E /* Switching to the given buffer */
00544 
00545 int  LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * pData);
00546 void LCD_X_Config(void);
00547 
00548 /*********************************************************************
00549 *
00550 *       Set layer properties
00551 */
00552 int LCD_SetAlphaEx     (int LayerIndex, int Alpha);
00553 int LCD_SetPosEx       (int LayerIndex, int xPos, int yPos);
00554 int LCD_SetSizeEx      (int LayerIndex, int xSize, int ySize);
00555 int LCD_SetVisEx       (int LayerIndex, int OnOff);
00556 int LCD_SetVRAMAddrEx  (int LayerIndex, void * pVRAM);
00557 int LCD_SetVSizeEx     (int LayerIndex, int xSize, int ySize);
00558 int LCD_SetAlphaModeEx (int LayerIndex, int AlphaMode);
00559 int LCD_SetChromaModeEx(int LayerIndex, int ChromaMode);
00560 int LCD_SetChromaEx    (int LayerIndex, LCD_COLOR ChromaMin, LCD_COLOR ChromaMax);
00561 
00562 int LCD_SetAlpha     (int Alpha);
00563 int LCD_SetVRAMAddr  (void * pVRAM);
00564 int LCD_SetVSize     (int xSize, int ySize);
00565 int LCD_SetSize      (int xSize, int ySize);
00566 int LCD_SetVis       (int OnOff);
00567 int LCD_SetPos       (int xPos, int yPos);
00568 int LCD_SetAlphaMode (int AlphaMode);
00569 int LCD_SetChromaMode(int ChromaMode);
00570 int LCD_SetChroma    (LCD_COLOR ChromaMin, LCD_COLOR ChromaMax);
00571 int LCD_SetLUTEntry  (U8 Pos, LCD_COLOR Color);
00572 int LCD_SetDevFunc   (int LayerIndex, int IdFunc, void (* pDriverFunc)(void));
00573 
00574 void LCD_SetOrg(int xOrg, int yOrg);
00575 
00576 /*********************************************************************
00577 *
00578 *       Get layer properties
00579 */
00580 int LCD_GetPosEx(int LayerIndex, int * pxPos, int * pyPos);
00581 
00582 int LCD_GetPos  (int * pxPos, int * pyPos);
00583 
00584 /*********************************************************************
00585 *
00586 *       Display refresh (optional)
00587 */
00588 int LCD_Refresh  (void);
00589 int LCD_RefreshEx(int LayerIndex);
00590 
00591 /*********************************************************************
00592 *
00593 *       NEXT_PIXEL API support
00594 */
00595 typedef struct {
00596   int  (* pfStart)   (int x0, int y0, int x1, int y1);
00597   void (* pfSetPixel)(LCD_PIXELINDEX PixelIndex);
00598   void (* pfNextLine)(void);
00599   void (* pfEnd)     (void);
00600 } LCD_API_NEXT_PIXEL;
00601 
00602 LCD_API_NEXT_PIXEL * LCD_GetNextPixelAPI(void);
00603 
00604 /*********************************************************************
00605 *
00606 *      LCD_CLIP function table
00607 */
00608 typedef void tLCD_HL_DrawHLine    (int x0, int y0,  int x1);
00609 typedef void tLCD_HL_DrawPixel    (int x0, int y0);
00610 
00611 typedef struct {
00612   tLCD_HL_DrawHLine * pfDrawHLine;
00613   tLCD_HL_DrawPixel * pfDrawPixel;
00614 } tLCD_HL_APIList;
00615 
00616 void LCD_DrawHLine(int x0, int y0,  int x1);
00617 void LCD_DrawPixel(int x0, int y0);
00618 void LCD_DrawVLine(int x,  int y0,  int y1);
00619 
00620 
00621 /*********************************************************************
00622 *
00623 *       Declarations for LCD_
00624 */
00625 void LCD_SetClipRectEx(const LCD_RECT * pRect);
00626 void LCD_SetClipRectMax(void);
00627 
00628 /* Get device capabilities (0 if not supported) */
00629 I32  LCD_GetDevCap  (int Index);
00630 I32  LCD_GetDevCapEx(int LayerIndex, int Index);
00631 
00632 /* Initialize LCD using config-parameters */
00633 int LCD_Init(void);
00634 int LCD_InitColors(void);
00635 
00636 void LCD_SetBkColor   (LCD_COLOR Color); /* Set background color */
00637 void LCD_SetColor     (LCD_COLOR Color); /* Set foreground color */
00638 void LCD_SetPixelIndex(int x, int y, int ColorIndex);
00639 
00640 /* Palette routines (Not available on all drivers) */
00641 void LCD_InitLUT(void);
00642 int  LCD_SetLUTEntryEx(int LayerIndex, U8 Pos, LCD_COLOR Color);
00643 void LCD_SetLUTEx(int LayerIndex, const LCD_PHYSPALETTE * pPalette);
00644 void LCD_SetLUT  (const LCD_PHYSPALETTE * pPalette);
00645 
00646 LCD_DRAWMODE LCD_SetDrawMode  (LCD_DRAWMODE dm);
00647 void LCD_SetColorIndex(unsigned PixelIndex);
00648 void LCD_SetBkColorIndex(unsigned PixelIndex);
00649 void LCD_FillRect(int x0, int y0, int x1, int y1);
00650 typedef void tLCD_SetPixelAA(int x, int y, U8 Intens);
00651 
00652 void LCD_SetPixelAA4_Trans  (int x, int y, U8 Intens);
00653 void LCD_SetPixelAA4_NoTrans(int x, int y, U8 Intens);
00654 
00655 void LCD_SetPixelAA8_Trans  (int x, int y, U8 Intens);
00656 void LCD_SetPixelAA8_NoTrans(int x, int y, U8 Intens);
00657 
00658 void LCD_AA_EnableGamma(int OnOff);
00659 void LCD_AA_SetGamma   (U8 * pGamma);
00660 void LCD_AA_GetGamma   (U8 * pGamma);
00661 
00662 LCD_COLOR    LCD_AA_MixColors16 (LCD_COLOR Color, LCD_COLOR BkColor, U8 Intens);
00663 LCD_COLOR    LCD_AA_MixColors256(LCD_COLOR Color, LCD_COLOR BkColor, U8 Intens);
00664 LCD_COLOR    LCD_MixColors256   (LCD_COLOR Color, LCD_COLOR BkColor, unsigned Intens);
00665 LCD_COLOR    LCD_GetPixelColor(int x, int y);     /* Get RGB color of pixel */
00666 unsigned int LCD_GetPixelIndex(int x, int y);
00667 int          LCD_GetBkColorIndex (void);
00668 int          LCD_GetColorIndex (void);
00669 #if (GUI_USE_ARGB)
00670 U32          LCD_AA_SetOrMask(U32 OrMask);
00671 #else
00672 U32          LCD_AA_SetAndMask(U32 AndMask);
00673 #endif
00674 
00675 /* Configuration */
00676 int  LCD_SetMaxNumColors(unsigned MaxNumColors);
00677 int  LCD_GetMaxNumColors(void);
00678 void LCD__SetPaletteConversionHook(void (* pfPaletteConversionHook)(const LCD_LOGPALETTE * pLogPal));
00679 
00680 /*********************************************************************
00681 *
00682 *       Optional support for rotation
00683 */
00684 #if GUI_SUPPORT_ROTATION
00685 
00686 typedef void tLCD_DrawBitmap(int x0, int y0, int xsize, int ysize,
00687                              int xMul, int yMul, int BitsPerPixel, int BytesPerLine,
00688                              const U8 * pPixel, const void * pTrans);
00689 typedef void tRect2TextRect (LCD_RECT * pRect);
00690 
00691 struct tLCD_APIList_struct {
00692   tLCD_DrawBitmap   * pfDrawBitmap;
00693   tRect2TextRect    * pfRect2TextRect;
00694   tRect2TextRect    * pfTransformRect;
00695 };
00696 
00697 typedef struct tLCD_APIList_struct tLCD_APIList;
00698 
00699 extern tLCD_APIList LCD_APIListCCW;
00700 extern tLCD_APIList LCD_APIListCW;
00701 extern tLCD_APIList LCD_APIList180;
00702 
00703 #define GUI_ROTATION   tLCD_APIList
00704 #define GUI_ROTATE_CCW &LCD_APIListCCW
00705 #define GUI_ROTATE_CW  &LCD_APIListCW
00706 #define GUI_ROTATE_180 &LCD_APIList180
00707 #define GUI_ROTATE_0   0
00708 
00709 tLCD_SetPixelAA * LCD__GetPfSetPixel(int BitsPerPixel);
00710 
00711 #endif
00712 
00713 /*********************************************************************
00714 *
00715 *       Physical color access, internally used only
00716 */
00717 void LCD__SetPhysColor(U8 Pos, LCD_COLOR Color);
00718 
00719 /*********************************************************************
00720 *
00721 *       Cache control
00722 */
00723 #define LCD_CC_UNLOCK (0)    /* Default mode: Cache is transparent */
00724 #define LCD_CC_LOCK   (1)    /* Cache is locked, no write operations */
00725 #define LCD_CC_FLUSH  (2)    /* Flush cache, do not change mode */
00726 
00727 int LCD_ControlCache  (int Cmd);
00728 int LCD_ControlCacheEx(int LayerIndex, int Cmd);
00729 
00730 /*********************************************************************
00731 *
00732 *       Color conversion
00733 */
00734 LCD_PIXELINDEX   LCD_Color2Index     (LCD_COLOR Color);
00735 LCD_COLOR        LCD_Index2Color     (int Index);
00736 LCD_COLOR        LCD_Index2ColorEx   (int i, unsigned LayerIndex);
00737 
00738 /*********************************************************************
00739 *
00740 *       LCD_X_...
00741 */
00742 unsigned char LCD_X_Read00(void);
00743 unsigned char LCD_X_Read01(void);
00744 void LCD_X_Write00 (unsigned char c);
00745 void LCD_X_Write01 (unsigned char c);
00746 void LCD_X_WriteM01(unsigned char * pData, int NumBytes);
00747 
00748 #if defined(__cplusplus)
00749   }
00750 #endif
00751 
00752 #endif /* LCD_H */
00753 
00754 /*************************** End of file ****************************/