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.

174 lines
5.3 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. bltbitmp.hxx
  7. Bitmap and display map definitions
  8. Note: This file depends on the BMID typedef in blt.hxx
  9. FILE HISTORY:
  10. rustanl 3-Dec-1990 Created
  11. JohnL 4-Mar-1991 Fully implemented display map
  12. Johnl 18-Mar-1991 Made code review changes
  13. Terryk 22-Mar-1991 comment header changed
  14. gregj 1-May-1991 Added DISPLAY_MAP::QueryID
  15. beng 14-May-1991 Hacked for separate compilation
  16. terryk 19-Jul-1991 Delete BLT_MAP::BLT_MAP( ULONG )
  17. Add BLT_MAP::SetBitmap( HBITMAP hbitmap )
  18. */
  19. #ifndef _BLT_HXX_
  20. #error "Don't include this file directly; instead, include it through blt.hxx"
  21. #endif // _BLT_HXX_
  22. #ifndef _BLTBITMP_HXX_
  23. #define _BLTBITMP_HXX_
  24. #include "base.hxx"
  25. #include "bltidres.hxx"
  26. // The following is the color that will be mapped to the screen background.
  27. // for DISPLAY_MAP objects. (this is bright green).
  28. //
  29. #define DISPLAY_MAP_TRANS_COLOR RGB(0x00, 0xFF, 0x00 )
  30. /*************************************************************************
  31. NAME: BIT_MAP
  32. SYNOPSIS: General wrapper for a bitmap object
  33. INTERFACE:
  34. BIT_MAP()
  35. Takes a bitmap ID defined in the resource and attempts to
  36. load it from the resource. Will assert out in debug version
  37. if loading fails.
  38. BIT_MAP()
  39. Assumes hbitmp is a valid bitmap handle and initializes the
  40. BIT_MAP object accordingly
  41. QueryHandle()
  42. Returns the bitmap handle
  43. QueryWidth()
  44. QueryHeight()
  45. Returns the width and the height (respectively)
  46. QueryError()
  47. Returns ERROR_INVALID_DATA if this BIT_MAP object is NULL
  48. PARENT: BASE
  49. NOTES: The bitmap is deleted during destruction.
  50. HISTORY:
  51. Rustanl 3-Dec-1990 Created
  52. Johnl 13-Mar-1991 Documented, cleaned up
  53. terryk 21-Jun-1991 Add 2 more constructors for bitmap class
  54. terryk 19-Jul-1991 Delete BLT_MAP( ULONG ) and Add
  55. SetBitmap( HBITMAP hbitmap )
  56. beng 04-Oct-1991 Win32 conversion
  57. beng 28-Jul-1992 Loads from app or lib; use IDRESOURCE
  58. **************************************************************************/
  59. DLL_CLASS BIT_MAP : public BASE
  60. {
  61. public:
  62. BIT_MAP( const IDRESOURCE & id );
  63. BIT_MAP( HBITMAP hbitmp );
  64. ~BIT_MAP();
  65. HBITMAP QueryHandle() const;
  66. UINT QueryHeight() const;
  67. UINT QueryWidth() const;
  68. VOID SetBitmap( HBITMAP hbitmap );
  69. private:
  70. HBITMAP _h;
  71. };
  72. /*************************************************************************
  73. NAME: DISPLAY_MAP
  74. SYNOPSIS: Used when portions of a bitmap need to transparently overlay
  75. the underlying screen. Generates the mask to do so automatically.
  76. INTERFACE:
  77. DISPLAY_MAP()
  78. Takes a BMID (Bitmap ID) and generates the mask automatically
  79. (note: the bitmap is twiddled with also, so don't use it
  80. by itself, always use the DISPLAY_MAP::Paint method).
  81. QueryMaskHandle()
  82. QueryBitmapHandle()
  83. Gets the HBITMAP of the mask and handle respectively
  84. QueryWidth()
  85. QueryHeight()
  86. Gets the width and height of the display map.
  87. QueryID()
  88. Gets the DMID for the display map.
  89. Paint()
  90. Paints this display map onto the given device context
  91. at the given position. Returns TRUE if successful,
  92. FALSE otherwise (BitBlt failed for some reason).
  93. PARENT: BASE
  94. HISTORY:
  95. Johnl 1-Mar-1991 Created first real version
  96. gregj 1-May-1991 Added QueryID() for GUILTT support
  97. beng 04-Oct-1991 Win32 conversion
  98. **************************************************************************/
  99. DLL_CLASS DISPLAY_MAP : public BASE
  100. {
  101. public:
  102. DISPLAY_MAP( BMID bmid );
  103. ~DISPLAY_MAP();
  104. HBITMAP QueryMaskHandle() const;
  105. HBITMAP QueryBitmapHandle() const;
  106. UINT QueryHeight() const;
  107. UINT QueryWidth() const;
  108. BOOL Paint( HDC hDC, INT x, INT y ) const;
  109. BMID QueryID() const { return _bmid; }
  110. private:
  111. BIT_MAP * _pbmMask; // Pointer to the bitmap of the mask
  112. BIT_MAP * _pbmBitmap; // Pointer to the bitmap image
  113. BMID _bmid; // display map ID
  114. VOID SetMaskBits( BYTE * pbBits,
  115. INT nColorIndex,
  116. INT nBitsPerPixel,
  117. UINT cbSize );
  118. VOID SetBitmapBits( BYTE * pbBits,
  119. INT nColorIndex,
  120. INT nBitsPerPixel,
  121. UINT cbSize );
  122. INT GetTransColorIndex( DWORD *pdwRGB, INT nNumDWords ) const;
  123. };
  124. #endif // _BLTBITMP_HXX - end of file