2 * PostScript brush handling
4 * Copyright 1998 Huw D M Davies
14 /***********************************************************************
15 * PSDRV_BRUSH_SelectObject
17 HBRUSH32
PSDRV_BRUSH_SelectObject( DC
* dc
, HBRUSH32 hbrush
, BRUSHOBJ
* brush
)
19 HBRUSH32 prevbrush
= dc
->w
.hBrush
;
20 PSDRV_PDEVICE
*physDev
= (PSDRV_PDEVICE
*)dc
->physDev
;
22 TRACE(psdrv
, "hbrush = %08x\n", hbrush
);
23 dc
->w
.hBrush
= hbrush
;
25 switch(brush
->logbrush
.lbStyle
) {
28 PSDRV_CreateColor(physDev
, &physDev
->brush
.color
,
29 brush
->logbrush
.lbColor
);
36 PSDRV_CreateColor(physDev
, &physDev
->brush
.color
,
37 brush
->logbrush
.lbColor
);
41 FIXME(psdrv
, "Unsupported brush style %d\n", brush
->logbrush
.lbStyle
);
45 FIXME(psdrv
, "Unrecognized brush style %d\n", brush
->logbrush
.lbStyle
);
49 physDev
->brush
.set
= FALSE
;
54 /**********************************************************************
59 static BOOL32
PSDRV_SetBrush(DC
*dc
)
61 PSDRV_PDEVICE
*physDev
= (PSDRV_PDEVICE
*)dc
->physDev
;
62 BRUSHOBJ
*brush
= (BRUSHOBJ
*)GDI_GetObjPtr( dc
->w
.hBrush
, BRUSH_MAGIC
);
65 ERR(psdrv
, "Can't get BRUSHOBJ\n");
69 switch (brush
->logbrush
.lbStyle
) {
72 PSDRV_WriteSetColor(dc
, &physDev
->brush
.color
);
83 physDev
->brush
.set
= TRUE
;
88 /**********************************************************************
93 static BOOL32
PSDRV_Fill(DC
*dc
, BOOL32 EO
)
96 return PSDRV_WriteFill(dc
);
98 return PSDRV_WriteEOFill(dc
);
102 /**********************************************************************
107 static BOOL32
PSDRV_Clip(DC
*dc
, BOOL32 EO
)
110 return PSDRV_WriteClip(dc
);
112 return PSDRV_WriteEOClip(dc
);
115 /**********************************************************************
120 BOOL32
PSDRV_Brush(DC
*dc
, BOOL32 EO
)
122 BRUSHOBJ
*brush
= (BRUSHOBJ
*)GDI_GetObjPtr( dc
->w
.hBrush
, BRUSH_MAGIC
);
125 ERR(psdrv
, "Can't get BRUSHOBJ\n");
129 switch (brush
->logbrush
.lbStyle
) {
132 PSDRV_WriteGSave(dc
);
134 PSDRV_WriteGRestore(dc
);
141 switch(brush
->logbrush
.lbHatch
) {
144 PSDRV_WriteGSave(dc
);
146 PSDRV_WriteHatch(dc
);
147 PSDRV_WriteStroke(dc
);
148 PSDRV_WriteGRestore(dc
);
149 if(brush
->logbrush
.lbHatch
== HS_VERTICAL
)
151 /* else fallthrough for HS_CROSS */
154 PSDRV_WriteGSave(dc
);
156 PSDRV_WriteRotate(dc
, 90.0);
157 PSDRV_WriteHatch(dc
);
158 PSDRV_WriteStroke(dc
);
159 PSDRV_WriteGRestore(dc
);
164 PSDRV_WriteGSave(dc
);
166 PSDRV_WriteRotate(dc
, -45.0);
167 PSDRV_WriteHatch(dc
);
168 PSDRV_WriteStroke(dc
);
169 PSDRV_WriteGRestore(dc
);
170 if(brush
->logbrush
.lbHatch
== HS_FDIAGONAL
)
172 /* else fallthrough for HS_DIAGCROSS */
175 PSDRV_WriteGSave(dc
);
177 PSDRV_WriteRotate(dc
, 45.0);
178 PSDRV_WriteHatch(dc
);
179 PSDRV_WriteStroke(dc
);
180 PSDRV_WriteGRestore(dc
);
184 ERR(psdrv
, "Unknown hatch style\n");