Release 971221
[wine/multimedia.git] / graphics / x11drv / pen.c
blob3a424cf7d161daed6cebf628b969e3c59de1aacb
1 /*
2 * GDI pen objects
4 * Copyright 1993 Alexandre Julliard
5 */
7 #include "pen.h"
8 #include "color.h"
9 #include "stddebug.h"
10 #include "debug.h"
12 static const char PEN_dash[] = { 5,3 }; /* ----- ----- ----- */
13 static const char PEN_dot[] = { 1,1 }; /* -- -- -- -- -- -- */
14 static const char PEN_dashdot[] = { 4,3,2,3 }; /* ---- -- ---- -- */
15 static const char PEN_dashdotdot[] = { 4,2,2,2,2,2 }; /* ---- -- -- ---- */
16 static const char PEN_alternate[] = { 1,1 }; /* FIXME */
18 /***********************************************************************
19 * PEN_SelectObject
21 HPEN32 X11DRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen )
23 HPEN32 prevHandle = dc->w.hPen;
25 dc->w.hPen = hpen;
26 dc->u.x.pen.style = pen->logpen.lopnStyle & PS_STYLE_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 / dc->wndExtX;
31 if (dc->u.x.pen.width < 0) dc->u.x.pen.width = -dc->u.x.pen.width;
32 if (dc->u.x.pen.width == 1) dc->u.x.pen.width = 0; /* Faster */
33 dc->u.x.pen.pixel = COLOR_ToPhysical( dc, pen->logpen.lopnColor );
34 switch(pen->logpen.lopnStyle & PS_STYLE_MASK)
36 case PS_DASH:
37 dc->u.x.pen.dashes = (char *)PEN_dash;
38 dc->u.x.pen.dash_len = 2;
39 break;
40 case PS_DOT:
41 dc->u.x.pen.dashes = (char *)PEN_dot;
42 dc->u.x.pen.dash_len = 2;
43 break;
44 case PS_DASHDOT:
45 dc->u.x.pen.dashes = (char *)PEN_dashdot;
46 dc->u.x.pen.dash_len = 4;
47 break;
48 case PS_DASHDOTDOT:
49 dc->u.x.pen.dashes = (char *)PEN_dashdotdot;
50 dc->u.x.pen.dash_len = 6;
51 break;
52 case PS_ALTERNATE:
53 /* FIXME: should be alternating _pixels_ that are set */
54 dc->u.x.pen.dashes = (char *)PEN_alternate;
55 dc->u.x.pen.dash_len = 2;
56 break;
57 case PS_USERSTYLE:
58 /* FIXME */
59 break;
62 return prevHandle;