,
Description
Creating image via canvas
What MCU/Processor/Board and compiler are you using?
stm32f746-discovery
What LVGL version are you using?
latest
What do you want to achieve?
I want to create image with smaller images.
What have you tried so far?
I have tried to create an 10x10 px^2 frames to create. But When I move canvas older ones are disappearing.
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
#include <stdint.h>
#include "stm32f7xx_hal.h"
#include "lvgl.h"
#define BUF_WIDTH (10)
#define BUF_HEIGHT (10)
static lv_obj_t *line;
static uint8_t canvas_buffer[LV_CANVAS_BUF_SIZE_TRUE_COLOR(BUF_WIDTH, BUF_HEIGHT)];
lv_color_t colors[] = { LV_COLOR_BLUE, LV_COLOR_RED, LV_COLOR_BLACK, LV_COLOR_GREEN, LV_COLOR_YELLOW };
void Communication_Control_Init(void)
{
line = lv_canvas_create(lv_scr_act(), NULL);
lv_canvas_set_buffer(line, canvas_buffer, BUF_WIDTH , BUF_HEIGHT, LV_IMG_CF_TRUE_COLOR);
lv_obj_align(line, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
}
void Communication_Control_Runtime(void)
{
for(int16_t i = 10; i < 100; i = i+10)
{
lv_obj_set_pos(line, i, i);
for(int16_t x = 0; x < BUF_WIDTH; x++)
{
for(int16_t y = 0; y < BUF_HEIGHT; y++)
{
lv_canvas_set_px(line, x, y, colors[(x+y)%5]);
}
}
}
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.