windev.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /** @file
  2. * Header file for internal routines.
  3. *
  4. * @author anlzhao
  5. * @author mandy.wu 2010/06/02
  6. * @version 0.1
  7. */
  8. #ifndef _WINDEV_H
  9. #define _WINDEV_H
  10. #include "gui_eng/stddefs.h"
  11. #include "gui_eng/device_gdi.h"
  12. /* Background Modes */
  13. #define TRANSPARENT (1)
  14. #define OPAQUE (2)
  15. #define DEFAULT_PEN_WIDTH (1)
  16. /* Flags for status of control. */
  17. typedef enum {
  18. PAINT_PAINTED = 0x00000001, /* WM_PAINT msg has been processed*/
  19. PAINT_NEEDSPAINT = 0x00000002, /* WM_PAINT seen, paint when can*/
  20. PAINT_NOT_REQUIRED = 0x00000004, /* WM_PAINT not required */
  21. } GENG_ControlStatus_e; //paint_opt_t;
  22. extern RegionProcs_t region_procs;
  23. extern UINT32 g_dVirtualWinWidth;
  24. extern UINT32 g_dVirtualWinHeight;
  25. /**
  26. * Get OSD plane size.
  27. *
  28. * @param pwWinWidth OSD plane width.
  29. * @param pwWinWidth OSD plane height.
  30. * @return GDL_SUCCESS if succeed, error codes of GDL_FAILURE otherwise.
  31. */
  32. INT32 GDL_GetOsdPlaneSize(UINT16 *pwPlaneWidth, UINT16 *pwPlaneHeight);
  33. /**
  34. * Initialize GUI engine and OSD.
  35. *
  36. * @param dWinWidth Window width.
  37. * @param dWinHeight Window height.
  38. * @return GDL_SUCCESS if succeed, error codes of GDL_FAILURE otherwise.
  39. */
  40. INT32 GDL_Open(UINT32 dWinWidth, UINT32 dWinHeight);
  41. /**
  42. * Uninitialize OSD.
  43. *
  44. * @return GDL_SUCCESS if succeed, error codes of GDL_FAILURE otherwise.
  45. */
  46. INT32 GDL_Close(void);
  47. /**
  48. * Open a screen.
  49. *
  50. * @param dWinWidth Window width.
  51. * @param dWinHeight Window height.
  52. * @return SUCCESS if succeed, FAILURE otherwise.
  53. */
  54. INT32 DEV_OpenScreen(UINT32 dWinWidth, UINT32 dWinHeight, BOOL bBmpCmpsd);
  55. /**
  56. * Close a screen.
  57. */
  58. INT32 DEV_CloseScreen(void);
  59. /**
  60. * Resize UI from the original size to the target size.
  61. *
  62. * @param wWidth The original width of UI.
  63. * @param wHeight The original height of UI.
  64. * @param wTargetWidth The desired width of UI to be scaled.
  65. * @param wTargetHeight The desired height of UI to be scaled.
  66. * @return SUCCESS if succeed, FAILURE otherwise.
  67. */
  68. INT32 DEV_ResizeUI(OSD_Layer_t osd_layer, UINT16 wWidth, UINT16 wHeight, UINT16 wTargetWidth, UINT16 wTargetHeight);
  69. /**
  70. * Get a new valid region handle for region creation.
  71. *
  72. * @param pRegionHandle Return a valid region handle.
  73. * @return SUCCESS if succeed, FAILURE otherwise.
  74. */
  75. INT32 DEV_NewRegionHandle(RegionHandle_t *pRegionHandle);
  76. /**
  77. * Create the region.
  78. *
  79. * @param pRegionInfo Pointer of region_info which is generated by tool.
  80. * @param dRegionIndex region index.
  81. * @param pRegionHandle Return the region handle of the specific region.
  82. * @return SUCCESS if succeed, FAILURE otherwise.
  83. */
  84. INT32 DEV_CreateRegion(RegionInfo_t *pRegionInfo, UINT32 dRegionIndex, RegionHandle_t *pRegionHandle);
  85. /**
  86. * Destroys the region.
  87. *
  88. * @param stRegionHandle Region handle.
  89. * @return SUCCESS or FAILURE.
  90. */
  91. INT32 DEV_DestroyRegion(RegionHandle_t stRegionHandle);
  92. /**
  93. * Set the region transparency.
  94. *
  95. * @param stRegionHandle Handle to the region.
  96. * @param bTransValue The transparency value to be set to the region.
  97. * @param bRegionBlendEnable Wether to enable the OSD region blend mode.
  98. * @return SUCCESS or FAILURE.
  99. */
  100. INT32 DEV_SetTransLevel(RegionHandle_t stRegionHandle, UINT8 bTransValue, BOOLEAN bRegionBlendEnable);
  101. /**
  102. * Set region palette.
  103. *
  104. * @param stRegionHandle Handle to the region.
  105. * @param bFirst First palette entry to set.
  106. * @param wCount Number of palette entries to set.
  107. * @param pPal New palette etnries (array of size @param count).
  108. * @return SUCCESS or FAILURE.
  109. */
  110. INT32 DEV_SetPal(RegionHandle_t stRegionHandle, UINT8 bFirst, UINT16 wCount, const PALENTRY *pPal);
  111. /**
  112. * Move the region to the given x and y position.
  113. *
  114. * @param stRegionHandle Handle to the region.
  115. * @param swXPos New x position of the region.
  116. * @param swYPos New y position of the region.
  117. * @return SUCCESS or FAILURE.
  118. */
  119. INT32 DEV_MoveRegion(RegionHandle_t stRegionHandle, INT16 swXPos, INT16 swYPos);
  120. /**
  121. * Returns the region handle index form the given region_info array with the specific region_index.
  122. *
  123. * @param pRegionInfo Virtual region id.
  124. * @param sdRegionIndex Region index.
  125. * @return INVALID_REGION_HANDLE on failure. Valid region handle on success.
  126. */
  127. RegionHandle_t DEV_GetRegionHandle(RegionInfo_t *pRegionInfo, INT32 sdRegionIndex);
  128. /**
  129. * Get the coordinates of the region
  130. *
  131. * @param stRegionHandle Handle to the region.
  132. * @param pRect Pointer to rectangle which return the coordinates.
  133. * @return SUCCESS or FAILURE.
  134. */
  135. INT32 DEV_GetRegionCoords(RegionHandle_t stRegionHandle, RECT *pRect);
  136. /**
  137. * Set activated regions.
  138. *
  139. * @param wRegionsNeeded Regions required.
  140. * @return SUCCESS or FAILURE.
  141. */
  142. INT32 DEV_SetRegions(UINT16 wRegionsNeeded);
  143. /**
  144. * Gets the current active regions
  145. *
  146. * @param pActiveRegions The actived regions returned.
  147. * @return SUCCESS or FAILURE.
  148. */
  149. INT32 DEV_GetActiveRegions(UINT32 *pActiveRegions);
  150. /**
  151. * Gets the bitmap data.
  152. *
  153. * @param stRegionHandle Region handle.
  154. * @param swIconId Icon identifier.
  155. * @param pImgData Pointer to the image data.
  156. * @return SUCCESS or FAILURE.
  157. */
  158. INT32 DEV_GetBmpData (RegionHandle_t stRegionHandle, INT16 swIconId, IMAGEHDR *pImgData);
  159. /**
  160. * SetOSDLayer.
  161. *
  162. * @param dRegionHandle Region handle.
  163. * @param layer OSD Layer .
  164. * @return SUCCESS or FAILURE.
  165. */
  166. INT32 DEV_SetOSDLayer(UINT32 dRegionHandle, OSD_Layer_t layer);
  167. INT32 DEV_GetOSDLayer(UINT32 dRegionHandle);
  168. /* devlist.c*/
  169. void LIST_add(PLISTHEAD pHead, PLIST pItem);
  170. void LIST_Insert( PLISTHEAD pHead, PLIST pItem);
  171. void LIST_remove(PLISTHEAD pHead, PLIST pItem);
  172. #define ITEM_OFFSET(type, field) ((long)&(((type *)0)->field))
  173. #define LIST_item_alloc(size) malloc((size))
  174. #define LIST_item_new(type) ((type *)LIST_item_alloc(sizeof(type)))
  175. #define LIST_item_free(ptr) free((void *)ptr)
  176. /* return base item address from list ptr*/
  177. #define GdItemAddr(p, type, list) ((type*)((long)p-ITEM_OFFSET(type,list)))
  178. #endif