Source code of Windows XP (NT5)
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.

161 lines
4.9 KiB

  1. //
  2. // BITMAPOBJ.HPP
  3. // Bitmap objects:
  4. //
  5. // Copyright Microsoft 1998-
  6. //
  7. #ifndef __BITMAPOBJ_HPP_
  8. #define __BITMAPOBJ_HPP_
  9. typedef struct COLOREDICON
  10. {
  11. HICON hIcon;
  12. COLORREF color;
  13. } COLORED_ICON;
  14. #define MAX_BITMAP_DATA 8192
  15. UINT GetBitmapDestinationAddress(BitmapDestinationAddress *destinationAddress, PUINT workspaceHandle, PUINT planeID);
  16. #define NonStandard24BitBitmapID "Bitmap24\0"
  17. typedef struct tagBITMAP_DATA
  18. {
  19. //
  20. // Data Buffer
  21. //
  22. BOOL m_bdataCheckpoint;
  23. UINT m_padBits;
  24. UINT m_length;
  25. } BITMAPDATA, *PBITMAPDATA;
  26. class BitmapObj : public T126Obj
  27. {
  28. public:
  29. BitmapObj (BitmapCreatePDU * pbitmapCreatePDU);
  30. void Continue (BitmapCreateContinuePDU * pbitmapCreateContinuePDU);
  31. BitmapObj (UINT);
  32. ~BitmapObj( void );
  33. void Draw(HDC hDC = NULL, BOOL bForcedDraw = FALSE, BOOL bPrinting = FALSE);
  34. BOOL CheckReallyHit(LPCRECT pRectHit){return RectangleHit(FALSE, pRectHit);}
  35. void FromScreenArea(LPCRECT lprcScreen);
  36. BOOL HasFillColor(void){return FALSE;}
  37. void SetFillColor(COLORREF cr, BOOL isPresent){}
  38. BOOL GetFillColor(COLORREF * pcr){return FALSE;}
  39. BOOL GetFillColor(RGBTRIPLE* prgb){return FALSE;}
  40. void SetPenColor(COLORREF cr, BOOL isPresent){}
  41. BOOL GetPenColor(COLORREF * pcr) {return FALSE;}
  42. BOOL GetPenColor(RGBTRIPLE* prgb){return FALSE;}
  43. void SetViewHandle(UINT viewHandle){};
  44. void DeleteSavedBitmap(void);
  45. void BitmapEditObj ( BitmapEditPDU * pbitmapEditPDU );
  46. void GetBitmapAttrib(PBitmapCreatePDU_attributes pAttribPDU);
  47. void SetBitmapAttrib(PBitmapCreatePDU_attributes *pattributes);
  48. void AllocateAttrib(PBitmapCreatePDU_attributes *pAttributes);
  49. //
  50. // PDU stuff
  51. //
  52. void CreateBitmapCreatePDU(CWBOBLIST * pCreatePDUList);
  53. void CreateBitmapEditPDU(BitmapEditPDU *pEditPDU);
  54. void CreateBitmapDeletePDU(BitmapDeletePDU *pDeletePDU);
  55. void CreateNonStandard24BitBitmap(BitmapCreatePDU * pBitmapCreatePDU);
  56. LPBITMAPINFOHEADER m_lpbiImage; // local copy of the DIB
  57. LPBITMAPINFOHEADER m_lpBitMask; // Bitmask for transparent bitmaps.
  58. LPBYTE m_lpTransparencyMask;
  59. UINT m_SizeOfTransparencyMask;
  60. BOOL m_fMoreToFollow;
  61. //
  62. // Masks 0x000000007 (BitmapAttribute_viewState_chosen = 1... BitmapAttribute_transparencyMask_chosen = 3)
  63. //
  64. void ChangedViewState(void){m_dwChangedAttrib |= (1 << (BitmapAttribute_viewState_chosen-1)) |
  65. BitmapEditPDU_attributeEdits_present;};
  66. void ChangedZOrder(void){m_dwChangedAttrib |= (1 << (BitmapAttribute_zOrder_chosen-1)) |
  67. BitmapEditPDU_attributeEdits_present;};
  68. void ChangedTransparencyMask(void){m_dwChangedAttrib |= (1 << (BitmapAttribute_transparencyMask_chosen-1)) |
  69. BitmapEditPDU_attributeEdits_present;};
  70. BOOL HasViewStateChanged(void){return (m_dwChangedAttrib & ( 1 << (BitmapAttribute_viewState_chosen-1)));};
  71. BOOL HasZOrderChanged(void){return (m_dwChangedAttrib & ( 1 << (BitmapAttribute_zOrder_chosen-1)));};
  72. BOOL HasTransparencyMaskChanged(void){return (m_dwChangedAttrib & ( 1 << (BitmapAttribute_transparencyMask_chosen-1)));};
  73. //
  74. // Masks 0x000000070 (BitmapEditPDU_scalingEdit_present = 0x10... BitmapEditPDU_anchorPointEdit_present = 0x40)
  75. //
  76. void ChangedAnchorPoint(void){ m_dwChangedAttrib |= BitmapEditPDU_anchorPointEdit_present;}
  77. void ChangedRegionOfInterest(void){ m_dwChangedAttrib |= bitmapRegionOfInterestEdit_present;}
  78. void ChangedScaling(void){ m_dwChangedAttrib |= BitmapEditPDU_scalingEdit_present;}
  79. BOOL HasAnchorPointChanged(void){ return (m_dwChangedAttrib & BitmapEditPDU_anchorPointEdit_present);}
  80. BOOL HasRegionOfInterestChanged(void){ return (m_dwChangedAttrib & bitmapRegionOfInterestEdit_present);}
  81. BOOL HasScalingChanged(void){ return (m_dwChangedAttrib & BitmapEditPDU_scalingEdit_present);}
  82. void ResetAttrib(void){m_dwChangedAttrib = 0;}
  83. void SetAllAttribs(void){m_dwChangedAttrib = 0x07;}
  84. DWORD GetPresentAttribs(void){return ((m_dwChangedAttrib & 0x0F0));}
  85. void ChangedPenThickness(void){};
  86. void OnObjectEdit(void);
  87. void OnObjectDelete(void);
  88. void SendNewObjectToT126Apps(void);
  89. void GetEncodedCreatePDU(ASN1_BUF *pBuf);
  90. //Remote pointer stuff
  91. //
  92. // Device context used for drawing and undrawing the pointer
  93. //
  94. HDC m_hMemDC;
  95. //
  96. // Pointer to the bitmap used to save the data under the pointer
  97. //
  98. HBITMAP m_hSaveBitmap;
  99. //
  100. // Handle of bitmap originally supplied with memDC
  101. //
  102. HBITMAP m_hOldBitmap;
  103. //
  104. // Handle of icon to be used for drawing
  105. //
  106. HICON m_hIcon;
  107. HICON CreateColoredIcon(COLORREF color, LPBITMAPINFOHEADER lpbInfo = NULL, LPBYTE pMaskBits = NULL);
  108. void CreateSaveBitmap();
  109. void UnDraw(void);
  110. BOOL UndrawScreen();
  111. void SetBitmapSize(LONG x, LONG y){m_bitmapSize.x = x; m_bitmapSize.y = y;}
  112. protected:
  113. DWORD m_dwChangedAttrib;
  114. POINT m_bitmapSize; // Width, Height
  115. RECT m_bitmapRegionOfInterest;
  116. UINT m_pixelAspectRatio;
  117. POINT m_scaling;
  118. UINT m_checkPoints;
  119. BITMAPDATA m_bitmapData;
  120. };
  121. #endif // __BITMAPOBJ_HPP_