From 37e364b2c6cc7487a1c888d256a73e5337bb7189 Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Wed, 14 Jun 2023 00:50:34 +0100 Subject: initial commit --- src/T2DLL/T2ImageObj.h | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 src/T2DLL/T2ImageObj.h (limited to 'src/T2DLL/T2ImageObj.h') 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; +}; -- cgit v1.2.3