2 * PostScript brush handling
4 * Copyright 1998 Huw D M Davies
13 DEFAULT_DEBUG_CHANNEL(psdrv)
15 /***********************************************************************
16 * PSDRV_BRUSH_SelectObject
18 HBRUSH PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush, BRUSHOBJ * brush )
20 HBRUSH prevbrush = dc->w.hBrush;
21 PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
23 TRACE(psdrv, "hbrush = %08x\n", hbrush);
24 dc->w.hBrush = hbrush;
26 switch(brush->logbrush.lbStyle) {
29 PSDRV_CreateColor(physDev, &physDev->brush.color,
30 brush->logbrush.lbColor);
37 PSDRV_CreateColor(physDev, &physDev->brush.color,
38 brush->logbrush.lbColor);
42 FIXME(psdrv, "Unsupported brush style %d\n", brush->logbrush.lbStyle);
46 FIXME(psdrv, "Unrecognized brush style %d\n", brush->logbrush.lbStyle);
50 physDev->brush.set = FALSE;
55 /**********************************************************************
60 static BOOL PSDRV_SetBrush(DC *dc)
62 PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
63 BRUSHOBJ *brush = (BRUSHOBJ *)GDI_GetObjPtr( dc->w.hBrush, BRUSH_MAGIC );
66 ERR(psdrv, "Can't get BRUSHOBJ\n");
70 switch (brush->logbrush.lbStyle) {
73 PSDRV_WriteSetColor(dc, &physDev->brush.color);
84 physDev->brush.set = TRUE;
89 /**********************************************************************
94 static BOOL PSDRV_Fill(DC *dc, BOOL EO)
97 return PSDRV_WriteFill(dc);
99 return PSDRV_WriteEOFill(dc);
103 /**********************************************************************
108 static BOOL PSDRV_Clip(DC *dc, BOOL EO)
111 return PSDRV_WriteClip(dc);
113 return PSDRV_WriteEOClip(dc);
116 /**********************************************************************
121 BOOL PSDRV_Brush(DC *dc, BOOL EO)
123 BRUSHOBJ *brush = (BRUSHOBJ *)GDI_GetObjPtr( dc->w.hBrush, BRUSH_MAGIC );
126 ERR(psdrv, "Can't get BRUSHOBJ\n");
130 switch (brush->logbrush.lbStyle) {
133 PSDRV_WriteGSave(dc);
135 PSDRV_WriteGRestore(dc);
142 switch(brush->logbrush.lbHatch) {
145 PSDRV_WriteGSave(dc);
147 PSDRV_WriteHatch(dc);
148 PSDRV_WriteStroke(dc);
149 PSDRV_WriteGRestore(dc);
150 if(brush->logbrush.lbHatch == HS_VERTICAL)
152 /* else fallthrough for HS_CROSS */
155 PSDRV_WriteGSave(dc);
157 PSDRV_WriteRotate(dc, 90.0);
158 PSDRV_WriteHatch(dc);
159 PSDRV_WriteStroke(dc);
160 PSDRV_WriteGRestore(dc);
165 PSDRV_WriteGSave(dc);
167 PSDRV_WriteRotate(dc, -45.0);
168 PSDRV_WriteHatch(dc);
169 PSDRV_WriteStroke(dc);
170 PSDRV_WriteGRestore(dc);
171 if(brush->logbrush.lbHatch == HS_FDIAGONAL)
173 /* else fallthrough for HS_DIAGCROSS */
176 PSDRV_WriteGSave(dc);
178 PSDRV_WriteRotate(dc, 45.0);
179 PSDRV_WriteHatch(dc);
180 PSDRV_WriteStroke(dc);
181 PSDRV_WriteGRestore(dc);
185 ERR(psdrv, "Unknown hatch style\n");