-
Notifications
You must be signed in to change notification settings - Fork 142
/
LVGLImageData.h
62 lines (45 loc) · 1.07 KB
/
LVGLImageData.h
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef LVGLIMAGEDATA_H
#define LVGLIMAGEDATA_H
#include <QImage>
#include <QIcon>
#include <lvgl/lvgl.h>
class LVGLImageData
{
public:
LVGLImageData();
LVGLImageData(QImage image, QString fileName, QString name);
LVGLImageData(QString fileName, QString name);
LVGLImageData(QJsonObject object);
~LVGLImageData();
enum ColorFormat {
LV_COLOR_1Bit,
LV_COLOR_8Bit,
LV_COLOR_16Bit,
LV_COLOR_24Bit,
LV_COLOR_32Bit
};
bool isValid();
lv_img_dsc_t *img_des();
QString name() const;
QJsonValue toJson() const;
QString fileName() const;
QIcon icon() const;
int width() const;
int height() const;
QString codeName() const;
bool saveAsCode(const QString &fileName) const;
bool saveAsBin(const QString &fileName) const;
ColorFormat colorFormat() const;
void setColorFormat(const ColorFormat &colorFormat);
static QStringList colorFormats();
private:
uint32_t m_size;
uint8_t *m_data;
lv_img_dsc_t m_img_dsc;
QString m_name;
QString m_fileName;
QIcon m_icon;
ColorFormat m_colorFormat;
static constexpr int ICON_SIZE = 128;
};
#endif // LVGLIMAGEDATA_H