2 * PostScript pen handling
4 * Copyright 1998 Huw D M Davies
10 #include "debugtools.h"
12 DEFAULT_DEBUG_CHANNEL(psdrv
)
14 static char PEN_dash
[] = "50 30"; /* ----- ----- ----- */
15 static char PEN_dot
[] = "20"; /* -- -- -- -- -- -- */
16 static char PEN_dashdot
[] = "40 30 20 30"; /* ---- -- ---- -- */
17 static char PEN_dashdotdot
[] = "40 20 20 20 20 20"; /* ---- -- -- ---- */
18 static char PEN_alternate
[] = "1";
20 /***********************************************************************
21 * PSDRV_PEN_SelectObject
23 extern HPEN
PSDRV_PEN_SelectObject( DC
* dc
, HPEN hpen
, PENOBJ
* pen
)
25 HPEN prevpen
= dc
->w
.hPen
;
26 PSDRV_PDEVICE
*physDev
= (PSDRV_PDEVICE
*)dc
->physDev
;
28 TRACE("hpen = %08x colour = %08lx\n", hpen
, pen
->logpen
.lopnColor
);
31 physDev
->pen
.width
= XLSTODS(dc
, pen
->logpen
.lopnWidth
.x
);
32 if(physDev
->pen
.width
< 0)
33 physDev
->pen
.width
= -physDev
->pen
.width
;
35 PSDRV_CreateColor(physDev
, &physDev
->pen
.color
, pen
->logpen
.lopnColor
);
36 physDev
->pen
.style
= pen
->logpen
.lopnStyle
& PS_STYLE_MASK
;
38 switch(physDev
->pen
.style
) {
40 physDev
->pen
.dash
= PEN_dash
;
44 physDev
->pen
.dash
= PEN_dot
;
48 physDev
->pen
.dash
= PEN_dashdot
;
52 physDev
->pen
.dash
= PEN_dashdotdot
;
56 physDev
->pen
.dash
= PEN_alternate
;
60 physDev
->pen
.dash
= NULL
;
63 if ((physDev
->pen
.width
> 1) && (physDev
->pen
.dash
!= NULL
)) {
64 physDev
->pen
.style
= PS_SOLID
;
65 physDev
->pen
.dash
= NULL
;
68 physDev
->pen
.set
= FALSE
;
73 /**********************************************************************
78 BOOL
PSDRV_SetPen(DC
*dc
)
80 PSDRV_PDEVICE
*physDev
= (PSDRV_PDEVICE
*)dc
->physDev
;
82 if (physDev
->pen
.style
!= PS_NULL
) {
83 PSDRV_WriteSetColor(dc
, &physDev
->pen
.color
);
85 if(!physDev
->pen
.set
) {
86 PSDRV_WriteSetPen(dc
);
87 physDev
->pen
.set
= TRUE
;