|
5
|
1 #ifndef OSTC45_ICON_H
|
|
|
2 #define OSTC45_ICON_H
|
|
|
3
|
|
|
4 #include <cstdint>
|
|
|
5 #include <vector>
|
|
|
6 #include <stdexcept>
|
|
|
7 #include <iostream>
|
|
|
8 #include <QString>
|
|
|
9 #include <QVector>
|
|
|
10 #include <QIODevice>
|
|
|
11 #include <QFile>
|
|
|
12 #include <QByteArray>
|
|
|
13
|
|
|
14 class BmpToArray
|
|
|
15 {
|
|
|
16 public:
|
|
|
17 struct CLUTEntry {
|
|
|
18 uint8_t b;
|
|
|
19 uint8_t g;
|
|
|
20 uint8_t r;
|
|
|
21 uint8_t a; // BMP setzt meist 0
|
|
|
22 };
|
|
|
23
|
|
|
24 QByteArray getTransferBytes() const;
|
|
|
25 void getImageXY(uint32_t* x, uint32_t* y);
|
|
|
26 BmpToArray(const QString& fileName);
|
|
|
27
|
|
|
28 private:
|
|
|
29 void loadBMP(const QString& filename);
|
|
|
30
|
|
|
31 QVector<CLUTEntry> clut;
|
|
|
32 QVector<uint8_t> pixelData; // Pixel-Indizes
|
|
|
33 QVector<uint32_t> clut32; // 32-Bit Palette
|
|
|
34 uint32_t width = 0;
|
|
|
35 uint32_t height = 0;
|
|
|
36 };
|
|
|
37 #endif // OSTC45_ICON_H
|