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.

116 lines
4.5 KiB

  1. /*****************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 2000
  4. *
  5. * TITLE: item.h
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: RickTu
  10. *
  11. * DATE: 10/18/00
  12. *
  13. * DESCRIPTION: Describes item class used in print photos wizard
  14. *
  15. *****************************************************************************/
  16. #ifndef _PRINT_PHOTOS_WIZARD_ITEM_H_
  17. #define _PRINT_PHOTOS_WIZARD_ITEM_H_
  18. #define RF_ROTATE_90 0x00000001
  19. #define RF_ROTATE_180 0x00000002
  20. #define RF_ROTATE_270 0x00000004
  21. #define RF_ROTATE_AS_NEEDED 0x00000008
  22. #define RF_ROTATION_MASK 0x0000000F
  23. #define RF_CROP_TO_FIT 0x00000010 // maintains aspect ratio
  24. #define RF_SCALE_TO_FIT 0x00000020 // maintains aspect ratio
  25. #define RF_STRETCH_TO_FIT 0x00000040 // does not maintain aspect ratio
  26. #define RF_USE_THUMBNAIL_DATA 0x00001000 // use small res thumbnail data to render
  27. #define RF_USE_MEDIUM_QUALITY_DATA 0x00002000 // use meidum quality data to render
  28. #define RF_USE_FULL_IMAGE_DATA 0x00004000 // use full image bits to render
  29. #define RF_SET_QUALITY_FOR_SCREEN 0x00010000 // this image is being rendered to the screen, so set the quality modes appropriately
  30. #define RF_NO_ERRORS_ON_FAILURE_TO_ROTATE 0x80000000 // even if we can't rotate, continue and print non-rotated
  31. #define RF_QUALITY_FLAGS_MASK (RF_USE_THUMBNAIL_DATA | RF_USE_MEDIUM_QUALITY_DATA | RF_USE_FULL_IMAGE_DATA)
  32. typedef struct {
  33. Gdiplus::Graphics * g;
  34. Gdiplus::Rect * pDest;
  35. RENDER_DIMENSIONS Dim;
  36. UINT Flags;
  37. LONG lFrame;
  38. } RENDER_OPTIONS, *LPRENDER_OPTIONS;
  39. HRESULT _CropImage( Gdiplus::Rect * pSrc, Gdiplus::Rect * pDest );
  40. HRESULT _ScaleImage( Gdiplus::Rect * pSrc, Gdiplus::Rect * pDest );
  41. class CPhotoItem
  42. {
  43. enum
  44. {
  45. DontKnowImageType = 0,
  46. ImageTypeIsLowResolutionFax,
  47. ImageTypeIsNOTLowResolutionFax
  48. };
  49. public:
  50. CPhotoItem( LPITEMIDLIST pidlFull );
  51. ~CPhotoItem();
  52. HBITMAP GetThumbnailBitmap( const SIZE &sizeDesired, LONG lFrame = 0 );
  53. HBITMAP GetClassBitmap( const SIZE &sizeDesired );
  54. HRESULT Render( RENDER_OPTIONS * pRO );
  55. HRESULT GetImageFrameCount( LONG * pFrameCount);
  56. LPITEMIDLIST GetPIDL() {return _pidlFull;}
  57. LPTSTR GetFilename() {return _szFileName;}
  58. LONGLONG GetFileSize() {return _llFileSize;}
  59. ULONG AddRef();
  60. ULONG Release();
  61. ULONG ReleaseWithoutDeleting();
  62. private:
  63. HRESULT _DoRotateAnnotations( BOOL bClockwise, UINT Flags );
  64. HRESULT _DoHandleRotation( Gdiplus::Image * pImage, Gdiplus::Rect &src, Gdiplus::Rect * pDest, UINT Flags, Gdiplus::REAL &ScaleFactorForY );
  65. HRESULT _RenderAnnotations( HDC hDC, RENDER_DIMENSIONS * pDim, Gdiplus::Rect * pDest, Gdiplus::Rect &src, Gdiplus::Rect &srcAfterClipping );
  66. HRESULT _MungeAnnotationDataForThumbnails( Gdiplus::Rect &src, Gdiplus::Rect &srcBeforeClipping, Gdiplus::Rect * pDest, UINT Flags );
  67. HRESULT _LoadAnnotations();
  68. HRESULT _CreateGdiPlusImage();
  69. HRESULT _CreateGdiPlusThumbnail( const SIZE &sizeDesired, LONG lFrame = 0 );
  70. HRESULT _DiscardGdiPlusImages();
  71. HRESULT _GetThumbnailQualityImage( Gdiplus::Image ** ppImage, RENDER_OPTIONS * pRO, BOOL * pbNeedsToBeDeleted );
  72. HRESULT _GetMediumQualityImage( Gdiplus::Image ** ppImage, RENDER_OPTIONS * pRO, BOOL * pbNeedsToBeDeleted );
  73. HRESULT _GetFullQualityImage( Gdiplus::Image ** ppImage, RENDER_OPTIONS * pRO, BOOL * pbNeedsToBeDeleted );
  74. private:
  75. LONG _cRef;
  76. LPITEMIDLIST _pidlFull;
  77. Gdiplus::Image * _pImage;
  78. Gdiplus::Bitmap * _pClassBitmap;
  79. Gdiplus::PropertyItem ** _pAnnotBits;
  80. CAnnotationSet * _pAnnotations;
  81. CComPtr<IStream> _pStream;
  82. LONG _lFrameCount;
  83. BOOL _bTimeFrames;
  84. CSimpleCriticalSection _csItem;
  85. HBITMAP * _pThumbnails;
  86. BOOL _bWeKnowAnnotationsDontExist;
  87. TCHAR _szFileName[MAX_PATH];
  88. LONGLONG _llFileSize;
  89. UINT _uImageType;
  90. Gdiplus::REAL _DPIx;
  91. Gdiplus::REAL _DPIy;
  92. };
  93. #endif