Functions
Public Functions
Graphics » HAL GFX » GFX GRAPHICS » Functions
Collaboration diagram for Public Functions:

## Functions
int | hal_gfx_checkGPUPresence (void)
| Check if a known GPU is present. More...
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. More...
void | hal_gfx_set_tex_color (uint32_t color)
| Set Texture Mapping default color. More...
void | hal_gfx_set_const_reg (int reg, uint32_t value)
| Write a value to a Constant Register of the GPU. More...
void | hal_gfx_set_clip (int32_t x, int32_t y, uint32_t w, uint32_t h)
| Sets the drawing area's Clipping Rectangle. More...
void | hal_gfx_get_clip (int32_t *x, int32_t *y, uint32_t *w, uint32_t *h)
| Gets the drawing area's Clipping Rectangle. More...
void | hal_gfx_enable_gradient (int enable)
| Enable color gradient. More...
void | hal_gfx_enable_depth (int enable)
| Enable depth. More...
uint32_t | hal_gfx_enable_aa (uint8_t e0, uint8_t e1, uint8_t e2, uint8_t e3)
| Enables MSAA per edge. More...
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. More...
void | hal_gfx_clear_dirty_region (void)
| Clear dirty region information - runs via the bound command-list, hal_gfx_get_dirty_region(), hal_gfx_clear_dirty_region() More...
void | hal_gfx_clear_dirty_region_imm (void)
| Clear dirty region information immediately, no command-list involved, hal_gfx_get_dirty_region(), hal_gfx_clear_dirty_region_imm() More...
void | hal_gfx_tri_cull (hal_gfx_tri_cull_t cull)
| Set triangle/quadrilateral culling mode. More...
int | hal_gfx_format_size (hal_gfx_tex_format_t format)
| Return pixel size in bytes. More...
int | hal_gfx_stride_size (hal_gfx_tex_format_t format, hal_gfx_tex_mode_t wrap_mode, int width)
| Return stride in bytes. More...
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. More...
uint32_t | hal_gfx_rgba (unsigned char R, unsigned char G, unsigned char B, unsigned char A)
| Return Nema internal RGBA color. More...
uint32_t | hal_gfx_premultiply_rgba (uint32_t rgba)
| Premultiply RGB channels with Alpha channel. More...
int | hal_gfx_init (void)
| Initialize hal_gfx library. More...
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) More...
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) More...
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) More...
void | hal_gfx_bind_depth_buffer (uintptr_t baseaddr_phys, uint32_t width, uint32_t height)
| Bind Depth Buffer. More...
void | hal_gfx_clear (uint32_t rgba8888)
| Clear destination texture with color. More...
void | hal_gfx_clear_depth (uint32_t val)
| Clear depth buffer with specified value. More...
void | hal_gfx_draw_line (int x0, int y0, int x1, int y1, uint32_t rgba8888)
| Draw a colored line, hal_gfx_rgba() More...
void | hal_gfx_draw_line_aa (float x0, float y0, float x1, float y1, float w, uint32_t rgba8888)
| Draw a line with width. More...
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() More...
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() More...
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() More...
void | hal_gfx_draw_rect (int x, int y, int w, int h, uint32_t rgba8888)
| Draw a colored rectangle, hal_gfx_rgba() More...
void | hal_gfx_fill_circle (int x, int y, int r, uint32_t rgba8888)
| Fill a circle with color, hal_gfx_rgba() More...
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() More...
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. More...
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. More...
void | hal_gfx_fill_rect (int x, int y, int w, int h, uint32_t rgba8888)
| Fill a rectangle with color. More...
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. More...
void | hal_gfx_fill_rect_f (float x, float y, float w, float h, uint32_t rgba8888)
| Fill a rectangle with color (float coordinates) More...
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) More...
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) More...
void | hal_gfx_blit (int x, int y)
| Blit source texture to destination texture. More...
void | hal_gfx_blit_rounded (int x, int y, int r)
| Blit source texture to destination texture with rounded corners. More...
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) More...
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) More...
void | hal_gfx_blit_rect_fit (int x, int y, int w, int h)
| Blit source texture to destination. More...
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. More...
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. More...
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. More...
void | hal_gfx_blit_rotate (int x, int y, uint32_t rotation)
| Rotate and Blit source texture to destination. More...
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. More...
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. More...
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. More...
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. More...
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. More...

## Detailed Description

## Function Documentation

## ◆ hal_gfx_bind_depth_buffer()

