#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