nu_2d.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /**************************************************************************//**
  2. * @file 2d.h
  3. * @brief N9H30 2DGE driver header file
  4. *
  5. * @note
  6. * SPDX-License-Identifier: Apache-2.0
  7. * Copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
  8. *****************************************************************************/
  9. #ifndef __NU_2D_H__
  10. #define __NU_2D_H__
  11. #ifdef __cplusplus
  12. extern "C"
  13. {
  14. #endif
  15. /** @addtogroup N9H30_Device_Driver N9H30 Device Driver
  16. @{
  17. */
  18. /** @addtogroup N9H30_GE2D_Driver GE2D Driver
  19. @{
  20. */
  21. /** @addtogroup N9H30_GE2D_EXPORTED_CONSTANTS GE2D Exported Constants
  22. @{
  23. */
  24. /// @cond HIDDEN_SYMBOLS
  25. typedef struct
  26. {
  27. uint32_t PatternA;
  28. uint32_t PatternB;
  29. } MONOPATTERN;
  30. #define COLOR_KEY 0xFF000000
  31. /// @endcond HIDDEN_SYMBOLS
  32. ///////////////////////////////////////////////////////////////////////////////
  33. // Definition of ROP2
  34. ///////////////////////////////////////////////////////////////////////////////
  35. #define BLACKNESS 0x00 /*!< rop code: 0 */
  36. #define DSTINVERT 0x55 /*!< rop code: Dn */
  37. #define MERGECOPY 0xC0 /*!< rop code: PSa */
  38. #define MERGEPAINT 0xBB /*!< rop code: DSno */
  39. #define NOTSRCCOPY 0x33 /*!< rop code: Sn */
  40. #define NOTSRCERASE 0x11 /*!< rop code: DSon */
  41. #define PATCOPY 0xF0 /*!< rop code: P */
  42. #define PATINVERT 0x5A /*!< rop code: DPx */
  43. #define PATPAINT 0xFB /*!< rop code: DPSnoo */
  44. #define SRCAND 0x88 /*!< rop code: DSa */
  45. #define SRCCOPY 0xCC /*!< rop code: S */
  46. #define SRCERASE 0x44 /*!< rop code: SDna */
  47. #define SRCINVERT 0x66 /*!< rop code: DSx */
  48. #define SRCPAINT 0xEE /*!< rop code: DSo */
  49. #define WHITENESS 0xFF /*!< rop code: 1 */
  50. ///////////////////////////////////////////////////////////////////////////////
  51. // Definition of Pen Styles
  52. ///////////////////////////////////////////////////////////////////////////////
  53. #define PS_SOLID 0xffff /*!< pan style: solid */ //1111111111111111 (1111111111111111)
  54. #define PS_DASH 0xcccc /*!< pan style: dash */ //1100110011001100 (1111000011110000)
  55. #define PS_DOT 0xaaaa /*!< pan style: dot */ //1010101010101010 (1100110011001100)
  56. #define PS_DASHDOT 0xe4e4 /*!< pan style: dash and dot */ //1110010011100100 (1111110000110000)
  57. #define PS_DASHDOTDOT 0xeaea /*!< pan style: dash and two dots */ //1110101011101010 (1111110011001100)
  58. #define PS_NULL 0x0000 /*!< pan style: null */ //0000000000000000 (0000000000000000)
  59. ///////////////////////////////////////////////////////////////////////////////
  60. // Definition of Brush Styles
  61. //
  62. // HS_HORIZONTAL: 00000000 HS_BDIAGONAL: 00000001
  63. // 00000000 00000010
  64. // 00000000 00000100
  65. // 00000000 00001000
  66. // 11111111 00010000
  67. // 00000000 00100000
  68. // 00000000 01000000
  69. // 00000000 10000000
  70. //
  71. // HS_VERTICAL: 00001000 HS_CROSS: 00001000
  72. // 00001000 00001000
  73. // 00001000 00001000
  74. // 00001000 00001000
  75. // 00001000 11111111
  76. // 00001000 00001000
  77. // 00001000 00001000
  78. // 00001000 00001000
  79. //
  80. // HS_FDIAGONAL: 10000000 HS_DIAGCROSS: 10000001
  81. // 01000000 01000010
  82. // 00100000 00100100
  83. // 00010000 00011000
  84. // 00001000 00011000
  85. // 00000100 00100100
  86. // 00000010 01000010
  87. // 00000001 10000001
  88. ///////////////////////////////////////////////////////////////////////////////
  89. #define HS_HORIZONTAL 0 /*!< brush style: horizontal */
  90. #define HS_VERTICAL 1 /*!< brush style: vertical */
  91. #define HS_FDIAGONAL 2 /*!< brush style: fdiagonal */
  92. #define HS_BDIAGONAL 3 /*!< brush style: bdiagonal */
  93. #define HS_CROSS 4 /*!< brush style: cross */
  94. #define HS_DIAGCROSS 5 /*!< brush style: diagcross */
  95. #define MODE_OPAQUE 0 /*!< opaque mode */
  96. #define MODE_TRANSPARENT 1 /*!< transparent mode */
  97. #define MODE_SRC_TRANSPARENT MODE_TRANSPARENT /*!< source transparent mode */
  98. #define MODE_DEST_TRANSPARENT 2 /*!< destination transparent mode */
  99. #define MODE_INSIDE_CLIP 0 /*!< clip inside */
  100. #define MODE_OUTSIDE_CLIP 1 /*!< clip outside */
  101. #define TYPE_MONO 0 /*!< mono */
  102. #define TYPE_COLOR 1 /*!< color */
  103. #define GE_BPP_8 0x00000000 /*!< 8bpp display */
  104. #define GE_BPP_16 0x00000010 /*!< 16bpp display */
  105. #define GE_BPP_32 0x00000020 /*!< 32bpp display */
  106. #define RGB332 1 /*!< 8bpp display */
  107. #define RGB565 2 /*!< 16bpp display */
  108. #define RGB888 3 /*!< 24bpp display */
  109. #define F8x8 0 /*!< 8x8 font support */
  110. #define F8x16 1 /*!< 8x16 font support */
  111. /*@}*/ /* end of group N9H30_GE2D_EXPORTED_CONSTANTS */
  112. /** @addtogroup N9H30_GE2D_EXPORTED_FUNCTIONS GE2D Exported Functions
  113. @{
  114. */
  115. void ge2dClearScreen(int color);
  116. void ge2dSetWriteMask(int mask);
  117. void ge2dSetSourceOriginStarting(void *ptr);
  118. void ge2dSetDestinationOriginStarting(void *ptr);
  119. void ge2dInit(int bpp, int width, int height, void *destination);
  120. void ge2dReset(void);
  121. void ge2dResetFIFO(void);
  122. void ge2dBitblt_SetDrawMode(int opt, int ckey, int mask);
  123. int ge2dBitblt_SetAlphaMode(int opt, int ks, int kd);
  124. void ge2dBitblt_ScreenToScreen(int srcx, int srcy, int destx, int desty, int width, int height);
  125. void ge2dBitblt_ScreenToScreenRop(int srcx, int srcy, int destx, int desty, int width, int height, int rop);
  126. void ge2dBitblt_SourceToDestination(int srcx, int srcy, int destx, int desty, int width, int height, int srcpitch, int destpitch);
  127. void ge2dClip_SetClip(int x1, int y1, int x2, int y2);
  128. void ge2dClip_SetClipMode(int opt);
  129. void ge2dDrawFrame(int x1, int y1, int x2, int y2, int color, int opt);
  130. void ge2dLine_DrawSolidLine(int x1, int y1, int x2, int y2, int color);
  131. void ge2dLine_DrawSolidLine_RGB565(int x1, int y1, int x2, int y2, int color);
  132. void ge2dLine_DrawStyledLine(int x1, int y1, int x2, int y2, int style, int fgcolor, int bkcolor, int draw_mode);
  133. void ge2dLine_DrawStyledLine_RGB565(int x1, int y1, int x2, int y2, int style, int fgcolor, int bkcolor, int draw_mode);
  134. void ge2dFill_Solid(int dx, int dy, int width, int height, int color);
  135. void ge2dFill_Solid_RGB565(int dx, int dy, int width, int height, int color);
  136. void ge2dFill_SolidBackground(int dx, int dy, int width, int height, int color);
  137. void ge2dFill_ColorPattern(int dx, int dy, int width, int height);
  138. void ge2dFill_MonoPattern(int dx, int dy, int width, int height, int opt);
  139. void ge2dFill_ColorPatternROP(int sx, int sy, int width, int height, int rop);
  140. void ge2dFill_MonoPatternROP(int sx, int sy, int width, int height, int rop, int opt);
  141. void ge2dFill_TileBlt(int srcx, int srcy, int destx, int desty, int width, int height, int x_count, int y_count);
  142. void ge2dHostBlt_Write(int x, int y, int width, int height, void *buf);
  143. void ge2dHostBlt_Read(int x, int y, int width, int height, void *buf);
  144. void ge2dHostBlt_Sprite(int x, int y, int width, int height, void *buf);
  145. void ge2dRotation(int srcx, int srcy, int destx, int desty, int width, int height, int ctl);
  146. void ge2dSpriteBlt_Screen(int destx, int desty, int sprite_width, int sprite_height, void *buf);
  147. void ge2dSpriteBltx_Screen(int x, int y, int sprite_sx, int sprite_sy, int width, int height, int sprite_width, int sprite_height, void *buf);
  148. void ge2dSpriteBlt_ScreenRop(int x, int y, int sprite_width, int sprite_height, void *buf, int rop);
  149. void ge2dSpriteBltx_ScreenRop(int x, int y, int sprite_sx, int sprite_sy, int width, int height, int sprite_width, int sprite_height, void *buf, int rop);
  150. void ge2dColorExpansionBlt(int x, int y, int width, int height, int fore_color, int back_color, int opt, void *buf);
  151. void ge2dHostColorExpansionBlt(int x, int y, int width, int height, int fore_color, int back_color, int opt, void *buf);
  152. void ge2dInitMonoPattern(int opt, int fore_color, int back_color);
  153. void ge2dInitMonoInputPattern(uint32_t PatternA, uint32_t PatternB, int fore_color, int back_color);
  154. void ge2dInitColorPattern(int patformat, void *patdata);
  155. void ge2dFont_PutChar(int x, int y, char asc_code, int fore_color, int back_color, int draw_mode, int font_id);
  156. void ge2dFont_PutString(int x, int y, char *str, int fore_color, int back_color, int draw_mode, int font_id);
  157. /*@}*/ /* end of group N9H30_GE2D_EXPORTED_FUNCTIONS */
  158. /*@}*/ /* end of group N9H30_GE2D_Driver */
  159. /*@}*/ /* end of group N9H30_Device_Driver */
  160. #ifdef __cplusplus
  161. }
  162. #endif
  163. #endif //__NU_2D_H__
  164. /*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/