1*c2c66affSColin Finck /*
2*c2c66affSColin Finck * Metafile driver graphics functions
3*c2c66affSColin Finck *
4*c2c66affSColin Finck * Copyright 1993, 1994 Alexandre Julliard
5*c2c66affSColin Finck *
6*c2c66affSColin Finck * This library is free software; you can redistribute it and/or
7*c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
8*c2c66affSColin Finck * License as published by the Free Software Foundation; either
9*c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
10*c2c66affSColin Finck *
11*c2c66affSColin Finck * This library is distributed in the hope that it will be useful,
12*c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14*c2c66affSColin Finck * Lesser General Public License for more details.
15*c2c66affSColin Finck *
16*c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
17*c2c66affSColin Finck * License along with this library; if not, write to the Free Software
18*c2c66affSColin Finck * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19*c2c66affSColin Finck */
20*c2c66affSColin Finck
21*c2c66affSColin Finck #include <stdarg.h>
22*c2c66affSColin Finck #include <stdlib.h>
23*c2c66affSColin Finck #include <string.h>
24*c2c66affSColin Finck
25*c2c66affSColin Finck #include "windef.h"
26*c2c66affSColin Finck #include "winbase.h"
27*c2c66affSColin Finck #include "wingdi.h"
28*c2c66affSColin Finck #include "mfdrv/metafiledrv.h"
29*c2c66affSColin Finck #include "wine/debug.h"
30*c2c66affSColin Finck
31*c2c66affSColin Finck WINE_DEFAULT_DEBUG_CHANNEL(metafile);
32*c2c66affSColin Finck
33*c2c66affSColin Finck /**********************************************************************
34*c2c66affSColin Finck * MFDRV_MoveTo
35*c2c66affSColin Finck */
MFDRV_MoveTo(PHYSDEV dev,INT x,INT y)36*c2c66affSColin Finck BOOL MFDRV_MoveTo(PHYSDEV dev, INT x, INT y)
37*c2c66affSColin Finck {
38*c2c66affSColin Finck return MFDRV_MetaParam2(dev,META_MOVETO,x,y);
39*c2c66affSColin Finck }
40*c2c66affSColin Finck
41*c2c66affSColin Finck /***********************************************************************
42*c2c66affSColin Finck * MFDRV_LineTo
43*c2c66affSColin Finck */
MFDRV_LineTo(PHYSDEV dev,INT x,INT y)44*c2c66affSColin Finck BOOL MFDRV_LineTo( PHYSDEV dev, INT x, INT y )
45*c2c66affSColin Finck {
46*c2c66affSColin Finck return MFDRV_MetaParam2(dev, META_LINETO, x, y);
47*c2c66affSColin Finck }
48*c2c66affSColin Finck
49*c2c66affSColin Finck
50*c2c66affSColin Finck /***********************************************************************
51*c2c66affSColin Finck * MFDRV_Arc
52*c2c66affSColin Finck */
MFDRV_Arc(PHYSDEV dev,INT left,INT top,INT right,INT bottom,INT xstart,INT ystart,INT xend,INT yend)53*c2c66affSColin Finck BOOL MFDRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
54*c2c66affSColin Finck INT xstart, INT ystart, INT xend, INT yend )
55*c2c66affSColin Finck {
56*c2c66affSColin Finck return MFDRV_MetaParam8(dev, META_ARC, left, top, right, bottom,
57*c2c66affSColin Finck xstart, ystart, xend, yend);
58*c2c66affSColin Finck }
59*c2c66affSColin Finck
60*c2c66affSColin Finck
61*c2c66affSColin Finck /***********************************************************************
62*c2c66affSColin Finck * MFDRV_Pie
63*c2c66affSColin Finck */
MFDRV_Pie(PHYSDEV dev,INT left,INT top,INT right,INT bottom,INT xstart,INT ystart,INT xend,INT yend)64*c2c66affSColin Finck BOOL MFDRV_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
65*c2c66affSColin Finck INT xstart, INT ystart, INT xend, INT yend )
66*c2c66affSColin Finck {
67*c2c66affSColin Finck return MFDRV_MetaParam8(dev, META_PIE, left, top, right, bottom,
68*c2c66affSColin Finck xstart, ystart, xend, yend);
69*c2c66affSColin Finck }
70*c2c66affSColin Finck
71*c2c66affSColin Finck
72*c2c66affSColin Finck /***********************************************************************
73*c2c66affSColin Finck * MFDRV_Chord
74*c2c66affSColin Finck */
MFDRV_Chord(PHYSDEV dev,INT left,INT top,INT right,INT bottom,INT xstart,INT ystart,INT xend,INT yend)75*c2c66affSColin Finck BOOL MFDRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
76*c2c66affSColin Finck INT xstart, INT ystart, INT xend, INT yend )
77*c2c66affSColin Finck {
78*c2c66affSColin Finck return MFDRV_MetaParam8(dev, META_CHORD, left, top, right, bottom,
79*c2c66affSColin Finck xstart, ystart, xend, yend);
80*c2c66affSColin Finck }
81*c2c66affSColin Finck
82*c2c66affSColin Finck /***********************************************************************
83*c2c66affSColin Finck * MFDRV_Ellipse
84*c2c66affSColin Finck */
MFDRV_Ellipse(PHYSDEV dev,INT left,INT top,INT right,INT bottom)85*c2c66affSColin Finck BOOL MFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
86*c2c66affSColin Finck {
87*c2c66affSColin Finck return MFDRV_MetaParam4(dev, META_ELLIPSE, left, top, right, bottom);
88*c2c66affSColin Finck }
89*c2c66affSColin Finck
90*c2c66affSColin Finck /***********************************************************************
91*c2c66affSColin Finck * MFDRV_Rectangle
92*c2c66affSColin Finck */
MFDRV_Rectangle(PHYSDEV dev,INT left,INT top,INT right,INT bottom)93*c2c66affSColin Finck BOOL MFDRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
94*c2c66affSColin Finck {
95*c2c66affSColin Finck return MFDRV_MetaParam4(dev, META_RECTANGLE, left, top, right, bottom);
96*c2c66affSColin Finck }
97*c2c66affSColin Finck
98*c2c66affSColin Finck /***********************************************************************
99*c2c66affSColin Finck * MFDRV_RoundRect
100*c2c66affSColin Finck */
MFDRV_RoundRect(PHYSDEV dev,INT left,INT top,INT right,INT bottom,INT ell_width,INT ell_height)101*c2c66affSColin Finck BOOL MFDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right,
102*c2c66affSColin Finck INT bottom, INT ell_width, INT ell_height )
103*c2c66affSColin Finck {
104*c2c66affSColin Finck return MFDRV_MetaParam6(dev, META_ROUNDRECT, left, top, right, bottom,
105*c2c66affSColin Finck ell_width, ell_height);
106*c2c66affSColin Finck }
107*c2c66affSColin Finck
108*c2c66affSColin Finck /***********************************************************************
109*c2c66affSColin Finck * MFDRV_SetPixel
110*c2c66affSColin Finck */
MFDRV_SetPixel(PHYSDEV dev,INT x,INT y,COLORREF color)111*c2c66affSColin Finck COLORREF MFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
112*c2c66affSColin Finck {
113*c2c66affSColin Finck return MFDRV_MetaParam4(dev, META_SETPIXEL, x, y,HIWORD(color),
114*c2c66affSColin Finck LOWORD(color));
115*c2c66affSColin Finck }
116*c2c66affSColin Finck
117*c2c66affSColin Finck
118*c2c66affSColin Finck /******************************************************************
119*c2c66affSColin Finck * MFDRV_MetaPoly - implements Polygon and Polyline
120*c2c66affSColin Finck */
MFDRV_MetaPoly(PHYSDEV dev,short func,POINTS * pt,short count)121*c2c66affSColin Finck static BOOL MFDRV_MetaPoly(PHYSDEV dev, short func, POINTS *pt, short count)
122*c2c66affSColin Finck {
123*c2c66affSColin Finck BOOL ret;
124*c2c66affSColin Finck DWORD len;
125*c2c66affSColin Finck METARECORD *mr;
126*c2c66affSColin Finck
127*c2c66affSColin Finck len = sizeof(METARECORD) + (count * 4);
128*c2c66affSColin Finck if (!(mr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len )))
129*c2c66affSColin Finck return FALSE;
130*c2c66affSColin Finck
131*c2c66affSColin Finck mr->rdSize = len / 2;
132*c2c66affSColin Finck mr->rdFunction = func;
133*c2c66affSColin Finck *(mr->rdParm) = count;
134*c2c66affSColin Finck memcpy(mr->rdParm + 1, pt, count * 4);
135*c2c66affSColin Finck ret = MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
136*c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, mr);
137*c2c66affSColin Finck return ret;
138*c2c66affSColin Finck }
139*c2c66affSColin Finck
140*c2c66affSColin Finck
141*c2c66affSColin Finck /**********************************************************************
142*c2c66affSColin Finck * MFDRV_Polyline
143*c2c66affSColin Finck */
MFDRV_Polyline(PHYSDEV dev,const POINT * pt,INT count)144*c2c66affSColin Finck BOOL MFDRV_Polyline( PHYSDEV dev, const POINT* pt, INT count )
145*c2c66affSColin Finck {
146*c2c66affSColin Finck int i;
147*c2c66affSColin Finck POINTS *pts;
148*c2c66affSColin Finck BOOL ret;
149*c2c66affSColin Finck
150*c2c66affSColin Finck pts = HeapAlloc( GetProcessHeap(), 0, sizeof(POINTS)*count );
151*c2c66affSColin Finck if(!pts) return FALSE;
152*c2c66affSColin Finck for (i=count;i--;)
153*c2c66affSColin Finck {
154*c2c66affSColin Finck pts[i].x = pt[i].x;
155*c2c66affSColin Finck pts[i].y = pt[i].y;
156*c2c66affSColin Finck }
157*c2c66affSColin Finck ret = MFDRV_MetaPoly(dev, META_POLYLINE, pts, count);
158*c2c66affSColin Finck
159*c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, pts );
160*c2c66affSColin Finck return ret;
161*c2c66affSColin Finck }
162*c2c66affSColin Finck
163*c2c66affSColin Finck
164*c2c66affSColin Finck /**********************************************************************
165*c2c66affSColin Finck * MFDRV_Polygon
166*c2c66affSColin Finck */
MFDRV_Polygon(PHYSDEV dev,const POINT * pt,INT count)167*c2c66affSColin Finck BOOL MFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
168*c2c66affSColin Finck {
169*c2c66affSColin Finck int i;
170*c2c66affSColin Finck POINTS *pts;
171*c2c66affSColin Finck BOOL ret;
172*c2c66affSColin Finck
173*c2c66affSColin Finck pts = HeapAlloc( GetProcessHeap(), 0, sizeof(POINTS)*count );
174*c2c66affSColin Finck if(!pts) return FALSE;
175*c2c66affSColin Finck for (i=count;i--;)
176*c2c66affSColin Finck {
177*c2c66affSColin Finck pts[i].x = pt[i].x;
178*c2c66affSColin Finck pts[i].y = pt[i].y;
179*c2c66affSColin Finck }
180*c2c66affSColin Finck ret = MFDRV_MetaPoly(dev, META_POLYGON, pts, count);
181*c2c66affSColin Finck
182*c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, pts );
183*c2c66affSColin Finck return ret;
184*c2c66affSColin Finck }
185*c2c66affSColin Finck
186*c2c66affSColin Finck
187*c2c66affSColin Finck /**********************************************************************
188*c2c66affSColin Finck * MFDRV_PolyPolygon
189*c2c66affSColin Finck */
MFDRV_PolyPolygon(PHYSDEV dev,const POINT * pt,const INT * counts,UINT polygons)190*c2c66affSColin Finck BOOL MFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polygons)
191*c2c66affSColin Finck {
192*c2c66affSColin Finck BOOL ret;
193*c2c66affSColin Finck DWORD len;
194*c2c66affSColin Finck METARECORD *mr;
195*c2c66affSColin Finck unsigned int i,j;
196*c2c66affSColin Finck POINTS *pts;
197*c2c66affSColin Finck INT16 totalpoint16 = 0;
198*c2c66affSColin Finck INT16 * pointcounts;
199*c2c66affSColin Finck
200*c2c66affSColin Finck for (i=0;i<polygons;i++) {
201*c2c66affSColin Finck totalpoint16 += counts[i];
202*c2c66affSColin Finck }
203*c2c66affSColin Finck
204*c2c66affSColin Finck /* allocate space for all points */
205*c2c66affSColin Finck pts=HeapAlloc( GetProcessHeap(), 0, sizeof(POINTS) * totalpoint16 );
206*c2c66affSColin Finck pointcounts = HeapAlloc( GetProcessHeap(), 0, sizeof(INT16) * totalpoint16 );
207*c2c66affSColin Finck
208*c2c66affSColin Finck /* copy point counts */
209*c2c66affSColin Finck for (i=0;i<polygons;i++) {
210*c2c66affSColin Finck pointcounts[i] = counts[i];
211*c2c66affSColin Finck }
212*c2c66affSColin Finck
213*c2c66affSColin Finck /* convert all points */
214*c2c66affSColin Finck for (j = totalpoint16; j--;){
215*c2c66affSColin Finck pts[j].x = pt[j].x;
216*c2c66affSColin Finck pts[j].y = pt[j].y;
217*c2c66affSColin Finck }
218*c2c66affSColin Finck
219*c2c66affSColin Finck len = sizeof(METARECORD) + sizeof(WORD) + polygons*sizeof(INT16) + totalpoint16*sizeof(*pts);
220*c2c66affSColin Finck
221*c2c66affSColin Finck if (!(mr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len ))) {
222*c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, pts );
223*c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, pointcounts );
224*c2c66affSColin Finck return FALSE;
225*c2c66affSColin Finck }
226*c2c66affSColin Finck
227*c2c66affSColin Finck mr->rdSize = len /2;
228*c2c66affSColin Finck mr->rdFunction = META_POLYPOLYGON;
229*c2c66affSColin Finck *(mr->rdParm) = polygons;
230*c2c66affSColin Finck memcpy(mr->rdParm + 1, pointcounts, polygons*sizeof(INT16));
231*c2c66affSColin Finck memcpy(mr->rdParm + 1+polygons, pts , totalpoint16*sizeof(*pts));
232*c2c66affSColin Finck ret = MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
233*c2c66affSColin Finck
234*c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, pts );
235*c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, pointcounts );
236*c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, mr);
237*c2c66affSColin Finck return ret;
238*c2c66affSColin Finck }
239*c2c66affSColin Finck
240*c2c66affSColin Finck
241*c2c66affSColin Finck /**********************************************************************
242*c2c66affSColin Finck * MFDRV_ExtFloodFill
243*c2c66affSColin Finck */
MFDRV_ExtFloodFill(PHYSDEV dev,INT x,INT y,COLORREF color,UINT fillType)244*c2c66affSColin Finck BOOL MFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType )
245*c2c66affSColin Finck {
246*c2c66affSColin Finck return MFDRV_MetaParam4(dev,META_FLOODFILL,x,y,HIWORD(color),
247*c2c66affSColin Finck LOWORD(color));
248*c2c66affSColin Finck }
249*c2c66affSColin Finck
250*c2c66affSColin Finck
251*c2c66affSColin Finck /******************************************************************
252*c2c66affSColin Finck * MFDRV_CreateRegion
253*c2c66affSColin Finck *
254*c2c66affSColin Finck * For explanation of the format of the record see MF_Play_MetaCreateRegion in
255*c2c66affSColin Finck * objects/metafile.c
256*c2c66affSColin Finck */
MFDRV_CreateRegion(PHYSDEV dev,HRGN hrgn)257*c2c66affSColin Finck static INT16 MFDRV_CreateRegion(PHYSDEV dev, HRGN hrgn)
258*c2c66affSColin Finck {
259*c2c66affSColin Finck DWORD len;
260*c2c66affSColin Finck METARECORD *mr;
261*c2c66affSColin Finck RGNDATA *rgndata;
262*c2c66affSColin Finck RECT *pCurRect, *pEndRect;
263*c2c66affSColin Finck WORD Bands = 0, MaxBands = 0;
264*c2c66affSColin Finck WORD *Param, *StartBand;
265*c2c66affSColin Finck BOOL ret;
266*c2c66affSColin Finck
267*c2c66affSColin Finck if (!(len = GetRegionData( hrgn, 0, NULL ))) return -1;
268*c2c66affSColin Finck if( !(rgndata = HeapAlloc( GetProcessHeap(), 0, len )) ) {
269*c2c66affSColin Finck WARN("Can't alloc rgndata buffer\n");
270*c2c66affSColin Finck return -1;
271*c2c66affSColin Finck }
272*c2c66affSColin Finck GetRegionData( hrgn, len, rgndata );
273*c2c66affSColin Finck
274*c2c66affSColin Finck /* Overestimate of length:
275*c2c66affSColin Finck * Assume every rect is a separate band -> 6 WORDs per rect
276*c2c66affSColin Finck */
277*c2c66affSColin Finck len = sizeof(METARECORD) + 20 + (rgndata->rdh.nCount * 12);
278*c2c66affSColin Finck if( !(mr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len )) ) {
279*c2c66affSColin Finck WARN("Can't alloc METARECORD buffer\n");
280*c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, rgndata );
281*c2c66affSColin Finck return -1;
282*c2c66affSColin Finck }
283*c2c66affSColin Finck
284*c2c66affSColin Finck Param = mr->rdParm + 11;
285*c2c66affSColin Finck StartBand = NULL;
286*c2c66affSColin Finck
287*c2c66affSColin Finck pEndRect = (RECT *)rgndata->Buffer + rgndata->rdh.nCount;
288*c2c66affSColin Finck for(pCurRect = (RECT *)rgndata->Buffer; pCurRect < pEndRect; pCurRect++)
289*c2c66affSColin Finck {
290*c2c66affSColin Finck if( StartBand && pCurRect->top == *(StartBand + 1) )
291*c2c66affSColin Finck {
292*c2c66affSColin Finck *Param++ = pCurRect->left;
293*c2c66affSColin Finck *Param++ = pCurRect->right;
294*c2c66affSColin Finck }
295*c2c66affSColin Finck else
296*c2c66affSColin Finck {
297*c2c66affSColin Finck if(StartBand)
298*c2c66affSColin Finck {
299*c2c66affSColin Finck *StartBand = Param - StartBand - 3;
300*c2c66affSColin Finck *Param++ = *StartBand;
301*c2c66affSColin Finck if(*StartBand > MaxBands)
302*c2c66affSColin Finck MaxBands = *StartBand;
303*c2c66affSColin Finck Bands++;
304*c2c66affSColin Finck }
305*c2c66affSColin Finck StartBand = Param++;
306*c2c66affSColin Finck *Param++ = pCurRect->top;
307*c2c66affSColin Finck *Param++ = pCurRect->bottom;
308*c2c66affSColin Finck *Param++ = pCurRect->left;
309*c2c66affSColin Finck *Param++ = pCurRect->right;
310*c2c66affSColin Finck }
311*c2c66affSColin Finck }
312*c2c66affSColin Finck
313*c2c66affSColin Finck if (StartBand)
314*c2c66affSColin Finck {
315*c2c66affSColin Finck *StartBand = Param - StartBand - 3;
316*c2c66affSColin Finck *Param++ = *StartBand;
317*c2c66affSColin Finck if(*StartBand > MaxBands)
318*c2c66affSColin Finck MaxBands = *StartBand;
319*c2c66affSColin Finck Bands++;
320*c2c66affSColin Finck }
321*c2c66affSColin Finck
322*c2c66affSColin Finck mr->rdParm[0] = 0;
323*c2c66affSColin Finck mr->rdParm[1] = 6;
324*c2c66affSColin Finck mr->rdParm[2] = 0x2f6;
325*c2c66affSColin Finck mr->rdParm[3] = 0;
326*c2c66affSColin Finck mr->rdParm[4] = (Param - &mr->rdFunction) * sizeof(WORD);
327*c2c66affSColin Finck mr->rdParm[5] = Bands;
328*c2c66affSColin Finck mr->rdParm[6] = MaxBands;
329*c2c66affSColin Finck mr->rdParm[7] = rgndata->rdh.rcBound.left;
330*c2c66affSColin Finck mr->rdParm[8] = rgndata->rdh.rcBound.top;
331*c2c66affSColin Finck mr->rdParm[9] = rgndata->rdh.rcBound.right;
332*c2c66affSColin Finck mr->rdParm[10] = rgndata->rdh.rcBound.bottom;
333*c2c66affSColin Finck mr->rdFunction = META_CREATEREGION;
334*c2c66affSColin Finck mr->rdSize = Param - (WORD *)mr;
335*c2c66affSColin Finck ret = MFDRV_WriteRecord( dev, mr, mr->rdSize * 2 );
336*c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, mr );
337*c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, rgndata );
338*c2c66affSColin Finck if(!ret)
339*c2c66affSColin Finck {
340*c2c66affSColin Finck WARN("MFDRV_WriteRecord failed\n");
341*c2c66affSColin Finck return -1;
342*c2c66affSColin Finck }
343*c2c66affSColin Finck return MFDRV_AddHandle( dev, hrgn );
344*c2c66affSColin Finck }
345*c2c66affSColin Finck
346*c2c66affSColin Finck
347*c2c66affSColin Finck /**********************************************************************
348*c2c66affSColin Finck * MFDRV_PaintRgn
349*c2c66affSColin Finck */
MFDRV_PaintRgn(PHYSDEV dev,HRGN hrgn)350*c2c66affSColin Finck BOOL MFDRV_PaintRgn( PHYSDEV dev, HRGN hrgn )
351*c2c66affSColin Finck {
352*c2c66affSColin Finck INT16 index;
353*c2c66affSColin Finck index = MFDRV_CreateRegion( dev, hrgn );
354*c2c66affSColin Finck if(index == -1)
355*c2c66affSColin Finck return FALSE;
356*c2c66affSColin Finck return MFDRV_MetaParam1( dev, META_PAINTREGION, index );
357*c2c66affSColin Finck }
358*c2c66affSColin Finck
359*c2c66affSColin Finck
360*c2c66affSColin Finck /**********************************************************************
361*c2c66affSColin Finck * MFDRV_InvertRgn
362*c2c66affSColin Finck */
MFDRV_InvertRgn(PHYSDEV dev,HRGN hrgn)363*c2c66affSColin Finck BOOL MFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn )
364*c2c66affSColin Finck {
365*c2c66affSColin Finck INT16 index;
366*c2c66affSColin Finck index = MFDRV_CreateRegion( dev, hrgn );
367*c2c66affSColin Finck if(index == -1)
368*c2c66affSColin Finck return FALSE;
369*c2c66affSColin Finck return MFDRV_MetaParam1( dev, META_INVERTREGION, index );
370*c2c66affSColin Finck }
371*c2c66affSColin Finck
372*c2c66affSColin Finck
373*c2c66affSColin Finck /**********************************************************************
374*c2c66affSColin Finck * MFDRV_FillRgn
375*c2c66affSColin Finck */
MFDRV_FillRgn(PHYSDEV dev,HRGN hrgn,HBRUSH hbrush)376*c2c66affSColin Finck BOOL MFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush )
377*c2c66affSColin Finck {
378*c2c66affSColin Finck INT16 iRgn, iBrush;
379*c2c66affSColin Finck iRgn = MFDRV_CreateRegion( dev, hrgn );
380*c2c66affSColin Finck if(iRgn == -1)
381*c2c66affSColin Finck return FALSE;
382*c2c66affSColin Finck iBrush = MFDRV_CreateBrushIndirect( dev, hbrush );
383*c2c66affSColin Finck if(!iBrush)
384*c2c66affSColin Finck return FALSE;
385*c2c66affSColin Finck return MFDRV_MetaParam2( dev, META_FILLREGION, iRgn, iBrush );
386*c2c66affSColin Finck }
387*c2c66affSColin Finck
388*c2c66affSColin Finck /**********************************************************************
389*c2c66affSColin Finck * MFDRV_FrameRgn
390*c2c66affSColin Finck */
MFDRV_FrameRgn(PHYSDEV dev,HRGN hrgn,HBRUSH hbrush,INT x,INT y)391*c2c66affSColin Finck BOOL MFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT x, INT y )
392*c2c66affSColin Finck {
393*c2c66affSColin Finck INT16 iRgn, iBrush;
394*c2c66affSColin Finck iRgn = MFDRV_CreateRegion( dev, hrgn );
395*c2c66affSColin Finck if(iRgn == -1)
396*c2c66affSColin Finck return FALSE;
397*c2c66affSColin Finck iBrush = MFDRV_CreateBrushIndirect( dev, hbrush );
398*c2c66affSColin Finck if(!iBrush)
399*c2c66affSColin Finck return FALSE;
400*c2c66affSColin Finck return MFDRV_MetaParam4( dev, META_FRAMEREGION, iRgn, iBrush, x, y );
401*c2c66affSColin Finck }
402*c2c66affSColin Finck
403*c2c66affSColin Finck
404*c2c66affSColin Finck /**********************************************************************
405*c2c66affSColin Finck * MFDRV_ExtSelectClipRgn
406*c2c66affSColin Finck */
MFDRV_ExtSelectClipRgn(PHYSDEV dev,HRGN hrgn,INT mode)407*c2c66affSColin Finck INT MFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
408*c2c66affSColin Finck {
409*c2c66affSColin Finck INT16 iRgn;
410*c2c66affSColin Finck INT ret;
411*c2c66affSColin Finck
412*c2c66affSColin Finck if (mode != RGN_COPY) return ERROR;
413*c2c66affSColin Finck if (!hrgn) return NULLREGION;
414*c2c66affSColin Finck iRgn = MFDRV_CreateRegion( dev, hrgn );
415*c2c66affSColin Finck if(iRgn == -1) return ERROR;
416*c2c66affSColin Finck ret = MFDRV_MetaParam1( dev, META_SELECTOBJECT, iRgn ) ? NULLREGION : ERROR;
417*c2c66affSColin Finck MFDRV_MetaParam1( dev, META_DELETEOBJECT, iRgn );
418*c2c66affSColin Finck MFDRV_RemoveHandle( dev, iRgn );
419*c2c66affSColin Finck return ret;
420*c2c66affSColin Finck }
421*c2c66affSColin Finck
422*c2c66affSColin Finck
423*c2c66affSColin Finck /**********************************************************************
424*c2c66affSColin Finck * MFDRV_PolyBezier
425*c2c66affSColin Finck * Since MetaFiles don't record Beziers and they don't even record
426*c2c66affSColin Finck * approximations to them using lines, we need this stub function.
427*c2c66affSColin Finck */
MFDRV_PolyBezier(PHYSDEV dev,const POINT * pts,DWORD count)428*c2c66affSColin Finck BOOL MFDRV_PolyBezier( PHYSDEV dev, const POINT *pts, DWORD count )
429*c2c66affSColin Finck {
430*c2c66affSColin Finck return FALSE;
431*c2c66affSColin Finck }
432*c2c66affSColin Finck
433*c2c66affSColin Finck /**********************************************************************
434*c2c66affSColin Finck * MFDRV_PolyBezierTo
435*c2c66affSColin Finck * Since MetaFiles don't record Beziers and they don't even record
436*c2c66affSColin Finck * approximations to them using lines, we need this stub function.
437*c2c66affSColin Finck */
MFDRV_PolyBezierTo(PHYSDEV dev,const POINT * pts,DWORD count)438*c2c66affSColin Finck BOOL MFDRV_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD count )
439*c2c66affSColin Finck {
440*c2c66affSColin Finck return FALSE;
441*c2c66affSColin Finck }
442