MT2523 API Reference  LinkIt SDK v4
G2D

This section introduces the Graphics 2D (G2D) driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, G2D Manager function groups, enums, structures and functions. More...

Overview

This section introduces the Graphics 2D (G2D) driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, G2D Manager function groups, enums, structures and functions.

Terms and acronyms

Terms Details
G2D The Graphics 2D Standard. For more information, please refer to 2D computer graphics in Wikipedia.

Supported features

How to use this driver

Overlay:

Support four layer overlay. Layer 0 is the bottom layer while layer 3 is the top layer. The G2D engine applies the overlay from the lowest (bottom) layer to highest (top) layer.

Rotation:

The rotation function supports seven options, including rotation by 90, 180 and 270 degrees, mirror, mirror and rotate by 90 degrees,
mirror and rotate by 180 degrees, mirror and rotate by 270 degrees. The rotation direction is clockwise.

Rectfill:

Rectangle fill enables to fill the user-defined color into a rectangle.

How to use this driver

Functions

hal_g2d_status_t hal_g2d_init (void)
 This function initializes the G2D module. More...
 
hal_g2d_status_t hal_g2d_get_handle (hal_g2d_handle_t **handle_ptr, hal_g2d_codec_type_t codec_type, hal_g2d_get_handle_mode_t handle_mode)
 This function gets a G2D handle to access and control the G2D engine. More...
 
hal_g2d_status_t hal_g2d_release_handle (hal_g2d_handle_t *handle)
 This function releases the G2D handle and frees its associated resources occupied by this G2D handle. More...
 
hal_g2d_status_t hal_g2d_query_rgb_buffer_range (hal_g2d_handle_t *handle, uint32_t *min_width, uint32_t *max_width, uint32_t *min_height, uint32_t *max_height)
 This function queries the range of the destination buffer. More...
 
hal_g2d_status_t hal_g2d_register_callback (hal_g2d_handle_t *handle, hal_g2d_callback_t callback)
 This function registers a user-defined callback function for the G2D completion events. More...
 
hal_g2d_status_t hal_g2d_set_clipping_window (hal_g2d_handle_t *handle, int32_t x, int32_t y, int32_t width, int32_t height)
 The function sets the clipping window for the destination buffer. More...
 
hal_g2d_status_t hal_g2d_replace_color (hal_g2d_handle_t *handle, uint8_t alpha0, uint8_t red0, uint8_t green0, uint8_t blue0, uint8_t alpha1, uint8_t red1, uint8_t green1, uint8_t blue1)
 The color of the pixel that matches to the combination of the old set (alpha0, red0, green0, blue0) is replaced with the combination of the new set (alpha1, red1, green1, blue1). More...
 
hal_g2d_status_t hal_g2d_set_source_key (hal_g2d_handle_t *handle, uint8_t alpha, uint8_t red, uint8_t green, uint8_t blue)
 
hal_g2d_status_t hal_set_rgb_buffer (hal_g2d_handle_t *handle, uint8_t *buffer, uint32_t size, uint32_t width, uint32_t height, hal_g2d_color_format_t color_format)
 
hal_g2d_status_t hal_g2d_set_rgb_buffer (hal_g2d_handle_t *handle, uint8_t *buffer, uint32_t size, uint32_t width, uint32_t height, hal_g2d_color_format_t color_format)
 This function sets the destination buffer. More...
 
hal_g2d_status_t hal_g2d_get_status (hal_g2d_handle_t *handle)
 The function gets the status of G2D engine. More...
 
hal_g2d_status_t hal_g2d_query_support (hal_g2d_codec_type_t codec_type, hal_g2d_supported_function_t function_type)
 This function queries whether a particular function type is supported by the G2D engine. More...
 
hal_g2d_status_t hal_g2d_overlay_enable_layer (hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, bool show_layer)
 This function enables a layer. More...
 
hal_g2d_status_t hal_g2d_overlay_set_layer_function (hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, hal_g2d_overlay_layer_function_t function)
 This function sets an overlay layer function to a specific layer. More...
 
hal_g2d_status_t hal_g2d_overlay_set_layer_rectfill_color (hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint32_t rectfill_color)
 This function sets rectangle fill color to a specific layer. More...
 
hal_g2d_status_t hal_g2d_overlay_set_layer_buffer (hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint8_t *buffer, uint32_t size)
 
