ReactOS 0.4.15-dev-5863-g1fe3ab7
ATL::CImage Class Reference

#include <atlimage.h>

Collaboration diagram for ATL::CImage:

Classes

struct  COMMON
 
struct  EXTENSION_ENTRY
 
struct  FILTER_DATA
 
struct  FORMAT_ENTRY
 
struct  MYBITMAPINFOEX
 

Public Types

enum  { createAlphaChannel = 1 }
 
enum  DIBOrientation { DIBOR_DEFAULT , DIBOR_BOTTOMUP , DIBOR_TOPDOWN }
 
enum  ExcludeFlags {
  excludeGIF = 0x01 , excludeBMP = 0x02 , excludeEMF = 0x04 , excludeWMF = 0x08 ,
  excludeJPEG = 0x10 , excludePNG = 0x20 , excludeTIFF = 0x40 , excludeIcon = 0x80 ,
  excludeOther = 0x80000000 , excludeDefaultLoad = 0 , excludeDefaultSave = excludeIcon | excludeEMF | excludeWMF
}
 

Public Member Functions

 CImage () throw ()
 
 ~CImage ()
 
 operator HBITMAP ()
 
void Attach (HBITMAP hBitmap, DIBOrientation eOrientation=DIBOR_DEFAULT)
 
HBITMAP Detach () throw ()
 
HDC GetDC () const throw ()
 
void ReleaseDC () const throw ()
 
BOOL AlphaBlend (HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, BYTE bSrcAlpha=0xFF, BYTE bBlendOp=AC_SRC_OVER) const
 
BOOL AlphaBlend (HDC hDestDC, int xDest, int yDest, BYTE bSrcAlpha=0xFF, BYTE bBlendOp=AC_SRC_OVER) const
 
BOOL AlphaBlend (HDC hDestDC, const POINT &pointDest, BYTE bSrcAlpha=0xFF, BYTE bBlendOp=AC_SRC_OVER) const
 
BOOL AlphaBlend (HDC hDestDC, const RECT &rectDest, const RECT &rectSrc, BYTE bSrcAlpha=0xFF, BYTE bBlendOp=AC_SRC_OVER) const
 
BOOL BitBlt (HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, DWORD dwROP=SRCCOPY) const throw ()
 
BOOL BitBlt (HDC hDestDC, int xDest, int yDest, DWORD dwROP=SRCCOPY) const throw ()
 
BOOL BitBlt (HDC hDestDC, const POINT &pointDest, DWORD dwROP=SRCCOPY) const throw ()
 
BOOL BitBlt (HDC hDestDC, const RECT &rectDest, const POINT &pointSrc, DWORD dwROP=SRCCOPY) const throw ()
 
BOOL Create (int nWidth, int nHeight, int nBPP, DWORD dwFlags=0) throw ()
 
BOOL CreateEx (int nWidth, int nHeight, int nBPP, DWORD eCompression, const DWORD *pdwBitmasks=NULL, DWORD dwFlags=0) throw ()
 
void Destroy () throw ()
 
BOOL Draw (HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight) const throw ()
 
BOOL Draw (HDC hDestDC, const RECT &rectDest, const RECT &rectSrc) const throw ()
 
BOOL Draw (HDC hDestDC, int xDest, int yDest) const throw ()
 
BOOL Draw (HDC hDestDC, const POINT &pointDest) const throw ()
 
BOOL Draw (HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight) const throw ()
 
BOOL Draw (HDC hDestDC, const RECT &rectDest) const throw ()
 
voidGetBits () throw ()
 
int GetBPP () const throw ()
 
void GetColorTable (UINT iFirstColor, UINT nColors, RGBQUAD *prgbColors) const throw ()
 
int GetHeight () const throw ()
 
int GetMaxColorTableEntries () const throw ()
 
int GetPitch () const throw ()
 
COLORREF GetPixel (int x, int y) const throw ()
 
voidGetPixelAddress (int x, int y) throw ()
 
COLORREF GetTransparentColor () const throw ()
 
int GetWidth () const throw ()
 
bool IsDIBSection () const throw ()
 
bool IsIndexed () const throw ()
 
bool IsNull () const throw ()
 
HRESULT Load (LPCTSTR pszFileName) throw ()
 
HRESULT Load (IStream *pStream) throw ()
 
void LoadFromResource (HINSTANCE hInstance, LPCTSTR pszResourceName) throw ()
 
void LoadFromResource (HINSTANCE hInstance, UINT nIDResource) throw ()
 
BOOL MaskBlt (HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, HBITMAP hbmMask, int xMask, int yMask, DWORD dwROP=SRCCOPY) const throw ()
 
BOOL MaskBlt (HDC hDestDC, const RECT &rectDest, const POINT &pointSrc, HBITMAP hbmMask, const POINT &pointMask, DWORD dwROP=SRCCOPY) const throw ()
 
BOOL MaskBlt (HDC hDestDC, int xDest, int yDest, HBITMAP hbmMask, DWORD dwROP=SRCCOPY) const throw ()
 
BOOL MaskBlt (HDC hDestDC, const POINT &pointDest, HBITMAP hbmMask, DWORD dwROP=SRCCOPY) const throw ()
 
BOOL PlgBlt (HDC hDestDC, const POINT *pPoints, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, HBITMAP hbmMask=NULL, int xMask=0, int yMask=0) const throw ()
 
BOOL PlgBlt (HDC hDestDC, const POINT *pPoints, HBITMAP hbmMask=NULL) const throw ()
 
BOOL PlgBlt (HDC hDestDC, const POINT *pPoints, const RECT &rectSrc, HBITMAP hbmMask, const POINT &pointMask) const throw ()
 
BOOL PlgBlt (HDC hDestDC, const POINT *pPoints, const RECT &rectSrc, HBITMAP hbmMask=NULL) const throw ()
 
void ReleaseGDIPlus () throw ()
 
HRESULT Save (IStream *pStream, GUID *guidFileType) const throw ()
 
HRESULT Save (LPCTSTR pszFileName, REFGUID guidFileType=GUID_NULL) const throw ()
 
void SetColorTable (UINT iFirstColor, UINT nColors, const RGBQUAD *prgbColors) throw ()
 
void SetPixel (int x, int y, COLORREF color) throw ()
 
void SetPixelIndexed (int x, int y, int iIndex) throw ()
 
void SetPixelRGB (int x, int y, BYTE r, BYTE g, BYTE b) throw ()
 
COLORREF SetTransparentColor (COLORREF rgbTransparent) throw ()
 
BOOL StretchBlt (HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwROP=SRCCOPY) const throw ()
 
BOOL StretchBlt (HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, DWORD dwROP=SRCCOPY) const throw ()
 
BOOL StretchBlt (HDC hDestDC, const RECT &rectDest, DWORD dwROP=SRCCOPY) const throw ()
 
BOOL StretchBlt (HDC hDestDC, const RECT &rectDest, const RECT &rectSrc, DWORD dwROP=SRCCOPY) const throw ()
 
BOOL TransparentBlt (HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, UINT crTransparent=CLR_INVALID) const throw ()
 
BOOL TransparentBlt (HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, UINT crTransparent=CLR_INVALID) const throw ()
 
BOOL TransparentBlt (HDC hDestDC, const RECT &rectDest, UINT crTransparent=CLR_INVALID) const throw ()
 
BOOL TransparentBlt (HDC hDestDC, const RECT &rectDest, const RECT &rectSrc, UINT crTransparent=CLR_INVALID) const throw ()
 

Static Public Member Functions

static BOOL IsTransparencySupported () throw ()
 
static HRESULT GetImporterFilterString (CSimpleString &strImporters, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription=NULL, DWORD dwExclude=excludeDefaultLoad, TCHAR chSeparator=TEXT('|'))
 
static HRESULT GetExporterFilterString (CSimpleString &strExporters, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription=NULL, DWORD dwExclude=excludeDefaultSave, TCHAR chSeparator=TEXT('|'))
 

Protected Member Functions

LPCWSTR GetFileExtension (LPCWSTR pszFileName) const
 
COLORREF RGBFromPaletteIndex (int iIndex) const
 
const GUIDFileTypeFromExtension (LPCWSTR pszExt) const
 
bool GetClsidFromFileType (CLSID *clsid, const GUID *guid) const
 
int GetEncoderClsid (LPCWSTR mime, CLSID *clsid) const
 
