ImageEx.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // GDIPlusHelper.h: interface for the CGDIPlusHelper class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_GDIPLUSHELPER_H__BD5F6266_5686_43E2_B146_5EA1217A56FE__INCLUDED_)
  5. #define AFX_GDIPLUSHELPER_H__BD5F6266_5686_43E2_B146_5EA1217A56FE__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. class ImageEx : public Image
  10. {
  11. public:
  12. ImageEx(IN LPCTSTR sResourceType, IN LPCTSTR sResource);
  13. ImageEx(const WCHAR* filename, BOOL useEmbeddedColorManagement = FALSE);
  14. ~ImageEx();
  15. public:
  16. void Draw(CDC* pDC);
  17. CSize GetSize();
  18. bool IsAnimatedGIF() { return m_nFrameCount > 1; }
  19. void SetPause(bool bPause);
  20. bool IsPaused() { return m_bPause; }
  21. bool InitAnimation(HWND hWnd, CPoint pt);
  22. bool InitAnimation(HDC hDC, CRect rect,BOOL bStretch);
  23. bool InitAnimation(HWND hWnd, CRect rect,BOOL bStretch);
  24. void Destroy();
  25. protected:
  26. bool TestForAnimatedGIF();
  27. void Initialize();
  28. bool DrawFrameGIF();
  29. IStream* m_pStream;
  30. bool LoadFromBuffer(BYTE* pBuff, int nSize);
  31. bool GetResource(LPCTSTR lpName, LPCTSTR lpType, void* pResource, int& nBufSize);
  32. bool Load(CString sResourceType, CString sResource);
  33. void ThreadAnimation();
  34. static UINT WINAPI _ThreadAnimationProc(LPVOID pParam);
  35. HANDLE m_hThread;
  36. HANDLE m_hPause;
  37. HANDLE m_hExitEvent;
  38. HINSTANCE m_hInst;
  39. HWND m_hWnd;
  40. HDC m_hDC;
  41. Rect m_Rect;
  42. UINT m_nFrameCount;
  43. UINT m_nFramePosition;
  44. bool m_bIsInitialized;
  45. bool m_bPause;
  46. PropertyItem* m_pPropertyItem;
  47. CPoint m_pt;
  48. bool m_bStretch;
  49. };
  50. #endif // !defined(AFX_GDIPLUSHELPER_H__BD5F6266_5686_43E2_B146_5EA1217A56FE__INCLUDED_)