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