Added all clipper&3d stubs.
[wine/multimedia.git] / graphics / metafiledrv / objects.c
blob6488df84ff72550c788dac177e625f939672bd19
1 /*
2 * GDI objects
4 * Copyright 1993 Alexandre Julliard
5 */
7 #include <stdlib.h>
8 #include <stdio.h>
9 #include "bitmap.h"
10 #include "brush.h"
11 #include "font.h"
12 #include "metafile.h"
13 #include "metafiledrv.h"
14 #include "pen.h"
15 #include "debug.h"
18 /***********************************************************************
19 * MFDRV_BITMAP_SelectObject
21 static HBITMAP16 MFDRV_BITMAP_SelectObject( DC * dc, HBITMAP16 hbitmap,
22 BITMAPOBJ * bmp )
24 return 0;
28 /***********************************************************************
29 * MFDRV_BRUSH_SelectObject
31 static HBRUSH32 MFDRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush,
32 BRUSHOBJ * brush )
34 LOGBRUSH16 logbrush = { brush->logbrush.lbStyle,
35 brush->logbrush.lbColor,
36 brush->logbrush.lbHatch };
37 switch (brush->logbrush.lbStyle)
39 case BS_SOLID:
40 case BS_HATCHED:
41 case BS_HOLLOW:
42 if (!MF_CreateBrushIndirect( dc, hbrush, &logbrush )) return 0;
43 break;
44 case BS_PATTERN:
45 case BS_DIBPATTERN:
46 if (!MF_CreatePatternBrush( dc, hbrush, &logbrush )) return 0;
47 break;
49 return 1; /* FIXME? */
53 /***********************************************************************
54 * MFDRV_FONT_SelectObject
56 static HFONT16 MFDRV_FONT_SelectObject( DC * dc, HFONT16 hfont,
57 FONTOBJ * font )
59 HFONT16 prevHandle = dc->w.hFont;
60 if (MF_CreateFontIndirect(dc, hfont, &(font->logfont))) return prevHandle;
61 return 0;
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;
75 return 0;
79 /***********************************************************************
80 * MFDRV_SelectObject
82 HGDIOBJ32 MFDRV_SelectObject( DC *dc, HGDIOBJ32 handle )
84 GDIOBJHDR * ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
85 HGDIOBJ32 ret = 0;
87 if (!ptr) return 0;
88 TRACE(gdi, "hdc=%04x %04x\n", dc->hSelf, handle );
90 switch(ptr->wMagic)
92 case PEN_MAGIC:
93 ret = MFDRV_PEN_SelectObject( dc, handle, (PENOBJ *)ptr );
94 break;
95 case BRUSH_MAGIC:
96 ret = MFDRV_BRUSH_SelectObject( dc, handle, (BRUSHOBJ *)ptr );
97 break;
98 case BITMAP_MAGIC:
99 ret = MFDRV_BITMAP_SelectObject( dc, handle, (BITMAPOBJ *)ptr );
100 break;
101 case FONT_MAGIC:
102 ret = MFDRV_FONT_SelectObject( dc, handle, (FONTOBJ *)ptr );
103 break;
104 case REGION_MAGIC:
105 ret = (HGDIOBJ16)SelectClipRgn16( dc->hSelf, handle );
106 break;
108 GDI_HEAP_UNLOCK( handle );
109 return ret;