diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-07-05 19:04:06 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-07-05 19:04:06 +0100 |
commit | 5e61c1280c15ab9969b94cd360cafd4a11b2dd30 (patch) | |
tree | 1fdb60d771c4351b5aa5dcf1a43376c0558625a4 /src/Bitmap.h | |
parent | c2efba6907fab934a04959b9bb644cf7141cc955 (diff) | |
download | t2win-5e61c1280c15ab9969b94cd360cafd4a11b2dd30.tar.gz t2win-5e61c1280c15ab9969b94cd360cafd4a11b2dd30.zip |
matched T2.exe
Diffstat (limited to '')
-rw-r--r-- | src/Bitmap.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/Bitmap.h b/src/Bitmap.h new file mode 100644 index 0000000..3c11764 --- /dev/null +++ b/src/Bitmap.h @@ -0,0 +1,37 @@ +#pragma once +#include "common.h" + +class Bitmap { +public: + Bitmap(); + ~Bitmap(); + void Free(); + BOOL AllocateHeader(); + void SetErrorCode(int code); + BOOL SetHeader(const Bitmap *other); + BOOL LoadFile(const char *path); + BOOL InitHeader(int width, int height); + BOOL InitGreyscalePalette(); + BOOL Allocate(int width, int height); + void Draw(HDC dc, int x, int y); + void Draw(HDC dc, const RECT &rect); + HPALETTE CreatePalette(); + BOOL DrawBitmap(const Bitmap *bmp, RECT srcRect, RECT destRect); + BOOL DrawBitmap(const Bitmap *bmp, RECT srcRect, RECT destRect, BYTE transparentCol); + BOOL SetPalette(const Bitmap *other); + BYTE GetPixel(int x, int y) const; + int GetPixel(POINT pt) const; + void SetRect(int left, int top, int right, int bottom); + void SetDefaultRect(); + int GetHeight() const; + int GetWidth() const; + int GetBitmapHeaderSize() const { return sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256; } + RGBQUAD *GetColors() { return mBitmap->bmiColors; } + +protected: + BITMAPINFO *mBitmap; + BYTE *mPixels; + RGBQUAD *mColors; + int mErrorCode; + RECT mRect; +}; |