hal_g2d_status_t hal_g2d_overlay_set_layer_rgb_buffer (hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint8_t *buffer, uint32_t size, uint32_t width, uint32_t height, hal_g2d_color_format_t color_format)
 This function sets the RGB buffer information to this layer. More...
 
hal_g2d_status_t hal_g2d_overlay_set_layer_yuv_buffer (hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint8_t *buffer[3], uint32_t size[3], uint32_t width, uint32_t height, hal_g2d_color_format_t color_format)
 
hal_g2d_status_t hal_g2d_overlay_set_layer_window (hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, int32_t x, int32_t y, uint32_t width, uint32_t height)
 This function sets the rectangle to a layer. More...
 
hal_g2d_status_t hal_g2d_overlay_set_layer_source_key (hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint32_t src_key_value)
 This function enables the source key for a layer. More...
 
hal_g2d_status_t hal_g2d_overlay_set_layer_rotation (hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, hal_g2d_rotate_angle_t rotation)
 This function sets the rotation for a layer. More...
 
hal_g2d_status_t hal_g2d_overlay_set_layer_alpha (hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint32_t alpha_value)
 This function sets the alpha to a layer. More...
 
hal_g2d_status_t hal_g2d_overlay_set_background_color (hal_g2d_handle_t *handle, uint32_t bg_color)
 This function sets the background color. More...
 
hal_g2d_status_t hal_g2d_overlay_set_alpha (hal_g2d_handle_t *handle, uint32_t alpha_value)
 This function sets the destination alpha. More...
 
hal_g2d_status_t hal_g2d_overlay_set_window (hal_g2d_handle_t *handle, int32_t x, int32_t y)
 This function sets the coordinates in the destination window. More...
 
hal_g2d_status_t hal_g2d_overlay_set_roi_window (hal_g2d_handle_t *handle, int32_t x, int32_t y, uint32_t width, uint32_t height)
 This function sets the ROI(region of interest) window. More...
 
hal_g2d_status_t hal_g2d_overlay_start (hal_g2d_handle_t *handle)
 This function starts the overlay. More...
 
hal_g2d_status_t hal_g2d_set_dithering (hal_g2d_handle_t *handle, hal_g2d_dithering_mode_t mode, uint8_t red_bit, uint8_t green_bit, uint8_t blue_bit)
 This function sets the dithering of the destination. More...
 
hal_g2d_status_t hal_g2d_overlay_set_layer_font_format (hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, hal_g2d_font_format_t format)
 This function sets the font format for a layer. More...
 
hal_g2d_status_t hal_g2d_overlay_set_layer_font_color (hal_g2d_handle_t *handle, hal_g2d_overlay_layer_t layer, uint32_t color)
 This function sets the font color for a layer. More...
 
hal_g2d_status_t hal_g2d_rectfill_set_destination_window (hal_g2d_handle_t *handle, int32_t x, int32_t y, int32_t width, int32_t height)
 
hal_g2d_status_t hal_g2d_rectfill_set_color (hal_g2d_handle_t *handle, uint32_t color)
 
hal_g2d_status_t hal_g2d_rectangle_fill_query_window_range (hal_g2d_handle_t *handle, int32_t *min_x, int32_t *max_x, int32_t *min_y, int32_t *max_y, uint32_t *min_width, uint32_t *max_width, uint32_t *min_height, uint32_t *max_height)
 
hal_g2d_status_t hal_g2d_rectfill_start (hal_g2d_handle_t *handle)
 

Modules

 Enum
 
 Struct
 
 Typedef
 

Function Documentation

hal_g2d_status_t hal_g2d_get_handle ( hal_g2d_handle_t **  handle_ptr,
hal_g2d_codec_type_t  codec_type,
hal_g2d_get_handle_mode_t  handle_mode 
)

This function gets a G2D handle to access and control the G2D engine.

After getting the handle, users can apply the G2D API to render images.

Parameters
[out]handle_ptris a pointer to the G2D handle, after the function returns successfully.
[in]codec_typespecifies the G2D codec type. Currently, only the HAL_G2D_CODEC_TYPE_HW is used.
[in]handle_modespecifies whether to use blocking mode or non-blocking mode to get the G2D handle. If in blocking mode, the function hal_g2d_overlay_start() will block until G2D is no longer busy.
Returns
HAL_G2D_STATUS_OK, if the operation to get the G2D handle completed successfully.
HAL_G2D_STATUS_BUSY, if the G2D hardware is busy and the handle_mode is set to HAL_G2D_GET_HANDLE_MODE_NON_BLOCKING.
hal_g2d_status_t hal_g2d_get_status ( hal_g2d_handle_t handle)

