hal_gfx_graphics.h
Go to the documentation of this file.
1 
2 /** @addtogroup GRAPHICS_SDK Graphics
3  * @{
4  */
5 
6 /** @defgroup HAL_GFX_GRAPHICS Hal gfx graphics
7  * @brief Draw basic primitive interfaces and blit texture interfaces
8  * @{
9  */
10 
11 
12 #ifndef HAL_GFX_GRAPHICS_H__
13 #define HAL_GFX_GRAPHICS_H__
14 
15 #include "hal_gfx_sys_defs.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 
22 /** @addtogroup HAL_GFX_GRAPHICS_ENUMERATIONS Enumerations
23  * @{
24  */
25 
26 /**
27  * @brief Graphics Texture
28  */
29 typedef enum {
30  HAL_GFX_NOTEX = -1, /**< No Texture */
31  HAL_GFX_TEX0 = 0, /**< Texture 0 */
32  HAL_GFX_TEX1 = 1, /**< Texture 1 */
33  HAL_GFX_TEX2 = 2, /**< Texture 2 */
34  HAL_GFX_TEX3 = 3 /**< Texture 3 */
36 
37 /**
38  * @brief Graphics Triangle Culling methond
39  */
40 typedef enum {
41  HAL_GFX_CULL_NONE = 0 , /**< Disable Triangle/Quadrilateral Culling */
42  HAL_GFX_CULL_CW = (1U<<28), /**< Cull clockwise Triangles/Quadrilaterals */
43  HAL_GFX_CULL_CCW = (1U<<29), /**< Cull anti-clockwise Triangles/Quadrilaterals */
46 
47 /** @} */
48 
49 /**
50  * @defgroup HAL_GFX_GRAPHICS_MACRO Defines
51  * @{
52  */
53 
54 #define HAL_GFX_RGBX8888 (0x00U) /**< RGBX8888 */
55 #define HAL_GFX_RGBA8888 (0x01U) /**< RGBA8888 */
56 #define HAL_GFX_XRGB8888 (0x02U) /**< XRGB8888 */
57 #define HAL_GFX_ARGB8888 (0x03U) /**< ARGB8888 */
58 #define HAL_GFX_RGB565 (0x04U) /**< RGBA5650 */
59 #define HAL_GFX_RGBA5650 (0x04U) /**< RGBA5650 */
60 #define HAL_GFX_RGBA5551 (0x05U) /**< RGBA5551 */
61 #define HAL_GFX_RGBA4444 (0x06U) /**< RGBA4444 */
62 #define HAL_GFX_RGBA0800 (0x07U) /**< RGBA0800 */
63 #define HAL_GFX_A8 (0x08U) /**< RGBA0008 */
64 #define HAL_GFX_RGBA0008 (0x08U) /**< RGBA0008 */
65 #define HAL_GFX_L8 (0x09U) /**< L8 */
66 #define HAL_GFX_RGBA3320 (0x38U) /**< RGBA3320 (source only) */
67 #define HAL_GFX_RGB332 (0x38U) /**< RGBA3320 (source only) */
68 #define HAL_GFX_BW1 (0x0CU) /**< A1 (source only) */
69 #define HAL_GFX_A1 (0x0CU) /**< A1 (source only) */
70 #define HAL_GFX_L1 (0x0BU) /**< L1 (source only) */
71 #define HAL_GFX_UYVY (0x0DU) /**< UYVY */
72 #define HAL_GFX_ABGR8888 (0x0EU) /**< ABGR8888 */
73 #define HAL_GFX_BGRA8888 (0x10U) /**< BGRA */
74 #define HAL_GFX_BGRX8888 (0x11U) /**< BGRX */
75 #define HAL_GFX_TSC4 (0x12U) /**< TSC4 */
76 #define HAL_GFX_TSC6 (0x16U) /**< TSC6 */
77 #define HAL_GFX_TSC6A (0x17U) /**< TSC6A */
78 #define HAL_GFX_RV (0x18U) /**< RV */
79 #define HAL_GFX_GU (0x19U) /**< GU */
80 #define HAL_GFX_BY (0x1AU) /**< BY */
81 #define HAL_GFX_YUV (0x1BU) /**< YUV */
82 #define HAL_GFX_Z24_8 (0x1cU) /**< Z24_8 */
83 #define HAL_GFX_Z16 (0x1dU) /**< Z16 */
84 #define HAL_GFX_UV (0x1eU) /**< UV */
85 #define HAL_GFX_A1LE (0x27U) /**< A1LE */
86 #define HAL_GFX_A2LE (0x28U) /**< A2LE */
87 #define HAL_GFX_A4LE (0x29U) /**< A4LE */
88 #define HAL_GFX_L1LE (0x2AU) /**< L1LE */
89 #define HAL_GFX_L2LE (0x2BU) /**< L2LE */
90 #define HAL_GFX_L4LE (0x2CU) /**< L4LE */
91 #define HAL_GFX_A2 (0x30U) /**< A2 */
92 #define HAL_GFX_A4 (0x34U) /**< A4 */
93 #define HAL_GFX_L2 (0x31U) /**< L2 */
94 #define HAL_GFX_L4 (0x35U) /**< L4 */
95 #define HAL_GFX_BGR24 (0x39U) /**< BGR24 */
96 #define HAL_GFX_RGB24 (0x3CU) /**< RGB24 */
97 #define HAL_GFX_RV10 (0x3DU) /**< RV-10bit */
98 #define HAL_GFX_GU10 (0x3EU) /**< GU-10bit */
99 #define HAL_GFX_BY10 (0x3FU) /**< BY-10bit */
100 
101 #define HAL_GFX_DITHER (0x80U) /**< GPU Dithering */
102 #define HAL_GFX_FORMAT_MASK (0x7FU) /**< Format Mask */
103 
104 //-----------------------------------------------------------------------------------------------------------------------
105 
106 // Texture Unit Parameters
107 //-----------------------------------------------------------------------------------------
108 // Filtering - 0:0
109 //----------------------
110 #define HAL_GFX_FILTER_PS (0x00U) /**< Point Sampling. */
111 #define HAL_GFX_FILTER_BL (0x01U) /**< Bilinear filtering. */
112 
113 // Wrapping Mode 3:2
114 //----------------------
115 #define HAL_GFX_TEX_CLAMP (0x00U<<2) /**< Clamp */
116 #define HAL_GFX_TEX_REPEAT (0x01U<<2) /**< Repeat */
117 #define HAL_GFX_TEX_BORDER (0x02U<<2) /**< Border */
118 #define HAL_GFX_TEX_MIRROR (0x03U<<2) /**< Mirror */
119 
120 // Texture Coordinates Ordering 4:4
121 //----------------------
122 #define HAL_GFX_TEX_MORTON_ORDER (0x10U)/**< Order */
123 
124 // Texture Coordinates Format 6:5
125 //----------------------
126 #define HAL_GFX_TEX_RANGE_0_1 (0x1U<<5) /**< Interpolated Coordinates range: 0-1 */
127 #define HAL_GFX_TEX_LEFT_HANDED (0x1U<<6) /**< (0,0) is bottom left corner */
128 
129 // Rotation Modes
130 //-----------------------------------------------------------------------------------------------------------------------
131 
132 #define HAL_GFX_ROT_000_CCW (0x0U) /**< No rotation */
133 #define HAL_GFX_ROT_090_CCW (0x1U) /**< Rotate 90 degrees counter-clockwise */
134 #define HAL_GFX_ROT_180_CCW (0x2U) /**< Rotate 180 degrees counter-clockwise */
135 #define HAL_GFX_ROT_270_CCW (0x3U) /**< Rotate 270 degrees counter-clockwise */
136 #define HAL_GFX_ROT_000_CW (0x0U) /**< No rotation */
137 #define HAL_GFX_ROT_270_CW (0x1U) /**< Rotate 270 degrees clockwise */
138 #define HAL_GFX_ROT_180_CW (0x2U) /**< Rotate 180 degrees clockwise */
139 #define HAL_GFX_ROT_090_CW (0x3U) /**< Rotate 90 degrees clockwise */
140 #define HAL_GFX_MIR_VERT (0x4U) /**< Mirror Vertically */
141 #define HAL_GFX_MIR_HOR (0x8U) /**< Mirror Horizontally */
142 
143 /** @} */
144 
145 /** @defgroup HAL_GFX_GRAPHICS_TYPE Typedef
146  * @{
147  */
148 typedef uint8_t hal_gfx_tex_mode_t; /**< The tex mode type */
149 typedef uint32_t hal_gfx_tex_format_t; /**< The tex format type */
150 /** @} */
151 
152 
153 /** @addtogroup HAL_GFX_GRAPHICS_FUNCTION Functions
154  * @{
155  */
156 
157 /**
158  * @defgroup HAL_GFX_GRAPHICS_PUBLIC_FUNCTION Public Functions
159  * @{
160  */
161 
162 /**
163  *****************************************************************************************
164  * @brief Check if a known GPU is present
165  * @return Return -1 if no known GPU is present
166  *****************************************************************************************
167  */
169 
170 /**
171  *****************************************************************************************
172  * @brief Program a Texture Unit
173  * @param[in] texid: Texture unit to be programmed
174  * @param[in] addr_gpu: Texture's address as seen by the GPU
175  * @param[in] width: Texture's width
176  * @param[in] height: Texture's height
177  * @param[in] format: Texture's format
178  * @param[in] stride: Texture's stride. If stride < 0, it's left to be calculated
179  * @param[in] wrap_mode: Wrap/Repeat mode to be used
180  *****************************************************************************************
181  */
182 void hal_gfx_bind_tex(hal_gfx_tex_t texid, uintptr_t addr_gpu,
183  uint32_t width, uint32_t height,
184  hal_gfx_tex_format_t format, int32_t stride, hal_gfx_tex_mode_t wrap_mode);
185 
186 /**
187  *****************************************************************************************
188  * @brief Set Texture Mapping default color
189  * @param[in] color: default color in 32-bit RGBA format, @ref hal_gfx_rgba()
190  *****************************************************************************************
191  */
192 void hal_gfx_set_tex_color(uint32_t color);
193 
194 /**
195  *****************************************************************************************
196  * @brief Write a value to a Constant Register of the GPU
197  * @param[in] reg: Constant Register to be written
198  * @param[in] value: Value to be written
199  *****************************************************************************************
200  */
201 void hal_gfx_set_const_reg(int reg, uint32_t value);
202 
203 /**
204  *****************************************************************************************
205  * @brief Sets the drawing area's Clipping Rectangle
206  * @param[in] x: Clip Window top-left x coordinate
207  * @param[in] y: Clip Window minimum y
208  * @param[in] w: Clip Window width
209  * @param[in] h: Clip Window height
210  *****************************************************************************************
211  */
212 void hal_gfx_set_clip(int32_t x, int32_t y, uint32_t w, uint32_t h);
213 
214 /**
215  *****************************************************************************************
216  * @brief Gets the drawing area's Clipping Rectangle
217  * @param[in] x: pointer to Clip Window top-left x coordinate
218  * @param[in] y: pointer to Clip Window minimum y
219  * @param[in] w: pointer to Clip Window width
220  * @param[in] h: pointer to Clip Window height
221  *****************************************************************************************
222  */
223 void hal_gfx_get_clip(int32_t * x, int32_t * y, uint32_t * w, uint32_t * h);
224 
225 /**
226  *****************************************************************************************
227  * @brief Enable color gradient
228  * @param[in] enable: !0 enable, 0 disable
229  *****************************************************************************************
230  */
231 void hal_gfx_enable_gradient(int enable);
232 
233 /**
234  *****************************************************************************************
235  * @brief Enable depth
236  * @param[in] enable: !0 enable, 0 disable
237  *****************************************************************************************
238  */
239 void hal_gfx_enable_depth(int enable);
240 
241 /**
242  *****************************************************************************************
243  * @brief Enables MSAA per edge
244  * @param[in] e0: Enable MSAA for edge 0 (vertices 0-1)
245  * @param[in] e1: Enable MSAA for edge 1 (vertices 1-2)
246  * @param[in] e2: Enable MSAA for edge 2 (vertices 2-3)
247  * @param[in] e3: Enable MSAA for edge 3 (vertices 3-0)
248  * @return previous AA flags (may be ignored)
249  *****************************************************************************************
250  */
251 uint32_t hal_gfx_enable_aa(uint8_t e0, uint8_t e1, uint8_t e2, uint8_t e3);
252 
253 /**
254  *****************************************************************************************
255  * @brief Returns the bounding rectangle of all the pixels that have been modified since its previous call
256  * @param[out] minx: x coordinate of the upper left corner of the dirty region
257  * @param[out] miny: y coordinate of the upper left corner of the dirty region
258  * @param[out] maxx: x coordinate of the lower right corner of the dirty region
259  * @param[out] maxy: y coordinate of the lower right corner of the dirty region
260  *****************************************************************************************
261  */
262 void hal_gfx_get_dirty_region(int *minx, int *miny, int *maxx, int *maxy);
263 
264 /**
265  *****************************************************************************************
266  * @brief Clear dirty region information - runs via the bound command-list, @ref hal_gfx_get_dirty_region(), @ref hal_gfx_clear_dirty_region()
267  * @retval None
268  *****************************************************************************************
269  */
271 
272 /**
273  *****************************************************************************************
274  * @brief Clear dirty region information immediately, no command-list involved, @ref hal_gfx_get_dirty_region(), @ref hal_gfx_clear_dirty_region_imm()
275  * @retval None
276  *****************************************************************************************
277  */
279 
280 /**
281  *****************************************************************************************
282  * @brief Set triangle/quadrilateral culling mode
283  * @param[in] cull: Culling mode, @ref hal_gfx_tri_cull_t
284  *****************************************************************************************
285  */
287 
288 /**
289  *****************************************************************************************
290  * @brief Return pixel size in bytes
291  * @param[in] format: Color format
292  * @return Return Pixel size in bytes
293  *****************************************************************************************
294  */
296 
297 /**
298  *****************************************************************************************
299  * @brief Return stride in bytes
300  * @param[in] format: Color format
301  * @param[in] wrap_mode: Wrap/Repeat mode to be used
302  * @param[in] width: Texture color format
303  * @return Return stride in bytes
304  *****************************************************************************************
305  */
307 
308 /**
309  *****************************************************************************************
310  * @brief Return texture size in bytes
311  * @param[in] format: Texture color format
312  * @param[in] wrap_mode: Wrap/Repeat mode to be used
313  * @param[in] width: Texture width
314  * @param[in] height: Texture height
315  * @return Return Texture size in bytes
316  *****************************************************************************************
317  */
318 int hal_gfx_texture_size(hal_gfx_tex_format_t format, hal_gfx_tex_mode_t wrap_mode, int width, int height);
319 
320 /**
321  *****************************************************************************************
322  * @brief Return Nema internal RGBA color
323  * @param[in] R: Red component
324  * @param[in] G: Green component
325  * @param[in] B: Blue component
326  * @param[in] A: Alpha component
327  * @return Return RGBA value
328  *****************************************************************************************
329  */
330 uint32_t hal_gfx_rgba(unsigned char R,
331  unsigned char G,
332  unsigned char B,
333  unsigned char A);
334 
335 /**
336  *****************************************************************************************
337  * @brief Premultiply RGB channels with Alpha channel
338  * @param[in] rgba: RGBA color
339  * @return Premultiplied RGBA color
340  *****************************************************************************************
341  */
342 uint32_t hal_gfx_premultiply_rgba(uint32_t rgba);
343 
344 /**
345  *****************************************************************************************
346  * @brief Initialize hal_gfx library
347  * @return Return negative value on error
348  *****************************************************************************************
349  */
350 int hal_gfx_init(void);
351 
352 /**
353  *****************************************************************************************
354  * @brief Program Texture Unit with a foreground (source) texture (@ref HAL_GFX_TEX1)
355  * @param[in] baseaddr_phys: Address of the source texture, as seen by the GPU
356  * @param[in] width: Texture width
357  * @param[in] height: Texture hight
358  * @param[in] format: Texture format
359  * @param[in] stride: Texture stride. If negative, it's calculated internally
360  * @param[in] mode: Wrapping and Filtering mode
361  *****************************************************************************************
362  */
363 void hal_gfx_bind_src_tex(uintptr_t baseaddr_phys,
364  uint32_t width, uint32_t height,
365  hal_gfx_tex_format_t format, int32_t stride, hal_gfx_tex_mode_t mode);
366 
367 /**
368  *****************************************************************************************
369  * @brief Program Texture Unit with a background texture (@ref HAL_GFX_TEX2)
370  * @param[in] baseaddr_phys: Address of the source2 texture, as seen by the GPU
371  * @param[in] width: Texture width
372  * @param[in] height: Texture hight
373  * @param[in] format: Texture format
374  * @param[in] stride: Texture stride. If negative, it's calculated internally
375  * @param[in] mode: Wrapping and Filtering mode
376  *****************************************************************************************
377  */
378 void hal_gfx_bind_src2_tex(uintptr_t baseaddr_phys,
379  uint32_t width, uint32_t height,
380  hal_gfx_tex_format_t format, int32_t stride, hal_gfx_tex_mode_t mode);
381 
382 /**
383  *****************************************************************************************
384  * @brief Program Texture Unit with a destination texture (@ref HAL_GFX_TEX0)
385  * @param[in] baseaddr_phys: Address of the destination texture, as seen by the GPU
386  * @param[in] width: Texture width
387  * @param[in] height: Texture hight
388  * @param[in] format: Texture format
389  * @param[in] stride: Texture stride. If negative, it's calculated internally
390  *****************************************************************************************
391  */
392 void hal_gfx_bind_dst_tex(uintptr_t baseaddr_phys,
393  uint32_t width, uint32_t height,
394  hal_gfx_tex_format_t format, int32_t stride);
395 
396 /**
397  *****************************************************************************************
398  * @brief Bind Depth Buffer
399  * @param[in] baseaddr_phys: Address of the depth buffer, as seen by the GPU
400  * @param[in] width: Buffer width
401  * @param[in] height: Buffer hight
402  *****************************************************************************************
403  */
404 void hal_gfx_bind_depth_buffer(uintptr_t baseaddr_phys,
405  uint32_t width, uint32_t height);
406 
407 /**
408  *****************************************************************************************
409  * @brief Clear destination texture with color
410  * @param[in] rgba8888: 32-bit RGBA color
411  *****************************************************************************************
412  */
413 void hal_gfx_clear(uint32_t rgba8888);
414 
415 /**
416  *****************************************************************************************
417  * @brief Clear depth buffer with specified value
418  * @param[in] val: Clear value
419  *****************************************************************************************
420  */
421 void hal_gfx_clear_depth(uint32_t val);
422 
423 /**
424  *****************************************************************************************
425  * @brief Draw a colored line, @ref hal_gfx_rgba()
426  * @param[in] x0 x coordinate at the beginning of the line
427  * @param[in] y0 y coordinate at the beginning of the line
428  * @param[in] x1 x coordinate at the end of the line
429  * @param[in] y1 y coordinate at the end of the line
430  * @param[in] rgba8888: Color to be used
431  *****************************************************************************************
432  */
433 void hal_gfx_draw_line(int x0, int y0, int x1, int y1, uint32_t rgba8888);
434 
435 /**
436  *****************************************************************************************
437  * @brief Draw a line with width. Apply AA if available, @ref hal_gfx_rgba(), @ref hal_gfx_draw_line()
438  * @param[in] x0 x coordinate at the beginning of the line
439  * @param[in] y0 y coordinate at the beginning of the line
440  * @param[in] x1 x coordinate at the end of the line
441  * @param[in] y1 y coordinate at the end of the line
442  * @param[in] w: line width
443  * @param[in] rgba8888: Color to be used
444  *****************************************************************************************
445  */
446 void
447 hal_gfx_draw_line_aa(float x0, float y0, float x1, float y1, float w,
448  uint32_t rgba8888);
449 
450 /**
451  *****************************************************************************************
452  * @brief Draw a colored circle with 1 pixel width, @ref hal_gfx_rgba()
453  * @param[in] x: x coordinate of the circle's center
454  * @param[in] y: y coordinate of the circle's center
455  * @param[in] r: circle's radius
456  * @param[in] rgba8888: Color to be used
457  *****************************************************************************************
458  */
459 void hal_gfx_draw_circle(int x, int y, int r, uint32_t rgba8888);
460 
461 /**
462  *****************************************************************************************
463  * @brief Draw a colored circle with Anti-Aliasing (if available) and specified width, @ref hal_gfx_rgba()
464  * @param[in] x: x coordinate of the circle's center
465  * @param[in] y: y coordinate of the circle's center
466  * @param[in] r: circle's radius
467  * @param[in] w: pencil width
468  * @param[in] rgba8888: Color to be used
469  *****************************************************************************************
470  */
471 void hal_gfx_draw_circle_aa(float x, float y, float r, float w, uint32_t rgba8888);
472 
473 /**
474  *****************************************************************************************
475  * @brief Draw a colored rectangle with rounded edges, @ref hal_gfx_rgba()
476  * @param[in] x0: x coordinate of the upper left vertex of the rectangle
477  * @param[in] y0: y coordinate at the upper left vertex of the rectangle
478  * @param[in] w: width of the rectangle
479  * @param[in] h: height of the rectangle
480  * @param[in] r: corner radius
481  * @param[in] rgba8888: Color to be used
482  *****************************************************************************************
483  */
484 void hal_gfx_draw_rounded_rect(int x0, int y0, int w, int h, int r, uint32_t rgba8888);
485 
486 /**
487  *****************************************************************************************
488  * @brief Draw a colored rectangle, @ref hal_gfx_rgba()
489  * @param[in] x: x coordinate of the upper left vertex of the rectangle
490  * @param[in] y: y coordinate at the upper left vertex of the rectangle
491  * @param[in] w: width of the rectangle
492  * @param[in] h: height of the rectangle
493  * @param[in] rgba8888: Color to be used
494  *****************************************************************************************
495  */
496 void hal_gfx_draw_rect(int x, int y, int w, int h, uint32_t rgba8888);
497 
498 /**
499  *****************************************************************************************
500  * @brief Fill a circle with color, @ref hal_gfx_rgba()
501  * @param[in] x: x coordinate of the circle's center
502  * @param[in] y: y coordinate of the circle's center
503  * @param[in] r: circle's radius
504  * @param[in] rgba8888: Color to be used
505  *****************************************************************************************
506  */
507 void hal_gfx_fill_circle(int x, int y, int r, uint32_t rgba8888);
508 
509 /**
510  *****************************************************************************************
511  * @brief Fill a circle with color, use Anti-Aliasing if available, @ref hal_gfx_rgba()
512  * @param[in] x: x coordinate of the circle's center
513  * @param[in] y: y coordinate of the circle's center
514  * @param[in] r: circle's radius
515  * @param[in] rgba8888: Color to be used
516  *****************************************************************************************
517  */
518 void hal_gfx_fill_circle_aa(float x, float y, float r, uint32_t rgba8888);
519 
520 /**
521  *****************************************************************************************
522  * @brief Fill a triangle with color
523  * @param[in] x0: x coordinate at the first vertex of the triangle
524  * @param[in] y0: y coordinate at the first vertex of the triangle
525  * @param[in] x1: x coordinate at the second vertex of the triangle
526  * @param[in] y1: y coordinate at the second vertex of the triangle
527  * @param[in] x2: x coordinate at the third vertex of the triangle
528  * @param[in] y2: y coordinate at the third vertex of the triangle
529  * @param[in] rgba8888: Color to be used
530  *****************************************************************************************
531  */
532 void hal_gfx_fill_triangle(int x0, int y0, int x1, int y1, int x2, int y2, uint32_t rgba8888);
533 
534 /**
535  *****************************************************************************************
536  * @brief Fill a rectangle with rounded edges with color
537  * @param[in] x0: x coordinate of the upper left vertex of the rectangle
538  * @param[in] y0: y coordinate at the upper left vertex of the rectangle
539  * @param[in] w: width of the rectangle
540  * @param[in] h: height of the rectangle
541  * @param[in] r: corner radius
542  * @param[in] rgba8888: Color to be used
543  *****************************************************************************************
544  */
545 void hal_gfx_fill_rounded_rect(int x0, int y0, int w, int h, int r, uint32_t rgba8888);
546 
547 /**
548  *****************************************************************************************
549  * @brief Fill a rectangle with color
550  * @param[in] x: x coordinate of the upper left vertex of the rectangle
551  * @param[in] y: y coordinate at the upper left vertex of the rectangle
552  * @param[in] w: width of the rectangle
553  * @param[in] h: height of the rectangle
554  * @param[in] rgba8888: Color to be used
555  *****************************************************************************************
556  */
557 void hal_gfx_fill_rect(int x, int y, int w, int h, uint32_t rgba8888);
558 
559 /**
560  *****************************************************************************************
561  * @brief Fill a quadrilateral with color
562  * @param[in] x0: x coordinate at the first vertex of the quadrilateral
563  * @param[in] y0: y coordinate at the first vertex of the quadrilateral
564  * @param[in] x1: x coordinate at the second vertex of the quadrilateral
565  * @param[in] y1: y coordinate at the second vertex of the quadrilateral
566  * @param[in] x2: x coordinate at the third vertex of the quadrilateral
567  * @param[in] y2: y coordinate at the third vertex of the quadrilateral
568  * @param[in] x3: x coordinate at the fourth vertex of the quadrilateral
569  * @param[in] y3: y coordinate at the fourth vertex of the quadrilateral
570  * @param[in] rgba8888: Color to be used
571  *****************************************************************************************
572  */
573 void hal_gfx_fill_quad(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3, uint32_t rgba8888);
574 
575 /**
576  *****************************************************************************************
577  * @brief Fill a rectangle with color (float coordinates)
578  * @param[in] x: x coordinate of the upper left vertex of the rectangle
579  * @param[in] y: y coordinate at the upper left vertex of the rectangle
580  * @param[in] w: width of the rectangle
581  * @param[in] h: height of the rectangle
582  * @param[in] rgba8888: Color to be used
583  *****************************************************************************************
584  */
585 void hal_gfx_fill_rect_f(float x, float y, float w, float h, uint32_t rgba8888);
586 
587 /**
588  *****************************************************************************************
589  * @brief Fill a quadrilateral with color (float coordinates)
590  * @param[in] x0: x coordinate at the first vertex of the quadrilateral
591  * @param[in] y0: y coordinate at the first vertex of the quadrilateral
592  * @param[in] x1: x coordinate at the second vertex of the quadrilateral
593  * @param[in] y1: y coordinate at the second vertex of the quadrilateral
594  * @param[in] x2: x coordinate at the third vertex of the quadrilateral
595  * @param[in] y2: y coordinate at the third vertex of the quadrilateral
596  * @param[in] x3: x coordinate at the fourth vertex of the quadrilateral
597  * @param[in] y3: y coordinate at the fourth vertex of the quadrilateral
598  * @param[in] rgba8888: Color to be used
599  *****************************************************************************************
600  */
601 void hal_gfx_fill_quad_f(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, uint32_t rgba8888);
602 
603 /**
604  *****************************************************************************************
605  * @brief Fill a triangle with color (float coordinates)
606  * @param[in] x0: x coordinate at the first vertex of the triangle
607  * @param[in] y0: y coordinate at the first vertex of the triangle
608  * @param[in] x1: x coordinate at the second vertex of the triangle
609  * @param[in] y1: y coordinate at the second vertex of the triangle
610  * @param[in] x2: x coordinate at the third vertex of the triangle
611  * @param[in] y2: y coordinate at the third vertex of the triangle
612  * @param[in] rgba8888: Color to be used
613  *****************************************************************************************
614  */
615 void hal_gfx_fill_triangle_f(float x0, float y0, float x1, float y1, float x2, float y2, uint32_t rgba8888);
616 
617 /**
618  *****************************************************************************************
619  * @brief Blit source texture to destination texture
620  * @note The width and height of the destination for the fast blit function depends on
621  * the foreground (source) texture (@ref HAL_GFX_TEX1)
622  * When the background texture (@ref HAL_GFX_TEX2) is in effect, the background texture
623  * is always at (0,0) and will not be offset according to the destination x and y coordinates.
624  * @param[in] x: destination x coordinate
625  * @param[in] y: destination y coordinate
626  *****************************************************************************************
627  */
628 void hal_gfx_blit (int x, int y);
629 
630 /**
631  *****************************************************************************************
632  * @brief Blit source texture to destination texture with rounded corners
633  * @param[in] x: destination x coordinate
634  * @param[in] y: destination y coordinate
635  * @param[in] r: destination corner radius
636  *****************************************************************************************
637  */
638 void hal_gfx_blit_rounded (int x, int y, int r);
639 
640 /**
641  *****************************************************************************************
642  * @brief Blit source texture to destination's specified rectangle (crop or wrap when needed)
643  * @param[in] x: destination x coordinate
644  * @param[in] y: destination y coordinate
645  * @param[in] w: destination width
646  * @param[in] h: destination height
647  *****************************************************************************************
648  */
649 void hal_gfx_blit_rect (int x, int y, int w, int h);
650 
651 /**
652  *****************************************************************************************
653  * @brief Blit part of a source texture to destination's specified rectangle (crop or wrap when needed)
654  * @param[in] dst_x: destination x coordinate
655  * @param[in] dst_y: destination y coordinate
656  * @param[in] w: destination width
657  * @param[in] h: destination height
658  * @param[in] src_x: source x coordinate
659  * @param[in] src_y: source y coordinate
660  *****************************************************************************************
661  */
662 void hal_gfx_blit_subrect(int dst_x, int dst_y, int w, int h, int src_x, int src_y);
663 
664 /**
665  *****************************************************************************************
666  * @brief Blit source texture to destination. Fit (scale) texture to specified rectangle
667  * @param[in] x: destination x coordinate
668  * @param[in] y: destination y coordinate
669  * @param[in] w: destination width
670  * @param[in] h: destination height
671  *****************************************************************************************
672  */
673 void hal_gfx_blit_rect_fit(int x, int y, int w, int h);
674 
675 /**
676  *****************************************************************************************
677  * @brief Blit part of source texture to destination. Fit (scale) texture to specified rectangle
678  * @param[in] dst_x: destination x coordinate
679  * @param[in] dst_y: destination y coordinate
680  * @param[in] dst_w: destination width
681  * @param[in] dst_h: destination height
682  * @param[in] src_x: source x coordinate
683  * @param[in] src_y: source y coordinate
684  * @param[in] src_w: source width
685  * @param[in] src_h: source height
686  *****************************************************************************************
687  */
688 void hal_gfx_blit_subrect_fit( int dst_x, int dst_y, int dst_w, int dst_h,
689  int src_x, int src_y, int src_w, int src_h);
690 
691 /**
692  *****************************************************************************************
693  * @brief Rotate around pivot point and Blit source texture
694  * @param[in] cx: destination rotation center x coordinate
695  * @param[in] cy: destination rotation center y coordinate
696  * @param[in] px: source pivot point x coordinate
697  * @param[in] py: source pivot point y coordinate
698  * @param[in] degrees_cw: degrees of clockwise rotation in range [0, 360]
699  *****************************************************************************************
700  */
701 void hal_gfx_blit_rotate_pivot( float cx, float cy,
702  float px, float py, float degrees_cw );
703 
704 /**
705  *****************************************************************************************
706  * @brief Rotate around pivot point and Blit source texture
707  * @param[in] cx: destination rotation center x coordinate
708  * @param[in] cy: destination rotation center y coordinate
709  * @param[in] px: source pivot point x coordinate
710  * @param[in] py: source pivot point y coordinate
711  * @param[in] degrees_cw: degrees of clockwise rotation in range [0, 360]
712  * @param[in] scale: the ratio of zoom in / zoom out, > 1.0 zoom out, < 1.0 zoom in
713  *****************************************************************************************
714  */
715 void hal_gfx_blit_rotate_pivot_scale( float cx, float cy, float px, float py, float degrees_cw, float scale);
716 
717 /**
718  *****************************************************************************************
719  * @brief Rotate and Blit source texture to destination
720  * @param[in] x: destination x coordinate
721  * @param[in] y: destination y coordinate
722  * @param[in] rotation: Rotation to be done
723  *****************************************************************************************
724  */
725 void hal_gfx_blit_rotate(int x, int y, uint32_t rotation);
726 
727 /**
728  *****************************************************************************************
729  * @brief Rotate and Blit partial source texture to destination
730  * @param[in] sx: source upper left x coordinate
731  * @param[in] sy: source upper left y coordinate
732  * @param[in] sw: source width of partial region
733  * @param[in] sh: source height of partial region
734  * @param[in] x: destination x coordinate
735  * @param[in] y: destination y coordinate
736  * @param[in] rotation: Rotation to be done
737  *****************************************************************************************
738  */
739 void hal_gfx_blit_rotate_partial(int sx, int sy,
740  int sw, int sh,
741  int x, int y,
742  uint32_t rotation);
743 
744 /**
745  *****************************************************************************************
746  * @brief Blit source texture to destination. Fit texture to specified triangle
747  * @param[in] dx0 x coordinate at the first vertex of the triangle
748  * @param[in] dy0 y coordinate at the first vertex of the triangle
749  * @param[in] v0 in [0, 3] indicates the corner of the texture that fits to the first vertex of the triangle
750  * 0 _ _ 1
751  * |_ _|
752  * 3 2
753  * @param[in] dx1 x coordinate at the second vertex of the triangle
754  * @param[in] dy1 y coordinate at the second vertex of the triangle
755  * @param[in] v1 in [0, 3] indicates the corner of the texture that fits to the second vertex of the triangle
756  * @param[in] dx2 x coordinate at the third vertex of the triangle
757  * @param[in] dy2 y coordinate at the third vertex of the triangle
758  * @param[in] v2 in [0, 3] indicates the corner of the texture that fits to the third vertex of the triangle
759  *****************************************************************************************
760  */
761 void hal_gfx_blit_tri_fit (float dx0, float dy0, int v0,
762  float dx1, float dy1, int v1,
763  float dx2, float dy2, int v2);
764 
765 /**
766  *****************************************************************************************
767  * @brief Blit a triangular part of the source tecture to a triangular destination area
768  * @param[in] dx0 x coordinate at the first vertex of the destination triangle
769  * @param[in] dy0 y coordinate at the first vertex of the destination triangle
770  * @param[in] dw0 w coordinate at the first vertex of the destination triangle
771  * @param[in] dx1 x coordinate at the second vertex of the destination triangle
772  * @param[in] dy1 y coordinate at the second vertex of the destination triangle
773  * @param[in] dw1 w coordinate at the second vertex of the destination triangle
774  * @param[in] dx2 x coordinate at the third vertex of the destination triangle
775  * @param[in] dy2 y coordinate at the third vertex of the destination triangle
776  * @param[in] dw2 w coordinate at the third vertex of the destination triangle
777  * @param[in] sx0 x coordinate at the first vertex of the source triangle
778  * @param[in] sy0 y coordinate at the first vertex of the source triangle
779  * @param[in] sx1 x coordinate at the second vertex of the source triangle
780  * @param[in] sy1 y coordinate at the second vertex of the source triangle
781  * @param[in] sx2 x coordinate at the third vertex of the source triangle
782  * @param[in] sy2 y coordinate at the third vertex of the source triangle
783  *****************************************************************************************
784  */
785 void hal_gfx_blit_tri_uv (float dx0, float dy0, float dw0,
786  float dx1, float dy1, float dw1,
787  float dx2, float dy2, float dw2,
788  float sx0, float sy0,
789  float sx1, float sy1,
790  float sx2, float sy2
791  );
792 
793 /**
794  *****************************************************************************************
795  * @brief Blit source texture to destination. Fit texture to specified quadrilateral
796  * @param[in] dx0 x coordinate at the first vertex of the quadrilateral
797  * @param[in] dy0 y coordinate at the first vertex of the quadrilateral
798  * @param[in] dx1 x coordinate at the second vertex of the quadrilateral
799  * @param[in] dy1 y coordinate at the second vertex of the quadrilateral
800  * @param[in] dx2 x coordinate at the third vertex of the quadrilateral
801  * @param[in] dy2 y coordinate at the third vertex of the quadrilateral
802  * @param[in] dx3 x coordinate at the fourth vertex of the quadrilateral
803  * @param[in] dy3 y coordinate at the fourth vertex of the quadrilateral
804  *****************************************************************************************
805  */
806 void hal_gfx_blit_quad_fit (float dx0, float dy0,
807  float dx1, float dy1,
808  float dx2, float dy2,
809  float dx3, float dy3);
810 
811 /**
812  *****************************************************************************************
813  * @brief Blit source texture to destination. Fit rectangulare area of texture to specified quadrilateral
814  * @param[in] dx0: x coordinate at the first vertex of the quadrilateral
815  * @param[in] dy0: y coordinate at the first vertex of the quadrilateral
816  * @param[in] dx1: x coordinate at the second vertex of the quadrilateral
817  * @param[in] dy1: y coordinate at the second vertex of the quadrilateral
818  * @param[in] dx2: x coordinate at the third vertex of the quadrilateral
819  * @param[in] dy2: y coordinate at the third vertex of the quadrilateral
820  * @param[in] dx3: x coordinate at the fourth vertex of the quadrilateral
821  * @param[in] dy3: y coordinate at the fourth vertex of the quadrilateral
822  * @param[in] sx: x coordinate of the top left corner of the texture's rectangular area to be blitted
823  * @param[in] sy: y coordinate of the top left corner of the texture's rectangular area to be blitted
824  * @param[in] sw: width of the texture's rectangular area to be blitted
825  * @param[in] sh: height of the texture's rectangular area to be blitted
826  *****************************************************************************************
827  */
828 void hal_gfx_blit_subrect_quad_fit(float dx0, float dy0,
829  float dx1, float dy1,
830  float dx2, float dy2,
831  float dx3, float dy3,
832  int sx, int sy,
833  int sw, int sh);
834 
835 
836 /** @} */
837 
838 /**
839  * @defgroup HAL_GFX_GRAPHICS_PRIVATE_FUNCTION Private Functions
840  * @{
841  */
842 
843 /**
844  *****************************************************************************************
845  * @brief private function
846  * @param[in] start: TODO
847  * @param[in] dx: TODO
848  * @param[in] dy: TODO
849  *****************************************************************************************
850  */
851 void hal_gfx_set_depth(float start, float dx, float dy);
852 
853 /**
854  *****************************************************************************************
855  * @brief private function
856  * @param[in] r_init: TODO
857  * @param[in] g_init: TODO
858  * @param[in] b_init: TODO
859  * @param[in] a_init: TODO
860  * @param[in] r_dx: TODO
861  * @param[in] r_dy: TODO
862  * @param[in] g_dx: TODO
863  * @param[in] g_dy: TODO
864  * @param[in] b_dx: TODO
865  * @param[in] b_dy: TODO
866  * @param[in] a_dx: TODO
867  * @param[in] a_dy: TODO
868  *****************************************************************************************
869  */
870 void hal_gfx_set_gradient(float r_init, float g_init, float b_init, float a_init,
871  float r_dx, float r_dy,
872  float g_dx, float g_dy,
873  float b_dx, float b_dy,
874  float a_dx, float a_dy);
875 
876 /**
877  *****************************************************************************************
878  * @brief Enable breakpoints
879  * @retval None
880  *****************************************************************************************
881  */
883 
884 /**
885  *****************************************************************************************
886  * @brief Disable breakpoints
887  * @retval None
888  *****************************************************************************************
889  */
891 
892 /**
893  *****************************************************************************************
894  * @brief Add a breakpoint to the current Command List
895  * @return Breakpoint ID
896  *****************************************************************************************
897  */
898 int hal_gfx_brk_add(void);
899 
900 /**
901  *****************************************************************************************
902  * @brief Add a breakpoint to the current Command List
903  * @param[in] brk_id: Breakpoint ID to wait for. If zero (0), wait until next Breakpoint
904  * @return ID of reached Breakpoint
905  *****************************************************************************************
906  */
907 int hal_gfx_brk_wait(int brk_id);
908 
909 /**
910  *****************************************************************************************
911  * @brief Instruct the GPU to resume execution
912  * @retval None
913  *****************************************************************************************
914  */
916 
917 /**
918  *****************************************************************************************
919  * @brief Enable external hold signals
920  * @param[in] hold_id: Hold signals to be enabled [0-3]
921  *****************************************************************************************
922  */
923 void hal_gfx_ext_hold_enable(uint32_t hold_id);
924 
925 /**
926  *****************************************************************************************
927  * @brief Disable external hold signals
928  * @param[in] hold_id: Hold signals to be disabled [0-3]
929  *****************************************************************************************
930  */
931 void hal_gfx_ext_hold_disable(uint32_t hold_id);
932 
933 /**
934  *****************************************************************************************
935  * @brief Enable Interrupt Request when GPU reaches hold point
936  * @param[in] hold_id: Hold signals' IRQ to be enabled [0-3]
937  *****************************************************************************************
938  */
939 void hal_gfx_ext_hold_irq_enable(uint32_t hold_id);
940 
941 /**
942  *****************************************************************************************
943  * @brief Disable external hold signals
944  * @param[in] hold_id: Hold signals' IRQ to be disabled [0-3]
945  *****************************************************************************************
946  */
947 void hal_gfx_ext_hold_irq_disable(uint32_t hold_id);
948 
949 /**
950  *****************************************************************************************
951  * @brief Assert hold signals internally via a Command List
952  * @param[in] hold_id: Hold signal to be asserted
953  * @param[in] stop: If not zero, force Command List Processor to wait for FLAG to be deasserted
954  *****************************************************************************************
955  */
956 void hal_gfx_ext_hold_assert(uint32_t hold_id, int stop);
957 
958 /**
959  *****************************************************************************************
960  * @brief Dessert hold signals internally via a Command List
961  * @param[in] hold_id: Hold signal to be deasserted
962  *****************************************************************************************
963  */
964 void hal_gfx_ext_hold_deassert(uint32_t hold_id);
965 
966 /**
967  *****************************************************************************************
968  * @brief Assert hold signals from the CPU (no Command List)
969  * @param[in] hold_id: Hold signal to be asserted
970  *****************************************************************************************
971  */
972 void hal_gfx_ext_hold_assert_imm(uint32_t hold_id);
973 
974 /**
975  *****************************************************************************************
976  * @brief Dessert hold signals from the CPU (no Command List)
977  * @param[in] hold_id: Hold signal to be deasserted
978  *****************************************************************************************
979  */
980 void hal_gfx_ext_hold_deassert_imm(uint32_t hold_id);
981 
982 /** @} */
983 /** @} */
984 
985 #ifdef __cplusplus
986 }
987 #endif
988 
989 #endif
990 
991 /** @} */
992 /** @} */
993 
hal_gfx_clear_depth
void hal_gfx_clear_depth(uint32_t val)
Clear depth buffer with specified value.
hal_gfx_enable_gradient
void hal_gfx_enable_gradient(int enable)
Enable color gradient.
hal_gfx_set_clip
void hal_gfx_set_clip(int32_t x, int32_t y, uint32_t w, uint32_t h)
Sets the drawing area's Clipping Rectangle.
hal_gfx_bind_tex
void hal_gfx_bind_tex(hal_gfx_tex_t texid, uintptr_t addr_gpu, uint32_t width, uint32_t height, hal_gfx_tex_format_t format, int32_t stride, hal_gfx_tex_mode_t wrap_mode)
Program a Texture Unit.
hal_gfx_blit_rotate_pivot
void hal_gfx_blit_rotate_pivot(float cx, float cy, float px, float py, float degrees_cw)
Rotate around pivot point and Blit source texture.
hal_gfx_ext_hold_irq_disable
void hal_gfx_ext_hold_irq_disable(uint32_t hold_id)
Disable external hold signals.
hal_gfx_ext_hold_deassert
void hal_gfx_ext_hold_deassert(uint32_t hold_id)
Dessert hold signals internally via a Command List.
hal_gfx_fill_rect_f
void hal_gfx_fill_rect_f(float x, float y, float w, float h, uint32_t rgba8888)
Fill a rectangle with color (float coordinates)
hal_gfx_blit_quad_fit
void hal_gfx_blit_quad_fit(float dx0, float dy0, float dx1, float dy1, float dx2, float dy2, float dx3, float dy3)
Blit source texture to destination. Fit texture to specified quadrilateral.
hal_gfx_premultiply_rgba
uint32_t hal_gfx_premultiply_rgba(uint32_t rgba)
Premultiply RGB channels with Alpha channel.
hal_gfx_fill_circle_aa
void hal_gfx_fill_circle_aa(float x, float y, float r, uint32_t rgba8888)
Fill a circle with color, use Anti-Aliasing if available, hal_gfx_rgba()
hal_gfx_ext_hold_disable
void hal_gfx_ext_hold_disable(uint32_t hold_id)
Disable external hold signals.
hal_gfx_blit_tri_uv
void hal_gfx_blit_tri_uv(float dx0, float dy0, float dw0, float dx1, float dy1, float dw1, float dx2, float dy2, float dw2, float sx0, float sy0, float sx1, float sy1, float sx2, float sy2)
Blit a triangular part of the source tecture to a triangular destination area.
hal_gfx_enable_aa
uint32_t hal_gfx_enable_aa(uint8_t e0, uint8_t e1, uint8_t e2, uint8_t e3)
Enables MSAA per edge.
hal_gfx_clear
void hal_gfx_clear(uint32_t rgba8888)
Clear destination texture with color.
hal_gfx_blit_tri_fit
void hal_gfx_blit_tri_fit(float dx0, float dy0, int v0, float dx1, float dy1, int v1, float dx2, float dy2, int v2)
Blit source texture to destination. Fit texture to specified triangle.
hal_gfx_enable_depth
void hal_gfx_enable_depth(int enable)
Enable depth.
hal_gfx_set_depth
void hal_gfx_set_depth(float start, float dx, float dy)
private function
hal_gfx_get_dirty_region
void hal_gfx_get_dirty_region(int *minx, int *miny, int *maxx, int *maxy)
Returns the bounding rectangle of all the pixels that have been modified since its previous call.
hal_gfx_checkGPUPresence
int hal_gfx_checkGPUPresence(void)
Check if a known GPU is present.
hal_gfx_fill_quad
void hal_gfx_fill_quad(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3, uint32_t rgba8888)
Fill a quadrilateral with color.
hal_gfx_tex_format_t
uint32_t hal_gfx_tex_format_t
Definition: hal_gfx_graphics.h:149
hal_gfx_fill_triangle_f
void hal_gfx_fill_triangle_f(float x0, float y0, float x1, float y1, float x2, float y2, uint32_t rgba8888)
Fill a triangle with color (float coordinates)
hal_gfx_blit_rotate
void hal_gfx_blit_rotate(int x, int y, uint32_t rotation)
Rotate and Blit source texture to destination.
hal_gfx_set_tex_color
void hal_gfx_set_tex_color(uint32_t color)
Set Texture Mapping default color.
hal_gfx_blit_rect_fit
void hal_gfx_blit_rect_fit(int x, int y, int w, int h)
Blit source texture to destination. Fit (scale) texture to specified rectangle.
hal_gfx_fill_rect
void hal_gfx_fill_rect(int x, int y, int w, int h, uint32_t rgba8888)
Fill a rectangle with color.
hal_gfx_bind_dst_tex
void hal_gfx_bind_dst_tex(uintptr_t baseaddr_phys, uint32_t width, uint32_t height, hal_gfx_tex_format_t format, int32_t stride)
Program Texture Unit with a destination texture (HAL_GFX_TEX0)
hal_gfx_stride_size
int hal_gfx_stride_size(hal_gfx_tex_format_t format, hal_gfx_tex_mode_t wrap_mode, int width)
Return stride in bytes.
hal_gfx_set_gradient
void hal_gfx_set_gradient(float r_init, float g_init, float b_init, float a_init, float r_dx, float r_dy, float g_dx, float g_dy, float b_dx, float b_dy, float a_dx, float a_dy)
private function
hal_gfx_draw_rounded_rect
void hal_gfx_draw_rounded_rect(int x0, int y0, int w, int h, int r, uint32_t rgba8888)
Draw a colored rectangle with rounded edges, hal_gfx_rgba()
hal_gfx_bind_src_tex
void hal_gfx_bind_src_tex(uintptr_t baseaddr_phys, uint32_t width, uint32_t height, hal_gfx_tex_format_t format, int32_t stride, hal_gfx_tex_mode_t mode)
Program Texture Unit with a foreground (source) texture (HAL_GFX_TEX1)
hal_gfx_fill_triangle
void hal_gfx_fill_triangle(int x0, int y0, int x1, int y1, int x2, int y2, uint32_t rgba8888)
Fill a triangle with color.
hal_gfx_draw_rect
void hal_gfx_draw_rect(int x, int y, int w, int h, uint32_t rgba8888)
Draw a colored rectangle, hal_gfx_rgba()
hal_gfx_texture_size
int hal_gfx_texture_size(hal_gfx_tex_format_t format, hal_gfx_tex_mode_t wrap_mode, int width, int height)
Return texture size in bytes.
HAL_GFX_TEX1
@ HAL_GFX_TEX1
Definition: hal_gfx_graphics.h:32
hal_gfx_sys_defs.h
hal_gfx_set_const_reg
void hal_gfx_set_const_reg(int reg, uint32_t value)
Write a value to a Constant Register of the GPU.
hal_gfx_draw_line
void hal_gfx_draw_line(int x0, int y0, int x1, int y1, uint32_t rgba8888)
Draw a colored line, hal_gfx_rgba()
hal_gfx_ext_hold_enable
void hal_gfx_ext_hold_enable(uint32_t hold_id)
Enable external hold signals.
hal_gfx_brk_continue
void hal_gfx_brk_continue(void)
Instruct the GPU to resume execution.
HAL_GFX_TEX2
@ HAL_GFX_TEX2
Definition: hal_gfx_graphics.h:33
HAL_GFX_CULL_NONE
@ HAL_GFX_CULL_NONE
Definition: hal_gfx_graphics.h:41
hal_gfx_blit_subrect_fit
void hal_gfx_blit_subrect_fit(int dst_x, int dst_y, int dst_w, int dst_h, int src_x, int src_y, int src_w, int src_h)
Blit part of source texture to destination. Fit (scale) texture to specified rectangle.
hal_gfx_bind_src2_tex
void hal_gfx_bind_src2_tex(uintptr_t baseaddr_phys, uint32_t width, uint32_t height, hal_gfx_tex_format_t format, int32_t stride, hal_gfx_tex_mode_t mode)
Program Texture Unit with a background texture (HAL_GFX_TEX2)
hal_gfx_blit_rounded
void hal_gfx_blit_rounded(int x, int y, int r)
Blit source texture to destination texture with rounded corners.
hal_gfx_format_size
int hal_gfx_format_size(hal_gfx_tex_format_t format)
Return pixel size in bytes.
hal_gfx_ext_hold_assert
void hal_gfx_ext_hold_assert(uint32_t hold_id, int stop)
Assert hold signals internally via a Command List.
hal_gfx_clear_dirty_region
void hal_gfx_clear_dirty_region(void)
Clear dirty region information - runs via the bound command-list, hal_gfx_get_dirty_region(),...
hal_gfx_tri_cull
void hal_gfx_tri_cull(hal_gfx_tri_cull_t cull)
Set triangle/quadrilateral culling mode.
hal_gfx_blit_rotate_partial
void hal_gfx_blit_rotate_partial(int sx, int sy, int sw, int sh, int x, int y, uint32_t rotation)
Rotate and Blit partial source texture to destination.
HAL_GFX_TEX3
@ HAL_GFX_TEX3
Definition: hal_gfx_graphics.h:34
hal_gfx_bind_depth_buffer
void hal_gfx_bind_depth_buffer(uintptr_t baseaddr_phys, uint32_t width, uint32_t height)
Bind Depth Buffer.
HAL_GFX_TEX0
@ HAL_GFX_TEX0
Definition: hal_gfx_graphics.h:31
hal_gfx_draw_circle
void hal_gfx_draw_circle(int x, int y, int r, uint32_t rgba8888)
Draw a colored circle with 1 pixel width, hal_gfx_rgba()
hal_gfx_blit_subrect
void hal_gfx_blit_subrect(int dst_x, int dst_y, int w, int h, int src_x, int src_y)
Blit part of a source texture to destination's specified rectangle (crop or wrap when needed)
hal_gfx_fill_rounded_rect
void hal_gfx_fill_rounded_rect(int x0, int y0, int w, int h, int r, uint32_t rgba8888)
Fill a rectangle with rounded edges with color.
hal_gfx_brk_disable
void hal_gfx_brk_disable(void)
Disable breakpoints.
hal_gfx_clear_dirty_region_imm
void hal_gfx_clear_dirty_region_imm(void)
Clear dirty region information immediately, no command-list involved, hal_gfx_get_dirty_region(),...
hal_gfx_draw_circle_aa
void hal_gfx_draw_circle_aa(float x, float y, float r, float w, uint32_t rgba8888)
Draw a colored circle with Anti-Aliasing (if available) and specified width, hal_gfx_rgba()
HAL_GFX_CULL_CW
@ HAL_GFX_CULL_CW
Definition: hal_gfx_graphics.h:42
HAL_GFX_NOTEX
@ HAL_GFX_NOTEX
Definition: hal_gfx_graphics.h:30
hal_gfx_blit
void hal_gfx_blit(int x, int y)
Blit source texture to destination texture.
HAL_GFX_CULL_ALL
@ HAL_GFX_CULL_ALL
Definition: hal_gfx_graphics.h:44
hal_gfx_brk_wait
int hal_gfx_brk_wait(int brk_id)
Add a breakpoint to the current Command List.
hal_gfx_blit_subrect_quad_fit
void hal_gfx_blit_subrect_quad_fit(float dx0, float dy0, float dx1, float dy1, float dx2, float dy2, float dx3, float dy3, int sx, int sy, int sw, int sh)
Blit source texture to destination. Fit rectangulare area of texture to specified quadrilateral.
hal_gfx_ext_hold_assert_imm
void hal_gfx_ext_hold_assert_imm(uint32_t hold_id)
Assert hold signals from the CPU (no Command List)
hal_gfx_ext_hold_irq_enable
void hal_gfx_ext_hold_irq_enable(uint32_t hold_id)
Enable Interrupt Request when GPU reaches hold point.
hal_gfx_ext_hold_deassert_imm
void hal_gfx_ext_hold_deassert_imm(uint32_t hold_id)
Dessert hold signals from the CPU (no Command List)
hal_gfx_tex_mode_t
uint8_t hal_gfx_tex_mode_t
Definition: hal_gfx_graphics.h:148
hal_gfx_draw_line_aa
void hal_gfx_draw_line_aa(float x0, float y0, float x1, float y1, float w, uint32_t rgba8888)
Draw a line with width. Apply AA if available, hal_gfx_rgba(), hal_gfx_draw_line()
hal_gfx_brk_add
int hal_gfx_brk_add(void)
Add a breakpoint to the current Command List.
hal_gfx_blit_rect
void hal_gfx_blit_rect(int x, int y, int w, int h)
Blit source texture to destination's specified rectangle (crop or wrap when needed)
hal_gfx_brk_enable
void hal_gfx_brk_enable(void)
Enable breakpoints.
hal_gfx_tri_cull_t
hal_gfx_tri_cull_t
Graphics Triangle Culling methond.
Definition: hal_gfx_graphics.h:40
hal_gfx_blit_rotate_pivot_scale
void hal_gfx_blit_rotate_pivot_scale(float cx, float cy, float px, float py, float degrees_cw, float scale)
Rotate around pivot point and Blit source texture.
hal_gfx_rgba
uint32_t hal_gfx_rgba(unsigned char R, unsigned char G, unsigned char B, unsigned char A)
Return Nema internal RGBA color.
hal_gfx_fill_quad_f
void hal_gfx_fill_quad_f(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, uint32_t rgba8888)
Fill a quadrilateral with color (float coordinates)
HAL_GFX_CULL_CCW
@ HAL_GFX_CULL_CCW
Definition: hal_gfx_graphics.h:43
hal_gfx_get_clip
void hal_gfx_get_clip(int32_t *x, int32_t *y, uint32_t *w, uint32_t *h)
Gets the drawing area's Clipping Rectangle.
hal_gfx_tex_t
hal_gfx_tex_t
Graphics Texture.
Definition: hal_gfx_graphics.h:29
hal_gfx_fill_circle
void hal_gfx_fill_circle(int x, int y, int r, uint32_t rgba8888)
Fill a circle with color, hal_gfx_rgba()
hal_gfx_init
int hal_gfx_init(void)
Initialize hal_gfx library.