ReactOS  0.4.12-dev-51-ge94618b
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  };

◆ 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  };

◆ ExcludeFlags

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

Definition at line 711 of file atlimage.h.

Constructor & Destructor Documentation

◆ CImage() [1/2]

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

Definition at line 49 of file atlimage.h.

Referenced by CreateInternal().

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  {
63  GetCommon().LoadLib();
64  }
65  }
#define CLR_INVALID
Definition: wingdi.h:881
#define ZeroMemory
Definition: winbase.h:1635
smooth NULL
Definition: ftsmooth.c:416
COLORREF m_rgbTransColor
Definition: atlimage.h:1010
HBITMAP m_hbm
Definition: atlimage.h:1004
bool m_bIsDIBSec
Definition: atlimage.h:1009
static COMMON & GetCommon()
Definition: atlimage.h:995
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
DIBSECTION m_ds
Definition: atlimage.h:1014
DIBOrientation m_eOrientation
Definition: atlimage.h:1007
HGDIOBJ m_hbmOld
Definition: atlimage.h:1005
bool m_bHasAlphaCh
Definition: atlimage.h:1008
HINSTANCE LoadLib()
Definition: atlimage.h:932

◆ ~CImage()

ATL::CImage::~CImage ( )
inline

Definition at line 67 of file atlimage.h.

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

◆ CImage() [2/2]

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

Member Function Documentation

