4 * Copyright 1993 Alexandre Julliard
13 #include "metafiledrv.h"
18 /***********************************************************************
19 * MFDRV_BITMAP_SelectObject
21 static HBITMAP16
MFDRV_BITMAP_SelectObject( DC
* dc
, HBITMAP16 hbitmap
,
28 /***********************************************************************
29 * MFDRV_BRUSH_SelectObject
31 static HBRUSH32
MFDRV_BRUSH_SelectObject( DC
* dc
, HBRUSH32 hbrush
,
34 LOGBRUSH16 logbrush
= { brush
->logbrush
.lbStyle
,
35 brush
->logbrush
.lbColor
,
36 brush
->logbrush
.lbHatch
};
37 switch (brush
->logbrush
.lbStyle
)
42 if (!MF_CreateBrushIndirect( dc
, hbrush
, &logbrush
)) return 0;
46 if (!MF_CreatePatternBrush( dc
, hbrush
, &logbrush
)) return 0;
49 return 1; /* FIXME? */
53 /***********************************************************************
54 * MFDRV_FONT_SelectObject
56 static HFONT16
MFDRV_FONT_SelectObject( DC
* dc
, HFONT16 hfont
,
59 HFONT16 prevHandle
= dc
->w
.hFont
;
60 if (MF_CreateFontIndirect(dc
, hfont
, &(font
->logfont
))) return prevHandle
;
65 /***********************************************************************
66 * MFDRV_PEN_SelectObject
68 static HPEN32
MFDRV_PEN_SelectObject( DC
* dc
, HPEN32 hpen
, PENOBJ
* pen
)
70 HPEN32 prevHandle
= dc
->w
.hPen
;
71 LOGPEN16 logpen
= { pen
->logpen
.lopnStyle
,
72 { pen
->logpen
.lopnWidth
.x
, pen
->logpen
.lopnWidth
.y
},
73 pen
->logpen
.lopnColor
};
74 if (MF_CreatePenIndirect( dc
, hpen
, &logpen
)) return prevHandle
;
79 /***********************************************************************
82 HGDIOBJ32
MFDRV_SelectObject( DC
*dc
, HGDIOBJ32 handle
)
84 GDIOBJHDR
* ptr
= GDI_GetObjPtr( handle
, MAGIC_DONTCARE
);
88 TRACE(gdi
, "hdc=%04x %04x\n", dc
->hSelf
, handle
);
93 ret
= MFDRV_PEN_SelectObject( dc
, handle
, (PENOBJ
*)ptr
);
96 ret
= MFDRV_BRUSH_SelectObject( dc
, handle
, (BRUSHOBJ
*)ptr
);
99 ret
= MFDRV_BITMAP_SelectObject( dc
, handle
, (BITMAPOBJ
*)ptr
);
102 ret
= MFDRV_FONT_SelectObject( dc
, handle
, (FONTOBJ
*)ptr
);
105 ret
= (HGDIOBJ16
)SelectClipRgn16( dc
->hSelf
, handle
);
108 GDI_HEAP_UNLOCK( handle
);