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.

98 lines
4.1 KiB

  1. //-------------------------------------------------------------------------//
  2. // BmpRgn.h - Bitmap-to-Region transforms
  3. //
  4. // History:
  5. // 01/31/2000 scotthan created
  6. //-------------------------------------------------------------------------//
  7. #ifndef __RGN_H__
  8. #define __RGN_H__
  9. //-------------------------------------------------------------------------//
  10. // CreateBitmapRgn
  11. //
  12. // Creates a region based on an arbitrary bitmap, transparency-keyed on a
  13. // RGB value within a specified tolerance. The key value is optional (-1 ==
  14. // use the value of the first pixel as the key).
  15. //
  16. EXTERN_C HRESULT WINAPI CreateBitmapRgn(
  17. HBITMAP hbm, int cxOffset, int cyOffset,
  18. int cx, int cy, BOOL fAlphaChannel, int iAlphaThreshold, COLORREF rgbMask,
  19. int nMaskTolerance, OUT HRGN *phrgn);
  20. //-------------------------------------------------------------------------//
  21. // CreateScaledBitmapRgn
  22. //
  23. // Behaves in the same manner as CreateBitmapRgn,
  24. // except builds a region based on a +scaled+ arbitrary bitmap.
  25. EXTERN_C HRGN WINAPI CreateScaledBitmapRgn(
  26. HBITMAP hbm, int cx, int cy, COLORREF rgbMask, int nMaskTolerance );
  27. //-------------------------------------------------------------------------//
  28. // CreateTextRgn
  29. //
  30. // Creates a region based on a text string in the indicated font.
  31. //
  32. EXTERN_C HRGN WINAPI CreateTextRgn( HFONT hf, LPCTSTR pszText );
  33. //-------------------------------------------------------------------------//
  34. // AddToCompositeRgn
  35. //
  36. // Wraps CombineRgn by managing composite creation and positioning
  37. // the source region (which is permanently offset). Returns one of:
  38. // NULLREGION, SIMPLEREGION, COMPLEXREGION, ERROR.
  39. //
  40. EXTERN_C int WINAPI AddToCompositeRgn(
  41. HRGN* phrgnComposite, HRGN hrgnSrc, int cxOffset, int cyOffset );
  42. //-------------------------------------------------------------------------//
  43. // RemoveFromCompositeRgn
  44. //
  45. // Wraps CombineRgn by managing removal of rectangular region from
  46. // an existing destination region. Returns one of:
  47. // NULLREGION, SIMPLEREGION, COMPLEXREGION, ERROR.
  48. //
  49. EXTERN_C int WINAPI RemoveFromCompositeRgn( HRGN hrgnDest, LPCRECT prcRemove );
  50. //-------------------------------------------------------------------------//
  51. // CreateTiledRectRgn
  52. //
  53. // Returns a rectangular region composed of region tiles.
  54. //
  55. EXTERN_C HRGN WINAPI CreateTiledRectRgn(
  56. HRGN hrgnTile, int cxTile, int cyTile, int cxBound, int cyBound );
  57. //-------------------------------------------------------------------------//
  58. // Region utilities:
  59. //
  60. EXTERN_C HRGN WINAPI _DupRgn( HRGN hrgnSrc );
  61. //-------------------------------------------------------------------------//
  62. // hit-testing
  63. #define HTR_NORESIZE_USESEGCODE 0
  64. #define HTR_NORESIZE_RETDEFAULT -1
  65. struct HITTESTRGN
  66. {
  67. HRGN hrgn; // test region
  68. POINT pt; // test point
  69. WORD wSegCode; // raw grid code, in the form of HTTOP, HTLEFT, HTTOPLEFT, etc. This speeds calcs
  70. WORD wDefault; // return code on hit failure.
  71. BOOL fCaptionAtTop; // interpret hits in top grid segs as a caption hit.
  72. UINT cxLeftMargin; // width of left resizing margin, HTR_NORESIZE_USESEGCODE, or HTR_NORESIZE_USEDEFAULTCODE
  73. UINT cyTopMargin; // height of top resizing margin, HTR_NORESIZE_USESEGCODE, or HTR_NORESIZE_USEDEFAULTCODE
  74. UINT cxRightMargin; // width of right resizing margin, HTR_NORESIZE_USESEGCODE, or HTR_NORESIZE_USEDEFAULTCODE
  75. UINT cyBottomMargin;// height of bottom resizing margin, HTR_NORESIZE_USESEGCODE, or HTR_NORESIZE_USEDEFAULTCODE
  76. };
  77. EXTERN_C WORD WINAPI _DefaultHitCodeFromSegCode( BOOL fHasCaption, WORD wSegHTcode );
  78. //-------------------------------------------------------------------------//
  79. // Stretch/Tile rects from original region and create a new one
  80. EXTERN_C HRESULT WINAPI _ScaleRectsAndCreateRegion(RGNDATA *pCustomRgnData,
  81. const RECT *pBoundRect, MARGINS *pMargins, SIZE *pszSrcImage, HRGN *pHrgn);
  82. //-------------------------------------------------------------------------//
  83. #ifdef _DEBUG
  84. void RegionDebug(HRGN hrgn);
  85. #endif
  86. #endif __RGN_H__