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.

94 lines
3.4 KiB

  1. /****************************************************************************/
  2. /* Copyright(C) Microsoft Corporation 1998 */
  3. /****************************************************************************/
  4. #ifndef _H_EOSINT
  5. #define _H_EOSINT
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif /* __cplusplus */
  9. WINGDIAPI HBRUSH WINAPI CreateHatchBrush(int, COLORREF);
  10. /* Hatch Styles */
  11. #define HS_HORIZONTAL 0 /* ----- */
  12. #define HS_VERTICAL 1 /* ||||| */
  13. #define HS_FDIAGONAL 2 /* \\\\\ */
  14. #define HS_BDIAGONAL 3 /* ///// */
  15. #define HS_CROSS 4 /* +++++ */
  16. #define HS_DIAGCROSS 5 /* xxxxx */
  17. #define HS_LAST HS_DIAGCROSS
  18. #define BS_HATCHED 2
  19. //const BYTE kbmHorizontal[] = {0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00};
  20. //const BYTE kbmVertical[] = {0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88};
  21. //const BYTE kbmFDiagonal[] = {0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88};
  22. //const BYTE kbmBDiagonal[] = {0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11};
  23. //const BYTE kbmCross[] = {0x11, 0x11, 0x11, 0xFF, 0x11, 0x11, 0x11, 0xFF};
  24. //const BYTE kbmDiagCross[] = {0x11, 0xAA, 0x8A, 0x44, 0x11, 0xAA, 0x8A, 0x44};
  25. const BYTE kbmBrushBits[6][8] = {{0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00},
  26. {0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88},
  27. {0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88},
  28. {0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11},
  29. {0x11, 0x11, 0x11, 0xFF, 0x11, 0x11, 0x11, 0xFF},
  30. {0x11, 0xAA, 0x8A, 0x44, 0x11, 0xAA, 0x8A, 0x44}};
  31. #ifdef __cplusplus
  32. }
  33. #endif /* __cplusplus */
  34. #ifdef __cplusplus
  35. class CHatchBrush // chb
  36. {
  37. public:
  38. CHatchBrush();
  39. ~CHatchBrush();
  40. // Inline this since it's only ever called from the 'C' CreateHatchBrush
  41. inline HBRUSH CreateHatchBrush(int fnStyle, COLORREF clrref)
  42. {
  43. // BUGBUG: Not using clrref! Need support from WinCE team
  44. DC_IGNORE_PARAMETER(clrref);
  45. HBITMAP hbm;
  46. DC_BEGIN_FN("CreateHatchBrush");
  47. switch (fnStyle)
  48. {
  49. case HS_BDIAGONAL: // 45-degree downward left-to-right hatch
  50. case HS_CROSS: // Horizontal and vertical crosshatch
  51. case HS_DIAGCROSS: // 45-degree crosshatch
  52. case HS_FDIAGONAL: // 45-degree upward left-to-right hatch
  53. case HS_HORIZONTAL: // Horizontal hatch
  54. case HS_VERTICAL: // Vertical hatch
  55. TRC_DBG((TB, _T("Faking hatched brush creation: %d"), fnStyle));
  56. if (NULL != (hbm = GetBrushBitmap(fnStyle))) {
  57. return ::CreatePatternBrush(hbm);
  58. }
  59. break;
  60. default:
  61. TRC_ERR((TB, _T("Illegal hatched brush style")));
  62. return NULL;
  63. }
  64. return NULL;
  65. };
  66. private:
  67. HBITMAP m_hbmBrush[HS_LAST];
  68. inline HBITMAP GetBrushBitmap(int fnStyle)
  69. {
  70. if (NULL == m_hbmBrush[fnStyle]) {
  71. return (m_hbmBrush[fnStyle] = CreateBitmap(8, 8, 1, 1, (const void *)kbmBrushBits[fnStyle]));
  72. } else {
  73. return m_hbmBrush[fnStyle];
  74. }
  75. };
  76. };
  77. #endif /* __cplusplus */
  78. #endif // _H_EOSINT