Add lcd_draw_img_from_llfs_file and lcd_draw_gif_from_llfs_file
This commit is contained in:
2023-12-03 22:01:14 +01:00
parent 0704473bc5
commit d77fca56b7
3 changed files with 57 additions and 1 deletions

View File

@@ -165,6 +165,7 @@ Note that when an image exceeds the X or Y size of the LCD display, the image wi
#### Drawing a BMP from the filesystem to the LCD
```c
void lcd_draw_img_from_fs(const char* name, uint32_t x_pos, uint32_t y_pos);
void lcd_draw_img_from_llfs_file(llfs_file_t* file, uint32_t x_pos, uint32_t y_pos);
```
```c
@@ -175,10 +176,13 @@ void main(void) {
lcd_init(true);
...
lcd_draw_img_from_fs("st.bmp", 0, 0);
...
llfs_file_t* file = llfs_open("st.bmp");
lcd_draw_img_from_llfs_file(file, 50, 50);
}
```
This function expects the name of the BMP image as argument, together with the X and Y coordinates.
This function expects the name of the BMP image as argument or a pointer to the llfs_file_t struct, together with the X and Y coordinates.
Note that this function only works for BMP images and not raw images and when an image exceeds the X or Y size of the LCD display, the image will go out of the visible LCD area.
@@ -186,6 +190,7 @@ Note that this function only works for BMP images and not raw images and when an
```c
lcd_gif_t* lcd_draw_gif(uint8_t* src, size_t size, uint32_t x_pos, uint32_t y_pos);
lcd_gif_t* lcd_draw_gif_from_fs(const char* name, uint32_t x_pos, uint32_t y_pos);
lcd_gif_t* lcd_draw_gif_from_llfs_file(llfs_file_t* file, uint32_t x_pos, uint32_t y_pos);
```
```c
#include "lcd_api.h"
@@ -201,6 +206,10 @@ void main(void) {
// From the filesystem
lcd_gif_t* gif = lcd_draw_gif_from_fs("st.gif", 0, 0);
// From a llfs_file_t struct
llfs_file_t* file = llfs_open("st.gif");
lcd_gif_t* gif = lcd_draw_gif_from_llfs_file(file, 0, 0);
if (gif == NULL) {
LOG_WARNING("GIF could not be drawn");
}