void hal_gfx_bind_depth_buffer | ( | uintptr_t | baseaddr_phys,
|  | uint32_t | width,
|  | uint32_t | height
| ) |  |

Bind Depth Buffer.

Parameters

  [in] | baseaddr_phys | Address of the depth buffer, as seen by the GPU
  [in] | width | Buffer width
  [in] | height | Buffer hight

## ◆ 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)

Parameters

  [in] | baseaddr_phys | Address of the destination texture, as seen by the GPU
  [in] | width | Texture width
  [in] | height | Texture hight
  [in] | format | Texture format
  [in] | stride | Texture stride. If negative, it's calculated internally

## ◆ 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)

Parameters

  [in] | baseaddr_phys | Address of the source2 texture, as seen by the GPU
  [in] | width | Texture width
  [in] | height | Texture hight
  [in] | format | Texture format
  [in] | stride | Texture stride. If negative, it's calculated internally
  [in] | mode | Wrapping and Filtering mode

## ◆ 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)

Parameters

  [in] | baseaddr_phys | Address of the source texture, as seen by the GPU
  [in] | width | Texture width
  [in] | height | Texture hight
  [in] | format | Texture format
  [in] | stride | Texture stride. If negative, it's calculated internally
  [in] | mode | Wrapping and Filtering mode

## ◆ 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.

Parameters

  [in] | texid | Texture unit to be programmed
  [in] | addr_gpu | Texture's address as seen by the GPU
  [in] | width | Texture's width
  [in] | height | Texture's height
  [in] | format | Texture's format
  [in] | stride | Texture's stride. If stride < 0, it's left to be calculated
  [in] | wrap_mode | Wrap/Repeat mode to be used

## ◆ hal_gfx_blit()

void hal_gfx_blit | ( | int | x,
|  | int | y
| ) |  |

Blit source texture to destination texture.

Note
  The width and height of the destination for the fast blit function depends on the foreground (source) texture (HAL_GFX_TEX1) When the background texture (HAL_GFX_TEX2) is in effect, the background texture is always at (0,0) and will not be offset according to the destination x and y coordinates.

Parameters

  [in] | x | destination x coordinate
  [in] | y | destination y coordinate

## ◆ 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

Parameters

  [in] | dx0 | x coordinate at the first vertex of the quadrilateral
  [in] | dy0 | y coordinate at the first vertex of the quadrilateral
  [in] | dx1 | x coordinate at the second vertex of the quadrilateral
  [in] | dy1 | y coordinate at the second vertex of the quadrilateral
  [in] | dx2 | x coordinate at the third vertex of the quadrilateral
  [in] | dy2 | y coordinate at the third vertex of the quadrilateral
  [in] | dx3 | x coordinate at the fourth vertex of the quadrilateral
  [in] | dy3 | y coordinate at the fourth vertex of the quadrilateral

## ◆ 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)

Parameters

  [in] | x | destination x coordinate
  [in] | y | destination y coordinate
  [in] | w | destination width
  [in] | h | destination height

## ◆ 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

Parameters

  [in] | x | destination x coordinate
  [in] | y | destination y coordinate
  [in] | w | destination width
  [in] | h | destination height

## ◆ hal_gfx_blit_rotate()

void hal_gfx_blit_rotate | ( | int | x,
|  | int | y,
|  | uint32_t | rotation
| ) |  |

Rotate and Blit source texture to destination.

Parameters

  [in] | x | destination x coordinate
  [in] | y | destination y coordinate
  [in] | rotation | Rotation to be done

## ◆ 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.

Parameters

  [in] | sx | source upper left x coordinate
  [in] | sy | source upper left y coordinate
  [in] | sw | source width of partial region
  [in] | sh | source height of partial region
  [in] | x | destination x coordinate
  [in] | y | destination y coordinate
  [in] | rotation | Rotation to be done

## ◆ 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.

Parameters

  [in] | cx | destination rotation center x coordinate
  [in] | cy | destination rotation center y coordinate
  [in] | px | source pivot point x coordinate
  [in] | py | source pivot point y coordinate
  [in] | degrees_cw | degrees of clockwise rotation in range [0, 360]

## ◆ 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.

Parameters

  [in] | cx | destination rotation center x coordinate
  [in] | cy | destination rotation center y coordinate
  [in] | px | source pivot point x coordinate
  [in] | py | source pivot point y coordinate
  [in] | degrees_cw | degrees of clockwise rotation in range [0, 360]
  [in] | scale | the ratio of zoom in / zoom out, > 1.0 zoom out, < 1.0 zoom in

