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 CDECL
EMFDRV_SaveDC( PHYSDEV dev
)
28 EMFDRV_PDEVICE
* physDev
= (EMFDRV_PDEVICE
*)dev
;
29 INT ret
= save_dc_state( physDev
->hdc
);
34 emr
.emr
.iType
= EMR_SAVEDC
;
35 emr
.emr
.nSize
= sizeof(emr
);
36 EMFDRV_WriteRecord( dev
, &emr
.emr
);
41 BOOL CDECL
EMFDRV_RestoreDC( PHYSDEV dev
, INT level
)
43 EMFDRV_PDEVICE
* physDev
= (EMFDRV_PDEVICE
*)dev
;
44 DC
*dc
= get_dc_ptr( physDev
->hdc
);
48 emr
.emr
.iType
= EMR_RESTOREDC
;
49 emr
.emr
.nSize
= sizeof(emr
);
52 emr
.iRelative
= level
;
54 emr
.iRelative
= level
- dc
->saveLevel
- 1;
58 ret
= restore_dc_state( physDev
->hdc
, level
);
61 if (ret
) EMFDRV_WriteRecord( dev
, &emr
.emr
);
65 UINT CDECL
EMFDRV_SetTextAlign( PHYSDEV dev
, UINT align
)
68 emr
.emr
.iType
= EMR_SETTEXTALIGN
;
69 emr
.emr
.nSize
= sizeof(emr
);
71 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
74 BOOL CDECL
EMFDRV_SetTextJustification(PHYSDEV dev
, INT nBreakExtra
, INT nBreakCount
)
76 EMRSETTEXTJUSTIFICATION emr
;
77 emr
.emr
.iType
= EMR_SETTEXTJUSTIFICATION
;
78 emr
.emr
.nSize
= sizeof(emr
);
79 emr
.nBreakExtra
= nBreakExtra
;
80 emr
.nBreakCount
= nBreakCount
;
81 return EMFDRV_WriteRecord(dev
, &emr
.emr
);
84 INT CDECL
EMFDRV_SetBkMode( PHYSDEV dev
, INT mode
)
87 emr
.emr
.iType
= EMR_SETBKMODE
;
88 emr
.emr
.nSize
= sizeof(emr
);
90 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
93 INT CDECL
EMFDRV_SetROP2( PHYSDEV dev
, INT rop
)
96 emr
.emr
.iType
= EMR_SETROP2
;
97 emr
.emr
.nSize
= sizeof(emr
);
99 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
102 INT CDECL
EMFDRV_SetPolyFillMode( PHYSDEV dev
, INT mode
)
104 EMRSETPOLYFILLMODE emr
;
105 emr
.emr
.iType
= EMR_SETPOLYFILLMODE
;
106 emr
.emr
.nSize
= sizeof(emr
);
108 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
111 INT CDECL
EMFDRV_SetStretchBltMode( PHYSDEV dev
, INT mode
)
113 EMRSETSTRETCHBLTMODE emr
;
114 emr
.emr
.iType
= EMR_SETSTRETCHBLTMODE
;
115 emr
.emr
.nSize
= sizeof(emr
);
117 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
120 INT CDECL
EMFDRV_ExcludeClipRect( PHYSDEV dev
, INT left
, INT top
, INT right
, INT bottom
)
122 EMREXCLUDECLIPRECT emr
;
123 emr
.emr
.iType
= EMR_EXCLUDECLIPRECT
;
124 emr
.emr
.nSize
= sizeof(emr
);
125 emr
.rclClip
.left
= left
;
126 emr
.rclClip
.top
= top
;
127 emr
.rclClip
.right
= right
;
128 emr
.rclClip
.bottom
= bottom
;
129 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
132 INT CDECL
EMFDRV_IntersectClipRect( PHYSDEV dev
, INT left
, INT top
, INT right
, INT bottom
)
134 EMRINTERSECTCLIPRECT emr
;
135 emr
.emr
.iType
= EMR_INTERSECTCLIPRECT
;
136 emr
.emr
.nSize
= sizeof(emr
);
137 emr
.rclClip
.left
= left
;
138 emr
.rclClip
.top
= top
;
139 emr
.rclClip
.right
= right
;
140 emr
.rclClip
.bottom
= bottom
;
141 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
144 INT CDECL
EMFDRV_OffsetClipRgn( PHYSDEV dev
, INT x
, INT y
)
146 EMROFFSETCLIPRGN emr
;
147 emr
.emr
.iType
= EMR_OFFSETCLIPRGN
;
148 emr
.emr
.nSize
= sizeof(emr
);
151 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
154 INT CDECL
EMFDRV_ExtSelectClipRgn( PHYSDEV dev
, HRGN hrgn
, INT mode
)
156 EMREXTSELECTCLIPRGN
*emr
;
162 if (mode
!= RGN_COPY
) return ERROR
;
165 else rgnsize
= GetRegionData( hrgn
, 0, NULL
);
167 size
= rgnsize
+ offsetof(EMREXTSELECTCLIPRGN
,RgnData
);
168 emr
= HeapAlloc( GetProcessHeap(), 0, size
);
169 if (rgnsize
) GetRegionData( hrgn
, rgnsize
, (RGNDATA
*)&emr
->RgnData
);
171 emr
->emr
.iType
= EMR_EXTSELECTCLIPRGN
;
172 emr
->emr
.nSize
= size
;
173 emr
->cbRgnData
= rgnsize
;
176 ret
= EMFDRV_WriteRecord( dev
, &emr
->emr
);
177 HeapFree( GetProcessHeap(), 0, emr
);
178 return ret
? SIMPLEREGION
: ERROR
;
181 DWORD CDECL
EMFDRV_SetMapperFlags( PHYSDEV dev
, DWORD flags
)
183 EMRSETMAPPERFLAGS emr
;
185 emr
.emr
.iType
= EMR_SETMAPPERFLAGS
;
186 emr
.emr
.nSize
= sizeof(emr
);
189 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
192 BOOL CDECL
EMFDRV_AbortPath( PHYSDEV dev
)
196 emr
.emr
.iType
= EMR_ABORTPATH
;
197 emr
.emr
.nSize
= sizeof(emr
);
199 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
202 BOOL CDECL
EMFDRV_BeginPath( PHYSDEV dev
)
206 emr
.emr
.iType
= EMR_BEGINPATH
;
207 emr
.emr
.nSize
= sizeof(emr
);
209 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
212 BOOL CDECL
EMFDRV_CloseFigure( PHYSDEV dev
)
216 emr
.emr
.iType
= EMR_CLOSEFIGURE
;
217 emr
.emr
.nSize
= sizeof(emr
);
219 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
222 BOOL CDECL
EMFDRV_EndPath( PHYSDEV dev
)
226 emr
.emr
.iType
= EMR_ENDPATH
;
227 emr
.emr
.nSize
= sizeof(emr
);
229 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
232 BOOL CDECL
EMFDRV_FillPath( PHYSDEV dev
)
236 emr
.emr
.iType
= EMR_FILLPATH
;
237 emr
.emr
.nSize
= sizeof(emr
);
239 emr
.rclBounds
.left
= 0;
240 emr
.rclBounds
.top
= 0;
241 emr
.rclBounds
.right
= 0;
242 emr
.rclBounds
.bottom
= 0;
243 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
246 BOOL CDECL
EMFDRV_FlattenPath( PHYSDEV dev
)
250 emr
.emr
.iType
= EMR_FLATTENPATH
;
251 emr
.emr
.nSize
= sizeof(emr
);
253 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
256 BOOL CDECL
EMFDRV_SelectClipPath( PHYSDEV dev
, INT iMode
)
258 EMRSELECTCLIPPATH emr
;
260 emr
.emr
.iType
= EMR_SELECTCLIPPATH
;
261 emr
.emr
.nSize
= sizeof(emr
);
264 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
267 BOOL CDECL
EMFDRV_StrokeAndFillPath( PHYSDEV dev
)
269 EMRSTROKEANDFILLPATH emr
;
271 emr
.emr
.iType
= EMR_STROKEANDFILLPATH
;
272 emr
.emr
.nSize
= sizeof(emr
);
274 emr
.rclBounds
.left
= 0;
275 emr
.rclBounds
.top
= 0;
276 emr
.rclBounds
.right
= 0;
277 emr
.rclBounds
.bottom
= 0;
278 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
281 BOOL CDECL
EMFDRV_StrokePath( PHYSDEV dev
)
285 emr
.emr
.iType
= EMR_STROKEPATH
;
286 emr
.emr
.nSize
= sizeof(emr
);
288 emr
.rclBounds
.left
= 0;
289 emr
.rclBounds
.top
= 0;
290 emr
.rclBounds
.right
= 0;
291 emr
.rclBounds
.bottom
= 0;
292 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
295 BOOL CDECL
EMFDRV_WidenPath( PHYSDEV dev
)
299 emr
.emr
.iType
= EMR_WIDENPATH
;
300 emr
.emr
.nSize
= sizeof(emr
);
302 return EMFDRV_WriteRecord( dev
, &emr
.emr
);
305 INT CDECL
EMFDRV_GetDeviceCaps(PHYSDEV dev
, INT cap
)
307 EMFDRV_PDEVICE
*physDev
= (EMFDRV_PDEVICE
*) dev
;
312 return physDev
->horzres
;
314 return physDev
->vertres
;
316 return physDev
->logpixelsx
;
318 return physDev
->logpixelsy
;
320 return physDev
->horzsize
;
322 return physDev
->vertsize
;
324 return physDev
->bitspixel
;
326 return physDev
->textcaps
;
328 return physDev
->rastercaps
;
330 return physDev
->technology
;
332 return physDev
->planes
;
334 return physDev
->numcolors
;
336 FIXME("Unimplemented cap %d\n", cap
);