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
28 #include "wine/wingdi16.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
37 /***********************************************************************
40 HPEN16 WINAPI CreatePen16( INT16 style, INT16 width, COLORREF color )
44 TRACE("%d %d %06lx\n", style, width, color );
46 logpen.lopnStyle = style;
47 logpen.lopnWidth.x = width;
48 logpen.lopnWidth.y = 0;
49 logpen.lopnColor = color;
51 return CreatePenIndirect( &logpen );
55 /***********************************************************************
58 HPEN WINAPI CreatePen( INT style, INT width, COLORREF color )
62 TRACE("%d %d %06lx\n", style, width, color );
64 logpen.lopnStyle = style;
65 logpen.lopnWidth.x = width;
66 logpen.lopnWidth.y = 0;
67 logpen.lopnColor = color;
69 return CreatePenIndirect( &logpen );
73 /***********************************************************************
74 * CreatePenIndirect (GDI.62)
76 HPEN16 WINAPI CreatePenIndirect16( const LOGPEN16 * pen )
81 if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
82 if (!(penPtr = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC, &hpen ))) return 0;
83 penPtr->logpen.lopnStyle = pen->lopnStyle;
84 penPtr->logpen.lopnColor = pen->lopnColor;
85 CONV_POINT16TO32( &pen->lopnWidth, &penPtr->logpen.lopnWidth );
86 GDI_ReleaseObj( hpen );
91 /***********************************************************************
92 * CreatePenIndirect (GDI32.@)
94 HPEN WINAPI CreatePenIndirect( const LOGPEN * pen )
99 if (!(penPtr = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC, &hpen ))) return 0;
100 penPtr->logpen.lopnStyle = pen->lopnStyle;
101 penPtr->logpen.lopnWidth = pen->lopnWidth;
102 penPtr->logpen.lopnColor = pen->lopnColor;
103 GDI_ReleaseObj( hpen );
107 /***********************************************************************
108 * ExtCreatePen (GDI32.@)
110 * FIXME: PS_USERSTYLE not handled
113 HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
114 const LOGBRUSH * brush, DWORD style_count,
115 const DWORD *style_bits )
120 if ((style & PS_STYLE_MASK) == PS_USERSTYLE)
121 FIXME("PS_USERSTYLE not handled\n");
122 if ((style & PS_TYPE_MASK) == PS_GEOMETRIC)
124 FIXME("Hatches not implemented\n");
126 if (!(penPtr = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC, &hpen ))) return 0;
127 penPtr->logpen.lopnStyle = style & ~PS_TYPE_MASK;
129 /* PS_USERSTYLE workaround */
130 if((penPtr->logpen.lopnStyle & PS_STYLE_MASK) == PS_USERSTYLE)
131 penPtr->logpen.lopnStyle =
132 (penPtr->logpen.lopnStyle & ~PS_STYLE_MASK) | PS_SOLID;
134 penPtr->logpen.lopnWidth.x = (style & PS_GEOMETRIC) ? width : 1;
135 penPtr->logpen.lopnWidth.y = 0;
136 penPtr->logpen.lopnColor = brush->lbColor;
137 GDI_ReleaseObj( hpen );
142 /***********************************************************************
145 INT16 PEN_GetObject16( PENOBJ * pen, INT16 count, LPSTR buffer )
148 logpen.lopnStyle = pen->logpen.lopnStyle;
149 logpen.lopnColor = pen->logpen.lopnColor;
150 CONV_POINT32TO16( &pen->logpen.lopnWidth, &logpen.lopnWidth );
151 if (count > sizeof(logpen)) count = sizeof(logpen);
152 memcpy( buffer, &logpen, count );
157 /***********************************************************************
160 INT PEN_GetObject( PENOBJ * pen, INT count, LPSTR buffer )
162 if (count > sizeof(pen->logpen)) count = sizeof(pen->logpen);
163 memcpy( buffer, &pen->logpen, count );