2 * PostScript pen handling
4 * Copyright 1998 Huw D M Davies
13 static char PEN_dash
[] = "50 30"; /* ----- ----- ----- */
14 static char PEN_dot
[] = "20"; /* -- -- -- -- -- -- */
15 static char PEN_dashdot
[] = "40 30 20 30"; /* ---- -- ---- -- */
16 static char PEN_dashdotdot
[] = "40 20 20 20 20 20"; /* ---- -- -- ---- */
17 static char PEN_alternate
[] = "1";
19 /***********************************************************************
20 * PSDRV_PEN_SelectObject
22 extern HPEN32
PSDRV_PEN_SelectObject( DC
* dc
, HPEN32 hpen
, PENOBJ
* pen
)
24 HPEN32 prevpen
= dc
->w
.hPen
;
25 PSDRV_PDEVICE
*physDev
= (PSDRV_PDEVICE
*)dc
->physDev
;
27 TRACE(psdrv
, "hpen = %08x colour = %08lx\n", hpen
, pen
->logpen
.lopnColor
);
30 physDev
->pen
.width
= XLSTODS(dc
, pen
->logpen
.lopnWidth
.x
);
31 if(physDev
->pen
.width
< 0)
32 physDev
->pen
.width
= -physDev
->pen
.width
;
34 PSDRV_CreateColor(physDev
, &physDev
->pen
.color
, pen
->logpen
.lopnColor
);
36 if(physDev
->pen
.width
> 1) { /* dashes only for 0 or 1 pixel pens */
37 physDev
->pen
.dash
= NULL
;
39 switch(pen
->logpen
.lopnStyle
& PS_STYLE_MASK
) {
41 physDev
->pen
.dash
= PEN_dash
;
45 physDev
->pen
.dash
= PEN_dot
;
49 physDev
->pen
.dash
= PEN_dashdot
;
53 physDev
->pen
.dash
= PEN_dashdotdot
;
57 physDev
->pen
.dash
= PEN_alternate
;
61 physDev
->pen
.dash
= NULL
;
66 physDev
->pen
.set
= FALSE
;
71 /**********************************************************************
76 BOOL32
PSDRV_SetPen(DC
*dc
)
78 PSDRV_PDEVICE
*physDev
= (PSDRV_PDEVICE
*)dc
->physDev
;
80 PSDRV_WriteSetColor(dc
, &physDev
->pen
.color
);
82 if(!physDev
->pen
.set
) {
83 PSDRV_WriteSetPen(dc
);
84 physDev
->pen
.set
= TRUE
;