# GfxFuncs ## **Overview** **Related Modules:** [Display](display.md) **Description:** Defines pointers to the hardware acceleration driver functions. ## **Summary** ## Data Fields

Variable Name

Description

InitGfx )(void)

int32_t(*

Initializes hardware acceleration.

DeinitGfx )(void)

int32_t(*

Deinitializes hardware acceleration.

FillRect )(ISurface *surface, IRect *rect, uint32_t color, GfxOpt *opt)

int32_t(*

Fills a rectangle with a given color on the canvas.

DrawRectangle )(ISurface *surface, Rectangle *rect, uint32_t color, GfxOpt *opt)

int32_t(*

Draws a rectangle with a given color on the canvas.

DrawLine )(ISurface *surface, ILine *line, GfxOpt *opt)

int32_t(*

Draws a straight line with a given color on the canvas.

DrawCircle )(ISurface *surface, ICircle *circle, GfxOpt *opt)

int32_t(*

Draws a circle with a specified center and radius on the canvas using a given color.

Blit )(ISurface *srcSurface, IRect *srcRect, ISurface *dstSurface, IRect *dstRect)

int32_t(*

Blits bitmaps.

Sync )(void)

int32_t(*

Synchronizes hardware acceleration.

## **Details** ## **Field Documentation** ## Blit ``` int32_t(* GfxFuncs::Blit) ([ISurface](isurface.md) *srcSurface, [IRect](irect.md) *srcRect, [ISurface](isurface.md) *dstSurface, [IRect](irect.md) *dstRect) ``` **Description:** Blits bitmaps. During bit blit, color space conversion \(CSC\), scaling, and rotation can be implemented. **Parameters:**

Name

Description

srcSurface Indicates the pointer to the source bitmap.
srcRect Indicates the pointer to the rectangle of the source bitmap.
dstSurface Indicates the pointer to the destination bitmap.
dstRect Indicates the pointer to the rectangle of the destination bitmap.
**Returns:** Returns **0** if the operation is successful; returns an error code defined in [DispErrCode](display.md#ga12a925dadef7573cd74d63d06824f9b0) otherwise. **See also:** Blit3 ## DeinitGfx ``` int32_t(* GfxFuncs::DeinitGfx) (void) ``` **Description:** Deinitializes hardware acceleration. **Returns:** Returns **0** if the operation is successful; returns an error code defined in [DispErrCode](display.md#ga12a925dadef7573cd74d63d06824f9b0) otherwise. **See also:** [InitGfx](gfxfuncs.md#a3ec8ed6a467ed0c88e4dd723723c0f41) ## DrawCircle ``` int32_t(* GfxFuncs::DrawCircle) ([ISurface](isurface.md) *surface, [ICircle](icircle.md) *circle, [GfxOpt](gfxopt.md) *opt) ``` **Description:** Draws a circle with a specified center and radius on the canvas using a given color. **Parameters:**

Name

Description

surface Indicates the pointer to the canvas.
circle Indicates the pointer to the circle to draw.
opt Indicates the pointer to the hardware acceleration option.
**Returns:** Returns **0** if the operation is successful; returns an error code defined in [DispErrCode](display.md#ga12a925dadef7573cd74d63d06824f9b0) otherwise. ## DrawLine ``` int32_t(* GfxFuncs::DrawLine) ([ISurface](isurface.md) *surface, [ILine](iline.md) *line, [GfxOpt](gfxopt.md) *opt) ``` **Description:** Draws a straight line with a given color on the canvas. **Parameters:**

Name

Description

surface Indicates the pointer to the canvas.
line Indicates the pointer to the line to draw.
opt Indicates the pointer to the hardware acceleration option.
**Returns:** Returns **0** if the operation is successful; returns an error code defined in [DispErrCode](display.md#ga12a925dadef7573cd74d63d06824f9b0) otherwise. ## DrawRectangle ``` int32_t(* GfxFuncs::DrawRectangle) ([ISurface](isurface.md) *surface, [Rectangle](rectangle.md) *rect, uint32_t color, [GfxOpt](gfxopt.md) *opt) ``` **Description:** Draws a rectangle with a given color on the canvas. **Parameters:**

Name

Description

surface Indicates the pointer to the canvas.
rect Indicates the pointer to the rectangle to draw.
color Indicates the color to draw.
opt Indicates the pointer to the hardware acceleration option.
**Returns:** Returns **0** if the operation is successful; returns an error code defined in [DispErrCode](display.md#ga12a925dadef7573cd74d63d06824f9b0) otherwise. **See also:** [FillRect](gfxfuncs.md#a12cf050a4c0d76f9816008fb102c7330) ## FillRect ``` int32_t(* GfxFuncs::FillRect) ([ISurface](isurface.md) *surface, [IRect](irect.md) *rect, uint32_t color, [GfxOpt](gfxopt.md) *opt) ``` **Description:** Fills a rectangle with a given color on the canvas. **Parameters:**

Name

Description

surface Indicates the pointer to the canvas.
rect Indicates the pointer to the rectangle to fill.
color Indicates the color to fill.
opt Indicates the pointer to the hardware acceleration option.
**Returns:** Returns **0** if the operation is successful; returns an error code defined in [DispErrCode](display.md#ga12a925dadef7573cd74d63d06824f9b0) otherwise. ## InitGfx ``` int32_t(* GfxFuncs::InitGfx) (void) ``` **Description:** Initializes hardware acceleration. **Returns:** Returns **0** if the operation is successful; returns an error code defined in [DispErrCode](display.md#ga12a925dadef7573cd74d63d06824f9b0) otherwise. **See also:** [DeinitGfx](gfxfuncs.md#ad86b127aad2a6e7f01e07b77054d42b3) ## Sync ``` int32_t(* GfxFuncs::Sync) (void) ``` **Description:** Synchronizes hardware acceleration. Use this function for hardware acceleration synchronization when hardware acceleration is used to draw and blit bitmaps. This function blocks the process until hardware acceleration is complete. **Parameters:**

Name

Description

timeOut Indicates the timeout duration for hardware acceleration synchronization. The value 0 indicates no timeout, so the process waits until hardware acceleration is complete.
**Returns:** Returns **0** if the operation is successful; returns an error code defined in [DispErrCode](display.md#ga12a925dadef7573cd74d63d06824f9b0) otherwise.