Release 981025.
[wine/multimedia.git] / graphics / x11drv / pen.c
blob52510753863587ca9d4e38e7486c436ca3c21053
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.type = pen->logpen.lopnStyle & PS_TYPE_MASK;
27 dc->u.x.pen.endcap = pen->logpen.lopnStyle & PS_ENDCAP_MASK;
28 dc->u.x.pen.linejoin = pen->logpen.lopnStyle & PS_JOIN_MASK;
30 dc->u.x.pen.width = (pen->logpen.lopnWidth.x * dc->vportExtX +
31 dc->wndExtX / 2) / dc->wndExtX;
32 if (dc->u.x.pen.width < 0) dc->u.x.pen.width = -dc->u.x.pen.width;
33 if (dc->u.x.pen.width == 1) dc->u.x.pen.width = 0; /* Faster */
34 dc->u.x.pen.pixel = COLOR_ToPhysical( dc, pen->logpen.lopnColor );
35 switch(pen->logpen.lopnStyle & PS_STYLE_MASK)
37 case PS_DASH:
38 dc->u.x.pen.dashes = (char *)PEN_dash;
39 dc->u.x.pen.dash_len = 2;
40 break;
41 case PS_DOT:
42 dc->u.x.pen.dashes = (char *)PEN_dot;
43 dc->u.x.pen.dash_len = 2;
44 break;
45 case PS_DASHDOT:
46 dc->u.x.pen.dashes = (char *)PEN_dashdot;
47 dc->u.x.pen.dash_len = 4;
48 break;
49 case PS_DASHDOTDOT:
50 dc->u.x.pen.dashes = (char *)PEN_dashdotdot;
51 dc->u.x.pen.dash_len = 6;
52 break;
53 case PS_ALTERNATE:
54 /* FIXME: should be alternating _pixels_ that are set */
55 dc->u.x.pen.dashes = (char *)PEN_alternate;
56 dc->u.x.pen.dash_len = 2;
57 break;
58 case PS_USERSTYLE:
59 /* FIXME */
60 break;
63 return prevHandle;