msi: Make TransformView_Create static.
[wine.git] / tools / winedump / emf.c
blob8a04886571c1cdef9e5d75cd53d87c13e361f4b5
1 /*
2 * Dump an Enhanced Meta File
4 * Copyright 2005 Mike McCormack
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 "config.h"
23 #include <stdio.h>
24 #include <fcntl.h>
25 #include <stdarg.h>
27 #include "winedump.h"
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "gdiplusenums.h"
33 typedef struct
35 WORD Type;
36 WORD Flags;
37 DWORD Size;
38 DWORD DataSize;
39 } EmfPlusRecordHeader;
41 static const char *debugstr_wn(const WCHAR *wstr, unsigned int n)
43 static char buf[80];
44 char *p;
45 unsigned int i;
47 if (!wstr) return "(null)";
49 i = 0;
50 p = buf;
51 *p++ = '\"';
52 while (i < n && i < sizeof(buf) - 3 && wstr[i])
54 if (wstr[i] < 127) *p++ = wstr[i];
55 else *p++ = '.';
56 i++;
58 *p++ = '\"';
59 *p = 0;
60 return buf;
63 static const char *debugstr_rect(const RECTL *rect)
65 return strmake( "%d,%d - %d,%d",
66 (UINT)rect->left, (UINT)rect->top, (UINT)rect->right, (UINT)rect->bottom );
69 static unsigned int read_int(const unsigned char *buffer)
71 return buffer[0]
72 + (buffer[1]<<8)
73 + (buffer[2]<<16)
74 + (buffer[3]<<24);
77 #define EMRCASE(x) case x: printf("%s%-20s %08x\n", pfx, #x, length); break
78 #define EMRPLUSCASE(x) case x: printf("%s %-20s %04x %08x %08x\n", pfx, #x, \
79 (UINT)header->Flags, (UINT)header->Size, (UINT)header->DataSize); break
81 unsigned long dump_emfrecord(const char *pfx, unsigned long offset)
83 const unsigned char* ptr;
84 unsigned int type, length, i;
86 ptr = PRD(offset, 8);
87 if (!ptr) return 0;
89 type = read_int(ptr);
90 length = read_int(ptr + 4);
92 switch(type)
94 case EMR_HEADER:
96 const ENHMETAHEADER *header = PRD(offset, sizeof(*header));
98 printf("%s%-20s %08x\n", pfx, "EMR_HEADER", length);
99 printf("%sbounds (%s) frame (%s) signature %#x version %#x bytes %#x records %#x\n"
100 "%shandles %#x reserved %#x palette entries %#x px %dx%d mm %dx%d μm %dx%d opengl %d description %s\n",
101 pfx, debugstr_rect( &header->rclBounds ), debugstr_rect( &header->rclFrame ),
102 (UINT)header->dSignature, (UINT)header->nVersion, (UINT)header->nBytes,
103 (UINT)header->nRecords, pfx, (UINT)header->nHandles, header->sReserved, (UINT)header->nPalEntries,
104 (UINT)header->szlDevice.cx, (UINT)header->szlDevice.cy,
105 (UINT)header->szlMillimeters.cx, (UINT)header->szlMillimeters.cy,
106 (UINT)header->szlMicrometers.cx, (UINT)header->szlMicrometers.cy,
107 (UINT)header->bOpenGL,
108 debugstr_wn((LPCWSTR)((const BYTE *)header + header->offDescription), header->nDescription));
109 break;
112 EMRCASE(EMR_POLYBEZIER);
113 EMRCASE(EMR_POLYGON);
114 EMRCASE(EMR_POLYLINE);
115 EMRCASE(EMR_POLYBEZIERTO);
116 EMRCASE(EMR_POLYLINETO);
117 EMRCASE(EMR_POLYPOLYLINE);
118 EMRCASE(EMR_POLYPOLYGON);
119 EMRCASE(EMR_SETWINDOWEXTEX);
120 EMRCASE(EMR_SETWINDOWORGEX);
121 EMRCASE(EMR_SETVIEWPORTEXTEX);
122 EMRCASE(EMR_SETVIEWPORTORGEX);
123 EMRCASE(EMR_SETBRUSHORGEX);
124 EMRCASE(EMR_EOF);
125 EMRCASE(EMR_SETPIXELV);
126 EMRCASE(EMR_SETMAPPERFLAGS);
127 EMRCASE(EMR_SETMAPMODE);
128 EMRCASE(EMR_SETBKMODE);
129 EMRCASE(EMR_SETPOLYFILLMODE);
130 EMRCASE(EMR_SETROP2);
131 EMRCASE(EMR_SETSTRETCHBLTMODE);
132 EMRCASE(EMR_SETTEXTALIGN);
133 EMRCASE(EMR_SETCOLORADJUSTMENT);
134 EMRCASE(EMR_SETTEXTCOLOR);
135 EMRCASE(EMR_SETBKCOLOR);
136 EMRCASE(EMR_OFFSETCLIPRGN);
137 EMRCASE(EMR_MOVETOEX);
138 EMRCASE(EMR_SETMETARGN);
139 EMRCASE(EMR_EXCLUDECLIPRECT);
141 case EMR_INTERSECTCLIPRECT:
143 const EMRINTERSECTCLIPRECT *clip = PRD(offset, sizeof(*clip));
145 printf("%s%-20s %08x\n", pfx, "EMR_INTERSECTCLIPRECT", length);
146 printf("%srect %s\n", pfx, debugstr_rect( &clip->rclClip ));
147 break;
150 EMRCASE(EMR_SCALEVIEWPORTEXTEX);
151 EMRCASE(EMR_SCALEWINDOWEXTEX);
152 EMRCASE(EMR_SAVEDC);
153 EMRCASE(EMR_RESTOREDC);
154 EMRCASE(EMR_SETWORLDTRANSFORM);
155 EMRCASE(EMR_MODIFYWORLDTRANSFORM);
156 EMRCASE(EMR_SELECTOBJECT);
157 EMRCASE(EMR_CREATEPEN);
158 EMRCASE(EMR_CREATEBRUSHINDIRECT);
159 EMRCASE(EMR_DELETEOBJECT);
160 EMRCASE(EMR_ANGLEARC);
161 EMRCASE(EMR_ELLIPSE);
162 EMRCASE(EMR_RECTANGLE);
163 EMRCASE(EMR_ROUNDRECT);
164 EMRCASE(EMR_ARC);
165 EMRCASE(EMR_CHORD);
166 EMRCASE(EMR_PIE);
167 EMRCASE(EMR_SELECTPALETTE);
168 EMRCASE(EMR_CREATEPALETTE);
169 EMRCASE(EMR_SETPALETTEENTRIES);
170 EMRCASE(EMR_RESIZEPALETTE);
171 EMRCASE(EMR_REALIZEPALETTE);
172 EMRCASE(EMR_EXTFLOODFILL);
173 EMRCASE(EMR_LINETO);
174 EMRCASE(EMR_ARCTO);
175 EMRCASE(EMR_POLYDRAW);
176 EMRCASE(EMR_SETARCDIRECTION);
177 EMRCASE(EMR_SETMITERLIMIT);
178 EMRCASE(EMR_BEGINPATH);
179 EMRCASE(EMR_ENDPATH);
180 EMRCASE(EMR_CLOSEFIGURE);
181 EMRCASE(EMR_FILLPATH);
182 EMRCASE(EMR_STROKEANDFILLPATH);
183 EMRCASE(EMR_STROKEPATH);
184 EMRCASE(EMR_FLATTENPATH);
185 EMRCASE(EMR_WIDENPATH);
186 EMRCASE(EMR_SELECTCLIPPATH);
187 EMRCASE(EMR_ABORTPATH);
189 case EMR_GDICOMMENT:
191 printf("%s%-20s %08x\n", pfx, "EMR_GDICOMMENT", length);
193 /* Handle EMF+ records */
194 if (length >= 16 && !memcmp((char*)PRD(offset + 12, sizeof(unsigned int)), "EMF+", 4))
196 const EmfPlusRecordHeader *header;
197 const unsigned int *data_size;
199 offset += 8;
200 length -= 8;
201 data_size = PRD(offset, sizeof(*data_size));
202 printf("%sdata size = %x\n", pfx, *data_size);
203 offset += 8;
204 length -= 8;
206 while (length >= sizeof(*header))
208 header = PRD(offset, sizeof(*header));
209 switch(header->Type)
211 EMRPLUSCASE(EmfPlusRecordTypeInvalid);
212 EMRPLUSCASE(EmfPlusRecordTypeHeader);
213 EMRPLUSCASE(EmfPlusRecordTypeEndOfFile);
214 EMRPLUSCASE(EmfPlusRecordTypeComment);
215 EMRPLUSCASE(EmfPlusRecordTypeGetDC);
216 EMRPLUSCASE(EmfPlusRecordTypeMultiFormatStart);
217 EMRPLUSCASE(EmfPlusRecordTypeMultiFormatSection);
218 EMRPLUSCASE(EmfPlusRecordTypeMultiFormatEnd);
219 EMRPLUSCASE(EmfPlusRecordTypeObject);
220 EMRPLUSCASE(EmfPlusRecordTypeClear);
221 EMRPLUSCASE(EmfPlusRecordTypeFillRects);
222 EMRPLUSCASE(EmfPlusRecordTypeDrawRects);
223 EMRPLUSCASE(EmfPlusRecordTypeFillPolygon);
224 EMRPLUSCASE(EmfPlusRecordTypeDrawLines);
225 EMRPLUSCASE(EmfPlusRecordTypeFillEllipse);
226 EMRPLUSCASE(EmfPlusRecordTypeDrawEllipse);
227 EMRPLUSCASE(EmfPlusRecordTypeFillPie);
228 EMRPLUSCASE(EmfPlusRecordTypeDrawPie);
229 EMRPLUSCASE(EmfPlusRecordTypeDrawArc);
230 EMRPLUSCASE(EmfPlusRecordTypeFillRegion);
231 EMRPLUSCASE(EmfPlusRecordTypeFillPath);
232 EMRPLUSCASE(EmfPlusRecordTypeDrawPath);
233 EMRPLUSCASE(EmfPlusRecordTypeFillClosedCurve);
234 EMRPLUSCASE(EmfPlusRecordTypeDrawClosedCurve);
235 EMRPLUSCASE(EmfPlusRecordTypeDrawCurve);
236 EMRPLUSCASE(EmfPlusRecordTypeDrawBeziers);
237 EMRPLUSCASE(EmfPlusRecordTypeDrawImage);
238 EMRPLUSCASE(EmfPlusRecordTypeDrawImagePoints);
239 EMRPLUSCASE(EmfPlusRecordTypeDrawString);
240 EMRPLUSCASE(EmfPlusRecordTypeSetRenderingOrigin);
241 EMRPLUSCASE(EmfPlusRecordTypeSetAntiAliasMode);
242 EMRPLUSCASE(EmfPlusRecordTypeSetTextRenderingHint);
243 EMRPLUSCASE(EmfPlusRecordTypeSetTextContrast);
244 EMRPLUSCASE(EmfPlusRecordTypeSetInterpolationMode);
245 EMRPLUSCASE(EmfPlusRecordTypeSetPixelOffsetMode);
246 EMRPLUSCASE(EmfPlusRecordTypeSetCompositingMode);
247 EMRPLUSCASE(EmfPlusRecordTypeSetCompositingQuality);
248 EMRPLUSCASE(EmfPlusRecordTypeSave);
249 EMRPLUSCASE(EmfPlusRecordTypeRestore);
250 EMRPLUSCASE(EmfPlusRecordTypeBeginContainer);
251 EMRPLUSCASE(EmfPlusRecordTypeBeginContainerNoParams);
252 EMRPLUSCASE(EmfPlusRecordTypeEndContainer);
253 EMRPLUSCASE(EmfPlusRecordTypeSetWorldTransform);
254 EMRPLUSCASE(EmfPlusRecordTypeResetWorldTransform);
255 EMRPLUSCASE(EmfPlusRecordTypeMultiplyWorldTransform);
256 EMRPLUSCASE(EmfPlusRecordTypeTranslateWorldTransform);
257 EMRPLUSCASE(EmfPlusRecordTypeScaleWorldTransform);
258 EMRPLUSCASE(EmfPlusRecordTypeRotateWorldTransform);
259 EMRPLUSCASE(EmfPlusRecordTypeSetPageTransform);
260 EMRPLUSCASE(EmfPlusRecordTypeResetClip);
261 EMRPLUSCASE(EmfPlusRecordTypeSetClipRect);
262 EMRPLUSCASE(EmfPlusRecordTypeSetClipPath);
263 EMRPLUSCASE(EmfPlusRecordTypeSetClipRegion);
264 EMRPLUSCASE(EmfPlusRecordTypeOffsetClip);
265 EMRPLUSCASE(EmfPlusRecordTypeDrawDriverString);
266 EMRPLUSCASE(EmfPlusRecordTypeStrokeFillPath);
267 EMRPLUSCASE(EmfPlusRecordTypeSerializableObject);
268 EMRPLUSCASE(EmfPlusRecordTypeSetTSGraphics);
269 EMRPLUSCASE(EmfPlusRecordTypeSetTSClip);
270 EMRPLUSCASE(EmfPlusRecordTotal);
272 default:
273 printf("%s unknown EMF+ record %x %04x %08x\n",
274 pfx, (UINT)header->Type, (UINT)header->Flags, (UINT)header->Size);
275 break;
278 if (length<sizeof(*header) || header->Size%4)
279 return 0;
281 length -= sizeof(*header);
282 offset += sizeof(*header);
284 for (i=0; i<header->Size-sizeof(*header); i+=4)
286 if (i%16 == 0)
287 printf("%s ", pfx);
288 if (!(ptr = PRD(offset, 4))) return 0;
289 length -= 4;
290 offset += 4;
291 printf("%08x ", read_int(ptr));
292 if ((i % 16 == 12) || (i + 4 == header->Size - sizeof(*header)))
293 printf("\n");
297 return offset;
300 break;
303 EMRCASE(EMR_FILLRGN);
304 EMRCASE(EMR_FRAMERGN);
305 EMRCASE(EMR_INVERTRGN);
306 EMRCASE(EMR_PAINTRGN);
308 case EMR_EXTSELECTCLIPRGN:
310 const EMREXTSELECTCLIPRGN *clip = PRD(offset, sizeof(*clip));
311 const RGNDATA *data = (const RGNDATA *)clip->RgnData;
312 UINT i, rc_count = 0;
313 const RECTL *rc;
315 if (length >= sizeof(*clip) + sizeof(*data))
316 rc_count = data->rdh.nCount;
318 printf("%s%-20s %08x\n", pfx, "EMR_EXTSELECTCLIPRGN", length);
319 printf("%smode %d, rects %d\n", pfx, (UINT)clip->iMode, rc_count);
320 for (i = 0, rc = (const RECTL *)data->Buffer; i < rc_count; i++)
321 printf("%s (%s)", pfx, debugstr_rect( &rc[i] ));
322 if (rc_count != 0) printf("\n");
323 break;
326 EMRCASE(EMR_BITBLT);
328 case EMR_STRETCHBLT:
330 const EMRSTRETCHBLT *blt = PRD(offset, sizeof(*blt));
331 const BITMAPINFOHEADER *bmih = (const BITMAPINFOHEADER *)((const unsigned char *)blt + blt->offBmiSrc);
333 printf("%s%-20s %08x\n", pfx, "EMR_STRETCHBLT", length);
334 printf("%sbounds (%s) dst %d,%d %dx%d src %d,%d %dx%d rop %#x xform (%f, %f, %f, %f, %f, %f)\n"
335 "%sbk_color %#x usage %#x bmi_offset %#x bmi_size %#x bits_offset %#x bits_size %#x\n",
336 pfx, debugstr_rect( &blt->rclBounds ), (UINT)blt->xDest, (UINT)blt->yDest, (UINT)blt->cxDest, (UINT)blt->cyDest,
337 (UINT)blt->xSrc, (UINT)blt->ySrc, (UINT)blt->cxSrc, (UINT)blt->cySrc, (UINT)blt->dwRop,
338 blt->xformSrc.eM11, blt->xformSrc.eM12, blt->xformSrc.eM21,
339 blt->xformSrc.eM22, blt->xformSrc.eDx, blt->xformSrc.eDy,
340 pfx, (UINT)blt->crBkColorSrc, (UINT)blt->iUsageSrc, (UINT)blt->offBmiSrc, (UINT)blt->cbBmiSrc,
341 (UINT)blt->offBitsSrc, (UINT)blt->cbBitsSrc);
342 printf("%sBITMAPINFOHEADER biSize %#x biWidth %d biHeight %d biPlanes %d biBitCount %d biCompression %#x\n"
343 "%sbiSizeImage %#x biXPelsPerMeter %d biYPelsPerMeter %d biClrUsed %#x biClrImportant %#x\n",
344 pfx, (UINT)bmih->biSize, (UINT)bmih->biWidth, (UINT)bmih->biHeight, (UINT)bmih->biPlanes,
345 (UINT)bmih->biBitCount, (UINT)bmih->biCompression, pfx, (UINT)bmih->biSizeImage,
346 (UINT)bmih->biXPelsPerMeter, (UINT)bmih->biYPelsPerMeter, (UINT)bmih->biClrUsed,
347 (UINT)bmih->biClrImportant);
348 break;
351 EMRCASE(EMR_MASKBLT);
352 EMRCASE(EMR_PLGBLT);
353 EMRCASE(EMR_SETDIBITSTODEVICE);
354 EMRCASE(EMR_STRETCHDIBITS);
356 case EMR_EXTCREATEFONTINDIRECTW:
358 const EMREXTCREATEFONTINDIRECTW *pf = PRD(offset, sizeof(*pf));
359 const LOGFONTW *plf = &pf->elfw.elfLogFont;
361 printf("%s%-20s %08x\n", pfx, "EMR_EXTCREATEFONTINDIRECTW", length);
362 printf("%s(%d %d %d %d %x out %d clip %x quality %d charset %d) %s %s %s %s\n",
363 pfx, (UINT)plf->lfHeight, (UINT)plf->lfWidth, (UINT)plf->lfEscapement, (UINT)plf->lfOrientation,
364 (UINT)plf->lfPitchAndFamily, (UINT)plf->lfOutPrecision, (UINT)plf->lfClipPrecision,
365 plf->lfQuality, plf->lfCharSet,
366 debugstr_wn(plf->lfFaceName, LF_FACESIZE),
367 plf->lfWeight > 400 ? "Bold" : "",
368 plf->lfItalic ? "Italic" : "",
369 plf->lfUnderline ? "Underline" : "");
370 break;
373 EMRCASE(EMR_EXTTEXTOUTA);
375 case EMR_EXTTEXTOUTW:
377 const EMREXTTEXTOUTW *etoW = PRD(offset, sizeof(*etoW));
378 const int *dx = (const int *)((const BYTE *)etoW + etoW->emrtext.offDx);
380 printf("%s%-20s %08x\n", pfx, "EMR_EXTTEXTOUTW", length);
381 printf("%sbounds (%s) mode %#x x_scale %f y_scale %f pt (%d,%d) rect (%s) flags %#x, %s\n",
382 pfx, debugstr_rect( &etoW->rclBounds ), (UINT)etoW->iGraphicsMode, etoW->exScale, etoW->eyScale,
383 (UINT)etoW->emrtext.ptlReference.x, (UINT)etoW->emrtext.ptlReference.y,
384 debugstr_rect( &etoW->emrtext.rcl ), (UINT)etoW->emrtext.fOptions,
385 debugstr_wn((LPCWSTR)((const BYTE *)etoW + etoW->emrtext.offString), etoW->emrtext.nChars));
386 printf("%sdx_offset %u {", pfx, (UINT)etoW->emrtext.offDx);
387 for (i = 0; i < etoW->emrtext.nChars; ++i)
389 printf("%d", dx[i]);
390 if (i != etoW->emrtext.nChars - 1)
391 putchar(',');
393 printf("}\n");
394 break;
397 EMRCASE(EMR_POLYBEZIER16);
398 EMRCASE(EMR_POLYGON16);
399 EMRCASE(EMR_POLYLINE16);
400 EMRCASE(EMR_POLYBEZIERTO16);
401 EMRCASE(EMR_POLYLINETO16);
402 EMRCASE(EMR_POLYPOLYLINE16);
403 EMRCASE(EMR_POLYPOLYGON16);
404 EMRCASE(EMR_POLYDRAW16);
405 EMRCASE(EMR_CREATEMONOBRUSH);
406 EMRCASE(EMR_CREATEDIBPATTERNBRUSHPT);
407 EMRCASE(EMR_EXTCREATEPEN);
408 EMRCASE(EMR_POLYTEXTOUTA);
409 EMRCASE(EMR_POLYTEXTOUTW);
410 EMRCASE(EMR_SETICMMODE);
411 EMRCASE(EMR_CREATECOLORSPACE);
412 EMRCASE(EMR_SETCOLORSPACE);
413 EMRCASE(EMR_DELETECOLORSPACE);
414 EMRCASE(EMR_GLSRECORD);
415 EMRCASE(EMR_GLSBOUNDEDRECORD);
416 EMRCASE(EMR_PIXELFORMAT);
417 EMRCASE(EMR_DRAWESCAPE);
418 EMRCASE(EMR_EXTESCAPE);
419 EMRCASE(EMR_STARTDOC);
420 EMRCASE(EMR_SMALLTEXTOUT);
421 EMRCASE(EMR_FORCEUFIMAPPING);
422 EMRCASE(EMR_NAMEDESCAPE);
423 EMRCASE(EMR_COLORCORRECTPALETTE);
424 EMRCASE(EMR_SETICMPROFILEA);
425 EMRCASE(EMR_SETICMPROFILEW);
427 case EMR_ALPHABLEND:
429 const EMRALPHABLEND *blend = PRD(offset, sizeof(*blend));
430 const BITMAPINFOHEADER *bmih = (const BITMAPINFOHEADER *)((const unsigned char *)blend + blend->offBmiSrc);
432 printf("%s%-20s %08x\n", pfx, "EMR_ALPHABLEND", length);
433 printf("%sbounds (%s) dst %d,%d %dx%d src %d,%d %dx%d rop %#x xform (%f, %f, %f, %f, %f, %f)\n"
434 "%sbk_color %#x usage %#x bmi_offset %#x bmi_size %#x bits_offset %#x bits_size %#x\n",
435 pfx, debugstr_rect( &blend->rclBounds ), (UINT)blend->xDest, (UINT)blend->yDest, (UINT)blend->cxDest, (UINT)blend->cyDest,
436 (UINT)blend->xSrc, (UINT)blend->ySrc, (UINT)blend->cxSrc, (UINT)blend->cySrc,
437 (UINT)blend->dwRop, blend->xformSrc.eM11, blend->xformSrc.eM12, blend->xformSrc.eM21,
438 blend->xformSrc.eM22, blend->xformSrc.eDx, blend->xformSrc.eDy,
439 pfx, (UINT)blend->crBkColorSrc, (UINT)blend->iUsageSrc, (UINT)blend->offBmiSrc,
440 (UINT)blend->cbBmiSrc, (UINT)blend->offBitsSrc, (UINT)blend->cbBitsSrc);
441 printf("%sBITMAPINFOHEADER biSize %#x biWidth %d biHeight %d biPlanes %d biBitCount %d biCompression %#x\n"
442 "%sbiSizeImage %#x biXPelsPerMeter %d biYPelsPerMeter %d biClrUsed %#x biClrImportant %#x\n",
443 pfx, (UINT)bmih->biSize, (UINT)bmih->biWidth, (UINT)bmih->biHeight, (UINT)bmih->biPlanes,
444 (UINT)bmih->biBitCount, (UINT)bmih->biCompression, pfx, (UINT)bmih->biSizeImage,
445 (UINT)bmih->biXPelsPerMeter, (UINT)bmih->biYPelsPerMeter, (UINT)bmih->biClrUsed,
446 (UINT)bmih->biClrImportant);
447 break;
450 EMRCASE(EMR_SETLAYOUT);
451 EMRCASE(EMR_TRANSPARENTBLT);
452 EMRCASE(EMR_RESERVED_117);
453 EMRCASE(EMR_GRADIENTFILL);
454 EMRCASE(EMR_SETLINKEDUFI);
455 EMRCASE(EMR_SETTEXTJUSTIFICATION);
456 EMRCASE(EMR_COLORMATCHTOTARGETW);
457 EMRCASE(EMR_CREATECOLORSPACEW);
459 default:
460 printf("%s%u %08x\n", pfx, type, length);
461 break;
464 if ( (length < 8) || (length % 4) )
465 return 0;
467 length -= 8;
469 offset += 8;
471 for(i=0; i<length; i+=4)
473 if (i%16 == 0)
474 printf("%s ", pfx);
475 if (!(ptr = PRD(offset, 4))) return 0;
476 offset += 4;
477 printf("%08x ", read_int(ptr));
478 if ( (i % 16 == 12) || (i + 4 == length))
479 printf("\n");
482 return offset;
485 enum FileSig get_kind_emf(void)
487 const ENHMETAHEADER* hdr;
489 hdr = PRD(0, sizeof(*hdr));
490 if (hdr && hdr->iType == EMR_HEADER && hdr->dSignature == ENHMETA_SIGNATURE)
491 return SIG_EMF;
492 return SIG_UNKNOWN;
495 void emf_dump(void)
497 unsigned long offset = 0;
498 while ((offset = dump_emfrecord("", offset)));