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 return EMFDRV_WriteRecord( dev, &emr.emr );
44 else if (level > 0 && level <= physDev->dc->saveLevel)
46 while (level >= physDev->dc->saveLevel)
48 EMFDRV_WriteRecord( dev, &emr.emr );
56 UINT EMFDRV_SetTextAlign( PHYSDEV dev, UINT align )
59 emr.emr.iType = EMR_SETTEXTALIGN;
60 emr.emr.nSize = sizeof(emr);
62 return EMFDRV_WriteRecord( dev, &emr.emr );
65 BOOL EMFDRV_SetTextJustification(PHYSDEV dev, INT nBreakExtra, INT nBreakCount)
67 EMRSETTEXTJUSTIFICATION emr;
68 emr.emr.iType = EMR_SETTEXTJUSTIFICATION;
69 emr.emr.nSize = sizeof(emr);
70 emr.nBreakExtra = nBreakExtra;
71 emr.nBreakCount = nBreakCount;
72 return EMFDRV_WriteRecord(dev, &emr.emr);
75 INT EMFDRV_SetBkMode( PHYSDEV dev, INT mode )
78 emr.emr.iType = EMR_SETBKMODE;
79 emr.emr.nSize = sizeof(emr);
81 return EMFDRV_WriteRecord( dev, &emr.emr );
84 INT EMFDRV_SetROP2( PHYSDEV dev, INT rop )
87 emr.emr.iType = EMR_SETROP2;
88 emr.emr.nSize = sizeof(emr);
90 return EMFDRV_WriteRecord( dev, &emr.emr );
93 INT EMFDRV_SetPolyFillMode( PHYSDEV dev, INT mode )
95 EMRSETPOLYFILLMODE emr;
96 emr.emr.iType = EMR_SETPOLYFILLMODE;
97 emr.emr.nSize = sizeof(emr);
99 return EMFDRV_WriteRecord( dev, &emr.emr );
102 INT EMFDRV_SetStretchBltMode( PHYSDEV dev, INT mode )
104 EMRSETSTRETCHBLTMODE emr;
105 emr.emr.iType = EMR_SETSTRETCHBLTMODE;
106 emr.emr.nSize = sizeof(emr);
108 return EMFDRV_WriteRecord( dev, &emr.emr );
111 INT EMFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
113 EMREXCLUDECLIPRECT emr;
114 emr.emr.iType = EMR_EXCLUDECLIPRECT;
115 emr.emr.nSize = sizeof(emr);
116 emr.rclClip.left = left;
117 emr.rclClip.top = top;
118 emr.rclClip.right = right;
119 emr.rclClip.bottom = bottom;
120 return EMFDRV_WriteRecord( dev, &emr.emr );
123 INT EMFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom)
125 EMRINTERSECTCLIPRECT emr;
126 emr.emr.iType = EMR_INTERSECTCLIPRECT;
127 emr.emr.nSize = sizeof(emr);
128 emr.rclClip.left = left;
129 emr.rclClip.top = top;
130 emr.rclClip.right = right;
131 emr.rclClip.bottom = bottom;
132 return EMFDRV_WriteRecord( dev, &emr.emr );
135 INT EMFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
137 EMROFFSETCLIPRGN emr;
138 emr.emr.iType = EMR_OFFSETCLIPRGN;
139 emr.emr.nSize = sizeof(emr);
142 return EMFDRV_WriteRecord( dev, &emr.emr );
145 INT EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
147 EMREXTSELECTCLIPRGN *emr;
153 if (mode != RGN_COPY) return ERROR;
156 else rgnsize = GetRegionData( hrgn, 0, NULL );
158 size = rgnsize + offsetof(EMREXTSELECTCLIPRGN,RgnData);
159 emr = HeapAlloc( GetProcessHeap(), 0, size );
160 if (rgnsize) GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
162 emr->emr.iType = EMR_EXTSELECTCLIPRGN;
163 emr->emr.nSize = size;
164 emr->cbRgnData = rgnsize;
167 ret = EMFDRV_WriteRecord( dev, &emr->emr );
168 HeapFree( GetProcessHeap(), 0, emr );
169 return ret ? SIMPLEREGION : ERROR;
172 DWORD EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags )
174 EMRSETMAPPERFLAGS emr;
176 emr.emr.iType = EMR_SETMAPPERFLAGS;
177 emr.emr.nSize = sizeof(emr);
180 return EMFDRV_WriteRecord( dev, &emr.emr );
183 BOOL EMFDRV_AbortPath( PHYSDEV dev )
187 emr.emr.iType = EMR_ABORTPATH;
188 emr.emr.nSize = sizeof(emr);
190 return EMFDRV_WriteRecord( dev, &emr.emr );
193 BOOL EMFDRV_BeginPath( PHYSDEV dev )
197 emr.emr.iType = EMR_BEGINPATH;
198 emr.emr.nSize = sizeof(emr);
200 return EMFDRV_WriteRecord( dev, &emr.emr );
203 BOOL EMFDRV_CloseFigure( PHYSDEV dev )
207 emr.emr.iType = EMR_CLOSEFIGURE;
208 emr.emr.nSize = sizeof(emr);
210 return EMFDRV_WriteRecord( dev, &emr.emr );
213 BOOL EMFDRV_EndPath( PHYSDEV dev )
217 emr.emr.iType = EMR_ENDPATH;
218 emr.emr.nSize = sizeof(emr);
220 return EMFDRV_WriteRecord( dev, &emr.emr );
223 BOOL EMFDRV_FillPath( PHYSDEV dev )
227 emr.emr.iType = EMR_FILLPATH;
228 emr.emr.nSize = sizeof(emr);
230 emr.rclBounds.left = 0;
231 emr.rclBounds.top = 0;
232 emr.rclBounds.right = 0;
233 emr.rclBounds.bottom = 0;
234 return EMFDRV_WriteRecord( dev, &emr.emr );
237 BOOL EMFDRV_FlattenPath( PHYSDEV dev )
241 emr.emr.iType = EMR_FLATTENPATH;
242 emr.emr.nSize = sizeof(emr);
244 return EMFDRV_WriteRecord( dev, &emr.emr );
247 BOOL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode )
249 EMRSELECTCLIPPATH emr;
251 emr.emr.iType = EMR_SELECTCLIPPATH;
252 emr.emr.nSize = sizeof(emr);
255 return EMFDRV_WriteRecord( dev, &emr.emr );
258 BOOL EMFDRV_StrokeAndFillPath( PHYSDEV dev )
260 EMRSTROKEANDFILLPATH emr;
262 emr.emr.iType = EMR_STROKEANDFILLPATH;
263 emr.emr.nSize = sizeof(emr);
265 emr.rclBounds.left = 0;
266 emr.rclBounds.top = 0;
267 emr.rclBounds.right = 0;
268 emr.rclBounds.bottom = 0;
269 return EMFDRV_WriteRecord( dev, &emr.emr );
272 BOOL EMFDRV_StrokePath( PHYSDEV dev )
276 emr.emr.iType = EMR_STROKEPATH;
277 emr.emr.nSize = sizeof(emr);
279 emr.rclBounds.left = 0;
280 emr.rclBounds.top = 0;
281 emr.rclBounds.right = 0;
282 emr.rclBounds.bottom = 0;
283 return EMFDRV_WriteRecord( dev, &emr.emr );
286 BOOL EMFDRV_WidenPath( PHYSDEV dev )
290 emr.emr.iType = EMR_WIDENPATH;
291 emr.emr.nSize = sizeof(emr);
293 return EMFDRV_WriteRecord( dev, &emr.emr );
296 INT EMFDRV_GetDeviceCaps(PHYSDEV dev, INT cap)
298 EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev;
303 return physDev->horzres;
305 return physDev->vertres;
307 return physDev->logpixelsx;
309 return physDev->logpixelsy;
311 return physDev->horzsize;
313 return physDev->vertsize;
315 return physDev->bitspixel;
317 return physDev->textcaps;
319 return physDev->rastercaps;
321 return physDev->technology;
323 return physDev->planes;
326 FIXME("Unimplemented cap %d\n", cap);