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
|
#ifndef T2DLL_T2IMAGEOBJ_H
#define T2DLL_T2IMAGEOBJ_H
#include "../common.h"
struct PARTSLIST {
T2BitImage *image;
RECT rect;
BOOL transparent;
BOOL halftoneMode;
};
// unknown name
struct SubPartData {
unsigned char flags;
union {
struct {
short top;
short left;
short bottom;
short right;
};
int partIndex;
int objectID;
};
};
#define SPD_PARTS_BY_NAME 1
#define SPD_PARTS_BY_ID 2
#define SPD_RECT 4
#define SPD_HALFTONE 0x20
#define SPD_TRANSPARENT 0x40
#define SPD_LOOP 0x80
// unknown name
struct ObjectData {
char name[32];
int id;
int pattern;
unsigned char grade;
unsigned char span;
unsigned char offset;
unsigned char roof;
unsigned char floor;
T2BitImage *image;
unsigned char subPartCount;
SubPartData subParts[4];
};
class AFX_CLASS_EXPORT T2ImageObj {
public:
T2ImageObj();
virtual ~T2ImageObj();
void AddObject(HINSTANCE instance, unsigned int resourceID, T2BitImage* image);
void AddObject(const char* name, int pattern, T2BitImage& image, const RECT* rect, BOOL transparent, BOOL halftoneMode);
void AddObject(int id, int pattern, T2BitImage& image, const RECT* rect, BOOL transparent, BOOL halftoneMode);
int FindObject(int id, int pattern = -1, int grade = 0, int span = 0, int offset = 255);
int FindObject(const char* name, int pattern = -1, int grade = 0, int span = 0, int offset = 255);
void EnumParts(int, int, PARTSLIST*, int*);
BOOL WithRoof(int index);
BOOL WithFloor(int index);
void DrawObject(T2BitImage* image, int index, RECT rect, int factor = 0, int foreGndColor = -1);
void DrawObject(CDC* dc, int index, RECT rect, int factor = 0, int foreGndColor = -1);
BOOL GetObjectSize(int index, SIZE* outSize);
T2BitImage* GetObjectImage(int index, RECT& outRect);
protected:
void DrawObject(void* target, int index, RECT rect, int factor, BOOL targetIsDC, int foreGndColor);
int mCount;
ObjectData *mData;
HANDLE mHandle;
};
#endif
|