◆ AlphaBlend() [1/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.

Referenced by AlphaBlend(), and Draw().

127  {
129 
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  }
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
Definition: atlimage.h:123
GLfloat bf
Definition: s_aatritemp.h:61
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
#define AC_SRC_ALPHA
Definition: alphablend.c:9
BYTE BlendOp
Definition: wingdi.h:2736
void ReleaseDC() const
Definition: atlimage.h:106
unsigned int BOOL
Definition: ntddk_ex.h:94
BYTE SourceConstantAlpha
Definition: wingdi.h:2738
static BOOL IsTransparencySupported()
Definition: atlimage.h:706
int ret
BYTE BlendFlags
Definition: wingdi.h:2737
HDC GetDC() const
Definition: atlimage.h:96
BYTE AlphaFormat
Definition: wingdi.h:2739

◆ AlphaBlend() [2/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  }
GLint GLint GLsizei width
Definition: gl.h:1546
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
Definition: atlimage.h:123
int GetWidth() const
Definition: atlimage.h:354
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
int GetHeight() const
Definition: atlimage.h:297

◆ AlphaBlend() [3/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  }
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
Definition: atlimage.h:123
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

◆ AlphaBlend() [4/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  }
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
Definition: atlimage.h:123
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
LONG bottom
Definition: windef.h:299

◆ Attach()

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

Definition at line 79 of file atlimage.h.

Referenced by Load(), LoadFromResource(), and SaveDIBToFile().

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

◆ AttachInternal()

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

Definition at line 1138 of file atlimage.h.

Referenced by Attach(), and CreateInternal().

1140  {
1141  Destroy();
1142 
1143  const int size = sizeof(DIBSECTION);
1144  m_bIsDIBSec = (::GetObject(hBitmap, size, &m_ds) == size);
1145 
1146  bool bOK = (::GetObject(hBitmap, sizeof(BITMAP), &m_bm) != 0);
1147 
1148  if (bOK)
1149  {
1150  m_hbm = hBitmap;
1151  m_eOrientation = eOrientation;
1152  m_bHasAlphaCh = (m_bm.bmBitsPixel == 32);
1154  }
1155  }
#define CLR_INVALID
Definition: wingdi.h:881
COLORREF m_rgbTransColor
Definition: atlimage.h:1010
GLsizeiptr size
Definition: glext.h:5919
HBITMAP m_hbm
Definition: atlimage.h:1004
bool m_bIsDIBSec
Definition: atlimage.h:1009
#define GetObject
Definition: wingdi.h:4445
BITMAP m_bm
Definition: atlimage.h:1013
Definition: bl.h:1331
DIBSECTION m_ds
Definition: atlimage.h:1014
DIBOrientation m_eOrientation
Definition: atlimage.h:1007
bool m_bHasAlphaCh
Definition: atlimage.h:1008
struct tagDIBSECTION DIBSECTION
void Destroy()
Definition: atlimage.h:208
static HBITMAP hBitmap
Definition: timezone.c:34

◆ BitBlt() [1/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.

Referenced by BitBlt().

170  {
171  GetDC();
172  BOOL ret = ::BitBlt(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
173  m_hDC, xSrc, ySrc, dwROP);
174  ReleaseDC();
175  return ret;
176  }
BOOL BitBlt(HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, DWORD dwROP=SRCCOPY) const
Definition: atlimage.h:167
void ReleaseDC() const
Definition: atlimage.h:106
unsigned int BOOL
Definition: ntddk_ex.h:94
int ret
HDC GetDC() const
Definition: atlimage.h:96

◆ BitBlt() [2/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  }
BOOL BitBlt(HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, DWORD dwROP=SRCCOPY) const
Definition: atlimage.h:167
int GetWidth() const
Definition: atlimage.h:354
int GetHeight() const
Definition: atlimage.h:297

◆ BitBlt() [3/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  }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
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() [4/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  }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
BOOL BitBlt(HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, DWORD dwROP=SRCCOPY) const
Definition: atlimage.h:167
LONG bottom
Definition: windef.h:299

◆ 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
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define BI_RGB
Definition: precomp.h:35

◆ 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.

Referenced by Create().

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

◆ 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 1157 of file atlimage.h.

Referenced by CreateEx().

1160  {
1161  ATLASSERT(nWidth != 0);
1162  ATLASSERT(nHeight != 0);
1163 
1164  // initialize BITMAPINFO extension
1165  MYBITMAPINFOEX bi;
1166  ZeroMemory(&bi, sizeof(bi));
1167  bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1168  bi.bmiHeader.biWidth = nWidth;
1169  bi.bmiHeader.biHeight = nHeight;
1170  bi.bmiHeader.biPlanes = 1;
1171  bi.bmiHeader.biBitCount = nBPP;
1172  bi.bmiHeader.biCompression = eCompression;
1173 
1174  // is there alpha channel?
1175  bool bHasAlphaCh;
1176  bHasAlphaCh = (nBPP == 32 && (dwFlags & createAlphaChannel));
1177 
1178  // get orientation
1179  DIBOrientation eOrientation;
1180  eOrientation = ((nHeight > 0) ? DIBOR_BOTTOMUP : DIBOR_TOPDOWN);
1181 
1182  // does it have bit fields?
1183  if (eCompression == BI_BITFIELDS)
1184  {
1185  if (nBPP == 16 || nBPP == 32)
1186  {
1187  // store the mask data
1188  LPDWORD pdwMask = reinterpret_cast<LPDWORD>(bi.bmiColors);
1189  pdwMask[0] = pdwBitmasks[0];
1190  pdwMask[1] = pdwBitmasks[1];
1191  pdwMask[2] = pdwBitmasks[2];
1192  }
1193  else
1194  {
1195  return FALSE;
1196  }
1197  }
1198  else
1199  {
1200  ATLASSERT(pdwBitmasks == NULL);
1201  if (pdwBitmasks)
1202  return FALSE;
1203  }
1204 
1205  // create a DIB section
1207  ATLASSERT(hDC);
1208  LPVOID pvBits;
1209  HBITMAP hbm = ::CreateDIBSection(hDC, bi.get(), DIB_RGB_COLORS,
1210  &pvBits, NULL, 0);
1211  ATLASSERT(hbm);
1212  ::DeleteDC(hDC);
1213 
1214  // attach it
1215  AttachInternal(hbm, eOrientation, -1);
1216  m_bHasAlphaCh = bHasAlphaCh;
1217 
1218  return hbm != NULL;
1219  }
#define HDC
Definition: msvc.h:22
#define HBITMAP
Definition: msvc.h:28
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
#define ZeroMemory
Definition: winbase.h:1635
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define BI_BITFIELDS
Definition: mmreg.h:507
void AttachInternal(HBITMAP hBitmap, DIBOrientation eOrientation, LONG iTransColor)
Definition: atlimage.h:1138
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
uint32_t * LPDWORD
Definition: typedefs.h:57
bool m_bHasAlphaCh
Definition: atlimage.h:1008
#define DIB_RGB_COLORS
Definition: wingdi.h:365

◆ Destroy()

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

Definition at line 208 of file atlimage.h.

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

209  {
210  if (m_hbm)
211  {
213  }
214  }
HBITMAP Detach()
Definition: atlimage.h:84
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HBITMAP m_hbm
Definition: atlimage.h:1004

◆ Detach()

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

Definition at line 84 of file atlimage.h.

Referenced by Destroy(), and SaveDIBToFile().

85  {
87  m_bHasAlphaCh = false;
89  ZeroMemory(&m_ds, sizeof(m_ds));
90 
92  m_hbm = NULL;
93  return hBitmap;
94  }
#define HBITMAP
Definition: msvc.h:28
#define CLR_INVALID
Definition: wingdi.h:881
#define ZeroMemory
Definition: winbase.h:1635
smooth NULL
Definition: ftsmooth.c:416
COLORREF m_rgbTransColor
Definition: atlimage.h:1010
HBITMAP m_hbm
Definition: atlimage.h:1004
DIBSECTION m_ds
Definition: atlimage.h:1014
DIBOrientation m_eOrientation
Definition: atlimage.h:1007
bool m_bHasAlphaCh
Definition: atlimage.h:1008
static HBITMAP hBitmap
Definition: timezone.c:34

◆ Draw() [1/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.

Referenced by Draw(), and START_TEST().

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  {
227  COLORREF rgb;
228  if ((m_rgbTransColor & 0xFF000000) == 0x01000000)
229  rgb = RGBFromPaletteIndex(m_rgbTransColor & 0xFF);
230  else
231  rgb = m_rgbTransColor;
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  }
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
Definition: atlimage.h:123
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
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:631
#define CLR_INVALID
Definition: wingdi.h:881
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
Definition: atlimage.h:667
COLORREF m_rgbTransColor
Definition: atlimage.h:1010
COLORREF RGBFromPaletteIndex(int iIndex) const
Definition: atlimage.h:1026
static BOOL IsTransparencySupported()
Definition: atlimage.h:706
_In_ ULONG _In_ ULONG rgb
Definition: winddi.h:3520
bool m_bHasAlphaCh
Definition: atlimage.h:1008
DWORD COLORREF
Definition: windef.h:290

◆ Draw() [2/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  }
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
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
LONG bottom
Definition: windef.h:299

◆ Draw() [3/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  }
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
int GetWidth() const
Definition: atlimage.h:354
int GetHeight() const
Definition: atlimage.h:297

◆ Draw() [4/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  }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
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() [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  }
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
int GetWidth() const
Definition: atlimage.h:354
int GetHeight() const
Definition: atlimage.h:297

◆ Draw() [6/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  }
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
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
LONG bottom
Definition: windef.h:299

◆ FileTypeFromExtension()

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

Definition at line 1040 of file atlimage.h.

Referenced by Save().

1041  {
1042  static const EXTENSION_ENTRY table[] =
1043  {
1044  {L".jpg", Gdiplus::ImageFormatJPEG},
1045  {L".png", Gdiplus::ImageFormatPNG},
1046  {L".bmp", Gdiplus::ImageFormatBMP},
1047  {L".gif", Gdiplus::ImageFormatGIF},
1048  {L".tif", Gdiplus::ImageFormatTIFF},
1049  {L".jpeg", Gdiplus::ImageFormatJPEG},
1050  {L".jpe", Gdiplus::ImageFormatJPEG},
1051  {L".jfif", Gdiplus::ImageFormatJPEG},
1052  {L".dib", Gdiplus::ImageFormatBMP},
1053  {L".rle", Gdiplus::ImageFormatBMP},
1054  {L".tiff", Gdiplus::ImageFormatTIFF}
1055  };
1056  const size_t count = _countof(table);
1057  for (size_t i = 0; i < count; ++i)
1058  {
1059  if (::lstrcmpiW(table[i].pszExt, pszExt) == 0)
1060  return &table[i].guid;
1061  }
1062  return NULL;
1063  }
#define _countof(array)
Definition: fontsub.cpp:30
GLuint GLuint GLsizei count
Definition: gl.h:1545
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
GLenum GLclampf GLint i
Definition: glfuncs.h:14
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1087

◆ GetBits()

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

Definition at line 271 of file atlimage.h.

Referenced by GetPixelAddress().

272  {
274  BYTE *pb = (BYTE *)m_bm.bmBits;
276  {
277  pb += m_bm.bmWidthBytes * (m_bm.bmHeight - 1);
278  }
279  return pb;
280  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
if(!(yy_init))
Definition: macro.lex.yy.c:717
unsigned char BYTE
Definition: ntddk_ex.h:96
BITMAP m_bm
Definition: atlimage.h:1013
DIBOrientation m_eOrientation
Definition: atlimage.h:1007
bool IsDIBSection() const
Definition: atlimage.h:360

◆ GetBPP()

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

Definition at line 282 of file atlimage.h.

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

283  {
284  ATLASSERT(m_hbm);
285  return m_bm.bmBitsPixel;
286  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HBITMAP m_hbm
Definition: atlimage.h:1004
BITMAP m_bm
Definition: atlimage.h:1013

◆ GetClsidFromFileType()

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

Definition at line 1071 of file atlimage.h.

Referenced by Save().

1072  {
1073  static const FORMAT_ENTRY table[] =
1074  {
1075  {Gdiplus::ImageFormatJPEG, L"image/jpeg"},
1076  {Gdiplus::ImageFormatPNG, L"image/png"},
1077  {Gdiplus::ImageFormatBMP, L"image/bmp"},
1078  {Gdiplus::ImageFormatGIF, L"image/gif"},
1079  {Gdiplus::ImageFormatTIFF, L"image/tiff"}
1080  };
1081  const size_t count = _countof(table);
1082  for (size_t i = 0; i < count; ++i)
1083  {
1084  if (IsGuidEqual(table[i].guid, *guid))
1085  {
1086  int num = GetEncoderClsid(table[i].mime, clsid);
1087  if (num >= 0)
1088  {
1089  return true;
1090  }
1091  }
1092  }
1093  return false;
1094  }
const WCHAR * mime
Definition: mimefilter.c:512
#define _countof(array)
Definition: fontsub.cpp:30
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLclampf GLint i
Definition: glfuncs.h:14
int GetEncoderClsid(LPCWSTR mime, CLSID *clsid) const
Definition: atlimage.h:1096
GLuint GLuint num
Definition: glext.h:9618
static const WCHAR L[]
Definition: oid.c:1087
bool IsGuidEqual(const GUID &guid1, const GUID &guid2) const
Definition: atlimage.h:1126

◆ GetColorTable()

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

Definition at line 288 of file atlimage.h.

Referenced by RGBFromPaletteIndex().

290  {
292  GetDC();
293  ::GetDIBColorTable(m_hDC, iFirstColor, nColors, prgbColors);
294  ReleaseDC();
295  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
void ReleaseDC() const
Definition: atlimage.h:106
UINT WINAPI GetDIBColorTable(HDC hDC, UINT iStartIndex, UINT cEntries, RGBQUAD *pColors)
Definition: palette.c:123
HDC GetDC() const
Definition: atlimage.h:96
bool IsDIBSection() const
Definition: atlimage.h:360

◆ GetCommon()

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

Definition at line 995 of file atlimage.h.

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

996  {
997  COMMON*& pCommon = GetCommonPtr();
998  if (pCommon == NULL)
999  pCommon = new COMMON;
1000  return *pCommon;
1001  }
smooth NULL
Definition: ftsmooth.c:416
static COMMON *& GetCommonPtr()
Definition: atlimage.h:989

◆ GetCommonFilterString()

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

Definition at line 734 of file atlimage.h.

Referenced by GetExporterFilterString(), and GetImporterFilterString().

740  {
741  static const FILTER_DATA table[] =
742  {
743  {excludeBMP, TEXT("BMP"), TEXT("*.BMP;*.DIB;*.RLE"), &Gdiplus::ImageFormatBMP},
744  {excludeJPEG, TEXT("JPEG"), TEXT("*.JPG;*.JPEG;*.JPE;*.JFIF"), &Gdiplus::ImageFormatJPEG},
745  {excludeGIF, TEXT("GIF"), TEXT("*.GIF"), &Gdiplus::ImageFormatGIF},
746  {excludeEMF, TEXT("EMF"), TEXT("*.EMF"), &Gdiplus::ImageFormatEMF},
747  {excludeWMF, TEXT("WMF"), TEXT("*.WMF"), &Gdiplus::ImageFormatWMF},
748  {excludeTIFF, TEXT("TIFF"), TEXT("*.TIF;*.TIFF"), &Gdiplus::ImageFormatTIFF},
749  {excludePNG, TEXT("PNG"), TEXT("*.PNG"), &Gdiplus::ImageFormatPNG},
750  {excludeIcon, TEXT("ICO"), TEXT("*.ICO"), &Gdiplus::ImageFormatIcon}
751  };
752 
753  if (pszAllFilesDescription)
754  {
755  strFilter += pszAllFilesDescription;
756  strFilter += chSeparator;
757 
758  BOOL bFirst = TRUE;
759  for (size_t i = 0; i < _countof(table); ++i)
760  {
761  if ((dwExclude & table[i].dwExclude) != 0)
762  continue;
763 
764  if (bFirst)
765  bFirst = FALSE;
766  else
767  strFilter += TEXT(';');
768 
769  strFilter += table[i].extensions;
770  }
771  strFilter += chSeparator;
772 
773  aguidFileTypes.Add(GUID_NULL);
774  }
775 
776  for (size_t i = 0; i < _countof(table); ++i)
777  {
778  if ((dwExclude & table[i].dwExclude) != 0)
779  continue;
780  strFilter += table[i].title;
781  strFilter += TEXT(" (");
782  strFilter += table[i].extensions;
783  strFilter += TEXT(")");
784  strFilter += chSeparator;
785  strFilter += table[i].extensions;
786  strFilter += chSeparator;
787 
788  aguidFileTypes.Add(*table[i].guid);
789  }
790 
791  strFilter += chSeparator;
792 
793  return S_OK;
794  }
#define TRUE
Definition: types.h:120
#define _countof(array)
Definition: fontsub.cpp:30
GLenum GLclampf GLint i
Definition: glfuncs.h:14
const GUID * guid
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GUID_NULL
Definition: ks.h:106
#define S_OK
Definition: intsafe.h:59
#define TEXT(s)
Definition: k32.h:26

◆ GetCommonPtr()

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

Definition at line 989 of file atlimage.h.

Referenced by GetCommon(), and ReleaseGDIPlus().

990  {
991  static COMMON *s_pCommon = NULL;
992  return s_pCommon;
993  }
smooth NULL
Definition: ftsmooth.c:416

◆ GetDC()

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

Definition at line 96 of file atlimage.h.

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

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:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
smooth NULL
Definition: ftsmooth.c:416
HBITMAP m_hbm
Definition: atlimage.h:1004
HGDIOBJ m_hbmOld
Definition: atlimage.h:1005

◆ GetEncoderClsid()

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

Definition at line 1096 of file atlimage.h.

Referenced by GetClsidFromFileType().

1097  {
1098  UINT count = 0, total_size = 0;
1099  GetCommon().GetImageEncodersSize(&count, &total_size);
1100  if (total_size == 0)
1101  return -1; // failure
1102 
1103  Gdiplus::ImageCodecInfo *pInfo;
1104  BYTE *pb = new BYTE[total_size];
1105  ATLASSERT(pb);
1106  pInfo = reinterpret_cast<Gdiplus::ImageCodecInfo *>(pb);
1107  if (pInfo == NULL)
1108  return -1; // failure
1109 
1110  GetCommon().GetImageEncoders(count, total_size, pInfo);
1111 
1112  for (UINT iInfo = 0; iInfo < count; ++iInfo)
1113  {
1114  if (::lstrcmpiW(pInfo[iInfo].MimeType, mime) == 0)
1115  {
1116  *clsid = pInfo[iInfo].Clsid;
1117  delete[] pb;
1118  return iInfo; // success
1119  }
1120  }
1121 
1122  delete[] pb;
1123  return -1; // failure
1124  }
const WCHAR * mime
Definition: mimefilter.c:512
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
GLuint GLuint GLsizei count
Definition: gl.h:1545
GETIMAGEENCODERSSIZE GetImageEncodersSize
Definition: atlimage.h:884
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
smooth NULL
Definition: ftsmooth.c:416
GETIMAGEENCODERS GetImageEncoders
Definition: atlimage.h:885
unsigned int UINT
Definition: ndis.h:50
static COMMON & GetCommon()
Definition: atlimage.h:995
unsigned char BYTE
Definition: ntddk_ex.h:96
struct ImageCodecInfo ImageCodecInfo

◆ GetExporterFilterString()

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

Definition at line 811 of file atlimage.h.

817  {
818  return GetCommonFilterString(strExporters,
819  aguidFileTypes,
820  pszAllFilesDescription,
821  dwExclude,
822  chSeparator);
823  }
static HRESULT GetCommonFilterString(CSimpleString &strFilter, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription, DWORD dwExclude, TCHAR chSeparator)
Definition: atlimage.h:734

◆ GetFileExtension()

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

Definition at line 1017 of file atlimage.h.

Referenced by Save().

1018  {
1019  LPCWSTR pch = wcsrchr(pszFileName, L'\\');
1020  if (pch == NULL)
1021  pch = wcsrchr(pszFileName, L'/');
1022  pch = (pch ? wcsrchr(pch, L'.') : wcsrchr(pszFileName, L'.'));
1023  return (pch ? pch : (pszFileName + ::lstrlenW(pszFileName)));
1024  }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define lstrlenW
Definition: compat.h:407
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:41
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
static const WCHAR L[]
Definition: oid.c:1087
WCHAR * pch
Definition: msvc.h:81

◆ GetHeight()

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

Definition at line 297 of file atlimage.h.

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

298  {
299  ATLASSERT(m_hbm);
300  return m_bm.bmHeight;
301  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HBITMAP m_hbm
Definition: atlimage.h:1004
BITMAP m_bm
Definition: atlimage.h:1013

◆ GetImporterFilterString()

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

Definition at line 797 of file atlimage.h.

803  {
804  return GetCommonFilterString(strImporters,
805  aguidFileTypes,
806  pszAllFilesDescription,
807  dwExclude,
808  chSeparator);
809  }
static HRESULT GetCommonFilterString(CSimpleString &strFilter, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription, DWORD dwExclude, TCHAR chSeparator)
Definition: atlimage.h:734

◆ 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  }
BITMAPINFOHEADER dsBmih
Definition: wingdi.h:1647
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
#define BI_BITFIELDS
Definition: mmreg.h:507
DWORD biCompression
Definition: amvideo.idl:35
BITMAP m_bm
Definition: atlimage.h:1013
DIBSECTION m_ds
Definition: atlimage.h:1014
bool IsDIBSection() const
Definition: atlimage.h:360

◆ GetPitch()

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

Definition at line 323 of file atlimage.h.

Referenced by GetPixelAddress().

324  {
327  return -m_bm.bmWidthBytes;
328  else
329  return m_bm.bmWidthBytes;
330  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
BITMAP m_bm
Definition: atlimage.h:1013
DIBOrientation m_eOrientation
Definition: atlimage.h:1007
bool IsDIBSection() const
Definition: atlimage.h:360

◆ GetPixel()

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

Definition at line 332 of file atlimage.h.

Referenced by START_TEST().

333  {
334  GetDC();
336  ReleaseDC();
337  return ret;
338  }
INT INT y
Definition: msvc.h:62
void ReleaseDC() const
Definition: atlimage.h:106
int ret
HDC GetDC() const
Definition: atlimage.h:96
INT x
Definition: msvc.h:62
COLORREF GetPixel(int x, int y) const
Definition: atlimage.h:332
DWORD COLORREF
Definition: windef.h:290

◆ 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  }
void * GetBits()
Definition: atlimage.h:271
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
INT INT y
Definition: msvc.h:62
unsigned char BYTE
Definition: ntddk_ex.h:96
INT x
Definition: msvc.h:62
int GetBPP() const
Definition: atlimage.h:282
int GetPitch() const
Definition: atlimage.h:323
bool IsDIBSection() const
Definition: atlimage.h:360

◆ GetTransparentColor()

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

Definition at line 349 of file atlimage.h.

350  {
351  return m_rgbTransColor;
352  }
COLORREF m_rgbTransColor
Definition: atlimage.h:1010

◆ GetWidth()

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

Definition at line 354 of file atlimage.h.

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

355  {
356  ATLASSERT(m_hbm);
357  return m_bm.bmWidth;
358  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HBITMAP m_hbm
Definition: atlimage.h:1004
BITMAP m_bm
Definition: atlimage.h:1013

◆ IsDIBSection()

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

Definition at line 360 of file atlimage.h.

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

361  {
362  ATLASSERT(m_hbm);
363  return m_bIsDIBSec;
364  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HBITMAP m_hbm
Definition: atlimage.h:1004
bool m_bIsDIBSec
Definition: atlimage.h:1009

◆ IsGuidEqual()

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

Definition at line 1126 of file atlimage.h.

Referenced by GetClsidFromFileType(), and Save().

1127  {
1129  if (::UuidEqual(const_cast<GUID *>(&guid1),
1130  const_cast<GUID *>(&guid2), &status))
1131  {
1132  if (status == RPC_S_OK)
1133  return true;
1134  }
1135  return false;
1136  }
int WINAPI UuidEqual(UUID *Uuid1, UUID *Uuid2, RPC_STATUS *Status)
Definition: rpcrt4_main.c:253
long RPC_STATUS
Definition: rpc.h:52
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22

◆ IsIndexed()

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

Definition at line 366 of file atlimage.h.

Referenced by SetPixelIndexed().

367  {
369  return GetBPP() <= 8;
370  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
int GetBPP() const
Definition: atlimage.h:282
bool IsDIBSection() const
Definition: atlimage.h:360

◆ IsNull()

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

Definition at line 372 of file atlimage.h.

Referenced by START_TEST().

373  {
374  return m_hbm == NULL;
375  }
smooth NULL
Definition: ftsmooth.c:416
HBITMAP m_hbm
Definition: atlimage.h:1004

◆ IsTransparencySupported()

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

Definition at line 706 of file atlimage.h.

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

707  {
708  return TRUE;
709  }
#define TRUE
Definition: types.h:120

◆ Load() [1/2]

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

Definition at line 377 of file atlimage.h.

Referenced by START_TEST().

378  {
379  // convert the file name string into Unicode
380  // TODO: use a string class
381 #ifdef UNICODE
382  LPCWSTR pszNameW = pszFileName;
383 #else
386  LPCWSTR pszNameW = szPath;
387 #endif
388 
389  // create a GpBitmap object from file
390  using namespace Gdiplus;
391  GpBitmap *pBitmap = NULL;
392  GetCommon().CreateBitmapFromFile(pszNameW, &pBitmap);
393  ATLASSERT(pBitmap);
394 
395  // TODO & FIXME: get parameters (m_rgbTransColor etc.)
396 
397  // get bitmap handle
398  HBITMAP hbm = NULL;
399  Color color(0xFF, 0xFF, 0xFF);
402  pBitmap, &hbm, color.GetValue());
403 
404  // delete GpBitmap
405  GetCommon().DisposeImage(pBitmap);
406 
407  // attach it
408  if (status == Ok)
409  Attach(hbm);
410  return (status == Ok ? S_OK : E_FAIL);
411  }
#define HBITMAP
Definition: msvc.h:28
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
CREATEBITMAPFROMFILE CreateBitmapFromFile
Definition: atlimage.h:886
#define E_FAIL
Definition: ddrawi.h:102
DISPOSEIMAGE DisposeImage
Definition: atlimage.h:892
GLuint color
Definition: glext.h:6243
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:41
smooth NULL
Definition: ftsmooth.c:416
#define MAX_PATH
Definition: compat.h:26
static COMMON & GetCommon()
Definition: atlimage.h:995
Status
Definition: gdiplustypes.h:24
#define S_OK
Definition: intsafe.h:59
LPCWSTR szPath
Definition: env.c:35
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
#define MultiByteToWideChar
Definition: compat.h:100
CREATEHBITMAPFROMBITMAP CreateHBITMAPFromBitmap
Definition: atlimage.h:887
static SERVICE_STATUS status
Definition: service.c:31
void Attach(HBITMAP hBitmap, DIBOrientation eOrientation=DIBOR_DEFAULT)
Definition: atlimage.h:79

◆ Load() [2/2]

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

Definition at line 412 of file atlimage.h.

413  {
414  // create GpBitmap from stream
415  using namespace Gdiplus;
416  GpBitmap *pBitmap = NULL;
417  GetCommon().CreateBitmapFromStream(pStream, &pBitmap);
418  ATLASSERT(pBitmap);
419 
420  // TODO & FIXME: get parameters (m_rgbTransColor etc.)
421 
422  // get bitmap handle
423  HBITMAP hbm = NULL;
424  Color color(0xFF, 0xFF, 0xFF);
427  pBitmap, &hbm, color.GetValue());
428 
429  // delete Bitmap
430  GetCommon().DisposeImage(pBitmap);
431 
432  // attach it
433  if (status == Ok)
434  Attach(hbm);
435  return (status == Ok ? S_OK : E_FAIL);
436  }
#define HBITMAP
Definition: msvc.h:28
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
CREATEBITMAPFROMSTREAM CreateBitmapFromStream
Definition: atlimage.h:888
#define E_FAIL
Definition: ddrawi.h:102
DISPOSEIMAGE DisposeImage
Definition: atlimage.h:892
GLuint color
Definition: glext.h:6243
smooth NULL
Definition: ftsmooth.c:416
static COMMON & GetCommon()
Definition: atlimage.h:995
Status
Definition: gdiplustypes.h:24
#define S_OK
Definition: intsafe.h:59
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
CREATEHBITMAPFROMBITMAP CreateHBITMAPFromBitmap
Definition: atlimage.h:887
static SERVICE_STATUS status
Definition: service.c:31
void Attach(HBITMAP hBitmap, DIBOrientation eOrientation=DIBOR_DEFAULT)
Definition: atlimage.h:79

◆ LoadFromResource() [1/2]

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

Definition at line 439 of file atlimage.h.

Referenced by LoadFromResource(), and START_TEST().

440  {
441  HANDLE hHandle = ::LoadImage(hInstance, pszResourceName,
443  Attach(reinterpret_cast<HBITMAP>(hHandle));
444  }
#define LR_CREATEDIBSECTION
Definition: winuser.h:1088
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LoadImage
Definition: winuser.h:5681
void Attach(HBITMAP hBitmap, DIBOrientation eOrientation=DIBOR_DEFAULT)
Definition: atlimage.h:79

◆ LoadFromResource() [2/2]

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

Definition at line 445 of file atlimage.h.

446  {
447  LoadFromResource(hInstance, MAKEINTRESOURCE(nIDResource));
448  }
#define MAKEINTRESOURCE
Definition: winuser.h:591
void LoadFromResource(HINSTANCE hInstance, LPCTSTR pszResourceName)
Definition: atlimage.h:439

◆ MaskBlt() [1/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 450 of file atlimage.h.

Referenced by MaskBlt().

454  {
456  GetDC();
457  BOOL ret = ::MaskBlt(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
458  m_hDC, xSrc, ySrc,
459  hbmMask, xMask, yMask, dwROP);
460  ReleaseDC();
461  return ret;
462  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
void ReleaseDC() const
Definition: atlimage.h:106
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL IsTransparencySupported()
Definition: atlimage.h:706
int ret
HDC GetDC() const
Definition: atlimage.h:96
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:450

◆ 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 463 of file atlimage.h.

466  {
467  return MaskBlt(hDestDC, rectDest.left, rectDest.top,
468  rectDest.right - rectDest.left, rectDest.bottom - rectDest.top,
469  pointSrc.x, pointSrc.y, hbmMask, pointMask.x, pointMask.y, dwROP);
470  }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
LONG bottom
Definition: windef.h:299
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:450

◆ MaskBlt() [3/4]

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

Definition at line 471 of file atlimage.h.

473  {
474  return MaskBlt(hDestDC, xDest, yDest, GetWidth(), GetHeight(),
475  0, 0, hbmMask, 0, 0, dwROP);
476  }
int GetWidth() const
Definition: atlimage.h:354
int GetHeight() const
Definition: atlimage.h:297
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:450

◆ MaskBlt() [4/4]

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

Definition at line 477 of file atlimage.h.

479  {
480  return MaskBlt(hDestDC, pointDest.x, pointDest.y, hbmMask, dwROP);
481  }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
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:450

◆ operator HBITMAP()

Definition at line 73 of file atlimage.h.

74  {
75  return m_hbm;
76  }
HBITMAP m_hbm
Definition: atlimage.h:1004

◆ operator=()

Referenced by CreateInternal().

◆ PlgBlt() [1/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 483 of file atlimage.h.

Referenced by PlgBlt().

487  {
489  GetDC();
490  BOOL ret = ::PlgBlt(hDestDC, pPoints, m_hDC,
491  xSrc, ySrc, nSrcWidth, nSrcHeight,
492  hbmMask, xMask, yMask);
493  ReleaseDC();
494  return ret;
495  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
void ReleaseDC() const
Definition: atlimage.h:106
unsigned int BOOL
Definition: ntddk_ex.h:94
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:483
static BOOL IsTransparencySupported()
Definition: atlimage.h:706
int ret
HDC GetDC() const
Definition: atlimage.h:96

◆ PlgBlt() [2/4]

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

Definition at line 496 of file atlimage.h.

498  {
499  return PlgBlt(hDestDC, pPoints, 0, 0, GetWidth(), GetHeight(),
500  hbmMask);
501  }
int GetWidth() const
Definition: atlimage.h:354
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:483
int GetHeight() const
Definition: atlimage.h:297

◆ PlgBlt() [3/4]

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

Definition at line 502 of file atlimage.h.

504  {
505  return PlgBlt(hDestDC, pPoints, rectSrc.left, rectSrc.top,
506  rectSrc.right - rectSrc.left, rectSrc.bottom - rectSrc.top,
507  hbmMask, pointMask.x, pointMask.y);
508  }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
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:483
LONG bottom
Definition: windef.h:299

◆ PlgBlt() [4/4]

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

Definition at line 509 of file atlimage.h.

511  {
512  POINT pointMask = {0, 0};
513  return PlgBlt(hDestDC, pPoints, rectSrc, hbmMask, pointMask);
514  }
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:483

◆ ReleaseDC()

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

Definition at line 106 of file atlimage.h.

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

107  {
108  ATLASSERT(m_hDC);
109 
110  if (m_hDC == NULL)
111  return;
112 
113  if (m_hbmOld)
114  {
116  m_hbmOld = NULL;
117  }
118  ::DeleteDC(m_hDC);
119  m_hDC = NULL;
120  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteDC(_In_ HDC)
HGDIOBJ m_hbmOld
Definition: atlimage.h:1005

◆ ReleaseGDIPlus()

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

Definition at line 516 of file atlimage.h.

Referenced by ~CImage().

517  {
518  COMMON*& pCommon = GetCommonPtr();
519  if (pCommon && pCommon->Release() == 0)
520  {
521  delete pCommon;
522  pCommon = NULL;
523  }
524  }
smooth NULL
Definition: ftsmooth.c:416
static COMMON *& GetCommonPtr()
Definition: atlimage.h:989

◆ RGBFromPaletteIndex()

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

Definition at line 1026 of file atlimage.h.

Referenced by Draw().

1027  {
1028  RGBQUAD table[256];
1029  GetColorTable(0, 256, table);
1030  RGBQUAD& quad = table[iIndex];
1031  return RGB(quad.rgbRed, quad.rgbGreen, quad.rgbBlue);
1032  }
UCHAR rgbBlue
Definition: inbv.c:118
UCHAR rgbGreen
Definition: inbv.c:119
UCHAR rgbRed
Definition: inbv.c:120
#define RGB(r, g, b)
Definition: wingdi.h:2917
void GetColorTable(UINT iFirstColor, UINT nColors, RGBQUAD *prgbColors) const
Definition: atlimage.h:288

◆ Save() [1/2]

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

Definition at line 526 of file atlimage.h.

Referenced by SaveDIBToFile(), and START_TEST().

527  {
528  using namespace Gdiplus;
529  ATLASSERT(m_hbm);
530 
531  // TODO & FIXME: set parameters (m_rgbTransColor etc.)
532  CLSID clsid;
533  if (!GetClsidFromFileType(&clsid, guidFileType))
534  return E_FAIL;
535 
536  // create a GpBitmap from HBITMAP
537  GpBitmap *pBitmap = NULL;
539 
540  // save to stream
541  Status status;
542  status = GetCommon().SaveImageToStream(pBitmap, pStream, &clsid, NULL);
543 
544  // destroy GpBitmap
545  GetCommon().DisposeImage(pBitmap);
546 
547  return (status == Ok ? S_OK : E_FAIL);
548  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
#define E_FAIL
Definition: ddrawi.h:102
DISPOSEIMAGE DisposeImage
Definition: atlimage.h:892
smooth NULL
Definition: ftsmooth.c:416
HBITMAP m_hbm
Definition: atlimage.h:1004
SAVEIMAGETOSTREAM SaveImageToStream
Definition: atlimage.h:890
bool GetClsidFromFileType(CLSID *clsid, const GUID *guid) const
Definition: atlimage.h:1071
REFCLSID clsid
Definition: msctf.c:84
static COMMON & GetCommon()
Definition: atlimage.h:995
Status
Definition: gdiplustypes.h:24
#define S_OK
Definition: intsafe.h:59
CREATEBITMAPFROMHBITMAP CreateBitmapFromHBITMAP
Definition: atlimage.h:889
static SERVICE_STATUS status
Definition: service.c:31

◆ Save() [2/2]

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

Definition at line 549 of file atlimage.h.

551  {
552  using namespace Gdiplus;
553  ATLASSERT(m_hbm);
554 
555  // TODO & FIXME: set parameters (m_rgbTransColor etc.)
556 
557  // convert the file name string into Unicode
558  // TODO: use a string class
559 #ifdef UNICODE
560  LPCWSTR pszNameW = pszFileName;
561 #else
564  LPCWSTR pszNameW = szPath;
565 #endif
566 
567  // if the file type is null, get the file type from extension
568  const GUID *FileType = &guidFileType;
569  if (IsGuidEqual(guidFileType, GUID_NULL))
570  {
571  LPCWSTR pszExt = GetFileExtension(pszNameW);
572  FileType = FileTypeFromExtension(pszExt);
573  }
574 
575  // get CLSID from file type
576  CLSID clsid;
577  if (!GetClsidFromFileType(&clsid, FileType))
578  return E_FAIL;
579 
580  // create a GpBitmap from HBITMAP
581  GpBitmap *pBitmap = NULL;
583 
584  // save to file
585  Status status;
586  status = GetCommon().SaveImageToFile(pBitmap, pszNameW, &clsid, NULL);
587 
588  // destroy GpBitmap
589  GetCommon().DisposeImage(pBitmap);
590 
591  return (status == Ok ? S_OK : E_FAIL);
592  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define E_FAIL
Definition: ddrawi.h:102
const GUID * FileTypeFromExtension(LPCWSTR pszExt) const
Definition: atlimage.h:1040
DISPOSEIMAGE DisposeImage
Definition: atlimage.h:892
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:41
smooth NULL
Definition: ftsmooth.c:416
HBITMAP m_hbm
Definition: atlimage.h:1004
LPCWSTR GetFileExtension(LPCWSTR pszFileName) const
Definition: atlimage.h:1017
#define MAX_PATH
Definition: compat.h:26
bool GetClsidFromFileType(CLSID *clsid, const GUID *guid) const
Definition: atlimage.h:1071
REFCLSID clsid
Definition: msctf.c:84
static COMMON & GetCommon()
Definition: atlimage.h:995
#define GUID_NULL
Definition: ks.h:106
SAVEIMAGETOFILE SaveImageToFile
Definition: atlimage.h:891
Status
Definition: gdiplustypes.h:24
#define S_OK
Definition: intsafe.h:59
LPCWSTR szPath
Definition: env.c:35
#define MultiByteToWideChar
Definition: compat.h:100
CREATEBITMAPFROMHBITMAP CreateBitmapFromHBITMAP
Definition: atlimage.h:889
bool IsGuidEqual(const GUID &guid1, const GUID &guid2) const
Definition: atlimage.h:1126
static SERVICE_STATUS status
Definition: service.c:31

◆ SetColorTable()

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

Definition at line 594 of file atlimage.h.

596  {
598  GetDC();
599  ::SetDIBColorTable(m_hDC, iFirstColor, nColors, prgbColors);
600  ReleaseDC();
601  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
void ReleaseDC() const
Definition: atlimage.h:106
UINT WINAPI SetDIBColorTable(_In_ HDC hdc, _In_ UINT iStart, _In_ UINT cEntries, _In_reads_(cEntries) const RGBQUAD *prgbq)
HDC GetDC() const
Definition: atlimage.h:96
bool IsDIBSection() const
Definition: atlimage.h:360

◆ SetPixel()

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

Definition at line 603 of file atlimage.h.

Referenced by SetPixelRGB().

604  {
605  GetDC();
606  ::SetPixelV(m_hDC, x, y, color);
607  ReleaseDC();
608  }
INT INT y
Definition: msvc.h:62
void ReleaseDC() const
Definition: atlimage.h:106
GLuint color
Definition: glext.h:6243
HDC GetDC() const
Definition: atlimage.h:96
INT x
Definition: msvc.h:62
BOOL WINAPI SetPixelV(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF)

◆ SetPixelIndexed()

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

Definition at line 610 of file atlimage.h.

611  {
612  ATLASSERT(IsIndexed());
613  GetDC();
614  ::SetPixelV(m_hDC, x, y, PALETTEINDEX(iIndex));
615  ReleaseDC();
616  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
bool IsIndexed() const
Definition: atlimage.h:366
INT INT y
Definition: msvc.h:62
void ReleaseDC() const
Definition: atlimage.h:106
HDC GetDC() const
Definition: atlimage.h:96
INT x
Definition: msvc.h:62
BOOL WINAPI SetPixelV(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF)
#define PALETTEINDEX(i)
Definition: wingdi.h:2920

◆ SetPixelRGB()

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

Definition at line 618 of file atlimage.h.

619  {
620  SetPixel(x, y, RGB(r, g, b));
621  }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INT INT y
Definition: msvc.h:62
void SetPixel(int x, int y, COLORREF color)
Definition: atlimage.h:603
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define RGB(r, g, b)
Definition: wingdi.h:2917
INT x
Definition: msvc.h:62

◆ SetTransparentColor()

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

Definition at line 623 of file atlimage.h.

Referenced by START_TEST().

624  {
625  ATLASSERT(m_hbm);
626  COLORREF rgbOldColor = m_rgbTransColor;
627  m_rgbTransColor = rgbTransparent;
628  return rgbOldColor;
629  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
COLORREF m_rgbTransColor
Definition: atlimage.h:1010
HBITMAP m_hbm
Definition: atlimage.h:1004
DWORD COLORREF
Definition: windef.h:290

◆ StretchBlt() [1/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 631 of file atlimage.h.

Referenced by Draw(), and StretchBlt().

635  {
636  GetDC();
637  BOOL ret = ::StretchBlt(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
638  m_hDC, xSrc, ySrc, nSrcWidth, nSrcHeight, dwROP);
639  ReleaseDC();
640  return ret;
641  }
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:631
void ReleaseDC() const
Definition: atlimage.h:106
unsigned int BOOL
Definition: ntddk_ex.h:94
int ret
HDC GetDC() const
Definition: atlimage.h:96

◆ StretchBlt() [2/4]

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

Definition at line 642 of file atlimage.h.

645  {
646  return StretchBlt(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
647  0, 0, GetWidth(), GetHeight(), dwROP);
648  }
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:631
int GetWidth() const
Definition: atlimage.h:354
int GetHeight() const
Definition: atlimage.h:297

◆ StretchBlt() [3/4]

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

Definition at line 649 of file atlimage.h.

651  {
652  return StretchBlt(hDestDC, rectDest.left, rectDest.top,
653  rectDest.right - rectDest.left,
654  rectDest.bottom - rectDest.top, dwROP);
655  }
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:631
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
LONG bottom
Definition: windef.h:299

◆ StretchBlt() [4/4]

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

Definition at line 656 of file atlimage.h.

658  {
659  return StretchBlt(hDestDC, rectDest.left, rectDest.top,
660  rectDest.right - rectDest.left,
661  rectDest.bottom - rectDest.top,
662  rectSrc.left, rectSrc.top,
663  rectSrc.right - rectSrc.left,
664  rectSrc.bottom - rectSrc.top, dwROP);
665  }
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:631
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
LONG bottom
Definition: windef.h:299

◆ TransparentBlt() [1/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 667 of file atlimage.h.

Referenced by Draw(), and TransparentBlt().

671  {
673  GetDC();
674  BOOL ret = ::TransparentBlt(hDestDC, xDest, yDest,
675  nDestWidth, nDestHeight,
676  m_hDC, xSrc, ySrc,
677  nSrcWidth, nSrcHeight, crTransparent);
678  ReleaseDC();
679  return ret;
680  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
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
Definition: atlimage.h:667
void ReleaseDC() const
Definition: atlimage.h:106
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL IsTransparencySupported()
Definition: atlimage.h:706
int ret
HDC GetDC() const
Definition: atlimage.h:96

◆ TransparentBlt() [2/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 681 of file atlimage.h.

684  {
685  return TransparentBlt(hDestDC, xDest, yDest, nDestWidth, nDestHeight,
686  0, 0, GetWidth(), GetHeight(), crTransparent);
687  }
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
Definition: atlimage.h:667
int GetWidth() const
Definition: atlimage.h:354
int GetHeight() const
Definition: atlimage.h:297

◆ TransparentBlt() [3/4]

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

Definition at line 688 of file atlimage.h.

690  {
691  return TransparentBlt(hDestDC, rectDest.left, rectDest.top,
692  rectDest.right - rectDest.left,
693  rectDest.bottom - rectDest.top, crTransparent);
694  }
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
Definition: atlimage.h:667
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
LONG bottom
Definition: windef.h:299

◆ TransparentBlt() [4/4]

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

Definition at line 695 of file atlimage.h.

698  {
699  return TransparentBlt(hDestDC, rectDest.left, rectDest.top,
700  rectDest.right - rectDest.left, rectDest.bottom - rectDest.left,
701  rectSrc.left, rectSrc.top, rectSrc.right - rectSrc.left,
702  rectSrc.bottom - rectSrc.top, crTransparent);
703  }
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
Definition: atlimage.h:667
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
LONG bottom
Definition: windef.h:299

Member Data Documentation

◆ @3885

union { ... }

◆ m_bHasAlphaCh

bool ATL::CImage::m_bHasAlphaCh
protected

Definition at line 1008 of file atlimage.h.

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

◆ m_bIsDIBSec

bool ATL::CImage::m_bIsDIBSec
protected

Definition at line 1009 of file atlimage.h.

Referenced by CImage(), and IsDIBSection().

◆ m_bm

BITMAP ATL::CImage::m_bm

◆ m_ds

DIBSECTION ATL::CImage::m_ds

Definition at line 1014 of file atlimage.h.

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

◆ m_eOrientation

DIBOrientation ATL::CImage::m_eOrientation
protected

Definition at line 1007 of file atlimage.h.

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

◆ m_hbm

HBITMAP ATL::CImage::m_hbm
protected

◆ m_hbmOld

HGDIOBJ ATL::CImage::m_hbmOld
mutableprotected

Definition at line 1005 of file atlimage.h.

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

◆ m_hDC

◆ m_rgbTransColor

COLORREF ATL::CImage::m_rgbTransColor
protected

Definition at line 1010 of file atlimage.h.

Referenced by CImage(), Detach(), Draw(), GetTransparentColor(), and SetTransparentColor().


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