Release 980301
[wine/hacks.git] / graphics / x11drv / pen.c
bloba918c8511aeafccc08cc16534341815282bf6192
1 /*
2 * GDI pen objects
4 * Copyright 1993 Alexandre Julliard
5 */
7 #include "pen.h"
8 #include "color.h"
9 #include "debug.h"
11 static const char PEN_dash[] = { 5,3 }; /* ----- ----- ----- */
12 static const char PEN_dot[] = { 1,1 }; /* -- -- -- -- -- -- */
13 static const char PEN_dashdot[] = { 4,3,2,3 }; /* ---- -- ---- -- */
14 static const char PEN_dashdotdot[] = { 4,2,2,2,2,2 }; /* ---- -- -- ---- */
15 static const char PEN_alternate[] = { 1,1 }; /* FIXME */
17 /***********************************************************************
18 * PEN_SelectObject
20 HPEN32 X11DRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen )
22 HPEN32 prevHandle = dc->w.hPen;
24 dc->w.hPen = hpen;
25 dc->u.x.pen.style = pen->logpen.lopnStyle & PS_STYLE_MASK;
26 dc->u.x.pen.endcap = pen->logpen.lopnStyle & PS_ENDCAP_MASK;
27 dc->u.x.pen.linejoin = pen->logpen.lopnStyle & PS_JOIN_MASK;
29 dc->u.x.pen.width = pen->logpen.lopnWidth.x * dc->vportExtX / dc->wndExtX;
30 if (dc->u.x.pen.width < 0) dc->u.x.pen.width = -dc->u.x.pen.width;
31 if (dc->u.x.pen.width == 1) dc->u.x.pen.width = 0; /* Faster */
32 dc->u.x.pen.pixel = COLOR_ToPhysical( dc, pen->logpen.lopnColor );
33 switch(pen->logpen.lopnStyle & PS_STYLE_MASK)
35 case PS_DASH:
36 dc->u.x.pen.dashes = (char *)PEN_dash;
37 dc->u.x.pen.dash_len = 2;
38 break;
39 case PS_DOT:
40 dc->u.x.pen.dashes = (char *)PEN_dot;
41 dc->u.x.pen.dash_len = 2;
42 break;
43 case PS_DASHDOT:
44 dc->u.x.pen.dashes = (char *)PEN_dashdot;
45 dc->u.x.pen.dash_len = 4;
46 break;
47 case PS_DASHDOTDOT:
48 dc->u.x.pen.dashes = (char *)PEN_dashdotdot;
49 dc->u.x.pen.dash_len = 6;
50 break;
51 case PS_ALTERNATE:
52 /* FIXME: should be alternating _pixels_ that are set */
53 dc->u.x.pen.dashes = (char *)PEN_alternate;
54 dc->u.x.pen.dash_len = 2;
55 break;
56 case PS_USERSTYLE:
57 /* FIXME */
58 break;
61 return prevHandle;