bool IsGuidEqual (const GUID &guid1, const GUID &guid2) const
 
void AttachInternal (HBITMAP hBitmap, DIBOrientation eOrientation, LONG iTransColor)
 
BOOL CreateInternal (int nWidth, int nHeight, int nBPP, DWORD eCompression, const DWORD *pdwBitmasks=NULL, DWORD dwFlags=0) throw ()
 

Static Protected Member Functions

static HRESULT GetCommonFilterString (CSimpleString &strFilter, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription, DWORD dwExclude, TCHAR chSeparator)
 
static COMMON *& GetCommonPtr ()
 
static COMMONGetCommon ()
 

Protected Attributes

HBITMAP m_hbm
 
HGDIOBJ m_hbmOld
 
HDC m_hDC
 
DIBOrientation m_eOrientation
 
bool m_bHasAlphaCh
 
bool m_bIsDIBSec
 
COLORREF m_rgbTransColor
 
union {
   BITMAP   m_bm
 
   DIBSECTION   m_ds
 
}; 
 

Private Member Functions

 CImage (const CImage &)
 
CImageoperator= (const CImage &)
 

Detailed Description

Definition at line 32 of file atlimage.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
createAlphaChannel 

Definition at line 36 of file atlimage.h.

37 {
38 createAlphaChannel = 1 // enable alpha
39 };
@ createAlphaChannel
Definition: atlimage.h:38

◆ DIBOrientation

Enumerator
DIBOR_DEFAULT 
DIBOR_BOTTOMUP 
DIBOR_TOPDOWN 

Definition at line 42 of file atlimage.h.

43 {
44 DIBOR_DEFAULT, // default
45 DIBOR_BOTTOMUP, // bottom-up DIB
46 DIBOR_TOPDOWN // top-down DIB
47 };
@ DIBOR_DEFAULT
Definition: atlimage.h:44
@ DIBOR_TOPDOWN
Definition: atlimage.h:46
@ DIBOR_BOTTOMUP
Definition: atlimage.h:45

◆ ExcludeFlags

Enumerator
excludeGIF 
excludeBMP 
excludeEMF 
excludeWMF 
excludeJPEG 
excludePNG 
excludeTIFF 
excludeIcon 
excludeOther 
excludeDefaultLoad 
excludeDefaultSave 

Definition at line 701 of file atlimage.h.

702 {
703 excludeGIF = 0x01,
704 excludeBMP = 0x02,
705 excludeEMF = 0x04,
706 excludeWMF = 0x08,
707 excludeJPEG = 0x10,
708 excludePNG = 0x20,
709 excludeTIFF = 0x40,
710 excludeIcon = 0x80,
711 excludeOther = 0x80000000,
714 };
@ excludeDefaultLoad
Definition: atlimage.h:712
@ excludeDefaultSave
Definition: atlimage.h:713
@ excludeOther
Definition: atlimage.h:711

Constructor & Destructor Documentation

◆ CImage() [1/2]

ATL::CImage::CImage ( )
throw (
)
inline

Definition at line 49 of file atlimage.h.

50 {
51 m_hbm = NULL;
52 m_hbmOld = NULL;
53 m_hDC = NULL;
54
56 m_bHasAlphaCh = false;
57 m_bIsDIBSec = false;
59 ZeroMemory(&m_ds, sizeof(m_ds));
60
61 if (GetCommon().AddRef() == 1)
62 {
64 }
65 }
DIBOrientation m_eOrientation
Definition: atlimage.h:997
HBITMAP m_hbm
Definition: atlimage.h:994
COLORREF m_rgbTransColor
Definition: atlimage.h:1000
bool m_bIsDIBSec
Definition: atlimage.h:999
DIBSECTION m_ds
Definition: atlimage.h:1004
bool m_bHasAlphaCh
Definition: atlimage.h:998
HGDIOBJ m_hbmOld
Definition: atlimage.h:995
static COMMON & GetCommon()
Definition: atlimage.h:985
#define NULL
Definition: types.h:112
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
HINSTANCE LoadLib()
Definition: atlimage.h:922
#define ZeroMemory
Definition: winbase.h:1670
#define CLR_INVALID
Definition: wingdi.h:883

◆ ~CImage()

ATL::CImage::~CImage ( )
inline

Definition at line 67 of file atlimage.h.

68 {
69 Destroy();
71 }
void Destroy()
Definition: atlimage.h:208
void ReleaseGDIPlus()
Definition: atlimage.h:513

◆ CImage() [2/2]

ATL::CImage::CImage ( const CImage )
private

Member Function Documentation

◆ AlphaBlend() [1/4]

BOOL ATL::CImage::AlphaBlend ( HDC  hDestDC,
const POINT pointDest,
BYTE  bSrcAlpha = 0xFF,
BYTE  bBlendOp = AC_SRC_OVER 
) const
inline

Definition at line 150 of file atlimage.h.

