1 #pragma once 2 3 /* Internal interface */ 4 5 #define NB_HATCH_STYLES 6 6 7 /* 8 * The layout of this structure is taken from "Windows Graphics Programming" 9 * book written by Feng Yuan. 10 * 11 * DON'T MODIFY THIS STRUCTURE UNLESS REALLY NEEDED AND EVEN THEN ASK ON 12 * A MAILING LIST FIRST. 13 */ 14 typedef struct _BRUSHBODY 15 { 16 ULONG iHatch; // This is not the brush style, but the hatch style! 17 HBITMAP hbmPattern; 18 HBITMAP hbmClient; 19 ULONG flAttrs; 20 21 ULONG ulBrushUnique; 22 BRUSH_ATTR *pBrushAttr; // Pointer to the currently active brush attribute 23 BRUSH_ATTR BrushAttr; // Internal brush attribute for global brushes 24 POINT ptOrigin; 25 ULONG bCacheGrabbed; 26 COLORREF crBack; 27 COLORREF crFore; 28 ULONG ulPalTime; 29 ULONG ulSurfTime; 30 PVOID pvRBrush; 31 HDEV hdev; 32 //DWORD unk054; 33 34 /* The following members are for PENs only */ 35 LONG lWidth; 36 FLOATOBJ eWidth; 37 ULONG ulPenStyle; 38 DWORD *pStyle; 39 ULONG dwStyleCount; 40 BYTE jJoin; // 0x06c Join styles for geometric wide lines 41 BYTE jEndCap; // end cap style for a geometric wide line 42 //WORD unk06e; // 0x06e 43 INT iBrushStyle; // 0x070 44 //PREGION prgn; // 0x074 45 //DWORD unk078; // 0x078 46 //DWORD unk07c; // 0x07c 47 ULONG ulStyleSize; 48 LIST_ENTRY ListHead; // 0x080 49 } BRUSHBODY; 50 51 #ifndef __cplusplus 52 typedef struct _BRUSH 53 { 54 /* Header for all gdi objects in the handle table. 55 Do not (re)move this. */ 56 BASEOBJECT BaseObject; 57 58 BRUSHBODY; 59 } BRUSH, *PBRUSH; 60 #else 61 class BRUSH; 62 typedef class BRUSH *PBRUSH; 63 #endif 64 65 typedef struct _EBRUSHOBJ 66 { 67 BRUSHOBJ BrushObject; 68 69 COLORREF crRealize; 70 ULONG ulRGBColor; 71 PVOID pengbrush; 72 ULONG ulSurfPalTime; 73 ULONG ulDCPalTime; 74 COLORREF crCurrentText; 75 COLORREF crCurrentBack; 76 COLORADJUSTMENT *pca; 77 // DWORD dwUnknown2c; 78 // DWORD dwUnknown30; 79 SURFACE * psurfTrg; 80 struct _PALETTE * ppalSurf; 81 struct _PALETTE * ppalDC; 82 struct _PALETTE * ppalDIB; 83 // DWORD dwUnknown44; 84 PBRUSH pbrush; 85 FLONG flattrs; 86 DWORD ulUnique; 87 // DWORD dwUnknown54; 88 // DWORD dwUnknown58; 89 90 SURFOBJ *psoMask; 91 } EBRUSHOBJ, *PEBRUSHOBJ; 92 93 /* GDI Brush Attributes */ 94 #define BR_NEED_FG_CLR 0x00000001 95 #define BR_NEED_BK_CLR 0x00000002 /* Background color is needed */ 96 #define BR_DITHER_OK 0x00000004 /* Allow color dithering */ 97 #define BR_IS_SOLID 0x00000010 /* Solid brush */ 98 #define BR_IS_HATCH 0x00000020 /* Hatch brush */ 99 #define BR_IS_BITMAP 0x00000040 /* DDB pattern brush */ 100 #define BR_IS_DIB 0x00000080 /* DIB pattern brush */ 101 #define BR_IS_NULL 0x00000100 /* Null/hollow brush */ 102 #define BR_IS_GLOBAL 0x00000200 /* Stock objects */ 103 #define BR_IS_PEN 0x00000400 /* Pen */ 104 #define BR_IS_OLDSTYLEPEN 0x00000800 /* Geometric pen */ 105 #define BR_IS_DIBPALCOLORS 0x00001000 106 #define BR_IS_DIBPALINDICES 0x00002000 107 #define BR_IS_DEFAULTSTYLE 0x00004000 108 #define BR_IS_MASKING 0x00008000 /* Pattern bitmap is used as transparent mask (?) */ 109 #define BR_IS_INSIDEFRAME 0x00010000 110 #define BR_CACHED_ENGINE 0x00040000 111 #define BR_CACHED_IS_SOLID 0x80000000 112 113 #define BRUSH_ShareLockBrush(hBrush) ((PBRUSH)GDIOBJ_ShareLockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)) 114 #define BRUSH_ShareUnlockBrush(pBrush) GDIOBJ_vDereferenceObject((POBJ)pBrush) 115 116 INT 117 FASTCALL 118 BRUSH_GetObject( 119 PBRUSH GdiObject, 120 INT Count, 121 LPLOGBRUSH Buffer); 122 123 VOID 124 NTAPI 125 BRUSH_vDeleteObject( 126 PVOID pvObject); 127 128 extern HSURF gahsurfHatch[HS_DDI_MAX]; 129 130 struct _SURFACE; 131 struct _PALETTE; 132 struct _DC; 133 134 INIT_FUNCTION 135 NTSTATUS 136 NTAPI 137 InitBrushImpl(VOID); 138 139 VOID 140 NTAPI 141 EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _SURFACE *, COLORREF, COLORREF, struct _PALETTE *); 142 143 VOID 144 NTAPI 145 EBRUSHOBJ_vInitFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *); 146 147 VOID 148 FASTCALL 149 EBRUSHOBJ_vSetSolidRGBColor(EBRUSHOBJ *pebo, COLORREF crColor); 150 151 VOID 152 NTAPI 153 EBRUSHOBJ_vUpdateFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *); 154 155 BOOL 156 NTAPI 157 EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo, BOOL bCallDriver); 158 159 VOID 160 NTAPI 161 EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo); 162 163 PVOID 164 NTAPI 165 EBRUSHOBJ_pvGetEngBrush(EBRUSHOBJ *pebo); 166 167 SURFOBJ* 168 NTAPI 169 EBRUSHOBJ_psoPattern(EBRUSHOBJ *pebo); 170 171 #define BRUSHOBJ_psoPattern(pbo) \ 172 EBRUSHOBJ_psoPattern(CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject)) 173 174 SURFOBJ* 175 NTAPI 176 EBRUSHOBJ_psoMask(EBRUSHOBJ *pebo); 177 178 #define BRUSHOBJ_psoMask(pbo) \ 179 EBRUSHOBJ_psoMask(CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject)) 180 181 FORCEINLINE 182 ULONG 183 EBRUSHOBJ_iSetSolidColor(EBRUSHOBJ *pebo, ULONG iSolidColor) 184 { 185 ULONG iOldColor = pebo->BrushObject.iSolidColor; 186 pebo->BrushObject.iSolidColor = iSolidColor; 187 return iOldColor; 188 } 189 190 BOOL FASTCALL IntGdiSetBrushOwner(PBRUSH,DWORD); 191 BOOL FASTCALL GreSetBrushOwner(HBRUSH,DWORD); 192 193 HBRUSH APIENTRY 194 IntGdiCreatePatternBrush( 195 HBITMAP hBitmap); 196 197 HBRUSH APIENTRY 198 IntGdiCreateSolidBrush( 199 COLORREF Color); 200 201 HBRUSH APIENTRY 202 IntGdiCreateNullBrush(VOID); 203 204 VOID 205 NTAPI 206 IntGdiSetSolidBrushColor( 207 _In_ HBRUSH hbr, 208 _In_ COLORREF crColor); 209