Implemented BitBlt, StretchBlt and SetDIBitsToDevice EMF driver
[wine/gsoc_dplay.git] / graphics / x11drv / pen.c
blob140d78f2112773a5c0c7b67adc90533f3e6aee5c
1 /*
2 * X11DRV pen objects
4 * Copyright 1993 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
23 #include "x11drv.h"
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
28 static const char PEN_dash[] = { 16,8 };
29 static const char PEN_dot[] = { 4,4 };
30 static const char PEN_dashdot[] = { 12,8,4,8 };
31 static const char PEN_dashdotdot[] = { 12,4,4,4,4,4 };
32 static const char PEN_alternate[] = { 1,1 };
34 /***********************************************************************
35 * SelectPen (X11DRV.@)
37 HPEN X11DRV_SelectPen( X11DRV_PDEVICE *physDev, HPEN hpen )
39 LOGPEN logpen;
40 DC *dc = physDev->dc;
42 if (!GetObjectA( hpen, sizeof(logpen), &logpen )) return 0;
44 physDev->pen.style = logpen.lopnStyle & PS_STYLE_MASK;
45 physDev->pen.type = logpen.lopnStyle & PS_TYPE_MASK;
46 physDev->pen.endcap = logpen.lopnStyle & PS_ENDCAP_MASK;
47 physDev->pen.linejoin = logpen.lopnStyle & PS_JOIN_MASK;
49 physDev->pen.width = GDI_ROUND((FLOAT)logpen.lopnWidth.x *
50 dc->xformWorld2Vport.eM11);
51 if (physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width;
52 if (physDev->pen.width == 1) physDev->pen.width = 0; /* Faster */
53 physDev->pen.pixel = X11DRV_PALETTE_ToPhysical( physDev, logpen.lopnColor );
54 switch(logpen.lopnStyle & PS_STYLE_MASK)
56 case PS_DASH:
57 physDev->pen.dashes = (char *)PEN_dash;
58 physDev->pen.dash_len = sizeof(PEN_dash)/sizeof(*PEN_dash);
59 break;
60 case PS_DOT:
61 physDev->pen.dashes = (char *)PEN_dot;
62 physDev->pen.dash_len = sizeof(PEN_dot)/sizeof(*PEN_dot);
63 break;
64 case PS_DASHDOT:
65 physDev->pen.dashes = (char *)PEN_dashdot;
66 physDev->pen.dash_len = sizeof(PEN_dashdot)/sizeof(*PEN_dashdot);
67 break;
68 case PS_DASHDOTDOT:
69 physDev->pen.dashes = (char *)PEN_dashdotdot;
70 physDev->pen.dash_len = sizeof(PEN_dashdotdot)/sizeof(*PEN_dashdotdot);
71 break;
72 case PS_ALTERNATE:
73 physDev->pen.dashes = (char *)PEN_alternate;
74 physDev->pen.dash_len = sizeof(PEN_alternate)/sizeof(*PEN_alternate);
75 break;
76 case PS_USERSTYLE:
77 FIXME("PS_USERSTYLE is not supported\n");
78 break;
80 return hpen;