4 * Copyright 1993 Alexandre Julliard
14 #include "wine/wingdi16.h"
17 #include "debugtools.h"
19 DEFAULT_DEBUG_CHANNEL(gdi);
23 /***********************************************************************
26 HPEN16 WINAPI CreatePen16( INT16 style, INT16 width, COLORREF color )
30 TRACE("%d %d %06lx\n", style, width, color );
32 logpen.lopnStyle = style;
33 logpen.lopnWidth.x = width;
34 logpen.lopnWidth.y = 0;
35 logpen.lopnColor = color;
37 return CreatePenIndirect( &logpen );
41 /***********************************************************************
44 HPEN WINAPI CreatePen( INT style, INT width, COLORREF color )
48 TRACE("%d %d %06lx\n", style, width, color );
50 logpen.lopnStyle = style;
51 logpen.lopnWidth.x = width;
52 logpen.lopnWidth.y = 0;
53 logpen.lopnColor = color;
55 return CreatePenIndirect( &logpen );
59 /***********************************************************************
60 * CreatePenIndirect (GDI.62)
62 HPEN16 WINAPI CreatePenIndirect16( const LOGPEN16 * pen )
67 if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
68 if (!(penPtr = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC, &hpen ))) return 0;
69 penPtr->logpen.lopnStyle = pen->lopnStyle;
70 penPtr->logpen.lopnColor = pen->lopnColor;
71 CONV_POINT16TO32( &pen->lopnWidth, &penPtr->logpen.lopnWidth );
72 GDI_ReleaseObj( hpen );
77 /***********************************************************************
78 * CreatePenIndirect (GDI32.@)
80 HPEN WINAPI CreatePenIndirect( const LOGPEN * pen )
85 if (!(penPtr = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC, &hpen ))) return 0;
86 penPtr->logpen.lopnStyle = pen->lopnStyle;
87 penPtr->logpen.lopnWidth = pen->lopnWidth;
88 penPtr->logpen.lopnColor = pen->lopnColor;
89 GDI_ReleaseObj( hpen );
93 /***********************************************************************
94 * ExtCreatePen (GDI32.@)
96 * FIXME: PS_USERSTYLE not handled
99 HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
100 const LOGBRUSH * brush, DWORD style_count,
101 const DWORD *style_bits )
106 if ((style & PS_STYLE_MASK) == PS_USERSTYLE)
107 FIXME("PS_USERSTYLE not handled\n");
108 if ((style & PS_TYPE_MASK) == PS_GEOMETRIC)
110 FIXME("Hatches not implemented\n");
112 if (!(penPtr = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC, &hpen ))) return 0;
113 penPtr->logpen.lopnStyle = style & ~PS_TYPE_MASK;
115 /* PS_USERSTYLE workaround */
116 if((penPtr->logpen.lopnStyle & PS_STYLE_MASK) == PS_USERSTYLE)
117 penPtr->logpen.lopnStyle =
118 (penPtr->logpen.lopnStyle & ~PS_STYLE_MASK) | PS_SOLID;
120 penPtr->logpen.lopnWidth.x = (style & PS_GEOMETRIC) ? width : 1;
121 penPtr->logpen.lopnWidth.y = 0;
122 penPtr->logpen.lopnColor = brush->lbColor;
123 GDI_ReleaseObj( hpen );
128 /***********************************************************************
131 INT16 PEN_GetObject16( PENOBJ * pen, INT16 count, LPSTR buffer )
134 logpen.lopnStyle = pen->logpen.lopnStyle;
135 logpen.lopnColor = pen->logpen.lopnColor;
136 CONV_POINT32TO16( &pen->logpen.lopnWidth, &logpen.lopnWidth );
137 if (count > sizeof(logpen)) count = sizeof(logpen);
138 memcpy( buffer, &logpen, count );
143 /***********************************************************************
146 INT PEN_GetObject( PENOBJ * pen, INT count, LPSTR buffer )
148 if (count > sizeof(pen->logpen)) count = sizeof(pen->logpen);
149 memcpy( buffer, &pen->logpen, count );