7 #ifndef _INC_cImageGDIP_H
8 #define _INC_cImageGDIP_H
15 #if defined(_WIN32) && (_MSC_VER >= 1300) && ! defined(UNDER_CE)
17 #include "../WinAPI/cWinResource.h"
53 typedef cImageBase SUPER_t;
56 static const FILECHAR_t*
const k_szImageExtsRev[CIMAGEGDIP_QTY + 1];
57 static const FILECHAR_t*
const k_szImageExts[CIMAGEGDIP_QTY + 1];
59 int m_iLockSurfaceCount;
60 cNewPtr<Gdiplus::Bitmap> m_pBitmap;
61 Gdiplus::BitmapData m_Data;
67 bool UpdateSurfaceParams();
72 , m_iLockSurfaceCount(0)
75 cImageGDIP(
const wchar_t* pwFile);
76 cImageGDIP(
const char* pwFile);
77 cImageGDIP(
const GChar_t* pResName,
const void* pResType = RT_RCDATA, HMODULE hInst =
HMODULE_NULL)
79 LoadResource(pResName, pResType, hInst);
83 LoadResource(
id, pResType, hInst);
85 virtual ~cImageGDIP();
87 virtual bool isValidImage() const noexcept
override
90 return m_pBitmap !=
nullptr;
93 virtual void SetEmpty()
override;
96 HRESULT LoadDirectDrawSurface7(IN IDirectDrawSurface7* pSurface);
97 HRESULT LoadFileGDIP(
const wchar_t* pwFile);
98 HRESULT LoadFileGDIP(
const char* pszFile);
101 return LoadFileGDIP(pszFileName);
104 HRESULT LoadFileWildcard(
const FILECHAR_t* pszFilePath,
bool bPreferCompressed =
false);
109 void CopyTo(cSurfaceBase& TexDst,
PIXELS_t itxs,
PIXELS_t itys,
bool bTextureXReverse,
bool bTextureYReverse)
const;
110 void CopyFrom(
const cSurfaceBase& TexSrc,
PIXELS_t itxs,
PIXELS_t itys,
bool bTextureXReverse,
bool bTextureYReverse,
bool bColorReverse);
112 HRESULT LockSurface(Gdiplus::PixelFormat ePixelFormat = PixelFormatDontCare,
bool bWrite =
false);
113 void UnlockSurface();
115 operator Gdiplus::Bitmap*()
const
129 :
public cSingleton<cImageGDIPType>
136 friend class cSingleton<cImageGDIPType>;
139 ULONG_PTR m_gdiplusToken;
149 virtual bool IsFileExt(
const FILECHAR_t* pszFileExt)
const
156 return new cImageGDIP;
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define UNREFERENCED_PARAMETER(P)
< _WIN32 type thing. get rid of stupid warning.
Definition: SysTypes.h:299
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define HMODULE_NULL
Definition: cOSModule.h:31
Definition: cImageBase.h:66
cRefPtr< cImageBase > cImageBasePtr
Definition: cImageBase.h:64
UNITTEST2_PREDEF(cQuadtree)
int PIXELS_t
Count of pixels in a dimension of some image/surface.
Definition: cSurfaceInfo.h:20
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
WORD RESOURCEID_t
A resource in .RC attached to a file/module. like MAKEINTRESOURCE(). https://docs....
Definition: cResourceBase.h:19
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26
class __DECL_IMPORT cStreamInput
Definition: cString.h:26
Definition: IUnknown.h:34