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 )
37 emr.emr.iType = EMR_RESTOREDC;
38 emr.emr.nSize = sizeof(emr);
39 emr.iRelative = level;
40 return EMFDRV_WriteRecord( dev, &emr.emr );
43 UINT EMFDRV_SetTextAlign( PHYSDEV dev, UINT align )
46 emr.emr.iType = EMR_SETTEXTALIGN;
47 emr.emr.nSize = sizeof(emr);
49 return EMFDRV_WriteRecord( dev, &emr.emr );
52 INT EMFDRV_SetBkMode( PHYSDEV dev, INT mode )
55 emr.emr.iType = EMR_SETBKMODE;
56 emr.emr.nSize = sizeof(emr);
58 return EMFDRV_WriteRecord( dev, &emr.emr );
61 INT EMFDRV_SetROP2( PHYSDEV dev, INT rop )
64 emr.emr.iType = EMR_SETROP2;
65 emr.emr.nSize = sizeof(emr);
67 return EMFDRV_WriteRecord( dev, &emr.emr );
70 INT EMFDRV_SetPolyFillMode( PHYSDEV dev, INT mode )
72 EMRSETPOLYFILLMODE emr;
73 emr.emr.iType = EMR_SETPOLYFILLMODE;
74 emr.emr.nSize = sizeof(emr);
76 return EMFDRV_WriteRecord( dev, &emr.emr );
79 INT EMFDRV_SetStretchBltMode( PHYSDEV dev, INT mode )
81 EMRSETSTRETCHBLTMODE emr;
82 emr.emr.iType = EMR_SETSTRETCHBLTMODE;
83 emr.emr.nSize = sizeof(emr);
85 return EMFDRV_WriteRecord( dev, &emr.emr );
88 INT EMFDRV_SetMapMode( PHYSDEV dev, INT mode )
91 emr.emr.iType = EMR_SETMAPMODE;
92 emr.emr.nSize = sizeof(emr);
94 return EMFDRV_WriteRecord( dev, &emr.emr );
97 INT EMFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
99 EMREXCLUDECLIPRECT emr;
100 emr.emr.iType = EMR_EXCLUDECLIPRECT;
101 emr.emr.nSize = sizeof(emr);
102 emr.rclClip.left = left;
103 emr.rclClip.top = top;
104 emr.rclClip.right = right;
105 emr.rclClip.bottom = bottom;
106 return EMFDRV_WriteRecord( dev, &emr.emr );
109 INT EMFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom)
111 EMRINTERSECTCLIPRECT emr;
112 emr.emr.iType = EMR_INTERSECTCLIPRECT;
113 emr.emr.nSize = sizeof(emr);
114 emr.rclClip.left = left;
115 emr.rclClip.top = top;
116 emr.rclClip.right = right;
117 emr.rclClip.bottom = bottom;
118 return EMFDRV_WriteRecord( dev, &emr.emr );
121 INT EMFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
123 EMROFFSETCLIPRGN emr;
124 emr.emr.iType = EMR_OFFSETCLIPRGN;
125 emr.emr.nSize = sizeof(emr);
128 return EMFDRV_WriteRecord( dev, &emr.emr );
131 INT EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
133 EMREXTSELECTCLIPRGN *emr;
139 if (mode != RGN_COPY) return ERROR;
142 else rgnsize = GetRegionData( hrgn, 0, NULL );
144 size = rgnsize + offsetof(EMREXTSELECTCLIPRGN,RgnData);
145 emr = HeapAlloc( GetProcessHeap(), 0, size );
146 if (rgnsize) GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
148 emr->emr.iType = EMR_EXTSELECTCLIPRGN;
149 emr->emr.nSize = size;
150 emr->cbRgnData = rgnsize;
153 ret = EMFDRV_WriteRecord( dev, &emr->emr );
154 HeapFree( GetProcessHeap(), 0, emr );
155 return ret ? SIMPLEREGION : ERROR;
158 DWORD EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags )
160 EMRSETMAPPERFLAGS emr;
162 emr.emr.iType = EMR_SETMAPPERFLAGS;
163 emr.emr.nSize = sizeof(emr);
166 return EMFDRV_WriteRecord( dev, &emr.emr );
169 BOOL EMFDRV_AbortPath( PHYSDEV dev )
173 emr.emr.iType = EMR_ABORTPATH;
174 emr.emr.nSize = sizeof(emr);
176 return EMFDRV_WriteRecord( dev, &emr.emr );
179 BOOL EMFDRV_BeginPath( PHYSDEV dev )
183 emr.emr.iType = EMR_BEGINPATH;
184 emr.emr.nSize = sizeof(emr);
186 return EMFDRV_WriteRecord( dev, &emr.emr );
189 BOOL EMFDRV_CloseFigure( PHYSDEV dev )
193 emr.emr.iType = EMR_CLOSEFIGURE;
194 emr.emr.nSize = sizeof(emr);
196 return EMFDRV_WriteRecord( dev, &emr.emr );
199 BOOL EMFDRV_EndPath( PHYSDEV dev )
203 emr.emr.iType = EMR_ENDPATH;
204 emr.emr.nSize = sizeof(emr);
206 return EMFDRV_WriteRecord( dev, &emr.emr );
209 BOOL EMFDRV_FillPath( PHYSDEV dev )
213 emr.emr.iType = EMR_FILLPATH;
214 emr.emr.nSize = sizeof(emr);
216 emr.rclBounds.left = 0;
217 emr.rclBounds.top = 0;
218 emr.rclBounds.right = 0;
219 emr.rclBounds.bottom = 0;
220 return EMFDRV_WriteRecord( dev, &emr.emr );
223 BOOL EMFDRV_FlattenPath( PHYSDEV dev )
227 emr.emr.iType = EMR_FLATTENPATH;
228 emr.emr.nSize = sizeof(emr);
230 return EMFDRV_WriteRecord( dev, &emr.emr );
233 BOOL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode )
235 EMRSELECTCLIPPATH emr;
237 emr.emr.iType = EMR_SELECTCLIPPATH;
238 emr.emr.nSize = sizeof(emr);
241 return EMFDRV_WriteRecord( dev, &emr.emr );
244 BOOL EMFDRV_StrokeAndFillPath( PHYSDEV dev )
246 EMRSTROKEANDFILLPATH emr;
248 emr.emr.iType = EMR_STROKEANDFILLPATH;
249 emr.emr.nSize = sizeof(emr);
251 emr.rclBounds.left = 0;
252 emr.rclBounds.top = 0;
253 emr.rclBounds.right = 0;
254 emr.rclBounds.bottom = 0;
255 return EMFDRV_WriteRecord( dev, &emr.emr );
258 BOOL EMFDRV_StrokePath( PHYSDEV dev )
262 emr.emr.iType = EMR_STROKEPATH;
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_WidenPath( PHYSDEV dev )
276 emr.emr.iType = EMR_WIDENPATH;
277 emr.emr.nSize = sizeof(emr);
279 return EMFDRV_WriteRecord( dev, &emr.emr );