![]() |
MT2523 API Reference
LinkIt SDK v4
|
This section provides APIs to display images and basic shapes, such as points, lines, rectangles, circles and polygons. More...
This section provides APIs to display images and basic shapes, such as points, lines, rectangles, circles and polygons.
Only BMP image is supported in SDK.
| Terms | Details |
|---|---|
| GDI | Graphics Device Interface. For more information, please refer to Wikipedia. |
| RGB | An additive color model in which red, green and blue light are added together in various ways to reproduce a broad array of colors. For more information, please refer to Wikipedia. |
| BLT | Bit block transfer, is a data operation commonly used in computer graphics in which several bitmaps are combined into one using a Boolean function. For more information, please refer to Wikipedia. |
Functions | |
| void | gdi_init (uint32_t width, uint32_t height, gdi_color_format_t color_format, uint8_t *buffer) |
| This function initializes the GDI. More... | |
| gdi_color_t | gdi_get_color_from_argb (uint8_t alpha, uint8_t red, uint8_t green, uint8_t blue) |
| This function generates a color from given alpha, red, green, blue. More... | |
| void | gdi_get_argb_from_color (uint8_t *alpha, uint8_t *red, uint8_t *green, uint8_t *blue, gdi_color_t color) |
| This function extracts alpha, red, green, blue from the given color, the value range of the component is relative with the color format. More... | |
| void | gdi_draw_point (int32_t x, int32_t y, gdi_color_t color) |
| This function draws a point on the screen. More... | |
| void | gdi_draw_line (int32_t x1, int32_t y1, int32_t x2, int32_t y2, gdi_color_t color) |
| This function draws a line on the screen. More... | |
| void | gdi_draw_rectangle (int32_t x1, int32_t y1, int32_t x2, int32_t y2, gdi_color_t color) |
| This function draws a rectangle on the screen. More... | |
| void | gdi_draw_filled_rectangle (int32_t x1, int32_t y1, int32_t x2, int32_t y2, gdi_color_t color) |
| This function draws a solid rectangle on the screen. More... | |
| void | gdi_draw_circle (int32_t x, int32_t y, int32_t radius, gdi_color_t color) |
| This function draws a circle on the screen. More... | |
| void | gdi_draw_filled_circle (int32_t x, int32_t y, int32_t radius, gdi_color_t color) |
| This function draws a solid circle on the screen. More... | |
| void | gdi_draw_filled_polygon (gdi_point_t point[], uint32_t point_num, gdi_color_t color) |
| This function draws a solid polygon on current screen. More... | |
| void | gdi_draw_polygon (gdi_point_t point[], uint32_t point_num, gdi_color_t color) |
| This function draws a polygon on current screen. More... | |
| gdi_result_t | gdi_image_draw_by_id (int32_t x, int32_t y, uint16_t image_id) |
| This function draws an image from a resource with original image dimension. More... | |
| gdi_result_t | gdi_image_draw_resized_by_id (int32_t x, int32_t y, uint32_t width, uint32_t height, uint16_t image_id) |
| This function draws an image from a resource with specified dimensions. More... | |
| gdi_result_t | gdi_image_get_dimension_by_id (uint16_t image_id, uint32_t *width, uint32_t *height) |
| This function gets the image dimension by the image resource ID. More... | |
| gdi_result_t | gdi_lcd_update_screen (uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2) |
| This function updates the LCD screen. More... | |
Modules | |
| Define | |
| This section defines macros for the GDI. | |
| Struct | |
| Basic data structure for the GDI. | |
| void gdi_draw_circle | ( | int32_t | x, |
| int32_t | y, | ||
| int32_t | radius, | ||
| gdi_color_t | color | ||
| ) |
This function draws a circle on the screen.
| [in] | x | is the x position of the center of the circle. |
| [in] | y | is the y position of the center of the circle. |
| [in] | radius | is the radius of the circle. |
| [in] | color | is the color of the circle. |
| void gdi_draw_filled_circle | ( | int32_t | x, |
| int32_t | y, | ||
| int32_t | radius, | ||
| gdi_color_t | color | ||
| ) |
This function draws a solid circle on the screen.
| [in] | x | is the x position of the center of the circle. |
| [in] | y | is the y position of the center of the circle. |
| [in] | radius | is the radius of the circle. |
| [in] | color | is the color to fill the circle. |
| void gdi_draw_filled_polygon | ( | gdi_point_t | point[], |
| uint32_t | point_num, | ||
| gdi_color_t | color | ||
| ) |
This function draws a solid polygon on current screen.
| [in] | point | is the point array. |
| [in] | point_num | is the number of elements of the point array. |
| [in] | color | is the color to fill the polygon. |
| void gdi_draw_filled_rectangle | ( | int32_t | x1, |
| int32_t | y1, | ||
| int32_t | x2, | ||
| int32_t | y2, | ||
| gdi_color_t | color | ||
| ) |
This function draws a solid rectangle on the screen.
| [in] | x1 | is the x position of the left-top corner of rectangle. |
| [in] | y1 | is the y position of the left-top corner of rectangle. |
| [in] | x2 | is the x position of the right-down corner of rectangle. |
| [in] | y2 | is the y position of the right-down corner of rectangle. |
| [in] | color | is the color to fill the rectangle. |
| void gdi_draw_line | ( | int32_t | x1, |
| int32_t | y1, | ||
| int32_t | x2, | ||
| int32_t | y2, | ||
| gdi_color_t | color | ||
| ) |
This function draws a line on the screen.
| [in] | x1 | is the x position of the first end point of line. |
| [in] | y1 | is the y position of the first end point of line. |
| [in] | x2 | is the x position of the other end point of line. |
| [in] | y2 | is the y position of the other end point of line. |
| [in] | color | is the color of the line. |
| void gdi_draw_point | ( | int32_t | x, |
| int32_t | y, | ||
| gdi_color_t | color | ||
| ) |
This function draws a point on the screen.
| [in] | x | is the x position of the point. |
| [in] | y | is the y position of the point. |
| [in] | color | is the color of the point. |
| void gdi_draw_polygon | ( | gdi_point_t | point[], |
| uint32_t | point_num, | ||
| gdi_color_t | color | ||
| ) |
This function draws a polygon on current screen.
| [in] | point | is the point array. |
| [in] | point_num | is the number of elements of the point array. |
| [in] | color | is the color of polygon. |
| void gdi_draw_rectangle | ( | int32_t | x1, |
| int32_t | y1, | ||
| int32_t | x2, | ||
| int32_t | y2, | ||
| gdi_color_t | color | ||
| ) |
This function draws a rectangle on the screen.
| [in] | x1 | is the x position of the left-top corner of rectangle. |
| [in] | y1 | is the y position of the left-top corner of rectangle. |
| [in] | x2 | is the x position of the right-down corner of rectangle. |
| [in] | y2 | is the y position of the right-down corner of rectangle. |
| [in] | color | is the color of the rectangle frame. |
| void gdi_get_argb_from_color | ( | uint8_t * | alpha, |
| uint8_t * | red, | ||
| uint8_t * | green, | ||
| uint8_t * | blue, | ||
| gdi_color_t | color | ||
| ) |
This function extracts alpha, red, green, blue from the given color, the value range of the component is relative with the color format.
| [out] | alpha | is the alpha component value of the given color. |
| [out] | red | is the red component value of the given color. |
| [out] | green | is the green component value of the given color. |
| [out] | blue | is the blue component value of the given color. |
| [in] | color | is the given color to extract alpha, red, green, blue. |
| gdi_color_t gdi_get_color_from_argb | ( | uint8_t | alpha, |
| uint8_t | red, | ||
| uint8_t | green, | ||
| uint8_t | blue | ||
| ) |
This function generates a color from given alpha, red, green, blue.
| [in] | alpha | is the alpha component value to generate the color. |
| [in] | red | is the red component value to generate the color. |
| [in] | green | is the green component value to generate the color. |
| [in] | blue | is the blue component value to generate the color. |
| gdi_result_t gdi_image_draw_by_id | ( | int32_t | x, |
| int32_t | y, | ||
| uint16_t | image_id | ||
| ) |
This function draws an image from a resource with original image dimension.
| [in] | x | is the x position to draw image. |
| [in] | y | is the y position to draw image. |
| [in] | image_id | is the image resource ID. |
| gdi_result_t gdi_image_draw_resized_by_id | ( | int32_t | x, |
| int32_t | y, | ||
| uint32_t | width, | ||
| uint32_t | height, | ||
| uint16_t | image_id | ||
| ) |
This function draws an image from a resource with specified dimensions.
| [in] | x | is the x position to draw image. |
| [in] | y | is the y position to draw image. |
| [in] | width | is the image width to draw. |
| [in] | height | is the image height to draw. |
| [in] | image_id | is the image resource ID. |
| gdi_result_t gdi_image_get_dimension_by_id | ( | uint16_t | image_id, |
| uint32_t * | width, | ||
| uint32_t * | height | ||
| ) |
This function gets the image dimension by the image resource ID.
| [in] | image_id | is the image resource ID. |
| [out] | width | is the image width. |
| [out] | height | is the image height. |
| void gdi_init | ( | uint32_t | width, |
| uint32_t | height, | ||
| gdi_color_format_t | color_format, | ||
| uint8_t * | buffer | ||
| ) |
This function initializes the GDI.
| [in] | width | is the width of the LCD. |
| [in] | height | is the height of the LCD. |
| [in] | color_format | is the color format of the buffer. |
| [in] | buffer | is the buffer containing the drawing content. |
| gdi_result_t gdi_lcd_update_screen | ( | uint32_t | x1, |
| uint32_t | y1, | ||
| uint32_t | x2, | ||
| uint32_t | y2 | ||
| ) |
This function updates the LCD screen.
The four parameters are the region to update the LCD screen.
| [in] | x1 | is x of left-top corner of update region. |
| [in] | y1 | is y of left-top corner of update region. |
| [in] | x2 | is x of right-down corner of update region. |
| [in] | y2 | is y of right-down corner of update region. |