Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
3.6 KiB

  1. #if !defined(SERVICES__Surface_h__INCLUDED)
  2. #define SERVICES__Surface_h__INCLUDED
  3. #pragma once
  4. /***************************************************************************\
  5. *****************************************************************************
  6. *
  7. * Pure Virtual Base Classes
  8. *
  9. *****************************************************************************
  10. \***************************************************************************/
  11. //------------------------------------------------------------------------------
  12. class DuSurface
  13. {
  14. public:
  15. virtual void Destroy() PURE;
  16. enum EType
  17. {
  18. stDC = GSURFACE_HDC,
  19. stGdiPlus = GSURFACE_GPGRAPHICS
  20. };
  21. virtual EType GetType() const PURE;
  22. virtual void SetIdentityTransform() PURE;
  23. virtual void SetWorldTransform(const XFORM * pxf) PURE;
  24. virtual void * Save() PURE;
  25. virtual void Restore(void * pvState) PURE;
  26. inline static DuSurface::EType
  27. GetSurfaceType(UINT nSurfaceType);
  28. inline static UINT GetSurfaceType(DuSurface::EType type);
  29. };
  30. //------------------------------------------------------------------------------
  31. class DuRegion
  32. {
  33. public:
  34. virtual void Destroy() PURE;
  35. virtual DuSurface::EType
  36. GetType() const PURE;
  37. };
  38. /***************************************************************************\
  39. *****************************************************************************
  40. *
  41. * GDI (Win32) Specific Implementation
  42. *
  43. *****************************************************************************
  44. \***************************************************************************/
  45. //------------------------------------------------------------------------------
  46. class DuDCSurface : public DuSurface
  47. {
  48. public:
  49. enum ESource
  50. {
  51. srcTempDC,
  52. srcCompatibleDC
  53. };
  54. static HRESULT Build(ESource src, DuDCSurface ** ppsrfNew);
  55. static HRESULT Build(HDC hdc, DuDCSurface ** ppsrfNew);
  56. virtual void Destroy();
  57. inline HDC GetHDC();
  58. virtual EType GetType() const { return DuSurface::stDC; }
  59. virtual void SetIdentityTransform();
  60. virtual void SetWorldTransform(const XFORM * pxf);
  61. virtual void * Save();
  62. virtual void Restore(void * pvState);
  63. protected:
  64. HDC m_hdc;
  65. BOOL m_fTempDC:1;
  66. BOOL m_fCompatibleDC:1;
  67. };
  68. /***************************************************************************\
  69. *****************************************************************************
  70. *
  71. * GDI+ Specific Implementation
  72. *
  73. *****************************************************************************
  74. \***************************************************************************/
  75. //------------------------------------------------------------------------------
  76. class DuGpSurface : public DuSurface
  77. {
  78. public:
  79. static HRESULT Build(Gdiplus::Graphics * pgpgr, DuGpSurface ** ppsrfNew);
  80. virtual void Destroy();
  81. inline Gdiplus::Graphics *
  82. GetGraphics();
  83. virtual EType GetType() const { return DuSurface::stGdiPlus; }
  84. virtual void SetIdentityTransform();
  85. virtual void SetWorldTransform(const XFORM * pxf);
  86. virtual void * Save();
  87. virtual void Restore(void * pvState);
  88. protected:
  89. Gdiplus::Graphics *
  90. m_pgpgr;
  91. };
  92. #include "Surface.inl"
  93. #endif // SERVICES__Surface_h__INCLUDED