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. Apply AA if available, hal_gfx_rgba(), hal_gfx_draw_line() 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. Fit (scale) texture to specified rectangle. 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. Fit (scale) texture to specified rectangle. 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. Fit texture to specified triangle. 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. Fit texture to specified quadrilateral. 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. Fit rectangulare area of texture to specified quadrilateral. 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_physAddress of the depth buffer, as seen by the GPU
[in]widthBuffer width
[in]heightBuffer 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_physAddress of the destination texture, as seen by the GPU
[in]widthTexture width
[in]heightTexture hight
[in]formatTexture format
[in]strideTexture 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_physAddress of the source2 texture, as seen by the GPU
[in]widthTexture width
[in]heightTexture hight
[in]formatTexture format
[in]strideTexture stride. If negative, it's calculated internally
[in]modeWrapping 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_physAddress of the source texture, as seen by the GPU
[in]widthTexture width
[in]heightTexture hight
[in]formatTexture format
[in]strideTexture stride. If negative, it's calculated internally
[in]modeWrapping 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]texidTexture unit to be programmed
[in]addr_gpuTexture's address as seen by the GPU
[in]widthTexture's width
[in]heightTexture's height
[in]formatTexture's format
[in]strideTexture's stride. If stride < 0, it's left to be calculated
[in]wrap_modeWrap/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]xdestination x coordinate
[in]ydestination 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]dx0x coordinate at the first vertex of the quadrilateral
[in]dy0y coordinate at the first vertex of the quadrilateral
[in]dx1x coordinate at the second vertex of the quadrilateral
[in]dy1y coordinate at the second vertex of the quadrilateral
[in]dx2x coordinate at the third vertex of the quadrilateral
[in]dy2y coordinate at the third vertex of the quadrilateral
[in]dx3x coordinate at the fourth vertex of the quadrilateral
[in]dy3y 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]xdestination x coordinate
[in]ydestination y coordinate
[in]wdestination width
[in]hdestination 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]xdestination x coordinate
[in]ydestination y coordinate
[in]wdestination width
[in]hdestination 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]xdestination x coordinate
[in]ydestination y coordinate
[in]rotationRotation 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]sxsource upper left x coordinate
[in]sysource upper left y coordinate
[in]swsource width of partial region
[in]shsource height of partial region
[in]xdestination x coordinate
[in]ydestination y coordinate
[in]rotationRotation 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]cxdestination rotation center x coordinate
[in]cydestination rotation center y coordinate
[in]pxsource pivot point x coordinate
[in]pysource pivot point y coordinate
[in]degrees_cwdegrees 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]cxdestination rotation center x coordinate
[in]cydestination rotation center y coordinate
[in]pxsource pivot point x coordinate
[in]pysource pivot point y coordinate
[in]degrees_cwdegrees of clockwise rotation in range [0, 360]
[in]scalethe 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]xdestination x coordinate
[in]ydestination y coordinate
[in]rdestination 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_xdestination x coordinate
[in]dst_ydestination y coordinate
[in]wdestination width
[in]hdestination height
[in]src_xsource x coordinate
[in]src_ysource 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_xdestination x coordinate
[in]dst_ydestination y coordinate
[in]dst_wdestination width
[in]dst_hdestination height
[in]src_xsource x coordinate
[in]src_ysource y coordinate
[in]src_wsource width
[in]src_hsource 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]dx0x coordinate at the first vertex of the quadrilateral
[in]dy0y coordinate at the first vertex of the quadrilateral
[in]dx1x coordinate at the second vertex of the quadrilateral
[in]dy1y coordinate at the second vertex of the quadrilateral
[in]dx2x coordinate at the third vertex of the quadrilateral
[in]dy2y coordinate at the third vertex of the quadrilateral
[in]dx3x coordinate at the fourth vertex of the quadrilateral
[in]dy3y coordinate at the fourth vertex of the quadrilateral
[in]sxx coordinate of the top left corner of the texture's rectangular area to be blitted
[in]syy coordinate of the top left corner of the texture's rectangular area to be blitted
[in]swwidth of the texture's rectangular area to be blitted
[in]shheight 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]dx0x coordinate at the first vertex of the triangle
[in]dy0y coordinate at the first vertex of the triangle
[in]v0in [0, 3] indicates the corner of the texture that fits to the first vertex of the triangle 0 _ _ 1 |_ _| 3 2
[in]dx1x coordinate at the second vertex of the triangle
[in]dy1y coordinate at the second vertex of the triangle
[in]v1in [0, 3] indicates the corner of the texture that fits to the second vertex of the triangle
[in]dx2x coordinate at the third vertex of the triangle
[in]dy2y coordinate at the third vertex of the triangle
[in]v2in [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]dx0x coordinate at the first vertex of the destination triangle
[in]dy0y coordinate at the first vertex of the destination triangle
[in]dw0w coordinate at the first vertex of the destination triangle
[in]dx1x coordinate at the second vertex of the destination triangle
[in]dy1y coordinate at the second vertex of the destination triangle
[in]dw1w coordinate at the second vertex of the destination triangle
[in]dx2x coordinate at the third vertex of the destination triangle
[in]dy2y coordinate at the third vertex of the destination triangle
[in]dw2w coordinate at the third vertex of the destination triangle
[in]sx0x coordinate at the first vertex of the source triangle
[in]sy0y coordinate at the first vertex of the source triangle
[in]sx1x coordinate at the second vertex of the source triangle
[in]sy1y coordinate at the second vertex of the source triangle
[in]sx2x coordinate at the third vertex of the source triangle
[in]sy2y 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]rgba888832-bit RGBA color