The function gets the status of G2D engine.

Parameters
[in]handleis the G2D handle to get the G2D engine's status.
Returns
HAL_G2D_STATUS_OK, if the G2D is available for use.
HAL_G2D_STATUS_BUSY, if the G2D hardware is busy.
hal_g2d_status_t hal_g2d_init ( void  )

This function initializes the G2D module.

Returns
HAL_G2D_STATUS_OK, if the initialization is successful.
hal_g2d_status_t hal_g2d_overlay_enable_layer ( hal_g2d_handle_t handle,
hal_g2d_overlay_layer_t  layer,
bool  show_layer 
)

This function enables a layer.

The layer will be put onto the destination buffer only when it is enabled.

Parameters
[in]handlespecifies the G2D handle.
[in]layerspecifies the layer that to be enabled. (layer 0, layer 1, layer 2 or layer 3).
[in]show_layeris the flag indicating whether the specified layer should be shown or not.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
hal_g2d_status_t hal_g2d_overlay_set_alpha ( hal_g2d_handle_t handle,
uint32_t  alpha_value 
)

This function sets the destination alpha.

Parameters
[in]handlespecifies the G2D handle.
[in]alpha_valueis the alpha value.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
hal_g2d_status_t hal_g2d_overlay_set_background_color ( hal_g2d_handle_t handle,
uint32_t  bg_color 
)

This function sets the background color.

Parameters
[in]handlespecifies the G2D handle.
[in]bg_coloris the background color.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
hal_g2d_status_t hal_g2d_overlay_set_layer_alpha ( hal_g2d_handle_t handle,
hal_g2d_overlay_layer_t  layer,
uint32_t  alpha_value 
)

This function sets the alpha to a layer.

Parameters
[in]handlespecifies the G2D handle.
[in]layeris the layer to set the alpha for.
[in]alpha_valueis alpha value for the layer.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
hal_g2d_status_t hal_g2d_overlay_set_layer_buffer ( hal_g2d_handle_t handle,
hal_g2d_overlay_layer_t  layer,
uint8_t *  buffer,
uint32_t  size 
)
Deprecated:
Please use hal_g2d_overlay_set_layer_rgb_buffer() instead.

This function sets a buffer for a layer.

Parameters
[in]handlespecifies the G2D handle.
[in]layeris the layer to set a RGB buffer for.
[in]bufferis the buffer address.
[in]sizeis the buffer size.
Returns
HAL_G2D_STATUS_OK, if set layer buffer information is successful.
hal_g2d_status_t hal_g2d_overlay_set_layer_font_color ( hal_g2d_handle_t handle,
hal_g2d_overlay_layer_t  layer,
uint32_t  color 
)

This function sets the font color for a layer.

Parameters
[in]handleis the G2D handle.
[in]layeris the layer to set the font color for.
[in]coloris the color to draw the font.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
HAL_G2D_STATUS_INVALID_PARAMETER, if an invalid parameter is given by user.
hal_g2d_status_t hal_g2d_overlay_set_layer_font_format ( hal_g2d_handle_t handle,
hal_g2d_overlay_layer_t  layer,
hal_g2d_font_format_t  format 
)

This function sets the font format for a layer.

Parameters
[in]handleis the G2D handle.
[in]layeris the layer to set the font format for.
[in]formatis the format of the font bitstream.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
HAL_G2D_STATUS_INVALID_PARAMETER, if an invalid parameter is given by user.
hal_g2d_status_t hal_g2d_overlay_set_layer_function ( hal_g2d_handle_t handle,
hal_g2d_overlay_layer_t  layer,
hal_g2d_overlay_layer_function_t  function 
)

This function sets an overlay layer function to a specific layer.

For example, to do the overlay only, set the function to HAL_G2D_OVERLAY_LAYER_FUNCTION_BUFFER.

Parameters
[in]handlespecifies the G2D handle.
[in]layeris the layer to assign the function to.
[in]functionspecifies the function to be assigned to the layer, such as HAL_G2D_OVERLAY_LAYER_FUNCTION_BUFFER.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
hal_g2d_status_t hal_g2d_overlay_set_layer_rectfill_color ( hal_g2d_handle_t handle,
hal_g2d_overlay_layer_t  layer,
uint32_t  rectfill_color 
)

This function sets rectangle fill color to a specific layer.

