Delphi 2.0 needs to allocate a bitmap bigger than 4096 bits wide.
[wine/multimedia.git] / graphics / metafiledrv / graphics.c
blob4ad49fb5d3b6e1e8319a3d17bf632903438e2291
1 /*
2 * Metafile driver graphics functions
4 * Copyright 1993, 1994 Alexandre Julliard
5 */
7 #include <stdlib.h>
8 #include "gdi.h"
9 #include "dc.h"
10 #include "metafile.h"
11 #include "region.h"
12 #include "xmalloc.h"
13 #include "metafiledrv.h"
14 #include "debug.h"
16 /**********************************************************************
17 * MFDRV_MoveToEx
19 BOOL32
20 MFDRV_MoveToEx(DC *dc,INT32 x,INT32 y,LPPOINT32 pt)
22 if (!MF_MetaParam2(dc,META_MOVETO,x,y))
23 return FALSE;
25 if (pt)
27 pt->x = dc->w.CursPosX;
28 pt->y = dc->w.CursPosY;
30 dc->w.CursPosX = x;
31 dc->w.CursPosY = y;
32 return TRUE;
35 /***********************************************************************
36 * MFDRV_LineTo
38 BOOL32
39 MFDRV_LineTo( DC *dc, INT32 x, INT32 y )
41 return MF_MetaParam2(dc, META_LINETO, x, y);
45 /***********************************************************************
46 * MFDRV_Arc
48 BOOL32
49 MFDRV_Arc( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom,
50 INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
52 return MF_MetaParam8(dc, META_ARC, left, top, right, bottom,
53 xstart, ystart, xend, yend);
57 /***********************************************************************
58 * MFDRV_Pie
60 BOOL32
61 MFDRV_Pie( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom,
62 INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
64 return MF_MetaParam8(dc, META_PIE, left, top, right, bottom,
65 xstart, ystart, xend, yend);
69 /***********************************************************************
70 * MFDRV_Chord
72 BOOL32
73 MFDRV_Chord( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom,
74 INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
76 return MF_MetaParam8(dc, META_CHORD, left, top, right, bottom,
77 xstart, ystart, xend, yend);
80 /***********************************************************************
81 * MFDRV_Ellipse
83 BOOL32
84 MFDRV_Ellipse( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom )
86 return MF_MetaParam4(dc, META_ELLIPSE, left, top, right, bottom);
89 /***********************************************************************
90 * MFDRV_Rectangle
92 BOOL32
93 MFDRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom)
95 return MF_MetaParam4(dc, META_RECTANGLE, left, top, right, bottom);
98 /***********************************************************************
99 * MFDRV_RoundRect
101 BOOL32
102 MFDRV_RoundRect( DC *dc, INT32 left, INT32 top, INT32 right,
103 INT32 bottom, INT32 ell_width, INT32 ell_height )
105 return MF_MetaParam6(dc, META_ROUNDRECT, left, top, right, bottom,
106 ell_width, ell_height);
109 /***********************************************************************
110 * MFDRV_SetPixel
112 COLORREF
113 MFDRV_SetPixel( DC *dc, INT32 x, INT32 y, COLORREF color )
115 return MF_MetaParam4(dc, META_SETPIXEL, x, y,HIWORD(color),LOWORD(color));
119 /**********************************************************************
120 * MFDRV_Polyline
122 BOOL32
123 MFDRV_Polyline( DC *dc, const POINT32* pt, INT32 count )
125 register int i;
126 LPPOINT16 pt16;
127 BOOL16 ret;
129 pt16 = (LPPOINT16)xmalloc(sizeof(POINT16)*count);
130 for (i=count;i--;) CONV_POINT32TO16(&(pt[i]),&(pt16[i]));
131 ret = MF_MetaPoly(dc, META_POLYLINE, pt16, count);
133 free(pt16);
134 return ret;
138 /**********************************************************************
139 * MFDRV_Polygon
141 BOOL32
142 MFDRV_Polygon( DC *dc, const POINT32* pt, INT32 count )
144 register int i;
145 LPPOINT16 pt16;
146 BOOL16 ret;
148 pt16 = (LPPOINT16)xmalloc(sizeof(POINT16)*count);
149 for (i=count;i--;) CONV_POINT32TO16(&(pt[i]),&(pt16[i]));
150 ret = MF_MetaPoly(dc, META_POLYGON, pt16, count);
152 free(pt16);
153 return ret;
157 /**********************************************************************
158 * PolyPolygon
160 BOOL32
161 MFDRV_PolyPolygon( DC *dc, const POINT32* pt, const INT32* counts, UINT32 polygons)
163 int i,j;
164 LPPOINT16 pt16;
165 const POINT32* curpt=pt;
166 BOOL32 ret;
168 for (i=0;i<polygons;i++) {
169 pt16=(LPPOINT16)xmalloc(sizeof(POINT16)*counts[i]);
170 for (j=counts[i];j--;) CONV_POINT32TO16(&(curpt[j]),&(pt16[j]));
171 ret = MF_MetaPoly(dc, META_POLYGON, pt16, counts[i]);
172 free(pt16);
173 if (!ret)
174 return FALSE;
175 curpt+=counts[i];
177 return TRUE;
181 /**********************************************************************
182 * MFDRV_ExtFloodFill
184 BOOL32
185 MFDRV_ExtFloodFill( DC *dc, INT32 x, INT32 y, COLORREF color, UINT32 fillType )
187 return MF_MetaParam4(dc,META_FLOODFILL,x,y,HIWORD(color),LOWORD(color));
191 /**********************************************************************
192 * MFDRV_PaintRgn
194 BOOL32
195 MFDRV_PaintRgn( DC *dc, HRGN32 hrgn )
197 INT16 index;
198 index = MF_CreateRegion( dc, hrgn );
199 if(index == -1)
200 return FALSE;
201 return MF_MetaParam1( dc, META_PAINTREGION, index );
205 /**********************************************************************
206 * MFDRV_SetBkColor
208 COLORREF
209 MFDRV_SetBkColor( DC *dc, COLORREF color )
211 return MF_MetaParam2(dc, META_SETBKCOLOR, HIWORD(color), LOWORD(color));
215 /**********************************************************************
216 * MFDRV_SetTextColor
218 COLORREF
219 MFDRV_SetTextColor( DC *dc, COLORREF color )
221 return MF_MetaParam2(dc, META_SETTEXTCOLOR, HIWORD(color), LOWORD(color));