Hello,
I have a lv_img_dsc_t data_img, which is allocate with the function lv_img_buf_alloc.
How should I fill the data_img.data element ?
I saw it is a const uint8_t * and I don’t understand how to modify the pixel in that element.
Hello,
I have a lv_img_dsc_t data_img, which is allocate with the function lv_img_buf_alloc.
How should I fill the data_img.data element ?
I saw it is a const uint8_t * and I don’t understand how to modify the pixel in that element.
The field names are pretty self-descriptive. E.g.
lv_img_dsc_t image = {
.header.always_zero = 0,
.header.w = 100,
.header.h = 100,
.data_size = 10000 * LV_IMG_PX_SIZE_ALPHA_BYTE,
.header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA,
.data = image_data,
};
image_data
doesn’t have to be const
. E.g. you can do this:
lv_color_t image_data[] = {...};
lv_img_dsc_t image = {
.header.always_zero = 0,
.header.w = 100,
.header.h = 100,
.data_size = 10000 * LV_IMG_PX_SIZE_ALPHA_BYTE,
.header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA,
.data = (const uint8_t *)image_data,
};
Thank you for the answer, I suppose it is the same logic when I use lv_img_dsc_t* ?
Yes, it is.