graphics/psdrv forgets to pull in @DLLFLAGS@, and so is compiled non-PIC if
[wine/multimedia.git] / objects / pen.c
bloba4825ad8600d8d07f8c4a71dddb874c747e2f8d3
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 LOGPEN32 logpen = { style, { width, 0 }, color };
18 TRACE(gdi, "%d %d %06lx\n", style, width, color );
19 return CreatePenIndirect32( &logpen );
23 /***********************************************************************
24 * CreatePen32 (GDI32.55)
26 HPEN32 WINAPI CreatePen32( INT32 style, INT32 width, COLORREF color )
28 LOGPEN32 logpen = { style, { width, 0 }, color };
29 TRACE(gdi, "%d %d %06lx\n", style, width, color );
30 return CreatePenIndirect32( &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 HPEN32 WINAPI CreatePenIndirect32( const LOGPEN32 * pen )
59 PENOBJ * penPtr;
60 HPEN32 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 HPEN32 WINAPI ExtCreatePen32( DWORD style, DWORD width,
80 const LOGBRUSH32 * brush, DWORD style_count,
81 const DWORD *style_bits )
83 LOGPEN32 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 CreatePenIndirect32( &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 INT32 PEN_GetObject32( PENOBJ * pen, INT32 count, LPSTR buffer )
118 if (count > sizeof(pen->logpen)) count = sizeof(pen->logpen);
119 memcpy( buffer, &pen->logpen, count );
120 return count;