libemf  1.0.9
libemf.h
1 /* -*- c++ -*-
2  * EMF: A library for generating ECMA-234 Enhanced Metafiles
3  * Copyright (C) 2002, 2003 lignum Computing, Inc. <dallenbarnett@users.sourceforge.net>
4  * $Id: libemf.h 82 2018-12-31 16:54:24Z dallenbarnett $
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21 #ifndef _LIBEMF_H
22 #define _LIBEMF_H 1
23 
24 #include <cmath>
25 #include <vector>
26 #include <map>
27 #include <functional>
28 #include <algorithm>
29 #include <stdexcept>
30 
31 #include <config.h>
32 #include <libEMF/emf.h>
33 
34 #include <libEMF/wine/w16.h>
35 
36 #ifdef ENABLE_EDITING
37 #include <iconv.h>
38 #include <errno.h>
39 #endif
40 
41 #define EMF_UNUSED(x) (void)x;
42 
43 namespace EMF {
48 #if 1
49  const int XMAX_PIXELS = 1024; /*(INT_MAX)*/
50 #else
51  const int XMAX_PIXELS = 1280; /*(INT_MAX)*/
52 #endif
53 
57 #if 1
58  const int YMAX_PIXELS = 768; /*(INT_MAX)*/
59 #else
60  const int YMAX_PIXELS = 1024; /*(INT_MAX)*/
61 #endif
62 
67  const int XMAX_MM = 320;
73  const int YMAX_MM = 240;
77  const int RESOLUTION = 96;
81  static inline int ROUND_TO_LONG ( int n ) { return ((n+3)/4)*4; }
82 
84 
89  struct WCHARSTR {
90  WCHAR *const string_;
91  const int length_;
92 
97  WCHARSTR ( WCHAR *const string, const int length )
98  : string_( string ), length_( length ) {}
99  };
100 
102 
107  struct CHARSTR {
108  CHAR *const string_;
109  const int length_;
110 
115  CHARSTR ( CHAR *const string, const int length )
116  : string_( string ), length_( length ) {}
117  };
118 
120 
124  struct BYTEARRAY {
125  BYTE *const array_;
126  const int n_;
127 
132  BYTEARRAY ( BYTE *const array, const int n )
133  : array_( array ), n_( n ) {}
134  };
135 
137 
140  struct POINTLARRAY {
141  POINTL *const points_;
142  const DWORD n_;
143 
148  POINTLARRAY ( POINTL *const points, const DWORD n )
149  : points_( points ), n_( n ) {}
150  };
151 
153 
156  struct POINT16ARRAY {
157  POINT16 *const points_;
158  const DWORD n_;
159 
164  POINT16ARRAY ( POINT16 *const points, const DWORD n )
165  : points_( points ), n_( n ) {}
166  };
167 
169 
172  struct INTARRAY {
173  INT *const ints_;
174  const DWORD n_;
175 
180  INTARRAY ( INT *const ints, const DWORD n )
181  : ints_( ints ), n_( n ) {}
182  };
183 
185 
188  struct DWORDARRAY {
189  DWORD *const dwords_;
190  const DWORD n_;
191 
196  DWORDARRAY ( DWORD *const dwords, const DWORD n )
197  : dwords_( dwords ), n_( n ) {}
198  };
199 
201 
204  struct PADDING {
205  static const char padding_[4];
206  const int size_;
207 
211  PADDING ( const int size ) : size_( size ) {}
212  };
213 
215 
222  class DATASTREAM {
223  bool swap_;
224  ::FILE* fp_;
225 
226  static bool bigEndian ( void );
227  public:
233  DATASTREAM ( ::FILE* fp = 0 ) : swap_( bigEndian() ), fp_( fp ) {}
238  void setStream ( ::FILE* fp ) { fp_ = fp; }
243  DATASTREAM& operator<< ( const BYTE& byte )
244  {
245  fwrite( &byte, sizeof(BYTE), 1, fp_ );
246  return *this;
247  }
252  DATASTREAM& operator>> ( BYTE& byte )
253  {
254  fread( &byte, sizeof(BYTE), 1, fp_ );
255  return *this;
256  }
261  DATASTREAM& operator<< ( const WORD& word )
262  {
263  if ( swap_ ) {
264  unsigned char const * p = (unsigned char const*)&word;
265  fwrite( &p[1], sizeof(unsigned char), 1, fp_ );
266  fwrite( &p[0], sizeof(unsigned char), 1, fp_ );
267  }
268  else
269  fwrite( &word, sizeof(WORD), 1, fp_ );
270  return *this;
271  }
276  DATASTREAM& operator>> ( WORD& word )
277  {
278  if ( swap_ ) {
279  unsigned char* p = (unsigned char*)&word;
280  fread( &p[1], sizeof(unsigned char), 1, fp_ );
281  fread( &p[0], sizeof(unsigned char), 1, fp_ );
282  }
283  else
284  fread( &word, sizeof(WORD), 1, fp_ );
285  return *this;
286  }
291  DATASTREAM& operator<< ( const INT16& word )
292  {
293  if ( swap_ ) {
294  unsigned char const * p = (unsigned char const*)&word;
295  fwrite( &p[1], sizeof(unsigned char), 1, fp_ );
296  fwrite( &p[0], sizeof(unsigned char), 1, fp_ );
297  }
298  else
299  fwrite( &word, sizeof(INT16), 1, fp_ );
300  return *this;
301  }
306  DATASTREAM& operator>> ( INT16& word )
307  {
308  if ( swap_ ) {
309  unsigned char* p = (unsigned char*)&word;
310  fread( &p[1], sizeof(unsigned char), 1, fp_ );
311  fread( &p[0], sizeof(unsigned char), 1, fp_ );
312  }
313  else
314  fread( &word, sizeof(INT16), 1, fp_ );
315  return *this;
316  }
321  DATASTREAM& operator<< ( const DWORD& dword )
322  {
323  if ( swap_ ) {
324  unsigned char const* p = (unsigned char const*)&dword;
325  fwrite( &p[3], sizeof(unsigned char), 1, fp_ );
326  fwrite( &p[2], sizeof(unsigned char), 1, fp_ );
327  fwrite( &p[1], sizeof(unsigned char), 1, fp_ );
328  fwrite( &p[0], sizeof(unsigned char), 1, fp_ );
329  }
330  else
331  fwrite( &dword, sizeof(DWORD), 1, fp_ );
332  return *this;
333  }
338  DATASTREAM& operator>> ( DWORD& dword )
339  {
340  if ( swap_ ) {
341  unsigned char* p = (unsigned char*)&dword;
342  fread( &p[3], sizeof(unsigned char), 1, fp_ );
343  fread( &p[2], sizeof(unsigned char), 1, fp_ );
344  fread( &p[1], sizeof(unsigned char), 1, fp_ );
345  fread( &p[0], sizeof(unsigned char), 1, fp_ );
346  }
347  else
348  fread( &dword, sizeof(DWORD), 1, fp_ );
349  return *this;
350  }
351 #if !defined( __LP64__ )
352 
356  DATASTREAM& operator<< ( const LONG& long_ )
357  {
358  if ( swap_ ) {
359  unsigned char const* p = (unsigned char const*)&long_;
360  fwrite( &p[3], sizeof(unsigned char), 1, fp_ );
361  fwrite( &p[2], sizeof(unsigned char), 1, fp_ );
362  fwrite( &p[1], sizeof(unsigned char), 1, fp_ );
363  fwrite( &p[0], sizeof(unsigned char), 1, fp_ );
364  }
365  else
366  fwrite( &long_, sizeof(LONG), 1, fp_ );
367  return *this;
368  }
373  DATASTREAM& operator>> ( LONG& long_ )
374  {
375  if ( swap_ ) {
376  unsigned char* p = (unsigned char*)&long_;
377  fread( &p[3], sizeof(unsigned char), 1, fp_ );
378  fread( &p[2], sizeof(unsigned char), 1, fp_ );
379  fread( &p[1], sizeof(unsigned char), 1, fp_ );
380  fread( &p[0], sizeof(unsigned char), 1, fp_ );
381  }
382  else
383  fread( &long_, sizeof(LONG), 1, fp_ );
384  return *this;
385  }
386 #endif /* __x86_64__ */
387 
391  DATASTREAM& operator<< ( const INT& int_ )
392  {
393  if ( swap_ ) {
394  unsigned char const* p = (unsigned char const*)&int_;
395  fwrite( &p[3], sizeof(unsigned char), 1, fp_ );
396  fwrite( &p[2], sizeof(unsigned char), 1, fp_ );
397  fwrite( &p[1], sizeof(unsigned char), 1, fp_ );
398  fwrite( &p[0], sizeof(unsigned char), 1, fp_ );
399  }
400  else
401  fwrite( &int_, sizeof(INT), 1, fp_ );
402  return *this;
403  }
408  DATASTREAM& operator>> ( INT& int_ )
409  {
410  if ( swap_ ) {
411  unsigned char* p = (unsigned char*)&int_;
412  fread( &p[3], sizeof(unsigned char), 1, fp_ );
413  fread( &p[2], sizeof(unsigned char), 1, fp_ );
414  fread( &p[1], sizeof(unsigned char), 1, fp_ );
415  fread( &p[0], sizeof(unsigned char), 1, fp_ );
416  }
417  else
418  fread( &int_, sizeof(INT), 1, fp_ );
419  return *this;
420  }
421 #if !defined(__LP64__)
422 
426  DATASTREAM& operator<< ( const UINT& uint )
427  {
428  if ( swap_ ) {
429  unsigned char const* p = (unsigned char const*)&uint;
430  fwrite( &p[3], sizeof(unsigned char), 1, fp_ );
431  fwrite( &p[2], sizeof(unsigned char), 1, fp_ );
432  fwrite( &p[1], sizeof(unsigned char), 1, fp_ );
433  fwrite( &p[0], sizeof(unsigned char), 1, fp_ );
434  }
435  else
436  fwrite( &uint, sizeof(UINT), 1, fp_ );
437  return *this;
438  }
443  DATASTREAM& operator>> ( UINT& uint )
444  {
445  if ( swap_ ) {
446  unsigned char* p = (unsigned char*)&uint;
447  fread( &p[3], sizeof(unsigned char), 1, fp_ );
448  fread( &p[2], sizeof(unsigned char), 1, fp_ );
449  fread( &p[1], sizeof(unsigned char), 1, fp_ );
450  fread( &p[0], sizeof(unsigned char), 1, fp_ );
451  }
452  else
453  fread( &uint, sizeof(UINT), 1, fp_ );
454  return *this;
455  }
456 #endif /* !__x86_64__ */
457 
461  DATASTREAM& operator<< ( const FLOAT& float_ )
462  {
463  if ( swap_ ) {
464  unsigned char const* p = (unsigned char const*)&float_;
465  fwrite( &p[3], sizeof(unsigned char), 1, fp_ );
466  fwrite( &p[2], sizeof(unsigned char), 1, fp_ );
467  fwrite( &p[1], sizeof(unsigned char), 1, fp_ );
468  fwrite( &p[0], sizeof(unsigned char), 1, fp_ );
469  }
470  else
471  fwrite( &float_, sizeof(FLOAT), 1, fp_ );
472  return *this;
473  }
478  DATASTREAM& operator>> ( FLOAT& float_ )
479  {
480  if ( swap_ ) {
481  unsigned char* p = (unsigned char*)&float_;
482  fread( &p[3], sizeof(unsigned char), 1, fp_ );
483  fread( &p[2], sizeof(unsigned char), 1, fp_ );
484  fread( &p[1], sizeof(unsigned char), 1, fp_ );
485  fread( &p[0], sizeof(unsigned char), 1, fp_ );
486  }
487  else
488  fread( &float_, sizeof(FLOAT), 1, fp_ );
489  return *this;
490  }
495  DATASTREAM& operator<< ( const PADDING& padding )
496  {
497  if ( padding.size_ != 0 )
498  fwrite( &padding.padding_, sizeof(CHAR), padding.size_, fp_ );
499  return *this;
500  }
505  DATASTREAM& operator<< ( const RECTL& rectl )
506  {
507  *this << rectl.left << rectl.top << rectl.right << rectl.bottom;
508  return *this;
509  }
514  DATASTREAM& operator>> ( RECTL& rectl )
515  {
516  *this >> rectl.left >> rectl.top >> rectl.right >> rectl.bottom;
517  return *this;
518  }
523  DATASTREAM& operator<< ( const SIZEL& sizel )
524  {
525  *this << sizel.cx << sizel.cy;
526  return *this;
527  }
532  DATASTREAM& operator>> ( SIZEL& sizel )
533  {
534  *this >> sizel.cx >> sizel.cy;
535  return *this;
536  }
541  DATASTREAM& operator<< ( const WCHARSTR& wcharstr )
542  {
543  for ( int i = 0; i < wcharstr.length_; i++ )
544  *this << wcharstr.string_[i];
545  return *this;
546  }
551  DATASTREAM& operator>> ( WCHARSTR& wcharstr )
552  {
553  for ( int i = 0; i < wcharstr.length_; i++ )
554  *this >> wcharstr.string_[i];
555  return *this;
556  }
561  DATASTREAM& operator<< ( const CHARSTR& charstr )
562  {
563  fwrite( charstr.string_, sizeof(CHAR), charstr.length_, fp_ );
564  return *this;
565  }
570  DATASTREAM& operator>> ( CHARSTR& charstr )
571  {
572  fread( charstr.string_, sizeof(CHAR), charstr.length_, fp_ );
573  return *this;
574  }
579  DATASTREAM& operator<< ( const ::EMR& emr )
580  {
581  *this << emr.iType << emr.nSize;
582  return *this;
583  }
588  DATASTREAM& operator>> ( ::EMR& emr )
589  {
590  *this >> emr.iType >> emr.nSize;
591  return *this;
592  }
597  DATASTREAM& operator<< ( const POINT& point )
598  {
599  *this << point.x << point.y;
600  return *this;
601  }
606  DATASTREAM& operator>> ( POINT& point )
607  {
608  *this >> point.x >> point.y;
609  return *this;
610  }
615  DATASTREAM& operator<< ( const POINTL& pointl )
616  {
617  *this << pointl.x << pointl.y;
618  return *this;
619  }
624  DATASTREAM& operator>> ( POINTL& pointl )
625  {
626  *this >> pointl.x >> pointl.y;
627  return *this;
628  }
633  DATASTREAM& operator<< ( const POINT16& point )
634  {
635  *this << point.x << point.y;
636  return *this;
637  }
642  DATASTREAM& operator>> ( POINT16& point )
643  {
644  *this >> point.x >> point.y;
645  return *this;
646  }
651  DATASTREAM& operator<< ( const XFORM& xform )
652  {
653  *this << xform.eM11 << xform.eM12 << xform.eM21 << xform.eM22
654  << xform.eDx << xform.eDy;
655  return *this;
656  }
661  DATASTREAM& operator>> ( XFORM& xform )
662  {
663  *this >> xform.eM11 >> xform.eM12 >> xform.eM21 >> xform.eM22
664  >> xform.eDx >> xform.eDy;
665  return *this;
666  }
671  DATASTREAM& operator<< ( const BYTEARRAY& array )
672  {
673  fwrite( array.array_, sizeof(BYTE), array.n_, fp_ );
674  return *this;
675  }
680  DATASTREAM& operator>> ( BYTEARRAY& array )
681  {
682  fread( array.array_, sizeof(BYTE), array.n_, fp_ );
683  return *this;
684  }
689  DATASTREAM& operator<< ( const POINTLARRAY& array )
690  {
691  for ( unsigned int i = 0; i < array.n_; i++ )
692  *this << array.points_[i];
693  return *this;
694  }
699  DATASTREAM& operator>> ( POINTLARRAY& array )
700  {
701  for ( unsigned int i = 0; i < array.n_; i++ )
702  *this >> array.points_[i];
703  return *this;
704  }
709  DATASTREAM& operator<< ( const POINT16ARRAY& array )
710  {
711  for ( unsigned int i = 0; i < array.n_; i++ )
712  *this << array.points_[i];
713  return *this;
714  }
719  DATASTREAM& operator>> ( POINT16ARRAY& array )
720  {
721  for ( unsigned int i = 0; i < array.n_; i++ )
722  *this >> array.points_[i];
723  return *this;
724  }
729  DATASTREAM& operator<< ( const INTARRAY& array )
730  {
731  for ( unsigned int i = 0; i < array.n_; i++ )
732  *this << array.ints_[i];
733  return *this;
734  }
739  DATASTREAM& operator>> ( INTARRAY& array )
740  {
741  for ( unsigned int i = 0; i < array.n_; i++ )
742  *this >> array.ints_[i];
743  return *this;
744  }
749  DATASTREAM& operator<< ( const DWORDARRAY& array )
750  {
751  for ( unsigned int i = 0; i < array.n_; i++ )
752  *this << array.dwords_[i];
753  return *this;
754  }
759  DATASTREAM& operator>> ( DWORDARRAY& array )
760  {
761  for ( unsigned int i = 0; i < array.n_; i++ )
762  *this >> array.dwords_[i];
763  return *this;
764  }
769  DATASTREAM& operator<< ( const ::EMRTEXT& text )
770  {
771  *this << text.ptlReference << text.nChars << text.offString << text.fOptions
772  << text.rcl << text.offDx;
773  return *this;
774  }
779  DATASTREAM& operator>> ( ::EMRTEXT& text )
780  {
781  *this >> text.ptlReference >> text.nChars >> text.offString >> text.fOptions
782  >> text.rcl >> text.offDx;
783  return *this;
784  }
789  DATASTREAM& operator<< ( const LOGPEN& pen )
790  {
791  *this << pen.lopnStyle << pen.lopnWidth << pen.lopnColor;
792  return *this;
793  }
798  DATASTREAM& operator>> ( LOGPEN& pen )
799  {
800  *this >> pen.lopnStyle >> pen.lopnWidth >> pen.lopnColor;
801  return *this;
802  }
807  DATASTREAM& operator<< ( const EXTLOGPEN& pen )
808  {
809  // *** How big is this structure if there are no style entries? ***
810  *this << pen.elpPenStyle << pen.elpWidth << pen.elpBrushStyle << pen.elpColor
811  << pen.elpHatch << pen.elpNumEntries;
812  return *this;
813  }
818  DATASTREAM& operator>> ( EXTLOGPEN& pen )
819  {
820  // *** How big is this structure if there are no style entries? ***
821  *this >> pen.elpPenStyle >> pen.elpWidth >> pen.elpBrushStyle >> pen.elpColor
822  >> pen.elpHatch >> pen.elpNumEntries;
823  return *this;
824  }
829  DATASTREAM& operator<< ( const LOGBRUSH& brush )
830  {
831  *this << brush.lbStyle << brush.lbColor << brush.lbHatch;
832  return *this;
833  }
838  DATASTREAM& operator>> ( LOGBRUSH& brush )
839  {
840  *this >> brush.lbStyle >> brush.lbColor >> brush.lbHatch;
841  return *this;
842  }
847  DATASTREAM& operator<< ( const LOGFONTW& font )
848  {
849  *this << font.lfHeight << font.lfWidth << font.lfEscapement
850  << font.lfOrientation << font.lfWeight << font.lfItalic
851  << font.lfUnderline << font.lfStrikeOut << font.lfCharSet
852  << font.lfOutPrecision << font.lfClipPrecision << font.lfQuality
853  << font.lfPitchAndFamily
854  << WCHARSTR( const_cast<WCHAR*const>(font.lfFaceName), LF_FACESIZE );
855  return *this;
856  }
861  DATASTREAM& operator>> ( LOGFONTW& font )
862  {
863  WCHARSTR wFaceName( font.lfFaceName, LF_FACESIZE );
864 
865  *this >> font.lfHeight >> font.lfWidth >> font.lfEscapement
866  >> font.lfOrientation >> font.lfWeight >> font.lfItalic
867  >> font.lfUnderline >> font.lfStrikeOut >> font.lfCharSet
868  >> font.lfOutPrecision >> font.lfClipPrecision >> font.lfQuality
869  >> font.lfPitchAndFamily
870  >> wFaceName;
871  return *this;
872  }
877  DATASTREAM& operator<< ( const PANOSE& panose )
878  {
879  fwrite( &panose, sizeof(PANOSE), 1, fp_ );
880  return *this;
881  }
886  DATASTREAM& operator>> ( PANOSE& panose )
887  {
888  fread( &panose, sizeof(PANOSE), 1, fp_ );
889  return *this;
890  }
895  DATASTREAM& operator<< ( const EXTLOGFONTW& font )
896  {
897  *this << font.elfLogFont
898  << WCHARSTR( const_cast<WCHAR*const>(font.elfFullName),
899  LF_FULLFACESIZE )
900  << WCHARSTR( const_cast<WCHAR*const>(font.elfStyle), LF_FACESIZE )
901  << font.elfVersion << font.elfStyleSize << font.elfMatch
902  << font.elfReserved
903  << BYTEARRAY( const_cast<BYTE*const>(font.elfVendorId),
904  ELF_VENDOR_SIZE )
905  << font.elfCulture << font.elfPanose;
906  return *this;
907  }
912  DATASTREAM& operator>> ( EXTLOGFONTW& font )
913  {
914  WCHARSTR wFullName( font.elfFullName, LF_FULLFACESIZE );
915  WCHARSTR wStyle( font.elfStyle, LF_FACESIZE );
916  BYTEARRAY bVendorId( font.elfVendorId, ELF_VENDOR_SIZE );
917  *this >> font.elfLogFont
918  >> wFullName >> wStyle
919  >> font.elfVersion >> font.elfStyleSize >> font.elfMatch
920  >> font.elfReserved >> bVendorId
921  >> font.elfCulture >> font.elfPanose;
922  return *this;
923  }
928  DATASTREAM& operator<< ( const LOGPALETTE& palette )
929  {
930  // *** How big is this structure if the palette is empty? ***
931  *this << palette.palVersion << palette.palNumEntries;
932  return *this;
933  }
938  DATASTREAM& operator>> ( LOGPALETTE& palette )
939  {
940  // *** How big is this structure if the palette is empty? ***
941  *this >> palette.palVersion >> palette.palNumEntries;
942  return *this;
943  }
944  private:
954  void fread ( void* ptr, size_t size, size_t nmemb, FILE* stream )
955  {
956  size_t res = ::fread( ptr, size, nmemb, stream );
957  if ( res < nmemb ) {
958  throw std::runtime_error( "error reading EMF stream" );
959  }
960  }
970  void fwrite ( const void* ptr, size_t size, size_t nmemb, FILE* stream )
971  {
972  size_t res = ::fwrite( ptr, size, nmemb, stream );
973  if ( res < nmemb ) {
974  throw std::runtime_error( "error writing EMF stream" );
975  }
976  }
977  };
978 
979  class METAFILEDEVICECONTEXT;
980 
982 
988  class METARECORD {
989  public:
996  virtual void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const = 0;
1003  virtual bool serialize ( DATASTREAM ds ) = 0;
1009  virtual int size ( void ) const = 0;
1015  virtual ~METARECORD( ) { }
1016 #ifdef ENABLE_EDITING
1017 
1021  virtual void edit ( void ) const {}
1022 #endif
1023  };
1024 
1025 #ifdef ENABLE_EDITING
1026  /* Miscellaneous editing routines */
1027  inline void edit_rectl ( const char* tag, const RECTL& rectl )
1028  {
1029 #if defined(__LP64__)
1030  const char* FMT = "\t%s\t: (%d, %d) - (%d, %d)\n";
1031 #else
1032  const char* FMT = "\t%s\t: (%ld, %ld) - (%ld, %ld)\n";
1033 #endif /* __x86_64__ */
1034  printf( FMT, tag, rectl.left, rectl.top, rectl.right, rectl.bottom );
1035  }
1036 
1037  inline void edit_xform ( const char* tag, const XFORM& xform )
1038  {
1039  printf( "\t%s.eM11\t: %f\n", tag, xform.eM11 );
1040  printf( "\t%s.eM12\t: %f\n", tag, xform.eM12 );
1041  printf( "\t%s.eM21\t: %f\n", tag, xform.eM21 );
1042  printf( "\t%s.eM22\t: %f\n", tag, xform.eM22 );
1043  printf( "\t%s.eDx\t: %f\n", tag, xform.eDx );
1044  printf( "\t%s.eDy\t: %f\n", tag, xform.eDy );
1045  }
1046 
1047  inline void edit_color ( const char* tag, const COLORREF& color )
1048  {
1049 #if defined(__LP64__)
1050  const char* FMT = "\t%s\t: R(0x%02x) G(0x%02x) B(0x%02x)\n";
1051 #else
1052  const char* FMT = "\t%s\t: R(0x%02lx) G(0x%02lx) B(0x%02lx)\n";
1053 #endif /* __x86_64__ */
1054  printf( FMT, tag,
1055  GetRValue( color ), GetGValue( color ), GetBValue( color ) );
1056  }
1057 
1058  inline void edit_sizel ( const char* tag, const SIZEL& size )
1059  {
1060 #if defined(__LP64__)
1061  const char* FMT = "\t%s\t: (%d, %d)\n";
1062 #else
1063  const char* FMT = "\t%s\t: (%ld, %ld)\n";
1064 #endif /* __x86_64__ */
1065  printf( FMT, tag, size.cx, size.cy );
1066  }
1067 
1068  inline void edit_pointl ( const char* tag, const POINTL& point )
1069  {
1070 #if defined(__LP64__)
1071  const char* FMT = "\t%s\t: (%d, %d)\n";
1072 #else
1073  const char* FMT = "\t%s\t: (%ld, %ld)\n";
1074 #endif /* __x86_64__ */
1075  printf( FMT, tag, point.x, point.y );
1076  }
1077 
1078  inline void edit_pointlarray ( const char* tag, const DWORD cptl,
1079  const POINTL* points )
1080  {
1081 #if defined(__LP64__)
1082  const char* FMT0 = "\tcptl%s\t: %d\n";
1083  const char* FMT1 = "%d, %d\n";
1084  const char* FMT2 = "\t\t%s %d, %d\n";
1085 #else
1086  const char* FMT0 = "\tcptl%s\t: %ld\n";
1087  const char* FMT1 = "%ld, %ld\n";
1088  const char* FMT2 = "\t\t%s %ld, %ld\n";
1089 #endif /* __x86_64__ */
1090  printf( FMT0, tag, cptl );
1091  printf( "\taptl%s\t: ", tag );
1092  if ( cptl > 0 )
1093  printf( FMT1, points[0].x, points[0].y );
1094  else
1095  puts( "" );
1096  for ( DWORD i = 1; i < cptl; i++ )
1097  printf( FMT2, tag, points[i].x, points[i].y );
1098  }
1099 
1100  inline void edit_point16array ( const char* tag, const unsigned int cpts,
1101  const POINT16* points )
1102  {
1103  printf( "\tcpts%s\t: %d\n", tag, cpts );
1104  printf( "\tapts%s\t: ", tag );
1105  if ( cpts > 0 )
1106  printf( "%d, %d\n", points[0].x, points[0].y );
1107  else
1108  puts( "" );
1109  for ( unsigned int i = 1; i < cpts; i++ )
1110  printf( "\t\t%s %d, %d\n", tag, points[i].x, points[i].y );
1111  }
1112 
1113  inline void edit_pen_style ( const char* tag, DWORD style )
1114  {
1115  printf( "\t%s\t: ", tag );
1116  switch ( style & PS_STYLE_MASK ) {
1117  case PS_SOLID: printf( "PS_SOLID" ); break;
1118  case PS_DASH: printf( "PS_DASH" ); break;
1119  case PS_DOT: printf( "PS_DOT" ); break;
1120  case PS_DASHDOT: printf( "PS_DASHDOT" ); break;
1121  case PS_DASHDOTDOT: printf( "PS_DASHDOTDOT" ); break;
1122  case PS_NULL: printf( "PS_NULL" ); break;
1123  case PS_INSIDEFRAME: printf( "PS_INSIDEFRAME" ); break;
1124  case PS_USERSTYLE: printf( "PS_USERSTYLE" ); break;
1125  case PS_ALTERNATE: printf( "PS_ALTERNATE" ); break;
1126  }
1127  switch ( style & PS_ENDCAP_MASK ) {
1128  case PS_ENDCAP_ROUND: printf( " | PS_ENDCAP_ROUND" ); break;
1129  case PS_ENDCAP_SQUARE: printf( " | PS_ENDCAP_SQUARE" ); break;
1130  case PS_ENDCAP_FLAT: printf( " | PS_ENDCAP_FLAT" ); break;
1131  }
1132  switch ( style & PS_JOIN_MASK ) {
1133  case PS_JOIN_ROUND: printf( " | PS_JOIN_ROUND" ); break;
1134  case PS_JOIN_BEVEL: printf( " | PS_JOIN_BEVEL" ); break;
1135  case PS_JOIN_MITER: printf( " | PS_JOIN_MITER" ); break;
1136  }
1137  switch ( style & PS_TYPE_MASK ) {
1138  case PS_COSMETIC: printf( " | PS_COSMETIC" ); break;
1139  case PS_GEOMETRIC: printf( " | PS_GEOMETRIC" ); break;
1140  }
1141  printf( "\n" );
1142  }
1143 
1144  inline void edit_brush_style ( const char* tag, DWORD style )
1145  {
1146 #if defined(__LP64__)
1147  const char* FMT = "unknown(%d)";
1148 #else
1149  const char* FMT = "unknown(%ld)";
1150 #endif /* __x86_64__ */
1151  printf( "\t%s\t: ", tag );
1152  switch ( style ) {
1153  case BS_SOLID: printf( "BS_SOLID" ); break;
1154  case BS_NULL: printf( "BS_NULL" ); break;
1155  case BS_HATCHED: printf( "BS_HATCHED" ); break;
1156  case BS_PATTERN: printf( "BS_PATTERN" ); break;
1157  case BS_INDEXED: printf( "BS_INDEXED" ); break;
1158  case BS_DIBPATTERN: printf( "BS_DIBPATTERN" ); break;
1159  case BS_DIBPATTERNPT: printf( "BS_DIBPATTERNPT" ); break;
1160  case BS_PATTERN8X8: printf( "BS_PATTERN8X8" ); break;
1161  case BS_DIBPATTERN8X8: printf( "BS_DIBPATTERN8X8" ); break;
1162  case BS_MONOPATTERN: printf( "BS_DIBPATTERN8X8" ); break;
1163  default: printf( FMT, style );
1164  }
1165  printf( "\n" );
1166  }
1167 
1168  inline void edit_brush_hatch ( const char* tag, DWORD hatch )
1169  {
1170 #if defined(__LP64__)
1171  const char* FMT = "unknown(%d)";
1172 #else
1173  const char* FMT = "unknown(%ld)";
1174 #endif /* __x86_64__ */
1175  printf( "\t%s\t: ", tag );
1176  switch ( hatch ) {
1177  case HS_HORIZONTAL: printf( "HS_HORIZONTAL" ); break;
1178  case HS_VERTICAL: printf( "HS_VERTICAL" ); break;
1179  case HS_FDIAGONAL: printf( "HS_FDIAGONAL" ); break;
1180  case HS_BDIAGONAL: printf( "HS_BDIAGONAL" ); break;
1181  case HS_CROSS: printf( "HS_CROSS" ); break;
1182  case HS_DIAGCROSS: printf( "HS_DIAGCROSS" ); break;
1183  default: printf( FMT, hatch );
1184  }
1185  printf( "\n" );
1186  }
1187 #endif
1188 
1195  enum OBJECTTYPE { O_METAFILEDEVICECONTEXT = OBJ_METADC,
1196  O_FONT = OBJ_FONT,
1197  O_PEN = OBJ_PEN,
1198  O_EXTPEN = OBJ_EXTPEN,
1199  O_BRUSH = OBJ_BRUSH,
1200  O_PALETTE = OBJ_PAL };
1201 #if 0
1202 
1205  static char* typStr ( OBJECTTYPE type )
1206  {
1207  switch (type) {
1208  case O_METAFILEDEVICECONTEXT:
1209  return "metafile device context";
1210  case O_FONT:
1211  return "font";
1212  case O_PEN:
1213  return "pen";
1214  case O_EXTPEN:
1215  return "extended pen";
1216  case O_BRUSH:
1217  return "brush";
1218  case O_PALETTE:
1219  return "palette";
1220  }
1221  return "unknown object";
1222  }
1223 #endif
1224 
1230  class OBJECT {
1231  public:
1232  HGDIOBJ handle;
1233  virtual ~OBJECT () {}
1239  OBJECT ( void ) : handle( 0 ) {}
1243  virtual OBJECTTYPE getType ( void ) const = 0;
1244  };
1245 
1247 
1252  class GRAPHICSOBJECT : public OBJECT {
1253  public:
1255  virtual ~GRAPHICSOBJECT () {}
1260  std::map< HDC, HGDIOBJ > contexts;
1267  virtual METARECORD* newEMR ( HDC dc, HGDIOBJ handle ) = 0;
1268  };
1269 
1270  typedef METARECORD*(*METARECORDCTOR)(DATASTREAM&);
1271 
1279  std::vector<OBJECT*> objects;
1280 
1287  std::map< DWORD, METARECORDCTOR > new_records;
1288 
1289  public:
1290  GLOBALOBJECTS ( void );
1291  ~GLOBALOBJECTS ( void );
1292  HGDIOBJ add ( OBJECT* object );
1293  OBJECT* find ( const HGDIOBJ handle );
1294  void remove ( const OBJECT* object );
1295 
1299  std::vector<EMF::OBJECT*>::const_iterator begin ( void ) const
1300  { return objects.begin(); }
1304  std::vector<EMF::OBJECT*>::const_iterator end ( void ) const
1305  { return objects.end(); }
1306 
1307  METARECORDCTOR newRecord ( DWORD iType ) const;
1308 
1310  static EMF::METARECORD* new_eof ( DATASTREAM& ds );
1312  static EMF::METARECORD* new_setviewportorgex ( DATASTREAM& ds );
1314  static EMF::METARECORD* new_setwindoworgex ( DATASTREAM& ds );
1316  static EMF::METARECORD* new_setviewportextex ( DATASTREAM& ds );
1318  static EMF::METARECORD* new_setwindowextex ( DATASTREAM& ds );
1320  static EMF::METARECORD* new_scaleviewportextex ( DATASTREAM& ds );
1322  static EMF::METARECORD* new_scalewindowextex ( DATASTREAM& ds );
1324  static EMF::METARECORD* new_modifyworldtransform ( DATASTREAM& ds );
1326  static EMF::METARECORD* new_setworldtransform ( DATASTREAM& ds );
1328  static EMF::METARECORD* new_settextalign ( DATASTREAM& ds );
1330  static EMF::METARECORD* new_settextcolor ( DATASTREAM& ds );
1332  static EMF::METARECORD* new_setbkcolor ( DATASTREAM& ds );
1334  static EMF::METARECORD* new_setbkmode ( DATASTREAM& ds );
1336  static EMF::METARECORD* new_setpolyfillmode ( DATASTREAM& ds );
1338  static EMF::METARECORD* new_setmapmode ( DATASTREAM& ds );
1340  static EMF::METARECORD* new_selectobject ( DATASTREAM& ds );
1342  static EMF::METARECORD* new_deleteobject ( DATASTREAM& ds );
1344  static EMF::METARECORD* new_movetoex ( DATASTREAM& ds );
1346  static EMF::METARECORD* new_lineto ( DATASTREAM& ds );
1348  static EMF::METARECORD* new_arc ( DATASTREAM& ds );
1350  static EMF::METARECORD* new_arcto ( DATASTREAM& ds );
1352  static EMF::METARECORD* new_rectangle ( DATASTREAM& ds );
1354  static EMF::METARECORD* new_ellipse ( DATASTREAM& ds );
1356  static EMF::METARECORD* new_polyline ( DATASTREAM& ds );
1358  static EMF::METARECORD* new_polyline16 ( DATASTREAM& ds );
1360  static EMF::METARECORD* new_polygon ( DATASTREAM& ds );
1362  static EMF::METARECORD* new_polygon16 ( DATASTREAM& ds );
1364  static EMF::METARECORD* new_polypolygon ( DATASTREAM& ds );
1366  static EMF::METARECORD* new_polypolygon16 ( DATASTREAM& ds );
1368  static EMF::METARECORD* new_polybezier ( DATASTREAM& ds );
1370  static EMF::METARECORD* new_polybezier16 ( DATASTREAM& ds );
1372  static EMF::METARECORD* new_polybezierto ( DATASTREAM& ds );
1374  static EMF::METARECORD* new_polybezierto16 ( DATASTREAM& ds );
1376  static EMF::METARECORD* new_polylineto ( DATASTREAM& ds );
1378  static EMF::METARECORD* new_polylineto16 ( DATASTREAM& ds );
1380  static EMF::METARECORD* new_exttextouta ( DATASTREAM& ds );
1382  static EMF::METARECORD* new_exttextoutw ( DATASTREAM& ds );
1384  static EMF::METARECORD* new_setpixelv ( DATASTREAM& ds );
1386  static EMF::METARECORD* new_createpen ( DATASTREAM& ds );
1388  static EMF::METARECORD* new_extcreatepen ( DATASTREAM& ds );
1390  static EMF::METARECORD* new_createbrushindirect ( DATASTREAM& ds );
1392  static EMF::METARECORD* new_extcreatefontindirectw ( DATASTREAM& ds );
1394  static EMF::METARECORD* new_fillpath ( DATASTREAM& ds );
1396  static EMF::METARECORD* new_strokepath ( DATASTREAM& ds );
1398  static EMF::METARECORD* new_strokeandfillpath ( DATASTREAM& ds );
1400  static EMF::METARECORD* new_beginpath ( DATASTREAM& ds );
1402  static EMF::METARECORD* new_endpath ( DATASTREAM& ds );
1404  static EMF::METARECORD* new_closefigure ( DATASTREAM& ds );
1406  static EMF::METARECORD* new_savedc ( DATASTREAM& ds );
1408  static EMF::METARECORD* new_restoredc ( DATASTREAM& ds );
1410  static EMF::METARECORD* new_setmetargn ( DATASTREAM& ds );
1412  static EMF::METARECORD* new_setmiterlimit ( DATASTREAM& ds );
1413  };
1414 
1415  extern GLOBALOBJECTS globalObjects;
1416 
1418 
1424  class ENHMETAHEADER : public METARECORD, public ::ENHMETAHEADER {
1425 
1426  LPWSTR description_w;
1427  int description_size;
1428 
1429  public:
1436  ENHMETAHEADER ( LPCWSTR description = 0 )
1437  : description_w( 0 ), description_size( 0 )
1438  {
1439  iType = EMR_HEADER;
1440  nSize = sizeof( ::ENHMETAHEADER );
1441 
1442  // Compute the bounds
1443  RECTL default_bounds = { 0, 0, 0, 0 };
1444  rclBounds = default_bounds;
1445  RECTL default_frame = { 0, 0, 0, 0 };
1446  rclFrame = default_frame;
1447  dSignature = ENHMETA_SIGNATURE;
1448  nVersion = 0x10000;
1449  nBytes = nSize;
1450  nRecords = 1;
1451  nHandles = 0;
1452  sReserved = 0;
1453  nDescription = 0;
1454  offDescription = 0;
1455  nPalEntries = 0;
1456  szlDevice.cx = XMAX_PIXELS;
1457  szlDevice.cy = YMAX_PIXELS;
1458  szlMillimeters.cx = XMAX_MM;
1459  szlMillimeters.cy = YMAX_MM;
1460  //
1461  cbPixelFormat = 0;
1462  offPixelFormat = 0;
1463  bOpenGL = FALSE;
1464  //
1465 #if 1
1466  szlMicrometers.cx = 1000 * szlMillimeters.cx;
1467  szlMicrometers.cy = 1000 * szlMillimeters.cy;
1468 #endif
1469  if ( description ) {
1470  // Count the number of characters in the description
1471  int description_count = 0, nulls = 0;
1472  LPCWSTR description_p = description;
1473  while ( nulls < 3 ) {
1474  description_count++;
1475  if ( (*description_p++) == 0 ) nulls++;
1476  }
1477 
1478  // Make sure that the TOTAL record length will be a multiple of 4
1479 
1480  int record_size = ROUND_TO_LONG( sizeof( ::ENHMETAHEADER ) +
1481  sizeof( WCHAR ) * description_count );
1482  description_size =
1483  (record_size - sizeof( ::ENHMETAHEADER )) / sizeof( WCHAR );
1484 
1485  description_w = new WCHAR[ description_size ];
1486 
1487  memset( description_w, 0, sizeof(WCHAR) * description_size );
1488 
1489  for ( int i=0; i<description_count; i++ )
1490  description_w[i] = *description++;
1491 
1492  nSize = nBytes = record_size;
1493  nDescription = description_count;
1494  offDescription = sizeof( ::ENHMETAHEADER );
1495  }
1496  }
1497 
1502  {
1503  if ( description_w ) delete[] description_w;
1504  }
1509  bool serialize ( DATASTREAM ds )
1510  {
1511  ds << iType << nSize
1512  << rclBounds << rclFrame
1513  << dSignature << nVersion << nBytes << nRecords << nHandles << sReserved
1514  << nDescription << offDescription << nPalEntries
1515  << szlDevice << szlMillimeters
1516  << cbPixelFormat << offPixelFormat << bOpenGL
1517 #if 1
1518  << szlMicrometers
1519 #endif
1520  << WCHARSTR( description_w, description_size );
1521  return true;
1522  }
1527  {
1528  ds >> iType >> nSize
1529  >> rclBounds >> rclFrame
1530  >> dSignature >> nVersion >> nBytes >> nRecords >> nHandles >> sReserved
1531  >> nDescription >> offDescription >> nPalEntries
1532  >> szlDevice >> szlMillimeters;
1533 
1534  // Some elements of the metafile header were added at later dates
1535 
1536 #define OffsetOf( a, b ) ((unsigned int)(((char*)&(((::ENHMETAHEADER*)a)->b)) - \
1537 (char*)((::ENHMETAHEADER*)a)))
1538 #if 1
1539  if ( OffsetOf( this, szlMicrometers ) <= offDescription )
1540  ds >> cbPixelFormat >> offPixelFormat >> bOpenGL;
1541 #else
1542  if ( sizeof(::ENHMETAHEADER) <= offDescription )
1543  ds >> cbPixelFormat >> offPixelFormat >> bOpenGL;
1544 #endif
1545 #undef OffsetOf
1546 #if 1
1547  if ( sizeof(::ENHMETAHEADER) <= offDescription )
1548  ds >> szlMicrometers;
1549 #endif
1550  // Should now probably check that the offset is correct...
1551 
1552  description_size = ( nSize - offDescription ) / sizeof(WCHAR);
1553  description_w = new WCHAR[ description_size ];
1554 
1555  WCHARSTR description( description_w, description_size );
1556 
1557  ds >> description;
1558 
1559  return true;
1560  }
1564  int size ( void ) const { return nSize; }
1570  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
1571  {
1572  // Actually handled by the destination device context.
1573  EMF_UNUSED(source);
1574  EMF_UNUSED(dc);
1575  }
1576 #ifdef ENABLE_EDITING
1577 
1580  void edit ( void ) const
1581  {
1582 #if defined(__LP64__)
1583  const char* FMT0 = "\tiType\t\t\t: %d\n";
1584  const char* FMT1 = "\tnSize\t\t\t: %d\n";
1585  const char* FMT2 = "\tnBytes\t\t\t: %d\n";
1586  const char* FMT3 = "\tnRecords\t\t: %d\n";
1587  const char* FMT4 = "\tnDescription\t\t: %d\n";
1588  const char* FMT5 = "\toffDescription\t\t: %d\n";
1589  const char* FMT6 = "\tnPalEntries\t\t: %d\n";
1590  const char* FMT7 = "\tcbPixelFormat\t\t: %d\n";
1591  const char* FMT8 = "\toffPixelFormat\t\t: %d\n";
1592  const char* FMT9 = "\tbOpenGL\t\t\t: %d\n";
1593 #else
1594  const char* FMT0 = "\tiType\t\t\t: %ld\n";
1595  const char* FMT1 = "\tnSize\t\t\t: %ld\n";
1596  const char* FMT2 = "\tnBytes\t\t\t: %ld\n";
1597  const char* FMT3 = "\tnRecords\t\t: %ld\n";
1598  const char* FMT4 = "\tnDescription\t\t: %ld\n";
1599  const char* FMT5 = "\toffDescription\t\t: %ld\n";
1600  const char* FMT6 = "\tnPalEntries\t\t: %ld\n";
1601  const char* FMT7 = "\tcbPixelFormat\t\t: %ld\n";
1602  const char* FMT8 = "\toffPixelFormat\t\t: %ld\n";
1603  const char* FMT9 = "\tbOpenGL\t\t\t: %ld\n";
1604 #endif
1605  printf( "*HEADER*\n" );
1606  printf( FMT0, iType );
1607  printf( FMT1, nSize );
1608  edit_rectl( "rclBounds\t", rclBounds );
1609  edit_rectl( "rclFrame\t", rclFrame );
1610  printf( "\tdSignature\t\t: %.4s\n", (const char*)&dSignature );
1611  printf( "\tnVersion\t\t: 0x%x\n", (unsigned int)nVersion );
1612  printf( FMT2, nBytes );
1613  printf( FMT3, nRecords );
1614  printf( "\tnHandles\t\t: %d\n", nHandles );
1615  printf( FMT4, nDescription );
1616  printf( FMT5, offDescription );
1617  printf( FMT6, nPalEntries );
1618  edit_sizel( "szlDevice\t", szlDevice );
1619  edit_sizel( "szlMillimeters\t", szlMillimeters );
1620 
1621  /* Make a crude guess as to the age of this file */
1622 #define OffsetOf( a, b ) ((unsigned int)(((const char*)&(((const ::ENHMETAHEADER*)a)->b)) - \
1623 (const char*)((const ::ENHMETAHEADER*)a)))
1624 
1625  if ( OffsetOf( this, cbPixelFormat ) <= offDescription ) {
1626  printf( FMT7, cbPixelFormat );
1627  printf( FMT8, offPixelFormat );
1628  printf( FMT9, bOpenGL );
1629 #if 1
1630  if ( sizeof(::ENHMETAHEADER) <= offDescription ) {
1631  edit_sizel( "szlMicrometers\t", szlMicrometers );
1632  }
1633 #endif
1634  }
1635 
1636 #undef OffsetOf
1637 
1638  if ( nDescription != 0 ) {
1639 
1640  wchar_t last_w = 0;
1641  WCHAR* description = description_w;
1642 
1643  printf( "\tDescription:" );
1644 
1645  for ( DWORD i = 0; i < nDescription; i++ ) {
1646 
1647  wchar_t w = *description++; /* This is not true, really. UNICODE is not
1648  * glibc's wide character representation */
1649 
1650  if ( w != 0 ) {
1651  if ( last_w == 0 ) printf( "\n\t\t" );
1652  putchar( w );
1653  }
1654 
1655  last_w = w;
1656  }
1657  printf( "\n" );
1658  }
1659  }
1660 #endif /* ENABLE_EDITING */
1661  };
1662 
1664 
1669  class EMREOF : public METARECORD, ::EMREOF {
1670  public:
1674  EMREOF ( void )
1675  {
1676  emr.iType = EMR_EOF;
1677  emr.nSize = sizeof( ::EMREOF );
1678  nPalEntries = 0;
1679  offPalEntries = 0;
1680  nSizeLast = 0;
1681  }
1682 
1688  {
1689  ds >> emr >> nPalEntries >> offPalEntries >> nSizeLast;
1690  }
1691 
1695  bool serialize ( DATASTREAM ds )
1696  {
1697  ds << emr << nPalEntries << offPalEntries << nSizeLast;
1698  return true;
1699  }
1703  int size ( void ) const { return emr.nSize; }
1709  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
1710  {
1711  // Actually handled by the destination device context.
1712  EMF_UNUSED(source);
1713  EMF_UNUSED(dc);
1714  }
1715 #ifdef ENABLE_EDITING
1716 
1719  void edit ( void ) const
1720  {
1721  printf( "*EOF*\n" );
1722  }
1723 #endif /* ENABLE_EDITING */
1724  };
1725 
1727 
1733  public:
1738  EMRSETVIEWPORTORGEX ( INT x, INT y )
1739  {
1740  emr.iType = EMR_SETVIEWPORTORGEX;
1741  emr.nSize = sizeof( ::EMRSETVIEWPORTORGEX );
1742  ptlOrigin.x = x;
1743  ptlOrigin.y = y;
1744  }
1750  {
1751  ds >> emr >> ptlOrigin;
1752  }
1756  bool serialize ( DATASTREAM ds )
1757  {
1758  ds << emr << ptlOrigin;
1759  return true;
1760  }
1764  int size ( void ) const { return emr.nSize; }
1770  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
1771  {
1772  EMF_UNUSED(source);
1773  SetViewportOrgEx( dc, ptlOrigin.x, ptlOrigin.y, 0 );
1774  }
1775 #ifdef ENABLE_EDITING
1776 
1779  void edit ( void ) const
1780  {
1781  printf( "*SETVIEWPORTORGEX*\n" );
1782  edit_pointl( "ptlOrigin", ptlOrigin );
1783  }
1784 #endif /* ENABLE_EDITING */
1785  };
1786 
1788 
1796  public:
1801  EMRSETWINDOWORGEX ( INT x, INT y )
1802  {
1803  emr.iType = EMR_SETWINDOWORGEX;
1804  emr.nSize = sizeof( ::EMRSETWINDOWORGEX );
1805  ptlOrigin.x = x;
1806  ptlOrigin.y = y;
1807  }
1813  {
1814  ds >> emr >> ptlOrigin;
1815  }
1819  bool serialize ( DATASTREAM ds )
1820  {
1821  ds << emr << ptlOrigin;
1822  return true;
1823  }
1827  int size ( void ) const { return emr.nSize; }
1833  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
1834  {
1835  EMF_UNUSED(source);
1836  SetWindowOrgEx( dc, ptlOrigin.x, ptlOrigin.y, 0 );
1837  }
1838 #ifdef ENABLE_EDITING
1839 
1842  void edit ( void ) const
1843  {
1844  printf( "*SETWINDOWORGEX*\n" );
1845  edit_pointl( "ptlOrigin", ptlOrigin );
1846  }
1847 #endif /* ENABLE_EDITING */
1848  };
1849 
1851 
1857  public:
1862  EMRSETVIEWPORTEXTEX ( INT cx, INT cy )
1863  {
1864  emr.iType = EMR_SETVIEWPORTEXTEX;
1865  emr.nSize = sizeof( ::EMRSETVIEWPORTEXTEX );
1866  szlExtent.cx = cx;
1867  szlExtent.cy = cy;
1868  }
1874  {
1875  ds >> emr >> szlExtent;
1876  }
1880  bool serialize ( DATASTREAM ds )
1881  {
1882  ds << emr << szlExtent;
1883  return true;
1884  }
1888  int size ( void ) const { return emr.nSize; }
1894  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
1895  {
1896  EMF_UNUSED(source);
1897  SetViewportExtEx( dc, szlExtent.cx, szlExtent.cy, 0 );
1898  }
1899 #ifdef ENABLE_EDITING
1900 
1903  void edit ( void ) const
1904  {
1905  printf( "*SETVIEWPORTEXTEX*\n" );
1906  edit_sizel( "szlExtent", szlExtent );
1907  }
1908 #endif /* ENABLE_EDITING */
1909  };
1910 
1912 
1918  public:
1925  EMRSCALEVIEWPORTEXTEX ( LONG x_num, LONG x_den, LONG y_num, LONG y_den )
1926  {
1927  emr.iType = EMR_SCALEVIEWPORTEXTEX;
1928  emr.nSize = sizeof( ::EMRSCALEVIEWPORTEXTEX );
1929  xNum = x_num;
1930  xDenom = x_den;
1931  yNum = y_num;
1932  yDenom = y_den;
1933  }
1939  {
1940  ds >> emr >> xNum >> xDenom >> yNum >> yDenom;
1941  }
1945  bool serialize ( DATASTREAM ds )
1946  {
1947  ds << emr << xNum << xDenom << yNum << yDenom;
1948  return true;
1949  }
1953  int size ( void ) const { return emr.nSize; }
1959  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
1960  {
1961  EMF_UNUSED(source);
1962  ScaleViewportExtEx( dc, xNum, xDenom, yNum, yDenom, 0 );
1963  }
1964 #ifdef ENABLE_EDITING
1965 
1968  void edit ( void ) const
1969  {
1970 #if defined(__LP64__)
1971  const char* FMT0 = "\txNum\t: %d\n";
1972  const char* FMT1 = "\txDenom\t: %d\n";
1973  const char* FMT2 = "\tyNum\t: %d\n";
1974  const char* FMT3 = "\tyDenom\t: %d\n";
1975 #else
1976  const char* FMT0 = "\txNum\t: %ld\n";
1977  const char* FMT1 = "\txDenom\t: %ld\n";
1978  const char* FMT2 = "\tyNum\t: %ld\n";
1979  const char* FMT3 = "\tyDenom\t: %ld\n";
1980 #endif
1981  printf( "*SCALEVIEWPORTEXTEX*\n" );
1982  printf( FMT0, xNum );
1983  printf( FMT1, xDenom );
1984  printf( FMT2, yNum );
1985  printf( FMT3, yDenom );
1986  }
1987 #endif /* ENABLE_EDITING */
1988  };
1989 
1991 
1997  public:
2002  EMRSETWINDOWEXTEX ( INT cx, INT cy )
2003  {
2004  emr.iType = EMR_SETWINDOWEXTEX;
2005  emr.nSize = sizeof( ::EMRSETWINDOWEXTEX );
2006  szlExtent.cx = cx;
2007  szlExtent.cy = cy;
2008  }
2014  {
2015  ds >> emr >> szlExtent;
2016  }
2020  bool serialize ( DATASTREAM ds )
2021  {
2022  ds << emr << szlExtent;
2023  return true;
2024  }
2028  int size ( void ) const { return emr.nSize; }
2034  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
2035  {
2036  EMF_UNUSED(source);
2037  SetWindowExtEx( dc, szlExtent.cx, szlExtent.cy, 0 );
2038  }
2039 #ifdef ENABLE_EDITING
2040 
2043  void edit ( void ) const
2044  {
2045  printf( "*SETWINDOWEXTEX*\n" );
2046  edit_sizel( "szlExtent", szlExtent );
2047  }
2048 #endif /* ENABLE_EDITING */
2049  };
2050 
2052 
2058  public:
2065  EMRSCALEWINDOWEXTEX ( LONG x_num, LONG x_den, LONG y_num, LONG y_den )
2066  {
2067  emr.iType = EMR_SCALEWINDOWEXTEX;
2068  emr.nSize = sizeof( ::EMRSCALEWINDOWEXTEX );
2069  xNum = x_num;
2070  xDenom = x_den;
2071  yNum = y_num;
2072  yDenom = y_den;
2073  }
2079  {
2080  ds >> emr >> xNum >> xDenom >> yNum >> yDenom;
2081  }
2085  bool serialize ( DATASTREAM ds )
2086  {
2087  ds << emr << xNum << xDenom << yNum << yDenom;
2088  return true;
2089  }
2093  int size ( void ) const { return emr.nSize; }
2099  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
2100  {
2101  EMF_UNUSED(source);
2102  ScaleWindowExtEx( dc, xNum, xDenom, yNum, yDenom, 0 );
2103  }
2104 #ifdef ENABLE_EDITING
2105 
2108  void edit ( void ) const
2109  {
2110 #if defined(__LP64__)
2111  const char* FMT0 = "\txNum\t: %d\n";
2112  const char* FMT1 = "\txDenom\t: %d\n";
2113  const char* FMT2 = "\tyNum\t: %d\n";
2114  const char* FMT3 = "\tyDenom\t: %d\n";
2115 #else
2116  const char* FMT0 = "\txNum\t: %ld\n";
2117  const char* FMT1 = "\txDenom\t: %ld\n";
2118  const char* FMT2 = "\tyNum\t: %ld\n";
2119  const char* FMT3 = "\tyDenom\t: %ld\n";
2120 #endif
2121  printf( "*SCALEWINDOWEXTEX*\n" );
2122  printf( FMT0, xNum );
2123  printf( FMT1, xDenom );
2124  printf( FMT2, yNum );
2125  printf( FMT3, yDenom );
2126  }
2127 #endif /* ENABLE_EDITING */
2128  };
2129 
2131 
2138  public:
2144  EMRMODIFYWORLDTRANSFORM ( const XFORM* transform, DWORD mode )
2145  {
2146  emr.iType = EMR_MODIFYWORLDTRANSFORM;
2147  emr.nSize = sizeof( ::EMRMODIFYWORLDTRANSFORM );
2148  xform = *transform;
2149  iMode = mode;
2150  }
2156  {
2157  ds >> emr >> xform >> iMode;
2158  }
2162  bool serialize ( DATASTREAM ds )
2163  {
2164  ds << emr << xform << iMode;
2165  return true;
2166  }
2170  int size ( void ) const { return emr.nSize; }
2176  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
2177  {
2178  EMF_UNUSED(source);
2179  ModifyWorldTransform( dc, &xform, iMode );
2180  }
2181 #ifdef ENABLE_EDITING
2182 
2185  void edit ( void ) const
2186  {
2187 #if defined(__LP64__)
2188  const char* FMT = "unknown(%d)\n";
2189 #else
2190  const char* FMT = "unknown(%ld)\n";
2191 #endif /* __x86_64__ */
2192  printf( "*MODIFYWORLDTRANSFORM*\n" );
2193  edit_xform( "xform", xform );
2194  printf( "\tiMode\t\t: " );
2195  switch ( iMode ) {
2196  case MWT_IDENTITY: printf( "MWT_IDENTITY\n" ); break;
2197  case MWT_LEFTMULTIPLY: printf( "MWT_LEFTMULTIPLY\n" ); break;
2198  case MWT_RIGHTMULTIPLY: printf( "MWT_RIGHTMULTIPLY\n" ); break;
2199  default: printf( FMT, iMode );
2200  }
2201  }
2202 #endif /* ENABLE_EDITING */
2203  };
2204 
2206 
2213  public:
2217  EMRSETWORLDTRANSFORM ( const XFORM* transform )
2218  {
2219  emr.iType = EMR_SETWORLDTRANSFORM;
2220  emr.nSize = sizeof( ::EMRSETWORLDTRANSFORM );
2221  xform = *transform;
2222  }
2228  {
2229  ds >> emr >> xform;
2230  }
2234  bool serialize ( DATASTREAM ds )
2235  {
2236  ds << emr << xform;
2237  return true;
2238  }
2242  int size ( void ) const { return emr.nSize; }
2248  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
2249  {
2250  EMF_UNUSED(source);
2251  SetWorldTransform( dc, &xform );
2252  }
2253 #ifdef ENABLE_EDITING
2254 
2257  void edit ( void ) const
2258  {
2259  printf( "*SETWORLDTRANSFORM*\n" );
2260  edit_xform( "xform", xform );
2261  }
2262 #endif /* ENABLE_EDITING */
2263  };
2264 
2266 
2270  public:
2274  EMRSETTEXTALIGN ( UINT mode )
2275  {
2276  emr.iType = EMR_SETTEXTALIGN;
2277  emr.nSize = sizeof( ::EMRSETTEXTALIGN );
2278  iMode = mode;
2279  }
2285  {
2286  ds >> emr >> iMode;
2287  }
2291  bool serialize ( DATASTREAM ds )
2292  {
2293  ds << emr << iMode;
2294  return true;
2295  }
2299  int size ( void ) const { return emr.nSize; }
2305  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
2306  {
2307  EMF_UNUSED(source);
2308  SetTextAlign( dc, iMode );
2309  }
2310 #ifdef ENABLE_EDITING
2311 
2314  void edit ( void ) const
2315  {
2316 #if defined(__LP64__)
2317  const char* FMT = "| unknown bits(0x%x)";
2318 #else
2319  const char* FMT = "| unknown bits(0x%lx)";
2320 #endif /* __x86_64__ */
2321  unsigned int known_bits = TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING;
2322  unsigned int unknown_bits = ~known_bits;
2323 
2324  printf( "*SETTEXTALIGN*\n" );
2325  printf( "\tiMode\t: " );
2326  if ( iMode & TA_UPDATECP )
2327  printf( "TA_UPDATECP" );
2328  else
2329  printf( "TA_NOUPDATECP" );
2330  if ( iMode & TA_CENTER )
2331  printf( " | TA_CENTER" );
2332  else if ( iMode & TA_RIGHT )
2333  printf( " | TA_RIGHT" );
2334  else
2335  printf( " | TA_LEFT" );
2336  if ( iMode & TA_BASELINE )
2337  printf( " | TA_BASELINE" );
2338  else if ( iMode & TA_BOTTOM )
2339  printf( " | TA_BOTTOM" );
2340  else
2341  printf( " | TA_TOP" );
2342  if ( iMode & TA_RTLREADING )
2343  printf( " | TA_RTLREADING" );
2344  if ( iMode & unknown_bits )
2345  printf( FMT, iMode & unknown_bits );
2346  printf( "\n" );
2347  }
2348 #endif /* ENABLE_EDITING */
2349  };
2350 
2352 
2356  public:
2360  EMRSETTEXTCOLOR ( COLORREF color )
2361  {
2362  emr.iType = EMR_SETTEXTCOLOR;
2363  emr.nSize = sizeof( ::EMRSETTEXTCOLOR );
2364  crColor = color;
2365  }
2371  {
2372  ds >> emr >> crColor;
2373  }
2377  bool serialize ( DATASTREAM ds )
2378  {
2379  ds << emr << crColor;
2380  return true;
2381  }
2385  int size ( void ) const { return emr.nSize; }
2391  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
2392  {
2393  EMF_UNUSED(source);
2394  SetTextColor( dc, crColor );
2395  }
2396 #ifdef ENABLE_EDITING
2397 
2400  void edit ( void ) const
2401  {
2402  printf( "*SETTEXTCOLOR*\n" );
2403  edit_color( "crColor", crColor );
2404  }
2405 #endif /* ENABLE_EDITING */
2406  };
2407 
2409 
2413  public:
2417  EMRSETBKCOLOR ( COLORREF color )
2418  {
2419  emr.iType = EMR_SETBKCOLOR;
2420  emr.nSize = sizeof( ::EMRSETBKCOLOR );
2421  crColor = color;
2422  }
2428  {
2429  ds >> emr >> crColor;
2430  }
2434  bool serialize ( DATASTREAM ds )
2435  {
2436  ds << emr << crColor;
2437  return true;
2438  }
2442  int size ( void ) const { return emr.nSize; }
2448  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
2449  {
2450  EMF_UNUSED(source);
2451  SetBkColor( dc, crColor );
2452  }
2453 #ifdef ENABLE_EDITING
2454 
2457  void edit ( void ) const
2458  {
2459  printf( "*SETBKCOLOR*\n" );
2460  edit_color( "crColor", crColor );
2461  }
2462 #endif /* ENABLE_EDITING */
2463  };
2464 
2466 
2471  public:
2475  EMRSETBKMODE ( DWORD mode )
2476  {
2477  emr.iType = EMR_SETBKMODE;
2478  emr.nSize = sizeof( ::EMRSETBKMODE );
2479  iMode = mode;
2480  }
2486  {
2487  ds >> emr >> iMode;
2488  }
2492  bool serialize ( DATASTREAM ds )
2493  {
2494  ds << emr << iMode;
2495  return true;
2496  }
2500  int size ( void ) const { return emr.nSize; }
2506  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
2507  {
2508  EMF_UNUSED(source);
2509  SetBkMode( dc, iMode );
2510  }
2511 #ifdef ENABLE_EDITING
2512 
2515  void edit ( void ) const
2516  {
2517 #if defined(__LP64__)
2518  const char* FMT = "unknown(%d)\n";
2519 #else
2520  const char* FMT = "unknown(%ld)\n";
2521 #endif /* __x86_64__ */
2522  printf( "*SETBKMODE*\n" );
2523  printf( "\tiMode\t: " );
2524  switch ( iMode ) {
2525  case TRANSPARENT: printf( "TRANSPARENT\n" ); break;
2526  case OPAQUE: printf( "OPAQUE\n" ); break;
2527  default: printf( FMT, iMode );
2528  }
2529  }
2530 #endif /* ENABLE_EDITING */
2531  };
2532 
2534 
2538  public:
2542  EMRSETPOLYFILLMODE ( DWORD mode )
2543  {
2544  emr.iType = EMR_SETPOLYFILLMODE;
2545  emr.nSize = sizeof( ::EMRSETPOLYFILLMODE );
2546  iMode = mode;
2547  }
2553  {
2554  ds >> emr >> iMode;
2555  }
2559  bool serialize ( DATASTREAM ds )
2560  {
2561  ds << emr << iMode;
2562  return true;
2563  }
2567  int size ( void ) const { return emr.nSize; }
2573  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
2574  {
2575  EMF_UNUSED(source);
2576  SetPolyFillMode( dc, iMode );
2577  }
2578 #ifdef ENABLE_EDITING
2579 
2582  void edit ( void ) const
2583  {
2584 #if defined(__LP64__)
2585  const char* FMT = "unknown(%d)\n";
2586 #else
2587  const char* FMT = "unknown(%ld)\n";
2588 #endif /* __x86_64__ */
2589  printf( "*SETPOLYFILLMODE*\n" );
2590  printf( "\tiMode: " );
2591  switch ( iMode ) {
2592  case ALTERNATE: printf( "ALTERNATE\n" ); break;
2593  case WINDING: printf( "WINDING\n" ); break;
2594  default: printf( FMT, iMode );
2595  }
2596  }
2597 #endif /* ENABLE_EDITING */
2598  };
2599 
2601 
2606  public:
2610  EMRSETMAPMODE ( DWORD mode )
2611  {
2612  emr.iType = EMR_SETMAPMODE;
2613  emr.nSize = sizeof( ::EMRSETMAPMODE );
2614  iMode = mode;
2615  }
2621  {
2622  ds >> emr >> iMode;
2623  }
2627  bool serialize ( DATASTREAM ds )
2628  {
2629  ds << emr << iMode;
2630  return true;
2631  }
2635  int size ( void ) const { return emr.nSize; }
2641  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
2642  {
2643  EMF_UNUSED(source);
2644  SetMapMode( dc, iMode );
2645  }
2646 #ifdef ENABLE_EDITING
2647 
2650  void edit ( void ) const
2651  {
2652 #if defined(__LP64__)
2653  const char* FMT = "unknown(%d)\n";
2654 #else
2655  const char* FMT = "unknown(%ld)\n";
2656 #endif /* __x86_64__ */
2657  printf( "*SETMAPMODE*\n" );
2658  printf( "\tiMode\t: " );
2659  switch ( iMode ) {
2660  case MM_TEXT: printf( "MM_TEXT\n" ); break;
2661  case MM_LOMETRIC: printf( "MM_LOMETRIC\n" ); break;
2662  case MM_HIMETRIC: printf( "MM_HIMETRIC\n" ); break;
2663  case MM_LOENGLISH: printf( "MM_LOENGLISH\n" ); break;
2664  case MM_HIENGLISH: printf( "MM_HIENGLISH\n" ); break;
2665  case MM_TWIPS: printf( "MM_TWIPS\n" ); break;
2666  case MM_ISOTROPIC: printf( "MM_ISOTROPIC\n" ); break;
2667  case MM_ANISOTROPIC: printf( "MM_ANISOTROPIC\n" ); break;
2668  default: printf( FMT, iMode );
2669  }
2670  }
2671 #endif /* ENABLE_EDITING */
2672  };
2673 
2675 
2679  public:
2683  EMRSELECTOBJECT ( HGDIOBJ object )
2684  {
2685  emr.iType = EMR_SELECTOBJECT;
2686  emr.nSize = sizeof( ::EMRSELECTOBJECT );
2687  ihObject = object;
2688  }
2694  {
2695  ds >> emr >> ihObject;
2696  }
2700  bool serialize ( DATASTREAM ds )
2701  {
2702  ds << emr << ihObject;
2703  return true;
2704  }
2708  int size ( void ) const { return emr.nSize; }
2714  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const;
2715 #ifdef ENABLE_EDITING
2716 
2719  void edit ( void ) const
2720  {
2721 #if defined(__LP64__)
2722  const char* FMT = "\tihObject\t: 0x%x\n";
2723 #else
2724  const char* FMT = "\tihObject\t: 0x%lx\n";
2725 #endif /* __x86_64__ */
2726  printf( "*SELECTOBJECT*\n" );
2727  printf( FMT, ihObject );
2728  }
2729 #endif /* ENABLE_EDITING */
2730  };
2731 
2733 
2737  public:
2741  EMRDELETEOBJECT ( HGDIOBJ object )
2742  {
2743  emr.iType = EMR_DELETEOBJECT;
2744  emr.nSize = sizeof( ::EMRDELETEOBJECT );
2745  ihObject = object;
2746  }
2752  {
2753  ds >> emr >> ihObject;
2754  }
2758  bool serialize ( DATASTREAM ds )
2759  {
2760  ds << emr << ihObject;
2761  return true;
2762  }
2766  int size ( void ) const { return emr.nSize; }
2772  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const;
2773 #ifdef ENABLE_EDITING
2774 
2777  void edit ( void ) const
2778  {
2779 #if defined(__LP64__)
2780  const char* FMT = "\tihObject\t: 0x%x\n";
2781 #else
2782  const char* FMT = "\tihObject\t: 0x%lx\n";
2783 #endif /* __x86_64__ */
2784  printf( "*DELETEOBJECT*\n" );
2785  printf( FMT, ihObject );
2786  }
2787 #endif /* ENABLE_EDITING */
2788  };
2789 
2791 
2795  public:
2800  EMRMOVETOEX ( INT x, INT y )
2801  {
2802  emr.iType = EMR_MOVETOEX;
2803  emr.nSize = sizeof( ::EMRMOVETOEX );
2804  ptl.x = x;
2805  ptl.y = y;
2806  }
2812  {
2813  ds >> emr >> ptl;
2814  }
2818  bool serialize ( DATASTREAM ds )
2819  {
2820  ds << emr << ptl;
2821  return true;
2822  }
2826  int size ( void ) const { return emr.nSize; }
2832  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
2833  {
2834  EMF_UNUSED(source);
2835  MoveToEx( dc, ptl.x, ptl.y, 0 );
2836  }
2837 #ifdef ENABLE_EDITING
2838 
2841  void edit ( void ) const
2842  {
2843  printf( "*MOVETOEX*\n" );
2844  edit_pointl( "ptl", ptl );
2845  }
2846 #endif /* ENABLE_EDITING */
2847  };
2848 
2850 
2854  public:
2859  EMRLINETO ( INT x, INT y )
2860  {
2861  emr.iType = EMR_LINETO;
2862  emr.nSize = sizeof( ::EMRLINETO );
2863  ptl.x = x;
2864  ptl.y = y;
2865  }
2871  {
2872  ds >> emr >> ptl;
2873  }
2877  bool serialize ( DATASTREAM ds )
2878  {
2879  ds << emr << ptl;
2880  return true;
2881  }
2885  int size ( void ) const { return emr.nSize; }
2891  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
2892  {
2893  EMF_UNUSED(source);
2894  LineTo( dc, ptl.x, ptl.y );
2895  }
2896 #ifdef ENABLE_EDITING
2897 
2900  void edit ( void ) const
2901  {
2902  printf( "*LINETO*\n" );
2903  edit_pointl( "ptl", ptl );
2904  }
2905 #endif /* ENABLE_EDITING */
2906  };
2907 
2909 
2912  class EMRARC : public METARECORD, ::EMRARC {
2913  public:
2925  EMRARC ( INT left, INT top, INT right, INT bottom, INT xstart,
2926  INT ystart, INT xend, INT yend )
2927  {
2928  emr.iType = EMR_ARC;
2929  emr.nSize = sizeof( ::EMRARC );
2930  rclBox.left = left;
2931  rclBox.right = right;
2932  rclBox.bottom = bottom;
2933  rclBox.top = top;
2934  ptlStart.x = xstart;
2935  ptlStart.y = ystart;
2936  ptlEnd.x = xend;
2937  ptlEnd.y = yend;
2938  }
2944  {
2945  ds >> emr >> rclBox >> ptlStart >> ptlEnd;
2946  }
2950  bool serialize ( DATASTREAM ds )
2951  {
2952  ds << emr << rclBox << ptlStart << ptlEnd;
2953  return true;
2954  }
2958  int size ( void ) const { return emr.nSize; }
2964  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
2965  {
2966  EMF_UNUSED(source);
2967  Arc( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom,
2968  ptlStart.x, ptlStart.y, ptlEnd.x, ptlEnd.y );
2969  }
2970 #ifdef ENABLE_EDITING
2971 
2974  void edit ( void ) const
2975  {
2976  printf( "*ARC*\n" );
2977  edit_rectl( "rclBox\t", rclBox );
2978  edit_pointl( "ptlStart", ptlStart );
2979  edit_pointl( "ptlEnd\t", ptlEnd );
2980  }
2981 #endif /* ENABLE_EDITING */
2982  };
2983 
2985 
2988  class EMRARCTO : public METARECORD, ::EMRARCTO {
2989  public:
3001  EMRARCTO ( INT left, INT top, INT right, INT bottom, INT xstart,
3002  INT ystart, INT xend, INT yend )
3003  {
3004  emr.iType = EMR_ARCTO;
3005  emr.nSize = sizeof( ::EMRARCTO );
3006  rclBox.left = left;
3007  rclBox.right = right;
3008  rclBox.bottom = bottom;
3009  rclBox.top = top;
3010  ptlStart.x = xstart;
3011  ptlStart.y = ystart;
3012  ptlEnd.x = xend;
3013  ptlEnd.y = yend;
3014  }
3020  {
3021  ds >> emr >> rclBox >> ptlStart >> ptlEnd;
3022  }
3026  bool serialize ( DATASTREAM ds )
3027  {
3028  ds << emr << rclBox << ptlStart << ptlEnd;
3029  return true;
3030  }
3034  int size ( void ) const { return emr.nSize; }
3040  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
3041  {
3042  EMF_UNUSED(source);
3043  ArcTo( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom,
3044  ptlStart.x, ptlStart.y, ptlEnd.x, ptlEnd.y );
3045  }
3046 #ifdef ENABLE_EDITING
3047 
3050  void edit ( void ) const
3051  {
3052  printf( "*ARCTO*\n" );
3053  edit_rectl( "rclBox\t", rclBox );
3054  edit_pointl( "ptlStart", ptlStart );
3055  edit_pointl( "ptlEnd\t", ptlEnd );
3056  }
3057 #endif /* ENABLE_EDITING */
3058  };
3059 
3061 
3065  public:
3072  EMRRECTANGLE ( INT left, INT top, INT right, INT bottom )
3073  {
3074  emr.iType = EMR_RECTANGLE;
3075  emr.nSize = sizeof( ::EMRRECTANGLE );
3076  rclBox.left = left;
3077  rclBox.right = right;
3078  rclBox.bottom = bottom;
3079  rclBox.top = top;
3080  }
3086  {
3087  ds >> emr >> rclBox;
3088  }
3092  bool serialize ( DATASTREAM ds )
3093  {
3094  ds << emr << rclBox;
3095  return true;
3096  }
3100  int size ( void ) const { return emr.nSize; }
3106  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
3107  {
3108  EMF_UNUSED(source);
3109  Rectangle( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom );
3110  }
3111 #ifdef ENABLE_EDITING
3112 
3115  void edit ( void ) const
3116  {
3117  printf( "*RECTANGLE*\n" );
3118  edit_rectl( "rclBox", rclBox );
3119  }
3120 #endif /* ENABLE_EDITING */
3121  };
3122 
3124 
3128  public:
3136  EMRELLIPSE ( INT left, INT top, INT right, INT bottom )
3137  {
3138  emr.iType = EMR_ELLIPSE;
3139  emr.nSize = sizeof( ::EMRELLIPSE );
3140  rclBox.left = left;
3141  rclBox.right = right;
3142  rclBox.bottom = bottom;
3143  rclBox.top = top;
3144  }
3150  {
3151  ds >> emr >> rclBox;
3152  }
3156  bool serialize ( DATASTREAM ds )
3157  {
3158  ds << emr << rclBox;
3159  return true;
3160  }
3164  int size ( void ) const { return emr.nSize; }
3170  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
3171  {
3172  EMF_UNUSED(source);
3173  Ellipse( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom );
3174  }
3175 #ifdef ENABLE_EDITING
3176 
3179  void edit ( void ) const
3180  {
3181  printf( "*ELLIPSE*\n" );
3182  edit_rectl( "rclBox", rclBox );
3183  }
3184 #endif /* ENABLE_EDITING */
3185  };
3186 
3188 
3192  POINTL* lpoints;
3193  public:
3199  EMRPOLYLINE ( const RECTL* bounds, const POINT* points, INT n )
3200  {
3201  cptl = n;
3202  aptl[0].x = 0; // Really unused
3203  aptl[0].y = 0;
3204 
3205  emr.iType = EMR_POLYLINE;
3206  // The (cptl - 1) below is to account for aptl, which isn't written out
3207  emr.nSize = sizeof( ::EMRPOLYLINE ) + sizeof( POINTL ) * ( cptl - 1);
3208 
3209  lpoints = new POINTL[cptl];
3210 
3211  for (int i=0; i<n; i++) {
3212  lpoints[i].x = points[i].x;
3213  lpoints[i].y = points[i].y;
3214  }
3215 
3216  rclBounds = *bounds;
3217  }
3222  {
3223  if ( lpoints ) delete[] lpoints;
3224  }
3230  {
3231  ds >> emr >> rclBounds >> cptl;
3232 
3233  lpoints = new POINTL[cptl];
3234 
3235  POINTLARRAY points( lpoints, cptl );
3236 
3237  ds >> points;
3238  }
3242  bool serialize ( DATASTREAM ds )
3243  {
3244  ds << emr << rclBounds << cptl << POINTLARRAY( lpoints, cptl );
3245  return true;
3246  }
3250  int size ( void ) const { return emr.nSize; }
3256  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
3257  {
3258  EMF_UNUSED(source);
3259  // According to the wine windef.h header, POINT and POINTL are equivalent
3260  Polyline( dc, (POINT*)lpoints, cptl );
3261  }
3262 #ifdef ENABLE_EDITING
3263 
3266  void edit ( void ) const
3267  {
3268  printf( "*POLYLINE*\n" );
3269  edit_rectl( "rclBounds", rclBounds );
3270 #if 0
3271  printf( "\tcptl : %ld\n", cptl );
3272  printf( "\taptl->\n" );
3273  for ( unsigned int i = 0; i < cptl; i++ )
3274  printf( "\t\t%ld, %ld\n", lpoints[i].x, lpoints[i].y );
3275 #else
3276  edit_pointlarray( "\t", cptl, lpoints );
3277 #endif
3278  }
3279 #endif /* ENABLE_EDITING */
3280  };
3281 
3283 
3287  POINT16* lpoints;
3288  public:
3294  EMRPOLYLINE16 ( const RECTL* bounds, const POINT16* points, INT n )
3295  {
3296  cpts = n;
3297  apts[0].x = 0; // Really unused
3298  apts[0].y = 0;
3299 
3300  emr.iType = EMR_POLYLINE16;
3301  // The (cptl - 1) below is to account for aptl, which isn't written out
3302  emr.nSize = sizeof( ::EMRPOLYLINE16 ) + sizeof( POINT16 ) * ( cpts - 1);
3303 
3304  lpoints = new POINT16[cpts];
3305 
3306  for (int i=0; i<n; i++) {
3307  lpoints[i].x = points[i].x;
3308  lpoints[i].y = points[i].y;
3309  }
3310 
3311  rclBounds = *bounds;
3312  }
3319  EMRPOLYLINE16 ( const RECTL* bounds, const POINT* points, INT n )
3320  {
3321  cpts = n;
3322  apts[0].x = 0; // Really unused
3323  apts[0].y = 0;
3324 
3325  emr.iType = EMR_POLYLINE16;
3326  // The (cptl - 1) below is to account for aptl, which isn't written out
3327  emr.nSize = sizeof( ::EMRPOLYLINE16 ) + sizeof( POINT16 ) * ( cpts - 1);
3328 
3329  lpoints = new POINT16[cpts];
3330 
3331  for (int i=0; i<n; i++) {
3332  lpoints[i].x = points[i].x;
3333  lpoints[i].y = points[i].y;
3334  }
3335 
3336  rclBounds = *bounds;
3337  }
3342  {
3343  if ( lpoints ) delete[] lpoints;
3344  }
3350  {
3351  ds >> emr >> rclBounds >> cpts;
3352 
3353  lpoints = new POINT16[cpts];
3354 
3355  POINT16ARRAY points( lpoints, cpts );
3356 
3357  ds >> points;
3358  }
3362  bool serialize ( DATASTREAM ds )
3363  {
3364  ds << emr << rclBounds << cpts << POINT16ARRAY( lpoints, cpts );
3365  return true;
3366  }
3370  int size ( void ) const { return emr.nSize; }
3376  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
3377  {
3378  EMF_UNUSED(source);
3379  // According to the wine windef.h header, POINT and POINTL are equivalent
3380  Polyline16( dc, lpoints, cpts );
3381  }
3382 #ifdef ENABLE_EDITING
3383 
3386  void edit ( void ) const
3387  {
3388  printf( "*POLYLINE16*\n" );
3389  edit_rectl( "rclBounds", rclBounds );
3390  edit_point16array( "\t", cpts, lpoints );
3391  }
3392 #endif /* ENABLE_EDITING */
3393  };
3394 
3396 
3400  POINTL* lpoints;
3401  public:
3407  EMRPOLYGON ( const RECTL* bounds, const POINT* points, INT n )
3408  {
3409  cptl = n;
3410  aptl[0].x = 0; // Really unused
3411  aptl[0].y = 0;
3412 
3413  emr.iType = EMR_POLYGON;
3414  // The (cptl-1) below is to account for aptl, which isn't written out
3415  emr.nSize = sizeof( ::EMRPOLYGON ) + sizeof( POINTL ) * (cptl-1);
3416 
3417  lpoints = new POINTL[cptl];
3418 
3419  for (int i=0; i<n; i++) {
3420  lpoints[i].x = points[i].x;
3421  lpoints[i].y = points[i].y;
3422  }
3423 
3424  rclBounds = *bounds;
3425  }
3431  {
3432  ds >> emr >> rclBounds >> cptl;
3433 
3434  lpoints = new POINTL[cptl];
3435 
3436  POINTLARRAY points( lpoints, cptl );
3437 
3438  ds >> points;
3439  }
3444  {
3445  if ( lpoints ) delete[] lpoints;
3446  }
3450  bool serialize ( DATASTREAM ds )
3451  {
3452  ds << emr << rclBounds << cptl << POINTLARRAY( lpoints, cptl );
3453  return true;
3454  }
3458  int size ( void ) const { return emr.nSize; }
3464  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
3465  {
3466  EMF_UNUSED(source);
3467  // According to the wine windef.h header, POINT and POINTL are equivalent
3468  Polygon( dc, (POINT*)lpoints, cptl );
3469  }
3470 #ifdef ENABLE_EDITING
3471 
3474  void edit ( void ) const
3475  {
3476  printf( "*POLYGON*\n" );
3477  edit_rectl( "rclBounds", rclBounds );
3478 #if 0
3479  printf( "\tcptl : %ld\n", cptl );
3480  printf( "\taptl->\n" );
3481  for ( unsigned int i = 0; i < cptl; i++ )
3482  printf( "\t\t%ld, %ld\n", lpoints[i].x, lpoints[i].y );
3483 #else
3484  edit_pointlarray( "\t", cptl, lpoints );
3485 #endif
3486  }
3487 #endif /* ENABLE_EDITING */
3488  };
3489 
3491 
3495  POINT16* lpoints;
3496  public:
3502  EMRPOLYGON16 ( const RECTL* bounds, const POINT* points, INT16 n )
3503  {
3504  cpts = n;
3505  apts[0].x = 0; // Really unused
3506  apts[0].y = 0;
3507 
3508  emr.iType = EMR_POLYGON16;
3509  // The (cptl-1) below is to account for aptl, which isn't written out
3510  emr.nSize = sizeof( ::EMRPOLYGON16 ) + sizeof( POINT16 ) * (cpts-1);
3511 
3512  lpoints = new POINT16[cpts];
3513 
3514  for (int i=0; i<n; i++) {
3515  lpoints[i].x = points[i].x;
3516  lpoints[i].y = points[i].y;
3517  }
3518 
3519  rclBounds = *bounds;
3520  }
3527  EMRPOLYGON16 ( const RECTL* bounds, const POINT16* points, INT16 n )
3528  {
3529  cpts = n;
3530  apts[0].x = 0; // Really unused
3531  apts[0].y = 0;
3532 
3533  emr.iType = EMR_POLYGON16;
3534  // The (cptl-1) below is to account for aptl, which isn't written out
3535  emr.nSize = sizeof( ::EMRPOLYGON16 ) + sizeof( POINT16 ) * (cpts-1);
3536 
3537  lpoints = new POINT16[cpts];
3538 
3539  for (int i=0; i<n; i++) {
3540  lpoints[i].x = points[i].x;
3541  lpoints[i].y = points[i].y;
3542  }
3543 
3544  rclBounds = *bounds;
3545  }
3551  {
3552  ds >> emr >> rclBounds >> cpts;
3553 
3554  lpoints = new POINT16[cpts];
3555 
3556  POINT16ARRAY points( lpoints, cpts );
3557 
3558  ds >> points;
3559  }
3564  {
3565  if ( lpoints ) delete[] lpoints;
3566  }
3570  bool serialize ( DATASTREAM ds )
3571  {
3572  ds << emr << rclBounds << cpts << POINT16ARRAY( lpoints, cpts );
3573  return true;
3574  }
3578  int size ( void ) const { return emr.nSize; }
3584  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
3585  {
3586  EMF_UNUSED(source);
3587  // According to the wine windef.h header, POINT and POINTL are equivalent
3588  Polygon16( dc, lpoints, cpts );
3589  }
3590 #ifdef ENABLE_EDITING
3591 
3594  void edit ( void ) const
3595  {
3596  printf( "*POLYGON16*\n" );
3597  edit_rectl( "rclBounds", rclBounds );
3598  edit_point16array( "\t", cpts, lpoints );
3599  }
3600 #endif /* ENABLE_EDITING */
3601  };
3602 
3604 
3608  DWORD* lcounts;
3609  POINTL* lpoints;
3610  public:
3617  EMRPOLYPOLYGON ( const RECTL* bounds, const POINT* points, const INT* counts,
3618  UINT polygons )
3619  {
3620  nPolys = polygons;
3621  // Count the number of points in points
3622  int n = 0;
3623  for ( unsigned int i = 0; i < nPolys; i++ )
3624  n += counts[i];
3625 
3626  cptl = n;
3627  aPolyCounts[0] = 0; // Really unused
3628  aptl[0].x = 0;
3629  aptl[0].y = 0;
3630 
3631  emr.iType = EMR_POLYPOLYGON;
3632  // The (#-1)'s below are to account for aPolyCounts[0] and aptl[0], which
3633  // aren't directly written out
3634  emr.nSize = sizeof( ::EMRPOLYPOLYGON ) + sizeof( POINTL ) * (cptl-1)
3635  + sizeof( DWORD ) * (nPolys-1);
3636 
3637  lcounts = new DWORD[nPolys];
3638 
3639  for ( unsigned int i = 0; i < nPolys; i++ )
3640  lcounts[i] = counts[i];
3641 
3642  lpoints = new POINTL[cptl];
3643 
3644  for (int i=0; i<n; i++) {
3645  lpoints[i].x = points[i].x;
3646  lpoints[i].y = points[i].y;
3647  }
3648 
3649  rclBounds = *bounds;
3650  }
3655  {
3656  if ( lcounts ) delete[] lcounts;
3657  if ( lpoints ) delete[] lpoints;
3658  }
3664  {
3665  ds >> emr >> rclBounds >> nPolys >> cptl;
3666 
3667  lcounts = new DWORD[nPolys];
3668 
3669  DWORDARRAY counts( lcounts, nPolys );
3670 
3671  ds >> counts;
3672 
3673  lpoints = new POINTL[cptl];
3674 
3675  POINTLARRAY points( lpoints, cptl );
3676 
3677  ds >> points;
3678  }
3682  bool serialize ( DATASTREAM ds )
3683  {
3684  ds << emr << rclBounds << nPolys << cptl << DWORDARRAY( lcounts, nPolys )
3685  << POINTLARRAY( lpoints, cptl );
3686  return true;
3687  }
3691  int size ( void ) const { return emr.nSize; }
3697  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
3698  {
3699  EMF_UNUSED(source);
3700  // According to the wine windef.h header, POINT and POINTL are equivalent
3701  // (but DWORD and INT are not)
3702  std::vector<INT> countsv( lcounts, lcounts + nPolys );
3703 
3704  PolyPolygon( dc, (POINT*)lpoints, &countsv[0], nPolys );
3705  }
3706 #ifdef ENABLE_EDITING
3707 
3710  void edit ( void ) const
3711  {
3712 #if defined(__LP64__)
3713  const char* FMT0 = "\tnPolys\t\t: %d\n";
3714  const char* FMT1 = "\tcptl\t\t: %d\n";
3715  const char* FMT2 = "%d\n";
3716  const char* FMT3 = "\t\t\t %d\n";
3717  const char* FMT4 = "%d, %d\n";
3718  const char* FMT5 = "\t\t\t %d, %d\n";
3719 #else
3720  const char* FMT0 = "\tnPolys\t\t: %ld\n";
3721  const char* FMT1 = "\tcptl\t\t: %ld\n";
3722  const char* FMT2 = "%ld\n";
3723  const char* FMT3 = "\t\t\t %ld\n";
3724  const char* FMT4 = "%ld, %ld\n";
3725  const char* FMT5 = "\t\t\t %ld, %ld\n";
3726 #endif /* __x86_64__ */
3727  printf( "*POLYPOLYGON*\n" );
3728  edit_rectl( "rclBounds", rclBounds );
3729  printf( FMT0, nPolys );
3730  printf( FMT1, cptl );
3731  printf( "\taPolyCounts\t: " );
3732  if ( nPolys > 0 )
3733  printf( FMT2, lcounts[0] );
3734  else
3735  puts( "" );
3736  for ( unsigned int i = 1; i < nPolys; i++ )
3737  printf( FMT3, lcounts[i] );
3738  printf( "\tapts\t\t: " );
3739  if ( cptl > 0 )
3740  printf( FMT4, lpoints[0].x, lpoints[0].y );
3741  else
3742  puts( "" );
3743  for ( unsigned int i = 1; i < cptl; i++ )
3744  printf( FMT5, lpoints[i].x, lpoints[i].y );
3745  }
3746 #endif /* ENABLE_EDITING */
3747  };
3748 
3750 
3754  DWORD* lcounts;
3755  POINT16* lpoints;
3756  public:
3763  EMRPOLYPOLYGON16 ( const RECTL* bounds, const POINT* points,
3764  const INT* counts, UINT polygons )
3765  {
3766  nPolys = polygons;
3767  // Count the number of points in points
3768  int n = 0;
3769  for ( unsigned int i = 0; i < nPolys; i++ )
3770  n += counts[i];
3771 
3772  cpts = n;
3773  aPolyCounts[0] = 0; // Really unused
3774  apts[0].x = 0;
3775  apts[0].y = 0;
3776 
3777  emr.iType = EMR_POLYPOLYGON16;
3778  // The (#-1)'s below are to account for aPolyCounts[0] and aptl[0], which
3779  // aren't directly written out
3780  emr.nSize = sizeof( ::EMRPOLYPOLYGON16 ) + sizeof( POINT16 ) * (cpts-1)
3781  + sizeof( DWORD ) * (nPolys-1);
3782 
3783  lcounts = new DWORD[nPolys];
3784 
3785  for ( unsigned int i = 0; i < nPolys; i++ )
3786  lcounts[i] = counts[i];
3787 
3788  lpoints = new POINT16[cpts];
3789 
3790  for (int i=0; i<n; i++) {
3791  lpoints[i].x = points[i].x;
3792  lpoints[i].y = points[i].y;
3793  }
3794 
3795  rclBounds = *bounds;
3796  }
3804  EMRPOLYPOLYGON16 ( const RECTL* bounds, const POINT16* points,
3805  const INT* counts, UINT16 polygons )
3806  {
3807  nPolys = polygons;
3808  // Count the number of points in points
3809  int n = 0;
3810  for ( unsigned int i = 0; i < nPolys; i++ )
3811  n += counts[i];
3812 
3813  cpts = n;
3814  aPolyCounts[0] = 0; // Really unused
3815  apts[0].x = 0;
3816  apts[0].y = 0;
3817 
3818  emr.iType = EMR_POLYPOLYGON16;
3819  // The (#-1)'s below are to account for aPolyCounts[0] and aptl[0], which
3820  // aren't directly written out
3821  emr.nSize = sizeof( ::EMRPOLYPOLYGON16 ) + sizeof( POINT16 ) * (cpts-1)
3822  + sizeof( DWORD ) * (nPolys-1);
3823 
3824  lcounts = new DWORD[nPolys];
3825 
3826  for ( unsigned int i = 0; i < nPolys; i++ )
3827  lcounts[i] = counts[i];
3828 
3829  lpoints = new POINT16[cpts];
3830 
3831  for (int i=0; i<n; i++) {
3832  lpoints[i].x = points[i].x;
3833  lpoints[i].y = points[i].y;
3834  }
3835 
3836  rclBounds = *bounds;
3837  }
3842  {
3843  if ( lcounts ) delete[] lcounts;
3844  if ( lpoints ) delete[] lpoints;
3845  }
3851  {
3852  ds >> emr >> rclBounds >> nPolys >> cpts;
3853 
3854  lcounts = new DWORD[nPolys];
3855 
3856  DWORDARRAY counts( lcounts, nPolys );
3857 
3858  ds >> counts;
3859 
3860  lpoints = new POINT16[cpts];
3861 
3862  POINT16ARRAY points( lpoints, cpts );
3863 
3864  ds >> points;
3865  }
3869  bool serialize ( DATASTREAM ds )
3870  {
3871  ds << emr << rclBounds << nPolys << cpts << DWORDARRAY( lcounts, nPolys )
3872  << POINT16ARRAY( lpoints, cpts );
3873  return true;
3874  }
3878  int size ( void ) const { return emr.nSize; }
3884  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
3885  {
3886  EMF_UNUSED(source);
3887  // According to the wine windef.h header, POINT and POINTL are equivalent
3888  // (but DWORD and INT are not)
3889  std::vector<INT> counts( lcounts, lcounts + nPolys );
3890 
3891  PolyPolygon16( dc, lpoints, &counts[0], nPolys );
3892  }
3893 #ifdef ENABLE_EDITING
3894 
3897  void edit ( void ) const
3898  {
3899 #if defined(__LP64__)
3900  const char* FMT0 = "\tnPolys\t\t: %d\n";
3901  const char* FMT1 = "\tcptl\t\t: %d\n";
3902  const char* FMT2 = "%d\n";
3903  const char* FMT3 = "\t\t\t %d\n";
3904 #else
3905  const char* FMT0 = "\tnPolys\t\t: %ld\n";
3906  const char* FMT1 = "\tcptl\t\t: %ld\n";
3907  const char* FMT2 = "%ld\n";
3908  const char* FMT3 = "\t\t\t %ld\n";
3909 #endif /* __x86_64__ */
3910  printf( "*POLYPOLYGON16*\n" );
3911  edit_rectl( "rclBounds", rclBounds );
3912  printf( FMT0, nPolys );
3913  printf( FMT1, cpts );
3914  printf( "\taPolyCounts\t: " );
3915  if ( nPolys > 0 )
3916  printf( FMT2, lcounts[0] );
3917  else
3918  puts( "" );
3919  for ( unsigned int i = 1; i < nPolys; i++ )
3920  printf( FMT3, lcounts[i] );
3921  printf( "\tapts\t\t: " );
3922  if ( cpts > 0 )
3923  printf( "%d, %d\n", lpoints[0].x, lpoints[0].y );
3924  else
3925  puts( "" );
3926  for ( unsigned int i = 1; i < cpts; i++ )
3927  printf( "\t\t\t %d, %d\n", lpoints[i].x, lpoints[i].y );
3928  }
3929 #endif /* ENABLE_EDITING */
3930  };
3931 
3933 
3937  POINTL* lpoints;
3938  public:
3944  EMRPOLYBEZIER ( const RECTL* bounds, const POINT* points, INT n )
3945  {
3946  cptl = n;
3947  aptl[0].x = 0; // Really unused
3948  aptl[0].y = 0;
3949 
3950  emr.iType = EMR_POLYBEZIER;
3951  // The (cptl-1) below is to account for aptl, which isn't written out
3952  emr.nSize = sizeof( ::EMRPOLYBEZIER ) + sizeof( POINTL ) * (cptl-1);
3953 
3954  lpoints = new POINTL[cptl];
3955 
3956  for (int i=0; i<n; i++) {
3957  lpoints[i].x = points[i].x;
3958  lpoints[i].y = points[i].y;
3959  }
3960 
3961  rclBounds = *bounds;
3962  }
3968  {
3969  ds >> emr >> rclBounds >> cptl;
3970 
3971  lpoints = new POINTL[cptl];
3972 
3973  POINTLARRAY points( lpoints, cptl );
3974 
3975  ds >> points;
3976  }
3981  {
3982  if ( lpoints ) delete[] lpoints;
3983  }
3987  bool serialize ( DATASTREAM ds )
3988  {
3989  ds << emr << rclBounds << cptl << POINTLARRAY( lpoints, cptl );
3990  return true;
3991  }
3995  int size ( void ) const { return emr.nSize; }
4001  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
4002  {
4003  EMF_UNUSED(source);
4004  // According to the wine windef.h header, POINT and POINTL are equivalent
4005  PolyBezier( dc, (POINT*)lpoints, cptl );
4006  }
4007 #ifdef ENABLE_EDITING
4008 
4011  void edit ( void ) const
4012  {
4013  printf( "*POLYBEZIER*\n" );
4014  edit_rectl( "rclBounds", rclBounds );
4015 #if 0
4016  printf( "\tcptl : %ld\n", cptl );
4017  printf( "\taptl->\n" );
4018  for ( unsigned int i = 0; i < cptl; i++ )
4019  printf( "\t\t%ld, %ld\n", lpoints[i].x, lpoints[i].y );
4020 #else
4021  edit_pointlarray( "\t", cptl, lpoints );
4022 #endif
4023  }
4024 #endif /* ENABLE_EDITING */
4025  };
4026 
4028 
4032  POINT16* lpoints;
4033  public:
4039  EMRPOLYBEZIER16 ( const RECTL* bounds, const POINT16* points, INT n )
4040  {
4041  cpts = n;
4042  apts[0].x = 0; // Really unused
4043  apts[0].y = 0;
4044 
4045  emr.iType = EMR_POLYBEZIER16;
4046  // The (cptl-1) below is to account for aptl, which isn't written out
4047  emr.nSize = sizeof( ::EMRPOLYBEZIER16 ) + sizeof( POINT16 ) * (cpts-1);
4048 
4049  lpoints = new POINT16[cpts];
4050 
4051  for (int i=0; i<n; i++) {
4052  lpoints[i].x = points[i].x;
4053  lpoints[i].y = points[i].y;
4054  }
4055 
4056  rclBounds = *bounds;
4057  }
4064  EMRPOLYBEZIER16 ( const RECTL* bounds, const POINT* points, INT n )
4065  {
4066  cpts = n;
4067  apts[0].x = 0; // Really unused
4068  apts[0].y = 0;
4069 
4070  emr.iType = EMR_POLYBEZIER16;
4071  // The (cptl-1) below is to account for aptl, which isn't written out
4072  emr.nSize = sizeof( ::EMRPOLYBEZIER16 ) + sizeof( POINT16 ) * (cpts-1);
4073 
4074  lpoints = new POINT16[cpts];
4075 
4076  for (int i=0; i<n; i++) {
4077  lpoints[i].x = points[i].x;
4078  lpoints[i].y = points[i].y;
4079  }
4080 
4081  rclBounds = *bounds;
4082  }
4088  {
4089  ds >> emr >> rclBounds >> cpts;
4090 
4091  lpoints = new POINT16[cpts];
4092 
4093  POINT16ARRAY points( lpoints, cpts );
4094 
4095  ds >> points;
4096  }
4101  {
4102  if ( lpoints ) delete[] lpoints;
4103  }
4107  bool serialize ( DATASTREAM ds )
4108  {
4109  ds << emr << rclBounds << cpts << POINT16ARRAY( lpoints, cpts );
4110  return true;
4111  }
4115  int size ( void ) const { return emr.nSize; }
4121  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
4122  {
4123  EMF_UNUSED(source);
4124  // According to the wine windef.h header, POINT and POINTL are equivalent
4125  PolyBezier16( dc, lpoints, cpts );
4126  }
4127 #ifdef ENABLE_EDITING
4128 
4131  void edit ( void ) const
4132  {
4133  printf( "*POLYBEZIER16*\n" );
4134  edit_rectl( "rclBounds", rclBounds );
4135  edit_point16array( "\t", cpts, lpoints );
4136  }
4137 #endif /* ENABLE_EDITING */
4138  };
4139 
4141 
4145  POINTL* lpoints;
4146  public:
4152  EMRPOLYBEZIERTO ( const RECTL* bounds, const POINT* points, INT n )
4153  {
4154  cptl = n;
4155  aptl[0].x = 0; // Really unused
4156  aptl[0].y = 0;
4157 
4158  emr.iType = EMR_POLYBEZIERTO;
4159  // The (cptl-1) below is to account for aptl, which isn't written out
4160  emr.nSize = sizeof( ::EMRPOLYBEZIERTO ) + sizeof( POINTL ) * (cptl-1);
4161 
4162  lpoints = new POINTL[cptl];
4163 
4164  for (int i=0; i<n; i++) {
4165  lpoints[i].x = points[i].x;
4166  lpoints[i].y = points[i].y;
4167  }
4168 
4169  rclBounds = *bounds;
4170  }
4176  {
4177  ds >> emr >> rclBounds >> cptl;
4178 
4179  lpoints = new POINTL[cptl];
4180 
4181  POINTLARRAY points( lpoints, cptl );
4182 
4183  ds >> points;
4184  }
4189  {
4190  if ( lpoints ) delete[] lpoints;
4191  }
4195  bool serialize ( DATASTREAM ds )
4196  {
4197  ds << emr << rclBounds << cptl << POINTLARRAY( lpoints, cptl );
4198  return true;
4199  }
4203  int size ( void ) const { return emr.nSize; }
4209  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
4210  {
4211  EMF_UNUSED(source);
4212  // According to the wine windef.h header, POINT and POINTL are equivalent
4213  PolyBezierTo( dc, (POINT*)lpoints, cptl );
4214  }
4215 #ifdef ENABLE_EDITING
4216 
4219  void edit ( void ) const
4220  {
4221  printf( "*POLYBEZIERTO*\n" );
4222  edit_rectl( "rclBounds", rclBounds );
4223 #if 0
4224  printf( "\tcptl : %ld\n", cptl );
4225  printf( "\taptl->\n" );
4226  for ( unsigned int i = 0; i < cptl; i++ )
4227  printf( "\t\t%ld, %ld\n", lpoints[i].x, lpoints[i].y );
4228 #else
4229  edit_pointlarray( "\t", cptl, lpoints );
4230 #endif
4231  }
4232 #endif /* ENABLE_EDITING */
4233  };
4234 
4236 
4240  POINT16* lpoints;
4241  public:
4247  EMRPOLYBEZIERTO16 ( const RECTL* bounds, const POINT16* points, INT n )
4248  {
4249  cpts = n;
4250  apts[0].x = 0; // Really unused
4251  apts[0].y = 0;
4252 
4253  emr.iType = EMR_POLYBEZIERTO16;
4254  // The (cptl-1) below is to account for aptl, which isn't written out
4255  emr.nSize = sizeof( ::EMRPOLYBEZIERTO16 ) + sizeof( POINT16 ) * (cpts-1);
4256 
4257  lpoints = new POINT16[cpts];
4258 
4259  for (int i=0; i<n; i++) {
4260  lpoints[i].x = points[i].x;
4261  lpoints[i].y = points[i].y;
4262  }
4263 
4264  rclBounds = *bounds;
4265  }
4272  EMRPOLYBEZIERTO16 ( const RECTL* bounds, const POINT* points, INT n )
4273  {
4274  cpts = n;
4275  apts[0].x = 0; // Really unused
4276  apts[0].y = 0;
4277 
4278  emr.iType = EMR_POLYBEZIERTO16;
4279  // The (cptl-1) below is to account for aptl, which isn't written out
4280  emr.nSize = sizeof( ::EMRPOLYBEZIERTO16 ) + sizeof( POINT16 ) * (cpts-1);
4281 
4282  lpoints = new POINT16[cpts];
4283 
4284  for (int i=0; i<n; i++) {
4285  lpoints[i].x = points[i].x;
4286  lpoints[i].y = points[i].y;
4287  }
4288 
4289  rclBounds = *bounds;
4290  }
4296  {
4297  ds >> emr >> rclBounds >> cpts;
4298 
4299  lpoints = new POINT16[cpts];
4300 
4301  POINT16ARRAY points( lpoints, cpts );
4302 
4303  ds >> points;
4304  }
4309  {
4310  if ( lpoints ) delete[] lpoints;
4311  }
4315  bool serialize ( DATASTREAM ds )
4316  {
4317  ds << emr << rclBounds << cpts << POINT16ARRAY( lpoints, cpts );
4318  return true;
4319  }
4323  int size ( void ) const { return emr.nSize; }
4329  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
4330  {
4331  EMF_UNUSED(source);
4332  // According to the wine windef.h header, POINT and POINTL are equivalent
4333  PolyBezierTo16( dc, lpoints, cpts );
4334  }
4335 #ifdef ENABLE_EDITING
4336 
4339  void edit ( void ) const
4340  {
4341  printf( "*POLYBEZIERTO16*\n" );
4342  edit_rectl( "rclBounds", rclBounds );
4343  edit_point16array( "\t", cpts, lpoints );
4344  }
4345 #endif /* ENABLE_EDITING */
4346  };
4347 
4349 
4353  POINTL* lpoints;
4354  public:
4360  EMRPOLYLINETO ( const RECTL* bounds, const POINT* points, INT n )
4361  {
4362  cptl = n;
4363  aptl[0].x = 0;
4364  aptl[0].y = 0;
4365 
4366  emr.iType = EMR_POLYLINETO;
4367  // The (cptl-1) below is to account for aptl, which isn't written out
4368  emr.nSize = sizeof( ::EMRPOLYLINETO ) + sizeof( POINTL ) * (cptl-1);
4369 
4370  lpoints = new POINTL[cptl];
4371 
4372  for (int i=0; i<n; i++) {
4373  lpoints[i].x = points[i].x;
4374  lpoints[i].y = points[i].y;
4375  }
4376 
4377  rclBounds = *bounds;
4378  }
4384  {
4385  ds >> emr >> rclBounds >> cptl;
4386 
4387  lpoints = new POINTL[cptl];
4388 
4389  POINTLARRAY points( lpoints, cptl );
4390 
4391  ds >> points;
4392  }
4397  {
4398  if ( lpoints ) delete[] lpoints;
4399  }
4403  bool serialize ( DATASTREAM ds )
4404  {
4405  ds << emr << rclBounds << cptl << POINTLARRAY( lpoints, cptl );
4406  return true;
4407  }
4411  int size ( void ) const { return emr.nSize; }
4417  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
4418  {
4419  EMF_UNUSED(source);
4420  // According to the wine windef.h header, POINT and POINTL are equivalent
4421  PolylineTo( dc, (POINT*)lpoints, cptl );
4422  }
4423 #ifdef ENABLE_EDITING
4424 
4427  void edit ( void ) const
4428  {
4429  printf( "*POLYLINETO*\n" );
4430  edit_rectl( "rclBounds", rclBounds );
4431 #if 0
4432  printf( "\tcptl : %ld\n", cptl );
4433  printf( "\taptl->\n" );
4434  for ( unsigned int i = 0; i < cptl; i++ )
4435  printf( "\t\t%ld, %ld\n", lpoints[i].x, lpoints[i].y );
4436 #else
4437  edit_pointlarray( "\t", cptl, lpoints );
4438 #endif
4439  }
4440 #endif /* ENABLE_EDITING */
4441  };
4442 
4444 
4448  POINT16* lpoints;
4449  public:
4455  EMRPOLYLINETO16 ( const RECTL* bounds, const POINT16* points, INT n )
4456  {
4457  cpts = n;
4458  apts[0].x = 0;
4459  apts[0].y = 0;
4460 
4461  emr.iType = EMR_POLYLINETO16;
4462  // The (cptl-1) below is to account for aptl, which isn't written out
4463  emr.nSize = sizeof( ::EMRPOLYLINETO16 ) + sizeof( POINT16 ) * (cpts-1);
4464 
4465  lpoints = new POINT16[cpts];
4466 
4467  for (int i=0; i<n; i++) {
4468  lpoints[i].x = points[i].x;
4469  lpoints[i].y = points[i].y;
4470  }
4471 
4472  rclBounds = *bounds;
4473  }
4480  EMRPOLYLINETO16 ( const RECTL* bounds, const POINT* points, INT n )
4481  {
4482  cpts = n;
4483  apts[0].x = 0;
4484  apts[0].y = 0;
4485 
4486  emr.iType = EMR_POLYLINETO16;
4487  // The (cptl-1) below is to account for aptl, which isn't written out
4488  emr.nSize = sizeof( ::EMRPOLYLINETO16 ) + sizeof( POINT16 ) * (cpts-1);
4489 
4490  lpoints = new POINT16[cpts];
4491 
4492  for (int i=0; i<n; i++) {
4493  lpoints[i].x = points[i].x;
4494  lpoints[i].y = points[i].y;
4495  }
4496 
4497  rclBounds = *bounds;
4498  }
4504  {
4505  ds >> emr >> rclBounds >> cpts;
4506 
4507  lpoints = new POINT16[cpts];
4508 
4509  POINT16ARRAY points( lpoints, cpts );
4510 
4511  ds >> points;
4512  }
4517  {
4518  if ( lpoints ) delete[] lpoints;
4519  }
4523  bool serialize ( DATASTREAM ds )
4524  {
4525  ds << emr << rclBounds << cpts << POINT16ARRAY( lpoints, cpts );
4526  return true;
4527  }
4531  int size ( void ) const { return emr.nSize; }
4537  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
4538  {
4539  EMF_UNUSED(source);
4540  // According to the wine windef.h header, POINT and POINTL are equivalent
4541  PolylineTo16( dc, lpoints, cpts );
4542  }
4543 #ifdef ENABLE_EDITING
4544 
4547  void edit ( void ) const
4548  {
4549  printf( "*POLYLINETO16*\n" );
4550  edit_rectl( "rclBounds", rclBounds );
4551  edit_point16array( "\t", cpts, lpoints );
4552  }
4553 #endif /* ENABLE_EDITING */
4554  };
4555 
4557 
4563  PSTR string_a;
4564  int string_size;
4565 
4566  INT* dx_i;
4567  public:
4577  EMREXTTEXTOUTA ( const RECTL* bounds, DWORD graphicsMode, FLOAT xScale,
4578  FLOAT yScale, const PEMRTEXT text, LPCSTR string,
4579  const INT* dx )
4580  {
4581  emr.iType = EMR_EXTTEXTOUTA;
4582  emr.nSize = sizeof( ::EMREXTTEXTOUTA );
4583 
4584  rclBounds = *bounds;
4585 
4586  iGraphicsMode = graphicsMode;
4587  exScale = xScale;
4588  eyScale = yScale;
4589 
4590  emrtext = *text;
4591 
4592  string_size = ROUND_TO_LONG( emrtext.nChars );
4593 
4594  string_a = new CHAR[ string_size ];
4595 
4596  memset( string_a, 0, sizeof(CHAR) * string_size );
4597 
4598  for ( unsigned int i=0; i<emrtext.nChars; i++ )
4599  string_a[i] = *string++;
4600 
4601  emrtext.offString = emr.nSize;
4602  emr.nSize += string_size * sizeof(CHAR);
4603 #if 0
4604 /*
4605 Test only - Problem: Windows requires this dx to be set - at least from 2K on
4606 but to calculate real dx values is hard
4607 For pstoedit - this is "fixed" now by estimating dx in pstoedit
4608 */
4609  if ( !dx ) {
4610  int * dxn = new int [string_size];
4611  for (unsigned int i=0; i < string_size; i++) dxn[i] = 10;
4612  dx = dxn;
4613  }
4614 #endif
4615 
4616  if ( dx ) {
4617 
4618  dx_i = new INT[ emrtext.nChars ];
4619 
4620  for ( unsigned int i=0; i<emrtext.nChars; i++ )
4621  dx_i[i] = *dx++;
4622 
4623  emrtext.offDx = emr.nSize;
4624  emr.nSize += emrtext.nChars * sizeof(INT);
4625  }
4626  else {
4627  emrtext.offDx = 0;
4628  dx_i = 0;
4629  }
4630  }
4636  {
4637  ds >> emr >> rclBounds >> iGraphicsMode >> exScale >> eyScale >> emrtext;
4638 
4639  if ( emrtext.offString != 0 ) {
4640  string_size = ROUND_TO_LONG( emrtext.nChars );
4641 
4642  string_a = new CHAR[ string_size ];
4643 
4644  memset( string_a, 0, sizeof(CHAR) * string_size );
4645 
4646  CHARSTR string( string_a, string_size );
4647 
4648  ds >> string;
4649  }
4650  else
4651  string_a = 0;
4652 
4653  if ( emrtext.offDx ) {
4654  dx_i = new INT[ emrtext.nChars ];
4655 
4656  INTARRAY dx_is( dx_i, emrtext.nChars );
4657 
4658  ds >> dx_is;
4659  }
4660  else
4661  dx_i = 0;
4662  }
4668  {
4669  if ( string_a ) delete[] string_a;
4670  if ( dx_i ) delete[] dx_i;
4671  }
4675  bool serialize ( DATASTREAM ds )
4676  {
4677  ds << emr << rclBounds << iGraphicsMode << exScale << eyScale
4678  << emrtext << CHARSTR( string_a, string_size );
4679  if ( dx_i )
4680  ds << INTARRAY( dx_i, emrtext.nChars );
4681  return true;
4682  }
4686  int size ( void ) const { return emr.nSize; }
4692  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
4693  {
4694  EMF_UNUSED(source);
4695  RECT rect;
4696  rect.left = emrtext.rcl.left;
4697  rect.top = emrtext.rcl.top;
4698  rect.right = emrtext.rcl.right;
4699  rect.bottom = emrtext.rcl.bottom;
4700 
4701  ExtTextOutA( dc, emrtext.ptlReference.x, emrtext.ptlReference.y,
4702  emrtext.fOptions, &rect, string_a, emrtext.nChars,
4703  dx_i );
4704  }
4705 #ifdef ENABLE_EDITING
4706 
4709  void edit ( void ) const
4710  {
4711 #if defined(__LP64__)
4712  const char* FMT0 = "unknown(%d)\n";
4713  const char* FMT1 = "\tptlReference\t: (%d,%d)\n";
4714  const char* FMT2 = "\tnChars\t\t: %d\n";
4715  const char* FMT3 = "\toffString\t: %d\n";
4716  const char* FMT4 = "\toffDx\t\t: %d\n";
4717 #else
4718  const char* FMT0 = "unknown(%ld)\n";
4719  const char* FMT1 = "\tptlReference\t: (%ld,%ld)\n";
4720  const char* FMT2 = "\tnChars\t\t: %ld\n";
4721  const char* FMT3 = "\toffString\t: %ld\n";
4722  const char* FMT4 = "\toffDx\t\t: %ld\n";
4723 #endif /* __x86_64__ */
4724  printf( "*EXTTEXTOUTA*\n" );
4725  edit_rectl( "rclBounds", rclBounds );
4726  printf( "\tiGraphicsMode\t: " );
4727  switch ( iGraphicsMode ) {
4728  case GM_COMPATIBLE: printf( "GM_COMPATIBLE\n" ); break;
4729  case GM_ADVANCED: printf( "GM_ADVANCED\n" ); break;
4730  default: printf( FMT0, iGraphicsMode );
4731  }
4732  printf( "\texScale\t\t: %f\n", exScale );
4733  printf( "\teyScale\t\t: %f\n", eyScale );
4734  printf( FMT1, emrtext.ptlReference.x, emrtext.ptlReference.y );
4735  printf( FMT2, emrtext.nChars );
4736  printf( FMT3, emrtext.offString );
4737  printf( "\tfOptions\t: " );
4738  if ( emrtext.fOptions == 0 )
4739  printf( "None" );
4740  else {
4741  if ( emrtext.fOptions & ETO_GRAYED ) {
4742  printf( "ETO_GRAYED" );
4743  if ( emrtext.fOptions & ~ETO_GRAYED )
4744  printf( " | " );
4745  }
4746  if ( emrtext.fOptions & ETO_OPAQUE ) {
4747  printf( "ETO_OPAQUE" );
4748  if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE) )
4749  printf( " | " );
4750  }
4751  if ( emrtext.fOptions & ETO_CLIPPED ) {
4752  printf( "ETO_CLIPPED" );
4753  if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED ) )
4754  printf( " | " );
4755  }
4756  if ( emrtext.fOptions & ETO_GLYPH_INDEX ) {
4757  printf( "ETO_GLYPH_INDEX" );
4758  if ( emrtext.fOptions &
4759  ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX) )
4760  printf( " | " );
4761  }
4762  if ( emrtext.fOptions & ETO_RTLREADING ) {
4763  printf( "ETO_RTLREADING" );
4764  if ( emrtext.fOptions &
4765  ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX |
4766  ETO_RTLREADING) )
4767  printf( " | " );
4768  }
4769  if ( emrtext.fOptions & ETO_IGNORELANGUAGE )
4770  printf( "ETO_IGNORELANGUAGE" );
4771  }
4772  printf( "\n" );
4773  edit_rectl( "rcl\t", emrtext.rcl );
4774  printf( FMT4, emrtext.offDx );
4775  printf( "\tString:\n\t\t%s\n", string_a );
4776 
4777  if ( emrtext.offDx != 0 ) {
4778  printf( "\tOffsets:\n\t\t" );
4779  for ( unsigned int i = 0; i < emrtext.nChars; i++ )
4780  printf( "%d ", dx_i[i] );
4781  printf( "\n" );
4782  }
4783  }
4784 #endif /* ENABLE_EDITING */
4785  };
4787 
4793  PWSTR string_a;
4794  int string_size;
4795 
4796  INT* dx_i;
4797  public:
4807  EMREXTTEXTOUTW ( const RECTL* bounds, DWORD graphicsMode, FLOAT xScale,
4808  FLOAT yScale, const PEMRTEXT text, LPCWSTR string,
4809  const INT* dx )
4810  {
4811  emr.iType = EMR_EXTTEXTOUTW;
4812  emr.nSize = sizeof( ::EMREXTTEXTOUTW );
4813 
4814  rclBounds = *bounds;
4815 
4816  iGraphicsMode = graphicsMode;
4817  exScale = xScale;
4818  eyScale = yScale;
4819 
4820  emrtext = *text;
4821 
4822  string_size = ROUND_TO_LONG( emrtext.nChars );
4823 
4824  string_a = new WCHAR[ string_size ];
4825 
4826  memset( string_a, 0, sizeof(WCHAR) * string_size );
4827 
4828  for ( unsigned int i=0; i<emrtext.nChars; i++ )
4829  string_a[i] = *string++;
4830 
4831  emrtext.offString = emr.nSize;
4832  emr.nSize += string_size * sizeof(WCHAR);
4833 #if 0
4834 /*
4835 Test only - Problem: Windows requires this dx to be set - at least from 2K on
4836 but to calculate real dx values is hard
4837 For pstoedit - this is "fixed" now by estimating dx in pstoedit
4838 */
4839  if ( !dx ) {
4840  int * dxn = new int [string_size];
4841  for (unsigned int i=0; i < string_size; i++) dxn[i] = 10;
4842  dx = dxn;
4843  }
4844 #endif
4845 
4846  if ( dx ) {
4847 
4848  dx_i = new INT[ emrtext.nChars ];
4849 
4850  for ( unsigned int i=0; i<emrtext.nChars; i++ )
4851  dx_i[i] = *dx++;
4852 
4853  emrtext.offDx = emr.nSize;
4854  emr.nSize += emrtext.nChars * sizeof(INT);
4855  }
4856  else {
4857  emrtext.offDx = 0;
4858  dx_i = 0;
4859  }
4860  }
4866  {
4867  ds >> emr >> rclBounds >> iGraphicsMode >> exScale >> eyScale >> emrtext;
4868 
4869  if ( emrtext.offString != 0 ) {
4870  string_size = ROUND_TO_LONG( emrtext.nChars );
4871 
4872  string_a = new WCHAR[ string_size ];
4873 
4874  memset( string_a, 0, sizeof(WCHAR) * string_size );
4875 
4876  WCHARSTR string( string_a, string_size );
4877 
4878  ds >> string;
4879  }
4880  else
4881  string_a = 0;
4882 
4883  if ( emrtext.offDx ) {
4884  dx_i = new INT[ emrtext.nChars ];
4885 
4886  INTARRAY dx_is( dx_i, emrtext.nChars );
4887 
4888  ds >> dx_is;
4889  }
4890  else
4891  dx_i = 0;
4892  }
4898  {
4899  if ( string_a ) delete[] string_a;
4900  if ( dx_i ) delete[] dx_i;
4901  }
4905  bool serialize ( DATASTREAM ds )
4906  {
4907  ds << emr << rclBounds << iGraphicsMode << exScale << eyScale
4908  << emrtext << WCHARSTR( string_a, string_size );
4909  if ( dx_i )
4910  ds << INTARRAY( dx_i, emrtext.nChars );
4911  return true;
4912  }
4916  int size ( void ) const { return emr.nSize; }
4922  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
4923  {
4924  EMF_UNUSED(source);
4925  RECT rect;
4926  rect.left = emrtext.rcl.left;
4927  rect.top = emrtext.rcl.top;
4928  rect.right = emrtext.rcl.right;
4929  rect.bottom = emrtext.rcl.bottom;
4930 
4931  ExtTextOutW( dc, emrtext.ptlReference.x, emrtext.ptlReference.y,
4932  emrtext.fOptions, &rect, string_a, emrtext.nChars,
4933  dx_i );
4934  }
4935 #ifdef ENABLE_EDITING
4936 
4939  void edit ( void ) const
4940  {
4941 #if defined(__LP64__)
4942  const char* FMT0 = "unknown(%d)\n";
4943  const char* FMT1 = "\tptlReference\t: (%d,%d)\n";
4944  const char* FMT2 = "\tnChars\t\t: %d\n";
4945  const char* FMT3 = "\toffString\t: %d\n";
4946  const char* FMT4 = "\toffDx\t\t: %d\n";
4947 #else
4948  const char* FMT0 = "unknown(%ld)\n";
4949  const char* FMT1 = "\tptlReference\t: (%ld,%ld)\n";
4950  const char* FMT2 = "\tnChars\t\t: %ld\n";
4951  const char* FMT3 = "\toffString\t: %ld\n";
4952  const char* FMT4 = "\toffDx\t\t: %ld\n";
4953 #endif /* __x86_64__ */
4954  printf( "*EXTTEXTOUTA*\n" );
4955  edit_rectl( "rclBounds", rclBounds );
4956  printf( "\tiGraphicsMode\t: " );
4957  switch ( iGraphicsMode ) {
4958  case GM_COMPATIBLE: printf( "GM_COMPATIBLE\n" ); break;
4959  case GM_ADVANCED: printf( "GM_ADVANCED\n" ); break;
4960  default: printf( FMT0, iGraphicsMode );
4961  }
4962  printf( "\texScale\t\t: %f\n", exScale );
4963  printf( "\teyScale\t\t: %f\n", eyScale );
4964  printf( FMT1, emrtext.ptlReference.x, emrtext.ptlReference.y );
4965  printf( FMT2, emrtext.nChars );
4966  printf( FMT3, emrtext.offString );
4967  printf( "\tfOptions\t: " );
4968  if ( emrtext.fOptions == 0 )
4969  printf( "None" );
4970  else {
4971  if ( emrtext.fOptions & ETO_GRAYED ) {
4972  printf( "ETO_GRAYED" );
4973  if ( emrtext.fOptions & ~ETO_GRAYED )
4974  printf( " | " );
4975  }
4976  if ( emrtext.fOptions & ETO_OPAQUE ) {
4977  printf( "ETO_OPAQUE" );
4978  if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE) )
4979  printf( " | " );
4980  }
4981  if ( emrtext.fOptions & ETO_CLIPPED ) {
4982  printf( "ETO_CLIPPED" );
4983  if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED ) )
4984  printf( " | " );
4985  }
4986  if ( emrtext.fOptions & ETO_GLYPH_INDEX ) {
4987  printf( "ETO_GLYPH_INDEX" );
4988  if ( emrtext.fOptions &
4989  ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX) )
4990  printf( " | " );
4991  }
4992  if ( emrtext.fOptions & ETO_RTLREADING ) {
4993  printf( "ETO_RTLREADING" );
4994  if ( emrtext.fOptions &
4995  ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX |
4996  ETO_RTLREADING) )
4997  printf( " | " );
4998  }
4999  if ( emrtext.fOptions & ETO_IGNORELANGUAGE )
5000  printf( "ETO_IGNORELANGUAGE" );
5001  }
5002  printf( "\n" );
5003  edit_rectl( "rcl\t", emrtext.rcl );
5004  printf( FMT4, emrtext.offDx );
5005 #if 0
5006  printf( "\tString:\n\t\t%s\n", string_a );
5007 #else
5008  {
5009  // iconv_open arguments are TO, FROM (not the other way around).
5010  iconv_t cvt = iconv_open( "UTF-8", "UTF-16LE" );
5011  std::vector<char> utf8_buffer( emrtext.nChars );
5012  // Cannot predict the space necessary to hold the converted
5013  // string. So, we loop until conversion is complete.
5014  size_t size = emrtext.nChars * sizeof(*string_a);
5015  size_t in_bytes_left = size;
5016  size_t converted = 0;
5017  char* in_buffer = (char*)string_a;
5018  while ( 1 ) {
5019  char* out_buffer = &utf8_buffer[converted];
5020  size_t out_bytes_left = size - converted;
5021 
5022  size_t n = iconv( cvt, &in_buffer, &in_bytes_left,
5023  &out_buffer, &out_bytes_left );
5024 
5025  converted = size - out_bytes_left;
5026 
5027  if ( n == (size_t)-1 ) {
5028  if ( errno == E2BIG ) {
5029  size_t new_size = 2 * utf8_buffer.size();
5030  utf8_buffer.resize( new_size );
5031  size = utf8_buffer.size();
5032  }
5033  else {
5034  // Real conversion error.
5035  break;
5036  }
5037  }
5038  else {
5039  break;
5040  }
5041  }
5042 
5043  iconv_close( cvt );
5044 
5045  if ( converted == utf8_buffer.size() )
5046  utf8_buffer.push_back( '\0' );
5047  else
5048  utf8_buffer[converted] = '\0';
5049 
5050  printf( "\tString:\n\t\t%s\n", &utf8_buffer[0] );
5051  }
5052 #endif
5053  if ( emrtext.offDx != 0 ) {
5054  printf( "\tOffsets:\n\t\t" );
5055  for ( unsigned int i = 0; i < emrtext.nChars; i++ )
5056  printf( "%d ", dx_i[i] );
5057  printf( "\n" );
5058  }
5059  }
5060 #endif /* ENABLE_EDITING */
5061  };
5062 
5064 
5068  public:
5074  EMRSETPIXELV ( INT x, INT y, COLORREF color )
5075  {
5076  emr.iType = EMR_SETPIXELV;
5077  emr.nSize = sizeof( ::EMRSETPIXELV );
5078  ptlPixel.x = x;
5079  ptlPixel.y = y;
5080  crColor = color;
5081  }
5087  {
5088  ds >> emr >> ptlPixel >> crColor;
5089  }
5093  bool serialize ( DATASTREAM ds )
5094  {
5095  ds << emr << ptlPixel << crColor;
5096  return true;
5097  }
5101  int size ( void ) const { return emr.nSize; }
5107  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
5108  {
5109  EMF_UNUSED(source);
5110  SetPixel( dc, ptlPixel.x, ptlPixel.y, crColor );
5111  }
5112 #ifdef ENABLE_EDITING
5113 
5116  void edit ( void ) const
5117  {
5118  printf( "*SETPIXELV*\n" );
5119  edit_pointl( "ptlPixel", ptlPixel );
5120  edit_color( "crColor\t", crColor );
5121  }
5122 #endif /* ENABLE_EDITING */
5123  };
5124 
5125  class PEN;
5126  class EXTPEN;
5127  class BRUSH;
5128  class FONT;
5129  class PALETTE;
5130 
5132 
5135  class EMRCREATEPEN : public METARECORD, public ::EMRCREATEPEN
5136  {
5137  public:
5142  EMRCREATEPEN ( PEN* pen, HGDIOBJ handle );
5147  EMRCREATEPEN ( DATASTREAM& ds );
5151  bool serialize ( DATASTREAM ds )
5152  {
5153  ds << emr << ihPen << lopn;
5154  return true;
5155  }
5159  int size ( void ) const { return emr.nSize; }
5165  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const;
5166 #ifdef ENABLE_EDITING
5167 
5170  void edit ( void ) const
5171  {
5172 #if defined(__LP64__)
5173  const char* FMT0 = "\tihPen\t\t: 0x%x\n";
5174  const char* FMT1 = "\tlopn.lopnWidth\t: %d, %d\n";
5175 #else
5176  const char* FMT0 = "\tihPen\t\t: 0x%lx\n";
5177  const char* FMT1 = "\tlopn.lopnWidth\t: %ld, %ld\n";
5178 #endif /* __x86_64__ */
5179  printf( "*CREATEPEN*\n" );
5180  printf( FMT0, ihPen );
5181  edit_pen_style( "lopn.lopnStyle", lopn.lopnStyle );
5182  printf( FMT1, lopn.lopnWidth.x, lopn.lopnWidth.y );
5183  edit_color( "lopn.lopnColor", lopn.lopnColor );
5184  }
5185 #endif /* ENABLE_EDITING */
5186  };
5187 
5189 
5194  {
5195  public:
5200  EMREXTCREATEPEN ( EXTPEN* pen, HGDIOBJ handle );
5205  EMREXTCREATEPEN ( DATASTREAM& ds );
5209  bool serialize ( DATASTREAM ds )
5210  {
5211  ds << emr << ihPen << offBmi << cbBmi << offBits << cbBits << elp;
5212  return true;
5213  }
5217  int size ( void ) const { return emr.nSize; }
5223  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const;
5224 #ifdef ENABLE_EDITING
5225 
5228  void edit ( void ) const
5229  {
5230 #if defined(__LP64__)
5231  const char* FMT0 = "\tihPen\t\t\t: 0x%x\n";
5232  const char* FMT1 = "\toffBmi\t\t\t: %d\n";
5233  const char* FMT2 = "\tcbBmi\t\t\t: %d\n";
5234  const char* FMT3 = "\toffBits\t\t\t: %d\n";
5235  const char* FMT4 = "\tcbBits\t\t\t: %d\n";
5236  const char* FMT5 = "\telp.elpWidth\t\t: %d\n";
5237  const char* FMT6 = "\telp.elpNumEntries\t: %d\n";
5238 #else
5239  const char* FMT0 = "\tihPen\t\t\t: 0x%lx\n";
5240  const char* FMT1 = "\toffBmi\t\t\t: %ld\n";
5241  const char* FMT2 = "\tcbBmi\t\t\t: %ld\n";
5242  const char* FMT3 = "\toffBits\t\t\t: %ld\n";
5243  const char* FMT4 = "\tcbBits\t\t\t: %ld\n";
5244  const char* FMT5 = "\telp.elpWidth\t\t: %ld\n";
5245  const char* FMT6 = "\telp.elpNumEntries\t: %ld\n";
5246 #endif /* __x86_64__ */
5247  printf( "*EXTCREATEPEN*\n" );
5248  printf( FMT0, ihPen );
5249  printf( FMT1, offBmi );
5250  printf( FMT2, cbBmi );
5251  printf( FMT3, offBits );
5252  printf( FMT4, cbBits );
5253  edit_pen_style( "elp.elpPenStyle\t", elp.elpPenStyle );
5254  printf( FMT5, elp.elpWidth );
5255  edit_brush_style( "elp.elpBrushStyle", elp.elpBrushStyle );
5256  edit_color( "elp.elpColor\t", elp.elpColor );
5257  edit_brush_hatch( "elp.elpHatch\t", elp.elpHatch );
5258  printf( FMT6, elp.elpNumEntries );
5259  }
5260 #endif /* ENABLE_EDITING */
5261  };
5262 
5264 
5268  {
5269  public:
5274  EMRCREATEBRUSHINDIRECT ( BRUSH* brush, HGDIOBJ handle );
5283  bool serialize ( DATASTREAM ds )
5284  {
5285  ds << emr << ihBrush << lb;
5286  return true;
5287  }
5291  int size ( void ) const { return emr.nSize; }
5297  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const;
5298 #ifdef ENABLE_EDITING
5299 
5302  void edit ( void ) const
5303  {
5304 #if defined(__LP64__)
5305  const char* FMT = "\tihBrush\t\t: 0x%x\n";
5306 #else
5307  const char* FMT = "\tihBrush\t\t: 0x%lx\n";
5308 #endif /* __x86_64__ */
5309  printf( "*CREATEBRUSHINDIRECT*\n" );
5310  printf( FMT, ihBrush );
5311  edit_brush_style( "lb.lbStyle", lb.lbStyle );
5312  edit_color( "lb.lbColor", lb.lbColor );
5313  edit_brush_hatch( "lb.lbHatch", lb.lbHatch );
5314  }
5315 #endif /* ENABLE_EDITING */
5316  };
5317 
5319 
5323  {
5324  public:
5329  EMREXTCREATEFONTINDIRECTW ( FONT* font, HGDIOBJ handle );
5338  bool serialize ( DATASTREAM ds )
5339  {
5340  // Since EMF records have to be multiples of 4 bytes, this
5341  // should perhaps be a general thing, but we know it's currently
5342  // only a problem for this structure.
5343 
5344  ds << emr << ihFont << elfw << PADDING( 2 );
5345 
5346  return true;
5347  }
5351  int size ( void ) const { return emr.nSize; }
5357  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const;
5358 #ifdef ENABLE_EDITING
5359 
5362  void edit ( void ) const
5363  {
5364 #if defined(__LP64__)
5365  const char* FMT0 = "\tihFont\t\t\t: %d\n";
5366  const char* FMT1 = "\tlfHeight\t\t: %d\n";
5367  const char* FMT2 = "\tlfWidth\t\t\t: %d\n";
5368  const char* FMT3 = "\tlfEscapement\t\t: %d\n";
5369  const char* FMT4 = "\tlfOrientation\t\t: %d\n";
5370  const char* FMT5 = "\telfVersion\t\t: %d\n";
5371  const char* FMT6 = "\telfStyleSize\t\t: %d\n";
5372  const char* FMT7 = "\telfMatch\t\t: %d\n";
5373  const char* FMT8 = "\telfCulture\t\t: %d\n";
5374 #else
5375  const char* FMT0 = "\tihFont\t\t\t: %ld\n";
5376  const char* FMT1 = "\tlfHeight\t\t: %ld\n";
5377  const char* FMT2 = "\tlfWidth\t\t\t: %ld\n";
5378  const char* FMT3 = "\tlfEscapement\t\t: %ld\n";
5379  const char* FMT4 = "\tlfOrientation\t\t: %ld\n";
5380  const char* FMT5 = "\telfVersion\t\t: %ld\n";
5381  const char* FMT6 = "\telfStyleSize\t\t: %ld\n";
5382  const char* FMT7 = "\telfMatch\t\t: %ld\n";
5383  const char* FMT8 = "\telfCulture\t\t: %ld\n";
5384 #endif /* __x86_64__ */
5385  printf( "*EXTCREATEFONTINDIRECTW*\n" );
5386  printf( FMT0, ihFont );
5387  printf( FMT1, elfw.elfLogFont.lfHeight );
5388  printf( FMT2, elfw.elfLogFont.lfWidth );
5389  printf( FMT3, elfw.elfLogFont.lfEscapement );
5390  printf( FMT4, elfw.elfLogFont.lfOrientation );
5391  printf( "\tlfWeight\t\t: " );
5392  switch ( elfw.elfLogFont.lfWeight ) {
5393  case FW_DONTCARE: printf( "FW_DONTCARE\n" ); break;
5394  case FW_THIN: printf( "FW_THIN\n" ); break;
5395  case FW_EXTRALIGHT: printf( "FW_EXTRALIGHT\n" ); break;
5396  case FW_LIGHT: printf( "FW_LIGHT\n" ); break;
5397  case FW_NORMAL: printf( "FW_NORMAL\n" ); break;
5398  case FW_MEDIUM: printf( "FW_MEDIUM\n" ); break;
5399  case FW_SEMIBOLD: printf( "FW_SEMIBOLD\n" ); break;
5400  case FW_BOLD: printf( "FW_BOLD\n" ); break;
5401  case FW_EXTRABOLD: printf( "FW_EXTRABOLD\n" ); break;
5402  case FW_BLACK: printf( "FW_BLACK\n" ); break;
5403  }
5404  printf( "\tlfItalic\t\t: %d\n", elfw.elfLogFont.lfItalic );
5405  printf( "\tlfUnderline\t\t: %d\n", elfw.elfLogFont.lfUnderline );
5406  printf( "\tlfStrikeOut\t\t: %d\n", elfw.elfLogFont.lfStrikeOut );
5407  printf( "\tlfCharSet\t\t: %d\n", elfw.elfLogFont.lfCharSet );
5408  printf( "\tlfOutPrecision\t\t: %d\n", elfw.elfLogFont.lfOutPrecision );
5409  printf( "\tlfClipPrecision\t\t: %d\n", elfw.elfLogFont.lfClipPrecision );
5410  printf( "\tlfQuality\t\t: %d\n", elfw.elfLogFont.lfQuality );
5411  printf( "\tlfPitchAndFamily\t: %d\n", elfw.elfLogFont.lfPitchAndFamily );
5412  int i = 0;
5413  printf( "\tlfFaceName\t\t: '" );
5414  while ( elfw.elfLogFont.lfFaceName[i] != 0 && i < LF_FACESIZE ) {
5415  putchar( elfw.elfLogFont.lfFaceName[i] );
5416  i++;
5417  }
5418  puts( "'" );
5419 
5420  i = 0;
5421  printf( "\telfFullName\t\t: '" );
5422  while ( elfw.elfFullName[i] != 0 && i < LF_FULLFACESIZE ) {
5423  putchar( elfw.elfFullName[i] );
5424  i++;
5425  }
5426  puts( "'" );
5427 
5428  i = 0;
5429  printf( "\telfStyle\t\t: '" );
5430  while ( elfw.elfStyle[i] != 0 && i < LF_FACESIZE ) {
5431  putchar( elfw.elfStyle[i] );
5432  i++;
5433  }
5434  puts( "'" );
5435 
5436  printf( FMT5, elfw.elfVersion );
5437  printf( FMT6, elfw.elfStyleSize );
5438  printf( FMT7, elfw.elfMatch );
5439  printf( "\telfVendorId\t\t: '%s'\n", elfw.elfVendorId );
5440  printf( FMT8, elfw.elfCulture );
5441  printf( "\telfPanose\t\t:\n" );
5442  printf( "\t\tbFamilyType\t\t: %d\n", elfw.elfPanose.bFamilyType );
5443  printf( "\t\tbSerifStyle\t\t: %d\n", elfw.elfPanose.bSerifStyle );
5444  printf( "\t\tbWeight\t\t\t: %d\n", elfw.elfPanose.bWeight );
5445  printf( "\t\tbProportion\t\t: %d\n", elfw.elfPanose.bProportion );
5446  printf( "\t\tbContrast\t\t: %d\n", elfw.elfPanose.bContrast );
5447  printf( "\t\tbStrokeVariation\t: %d\n", elfw.elfPanose.bStrokeVariation );
5448  printf( "\t\tbArmStyle\t\t: %d\n", elfw.elfPanose.bArmStyle );
5449  printf( "\t\tbLetterform\t\t: %d\n", elfw.elfPanose.bLetterform );
5450  printf( "\t\tbMidline\t\t: %d\n", elfw.elfPanose.bMidline );
5451  printf( "\t\tbXHeight\t\t: %d\n", elfw.elfPanose.bXHeight );
5452  }
5453 #endif /* ENABLE_EDITING */
5454  };
5455 
5457 
5461  {
5462  public:
5467  EMRCREATEPALETTE ( PALETTE* palette, HGDIOBJ handle );
5472  EMRCREATEPALETTE ( DATASTREAM& ds );
5476  bool serialize ( DATASTREAM ds )
5477  {
5478  ds << emr << ihPal << lgpl;
5479  return true;
5480  }
5484  int size ( void ) const { return emr.nSize; }
5490  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const;
5491 #ifdef ENABLE_EDITING
5492 
5495  void edit ( void ) const
5496  {
5497  printf( "*CREATEPALETTE* (not really handled by libEMF)\n" );
5498  }
5499 #endif /* ENABLE_EDITING */
5500  };
5501 
5503 
5507  public:
5511  EMRFILLPATH ( const RECTL* bounds )
5512  {
5513  emr.iType = EMR_FILLPATH;
5514  emr.nSize = sizeof( ::EMRFILLPATH );
5515  rclBounds = *bounds;
5516  }
5522  {
5523  ds >> emr >> rclBounds;
5524  }
5528  bool serialize ( DATASTREAM ds )
5529  {
5530  ds << emr << rclBounds;
5531  return true;
5532  }
5536  int size ( void ) const { return emr.nSize; }
5542  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
5543  {
5544  EMF_UNUSED(source);
5545  FillPath( dc );
5546  }
5547 #ifdef ENABLE_EDITING
5548 
5551  void edit ( void ) const
5552  {
5553  printf( "*FILLPATH*\n" );
5554  edit_rectl( "rclBounds", rclBounds );
5555  }
5556 #endif /* ENABLE_EDITING */
5557  };
5559 
5563  public:
5567  EMRSTROKEPATH ( const RECTL* bounds )
5568  {
5569  emr.iType = EMR_STROKEPATH;
5570  emr.nSize = sizeof( ::EMRSTROKEPATH );
5571  rclBounds = *bounds;
5572  }
5578  {
5579  ds >> emr >> rclBounds;
5580  }
5584  bool serialize ( DATASTREAM ds )
5585  {
5586  ds << emr << rclBounds;
5587  return true;
5588  }
5592  int size ( void ) const { return emr.nSize; }
5598  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
5599  {
5600  EMF_UNUSED(source);
5601  StrokePath( dc );
5602  }
5603 #ifdef ENABLE_EDITING
5604 
5607  void edit ( void ) const
5608  {
5609  printf( "*STROKEPATH*\n" );
5610  edit_rectl( "rclBounds", rclBounds );
5611  }
5612 #endif /* ENABLE_EDITING */
5613  };
5615 
5619  public:
5623  EMRSTROKEANDFILLPATH ( const RECTL* bounds )
5624  {
5625  emr.iType = EMR_STROKEANDFILLPATH;
5626  emr.nSize = sizeof( ::EMRSTROKEANDFILLPATH );
5627  rclBounds = *bounds;
5628  }
5634  {
5635  ds >> emr >> rclBounds;
5636  }
5640  bool serialize ( DATASTREAM ds )
5641  {
5642  ds << emr << rclBounds;
5643  return true;
5644  }
5648  int size ( void ) const { return emr.nSize; }
5654  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
5655  {
5656  EMF_UNUSED(source);
5657  StrokeAndFillPath( dc );
5658  }
5659 #ifdef ENABLE_EDITING
5660 
5663  void edit ( void ) const
5664  {
5665  printf( "*STROKEANDFILLPATH*\n" );
5666  edit_rectl( "rclBounds", rclBounds );
5667  }
5668 #endif /* ENABLE_EDITING */
5669  };
5671 
5675  public:
5679  EMRBEGINPATH ( void )
5680  {
5681  emr.iType = EMR_BEGINPATH;
5682  emr.nSize = sizeof( ::EMRBEGINPATH );
5683  }
5689  {
5690  ds >> emr;
5691  }
5695  bool serialize ( DATASTREAM ds )
5696  {
5697  ds << emr;
5698  return true;
5699  }
5703  int size ( void ) const { return emr.nSize; }
5709  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
5710  {
5711  EMF_UNUSED(source);
5712  BeginPath( dc );
5713  }
5714 #ifdef ENABLE_EDITING
5715 
5718  void edit ( void ) const
5719  {
5720  printf( "*BEGINPATH*\n" );
5721  }
5722 #endif /* ENABLE_EDITING */
5723  };
5725 
5729  public:
5733  EMRENDPATH ( void )
5734  {
5735  emr.iType = EMR_ENDPATH;
5736  emr.nSize = sizeof( ::EMRENDPATH );
5737  }
5743  {
5744  ds >> emr;
5745  }
5749  bool serialize ( DATASTREAM ds )
5750  {
5751  ds << emr;
5752  return true;
5753  }
5757  int size ( void ) const { return emr.nSize; }
5763  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
5764  {
5765  EMF_UNUSED(source);
5766  EndPath( dc );
5767  }
5768 #ifdef ENABLE_EDITING
5769 
5772  void edit ( void ) const
5773  {
5774  printf( "*ENDPATH*\n" );
5775  }
5776 #endif /* ENABLE_EDITING */
5777  };
5779 
5783  public:
5788  {
5789  emr.iType = EMR_CLOSEFIGURE;
5790  emr.nSize = sizeof( ::EMRCLOSEFIGURE );
5791  }
5797  {
5798  ds >> emr;
5799  }
5803  bool serialize ( DATASTREAM ds )
5804  {
5805  ds << emr;
5806  return true;
5807  }
5811  int size ( void ) const { return emr.nSize; }
5817  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
5818  {
5819  EMF_UNUSED(source);
5820  CloseFigure( dc );
5821  }
5822 #ifdef ENABLE_EDITING
5823 
5826  void edit ( void ) const
5827  {
5828  printf( "*CLOSEFIGURE*\n" );
5829  }
5830 #endif /* ENABLE_EDITING */
5831  };
5833 
5838  public:
5842  EMRSAVEDC ( void )
5843  {
5844  emr.iType = EMR_SAVEDC;
5845  emr.nSize = sizeof( ::EMRSAVEDC );
5846  }
5852  {
5853  ds >> emr;
5854  }
5858  bool serialize ( DATASTREAM ds )
5859  {
5860  ds << emr;
5861  return true;
5862  }
5866  int size ( void ) const { return emr.nSize; }
5872  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
5873  {
5874  EMF_UNUSED(source);
5875  SaveDC( dc );
5876  }
5877 #ifdef ENABLE_EDITING
5878 
5881  void edit ( void ) const
5882  {
5883  printf( "*SAVEDC*\n" );
5884  }
5885 #endif /* ENABLE_EDITING */
5886  };
5888 
5892  public:
5896  EMRRESTOREDC ( INT n )
5897  {
5898  emr.iType = EMR_RESTOREDC;
5899  emr.nSize = sizeof( ::EMRRESTOREDC );
5900  iRelative = n;
5901  }
5907  {
5908  ds >> emr >> iRelative;
5909  }
5913  bool serialize ( DATASTREAM ds )
5914  {
5915  ds << emr << iRelative;
5916  return true;
5917  }
5921  int size ( void ) const { return emr.nSize; }
5927  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
5928  {
5929  EMF_UNUSED(source);
5930  RestoreDC( dc, iRelative );
5931  }
5932 #ifdef ENABLE_EDITING
5933 
5936  void edit ( void ) const
5937  {
5938 #if defined(__LP64__)
5939  const char* FMT = "\tiRelative: %d\n";
5940 #else
5941  const char* FMT = "\tiRelative: %ld\n";
5942 #endif /* __x86_64__ */
5943  printf( "*RESTOREDC*\n" );
5944  printf( FMT, iRelative );
5945  }
5946 #endif /* ENABLE_EDITING */
5947  };
5949 
5953  public:
5957  EMRSETMETARGN ( void )
5958  {
5959  emr.iType = EMR_SETMETARGN;
5960  emr.nSize = sizeof( ::EMRSETMETARGN );
5961  }
5967  {
5968  ds >> emr;
5969  }
5973  bool serialize ( DATASTREAM ds )
5974  {
5975  ds << emr;
5976  return true;
5977  }
5981  int size ( void ) const { return emr.nSize; }
5987  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
5988  {
5989  EMF_UNUSED(source);
5990  SetMetaRgn( dc );
5991  }
5992 #ifdef ENABLE_EDITING
5993 
5996  void edit ( void ) const
5997  {
5998  printf( "*SETMETARGN*\n" );
5999  }
6000 #endif /* ENABLE_EDITING */
6001  };
6002 
6004 
6007  class PEN : public GRAPHICSOBJECT, public LOGPEN {
6008  public:
6012  PEN ( const LOGPEN* lpen )
6013  {
6014  lopnStyle = lpen->lopnStyle;
6015  lopnWidth = lpen->lopnWidth;
6016  lopnColor = lpen->lopnColor;
6017  }
6021  OBJECTTYPE getType ( void ) const { return O_PEN; }
6028  METARECORD* newEMR ( HDC dc, HGDIOBJ emf_handle )
6029  {
6030  contexts[dc] = emf_handle;
6031  return new EMRCREATEPEN( this, emf_handle );
6032  }
6033  };
6034 
6036 
6039  class EXTPEN : public GRAPHICSOBJECT, public EXTLOGPEN {
6040  public:
6044  EXTPEN ( const EXTLOGPEN* lpen )
6045  {
6046  elpPenStyle = lpen->elpPenStyle;
6047  elpWidth = lpen->elpWidth;
6048  elpBrushStyle = lpen->elpBrushStyle;
6049  elpColor = lpen->elpColor;
6050  elpHatch = lpen->elpHatch;
6051  elpNumEntries = 0;
6052  elpStyleEntry[0] = 0;
6053  }
6057  OBJECTTYPE getType ( void ) const { return O_EXTPEN; }
6064  METARECORD* newEMR ( HDC dc, HGDIOBJ emf_handle )
6065  {
6066  contexts[dc] = emf_handle;
6067  return new EMREXTCREATEPEN( this, emf_handle );
6068  }
6069  };
6070 
6072 
6075  class BRUSH : public GRAPHICSOBJECT, public LOGBRUSH {
6076  public:
6080  BRUSH ( const LOGBRUSH* lbrush )
6081  {
6082  lbStyle = lbrush->lbStyle;
6083  lbColor = lbrush->lbColor;
6084  lbHatch = lbrush->lbHatch;
6085  }
6089  OBJECTTYPE getType ( void ) const { return O_BRUSH; }
6096  METARECORD* newEMR ( HDC dc, HGDIOBJ emf_handle )
6097  {
6098  contexts[dc] = emf_handle;
6099  return new EMRCREATEBRUSHINDIRECT( this, emf_handle );
6100  }
6101  };
6102 
6104 
6107  class FONT : public GRAPHICSOBJECT, public EXTLOGFONTW {
6108  public:
6112  FONT ( const LOGFONTW* lfont )
6113  {
6114  this->elfLogFont = *lfont;
6115  // There are a lot more entries in the EXTLOGFONTW structure than
6116  // the API has values for, so we invent them here
6117  memset( &elfFullName, 0, sizeof elfFullName );
6118  memset( &elfStyle, 0, sizeof elfStyle );
6119  elfVersion = ELF_VERSION;
6120  elfStyleSize = 0;
6121  elfMatch = 0;
6122  elfReserved = 0;
6123  memset( &elfVendorId, 0, sizeof elfVendorId );
6124  elfCulture = ELF_CULTURE_LATIN;
6125  memset( &elfPanose, 1, sizeof(PANOSE) );
6126  }
6130  OBJECTTYPE getType ( void ) const { return O_FONT; }
6137  METARECORD* newEMR ( HDC dc, HGDIOBJ emf_handle )
6138  {
6139  contexts[dc] = emf_handle;
6140  return new EMREXTCREATEFONTINDIRECTW( this, emf_handle );
6141  }
6142  };
6143 
6145 
6148  class PALETTE : public GRAPHICSOBJECT, public LOGPALETTE {
6149  public:
6153  PALETTE ( const LOGPALETTE* lpalette )
6154  {
6155  EMF_UNUSED(lpalette);
6156  palVersion = 0;
6157  palNumEntries = 0;
6158  PALETTEENTRY zero_entry = { 0, 0, 0, 0 };
6159  palPalEntry[0] = zero_entry;
6160  }
6164  OBJECTTYPE getType ( void ) const { return O_PALETTE; }
6171  METARECORD* newEMR ( HDC dc, HGDIOBJ emf_handle )
6172  {
6173  contexts[dc] = emf_handle;
6174  return new EMRCREATEPALETTE( this, emf_handle );
6175  }
6176  };
6177 
6179 
6183  public:
6187  EMRSETMITERLIMIT ( FLOAT limit )
6188  {
6189  emr.iType = EMR_SETMITERLIMIT;
6190  emr.nSize = sizeof( ::EMRSETMITERLIMIT );
6191  eMiterLimit = limit;
6192  }
6198  {
6199  int miter_limit;
6200  ds >> emr >> miter_limit;
6201  eMiterLimit = float(miter_limit);
6202  }
6206  bool serialize ( DATASTREAM ds )
6207  {
6208  ds << emr << (int)eMiterLimit;
6209  return true;
6210  }
6214  int size ( void ) const { return emr.nSize; }
6220  void execute ( METAFILEDEVICECONTEXT* source, HDC dc ) const
6221  {
6222  EMF_UNUSED(source);
6223  SetMiterLimit( dc, eMiterLimit, 0 );
6224  }
6225 #ifdef ENABLE_EDITING
6226 
6229  void edit ( void ) const
6230  {
6231  printf( "*SETMITERLIMIT*\n" );
6232  printf( "\teMiterLimit\t: %f\n", eMiterLimit );
6233  }
6234 #endif /* ENABLE_EDITING */
6235  };
6236 
6238 
6252  void init ( const RECT* size, LPCWSTR description_w ) {
6253 
6254  // Evidently, metafile handles are numbered from 1, so don't
6255  // ever use 0.
6256 
6257  handles.push_back( true );
6258 
6259  // Keep some of our graphics state in a header record
6260 
6261  header = new ENHMETAHEADER ( description_w );
6262  records.push_back( header );
6263 
6264  // Compute the size and position of the metafile on the "page"
6265 
6266  if ( size ) {
6267  update_frame = false;
6268 
6269  header->rclFrame.left = size->left;
6270  header->rclFrame.top = size->top;
6271  header->rclFrame.right = size->right;
6272  header->rclFrame.bottom = size->bottom;
6273 
6274  header->rclBounds.left =
6275  size->left * header->szlDevice.cx / ( header->szlMillimeters.cx * 100 );
6276  header->rclBounds.top =
6277  size->top * header->szlDevice.cy / ( header->szlMillimeters.cy * 100 );
6278  header->rclBounds.right =
6279  size->right * header->szlDevice.cx / ( header->szlMillimeters.cx * 100 );
6280  header->rclBounds.bottom =
6281  size->bottom * header->szlDevice.cy / ( header->szlMillimeters.cy * 100 );
6282  }
6283  else {
6284  update_frame = true;
6285 
6286  header->rclBounds.left = -10;
6287  header->rclBounds.top = -10;
6288  header->rclBounds.right = 10;
6289  header->rclBounds.bottom = 10;
6290 
6291  header->rclFrame.left = (LONG)floor( (float)header->rclBounds.left *
6292  header->szlMillimeters.cx * 100 / header->szlDevice.cx );
6293  header->rclFrame.top = (LONG)floor( (float)header->rclBounds.top *
6294  header->szlMillimeters.cy * 100 / header->szlDevice.cy );
6295  header->rclFrame.right = (LONG)ceil( (float)header->rclBounds.right *
6296  header->szlMillimeters.cx * 100 / header->szlDevice.cx );
6297  header->rclFrame.bottom = (LONG)ceil( (float)header->rclBounds.bottom *
6298  header->szlMillimeters.cy * 100 / header->szlDevice.cy );
6299  }
6300 
6301  // Some default graphics state (are they really, though?)
6302 
6303  SIZEL default_resolution = { RESOLUTION, RESOLUTION };
6304  resolution = default_resolution;
6305  SIZEL default_viewport_ext = { 1, 1 };
6306  viewport_ext = default_viewport_ext;
6307  POINT default_viewport_org = { 0, 0 };
6308  viewport_org = default_viewport_org;
6309  SIZEL default_window_ext = { 1, 1 };
6310  window_ext = default_window_ext;
6311  POINT default_window_org = { 0, 0 };
6312  window_org = default_window_org;
6313 
6314  min_device_point = viewport_org;
6315  max_device_point = viewport_org;
6316 
6317  pen = (PEN*)globalObjects.find( BLACK_PEN | ENHMETA_STOCK_OBJECT );
6318  brush = (BRUSH*)globalObjects.find( BLACK_BRUSH | ENHMETA_STOCK_OBJECT );
6319  font = (FONT*)globalObjects.find( DEVICE_DEFAULT_FONT | ENHMETA_STOCK_OBJECT);
6320  palette = (PALETTE*)globalObjects.find( DEFAULT_PALETTE|ENHMETA_STOCK_OBJECT);
6321 
6322  text_alignment = TA_BASELINE;
6323  text_color = RGB(0,0,0);
6324  bk_color = RGB(0xff,0xff,0xff);
6325  bk_mode = OPAQUE;
6326  polyfill_mode = ALTERNATE;
6327  map_mode = MM_TEXT;
6328  miter_limit = 10.f;
6329 
6330  handle = globalObjects.add( this );
6331  }
6332 
6333  public:
6337  ::FILE* fp;
6350  std::vector< EMF::METARECORD* > records;
6351 
6352  // Keep a small set of graphics state information
6353  SIZEL resolution;
6356  SIZEL window_ext;
6357  POINT window_org;
6361  POINT point;
6367  COLORREF text_color;
6368  COLORREF bk_color;
6369  INT bk_mode;
6371  INT map_mode;
6372  FLOAT miter_limit;
6373 
6379  std::vector< bool > handles;
6380 
6386  std::map< HGDIOBJ, HGDIOBJ > emf_handles;
6387 
6398  METAFILEDEVICECONTEXT ( FILE* fp_, const RECT* size,
6399  LPCWSTR description_w )
6400  : fp(fp_), ds( fp_ )
6401  {
6402  init( size, description_w );
6403  }
6409  {
6410  // Purge all the metarecords (if there are any) {this include the
6411  // header record, too}
6412  if ( records.size() > 0 )
6413  deleteMetafile();
6414  }
6418  OBJECTTYPE getType ( void ) const { return O_METAFILEDEVICECONTEXT; }
6423  DWORD nextHandle ( void )
6424  {
6425  for ( unsigned int i = 1; i < handles.size(); i++ ) {
6426  if ( !handles[i] ) {
6427  handles[i] = true;
6428  return i;
6429  }
6430  }
6431  handles.push_back( true );
6432  // Well, it appears that even StockObject handles count for something.
6433  // Not sure what the right value here is, then.
6434  header->nHandles = handles.size();
6435  return handles.size()-1;
6436  }
6440  void clearHandle ( DWORD handle )
6441  {
6442  handles[handle] = false;
6443  }
6449  void appendRecord ( METARECORD* record )
6450  {
6451  records.push_back( record );
6452 
6453  header->nBytes += record->size();
6454  header->nRecords++;
6455  }
6461  void appendHandle ( METARECORD* record )
6462  {
6463  records.push_back( record );
6464 
6465  header->nBytes += record->size();
6466  header->nRecords++;
6467  }
6472  void deleteMetafile ( void )
6473  {
6474  for ( std::vector<METARECORD*>::const_iterator r = records.begin();
6475  r != records.end();
6476  r++ ) {
6477  delete *r;
6478  }
6479  records.clear();
6480  }
6485  void mergePoint ( const LONG& x, const LONG& y )
6486  {
6487  POINT p;
6488  p.x = x;
6489  p.y = y;
6490  mergePoint( p );
6491  }
6496  void mergePoint( const POINT& p )
6497  {
6498  POINT device_point;
6499 
6500  // *** Note, it's possible for the global transformation matrix to
6501  // affect this too. ***
6502 
6503  device_point.x = (LONG)( (float)( p.x - window_org.x ) / window_ext.cx *
6504  viewport_ext.cx + viewport_org.x );
6505 
6506  device_point.y = (LONG)( (float)( p.y - window_org.y ) / window_ext.cy *
6507  viewport_ext.cy + viewport_org.y );
6508 
6509  // If the user didn't specify a bounding rectangle in the constructor,
6510  // compute one from this data, too.
6511  if ( device_point.x < min_device_point.x ) {
6512  min_device_point.x = device_point.x;
6513  if ( update_frame ) {
6514  header->rclBounds.left = min_device_point.x - 10;
6515  header->rclFrame.left = (LONG)floor( (float)header->rclBounds.left *
6516  header->szlMillimeters.cx * 100 / header->szlDevice.cx );
6517  }
6518  }
6519  else if ( device_point.x > max_device_point.x ) {
6520  max_device_point.x = device_point.x;
6521  if ( update_frame ) {
6522  header->rclBounds.right = max_device_point.x + 10;
6523  header->rclFrame.right = (LONG)ceil( (float)header->rclBounds.right *
6524  header->szlMillimeters.cx * 100 / header->szlDevice.cx );
6525  }
6526  }
6527 
6528  if ( device_point.y < min_device_point.y ) {
6529  min_device_point.y = device_point.y;
6530  if ( update_frame ) {
6531  header->rclBounds.top = min_device_point.y - 10;
6532  header->rclFrame.top = (LONG)floor( (float)header->rclBounds.top *
6533  header->szlMillimeters.cy * 100 / header->szlDevice.cy );
6534  }
6535  }
6536  else if ( device_point.y > max_device_point.y ) {
6537  max_device_point.y = device_point.y;
6538  if ( update_frame ) {
6539  header->rclBounds.bottom = max_device_point.y + 10;
6540  header->rclFrame.bottom = (LONG)ceil( (float)header->rclBounds.bottom *
6541  header->szlMillimeters.cy * 100 / header->szlDevice.cy );
6542  }
6543  }
6544  }
6545  };
6546 
6547 } // close EMF namespace
6548 
6549 #undef EMF_UNUSED
6550 #endif /* _LIBEMF_H */
~EMRPOLYLINE16()
Definition: libemf.h:3341
bool serialize(DATASTREAM ds)
Definition: libemf.h:4315
bool serialize(DATASTREAM ds)
Definition: libemf.h:4675
int size(void) const
Definition: libemf.h:5159
bool serialize(DATASTREAM ds)
Definition: libemf.h:5209
bool serialize(DATASTREAM ds)
Definition: libemf.h:4403
int size(void) const
Definition: libemf.h:2708
bool serialize(DATASTREAM ds)
Definition: libemf.h:5338
EMF Line To.
Definition: libemf.h:2853
EMRSETBKCOLOR(DATASTREAM &ds)
Definition: libemf.h:2427
void mergePoint(const POINT &p)
Definition: libemf.h:6496
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2964
int size(void) const
Definition: libemf.h:4686
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4537
EMRSCALEWINDOWEXTEX(LONG x_num, LONG x_den, LONG y_num, LONG y_den)
Definition: libemf.h:2065
int size(void) const
Definition: libemf.h:5703
int size(void) const
Definition: libemf.h:2885
EMF End of File Record.
Definition: libemf.h:1669
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3106
EMRENDPATH(void)
Definition: libemf.h:5733
~ENHMETAHEADER()
Definition: libemf.h:1501
EMF Set Background Color.
Definition: libemf.h:2412
EMREXTTEXTOUTW(const RECTL *bounds, DWORD graphicsMode, FLOAT xScale, FLOAT yScale, const PEMRTEXT text, LPCWSTR string, const INT *dx)
Definition: libemf.h:4807
EMRARCTO(DATASTREAM &ds)
Definition: libemf.h:3019
FONT(const LOGFONTW *lfont)
Definition: libemf.h:6112
int size(void) const
Definition: libemf.h:5648
EMRPOLYLINE16(DATASTREAM &ds)
Definition: libemf.h:3349
EMF PolyBezierTo16.
Definition: libemf.h:4239
COLORREF text_color
The current text foreground color.
Definition: libemf.h:6367
EMRPOLYBEZIERTO16(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4272
~EMRPOLYBEZIERTO()
Definition: libemf.h:4188
bool serialize(DATASTREAM ds)
Definition: libemf.h:3156
int size(void) const
Definition: libemf.h:2958
int size(void) const
Definition: libemf.h:3164
EMF Modify World Transform.
Definition: libemf.h:2137
EMRSETVIEWPORTORGEX(DATASTREAM &ds)
Definition: libemf.h:1749
virtual ~METARECORD()
Definition: libemf.h:1015
int size(void) const
Definition: libemf.h:5217
int size(void) const
Definition: libemf.h:4323
~EMRPOLYBEZIER()
Definition: libemf.h:3980
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6064
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2248
EMRARC(INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
Definition: libemf.h:2925
EMF Fill path.
Definition: libemf.h:5506
EMRSTROKEANDFILLPATH(const RECTL *bounds)
Definition: libemf.h:5623
int size(void) const
Definition: libemf.h:1703
bool serialize(DATASTREAM ds)
Definition: libemf.h:5093
EMRSETBKCOLOR(COLORREF color)
Definition: libemf.h:2417
Represent an array of points in a simple way.
Definition: libemf.h:140
EMRELLIPSE(DATASTREAM &ds)
Definition: libemf.h:3149
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2891
EMRELLIPSE(INT left, INT top, INT right, INT bottom)
Definition: libemf.h:3136
EMF Extended Text Output Wide character.
Definition: libemf.h:4792
Represent a byte array in a simple way.
Definition: libemf.h:124
A global graphics object.
Definition: libemf.h:1252
EMRPOLYGON(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:3407
int size(void) const
Definition: libemf.h:5811
int size(void) const
Definition: libemf.h:2635
EMRCLOSEFIGURE(DATASTREAM &ds)
Definition: libemf.h:5796
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5927
EMRSETWINDOWEXTEX(INT cx, INT cy)
Definition: libemf.h:2002
int size(void) const
Definition: libemf.h:2170
EMRPOLYLINETO(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4360
All metafile records must be padded out to a multiple of 4 bytes.
Definition: libemf.h:204
bool serialize(DATASTREAM ds)
Definition: libemf.h:2377
bool serialize(DATASTREAM ds)
Definition: libemf.h:3092
EMRPOLYLINE16(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:3319
EMF Stroke and Fill path.
Definition: libemf.h:5618
int size(void) const
Definition: libemf.h:3691
EMF Scale Viewport Extents (ex)
Definition: libemf.h:1917
EMRSCALEVIEWPORTEXTEX(DATASTREAM &ds)
Definition: libemf.h:1938
bool update_frame
Update the frame automatically?
Definition: libemf.h:6358
EMRPOLYBEZIERTO(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4152
OBJECTTYPE getType(void) const
Definition: libemf.h:6089
int size(void) const
Definition: libemf.h:5757
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4121
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4001
EMF Set Text Color.
Definition: libemf.h:2355
int size(void) const
Definition: libemf.h:1827
bool serialize(DATASTREAM ds)
Definition: libemf.h:5858
EMRDELETEOBJECT(HGDIOBJ object)
Definition: libemf.h:2741
EMF Rectangle.
Definition: libemf.h:3064
EMRMOVETOEX(INT x, INT y)
Definition: libemf.h:2800
virtual ~GRAPHICSOBJECT()
GRAPHICSOBJECTs has a virtual destructor.
Definition: libemf.h:1255
int size(void) const
Definition: libemf.h:5981
bool serialize(DATASTREAM ds)
Definition: libemf.h:5283
EMRLINETO(DATASTREAM &ds)
Definition: libemf.h:2870
Graphics Brush.
Definition: libemf.h:6075
EMREOF(void)
Definition: libemf.h:1674
EMF Poly Polygon.
Definition: libemf.h:3607
int size(void) const
Definition: libemf.h:3250
EMRARC(DATASTREAM &ds)
Definition: libemf.h:2943
Represent a wide (UNICODE) character string in a simple way.
Definition: libemf.h:89
void appendHandle(METARECORD *record)
Definition: libemf.h:6461
FONT * font
The current font.
Definition: libemf.h:6364
int size(void) const
Definition: libemf.h:5484
EMRPOLYGON16(const RECTL *bounds, const POINT *points, INT16 n)
Definition: libemf.h:3502
EMF Close Figure.
Definition: libemf.h:5782
bool serialize(DATASTREAM ds)
Definition: libemf.h:5973
EMF Polybezier.
Definition: libemf.h:3936
OBJECTTYPE getType(void) const
Definition: libemf.h:6418
bool serialize(DATASTREAM ds)
Definition: libemf.h:5803
bool serialize(DATASTREAM ds)
Definition: libemf.h:4107
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:1959
EMREXTTEXTOUTW(DATASTREAM &ds)
Definition: libemf.h:4865
bool serialize(DATASTREAM ds)
Definition: libemf.h:5476
EMRDELETEOBJECT(DATASTREAM &ds)
Definition: libemf.h:2751
EMF Set World Transform.
Definition: libemf.h:2212
bool serialize(DATASTREAM ds)
Definition: libemf.h:5695
EMF Stroke path.
Definition: libemf.h:5562
EMRMOVETOEX(DATASTREAM &ds)
Definition: libemf.h:2811
EMF MoveTo (ex)
Definition: libemf.h:2794
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5817
EMRPOLYPOLYGON16(const RECTL *bounds, const POINT16 *points, const INT *counts, UINT16 polygons)
Definition: libemf.h:3804
EMF Set Window Extent (ex)
Definition: libemf.h:1996
EMF SetMiterLimit.
Definition: libemf.h:6182
EXTPEN(const EXTLOGPEN *lpen)
Definition: libemf.h:6044
int size(void) const
Definition: libemf.h:2299
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5107
DWORD nextHandle(void)
Definition: libemf.h:6423
int size(void) const
Definition: libemf.h:5866
EMF Poly Polygon16.
Definition: libemf.h:3753
EMRSETWORLDTRANSFORM(const XFORM *transform)
Definition: libemf.h:2217
int size(void) const
Definition: libemf.h:2826
OBJECTTYPE getType(void) const
Definition: libemf.h:6057
POINT window_org
The origin of the window.
Definition: libemf.h:6357
int size(void) const
Definition: libemf.h:4916
EMRPOLYBEZIER16(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4064
INT bk_mode
The current background mode.
Definition: libemf.h:6369
EMRSETTEXTALIGN(DATASTREAM &ds)
Definition: libemf.h:2284
EMREOF(DATASTREAM &ds)
Definition: libemf.h:1687
static const char padding_[4]
Pad with &#39;\0&#39;s.
Definition: libemf.h:205
Represent an array of integers in a simple way.
Definition: libemf.h:172
int size(void) const
Definition: libemf.h:3458
virtual ~METAFILEDEVICECONTEXT()
Definition: libemf.h:6408
EMF Restore DC.
Definition: libemf.h:5891
EMF Pen.
Definition: libemf.h:5135
int size(void) const
Definition: libemf.h:3370
EMRPOLYGON(DATASTREAM &ds)
Definition: libemf.h:3430
ENHMETAHEADER(LPCWSTR description=0)
Definition: libemf.h:1436
EMF Set Text Alignment.
Definition: libemf.h:2269
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3584
EMF Save DC.
Definition: libemf.h:5837
OBJECT(void)
Definition: libemf.h:1239
int size(void) const
Definition: libemf.h:2385
int size(void) const
Definition: libemf.h:3878
std::map< HDC, HGDIOBJ > contexts
Definition: libemf.h:1260
~EMRPOLYLINE()
Definition: libemf.h:3221
bool serialize(DATASTREAM ds)
Definition: libemf.h:3869
void deleteMetafile(void)
Definition: libemf.h:6472
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:1770
bool serialize(DATASTREAM ds)
Definition: libemf.h:2627
bool serialize(DATASTREAM ds)
Definition: libemf.h:2559
bool serialize(DATASTREAM ds)
Definition: libemf.h:3362
EMRPOLYLINE(DATASTREAM &ds)
Definition: libemf.h:3229
EMRSETBKMODE(DATASTREAM &ds)
Definition: libemf.h:2485
bool serialize(DATASTREAM ds)
Definition: libemf.h:3242
bool serialize(DATASTREAM ds)
Definition: libemf.h:1509
EMRPOLYBEZIER(DATASTREAM &ds)
Definition: libemf.h:3967
EMRPOLYLINETO16(const RECTL *bounds, const POINT16 *points, INT n)
Definition: libemf.h:4455
POINT point
The current point.
Definition: libemf.h:6361
bool serialize(DATASTREAM ds)
Definition: libemf.h:5528
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2506
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3170
bool serialize(DATASTREAM ds)
Definition: libemf.h:2700
const DWORD n_
Number of POINTLs in array.
Definition: libemf.h:142
EMRSETVIEWPORTORGEX(INT x, INT y)
Definition: libemf.h:1738
EMRPOLYBEZIERTO16(const RECTL *bounds, const POINT16 *points, INT n)
Definition: libemf.h:4247
EMF Begin Path.
Definition: libemf.h:5674
~EMREXTTEXTOUTW()
Definition: libemf.h:4897
int size(void) const
Definition: libemf.h:5351
BRUSH * brush
The current brush.
Definition: libemf.h:6363
bool serialize(DATASTREAM ds)
Definition: libemf.h:2234
int size(void) const
Definition: libemf.h:2242
Global GDI object.
Definition: libemf.h:1230
int size(void) const
Definition: libemf.h:4411
int size(void) const
Definition: libemf.h:5536
const int size_
Number of bytes of padding.
Definition: libemf.h:206
POINT16 *const points_
Array of POINT16s.
Definition: libemf.h:157
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5763
Represent an array of double word integers in a simple way.
Definition: libemf.h:188
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2832
~EMRPOLYLINETO()
Definition: libemf.h:4396
PEN(const LOGPEN *lpen)
Definition: libemf.h:6012
void mergePoint(const LONG &x, const LONG &y)
Definition: libemf.h:6485
UINT text_alignment
The current text alignment.
Definition: libemf.h:6366
OBJECTTYPE getType(void) const
Definition: libemf.h:6164
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2448
Extended Graphics Pen.
Definition: libemf.h:6039
EMRBEGINPATH(DATASTREAM &ds)
Definition: libemf.h:5688
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:6220
EMRSTROKEPATH(const RECTL *bounds)
Definition: libemf.h:5567
Graphics Font.
Definition: libemf.h:6107
int size(void) const
Definition: libemf.h:2442
EMF Set Window Origin (ex)
Definition: libemf.h:1795
EMRSETBKMODE(DWORD mode)
Definition: libemf.h:2475
DWORD *const dwords_
Array of double words.
Definition: libemf.h:189
EMRSETMETARGN(DATASTREAM &ds)
Definition: libemf.h:5966
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3464
EMRSETTEXTCOLOR(DATASTREAM &ds)
Definition: libemf.h:2370
virtual int size(void) const =0
int size(void) const
Definition: libemf.h:4531
EMF Extended Pen.
Definition: libemf.h:5193
~EMRPOLYBEZIER16()
Definition: libemf.h:4100
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4922
EMRSCALEVIEWPORTEXTEX(LONG x_num, LONG x_den, LONG y_num, LONG y_den)
Definition: libemf.h:1925
int size(void) const
Definition: libemf.h:5291
EMRSETPOLYFILLMODE(DWORD mode)
Definition: libemf.h:2542
EMRRESTOREDC(DATASTREAM &ds)
Definition: libemf.h:5906
CHARSTR(CHAR *const string, const int length)
Definition: libemf.h:115
EMRSETVIEWPORTEXTEX(DATASTREAM &ds)
Definition: libemf.h:1873
bool serialize(DATASTREAM ds)
Definition: libemf.h:5749
~EMRPOLYPOLYGON()
Definition: libemf.h:3654
EMRFILLPATH(DATASTREAM &ds)
Definition: libemf.h:5521
Enhanced Metafile Header Record.
Definition: libemf.h:1424
EMF PolylineTo.
Definition: libemf.h:4352
EMF Set Viewport Origin (ex)
Definition: libemf.h:1732
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5598
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:1570
OBJECT * find(const HGDIOBJ handle)
Definition: libemf.cpp:213
bool serialize(DATASTREAM ds)
Definition: libemf.h:3987
const int length_
Number of WCHARs in string.
Definition: libemf.h:91
POINTLARRAY(POINTL *const points, const DWORD n)
Definition: libemf.h:148
std::vector< EMF::OBJECT * >::const_iterator end(void) const
Definition: libemf.h:1304
::FILE * fp
Definition: libemf.h:6337
EMRRECTANGLE(INT left, INT top, INT right, INT bottom)
Definition: libemf.h:3072
EMRPOLYPOLYGON16(const RECTL *bounds, const POINT *points, const INT *counts, UINT polygons)
Definition: libemf.h:3763
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2305
int size(void) const
Definition: libemf.h:2500
POINT viewport_org
The origin of the viewport.
Definition: libemf.h:6355
INT polyfill_mode
The current polygon fill mode.
Definition: libemf.h:6370
std::map< HGDIOBJ, HGDIOBJ > emf_handles
Definition: libemf.h:6386
~EMRPOLYPOLYGON16()
Definition: libemf.h:3841
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:1709
void clearHandle(DWORD handle)
Definition: libemf.h:6440
PEN * pen
The current pen.
Definition: libemf.h:6362
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3884
FLOAT miter_limit
The current miter length limit.
Definition: libemf.h:6372
POINT min_device_point
The lft/top-most painted point in device units.
Definition: libemf.h:6359
EMF Set Viewport Extents (ex)
Definition: libemf.h:1856
bool serialize(DATASTREAM ds)
Definition: libemf.h:1756
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4417
EMRPOLYLINE16(const RECTL *bounds, const POINT16 *points, INT n)
Definition: libemf.h:3294
const int length_
Number of single byte characters in array.
Definition: libemf.h:109
bool serialize(DATASTREAM ds)
Definition: libemf.h:5640
bool serialize(DATASTREAM ds)
Definition: libemf.h:6206
int size(void) const
Definition: libemf.h:3578
COLORREF bk_color
The current background color.
Definition: libemf.h:6368
bool serialize(DATASTREAM ds)
Definition: libemf.h:2434
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3376
Represent an ASCII character string in a simple way.
Definition: libemf.h:107
EMRSETPOLYFILLMODE(DATASTREAM &ds)
Definition: libemf.h:2552
int size(void) const
Definition: libemf.h:1564
bool unserialize(DATASTREAM ds)
Definition: libemf.h:1526
EMF Arc To.
Definition: libemf.h:2988
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:1833
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4329
EMREXTTEXTOUTA(DATASTREAM &ds)
Definition: libemf.h:4635
Represent an array of 16-bit point in a simple way.
Definition: libemf.h:156
METAFILEDEVICECONTEXT(FILE *fp_, const RECT *size, LPCWSTR description_w)
Definition: libemf.h:6398
EMF Ellipse.
Definition: libemf.h:3127
int size(void) const
Definition: libemf.h:6214
void appendRecord(METARECORD *record)
Definition: libemf.h:6449
PADDING(const int size)
Definition: libemf.h:211
EMRSETPIXELV(INT x, INT y, COLORREF color)
Definition: libemf.h:5074
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3697
int size(void) const
Definition: libemf.h:4203
EMRSETWORLDTRANSFORM(DATASTREAM &ds)
Definition: libemf.h:2227
bool serialize(DATASTREAM ds)
Definition: libemf.h:3026
std::vector< EMF::METARECORD *> records
Definition: libemf.h:6350
int size(void) const
Definition: libemf.h:4115
EMF Set Mapping Mode.
Definition: libemf.h:2605
EMRSAVEDC(DATASTREAM &ds)
Definition: libemf.h:5851
EMRSETMAPMODE(DWORD mode)
Definition: libemf.h:2610
POINT max_device_point
The rgt/btm-most painted point in device units.
Definition: libemf.h:6360
EMRPOLYLINETO16(DATASTREAM &ds)
Definition: libemf.h:4503
~EMRPOLYBEZIERTO16()
Definition: libemf.h:4308
EMRSTROKEPATH(DATASTREAM &ds)
Definition: libemf.h:5577
EMRSTROKEANDFILLPATH(DATASTREAM &ds)
Definition: libemf.h:5633
The base class of all metafile records.
Definition: libemf.h:988
~EMRPOLYLINETO16()
Definition: libemf.h:4516
~EMRPOLYGON()
Definition: libemf.h:3443
bool serialize(DATASTREAM ds)
Definition: libemf.h:2492
EMRPOLYPOLYGON(const RECTL *bounds, const POINT *points, const INT *counts, UINT polygons)
Definition: libemf.h:3617
PALETTE * palette
The current palette.
Definition: libemf.h:6365
std::vector< EMF::OBJECT * >::const_iterator begin(void) const
Definition: libemf.h:1299
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6028
CHAR *const string_
Array of single byte characters.
Definition: libemf.h:108
POINT16ARRAY(POINT16 *const points, const DWORD n)
Definition: libemf.h:164
EMF Polybezier16.
Definition: libemf.h:4031
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6096
int size(void) const
Definition: libemf.h:2567
EMRPOLYBEZIER(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:3944
int size(void) const
Definition: libemf.h:1888
EMRMODIFYWORLDTRANSFORM(const XFORM *transform, DWORD mode)
Definition: libemf.h:2144
DATASTREAM ds
Definition: libemf.h:6342
EMRPOLYGON16(DATASTREAM &ds)
Definition: libemf.h:3550
OBJECTTYPE getType(void) const
Definition: libemf.h:6130
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6171
EMRSETPIXELV(DATASTREAM &ds)
Definition: libemf.h:5086
HGDIOBJ handle
Definition: libemf.h:1232
EMRPOLYPOLYGON(DATASTREAM &ds)
Definition: libemf.h:3663
EMRPOLYBEZIERTO(DATASTREAM &ds)
Definition: libemf.h:4175
bool serialize(DATASTREAM ds)
Definition: libemf.h:2085
EMRSELECTOBJECT(DATASTREAM &ds)
Definition: libemf.h:2693
const DWORD n_
Number of double words in array.
Definition: libemf.h:190
int size(void) const
Definition: libemf.h:3100
EMRSELECTOBJECT(HGDIOBJ object)
Definition: libemf.h:2683
EMRSETTEXTCOLOR(COLORREF color)
Definition: libemf.h:2360
~EMRPOLYGON16()
Definition: libemf.h:3563
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6137
EMF Set the Polygon Fill Mode.
Definition: libemf.h:2537
EMRMODIFYWORLDTRANSFORM(DATASTREAM &ds)
Definition: libemf.h:2155
EMF PolylineTo16.
Definition: libemf.h:4447
BYTE *const array_
Array of unsigned bytes.
Definition: libemf.h:125
Definition: libemf.cpp:26
EMF Palette.
Definition: libemf.h:5460
int size(void) const
Definition: libemf.h:3995
Support different endian modes when reading and writing the metafile.
Definition: libemf.h:222
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2391
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2641
bool serialize(DATASTREAM ds)
Definition: libemf.h:1880
EMRPOLYLINETO16(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4480
bool serialize(DATASTREAM ds)
Definition: libemf.h:2020
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5709
SIZEL window_ext
The extent of the window.
Definition: libemf.h:6356
EMRCLOSEFIGURE(void)
Definition: libemf.h:5787
int size(void) const
Definition: libemf.h:5592
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3040
bool serialize(DATASTREAM ds)
Definition: libemf.h:2950
int size(void) const
Definition: libemf.h:1764
EMF Set Background Mode.
Definition: libemf.h:2470
EMRARCTO(INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
Definition: libemf.h:3001
int size(void) const
Definition: libemf.h:2766
bool serialize(DATASTREAM ds)
Definition: libemf.h:5151
bool serialize(DATASTREAM ds)
Definition: libemf.h:5584
EMRPOLYBEZIER16(const RECTL *bounds, const POINT16 *points, INT n)
Definition: libemf.h:4039
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4209
DWORDARRAY(DWORD *const dwords, const DWORD n)
Definition: libemf.h:196
bool serialize(DATASTREAM ds)
Definition: libemf.h:3570
SIZEL viewport_ext
The extent of the viewport.
Definition: libemf.h:6354
const int n_
Number of bytes in array.
Definition: libemf.h:126
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:1894
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2573
EMRSETWINDOWEXTEX(DATASTREAM &ds)
Definition: libemf.h:2013
EMRPOLYPOLYGON16(DATASTREAM &ds)
Definition: libemf.h:3850
WCHAR *const string_
String of WCHARs.
Definition: libemf.h:90
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2099
int size(void) const
Definition: libemf.h:3034
EMRPOLYGON16(const RECTL *bounds, const POINT16 *points, INT16 n)
Definition: libemf.h:3527
INT *const ints_
Array of ints.
Definition: libemf.h:173
EMRRESTOREDC(INT n)
Definition: libemf.h:5896
EMF Polyline.
Definition: libemf.h:3191
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5987
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2176
INTARRAY(INT *const ints, const DWORD n)
Definition: libemf.h:180
BYTEARRAY(BYTE *const array, const int n)
Definition: libemf.h:132
Graphics Device Context.
Definition: libemf.h:6244
EMRENDPATH(DATASTREAM &ds)
Definition: libemf.h:5742
EMF Extended Text Output ASCII.
Definition: libemf.h:4562
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5542
int size(void) const
Definition: libemf.h:5101
const DWORD n_
Number of POINT16s in array.
Definition: libemf.h:158
Graphics Pen.
Definition: libemf.h:6007
EMRLINETO(INT x, INT y)
Definition: libemf.h:2859
int size(void) const
Definition: libemf.h:2093
EMRSETMITERLIMIT(FLOAT limit)
Definition: libemf.h:6187
bool serialize(DATASTREAM ds)
Definition: libemf.h:1695
EMRRECTANGLE(DATASTREAM &ds)
Definition: libemf.h:3085
bool serialize(DATASTREAM ds)
Definition: libemf.h:1945
bool serialize(DATASTREAM ds)
Definition: libemf.h:4195
EMRSETMAPMODE(DATASTREAM &ds)
Definition: libemf.h:2620
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2034
bool serialize(DATASTREAM ds)
Definition: libemf.h:2877
~EMREXTTEXTOUTA()
Definition: libemf.h:4667
bool serialize(DATASTREAM ds)
Definition: libemf.h:3450
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4692
EMRSCALEWINDOWEXTEX(DATASTREAM &ds)
Definition: libemf.h:2078
bool serialize(DATASTREAM ds)
Definition: libemf.h:3682
EMF Scale Window Extents (ex)
Definition: libemf.h:2057
EMF Polyline16.
Definition: libemf.h:3286
EMRBEGINPATH(void)
Definition: libemf.h:5679
SIZEL resolution
The resolution in DPI of the reference DC.
Definition: libemf.h:6353
EMRSETVIEWPORTEXTEX(INT cx, INT cy)
Definition: libemf.h:1862
BRUSH(const LOGBRUSH *lbrush)
Definition: libemf.h:6080
OBJECTTYPE getType(void) const
Definition: libemf.h:6021
INT map_mode
The current mapping mode.
Definition: libemf.h:6371
POINTL *const points_
Array of POINTLs.
Definition: libemf.h:141
EMF Font.
Definition: libemf.h:5322
EMF Select Object.
Definition: libemf.h:2678
bool serialize(DATASTREAM ds)
Definition: libemf.h:2758
EMRSAVEDC(void)
Definition: libemf.h:5842
EMF Arc.
Definition: libemf.h:2912
EMRSETMETARGN(void)
Definition: libemf.h:5957
EMRPOLYLINETO(DATASTREAM &ds)
Definition: libemf.h:4383
EMRSETTEXTALIGN(UINT mode)
Definition: libemf.h:2274
bool serialize(DATASTREAM ds)
Definition: libemf.h:5913
bool serialize(DATASTREAM ds)
Definition: libemf.h:1819
EMF Set Pixel.
Definition: libemf.h:5067
DATASTREAM(::FILE *fp=0)
Definition: libemf.h:233
EMF Filled Polygon16.
Definition: libemf.h:3494
int size(void) const
Definition: libemf.h:2028
EMRPOLYBEZIERTO16(DATASTREAM &ds)
Definition: libemf.h:4295
WCHARSTR(WCHAR *const string, const int length)
Definition: libemf.h:97
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5654
EMRPOLYLINE(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:3199
EMF Filled Polygon.
Definition: libemf.h:3399
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3256
EMF PolyBezierTo.
Definition: libemf.h:4144
Definition: libemf.h:1275
EMF Brush.
Definition: libemf.h:5267
EMRFILLPATH(const RECTL *bounds)
Definition: libemf.h:5511
EMRPOLYBEZIER16(DATASTREAM &ds)
Definition: libemf.h:4087
EMREXTTEXTOUTA(const RECTL *bounds, DWORD graphicsMode, FLOAT xScale, FLOAT yScale, const PEMRTEXT text, LPCSTR string, const INT *dx)
Definition: libemf.h:4577
bool serialize(DATASTREAM ds)
Definition: libemf.h:4905
void setStream(::FILE *fp)
Definition: libemf.h:238
const DWORD n_
Number of ints in array.
Definition: libemf.h:174
EMRSETMITERLIMIT(DATASTREAM &ds)
Definition: libemf.h:6197
EMF Delete Object.
Definition: libemf.h:2736
int size(void) const
Definition: libemf.h:5921
bool serialize(DATASTREAM ds)
Definition: libemf.h:4523
EMRSETWINDOWORGEX(DATASTREAM &ds)
Definition: libemf.h:1812
EMRSETWINDOWORGEX(INT x, INT y)
Definition: libemf.h:1801
bool serialize(DATASTREAM ds)
Definition: libemf.h:2818
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5872
ENHMETAHEADER * header
Definition: libemf.h:6346
bool serialize(DATASTREAM ds)
Definition: libemf.h:2162
EMF Set Meta Region.
Definition: libemf.h:5952
HGDIOBJ add(OBJECT *object)
Definition: libemf.cpp:180
std::vector< bool > handles
Definition: libemf.h:6379
EMF End Path.
Definition: libemf.h:5728
bool serialize(DATASTREAM ds)
Definition: libemf.h:2291
PALETTE(const LOGPALETTE *lpalette)
Definition: libemf.h:6153
Graphics Palette.
Definition: libemf.h:6148
int size(void) const
Definition: libemf.h:1953