Parameters
[in]handlespecifies the G2D handle.
[in]layeris the layer to set the color for the rectangle fill.
[in]rectfill_coloris the color for the rectangle fill.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
hal_g2d_status_t hal_g2d_overlay_set_layer_rgb_buffer ( hal_g2d_handle_t handle,
hal_g2d_overlay_layer_t  layer,
uint8_t *  buffer,
uint32_t  size,
uint32_t  width,
uint32_t  height,
hal_g2d_color_format_t  color_format 
)

This function sets the RGB buffer information to this layer.

Parameters
[in]handlespecifies the G2D handle.
[in]layeris the layer to enable.
[in]bufferis the buffer address.
[in]sizeis the buffer size.
[in]widthis the buffer width.
[in]heightis the buffer height.
[in]color_formatis the color format to apply to the buffer.
Returns
HAL_G2D_STATUS_OK, if set RGB buffer information is successful.
HAL_G2D_STATUS_INVALID_PARAMETER, if the values of the parameters are out of range, such as the width is greater than 0x2000.
hal_g2d_status_t hal_g2d_overlay_set_layer_rotation ( hal_g2d_handle_t handle,
hal_g2d_overlay_layer_t  layer,
hal_g2d_rotate_angle_t  rotation 
)

This function sets the rotation for a layer.

Parameters
[in]handlespecifies the G2D handle.
[in]layeris the layer to set the rotation for.
[in]rotationis the layer's rotation angle.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
hal_g2d_status_t hal_g2d_overlay_set_layer_source_key ( hal_g2d_handle_t handle,
hal_g2d_overlay_layer_t  layer,
uint32_t  src_key_value 
)

This function enables the source key for a layer.

Parameters
[in]handlespecifies the G2D handle.
[in]layeris the layer to enable the source key for.
[in]src_key_valueis the source key value.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
hal_g2d_status_t hal_g2d_overlay_set_layer_window ( hal_g2d_handle_t handle,
hal_g2d_overlay_layer_t  layer,
int32_t  x,
int32_t  y,
uint32_t  width,
uint32_t  height 
)

This function sets the rectangle to a layer.

Parameters
[in]handlespecifies the G2D handle.
[in]layeris the layer to set a rectangle for.
[in]xis the coordinate X of the rectangle.
[in]yis the coordinate Y of the rectangle.
[in]widthis the width of the rectangle.
[in]heightis the height of the rectangle.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
HAL_G2D_STATUS_INVALID_PARAMETER, if the values of the parameters are out of the range, such as the width is greater than 0x2000.
hal_g2d_status_t hal_g2d_overlay_set_layer_yuv_buffer ( hal_g2d_handle_t handle,
hal_g2d_overlay_layer_t  layer,
uint8_t *  buffer[3],
uint32_t  size[3],
uint32_t  width,
uint32_t  height,
hal_g2d_color_format_t  color_format 
)
Deprecated:
Please use hal_g2d_overlay_set_layer_rgb_buffer() instead.

This function sets a YUV buffer for a layer.

Parameters
[in]handlespecifies the G2D handle.
[in]layeris the layer to set the YUV buffer for.
[in]bufferis the buffer address.
[in]sizeis the buffer size.
[in]widthis the buffer width.
[in]heightis the buffer height.
[in]color_formatis the color format to apply to the buffer.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
HAL_G2D_STATUS_INVALID_PARAMETER, if the values of the parameters are out of range, such as the width is greater than 0x2000.
hal_g2d_status_t hal_g2d_overlay_set_roi_window ( hal_g2d_handle_t handle,
int32_t  x,
int32_t  y,
uint32_t  width,
uint32_t  height 
)

This function sets the ROI(region of interest) window.

Parameters
[in]handlespecifies the G2D handle.
[in]xis the coordinate X of the ROI window.
[in]yis the coordinate Y of the ROI window.
[in]widthis the width of the ROI window.
[in]heightis the height of the ROI window.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
HAL_G2D_STATUS_INVALID_PARAMETER, if the values of the parameters are out of range, such as X, Y, width or height is over 2048.
hal_g2d_status_t hal_g2d_overlay_set_window ( hal_g2d_handle_t handle,
int32_t  x,
int32_t  y 
)

This function sets the coordinates in the destination window.

Call the function hal_g2d_overlay_set_roi_window() to set the width and height.

Parameters
[in]handlespecifies the G2D handle.
[in]xis coordinate X of the destination window.
[in]yis coordinate Y of the destination window.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
hal_g2d_status_t hal_g2d_overlay_start ( hal_g2d_handle_t handle)

