1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use crate::endecoder::lvgl;

pub mod endecoder;
pub mod midata;

pub struct EncoderParams {
    pub color_format: lvgl::ColorFormat,
    pub stride_align: u32,
    pub dither: bool,
    pub lvgl_version: lvgl::LVGLVersion,
}

impl Default for EncoderParams {
    fn default() -> Self {
        Self {
            color_format: Default::default(),
            stride_align: 1,
            dither: false,
            lvgl_version: lvgl::LVGLVersion::Unknown,
        }
    }
}

impl EncoderParams {
    pub fn new() -> Self {
        Self::default()
    }

    pub fn with_color_format(mut self, color_format: lvgl::ColorFormat) -> Self {
        self.color_format = color_format;
        self
    }

    pub fn with_stride_align(mut self, stride_align: u32) -> Self {
        self.stride_align = stride_align;
        self
    }

    pub fn with_dither(mut self, dither: bool) -> Self {
        self.dither = dither;
        self
    }

    pub fn with_lvgl_version(mut self, lvgl_version: lvgl::LVGLVersion) -> Self {
        self.lvgl_version = lvgl_version;
        self
    }
}