## ◆ hal_gfx_blit_rounded()

void hal_gfx_blit_rounded | ( | int | x,
|  | int | y,
|  | int | r
| ) |  |

Blit source texture to destination texture with rounded corners.

Parameters

  [in] | x | destination x coordinate
  [in] | y | destination y coordinate
  [in] | r | destination corner radius

## ◆ 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)

Parameters

  [in] | dst_x | destination x coordinate
  [in] | dst_y | destination y coordinate
  [in] | w | destination width
  [in] | h | destination height
  [in] | src_x | source x coordinate
  [in] | src_y | source y coordinate

## ◆ 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

Parameters

  [in] | dst_x | destination x coordinate
  [in] | dst_y | destination y coordinate
  [in] | dst_w | destination width
  [in] | dst_h | destination height
  [in] | src_x | source x coordinate
  [in] | src_y | source y coordinate
  [in] | src_w | source width
  [in] | src_h | source height

## ◆ 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

Parameters

  [in] | dx0 | x coordinate at the first vertex of the quadrilateral
  [in] | dy0 | y coordinate at the first vertex of the quadrilateral
  [in] | dx1 | x coordinate at the second vertex of the quadrilateral
  [in] | dy1 | y coordinate at the second vertex of the quadrilateral
  [in] | dx2 | x coordinate at the third vertex of the quadrilateral
  [in] | dy2 | y coordinate at the third vertex of the quadrilateral
  [in] | dx3 | x coordinate at the fourth vertex of the quadrilateral
  [in] | dy3 | y coordinate at the fourth vertex of the quadrilateral
  [in] | sx | x coordinate of the top left corner of the texture's rectangular area to be blitted
  [in] | sy | y coordinate of the top left corner of the texture's rectangular area to be blitted
  [in] | sw | width of the texture's rectangular area to be blitted
  [in] | sh | height of the texture's rectangular area to be blitted

## ◆ 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

Parameters

  [in] | dx0 | x coordinate at the first vertex of the triangle
  [in] | dy0 | y coordinate at the first vertex of the triangle
  [in] | v0 | in [0, 3] indicates the corner of the texture that fits to the first vertex of the triangle 0 _ _ 1 |_ _| 3 2
  [in] | dx1 | x coordinate at the second vertex of the triangle
  [in] | dy1 | y coordinate at the second vertex of the triangle
  [in] | v1 | in [0, 3] indicates the corner of the texture that fits to the second vertex of the triangle
  [in] | dx2 | x coordinate at the third vertex of the triangle
  [in] | dy2 | y coordinate at the third vertex of the triangle
  [in] | v2 | in [0, 3] indicates the corner of the texture that fits to the third vertex of the triangle

## ◆ 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.

Parameters

  [in] | dx0 | x coordinate at the first vertex of the destination triangle
  [in] | dy0 | y coordinate at the first vertex of the destination triangle
  [in] | dw0 | w coordinate at the first vertex of the destination triangle
  [in] | dx1 | x coordinate at the second vertex of the destination triangle
  [in] | dy1 | y coordinate at the second vertex of the destination triangle
  [in] | dw1 | w coordinate at the second vertex of the destination triangle
  [in] | dx2 | x coordinate at the third vertex of the destination triangle
  [in] | dy2 | y coordinate at the third vertex of the destination triangle
  [in] | dw2 | w coordinate at the third vertex of the destination triangle
  [in] | sx0 | x coordinate at the first vertex of the source triangle
  [in] | sy0 | y coordinate at the first vertex of the source triangle
  [in] | sx1 | x coordinate at the second vertex of the source triangle
  [in] | sy1 | y coordinate at the second vertex of the source triangle
  [in] | sx2 | x coordinate at the third vertex of the source triangle
  [in] | sy2 | y coordinate at the third vertex of the source triangle

## ◆ hal_gfx_checkGPUPresence()

int hal_gfx_checkGPUPresence | ( | void |  | ) |

Check if a known GPU is present.

Returns
  Return -1 if no known GPU is present

## ◆ hal_gfx_clear()

void hal_gfx_clear | ( | uint32_t | rgba8888 | ) |

Clear destination texture with color.

Parameters

  [in] | rgba8888 | 32-bit RGBA color

## ◆ hal_gfx_clear_depth()

void hal_gfx_clear_depth | ( | uint32_t | val | ) |

Clear depth buffer with specified value.

Parameters

  [in] | val | Clear value

