2 * Enhanced MetaFile driver dc value functions
4 * Copyright 1999 Huw D M Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "enhmfdrv/enhmetafiledrv.h"
22 #include "wine/debug.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile);
26 INT EMFDRV_SaveDC( PHYSDEV dev )
29 emr.emr.iType = EMR_SAVEDC;
30 emr.emr.nSize = sizeof(emr);
31 return EMFDRV_WriteRecord( dev, &emr.emr );
34 BOOL EMFDRV_RestoreDC( PHYSDEV dev, INT level )
36 EMFDRV_PDEVICE* physDev = (EMFDRV_PDEVICE*)dev;
39 emr.emr.iType = EMR_RESTOREDC;
40 emr.emr.nSize = sizeof(emr);
43 emr.iRelative = level;
45 emr.iRelative = level - physDev->dc->saveLevel - 1;
47 EMFDRV_WriteRecord( dev, &emr.emr );
52 UINT EMFDRV_SetTextAlign( PHYSDEV dev, UINT align )
55 emr.emr.iType = EMR_SETTEXTALIGN;
56 emr.emr.nSize = sizeof(emr);
58 return EMFDRV_WriteRecord( dev, &emr.emr );
61 BOOL EMFDRV_SetTextJustification(PHYSDEV dev, INT nBreakExtra, INT nBreakCount)
63 EMRSETTEXTJUSTIFICATION emr;
64 emr.emr.iType = EMR_SETTEXTJUSTIFICATION;
65 emr.emr.nSize = sizeof(emr);
66 emr.nBreakExtra = nBreakExtra;
67 emr.nBreakCount = nBreakCount;
68 return EMFDRV_WriteRecord(dev, &emr.emr);
71 INT EMFDRV_SetBkMode( PHYSDEV dev, INT mode )
74 emr.emr.iType = EMR_SETBKMODE;
75 emr.emr.nSize = sizeof(emr);
77 return EMFDRV_WriteRecord( dev, &emr.emr );
80 INT EMFDRV_SetROP2( PHYSDEV dev, INT rop )
83 emr.emr.iType = EMR_SETROP2;
84 emr.emr.nSize = sizeof(emr);
86 return EMFDRV_WriteRecord( dev, &emr.emr );
89 INT EMFDRV_SetPolyFillMode( PHYSDEV dev, INT mode )
91 EMRSETPOLYFILLMODE emr;
92 emr.emr.iType = EMR_SETPOLYFILLMODE;
93 emr.emr.nSize = sizeof(emr);
95 return EMFDRV_WriteRecord( dev, &emr.emr );
98 INT EMFDRV_SetStretchBltMode( PHYSDEV dev, INT mode )
100 EMRSETSTRETCHBLTMODE emr;
101 emr.emr.iType = EMR_SETSTRETCHBLTMODE;
102 emr.emr.nSize = sizeof(emr);
104 return EMFDRV_WriteRecord( dev, &emr.emr );
107 INT EMFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
109 EMREXCLUDECLIPRECT emr;
110 emr.emr.iType = EMR_EXCLUDECLIPRECT;
111 emr.emr.nSize = sizeof(emr);
112 emr.rclClip.left = left;
113 emr.rclClip.top = top;
114 emr.rclClip.right = right;
115 emr.rclClip.bottom = bottom;
116 return EMFDRV_WriteRecord( dev, &emr.emr );
119 INT EMFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom)
121 EMRINTERSECTCLIPRECT emr;
122 emr.emr.iType = EMR_INTERSECTCLIPRECT;
123 emr.emr.nSize = sizeof(emr);
124 emr.rclClip.left = left;
125 emr.rclClip.top = top;
126 emr.rclClip.right = right;
127 emr.rclClip.bottom = bottom;
128 return EMFDRV_WriteRecord( dev, &emr.emr );
131 INT EMFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
133 EMROFFSETCLIPRGN emr;
134 emr.emr.iType = EMR_OFFSETCLIPRGN;
135 emr.emr.nSize = sizeof(emr);
138 return EMFDRV_WriteRecord( dev, &emr.emr );
141 INT EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
143 EMREXTSELECTCLIPRGN *emr;
149 if (mode != RGN_COPY) return ERROR;
152 else rgnsize = GetRegionData( hrgn, 0, NULL );
154 size = rgnsize + offsetof(EMREXTSELECTCLIPRGN,RgnData);
155 emr = HeapAlloc( GetProcessHeap(), 0, size );
156 if (rgnsize) GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
158 emr->emr.iType = EMR_EXTSELECTCLIPRGN;
159 emr->emr.nSize = size;
160 emr->cbRgnData = rgnsize;
163 ret = EMFDRV_WriteRecord( dev, &emr->emr );
164 HeapFree( GetProcessHeap(), 0, emr );
165 return ret ? SIMPLEREGION : ERROR;
168 DWORD EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags )
170 EMRSETMAPPERFLAGS emr;
172 emr.emr.iType = EMR_SETMAPPERFLAGS;
173 emr.emr.nSize = sizeof(emr);
176 return EMFDRV_WriteRecord( dev, &emr.emr );
179 BOOL EMFDRV_AbortPath( PHYSDEV dev )
183 emr.emr.iType = EMR_ABORTPATH;
184 emr.emr.nSize = sizeof(emr);
186 return EMFDRV_WriteRecord( dev, &emr.emr );
189 BOOL EMFDRV_BeginPath( PHYSDEV dev )
193 emr.emr.iType = EMR_BEGINPATH;
194 emr.emr.nSize = sizeof(emr);
196 return EMFDRV_WriteRecord( dev, &emr.emr );
199 BOOL EMFDRV_CloseFigure( PHYSDEV dev )
203 emr.emr.iType = EMR_CLOSEFIGURE;
204 emr.emr.nSize = sizeof(emr);
206 return EMFDRV_WriteRecord( dev, &emr.emr );
209 BOOL EMFDRV_EndPath( PHYSDEV dev )
213 emr.emr.iType = EMR_ENDPATH;
214 emr.emr.nSize = sizeof(emr);
216 return EMFDRV_WriteRecord( dev, &emr.emr );
219 BOOL EMFDRV_FillPath( PHYSDEV dev )
223 emr.emr.iType = EMR_FILLPATH;
224 emr.emr.nSize = sizeof(emr);
226 emr.rclBounds.left = 0;
227 emr.rclBounds.top = 0;
228 emr.rclBounds.right = 0;
229 emr.rclBounds.bottom = 0;
230 return EMFDRV_WriteRecord( dev, &emr.emr );
233 BOOL EMFDRV_FlattenPath( PHYSDEV dev )
237 emr.emr.iType = EMR_FLATTENPATH;
238 emr.emr.nSize = sizeof(emr);
240 return EMFDRV_WriteRecord( dev, &emr.emr );
243 BOOL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode )
245 EMRSELECTCLIPPATH emr;
247 emr.emr.iType = EMR_SELECTCLIPPATH;
248 emr.emr.nSize = sizeof(emr);
251 return EMFDRV_WriteRecord( dev, &emr.emr );
254 BOOL EMFDRV_StrokeAndFillPath( PHYSDEV dev )
256 EMRSTROKEANDFILLPATH emr;
258 emr.emr.iType = EMR_STROKEANDFILLPATH;
259 emr.emr.nSize = sizeof(emr);
261 emr.rclBounds.left = 0;
262 emr.rclBounds.top = 0;
263 emr.rclBounds.right = 0;
264 emr.rclBounds.bottom = 0;
265 return EMFDRV_WriteRecord( dev, &emr.emr );
268 BOOL EMFDRV_StrokePath( PHYSDEV dev )
272 emr.emr.iType = EMR_STROKEPATH;
273 emr.emr.nSize = sizeof(emr);
275 emr.rclBounds.left = 0;
276 emr.rclBounds.top = 0;
277 emr.rclBounds.right = 0;
278 emr.rclBounds.bottom = 0;
279 return EMFDRV_WriteRecord( dev, &emr.emr );
282 BOOL EMFDRV_WidenPath( PHYSDEV dev )
286 emr.emr.iType = EMR_WIDENPATH;
287 emr.emr.nSize = sizeof(emr);
289 return EMFDRV_WriteRecord( dev, &emr.emr );
292 INT EMFDRV_GetDeviceCaps(PHYSDEV dev, INT cap)
294 EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev;
299 return physDev->horzres;
301 return physDev->vertres;
303 return physDev->logpixelsx;
305 return physDev->logpixelsy;
307 return physDev->horzsize;
309 return physDev->vertsize;
311 return physDev->bitspixel;
313 return physDev->textcaps;
315 return physDev->rastercaps;
317 return physDev->technology;
319 return physDev->planes;
322 FIXME("Unimplemented cap %d\n", cap);