/** @file * Header file for graphics device interfaces. * * @author anlzhao * @author mandy.wu 2009/08/21 (Draw objs to a tempbuf and then blit once to OSD) * @version 0.1 */ #ifndef _DEVICE_H #define _DEVICE_H #include "gui_eng/stddefs.h" #include "gui_eng/region.h" #define INVALID_REGION_HANDLE (-1) #define PAL_ENTRY_NUM (256) #define PAL_ENTRY_NUM_4BPP (16) #define DIV_BYTE_SHIFT (3) //#define BITS_PER_BYTE (8) #define BMP_ALIGN_BYTE_NUM (4) /** Input key types used by WM_KEYDOWN message on Editbox control. */ typedef enum { KEY_0 = 0, /**< */ KEY_1, /**< */ KEY_2, /**< */ KEY_3, /**< */ KEY_4, /**< */ KEY_5, /**< */ KEY_6, /**< */ KEY_7, /**< */ KEY_8, /**< */ KEY_9, /**< */ KEY_LEFT, /**< */ KEY_RIGHT, /**< */ KEY_UP, /**< */ KEY_DOWN, /**< */ } input_key_t; /* ** Double linked list data structure ** LIST must be first declared in struct */ typedef struct _list { struct _list *next; struct _list *prev; } LIST, *PLIST; /* Double linked list head data structure */ typedef struct _listhead { struct _list *head; struct _list *tail; } LISTHEAD, *PLISTHEAD; /* GDL layer drawing flags */ #define GDL_SRC_ALIGNED (0x1) /**< Indicates that pstImgData is 4-byte aligned or not. */ #define GDL_IGNORE_TRANS_COLOR (0x2) /**< If set, the transparent color won't be drawn. */ #define GDL_180_ROTATE (0x4) /**< 180 degree rotation. */ /* Graphics rendering operation funcs */ typedef struct { INT32 (*draw_pixel) (RegionHandle_t sdRegionHandle, INT16 swX, INT16 swY, UINT32 dValue, INT32 *pBlockId); INT32 (*draw_line) (RegionHandle_t sdRegionHandle, INT16 swX1, INT16 swY1, INT16 swX2, INT16 swY2, UINT16 wThickness, Color_t stColor, INT32 *pBlockId); INT32 (*draw_rect) (RegionHandle_t sdRegionHandle, RECT stRect, UINT16 wThickness, Color_t stColor, INT32 *pBlockId); INT32 (*draw_hole_rect) (RegionHandle_t sdRegionHandle, RECT stRect, UINT16 wThickness, INT32 *pBlockId, INT32 isEvenAlign); INT32 (*fill_rect) (RegionHandle_t sdRegionHandle, RECT stRect, Color_t stColor, BOOLEAN bIgnoreTransColor, INT32 *pBlockId); INT32 (*fill_bmp) (RegionHandle_t sdRegionHandle, RECT stSrcRect, RECT stDstRect, const PIMAGEHDR pstImgData, PALENTRY *pDynSrcPal, UINT8 bDrawFlag, INT32 *pBlockId); INT32 (*blit_bmp) (RegionHandle_t sdRegionHandle, RECT stSrcRect, RECT stDstRect, const PIMAGEHDR pstImgData, PALENTRY *pDynSrcPal, UINT8 bDrawFlag, INT32 *pBlockId); INT32 (*blit_rot_bmp) (RegionHandle_t sdRegionHandle, RECT stSrcRect, RECT stDstRect, const PIMAGEHDR pstImgData, PALENTRY *pDynSrcPal, UINT32 dAngle, INT32 *pBlockId); INT32 (*sblit_bmp) (RegionHandle_t sdRegionHandle, RECT stSrcRect, RECT stDstRect, const PIMAGEHDR pstImgData, PALENTRY *pDynSrcPal, INT32 *pBlockId); INT32 (*blit_text_bmp)(RegionHandle_t sdRegionHandle, RECT stRect, PIMAGEHDR pstTextData, INT32 *pBlockId); INT32 (*blend_bmp) (RegionHandle_t sdRegionHandle, RECT stDstRect, const PIMAGEHDR pstImgData, PALENTRY *pDynSrcPal, UINT8 bAlphaValue, INT32 *pBlockId); INT32 (*set_dispaly) (BOOL ShowOSD); } DRAWDRIVER, *PDRAWDRIVER; typedef struct _region_params { BOOLEAN bFullAALock; /* TRUE if the palette of this region is modified by 256-level AA rendering. */ // Resources RegionInfo_t *region_info; /* Pointer to a specific region_info */ UINT32 region_index; /* The region index of the region_info array */ RECT rect; PALENTRY *pPal; /* Pointer to the current referenced region pal */ void *pClutTable; /* prepare for OSD Library */ PixelFormat_e format; UINT8 bpp; /* bits per pixel */ UINT8 transparency; /* 0~MAX_REGION_TRANSPARENCY 0: OPaque */ UINT8 enable_trans; OSD_Layer_t layer; PDRAWDRIVER drawdriver; /* Indicate function ptrs to drawing driver */ } RegionParams_t; /* OSD region operation funcs */ typedef struct _region_procs { INT32 (*pOpenRegion)(RegionHandle_t stRegionHandle); INT32 (*pCloseRegion)(RegionHandle_t stRegionHandle); INT32 (*pSetTransLevel) (RegionHandle_t stRegionHandle, UINT8 bTransValue, BOOLEAN bRegionBlendEnable); INT32 (*pSetPal)(RegionHandle_t stRegionHandle, const PALENTRY *pPal); INT32(*pResizeUI) (OSD_Layer_t osd_layer, UINT16 wWidth, UINT16 wHeight, UINT16 wTargetWidth, UINT16 wTargetHeight); } RegionProcs_t; #endif /* _DEVICE_H */