2 * PostScript brush handling
4 * Copyright 1998 Huw D M Davies
13 /***********************************************************************
14 * PSDRV_BRUSH_SelectObject
16 HBRUSH
PSDRV_BRUSH_SelectObject( DC
* dc
, HBRUSH hbrush
, BRUSHOBJ
* brush
)
18 HBRUSH prevbrush
= dc
->w
.hBrush
;
19 PSDRV_PDEVICE
*physDev
= (PSDRV_PDEVICE
*)dc
->physDev
;
21 TRACE(psdrv
, "hbrush = %08x\n", hbrush
);
22 dc
->w
.hBrush
= hbrush
;
24 switch(brush
->logbrush
.lbStyle
) {
27 PSDRV_CreateColor(physDev
, &physDev
->brush
.color
,
28 brush
->logbrush
.lbColor
);
35 PSDRV_CreateColor(physDev
, &physDev
->brush
.color
,
36 brush
->logbrush
.lbColor
);
40 FIXME(psdrv
, "Unsupported brush style %d\n", brush
->logbrush
.lbStyle
);
44 FIXME(psdrv
, "Unrecognized brush style %d\n", brush
->logbrush
.lbStyle
);
48 physDev
->brush
.set
= FALSE
;
53 /**********************************************************************
58 static BOOL
PSDRV_SetBrush(DC
*dc
)
60 PSDRV_PDEVICE
*physDev
= (PSDRV_PDEVICE
*)dc
->physDev
;
61 BRUSHOBJ
*brush
= (BRUSHOBJ
*)GDI_GetObjPtr( dc
->w
.hBrush
, BRUSH_MAGIC
);
64 ERR(psdrv
, "Can't get BRUSHOBJ\n");
68 switch (brush
->logbrush
.lbStyle
) {
71 PSDRV_WriteSetColor(dc
, &physDev
->brush
.color
);
82 physDev
->brush
.set
= TRUE
;
87 /**********************************************************************
92 static BOOL
PSDRV_Fill(DC
*dc
, BOOL EO
)
95 return PSDRV_WriteFill(dc
);
97 return PSDRV_WriteEOFill(dc
);
101 /**********************************************************************
106 static BOOL
PSDRV_Clip(DC
*dc
, BOOL EO
)
109 return PSDRV_WriteClip(dc
);
111 return PSDRV_WriteEOClip(dc
);
114 /**********************************************************************
119 BOOL
PSDRV_Brush(DC
*dc
, BOOL EO
)
121 BRUSHOBJ
*brush
= (BRUSHOBJ
*)GDI_GetObjPtr( dc
->w
.hBrush
, BRUSH_MAGIC
);
124 ERR(psdrv
, "Can't get BRUSHOBJ\n");
128 switch (brush
->logbrush
.lbStyle
) {
131 PSDRV_WriteGSave(dc
);
133 PSDRV_WriteGRestore(dc
);
140 switch(brush
->logbrush
.lbHatch
) {
143 PSDRV_WriteGSave(dc
);
145 PSDRV_WriteHatch(dc
);
146 PSDRV_WriteStroke(dc
);
147 PSDRV_WriteGRestore(dc
);
148 if(brush
->logbrush
.lbHatch
== HS_VERTICAL
)
150 /* else fallthrough for HS_CROSS */
153 PSDRV_WriteGSave(dc
);
155 PSDRV_WriteRotate(dc
, 90.0);
156 PSDRV_WriteHatch(dc
);
157 PSDRV_WriteStroke(dc
);
158 PSDRV_WriteGRestore(dc
);
163 PSDRV_WriteGSave(dc
);
165 PSDRV_WriteRotate(dc
, -45.0);
166 PSDRV_WriteHatch(dc
);
167 PSDRV_WriteStroke(dc
);
168 PSDRV_WriteGRestore(dc
);
169 if(brush
->logbrush
.lbHatch
== HS_FDIAGONAL
)
171 /* else fallthrough for HS_DIAGCROSS */
174 PSDRV_WriteGSave(dc
);
176 PSDRV_WriteRotate(dc
, 45.0);
177 PSDRV_WriteHatch(dc
);
178 PSDRV_WriteStroke(dc
);
179 PSDRV_WriteGRestore(dc
);
183 ERR(psdrv
, "Unknown hatch style\n");