forked from akerou/fvp
-
Notifications
You must be signed in to change notification settings - Fork 2
/
nvsgconverter.h
77 lines (56 loc) · 1.66 KB
/
nvsgconverter.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef NVSGCONVERTER_H
#define NVSGCONVERTER_H
#include <QFile>
#include <QMap>
#include <QString>
#include <QByteArray>
#include <QDataStream>
#include <lodepng.h>
#include <QDir>
#include <QTextCodec>
class NvsgConverter
{
public:
static NvsgConverter & getInstance()
{
static NvsgConverter converter;
return converter;
}
void autoProcess(const char *input, const char* process_mode, const char *output = NULL);
private:
typedef struct
{
char *data;
quint32 bytes;
quint16 height;
quint16 width;
quint16 mode;
} Image;
typedef struct
{
quint16 x = 0;
quint16 y = 0;
} Pos;
int decodeNvsg(const QString infile, const QString outfile);
int encodeNvsg(const QString infile, const QString outfile);
QMap<QString, Pos> positions;
const QString d_mode = "-decode";
const QString e_mode = "-encode";
const char *HZC1_MAGIC = "hzc1";
const char *NVSG_MAGIC = "NVSG";
const char *pos_file = "pos.dat";
void massProcess(const QDir in_dir, const QString out, const QString mode);
NvsgConverter();
NvsgConverter(const NvsgConverter&){}
void operator=(NvsgConverter const&){}
int imgFromString_save(const QString filename, QByteArray data, int width, int height, int mode);
Image* imgToString(const QString filename);
int readPosInfo();
int appendPosInfo(QString filename, quint16 x_pos, quint16 y_pos);
QByteArray pos_buf;
int writePosInfo();
bool checkMap(const QString filename);
Pos getPos(const QString filename);
QByteArray readFile(const QString infile);
};
#endif // NVSGCONVERTER_H