This function starts the overlay.

Parameters
[in]handlespecifies the G2D handle.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
HAL_G2D_STATUS_BUSY, if the G2D hardware is busy.
hal_g2d_status_t hal_g2d_query_rgb_buffer_range ( hal_g2d_handle_t handle,
uint32_t *  min_width,
uint32_t *  max_width,
uint32_t *  min_height,
uint32_t *  max_height 
)

This function queries the range of the destination buffer.

Parameters
[in]handleis the G2D handle.
[out]min_widthis the minimum width.
[out]max_widthis the maximum width.
[out]min_heightis the minimum height.
[out]max_heightis the maximum height.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
hal_g2d_status_t hal_g2d_query_support ( hal_g2d_codec_type_t  codec_type,
hal_g2d_supported_function_t  function_type 
)

This function queries whether a particular function type is supported by the G2D engine.

Parameters
[in]codec_typespecifies the codec type, hardware codec or software codec.
[in]function_typespecifies the function type to be queried.
Returns
HAL_G2D_STATUS_OK, if the queried function type is supported.
HAL_G2D_STATUS_NOT_SUPPORTED, the function type is not supported.
hal_g2d_status_t hal_g2d_rectangle_fill_query_window_range ( hal_g2d_handle_t handle,
int32_t *  min_x,
int32_t *  max_x,
int32_t *  min_y,
int32_t *  max_y,
uint32_t *  min_width,
uint32_t *  max_width,
uint32_t *  min_height,
uint32_t *  max_height 
)
Deprecated:
Please use hal_g2d_query_rgb_buffer_range() instead.

This function queries the range of the destination window.

Parameters
[in]handlespecifies the G2D handle.
[out]min_xis the minimum of the coordinate X.
[out]max_xis the maximum of the coordinate X.
[out]min_yis the minimum of the coordinate Y.
[out]max_yis the maximum of the coordinate Y.
[out]min_widthis minimum of the width of the window.
[out]max_widthis maximum of the width of the window.
[out]min_heightis minimum of the height of the window.
[out]max_heightis maximum of the height of the window.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
hal_g2d_status_t hal_g2d_rectfill_set_color ( hal_g2d_handle_t handle,
uint32_t  color 
)
Deprecated:
Please use hal_g2d_overlay_set_layer_rectfill_color() instead.

This function sets the color for the rectangle fill.

Parameters
[in]handlespecifies the G2D handle.
[in]coloris the color to fill the rectangle.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
hal_g2d_status_t hal_g2d_rectfill_set_destination_window ( hal_g2d_handle_t handle,
int32_t  x,
int32_t  y,
int32_t  width,
int32_t  height 
)
Deprecated:
Please use hal_g2d_overlay_set_layer_window() instead.

This function sets the rectangle fill region.

Parameters
[in]handleis the G2D handle.
[in]xis the coordinate X of the region for the rectangle fill.
[in]yis the coordinate Y of the region for the rectangle fill.
[in]widthis width of rectangle fill.
[in]heightis height of rectangle fill.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
HAL_G2D_STATUS_INVALID_PARAMETER, if the values of the parameters are out of range, such as X, Y, width or height is over 2048.
hal_g2d_status_t hal_g2d_rectfill_start ( hal_g2d_handle_t handle)
Deprecated:
Please use hal_g2d_overlay_start() instead.

This function starts the rectangle fill operation.

Parameters
[in]handlespecifies the G2D handle.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
HAL_G2D_STATUS_BUSY, if the G2D hardware is busy.
hal_g2d_status_t hal_g2d_register_callback ( hal_g2d_handle_t handle,
hal_g2d_callback_t  callback 
)

This function registers a user-defined callback function for the G2D completion events.

The callback is invoked whenever the G2D engine completes an operation, such as draws an overlay, makes a rotation or fills a rectangle.

Parameters
[in]handlespecifies the G2D handle.
[in]callbackspecifies the callback function to be registered.
Returns
HAL_G2D_STATUS_OK, if the registration is successful.
hal_g2d_status_t hal_g2d_release_handle ( hal_g2d_handle_t handle)

This function releases the G2D handle and frees its associated resources occupied by this G2D handle.

Call this function after all rendering processes are complete.