◆ hal_gfx_clear_depth()

void hal_gfx_clear_depth ( uint32_t  val)

Clear depth buffer with specified value.

Parameters
[in]valClear 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]xx coordinate of the circle's center
[in]yy coordinate of the circle's center
[in]rcircle's radius
[in]rgba8888Color 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]xx coordinate of the circle's center
[in]yy coordinate of the circle's center
[in]rcircle's radius
[in]wpencil width
[in]rgba8888Color 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]x0x coordinate at the beginning of the line
[in]y0y coordinate at the beginning of the line
[in]x1x coordinate at the end of the line
[in]y1y coordinate at the end of the line
[in]rgba8888Color 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]x0x coordinate at the beginning of the line
[in]y0y coordinate at the beginning of the line
[in]x1x coordinate at the end of the line
[in]y1y coordinate at the end of the line
[in]wline width
[in]rgba8888Color 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]xx coordinate of the upper left vertex of the rectangle
[in]yy coordinate at the upper left vertex of the rectangle
[in]wwidth of the rectangle
[in]hheight of the rectangle
[in]rgba8888Color 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]x0x coordinate of the upper left vertex of the rectangle
[in]y0y coordinate at the upper left vertex of the rectangle
[in]wwidth of the rectangle
[in]hheight of the rectangle
[in]rcorner radius
[in]rgba8888Color 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]e0Enable MSAA for edge 0 (vertices 0-1)
[in]e1Enable MSAA for edge 1 (vertices 1-2)
[in]e2Enable MSAA for edge 2 (vertices 2-3)
[in]e3Enable 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]xx coordinate of the circle's center
[in]yy coordinate of the circle's center
[in]rcircle's radius
[in]rgba8888Color 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]xx coordinate of the circle's center
[in]yy coordinate of the circle's center
[in]rcircle's radius
[in]rgba8888Color 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]x0x coordinate at the first vertex of the quadrilateral
[in]y0y coordinate at the first vertex of the quadrilateral
[in]x1x coordinate at the second vertex of the quadrilateral
[in]y1y coordinate at the second vertex of the quadrilateral
[in]x2x coordinate at the third vertex of the quadrilateral
[in]y2y coordinate at the third vertex of the quadrilateral
[in]x3x coordinate at the fourth vertex of the quadrilateral
[in]y3y coordinate at the fourth vertex of the quadrilateral
[in]rgba8888Color 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]x0x coordinate at the first vertex of the quadrilateral
[in]y0y coordinate at the first vertex of the quadrilateral
[in]x1x coordinate at the second vertex of the quadrilateral
[in]y1y coordinate at the second vertex of the quadrilateral
[in]x2x coordinate at the third vertex of the quadrilateral
[in]y2y coordinate at the third vertex of the quadrilateral
[in]x3x coordinate at the fourth vertex of the quadrilateral
[in]y3y coordinate at the fourth vertex of the quadrilateral
[in]rgba8888Color 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]xx coordinate of the upper left vertex of the rectangle
[in]yy coordinate at the upper left vertex of the rectangle
[in]wwidth of the rectangle
[in]hheight of the rectangle
[in]rgba8888Color 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]xx coordinate of the upper left vertex of the rectangle
[in]yy coordinate at the upper left vertex of the rectangle
[in]wwidth of the rectangle
[in]hheight of the rectangle
[in]rgba8888Color 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]x0x coordinate of the upper left vertex of the rectangle
[in]y0y coordinate at the upper left vertex of the rectangle
[in]wwidth of the rectangle
[in]hheight of the rectangle
[in]rcorner radius
[in]rgba8888Color 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]x0x coordinate at the first vertex of the triangle
[in]y0y coordinate at the first vertex of the triangle
[in]x1x coordinate at the second vertex of the triangle
[in]y1y coordinate at the second vertex of the triangle
[in]x2x coordinate at the third vertex of the triangle
[in]y2y coordinate at the third vertex of the triangle
[in]rgba8888Color 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]x0x coordinate at the first vertex of the triangle
[in]y0y coordinate at the first vertex of the triangle
[in]x1x coordinate at the second vertex of the triangle
[in]y1y coordinate at the second vertex of the triangle
[in]x2x coordinate at the third vertex of the triangle
[in]y2y coordinate at the third vertex of the triangle
[in]rgba8888Color 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]formatColor 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]xpointer to Clip Window top-left x coordinate
[in]ypointer to Clip Window minimum y
[in]wpointer to Clip Window width
[in]hpointer 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]minxx coordinate of the upper left corner of the dirty region
[out]minyy coordinate of the upper left corner of the dirty region
[out]maxxx coordinate of the lower right corner of the dirty region
[out]maxyy 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]rgbaRGBA 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]RRed component
[in]GGreen component
[in]BBlue component
[in]AAlpha 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]xClip Window top-left x coordinate
[in]yClip Window minimum y
[in]wClip Window width
[in]hClip 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]regConstant Register to be written
[in]valueValue to be written

◆ hal_gfx_set_tex_color()

void hal_gfx_set_tex_color ( uint32_t  color)

Set Texture Mapping default color.

Parameters
[in]colordefault 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]formatColor format
[in]wrap_modeWrap/Repeat mode to be used
[in]widthTexture 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]formatTexture color format
[in]wrap_modeWrap/Repeat mode to be used
[in]widthTexture width
[in]heightTexture 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]cullCulling mode, hal_gfx_tri_cull_t