-
Notifications
You must be signed in to change notification settings - Fork 2
/
respicture.h
53 lines (43 loc) · 1.04 KB
/
respicture.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
#ifndef RESPICTURE_H
#define RESPICTURE_H
#include <QImage>
#include <QVector>
#include <QMessageBox>
#include <QObject>
#include <vector>
#include <string.h>
#include "zlib_util.h"
#include "ioutils.h"
#define PIC_HEADER_SIZE 8U
#define IMG_HAS_ALPHA(TYPE) ((TYPE) & 8U)
using namespace std;
/* File headers in RES file */
typedef struct {
uint32_t address;
uint16_t size;
uint8_t type;
char name[9];
} FileHeader;
class ResPicture {
public:
ResPicture();
ResPicture(FileHeader, const uint8_t*);
bool isEmpty();
const QImage& getImage();
const QString getName();
const QString getInfo();
FileHeader getHeader();
const QSize& getSize();
vector<uint8_t> getCompressedData();
void replaceImage(const QImage&);
private:
void parseAlphaImage();
void parseOpaqueImage();
bool m_parsed;
FileHeader m_header;
QImage m_image;
QSize m_dimension;
vector<uint8_t> m_uncompressed;
vector<uint8_t> m_compressed;
};
#endif // RESPICTURE_H