4 * Copyright 1993 Alexandre Julliard
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
)
42 if (pen
->lopnStyle
> PS_INSIDEFRAME
) return 0;
43 hpen
= GDI_AllocObject( sizeof(PENOBJ
), PEN_MAGIC
);
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
);
54 /***********************************************************************
55 * CreatePenIndirect32 (GDI32.56)
57 HPEN32 WINAPI
CreatePenIndirect32( const LOGPEN32
* pen
)
62 if (pen
->lopnStyle
> PS_INSIDEFRAME
) return 0;
63 hpen
= GDI_AllocObject( sizeof(PENOBJ
), PEN_MAGIC
);
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
);
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
)
85 if ((style
& PS_STYLE_MASK
) == PS_USERSTYLE
)
86 FIXME(gdi
, "PS_USERSTYLE not handled\n");
87 if ((style
& PS_TYPE_MASK
) == PS_GEOMETRIC
)
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 /***********************************************************************
101 INT16
PEN_GetObject16( PENOBJ
* pen
, INT16 count
, LPSTR buffer
)
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
);
113 /***********************************************************************
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
);