~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/winex11.drv/pen.c

Version: ~ [ wine-1.5.30 ] ~ [ wine-1.5.29 ] ~ [ wine-1.5.28 ] ~ [ wine-1.5.27 ] ~ [ wine-1.5.26 ] ~ [ wine-1.5.25 ] ~ [ wine-1.5.24 ] ~ [ wine-1.5.23 ] ~ [ wine-1.5.22 ] ~ [ wine-1.5.21 ] ~ [ wine-1.5.20 ] ~ [ wine-1.5.19 ] ~ [ wine-1.5.18 ] ~ [ wine-1.5.17 ] ~ [ wine-1.5.16 ] ~ [ wine-1.5.15 ] ~ [ wine-1.5.14 ] ~ [ wine-1.5.13 ] ~ [ wine-1.5.12 ] ~ [ wine-1.5.11 ] ~ [ wine-1.5.10 ] ~ [ wine-1.5.9 ] ~ [ wine-1.5.8 ] ~ [ wine-1.5.7 ] ~ [ wine-1.4.1 ] ~ [ wine-1.5.6 ] ~ [ wine-1.5.5 ] ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * X11DRV pen objects
  3  *
  4  * Copyright 1993 Alexandre Julliard
  5  *
  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.
 10  *
 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.
 15  *
 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #include "config.h"
 22 
 23 #include "x11drv.h"
 24 #include "wine/debug.h"
 25 
 26 WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
 27 
 28 /***********************************************************************
 29  *           SelectPen   (X11DRV.@)
 30  */
 31 HPEN CDECL X11DRV_SelectPen( X11DRV_PDEVICE *physDev, HPEN hpen )
 32 {
 33     static const char PEN_dash[]          = { 16,8 };
 34     static const char PEN_dot[]           = { 4,4 };
 35     static const char PEN_dashdot[]       = { 12,8,4,8 };
 36     static const char PEN_dashdotdot[]    = { 12,4,4,4,4,4 };
 37     static const char PEN_alternate[]     = { 1,1 };
 38     static const char EXTPEN_dash[]       = { 3,1 };
 39     static const char EXTPEN_dot[]        = { 1,1 };
 40     static const char EXTPEN_dashdot[]    = { 3,1,1,1 };
 41     static const char EXTPEN_dashdotdot[] = { 3,1,1,1,1,1 };
 42     LOGPEN logpen;
 43     int i;
 44 
 45     if (!GetObjectW( hpen, sizeof(logpen), &logpen ))
 46     {
 47         /* must be an extended pen */
 48         EXTLOGPEN *elp;
 49         INT size = GetObjectW( hpen, 0, NULL );
 50 
 51         if (!size) return 0;
 52 
 53         physDev->pen.ext = 1;
 54         elp = HeapAlloc( GetProcessHeap(), 0, size );
 55 
 56         GetObjectW( hpen, size, elp );
 57         /* FIXME: add support for user style pens */
 58         logpen.lopnStyle = elp->elpPenStyle;
 59         logpen.lopnWidth.x = elp->elpWidth;
 60         logpen.lopnWidth.y = 0;
 61         logpen.lopnColor = elp->elpColor;
 62 
 63         HeapFree( GetProcessHeap(), 0, elp );
 64     }
 65     else
 66         physDev->pen.ext = 0;
 67 
 68     physDev->pen.style = logpen.lopnStyle & PS_STYLE_MASK;
 69     physDev->pen.type = logpen.lopnStyle & PS_TYPE_MASK;
 70     physDev->pen.endcap = logpen.lopnStyle & PS_ENDCAP_MASK;
 71     physDev->pen.linejoin = logpen.lopnStyle & PS_JOIN_MASK;
 72 
 73     physDev->pen.width = logpen.lopnWidth.x;
 74     if ((logpen.lopnStyle & PS_GEOMETRIC) || (physDev->pen.width >= 1))
 75     {
 76         physDev->pen.width = X11DRV_XWStoDS( physDev, physDev->pen.width );
 77         if (physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width;
 78     }
 79 
 80     if (physDev->pen.width == 1) physDev->pen.width = 0;  /* Faster */
 81     if (hpen == GetStockObject( DC_PEN ))
 82         logpen.lopnColor = GetDCPenColor( physDev->hdc );
 83     physDev->pen.pixel = X11DRV_PALETTE_ToPhysical( physDev, logpen.lopnColor );
 84     switch(logpen.lopnStyle & PS_STYLE_MASK)
 85     {
 86       case PS_DASH:
 87             physDev->pen.dash_len = sizeof(PEN_dash)/sizeof(*PEN_dash);
 88             memcpy(physDev->pen.dashes, physDev->pen.ext ? EXTPEN_dash : PEN_dash,
 89                    physDev->pen.dash_len);
 90             break;
 91       case PS_DOT:
 92             physDev->pen.dash_len = sizeof(PEN_dot)/sizeof(*PEN_dot);
 93             memcpy(physDev->pen.dashes, physDev->pen.ext ? EXTPEN_dot : PEN_dot,
 94                    physDev->pen.dash_len);
 95             break;
 96       case PS_DASHDOT:
 97             physDev->pen.dash_len = sizeof(PEN_dashdot)/sizeof(*PEN_dashdot);
 98             memcpy(physDev->pen.dashes, physDev->pen.ext ? EXTPEN_dashdot : PEN_dashdot,
 99                    physDev->pen.dash_len);
100             break;
101       case PS_DASHDOTDOT:
102             physDev->pen.dash_len = sizeof(PEN_dashdotdot)/sizeof(*PEN_dashdotdot);
103             memcpy(physDev->pen.dashes, physDev->pen.ext ? EXTPEN_dashdotdot : PEN_dashdotdot,
104                    physDev->pen.dash_len);
105             break;
106       case PS_ALTERNATE:
107             physDev->pen.dash_len = sizeof(PEN_alternate)/sizeof(*PEN_alternate);
108             memcpy(physDev->pen.dashes, PEN_alternate, physDev->pen.dash_len);
109             break;
110       case PS_USERSTYLE:
111         FIXME("PS_USERSTYLE is not supported\n");
112         /* fall through */
113       default:
114         physDev->pen.dash_len = 0;
115         break;
116     }
117     if(physDev->pen.ext && physDev->pen.dash_len &&
118         (logpen.lopnStyle & PS_STYLE_MASK) != PS_ALTERNATE)
119         for(i = 0; i < physDev->pen.dash_len; i++)
120             physDev->pen.dashes[i] *= (physDev->pen.width ? physDev->pen.width : 1);
121 
122     return hpen;
123 }
124 
125 
126 /***********************************************************************
127  *           SetDCPenColor (X11DRV.@)
128  */
129 COLORREF CDECL X11DRV_SetDCPenColor( X11DRV_PDEVICE *physDev, COLORREF crColor )
130 {
131     if (GetCurrentObject(physDev->hdc, OBJ_PEN) == GetStockObject( DC_PEN ))
132         physDev->pen.pixel = X11DRV_PALETTE_ToPhysical( physDev, crColor );
133 
134     return crColor;
135 }
136 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.