diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-06-14 00:50:34 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-06-14 00:50:34 +0100 |
commit | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (patch) | |
tree | eaf6e857382eef16c2dd940eb4125536fbe068bd /src/T2DLL/T2ImageObj.h | |
download | t2win-37e364b2c6cc7487a1c888d256a73e5337bb7189.tar.gz t2win-37e364b2c6cc7487a1c888d256a73e5337bb7189.zip |
initial commit
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2ImageObj.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/T2DLL/T2ImageObj.h b/src/T2DLL/T2ImageObj.h new file mode 100644 index 0000000..b954df8 --- /dev/null +++ b/src/T2DLL/T2ImageObj.h @@ -0,0 +1,72 @@ +#pragma once +#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 DLL_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, int grade, int span, int offset); + int FindObject(const char* name, int pattern, int grade, int span, int offset); + void EnumParts(int, int, PARTSLIST*, int*); + BOOL WithRoof(int index); + BOOL WithFloor(int index); + void DrawObject(T2BitImage* image, int index, RECT rect, int factor, int foreGndColor); + void DrawObject(CDC* dc, int index, RECT rect, int factor, int foreGndColor); + 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; +}; |