Parameters
[in]handleis G2D handle.
Returns
HAL_G2D_STATUS_OK, if the G2D handle is released successfully.
HAL_G2D_STATUS_BUSY, if the G2D hardware is busy.
hal_g2d_status_t hal_g2d_replace_color ( hal_g2d_handle_t handle,
uint8_t  alpha0,
uint8_t  red0,
uint8_t  green0,
uint8_t  blue0,
uint8_t  alpha1,
uint8_t  red1,
uint8_t  green1,
uint8_t  blue1 
)

The color of the pixel that matches to the combination of the old set (alpha0, red0, green0, blue0) is replaced with the combination of the new set (alpha1, red1, green1, blue1).

Parameters
[in]handlespecifies the G2D handle.
[in]alpha0is the old alpha color component.
[in]red0is the old red color component.
[in]green0is the old green color component.
[in]blue0is the old blue color component.
[in]alpha1is the new alpha color component.
[in]red1is the new red color component.
[in]green1is the new green color component.
[in]blue1is the new blue color component.
Returns
HAL_G2D_STATUS_OK, if the operation completed successfully.
hal_g2d_status_t hal_g2d_set_clipping_window ( hal_g2d_handle_t handle,
int32_t  x,
int32_t  y,
int32_t  width,
int32_t  height 
)

The function sets the clipping window for the destination buffer.

All data outside the clipping window will remain unchanged.

Parameters
[in]handlespecifies the G2D handle.
[in]xis the base vertex coordinate X of clipping window.
[in]yis the base vertex coordinate Y of clipping window.
[in]widthis the width of the clipping window.
[in]heightis the height of the clipping window.
Returns
HAL_G2D_STATUS_OK, if the destination clipping window is set successfully.
HAL_G2D_STATUS_INVALID_PARAMETER, if the parameters are out of range. Supported range: -2048 <= x, y <= 2047; 1 <= x + width, y + height <= 2048.
hal_g2d_status_t hal_g2d_set_dithering ( hal_g2d_handle_t handle,
hal_g2d_dithering_mode_t  mode,
uint8_t  red_bit,
uint8_t  green_bit,
uint8_t  blue_bit 
)

This function sets the dithering of the destination.

Parameters
[in]handleis the G2D handle.
[in]modeis the dithering mode.
[in]red_bitis the dithering bit in red channel.
[in]green_bitis the dithering bit in green channel.
[in]blue_bitis the dithering bit in blue channel.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
HAL_G2D_STATUS_INVALID_PARAMETER, if an invalid parameter is given by user.
hal_g2d_status_t hal_g2d_set_rgb_buffer ( hal_g2d_handle_t handle,
uint8_t *  buffer,
uint32_t  size,
uint32_t  width,
uint32_t  height,
hal_g2d_color_format_t  color_format 
)

This function sets the destination buffer.

Parameters
[in]handlespecifies the G2D handle.
[in]bufferis the address of the destination buffer.
[in]sizeis the buffer size.
[in]widthis the width of the destination buffer.
[in]heightis the height of the destination buffer.
[in]color_formatspecifies the color format(GRAY, RGB565, RGB888, ARGB8888, etc.).
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
HAL_G2D_STATUS_INVALID_PARAMETER, if the values of parameters are out of range, for example, the width is greater than 0x2000.
hal_g2d_status_t hal_g2d_set_source_key ( hal_g2d_handle_t handle,
uint8_t  alpha,
uint8_t  red,
uint8_t  green,
uint8_t  blue 
)
Deprecated:
Please use hal_g2d_overlay_set_layer_source_key() instead.

This function sets the source key value.

Parameters
[in]handlespecifies the G2D handle.
[in]alphais the alpha color component of source key color.
[in]redis the red color component of source key color.
[in]greenis the green color component of source key color.
[in]blueis the blue color component of source key color.
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
hal_g2d_status_t hal_set_rgb_buffer ( hal_g2d_handle_t handle,
uint8_t *  buffer,
uint32_t  size,
uint32_t  width,
uint32_t  height,
hal_g2d_color_format_t  color_format 
)
Deprecated:
Please use hal_g2d_set_rgb_buffer() instead.

This function sets the destination buffer.

Parameters
[in]handlespecifies the G2D handle.
[in]bufferis the address of the destination buffer.
[in]sizeis the buffer size.
[in]widthis the width of the destination buffer.
[in]heightis the height of the destination buffer.
[in]color_formatspecifies the color format(GRAY, RGB565, RGB888, ARGB8888, etc.).
Returns
HAL_G2D_STATUS_OK, if the operation is successful.
HAL_G2D_STATUS_INVALID_PARAMETER, if the values of parameters are out of the range, for example, the width is greater than 0x2000.