152 {
153 return AlphaBlend(hDestDC, pointDest.x, pointDest.y, bSrcAlpha, bBlendOp);
154 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define AlphaBlend
Definition: misc.c:293

◆ AlphaBlend() [2/4]

BOOL ATL::CImage::AlphaBlend ( HDC  hDestDC,
const RECT rectDest,
const RECT rectSrc,
BYTE  bSrcAlpha = 0xFF,
BYTE  bBlendOp = AC_SRC_OVER 
) const
inline

Definition at line 155 of file atlimage.h.

157 {
158 return AlphaBlend(hDestDC, rectDest.left, rectDest.top,
159 rectDest.right - rectDest.left,
160 rectDest.bottom - rectDest.top,
161 rectSrc.left, rectSrc.top,
162 rectSrc.right - rectSrc.left,
163 rectSrc.bottom - rectSrc.top,
164 bSrcAlpha, bBlendOp);
165 }
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306

◆ AlphaBlend() [3/4]

BOOL ATL::CImage::AlphaBlend ( HDC  hDestDC,
int  xDest,
int  yDest,
BYTE  bSrcAlpha = 0xFF,
BYTE  bBlendOp = AC_SRC_OVER 
) const
inline

Definition at line 142 of file atlimage.h.

144 {
145 int width = GetWidth();
146 int height = GetHeight();
147 return AlphaBlend(hDestDC, xDest, yDest, width, height, 0, 0,
148 width, height, bSrcAlpha, bBlendOp);
149 }
int GetWidth() const
Definition: atlimage.h:354
int GetHeight() const
Definition: atlimage.h:297
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546

◆ AlphaBlend() [4/4]

BOOL ATL::CImage::AlphaBlend ( HDC  hDestDC,
int  xDest,
int  yDest,
int  nDestWidth,
int  nDestHeight,
int  xSrc,
int  ySrc,
int  nSrcWidth,
int  nSrcHeight,
BYTE  bSrcAlpha = 0xFF,
BYTE  bBlendOp = AC_SRC_OVER 
) const
inline

Definition at line 123 of file atlimage.h.

127 {
129
130 BLENDFUNCTION bf;
131 bf.BlendOp = bBlendOp;
132 bf.BlendFlags = 0;
133 bf.SourceConstantAlpha = bSrcAlpha;
135
136 GetDC();
137 BOOL ret = ::AlphaBlend(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
138 m_hDC, xSrc, ySrc, nSrcWidth, nSrcHeight, bf);
139 ReleaseDC();
140 return ret;
141 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HDC GetDC() const
Definition: atlimage.h:96
void ReleaseDC() const
Definition: atlimage.h:106
static BOOL IsTransparencySupported()
Definition: atlimage.h:696
unsigned int BOOL
Definition: ntddk_ex.h:94
#define AC_SRC_ALPHA
Definition: alphablend.c:9
BYTE BlendOp
Definition: wingdi.h:2759
BYTE BlendFlags
Definition: wingdi.h:2760
BYTE AlphaFormat
Definition: wingdi.h:2762
BYTE SourceConstantAlpha
Definition: wingdi.h:2761
int ret

◆ Attach()

void ATL::CImage::Attach ( HBITMAP  hBitmap,
DIBOrientation  eOrientation = DIBOR_DEFAULT 
)
inline

Definition at line 79 of file atlimage.h.

80 {
81 AttachInternal(hBitmap, eOrientation, -1);
82 }
void AttachInternal(HBITMAP hBitmap, DIBOrientation eOrientation, LONG iTransColor)
Definition: atlimage.h:1128
static HBITMAP hBitmap
Definition: timezone.c:26

Referenced by Load(), and LoadFromResource().

◆ AttachInternal()

void ATL::CImage::AttachInternal ( HBITMAP  hBitmap,
DIBOrientation  eOrientation,
LONG  iTransColor 
)
inlineprotected

Definition at line 1128 of file atlimage.h.

1130 {
1131 Destroy();
1132
1133 const int size = sizeof(DIBSECTION);
1135
1136 bool bOK = (::GetObject(hBitmap, sizeof(BITMAP), &m_bm) != 0);
1137
1138 if (bOK)
1139 {
1140 m_hbm = hBitmap;
1141 m_eOrientation = eOrientation;
1142 m_bHasAlphaCh = (m_bm.bmBitsPixel == 32);
1144 }
1145 }
BITMAP m_bm
Definition: atlimage.h:1003
GLsizeiptr size
Definition: glext.h:5919
Definition: bl.h:1331
struct tagDIBSECTION DIBSECTION
#define GetObject
Definition: wingdi.h:4468

Referenced by Attach(), and CreateInternal().

◆ BitBlt() [1/4]

BOOL ATL::CImage::BitBlt ( HDC  hDestDC,
const POINT pointDest,
DWORD  dwROP = SRCCOPY 
) const
throw (
)
inline

Definition at line 183 of file atlimage.h.

185 {
186 return BitBlt(hDestDC, pointDest.x, pointDest.y, dwROP);
187 }
BOOL BitBlt(HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, DWORD dwROP=SRCCOPY) const
Definition: atlimage.h:167

◆ BitBlt() [2/4]

BOOL ATL::CImage::BitBlt ( HDC  hDestDC,
const RECT rectDest,
const POINT pointSrc,
DWORD  dwROP = SRCCOPY 
) const
throw (
)
inline

Definition at line 188 of file atlimage.h.

190 {
191 return BitBlt(hDestDC, rectDest.left, rectDest.top,
192 rectDest.right - rectDest.left,
193 rectDest.bottom - rectDest.top,
194 pointSrc.x, pointSrc.y, dwROP);
195 }

◆ BitBlt() [3/4]

BOOL ATL::CImage::BitBlt ( HDC  hDestDC,
int  xDest,
int  yDest,
DWORD  dwROP = SRCCOPY 
) const
throw (
)
inline

Definition at line 177 of file atlimage.h.

179 {
180 return BitBlt(hDestDC, xDest, yDest,
181 GetWidth(), GetHeight(), 0, 0, dwROP);
182 }

◆ BitBlt() [4/4]

BOOL ATL::CImage::BitBlt ( HDC  hDestDC,
int  xDest,
int  yDest,
int  nDestWidth,
int  nDestHeight,
int  xSrc,
int  ySrc,
DWORD  dwROP = SRCCOPY 
) const
throw (
)
inline

Definition at line 167 of file atlimage.h.

170 {
171 GetDC();
172 BOOL ret = ::BitBlt(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
173 m_hDC, xSrc, ySrc, dwROP);
174 ReleaseDC();
175 return ret;
176 }

Referenced by BitBlt().

◆ Create()

BOOL ATL::CImage::Create ( int  nWidth,
int  nHeight,
int  nBPP,
DWORD  dwFlags = 0 
)
throw (
)
inline

Definition at line 197 of file atlimage.h.

198 {
199 return CreateEx(nWidth, nHeight, nBPP, BI_RGB, NULL, dwFlags);
200 }
BOOL CreateEx(int nWidth, int nHeight, int nBPP, DWORD eCompression, const DWORD *pdwBitmasks=NULL, DWORD dwFlags=0)
Definition: atlimage.h:202
#define BI_RGB
Definition: precomp.h:47
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

◆ CreateEx()

BOOL ATL::CImage::CreateEx ( int  nWidth,
int  nHeight,
int  nBPP,
DWORD  eCompression,
const DWORD pdwBitmasks = NULL,
DWORD  dwFlags = 0 
)
throw (
)
inline

Definition at line 202 of file atlimage.h.

204 {
205 return CreateInternal(nWidth, nHeight, nBPP, eCompression, pdwBitmasks, dwFlags);
206 }
BOOL CreateInternal(int nWidth, int nHeight, int nBPP, DWORD eCompression, const DWORD *pdwBitmasks=NULL, DWORD dwFlags=0)
Definition: atlimage.h:1147

Referenced by Create().

◆ CreateInternal()

BOOL ATL::CImage::CreateInternal ( int  nWidth,
int  nHeight,
int  nBPP,
DWORD  eCompression,
const DWORD pdwBitmasks = NULL,
DWORD  dwFlags = 0 
)
throw (
)
inlineprotected

Definition at line 1147 of file atlimage.h.

1150 {
1151 ATLASSERT(nWidth != 0);
1152 ATLASSERT(nHeight != 0);
1153
1154 // initialize BITMAPINFO extension
1155 MYBITMAPINFOEX bi;
1156 ZeroMemory(&bi, sizeof(bi));
1157 bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1158 bi.bmiHeader.biWidth = nWidth;
1159 bi.bmiHeader.biHeight = nHeight;
1160 bi.bmiHeader.biPlanes = 1;
1161 bi.bmiHeader.biBitCount = nBPP;
1162 bi.bmiHeader.biCompression = eCompression;
1163
1164 // is there alpha channel?
1165 bool bHasAlphaCh;
1166 bHasAlphaCh = (nBPP == 32 && (dwFlags & createAlphaChannel));
1167
1168 // get orientation
1169 DIBOrientation eOrientation;
1170 eOrientation = ((nHeight > 0) ? DIBOR_BOTTOMUP : DIBOR_TOPDOWN);
1171
1172 // does it have bit fields?
1173 if (eCompression == BI_BITFIELDS)
1174 {
1175 if (nBPP == 16 || nBPP == 32)
1176 {
1177 // store the mask data
1178 LPDWORD pdwMask = reinterpret_cast<LPDWORD>(bi.bmiColors);
1179 pdwMask[0] = pdwBitmasks[0];
1180 pdwMask[1] = pdwBitmasks[1];
1181 pdwMask[2] = pdwBitmasks[2];
1182 }
1183 else
1184 {
1185 return FALSE;
1186 }
1187 }
1188 else
1189 {
1190 ATLASSERT(pdwBitmasks == NULL);
1191 if (pdwBitmasks)
1192 return FALSE;
1193 }
1194
1195 // create a DIB section
1197 ATLASSERT(hDC);
1198 LPVOID pvBits;
1200 &pvBits, NULL, 0);
1201 ATLASSERT(hbm);
1202 ::DeleteDC(hDC);
1203
1204 // attach it
1205 AttachInternal(hbm, eOrientation, -1);
1206 m_bHasAlphaCh = bHasAlphaCh;
1207
1208 return hbm != NULL;
1209 }
static HDC hDC
Definition: 3dtext.c:33
#define FALSE
Definition: types.h:117
#define BI_BITFIELDS
Definition: mmreg.h:507
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
uint32_t * LPDWORD
Definition: typedefs.h:59
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:199
#define DIB_RGB_COLORS
Definition: wingdi.h:367
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by CreateEx().

◆ Destroy()

void ATL::CImage::Destroy ( )
throw (
)
inline

Definition at line 208 of file atlimage.h.

209 {
210 if (m_hbm)
211 {
213 }
214 }
HBITMAP Detach()
Definition: atlimage.h:84
pKey DeleteObject()

Referenced by AttachInternal(), START_TEST(), and ~CImage().

◆ Detach()

HBITMAP ATL::CImage::Detach ( )
throw (
)
inline

Definition at line 84 of file atlimage.h.

85 {
87 m_bHasAlphaCh = false;
89 ZeroMemory(&m_ds, sizeof(m_ds));
90
92 m_hbm = NULL;
93 return hBitmap;
94 }

Referenced by Destroy().

◆ Draw() [1/6]

BOOL ATL::CImage::Draw ( HDC  hDestDC,
const POINT pointDest 
) const
throw (
)
inline

Definition at line 254 of file atlimage.h.

255 {
256 return Draw(hDestDC, pointDest.x, pointDest.y);
257 }
BOOL Draw(HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight) const
Definition: atlimage.h:216

◆ Draw() [2/6]

BOOL ATL::CImage::Draw ( HDC  hDestDC,
const RECT rectDest 
) const
throw (
)
inline

Definition at line 264 of file atlimage.h.

265 {
266 return Draw(hDestDC, rectDest.left, rectDest.top,
267 rectDest.right - rectDest.left,
268 rectDest.bottom - rectDest.top);
269 }

◆ Draw() [3/6]

BOOL ATL::CImage::Draw ( HDC  hDestDC,
const RECT rectDest,
const RECT rectSrc 
) const
throw (
)
inline

Definition at line 241 of file atlimage.h.

242 {
243 return Draw(hDestDC, rectDest.left, rectDest.top,
244 rectDest.right - rectDest.left,
245 rectDest.bottom - rectDest.top,
246 rectSrc.left, rectSrc.top,
247 rectSrc.right - rectSrc.left,
248 rectSrc.bottom - rectSrc.top);
249 }

◆ Draw() [4/6]

BOOL ATL::CImage::Draw ( HDC  hDestDC,
int  xDest,
int  yDest 
) const
throw (
)
inline

Definition at line 250 of file atlimage.h.

251 {
252 return Draw(hDestDC, xDest, yDest, GetWidth(), GetHeight());
253 }

◆ Draw() [5/6]

BOOL ATL::CImage::Draw ( HDC  hDestDC,
int  xDest,
int  yDest,
int  nDestWidth,
int  nDestHeight 
) const
throw (
)
inline

Definition at line 258 of file atlimage.h.

260 {
261 return Draw(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
262 0, 0, GetWidth(), GetHeight());
263 }

◆ Draw() [6/6]

BOOL ATL::CImage::Draw ( HDC  hDestDC,
int  xDest,
int  yDest,
int  nDestWidth,
int  nDestHeight,
int  xSrc,
int  ySrc,
int  nSrcWidth,
int  nSrcHeight 
) const
throw (
)
inline

Definition at line 216 of file atlimage.h.

218 {
220 if (m_bHasAlphaCh)
221 {
222 return AlphaBlend(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
223 xSrc, ySrc, nSrcWidth, nSrcHeight);
224 }
225 else if (m_rgbTransColor != CLR_INVALID)
226 {
228 if ((m_rgbTransColor & 0xFF000000) == 0x01000000)
230 else
232 return TransparentBlt(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
233 xSrc, ySrc, nSrcWidth, nSrcHeight, rgb);
234 }
235 else
236 {
237 return StretchBlt(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
238 xSrc, ySrc, nSrcWidth, nSrcHeight);
239 }
240 }
COLORREF RGBFromPaletteIndex(int iIndex) const
Definition: atlimage.h:1016
BOOL StretchBlt(HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwROP=SRCCOPY) const
Definition: atlimage.h:621
#define TransparentBlt
Definition: misc.c:292
_In_ ULONG _In_ ULONG rgb
Definition: winddi.h:3521
DWORD COLORREF
Definition: windef.h:300

Referenced by Draw(), and START_TEST().

◆ FileTypeFromExtension()

const GUID * ATL::CImage::FileTypeFromExtension ( LPCWSTR  pszExt) const
inlineprotected

Definition at line 1030 of file atlimage.h.

1031 {
1032 static const EXTENSION_ENTRY table[] =
1033 {
1034 {L".jpg", Gdiplus::ImageFormatJPEG},
1035 {L".png", Gdiplus::ImageFormatPNG},
1036 {L".bmp", Gdiplus::ImageFormatBMP},
1037 {L".gif", Gdiplus::ImageFormatGIF},
1038 {L".tif", Gdiplus::ImageFormatTIFF},
1039 {L".jpeg", Gdiplus::ImageFormatJPEG},
1040 {L".jpe", Gdiplus::ImageFormatJPEG},
1041 {L".jfif", Gdiplus::ImageFormatJPEG},
1042 {L".dib", Gdiplus::ImageFormatBMP},
1043 {L".rle", Gdiplus::ImageFormatBMP},
1044 {L".tiff", Gdiplus::ImageFormatTIFF}
1045 };
1046 const size_t count = _countof(table);
1047 for (size_t i = 0; i < count; ++i)
1048 {
1049 if (::lstrcmpiW(table[i].pszExt, pszExt) == 0)
1050 return &table[i].guid;
1051 }
1052 return NULL;
1053 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define L(x)
Definition: ntvdm.h:50
#define _countof(array)
Definition: sndvol32.h:68

Referenced by Save().

◆ GetBits()

void * ATL::CImage::GetBits ( )
throw (
)
inline

Definition at line 271 of file atlimage.h.

272 {
274 BYTE *pb = (BYTE *)m_bm.bmBits;
276 {
277 pb += m_bm.bmWidthBytes * (m_bm.bmHeight - 1);
278 }
279 return pb;
280 }
bool IsDIBSection() const
Definition: atlimage.h:360
if(dx< 0)
Definition: linetemp.h:194
unsigned char BYTE
Definition: xxhash.c:193

Referenced by GetPixelAddress().

◆ GetBPP()

int ATL::CImage::GetBPP ( ) const
throw (
)
inline

Definition at line 282 of file atlimage.h.

283 {
285 return m_bm.bmBitsPixel;
286 }

Referenced by GetPixelAddress(), IsIndexed(), and START_TEST().

◆ GetClsidFromFileType()

bool ATL::CImage::GetClsidFromFileType ( CLSID clsid,
const GUID guid 
) const
inlineprotected

Definition at line 1061 of file atlimage.h.

1062 {
1063 static const FORMAT_ENTRY table[] =
1064 {
1065 {Gdiplus::ImageFormatJPEG, L"image/jpeg"},
1066 {Gdiplus::ImageFormatPNG, L"image/png"},
1067 {Gdiplus::ImageFormatBMP, L"image/bmp"},
1068 {Gdiplus::ImageFormatGIF, L"image/gif"},
1069 {Gdiplus::ImageFormatTIFF, L"image/tiff"}
1070 };
1071 const size_t count = _countof(table);
1072 for (size_t i = 0; i < count; ++i)
1073 {
1074 if (IsGuidEqual(table[i].guid, *guid))
1075 {
1077 if (num >= 0)
1078 {
1079 return true;
1080 }
1081 }
1082 }
1083 return false;
1084 }
int GetEncoderClsid(LPCWSTR mime, CLSID *clsid) const
Definition: atlimage.h:1086
bool IsGuidEqual(const GUID &guid1, const GUID &guid2) const
Definition: atlimage.h:1116
GLuint GLuint num
Definition: glext.h:9618
const GUID * guid
const WCHAR * mime
Definition: mimefilter.c:512
REFCLSID clsid
Definition: msctf.c:82

Referenced by Save().

◆ GetColorTable()

void ATL::CImage::GetColorTable ( UINT  iFirstColor,
UINT  nColors,
RGBQUAD prgbColors 
) const
throw (
)
inline

Definition at line 288 of file atlimage.h.

290 {
292 GetDC();
293 ::GetDIBColorTable(m_hDC, iFirstColor, nColors, prgbColors);
294 ReleaseDC();
295 }
UINT WINAPI GetDIBColorTable(HDC hDC, UINT iStartIndex, UINT cEntries, RGBQUAD *pColors)
Definition: palette.c:123

Referenced by RGBFromPaletteIndex().

◆ GetCommon()

static COMMON & ATL::CImage::GetCommon ( )
inlinestaticprotected

Definition at line 985 of file atlimage.h.

986 {
987 COMMON*& pCommon = GetCommonPtr();
988 if (pCommon == NULL)
989 pCommon = new COMMON;
990 return *pCommon;
991 }
static COMMON *& GetCommonPtr()
Definition: atlimage.h:979

Referenced by CImage(), GetEncoderClsid(), Load(), and Save().

◆ GetCommonFilterString()

static HRESULT ATL::CImage::GetCommonFilterString ( CSimpleString strFilter,
CSimpleArray< GUID > &  aguidFileTypes,
LPCTSTR  pszAllFilesDescription,
DWORD  dwExclude,
TCHAR  chSeparator 
)
inlinestaticprotected

Definition at line 724 of file atlimage.h.

730 {
731 static const FILTER_DATA table[] =
732 {
733 {excludeBMP, TEXT("BMP"), TEXT("*.BMP;*.DIB;*.RLE"), &Gdiplus::ImageFormatBMP},
734 {excludeJPEG, TEXT("JPEG"), TEXT("*.JPG;*.JPEG;*.JPE;*.JFIF"), &Gdiplus::ImageFormatJPEG},
735 {excludeGIF, TEXT("GIF"), TEXT("*.GIF"), &Gdiplus::ImageFormatGIF},
736 {excludeEMF, TEXT("EMF"), TEXT("*.EMF"), &Gdiplus::ImageFormatEMF},
737 {excludeWMF, TEXT("WMF"), TEXT("*.WMF"), &Gdiplus::ImageFormatWMF},
738 {excludeTIFF, TEXT("TIFF"), TEXT("*.TIF;*.TIFF"), &Gdiplus::ImageFormatTIFF},
739 {excludePNG, TEXT("PNG"), TEXT("*.PNG"), &Gdiplus::ImageFormatPNG},
740 {excludeIcon, TEXT("ICO"), TEXT("*.ICO"), &Gdiplus::ImageFormatIcon}
741 };
742
743 if (pszAllFilesDescription)
744 {
745 strFilter += pszAllFilesDescription;
746 strFilter += chSeparator;
747
748 BOOL bFirst = TRUE;
749 for (size_t i = 0; i < _countof(table); ++i)
750 {
751 if ((dwExclude & table[i].dwExclude) != 0)
752 continue;
753
754 if (bFirst)
755 bFirst = FALSE;
756 else
757 strFilter += TEXT(';');
758
759 strFilter += table[i].extensions;
760 }
761 strFilter += chSeparator;
762
763 aguidFileTypes.Add(GUID_NULL);
764 }
765
766 for (size_t i = 0; i < _countof(table); ++i)
767 {
768 if ((dwExclude & table[i].dwExclude) != 0)
769 continue;
770 strFilter += table[i].title;
771 strFilter += TEXT(" (");
772 strFilter += table[i].extensions;
773 strFilter += TEXT(")");
774 strFilter += chSeparator;
775 strFilter += table[i].extensions;
776 strFilter += chSeparator;
777
778 aguidFileTypes.Add(*table[i].guid);
779 }
780
781 strFilter += chSeparator;
782
783 return S_OK;
784 }
#define TRUE
Definition: types.h:120
#define S_OK
Definition: intsafe.h:52
#define TEXT(s)
Definition: k32.h:26
#define GUID_NULL
Definition: ks.h:106

Referenced by GetExporterFilterString(), and GetImporterFilterString().

◆ GetCommonPtr()

static COMMON *& ATL::CImage::GetCommonPtr ( )
inlinestaticprotected

Definition at line 979 of file atlimage.h.

980 {
981 static COMMON *s_pCommon = NULL;
982 return s_pCommon;
983 }

Referenced by GetCommon(), and ReleaseGDIPlus().

◆ GetDC()

HDC ATL::CImage::GetDC ( ) const
throw (
)
inline

Definition at line 96 of file atlimage.h.

97 {
98 if (m_hDC)
99 return m_hDC;
100
103 return m_hDC;
104 }
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539

Referenced by AlphaBlend(), BitBlt(), GetColorTable(), GetPixel(), MaskBlt(), PlgBlt(), SetColorTable(), SetPixel(), SetPixelIndexed(), START_TEST(), StretchBlt(), and TransparentBlt().

◆ GetEncoderClsid()

int ATL::CImage::GetEncoderClsid ( LPCWSTR  mime,
CLSID clsid 
) const
inlineprotected

Definition at line 1086 of file atlimage.h.

1087 {
1088 UINT count = 0, total_size = 0;
1089 GetCommon().GetImageEncodersSize(&count, &total_size);
1090 if (total_size == 0)
1091 return -1; // failure
1092
1093 Gdiplus::ImageCodecInfo *pInfo;
1094 BYTE *pb = new BYTE[total_size];
1095 ATLASSERT(pb);
1096 pInfo = reinterpret_cast<Gdiplus::ImageCodecInfo *>(pb);
1097 if (pInfo == NULL)
1098 return -1; // failure
1099
1100 GetCommon().GetImageEncoders(count, total_size, pInfo);
1101
1102 for (UINT iInfo = 0; iInfo < count; ++iInfo)
1103 {
1104 if (::lstrcmpiW(pInfo[iInfo].MimeType, mime) == 0)
1105 {
1106 *clsid = pInfo[iInfo].Clsid;
1107 delete[] pb;
1108 return iInfo; // success
1109 }
1110 }
1111
1112 delete[] pb;
1113 return -1; // failure
1114 }
unsigned int UINT
Definition: ndis.h:50
GETIMAGEENCODERS GetImageEncoders
Definition: atlimage.h:875
GETIMAGEENCODERSSIZE GetImageEncodersSize
Definition: atlimage.h:874

Referenced by GetClsidFromFileType().

◆ GetExporterFilterString()

static HRESULT ATL::CImage::GetExporterFilterString ( CSimpleString strExporters,
CSimpleArray< GUID > &  aguidFileTypes,
LPCTSTR  pszAllFilesDescription = NULL,
DWORD  dwExclude = excludeDefaultSave,
TCHAR  chSeparator = TEXT('|') 
)
inlinestatic

Definition at line 801 of file atlimage.h.

807 {
808 return GetCommonFilterString(strExporters,
809 aguidFileTypes,
810 pszAllFilesDescription,
811 dwExclude,
812 chSeparator);
813 }
static HRESULT GetCommonFilterString(CSimpleString &strFilter, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription, DWORD dwExclude, TCHAR chSeparator)
Definition: atlimage.h:724

Referenced by _tWinMain(), and START_TEST().

◆ GetFileExtension()

LPCWSTR ATL::CImage::GetFileExtension ( LPCWSTR  pszFileName) const
inlineprotected

Definition at line 1007 of file atlimage.h.

1008 {
1010 if (pch == NULL)
1011 pch = wcsrchr(pszFileName, L'/');
1012 pch = (pch ? wcsrchr(pch, L'.') : wcsrchr(pszFileName, L'.'));
1013 return (pch ? pch : (pszFileName + ::lstrlenW(pszFileName)));
1014 }
#define wcsrchr
Definition: compat.h:16
#define lstrlenW
Definition: compat.h:750
#define pch(ap)
Definition: match.c:418
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by Save().

◆ GetHeight()

int ATL::CImage::GetHeight ( ) const
throw (
)
inline

Definition at line 297 of file atlimage.h.

298 {
300 return m_bm.bmHeight;
301 }

Referenced by AlphaBlend(), BitBlt(), Draw(), MaskBlt(), PlgBlt(), START_TEST(), StretchBlt(), and TransparentBlt().

◆ GetImporterFilterString()

static HRESULT ATL::CImage::GetImporterFilterString ( CSimpleString strImporters,
CSimpleArray< GUID > &  aguidFileTypes,
LPCTSTR  pszAllFilesDescription = NULL,
DWORD  dwExclude = excludeDefaultLoad,
TCHAR  chSeparator = TEXT('|') 
)
inlinestatic

Definition at line 787 of file atlimage.h.

793 {
794 return GetCommonFilterString(strImporters,
795 aguidFileTypes,
796 pszAllFilesDescription,
797 dwExclude,
798 chSeparator);
799 }

Referenced by _tWinMain(), and START_TEST().

◆ GetMaxColorTableEntries()

int ATL::CImage::GetMaxColorTableEntries ( ) const
throw (
)
inline

Definition at line 303 of file atlimage.h.

304 {
307 return m_ds.dsBmih.biClrUsed;
308 switch (m_bm.bmBitsPixel)
309 {
310 case 1: return 2;
311 case 4: return 16;
312 case 8: return 256;
313 case 16: case 32:
315 return 3;
316 return 0;
317 case 24:
318 default:
319 return 0;
320 }
321 }
USHORT biBitCount
Definition: precomp.h:37
ULONG biCompression
Definition: precomp.h:38
BITMAPINFOHEADER dsBmih
Definition: wingdi.h:1670

◆ GetPitch()

int ATL::CImage::GetPitch ( ) const
throw (
)
inline

Definition at line 323 of file atlimage.h.

324 {
327 return -m_bm.bmWidthBytes;
328 else
329 return m_bm.bmWidthBytes;
330 }

Referenced by GetPixelAddress().

◆ GetPixel()

COLORREF ATL::CImage::GetPixel ( int  x,
int  y 
) const
throw (
)
inline

Definition at line 332 of file atlimage.h.

333 {
334 GetDC();
336 ReleaseDC();
337 return ret;
338 }
COLORREF GetPixel(int x, int y) const
Definition: atlimage.h:332
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by GetPixel(), and START_TEST().

◆ GetPixelAddress()

void * ATL::CImage::GetPixelAddress ( int  x,
int  y 
)
throw (
)
inline

Definition at line 340 of file atlimage.h.

341 {
343 BYTE *pb = (BYTE *)GetBits();
344 pb += GetPitch() * y;
345 pb += (GetBPP() * x) / 8;
346 return pb;
347 }
int GetBPP() const
Definition: atlimage.h:282
void * GetBits()
Definition: atlimage.h:271
int GetPitch() const
Definition: atlimage.h:323

◆ GetTransparentColor()

COLORREF ATL::CImage::GetTransparentColor ( ) const
throw (
)
inline

Definition at line 349 of file atlimage.h.

350 {
351 return m_rgbTransColor;
352 }

◆ GetWidth()

int ATL::CImage::GetWidth ( ) const
throw (
)
inline

Definition at line 354 of file atlimage.h.

355 {
357 return m_bm.bmWidth;
358 }

Referenced by AlphaBlend(), BitBlt(), Draw(), MaskBlt(), PlgBlt(), START_TEST(), StretchBlt(), and TransparentBlt().

◆ IsDIBSection()

bool ATL::CImage::IsDIBSection ( ) const
throw (
)
inline

Definition at line 360 of file atlimage.h.

361 {
363 return m_bIsDIBSec;
364 }

Referenced by GetBits(), GetColorTable(), GetMaxColorTableEntries(), GetPitch(), GetPixelAddress(), IsIndexed(), and SetColorTable().

◆ IsGuidEqual()

bool ATL::CImage::IsGuidEqual ( const GUID guid1,
const GUID guid2 
) const
inlineprotected

Definition at line 1116 of file atlimage.h.

1117 {
1119 if (::UuidEqual(const_cast<GUID *>(&guid1),
1120 const_cast<GUID *>(&guid2), &status))
1121 {
1122 if (status == RPC_S_OK)
1123 return true;
1124 }
1125 return false;
1126 }
static GUID guid2
Definition: devinst.c:42
#define RPC_S_OK
Definition: rpcnterr.h:22
int WINAPI UuidEqual(UUID *Uuid1, UUID *Uuid2, RPC_STATUS *Status)
Definition: rpcrt4_main.c:252
long RPC_STATUS
Definition: rpc.h:52
Definition: ps.c:97

Referenced by GetClsidFromFileType(), and Save().

◆ IsIndexed()

bool ATL::CImage::IsIndexed ( ) const
throw (
)
inline

Definition at line 366 of file atlimage.h.

367 {
369 return GetBPP() <= 8;
370 }

Referenced by SetPixelIndexed().

◆ IsNull()

bool ATL::CImage::IsNull ( ) const
throw (
)
inline

Definition at line 372 of file atlimage.h.

373 {
374 return m_hbm == NULL;
375 }

Referenced by START_TEST().

◆ IsTransparencySupported()

static BOOL ATL::CImage::IsTransparencySupported ( )
throw (
)
inlinestatic

Definition at line 696 of file atlimage.h.

697 {
698 return TRUE;
699 }

Referenced by AlphaBlend(), Draw(), MaskBlt(), PlgBlt(), and TransparentBlt().

◆ Load() [1/2]

HRESULT ATL::CImage::Load ( IStream pStream)
throw (
)
inline

Definition at line 407 of file atlimage.h.

408 {
409 // create GpBitmap from stream
410 using namespace Gdiplus;
411 GpBitmap *pBitmap = NULL;
412 if (GetCommon().CreateBitmapFromStream(pStream, &pBitmap) != Ok)
413 {
414 return E_FAIL;
415 }
416
417 // TODO & FIXME: get parameters (m_rgbTransColor etc.)
418
419 // get bitmap handle
420 HBITMAP hbm = NULL;
421 Color color(0xFF, 0xFF, 0xFF);
422 Gdiplus::Status status;
424 pBitmap, &hbm, color.GetValue());
425
426 // delete Bitmap
427 GetCommon().DisposeImage(pBitmap);
428
429 // attach it
430 if (status == Ok)
431 Attach(hbm);
432 return (status == Ok ? S_OK : E_FAIL);
433 }
void Attach(HBITMAP hBitmap, DIBOrientation eOrientation=DIBOR_DEFAULT)
Definition: atlimage.h:79
#define E_FAIL
Definition: ddrawi.h:102
@ Ok
Definition: gdiplustypes.h:26
GLuint color
Definition: glext.h:6243
DISPOSEIMAGE DisposeImage
Definition: atlimage.h:882
CREATEHBITMAPFROMBITMAP CreateHBITMAPFromBitmap
Definition: atlimage.h:877

◆ Load() [2/2]

HRESULT ATL::CImage::Load ( LPCTSTR  pszFileName)
throw (
)
inline

Definition at line 377 of file atlimage.h.

378 {
379 // convert the file name string into Unicode
380 CStringW pszNameW(pszFileName);
381
382 // create a GpBitmap object from file
383 using namespace Gdiplus;
384 GpBitmap *pBitmap = NULL;
385 if (GetCommon().CreateBitmapFromFile(pszNameW, &pBitmap) != Ok)
386 {
387 return E_FAIL;
388 }
389
390 // TODO & FIXME: get parameters (m_rgbTransColor etc.)
391
392 // get bitmap handle
393 HBITMAP hbm = NULL;
394 Color color(0xFF, 0xFF, 0xFF);
395 Gdiplus::Status status;
397 pBitmap, &hbm, color.GetValue());
398
399 // delete GpBitmap
400 GetCommon().DisposeImage(pBitmap);
401
402 // attach it
403 if (status == Ok)
404 Attach(hbm);
405 return (status == Ok ? S_OK : E_FAIL);
406 }
static CREATEBITMAPFROMFILE CreateBitmapFromFile
Definition: CImage.cpp:83

