Large-scale renaming of all Win32 functions and types to use the
[wine/hacks.git] / objects / pen.c
blob21578f157b305449d798757032a0d983e07b74f0
1 /*
2 * GDI pen objects
4 * Copyright 1993 Alexandre Julliard
5 */
7 #include "pen.h"
8 #include "debug.h"
12 /***********************************************************************
13 * CreatePen16 (GDI.61)
15 HPEN16 WINAPI CreatePen16( INT16 style, INT16 width, COLORREF color )
17 LOGPEN logpen = { style, { width, 0 }, color };
18 TRACE(gdi, "%d %d %06lx\n", style, width, color );
19 return CreatePenIndirect( &logpen );
23 /***********************************************************************
24 * CreatePen32 (GDI32.55)
26 HPEN WINAPI CreatePen( INT style, INT width, COLORREF color )
28 LOGPEN logpen = { style, { width, 0 }, color };
29 TRACE(gdi, "%d %d %06lx\n", style, width, color );
30 return CreatePenIndirect( &logpen );
34 /***********************************************************************
35 * CreatePenIndirect16 (GDI.62)
37 HPEN16 WINAPI CreatePenIndirect16( const LOGPEN16 * pen )
39 PENOBJ * penPtr;
40 HPEN16 hpen;
42 if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
43 hpen = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC );
44 if (!hpen) return 0;
45 penPtr = (PENOBJ *)GDI_HEAP_LOCK( hpen );
46 penPtr->logpen.lopnStyle = pen->lopnStyle;
47 penPtr->logpen.lopnColor = pen->lopnColor;
48 CONV_POINT16TO32( &pen->lopnWidth, &penPtr->logpen.lopnWidth );
49 GDI_HEAP_UNLOCK( hpen );
50 return hpen;
54 /***********************************************************************
55 * CreatePenIndirect32 (GDI32.56)
57 HPEN WINAPI CreatePenIndirect( const LOGPEN * pen )
59 PENOBJ * penPtr;
60 HPEN hpen;
62 if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
63 hpen = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC );
64 if (!hpen) return 0;
65 penPtr = (PENOBJ *)GDI_HEAP_LOCK( hpen );
66 penPtr->logpen.lopnStyle = pen->lopnStyle;
67 penPtr->logpen.lopnWidth = pen->lopnWidth;
68 penPtr->logpen.lopnColor = pen->lopnColor;
69 GDI_HEAP_UNLOCK( hpen );
70 return hpen;
73 /***********************************************************************
74 * ExtCreatePen32 (GDI32.93)
76 * FIXME: PS_USERSTYLE not handled
79 HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
80 const LOGBRUSH * brush, DWORD style_count,
81 const DWORD *style_bits )
83 LOGPEN logpen;
85 if ((style & PS_STYLE_MASK) == PS_USERSTYLE)
86 FIXME(gdi, "PS_USERSTYLE not handled\n");
87 if ((style & PS_TYPE_MASK) == PS_GEOMETRIC)
88 if (brush->lbHatch)
89 FIXME(gdi, "Hatches not implemented\n");
91 logpen.lopnStyle = style & ~PS_TYPE_MASK;
92 logpen.lopnWidth.x = (style & PS_GEOMETRIC) ? width : 1;
93 logpen.lopnWidth.y = 0;
94 logpen.lopnColor = brush->lbColor;
95 return CreatePenIndirect( &logpen );
98 /***********************************************************************
99 * PEN_GetObject16
101 INT16 PEN_GetObject16( PENOBJ * pen, INT16 count, LPSTR buffer )
103 LOGPEN16 logpen;
104 logpen.lopnStyle = pen->logpen.lopnStyle;
105 logpen.lopnColor = pen->logpen.lopnColor;
106 CONV_POINT32TO16( &pen->logpen.lopnWidth, &logpen.lopnWidth );
107 if (count > sizeof(logpen)) count = sizeof(logpen);
108 memcpy( buffer, &logpen, count );
109 return count;
113 /***********************************************************************
114 * PEN_GetObject32
116 INT PEN_GetObject( PENOBJ * pen, INT count, LPSTR buffer )
118 if (count > sizeof(pen->logpen)) count = sizeof(pen->logpen);
119 memcpy( buffer, &pen->logpen, count );
120 return count;