/** @file * Header file for internal routines. * * @author anlzhao * @author mandy.wu 2010/06/02 * @version 0.1 */ #ifndef _WINDEV_H #define _WINDEV_H #include "gui_eng/stddefs.h" #include "gui_eng/device_gdi.h" /* Background Modes */ #define TRANSPARENT (1) #define OPAQUE (2) #define DEFAULT_PEN_WIDTH (1) /* Flags for status of control. */ typedef enum { PAINT_PAINTED = 0x00000001, /* WM_PAINT msg has been processed*/ PAINT_NEEDSPAINT = 0x00000002, /* WM_PAINT seen, paint when can*/ PAINT_NOT_REQUIRED = 0x00000004, /* WM_PAINT not required */ } GENG_ControlStatus_e; //paint_opt_t; extern RegionProcs_t region_procs; extern UINT32 g_dVirtualWinWidth; extern UINT32 g_dVirtualWinHeight; /** * Get OSD plane size. * * @param pwWinWidth OSD plane width. * @param pwWinWidth OSD plane height. * @return GDL_SUCCESS if succeed, error codes of GDL_FAILURE otherwise. */ INT32 GDL_GetOsdPlaneSize(UINT16 *pwPlaneWidth, UINT16 *pwPlaneHeight); /** * Initialize GUI engine and OSD. * * @param dWinWidth Window width. * @param dWinHeight Window height. * @return GDL_SUCCESS if succeed, error codes of GDL_FAILURE otherwise. */ INT32 GDL_Open(UINT32 dWinWidth, UINT32 dWinHeight); /** * Uninitialize OSD. * * @return GDL_SUCCESS if succeed, error codes of GDL_FAILURE otherwise. */ INT32 GDL_Close(void); /** * Open a screen. * * @param dWinWidth Window width. * @param dWinHeight Window height. * @return SUCCESS if succeed, FAILURE otherwise. */ INT32 DEV_OpenScreen(UINT32 dWinWidth, UINT32 dWinHeight, BOOL bBmpCmpsd); /** * Close a screen. */ INT32 DEV_CloseScreen(void); /** * Resize UI from the original size to the target size. * * @param wWidth The original width of UI. * @param wHeight The original height of UI. * @param wTargetWidth The desired width of UI to be scaled. * @param wTargetHeight The desired height of UI to be scaled. * @return SUCCESS if succeed, FAILURE otherwise. */ INT32 DEV_ResizeUI(OSD_Layer_t osd_layer, UINT16 wWidth, UINT16 wHeight, UINT16 wTargetWidth, UINT16 wTargetHeight); /** * Get a new valid region handle for region creation. * * @param pRegionHandle Return a valid region handle. * @return SUCCESS if succeed, FAILURE otherwise. */ INT32 DEV_NewRegionHandle(RegionHandle_t *pRegionHandle); /** * Create the region. * * @param pRegionInfo Pointer of region_info which is generated by tool. * @param dRegionIndex region index. * @param pRegionHandle Return the region handle of the specific region. * @return SUCCESS if succeed, FAILURE otherwise. */ INT32 DEV_CreateRegion(RegionInfo_t *pRegionInfo, UINT32 dRegionIndex, RegionHandle_t *pRegionHandle); /** * Destroys the region. * * @param stRegionHandle Region handle. * @return SUCCESS or FAILURE. */ INT32 DEV_DestroyRegion(RegionHandle_t stRegionHandle); /** * Set the region transparency. * * @param stRegionHandle Handle to the region. * @param bTransValue The transparency value to be set to the region. * @param bRegionBlendEnable Wether to enable the OSD region blend mode. * @return SUCCESS or FAILURE. */ INT32 DEV_SetTransLevel(RegionHandle_t stRegionHandle, UINT8 bTransValue, BOOLEAN bRegionBlendEnable); /** * Set region palette. * * @param stRegionHandle Handle to the region. * @param bFirst First palette entry to set. * @param wCount Number of palette entries to set. * @param pPal New palette etnries (array of size @param count). * @return SUCCESS or FAILURE. */ INT32 DEV_SetPal(RegionHandle_t stRegionHandle, UINT8 bFirst, UINT16 wCount, const PALENTRY *pPal); /** * Move the region to the given x and y position. * * @param stRegionHandle Handle to the region. * @param swXPos New x position of the region. * @param swYPos New y position of the region. * @return SUCCESS or FAILURE. */ INT32 DEV_MoveRegion(RegionHandle_t stRegionHandle, INT16 swXPos, INT16 swYPos); /** * Returns the region handle index form the given region_info array with the specific region_index. * * @param pRegionInfo Virtual region id. * @param sdRegionIndex Region index. * @return INVALID_REGION_HANDLE on failure. Valid region handle on success. */ RegionHandle_t DEV_GetRegionHandle(RegionInfo_t *pRegionInfo, INT32 sdRegionIndex); /** * Get the coordinates of the region * * @param stRegionHandle Handle to the region. * @param pRect Pointer to rectangle which return the coordinates. * @return SUCCESS or FAILURE. */ INT32 DEV_GetRegionCoords(RegionHandle_t stRegionHandle, RECT *pRect); /** * Set activated regions. * * @param wRegionsNeeded Regions required. * @return SUCCESS or FAILURE. */ INT32 DEV_SetRegions(UINT16 wRegionsNeeded); /** * Gets the current active regions * * @param pActiveRegions The actived regions returned. * @return SUCCESS or FAILURE. */ INT32 DEV_GetActiveRegions(UINT32 *pActiveRegions); /** * Gets the bitmap data. * * @param stRegionHandle Region handle. * @param swIconId Icon identifier. * @param pImgData Pointer to the image data. * @return SUCCESS or FAILURE. */ INT32 DEV_GetBmpData (RegionHandle_t stRegionHandle, INT16 swIconId, IMAGEHDR *pImgData); /** * SetOSDLayer. * * @param dRegionHandle Region handle. * @param layer OSD Layer . * @return SUCCESS or FAILURE. */ INT32 DEV_SetOSDLayer(UINT32 dRegionHandle, OSD_Layer_t layer); INT32 DEV_GetOSDLayer(UINT32 dRegionHandle); /* devlist.c*/ void LIST_add(PLISTHEAD pHead, PLIST pItem); void LIST_Insert( PLISTHEAD pHead, PLIST pItem); void LIST_remove(PLISTHEAD pHead, PLIST pItem); #define ITEM_OFFSET(type, field) ((long)&(((type *)0)->field)) #define LIST_item_alloc(size) malloc((size)) #define LIST_item_new(type) ((type *)LIST_item_alloc(sizeof(type))) #define LIST_item_free(ptr) free((void *)ptr) /* return base item address from list ptr*/ #define GdItemAddr(p, type, list) ((type*)((long)p-ITEM_OFFSET(type,list))) #endif