4 * Copyright 1993 Alexandre Julliard
14 /***********************************************************************
15 * CreatePen16 (GDI.61)
17 HPEN16 WINAPI
CreatePen16( INT16 style
, INT16 width
, COLORREF color
)
19 LOGPEN32 logpen
= { style
, { width
, 0 }, color
};
20 TRACE(gdi
, "%d %d %06lx\n", style
, width
, color
);
21 return CreatePenIndirect32( &logpen
);
25 /***********************************************************************
26 * CreatePen32 (GDI32.55)
28 HPEN32 WINAPI
CreatePen32( INT32 style
, INT32 width
, COLORREF color
)
30 LOGPEN32 logpen
= { style
, { width
, 0 }, color
};
31 TRACE(gdi
, "%d %d %06lx\n", style
, width
, color
);
32 return CreatePenIndirect32( &logpen
);
36 /***********************************************************************
37 * CreatePenIndirect16 (GDI.62)
39 HPEN16 WINAPI
CreatePenIndirect16( const LOGPEN16
* pen
)
44 if (pen
->lopnStyle
> PS_INSIDEFRAME
) return 0;
45 hpen
= GDI_AllocObject( sizeof(PENOBJ
), PEN_MAGIC
);
47 penPtr
= (PENOBJ
*)GDI_HEAP_LOCK( hpen
);
48 penPtr
->logpen
.lopnStyle
= pen
->lopnStyle
;
49 penPtr
->logpen
.lopnColor
= pen
->lopnColor
;
50 CONV_POINT16TO32( &pen
->lopnWidth
, &penPtr
->logpen
.lopnWidth
);
51 GDI_HEAP_UNLOCK( hpen
);
56 /***********************************************************************
57 * CreatePenIndirect32 (GDI32.56)
59 HPEN32 WINAPI
CreatePenIndirect32( const LOGPEN32
* pen
)
64 if (pen
->lopnStyle
> PS_INSIDEFRAME
) return 0;
65 hpen
= GDI_AllocObject( sizeof(PENOBJ
), PEN_MAGIC
);
67 penPtr
= (PENOBJ
*)GDI_HEAP_LOCK( hpen
);
68 penPtr
->logpen
.lopnStyle
= pen
->lopnStyle
;
69 penPtr
->logpen
.lopnWidth
= pen
->lopnWidth
;
70 penPtr
->logpen
.lopnColor
= pen
->lopnColor
;
71 GDI_HEAP_UNLOCK( hpen
);
75 /***********************************************************************
76 * ExtCreatePen32 (GDI32.93)
78 * FIXME: PS_USERSTYLE not handled
81 HPEN32 WINAPI
ExtCreatePen32( DWORD style
, DWORD width
,
82 const LOGBRUSH32
* brush
, DWORD style_count
,
83 const DWORD
*style_bits
)
87 if ((style
& PS_STYLE_MASK
) == PS_USERSTYLE
)
88 FIXME(gdi
, "PS_USERSTYLE not handled\n");
89 if ((style
& PS_TYPE_MASK
) == PS_GEOMETRIC
)
91 FIXME(gdi
, "Hatches not implemented\n");
93 logpen
.lopnStyle
= style
& ~PS_TYPE_MASK
;
94 logpen
.lopnWidth
.x
= (style
& PS_GEOMETRIC
) ? width
: 1;
95 logpen
.lopnWidth
.y
= 0;
96 logpen
.lopnColor
= brush
->lbColor
;
97 return CreatePenIndirect32( &logpen
);
100 /***********************************************************************
103 INT16
PEN_GetObject16( PENOBJ
* pen
, INT16 count
, LPSTR buffer
)
106 logpen
.lopnStyle
= pen
->logpen
.lopnStyle
;
107 logpen
.lopnColor
= pen
->logpen
.lopnColor
;
108 CONV_POINT32TO16( &pen
->logpen
.lopnWidth
, &logpen
.lopnWidth
);
109 if (count
> sizeof(logpen
)) count
= sizeof(logpen
);
110 memcpy( buffer
, &logpen
, count
);
115 /***********************************************************************
118 INT32
PEN_GetObject32( PENOBJ
* pen
, INT32 count
, LPSTR buffer
)
120 if (count
> sizeof(pen
->logpen
)) count
= sizeof(pen
->logpen
);
121 memcpy( buffer
, &pen
->logpen
, count
);