## ◆ 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_clear_dirty_region()

Return values

  None |

## ◆ 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_clear_dirty_region_imm()

Return values

  None |

## ◆ 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()

Parameters

  [in] | x | x coordinate of the circle's center
  [in] | y | y coordinate of the circle's center
  [in] | r | circle's radius
  [in] | rgba8888 | Color to be used

## ◆ 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()

Parameters

  [in] | x | x coordinate of the circle's center
  [in] | y | y coordinate of the circle's center
  [in] | r | circle's radius
  [in] | w | pencil width
  [in] | rgba8888 | Color to be used

## ◆ 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()

Parameters

  [in] | x0 | x coordinate at the beginning of the line
  [in] | y0 | y coordinate at the beginning of the line
  [in] | x1 | x coordinate at the end of the line
  [in] | y1 | y coordinate at the end of the line
  [in] | rgba8888 | Color to be used

## ◆ 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()

Parameters

  [in] | x0 | x coordinate at the beginning of the line
  [in] | y0 | y coordinate at the beginning of the line
  [in] | x1 | x coordinate at the end of the line
  [in] | y1 | y coordinate at the end of the line
  [in] | w | line width
  [in] | rgba8888 | Color to be used

## ◆ 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()

Parameters

  [in] | x | x coordinate of the upper left vertex of the rectangle
  [in] | y | y coordinate at the upper left vertex of the rectangle
  [in] | w | width of the rectangle
  [in] | h | height of the rectangle
  [in] | rgba8888 | Color to be used

## ◆ 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()

Parameters

  [in] | x0 | x coordinate of the upper left vertex of the rectangle
  [in] | y0 | y coordinate at the upper left vertex of the rectangle
  [in] | w | width of the rectangle
  [in] | h | height of the rectangle
  [in] | r | corner radius
  [in] | rgba8888 | Color to be used

## ◆ 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.

Parameters

  [in] | e0 | Enable MSAA for edge 0 (vertices 0-1)
  [in] | e1 | Enable MSAA for edge 1 (vertices 1-2)
  [in] | e2 | Enable MSAA for edge 2 (vertices 2-3)
  [in] | e3 | Enable MSAA for edge 3 (vertices 3-0)

Returns
  previous AA flags (may be ignored)

## ◆ hal_gfx_enable_depth()

void hal_gfx_enable_depth | ( | int | enable | ) |

Enable depth.

Parameters

  [in] | enable | !0 enable, 0 disable

## ◆ hal_gfx_enable_gradient()

void hal_gfx_enable_gradient | ( | int | enable | ) |

Enable color gradient.

Parameters

  [in] | enable | !0 enable, 0 disable

## ◆ 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()

Parameters

  [in] | x | x coordinate of the circle's center
  [in] | y | y coordinate of the circle's center
  [in] | r | circle's radius
  [in] | rgba8888 | Color to be used

## ◆ 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()

Parameters

  [in] | x | x coordinate of the circle's center
  [in] | y | y coordinate of the circle's center
  [in] | r | circle's radius
  [in] | rgba8888 | Color to be used

## ◆ 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.

Parameters

  [in] | x0 | x coordinate at the first vertex of the quadrilateral
  [in] | y0 | y coordinate at the first vertex of the quadrilateral
  [in] | x1 | x coordinate at the second vertex of the quadrilateral
  [in] | y1 | y coordinate at the second vertex of the quadrilateral
  [in] | x2 | x coordinate at the third vertex of the quadrilateral
  [in] | y2 | y coordinate at the third vertex of the quadrilateral
  [in] | x3 | x coordinate at the fourth vertex of the quadrilateral
  [in] | y3 | y coordinate at the fourth vertex of the quadrilateral
  [in] | rgba8888 | Color to be used

## ◆ 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)

Parameters

  [in] | x0 | x coordinate at the first vertex of the quadrilateral
  [in] | y0 | y coordinate at the first vertex of the quadrilateral
  [in] | x1 | x coordinate at the second vertex of the quadrilateral
  [in] | y1 | y coordinate at the second vertex of the quadrilateral
  [in] | x2 | x coordinate at the third vertex of the quadrilateral
  [in] | y2 | y coordinate at the third vertex of the quadrilateral
  [in] | x3 | x coordinate at the fourth vertex of the quadrilateral
  [in] | y3 | y coordinate at the fourth vertex of the quadrilateral
  [in] | rgba8888 | Color to be used

## ◆ 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.