Referenced by START_TEST().

◆ LoadFromResource() [1/2]

void ATL::CImage::LoadFromResource ( HINSTANCE  hInstance,
LPCTSTR  pszResourceName 
)
throw (
)
inline

Definition at line 436 of file atlimage.h.

437 {
438 HANDLE hHandle = ::LoadImage(hInstance, pszResourceName,
440 Attach(reinterpret_cast<HBITMAP>(hHandle));
441 }
HINSTANCE hInstance
Definition: charmap.c:19
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LR_CREATEDIBSECTION
Definition: winuser.h:1092
#define LoadImage
Definition: winuser.h:5805

Referenced by LoadFromResource(), and START_TEST().

◆ LoadFromResource() [2/2]

void ATL::CImage::LoadFromResource ( HINSTANCE  hInstance,
UINT  nIDResource 
)
throw (
)
inline

Definition at line 442 of file atlimage.h.

443 {
445 }
void LoadFromResource(HINSTANCE hInstance, LPCTSTR pszResourceName)
Definition: atlimage.h:436
#define MAKEINTRESOURCE
Definition: winuser.h:591

◆ MaskBlt() [1/4]

BOOL ATL::CImage::MaskBlt ( HDC  hDestDC,
const POINT pointDest,
HBITMAP  hbmMask,
DWORD  dwROP = SRCCOPY 
) const
throw (
)
inline

Definition at line 474 of file atlimage.h.

476 {
477 return MaskBlt(hDestDC, pointDest.x, pointDest.y, hbmMask, dwROP);
478 }
BOOL MaskBlt(HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, HBITMAP hbmMask, int xMask, int yMask, DWORD dwROP=SRCCOPY) const
Definition: atlimage.h:447

◆ MaskBlt() [2/4]

BOOL ATL::CImage::MaskBlt ( HDC  hDestDC,
const RECT rectDest,
const POINT pointSrc,
HBITMAP  hbmMask,
const POINT pointMask,
DWORD  dwROP = SRCCOPY 
) const
throw (
)
inline

Definition at line 460 of file atlimage.h.

463 {
464 return MaskBlt(hDestDC, rectDest.left, rectDest.top,
465 rectDest.right - rectDest.left, rectDest.bottom - rectDest.top,
466 pointSrc.x, pointSrc.y, hbmMask, pointMask.x, pointMask.y, dwROP);
467 }

◆ MaskBlt() [3/4]

BOOL ATL::CImage::MaskBlt ( HDC  hDestDC,
int  xDest,
int  yDest,
HBITMAP  hbmMask,
DWORD  dwROP = SRCCOPY 
) const
throw (
)
inline

Definition at line 468 of file atlimage.h.

470 {
471 return MaskBlt(hDestDC, xDest, yDest, GetWidth(), GetHeight(),
472 0, 0, hbmMask, 0, 0, dwROP);
473 }

◆ MaskBlt() [4/4]

BOOL ATL::CImage::MaskBlt ( HDC  hDestDC,
int  xDest,
int  yDest,
int  nDestWidth,
int  nDestHeight,
int  xSrc,
int  ySrc,
HBITMAP  hbmMask,
int  xMask,
int  yMask,
DWORD  dwROP = SRCCOPY 
) const
throw (
)
inline

Definition at line 447 of file atlimage.h.

451 {
453 GetDC();
454 BOOL ret = ::MaskBlt(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
455 m_hDC, xSrc, ySrc,
456 hbmMask, xMask, yMask, dwROP);
457 ReleaseDC();
458 return ret;
459 }

Referenced by MaskBlt().

◆ operator HBITMAP()

ATL::CImage::operator HBITMAP ( )
inline

Definition at line 73 of file atlimage.h.

74 {
75 return m_hbm;
76 }

◆ operator=()

CImage & ATL::CImage::operator= ( const CImage )
private

◆ PlgBlt() [1/4]

BOOL ATL::CImage::PlgBlt ( HDC  hDestDC,
const POINT pPoints,
const RECT rectSrc,
HBITMAP  hbmMask,
const POINT pointMask 
) const
throw (
)
inline

Definition at line 499 of file atlimage.h.

501 {
502 return PlgBlt(hDestDC, pPoints, rectSrc.left, rectSrc.top,
503 rectSrc.right - rectSrc.left, rectSrc.bottom - rectSrc.top,
504 hbmMask, pointMask.x, pointMask.y);
505 }
BOOL PlgBlt(HDC hDestDC, const POINT *pPoints, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, HBITMAP hbmMask=NULL, int xMask=0, int yMask=0) const
Definition: atlimage.h:480

◆ PlgBlt() [2/4]

BOOL ATL::CImage::PlgBlt ( HDC  hDestDC,
const POINT pPoints,
const RECT rectSrc,
HBITMAP  hbmMask = NULL 
) const
throw (
)
inline

Definition at line 506 of file atlimage.h.

508 {
509 POINT pointMask = {0, 0};
510 return PlgBlt(hDestDC, pPoints, rectSrc, hbmMask, pointMask);
511 }

◆ PlgBlt() [3/4]

BOOL ATL::CImage::PlgBlt ( HDC  hDestDC,
const POINT pPoints,
HBITMAP  hbmMask = NULL 
) const
throw (
)
inline

Definition at line 493 of file atlimage.h.

495 {
496 return PlgBlt(hDestDC, pPoints, 0, 0, GetWidth(), GetHeight(),
497 hbmMask);
498 }

◆ PlgBlt() [4/4]

BOOL ATL::CImage::PlgBlt ( HDC  hDestDC,
const POINT pPoints,
int  xSrc,
int  ySrc,
int  nSrcWidth,
int  nSrcHeight,
HBITMAP  hbmMask = NULL,
int  xMask = 0,
int  yMask = 0 
) const
throw (
)
inline

Definition at line 480 of file atlimage.h.

484 {
486 GetDC();
487 BOOL ret = ::PlgBlt(hDestDC, pPoints, m_hDC,
488 xSrc, ySrc, nSrcWidth, nSrcHeight,
489 hbmMask, xMask, yMask);
490 ReleaseDC();
491 return ret;
492 }

Referenced by PlgBlt().

◆ ReleaseDC()

void ATL::CImage::ReleaseDC ( ) const
throw (
)
inline

Definition at line 106 of file atlimage.h.

107 {
109
110 if (m_hDC == NULL)
111 return;
112
113 if (m_hbmOld)
114 {
116 m_hbmOld = NULL;
117 }
119 m_hDC = NULL;
120 }

Referenced by AlphaBlend(), BitBlt(), GetColorTable(), GetPixel(), MaskBlt(), PlgBlt(), SetColorTable(), SetPixel(), SetPixelIndexed(), START_TEST(), StretchBlt(), and TransparentBlt().

◆ ReleaseGDIPlus()

void ATL::CImage::ReleaseGDIPlus ( )
throw (
)
inline

Definition at line 513 of file atlimage.h.

514 {
515 COMMON*& pCommon = GetCommonPtr();
516 if (pCommon && pCommon->Release() == 0)
517 {
518 delete pCommon;
519 pCommon = NULL;
520 }
521 }

Referenced by ~CImage().

◆ RGBFromPaletteIndex()

COLORREF ATL::CImage::RGBFromPaletteIndex ( int  iIndex) const
inlineprotected

Definition at line 1016 of file atlimage.h.

1017 {
1018 RGBQUAD table[256];
1019 GetColorTable(0, 256, table);
1020 RGBQUAD& quad = table[iIndex];
1021 return RGB(quad.rgbRed, quad.rgbGreen, quad.rgbBlue);
1022 }
void GetColorTable(UINT iFirstColor, UINT nColors, RGBQUAD *prgbColors) const
Definition: atlimage.h:288
#define RGB(r, g, b)
Definition: precomp.h:62
ULONG RGBQUAD
Definition: precomp.h:50
static void quad(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv)
Definition: quads.c:63

Referenced by Draw().

◆ Save() [1/2]

HRESULT ATL::CImage::Save ( IStream pStream,
GUID guidFileType 
) const
throw (
)
inline

Definition at line 523 of file atlimage.h.

524 {
525 using namespace Gdiplus;
527
528 // TODO & FIXME: set parameters (m_rgbTransColor etc.)
529 CLSID clsid;
530 if (!GetClsidFromFileType(&clsid, guidFileType))
531 return E_FAIL;
532
533 // create a GpBitmap from HBITMAP
534 GpBitmap *pBitmap = NULL;
536
537 // save to stream
539 status = GetCommon().SaveImageToStream(pBitmap, pStream, &clsid, NULL);
540
541 // destroy GpBitmap
542 GetCommon().DisposeImage(pBitmap);
543
544 return (status == Ok ? S_OK : E_FAIL);
545 }
bool GetClsidFromFileType(CLSID *clsid, const GUID *guid) const
Definition: atlimage.h:1061
Status
Definition: gdiplustypes.h:25
SAVEIMAGETOSTREAM SaveImageToStream
Definition: atlimage.h:880
CREATEBITMAPFROMHBITMAP CreateBitmapFromHBITMAP
Definition: atlimage.h:879

Referenced by START_TEST().

◆ Save() [2/2]

HRESULT ATL::CImage::Save ( LPCTSTR  pszFileName,
REFGUID  guidFileType = GUID_NULL 
) const
throw (
)
inline

Definition at line 546 of file atlimage.h.

548 {
549 using namespace Gdiplus;
551
552 // TODO & FIXME: set parameters (m_rgbTransColor etc.)
553
554 // convert the file name string into Unicode
555 CStringW pszNameW(pszFileName);
556
557 // if the file type is null, get the file type from extension
558 const GUID *FileType = &guidFileType;
559 if (IsGuidEqual(guidFileType, GUID_NULL))
560 {
561 LPCWSTR pszExt = GetFileExtension(pszNameW);
563 }
564
565 // get CLSID from file type
566 CLSID clsid;
568 return E_FAIL;
569
570 // create a GpBitmap from HBITMAP
571 GpBitmap *pBitmap = NULL;
573
574 // save to file
576 status = GetCommon().SaveImageToFile(pBitmap, pszNameW, &clsid, NULL);
577
578 // destroy GpBitmap
579 GetCommon().DisposeImage(pBitmap);
580
581 return (status == Ok ? S_OK : E_FAIL);
582 }
const GUID * FileTypeFromExtension(LPCWSTR pszExt) const
Definition: atlimage.h:1030
LPCWSTR GetFileExtension(LPCWSTR pszFileName) const
Definition: atlimage.h:1007
SAVEIMAGETOFILE SaveImageToFile
Definition: atlimage.h:881
_In_ WDFDEVICE _In_ WDF_SPECIAL_FILE_TYPE FileType
Definition: wdfdevice.h:2741

◆ SetColorTable()

void ATL::CImage::SetColorTable ( UINT  iFirstColor,
UINT  nColors,
const RGBQUAD prgbColors 
)
throw (
)
inline

Definition at line 584 of file atlimage.h.

586 {
588 GetDC();
589 ::SetDIBColorTable(m_hDC, iFirstColor, nColors, prgbColors);
590 ReleaseDC();
591 }
UINT WINAPI SetDIBColorTable(_In_ HDC hdc, _In_ UINT iStart, _In_ UINT cEntries, _In_reads_(cEntries) const RGBQUAD *prgbq)

◆ SetPixel()

void ATL::CImage::SetPixel ( int  x,
int  y,
COLORREF  color 
)
throw (
)
inline

Definition at line 593 of file atlimage.h.

594 {
595 GetDC();
597 ReleaseDC();
598 }
BOOL WINAPI SetPixelV(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF)

Referenced by SetPixelRGB().

◆ SetPixelIndexed()

void ATL::CImage::SetPixelIndexed ( int  x,
int  y,
int  iIndex 
)
throw (
)
inline

Definition at line 600 of file atlimage.h.

601 {
603 GetDC();
604 ::SetPixelV(m_hDC, x, y, PALETTEINDEX(iIndex));
605 ReleaseDC();
606 }
bool IsIndexed() const
Definition: atlimage.h:366
#define PALETTEINDEX(i)
Definition: wingdi.h:2943

◆ SetPixelRGB()

void ATL::CImage::SetPixelRGB ( int  x,
int  y,
BYTE  r,
BYTE  g,
BYTE  b 
)
throw (
)
inline

Definition at line 608 of file atlimage.h.

609 {
610 SetPixel(x, y, RGB(r, g, b));
611 }
void SetPixel(int x, int y, COLORREF color)
Definition: atlimage.h:593
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204

◆ SetTransparentColor()

COLORREF ATL::CImage::SetTransparentColor ( COLORREF  rgbTransparent)
throw (
)
inline

Definition at line 613 of file atlimage.h.

614 {
616 COLORREF rgbOldColor = m_rgbTransColor;
617 m_rgbTransColor = rgbTransparent;
618 return rgbOldColor;
619 }

Referenced by START_TEST().

◆ StretchBlt() [1/4]

BOOL ATL::CImage::StretchBlt ( HDC  hDestDC,
const RECT rectDest,
const RECT rectSrc,
DWORD  dwROP = SRCCOPY 
) const
throw (
)
inline

Definition at line 646 of file atlimage.h.

648 {
649 return StretchBlt(hDestDC, rectDest.left, rectDest.top,
650 rectDest.right - rectDest.left,
651 rectDest.bottom - rectDest.top,
652 rectSrc.left, rectSrc.top,
653 rectSrc.right - rectSrc.left,
654 rectSrc.bottom - rectSrc.top, dwROP);
655 }

◆ StretchBlt() [2/4]

BOOL ATL::CImage::StretchBlt ( HDC  hDestDC,
const RECT rectDest,
DWORD  dwROP = SRCCOPY 
) const
throw (
)
inline

Definition at line 639 of file atlimage.h.

641 {
642 return StretchBlt(hDestDC, rectDest.left, rectDest.top,
643 rectDest.right - rectDest.left,
644 rectDest.bottom - rectDest.top, dwROP);
645 }

◆ StretchBlt() [3/4]

BOOL ATL::CImage::StretchBlt ( HDC  hDestDC,
int  xDest,
int  yDest,
int  nDestWidth,
int  nDestHeight,
DWORD  dwROP = SRCCOPY 
) const
throw (
)
inline

Definition at line 632 of file atlimage.h.

635 {
636 return StretchBlt(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
637 0, 0, GetWidth(), GetHeight(), dwROP);
638 }

◆ StretchBlt() [4/4]

BOOL ATL::CImage::StretchBlt ( HDC  hDestDC,
int  xDest,
int  yDest,
int  nDestWidth,
int  nDestHeight,
int  xSrc,
int  ySrc,
int  nSrcWidth,
int  nSrcHeight,
DWORD  dwROP = SRCCOPY 
) const
throw (
)
inline

Definition at line 621 of file atlimage.h.

625 {
626 GetDC();
627 BOOL ret = ::StretchBlt(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
628 m_hDC, xSrc, ySrc, nSrcWidth, nSrcHeight, dwROP);
629 ReleaseDC();
630 return ret;
631 }

Referenced by Draw(), and StretchBlt().

◆ TransparentBlt() [1/4]

BOOL ATL::CImage::TransparentBlt ( HDC  hDestDC,
const RECT rectDest,
const RECT rectSrc,
UINT  crTransparent = CLR_INVALID 
) const
throw (
)
inline

Definition at line 685 of file atlimage.h.

688 {
689 return TransparentBlt(hDestDC, rectDest.left, rectDest.top,
690 rectDest.right - rectDest.left, rectDest.bottom - rectDest.left,
691 rectSrc.left, rectSrc.top, rectSrc.right - rectSrc.left,
692 rectSrc.bottom - rectSrc.top, crTransparent);
693 }

◆ TransparentBlt() [2/4]

BOOL ATL::CImage::TransparentBlt ( HDC  hDestDC,
const RECT rectDest,
UINT  crTransparent = CLR_INVALID 
) const
throw (
)
inline

Definition at line 678 of file atlimage.h.

680 {
681 return TransparentBlt(hDestDC, rectDest.left, rectDest.top,
682 rectDest.right - rectDest.left,
683 rectDest.bottom - rectDest.top, crTransparent);
684 }

◆ TransparentBlt() [3/4]

BOOL ATL::CImage::TransparentBlt ( HDC  hDestDC,
int  xDest,
int  yDest,
int  nDestWidth,
int  nDestHeight,
int  xSrc,
int  ySrc,
int  nSrcWidth,
int  nSrcHeight,
UINT  crTransparent = CLR_INVALID 
) const
throw (
)
inline

Definition at line 657 of file atlimage.h.

661 {
663 GetDC();
664 BOOL ret = ::TransparentBlt(hDestDC, xDest, yDest,
665 nDestWidth, nDestHeight,
666 m_hDC, xSrc, ySrc,
667 nSrcWidth, nSrcHeight, crTransparent);
668 ReleaseDC();
669 return ret;
670 }

◆ TransparentBlt() [4/4]

BOOL ATL::CImage::TransparentBlt ( HDC  hDestDC,
int  xDest,
int  yDest,
int  nDestWidth,
int  nDestHeight,
UINT  crTransparent = CLR_INVALID 
) const
throw (
)
inline

Definition at line 671 of file atlimage.h.

674 {
675 return TransparentBlt(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
676 0, 0, GetWidth(), GetHeight(), crTransparent);
677 }

Member Data Documentation

◆ 

union { ... } ATL::CImage::@4078

◆ m_bHasAlphaCh

bool ATL::CImage::m_bHasAlphaCh
protected

Definition at line 998 of file atlimage.h.

Referenced by AttachInternal(), CImage(), CreateInternal(), Detach(), and Draw().

◆ m_bIsDIBSec

bool ATL::CImage::m_bIsDIBSec
protected

Definition at line 999 of file atlimage.h.

Referenced by AttachInternal(), CImage(), and IsDIBSection().

◆ m_bm

BITMAP ATL::CImage::m_bm

◆ m_ds

DIBSECTION ATL::CImage::m_ds

Definition at line 1004 of file atlimage.h.

Referenced by AttachInternal(), CImage(), Detach(), and GetMaxColorTableEntries().

◆ m_eOrientation

DIBOrientation ATL::CImage::m_eOrientation
protected

Definition at line 997 of file atlimage.h.

Referenced by AttachInternal(), CImage(), Detach(), GetBits(), and GetPitch().

◆ m_hbm

◆ m_hbmOld

HGDIOBJ ATL::CImage::m_hbmOld
mutableprotected

Definition at line 995 of file atlimage.h.

Referenced by CImage(), GetDC(), and ReleaseDC().

◆ m_hDC

◆ m_rgbTransColor

COLORREF ATL::CImage::m_rgbTransColor
protected

The documentation for this class was generated from the following file: