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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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;
37 DC *dc = get_dc_ptr( physDev->hdc );
40 emr.emr.iType = EMR_RESTOREDC;
41 emr.emr.nSize = sizeof(emr);
44 emr.iRelative = level;
46 emr.iRelative = level - dc->saveLevel - 1;
48 EMFDRV_WriteRecord( dev, &emr.emr );
54 UINT EMFDRV_SetTextAlign( PHYSDEV dev, UINT align )
57 emr.emr.iType = EMR_SETTEXTALIGN;
58 emr.emr.nSize = sizeof(emr);
60 return EMFDRV_WriteRecord( dev, &emr.emr );
63 BOOL EMFDRV_SetTextJustification(PHYSDEV dev, INT nBreakExtra, INT nBreakCount)
65 EMRSETTEXTJUSTIFICATION emr;
66 emr.emr.iType = EMR_SETTEXTJUSTIFICATION;
67 emr.emr.nSize = sizeof(emr);
68 emr.nBreakExtra = nBreakExtra;
69 emr.nBreakCount = nBreakCount;
70 return EMFDRV_WriteRecord(dev, &emr.emr);
73 INT EMFDRV_SetBkMode( PHYSDEV dev, INT mode )
76 emr.emr.iType = EMR_SETBKMODE;
77 emr.emr.nSize = sizeof(emr);
79 return EMFDRV_WriteRecord( dev, &emr.emr );
82 INT EMFDRV_SetROP2( PHYSDEV dev, INT rop )
85 emr.emr.iType = EMR_SETROP2;
86 emr.emr.nSize = sizeof(emr);
88 return EMFDRV_WriteRecord( dev, &emr.emr );
91 INT EMFDRV_SetPolyFillMode( PHYSDEV dev, INT mode )
93 EMRSETPOLYFILLMODE emr;
94 emr.emr.iType = EMR_SETPOLYFILLMODE;
95 emr.emr.nSize = sizeof(emr);
97 return EMFDRV_WriteRecord( dev, &emr.emr );
100 INT EMFDRV_SetStretchBltMode( PHYSDEV dev, INT mode )
102 EMRSETSTRETCHBLTMODE emr;
103 emr.emr.iType = EMR_SETSTRETCHBLTMODE;
104 emr.emr.nSize = sizeof(emr);
106 return EMFDRV_WriteRecord( dev, &emr.emr );
109 INT EMFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
111 EMREXCLUDECLIPRECT emr;
112 emr.emr.iType = EMR_EXCLUDECLIPRECT;
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_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom)
123 EMRINTERSECTCLIPRECT emr;
124 emr.emr.iType = EMR_INTERSECTCLIPRECT;
125 emr.emr.nSize = sizeof(emr);
126 emr.rclClip.left = left;
127 emr.rclClip.top = top;
128 emr.rclClip.right = right;
129 emr.rclClip.bottom = bottom;
130 return EMFDRV_WriteRecord( dev, &emr.emr );
133 INT EMFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
135 EMROFFSETCLIPRGN emr;
136 emr.emr.iType = EMR_OFFSETCLIPRGN;
137 emr.emr.nSize = sizeof(emr);
140 return EMFDRV_WriteRecord( dev, &emr.emr );
143 INT EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
145 EMREXTSELECTCLIPRGN *emr;
151 if (mode != RGN_COPY) return ERROR;
154 else rgnsize = GetRegionData( hrgn, 0, NULL );
156 size = rgnsize + offsetof(EMREXTSELECTCLIPRGN,RgnData);
157 emr = HeapAlloc( GetProcessHeap(), 0, size );
158 if (rgnsize) GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
160 emr->emr.iType = EMR_EXTSELECTCLIPRGN;
161 emr->emr.nSize = size;
162 emr->cbRgnData = rgnsize;
165 ret = EMFDRV_WriteRecord( dev, &emr->emr );
166 HeapFree( GetProcessHeap(), 0, emr );
167 return ret ? SIMPLEREGION : ERROR;
170 DWORD EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags )
172 EMRSETMAPPERFLAGS emr;
174 emr.emr.iType = EMR_SETMAPPERFLAGS;
175 emr.emr.nSize = sizeof(emr);
178 return EMFDRV_WriteRecord( dev, &emr.emr );
181 BOOL EMFDRV_AbortPath( PHYSDEV dev )
185 emr.emr.iType = EMR_ABORTPATH;
186 emr.emr.nSize = sizeof(emr);
188 return EMFDRV_WriteRecord( dev, &emr.emr );
191 BOOL EMFDRV_BeginPath( PHYSDEV dev )
195 emr.emr.iType = EMR_BEGINPATH;
196 emr.emr.nSize = sizeof(emr);
198 return EMFDRV_WriteRecord( dev, &emr.emr );
201 BOOL EMFDRV_CloseFigure( PHYSDEV dev )
205 emr.emr.iType = EMR_CLOSEFIGURE;
206 emr.emr.nSize = sizeof(emr);
208 return EMFDRV_WriteRecord( dev, &emr.emr );
211 BOOL EMFDRV_EndPath( PHYSDEV dev )
215 emr.emr.iType = EMR_ENDPATH;
216 emr.emr.nSize = sizeof(emr);
218 return EMFDRV_WriteRecord( dev, &emr.emr );
221 BOOL EMFDRV_FillPath( PHYSDEV dev )
225 emr.emr.iType = EMR_FILLPATH;
226 emr.emr.nSize = sizeof(emr);
228 emr.rclBounds.left = 0;
229 emr.rclBounds.top = 0;
230 emr.rclBounds.right = 0;
231 emr.rclBounds.bottom = 0;
232 return EMFDRV_WriteRecord( dev, &emr.emr );
235 BOOL EMFDRV_FlattenPath( PHYSDEV dev )
239 emr.emr.iType = EMR_FLATTENPATH;
240 emr.emr.nSize = sizeof(emr);
242 return EMFDRV_WriteRecord( dev, &emr.emr );
245 BOOL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode )
247 EMRSELECTCLIPPATH emr;
249 emr.emr.iType = EMR_SELECTCLIPPATH;
250 emr.emr.nSize = sizeof(emr);
253 return EMFDRV_WriteRecord( dev, &emr.emr );
256 BOOL EMFDRV_StrokeAndFillPath( PHYSDEV dev )
258 EMRSTROKEANDFILLPATH emr;
260 emr.emr.iType = EMR_STROKEANDFILLPATH;
261 emr.emr.nSize = sizeof(emr);
263 emr.rclBounds.left = 0;
264 emr.rclBounds.top = 0;
265 emr.rclBounds.right = 0;
266 emr.rclBounds.bottom = 0;
267 return EMFDRV_WriteRecord( dev, &emr.emr );
270 BOOL EMFDRV_StrokePath( PHYSDEV dev )
274 emr.emr.iType = EMR_STROKEPATH;
275 emr.emr.nSize = sizeof(emr);
277 emr.rclBounds.left = 0;
278 emr.rclBounds.top = 0;
279 emr.rclBounds.right = 0;
280 emr.rclBounds.bottom = 0;
281 return EMFDRV_WriteRecord( dev, &emr.emr );
284 BOOL EMFDRV_WidenPath( PHYSDEV dev )
288 emr.emr.iType = EMR_WIDENPATH;
289 emr.emr.nSize = sizeof(emr);
291 return EMFDRV_WriteRecord( dev, &emr.emr );
294 INT EMFDRV_GetDeviceCaps(PHYSDEV dev, INT cap)
296 EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev;
301 return physDev->horzres;
303 return physDev->vertres;
305 return physDev->logpixelsx;
307 return physDev->logpixelsy;
309 return physDev->horzsize;
311 return physDev->vertsize;
313 return physDev->bitspixel;
315 return physDev->textcaps;
317 return physDev->rastercaps;
319 return physDev->technology;
321 return physDev->planes;
323 return physDev->numcolors;
325 FIXME("Unimplemented cap %d\n", cap);