Parameters

  [in] | x | x coordinate of the upper left vertex of the rectangle
  [in] | y | y coordinate at the upper left vertex of the rectangle
  [in] | w | width of the rectangle
  [in] | h | height of the rectangle
  [in] | rgba8888 | Color to be used

## ◆ 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)

Parameters

  [in] | x | x coordinate of the upper left vertex of the rectangle
  [in] | y | y coordinate at the upper left vertex of the rectangle
  [in] | w | width of the rectangle
  [in] | h | height of the rectangle
  [in] | rgba8888 | Color to be used

## ◆ 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.

Parameters

  [in] | x0 | x coordinate of the upper left vertex of the rectangle
  [in] | y0 | y coordinate at the upper left vertex of the rectangle
  [in] | w | width of the rectangle
  [in] | h | height of the rectangle
  [in] | r | corner radius
  [in] | rgba8888 | Color to be used

## ◆ 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.

Parameters

  [in] | x0 | x coordinate at the first vertex of the triangle
  [in] | y0 | y coordinate at the first vertex of the triangle
  [in] | x1 | x coordinate at the second vertex of the triangle
  [in] | y1 | y coordinate at the second vertex of the triangle
  [in] | x2 | x coordinate at the third vertex of the triangle
  [in] | y2 | y coordinate at the third vertex of the triangle
  [in] | rgba8888 | Color to be used

## ◆ 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)

Parameters

  [in] | x0 | x coordinate at the first vertex of the triangle
  [in] | y0 | y coordinate at the first vertex of the triangle
  [in] | x1 | x coordinate at the second vertex of the triangle
  [in] | y1 | y coordinate at the second vertex of the triangle
  [in] | x2 | x coordinate at the third vertex of the triangle
  [in] | y2 | y coordinate at the third vertex of the triangle
  [in] | rgba8888 | Color to be used

## ◆ hal_gfx_format_size()

int hal_gfx_format_size | ( | hal_gfx_tex_format_t | format | ) |

Return pixel size in bytes.

Parameters

  [in] | format | Color format

Returns
  Return Pixel size in bytes

## ◆ 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.

Parameters

  [in] | x | pointer to Clip Window top-left x coordinate
  [in] | y | pointer to Clip Window minimum y
  [in] | w | pointer to Clip Window width
  [in] | h | pointer to Clip Window height

## ◆ 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.

Parameters

  [out] | minx | x coordinate of the upper left corner of the dirty region
  [out] | miny | y coordinate of the upper left corner of the dirty region
  [out] | maxx | x coordinate of the lower right corner of the dirty region
  [out] | maxy | y coordinate of the lower right corner of the dirty region

## ◆ hal_gfx_init()

int hal_gfx_init | ( | void |  | ) |

Initialize hal_gfx library.

Returns
  Return negative value on error

## ◆ hal_gfx_premultiply_rgba()

uint32_t hal_gfx_premultiply_rgba | ( | uint32_t | rgba | ) |

Premultiply RGB channels with Alpha channel.

Parameters

  [in] | rgba | RGBA color

Returns
  Premultiplied RGBA color

## ◆ 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.

Parameters

  [in] | R | Red component
  [in] | G | Green component
  [in] | B | Blue component
  [in] | A | Alpha component

Returns
  Return RGBA value

## ◆ 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.

Parameters

  [in] | x | Clip Window top-left x coordinate
  [in] | y | Clip Window minimum y
  [in] | w | Clip Window width
  [in] | h | Clip Window height

## ◆ 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.

Parameters

  [in] | reg | Constant Register to be written
  [in] | value | Value to be written

## ◆ hal_gfx_set_tex_color()

void hal_gfx_set_tex_color | ( | uint32_t | color | ) |

Set Texture Mapping default color.

Parameters

  [in] | color | default color in 32-bit RGBA format, hal_gfx_rgba()

## ◆ 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.

Parameters

  [in] | format | Color format
  [in] | wrap_mode | Wrap/Repeat mode to be used
  [in] | width | Texture color format

Returns
  Return stride in bytes

## ◆ 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.

Parameters

  [in] | format | Texture color format
  [in] | wrap_mode | Wrap/Repeat mode to be used
  [in] | width | Texture width
  [in] | height | Texture height

Returns
  Return Texture size in bytes

## ◆ hal_gfx_tri_cull()

void hal_gfx_tri_cull | ( | hal_gfx_tri_cull_t | cull | ) |

Set triangle/quadrilateral culling mode.

Parameters

  [in] | cull | Culling mode, hal_gfx_tri_cull_t