32 #include <libEMF/emf.h>    34 #include <libEMF/wine/w16.h>    41 #define EMF_UNUSED(x) (void)x;    49   const int XMAX_PIXELS = 1024; 
    51   const int XMAX_PIXELS = 1280; 
    58   const int YMAX_PIXELS = 768; 
    60   const int YMAX_PIXELS = 1024; 
    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; }
    97     WCHARSTR ( WCHAR *
const string, 
const int length )
    98       : string_( string ), length_( length ) {}
   115     CHARSTR ( CHAR *
const string, 
const int length )
   116       : string_( string ), length_( length ) {}
   133       : array_( array ), n_( n ) {}
   149       : points_( points ), n_( n ) {}
   165       : points_( points ), n_( n ) {}
   181       : ints_( ints ), n_( n ) {}
   197       : dwords_( dwords ), n_( n ) {}
   205     static const char padding_[4]; 
   226     static bool bigEndian ( 
void );
   233     DATASTREAM ( ::FILE* fp = 0 ) : swap_( bigEndian() ), fp_( fp ) {}
   245       fwrite( &byte, 
sizeof(BYTE), 1, fp_ );
   254       fread( &byte, 
sizeof(BYTE), 1, fp_ );
   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_ );
   269         fwrite( &word, 
sizeof(WORD), 1, fp_ );
   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_ );
   284         fread( &word, 
sizeof(WORD), 1, fp_ );
   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_ );
   299         fwrite( &word, 
sizeof(INT16), 1, fp_ );
   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_ );
   314         fread( &word, 
sizeof(INT16), 1, fp_ );
   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_ );
   331         fwrite( &dword, 
sizeof(DWORD), 1, fp_ );
   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_ );
   348         fread( &dword, 
sizeof(DWORD), 1, fp_ );
   351 #if !defined( __LP64__ )   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_ );
   366         fwrite( &long_, 
sizeof(LONG), 1, fp_ );
   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_ );
   383         fread( &long_, 
sizeof(LONG), 1, fp_ );
   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_ );
   401         fwrite( &int_, 
sizeof(INT), 1, fp_ );
   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_ );
   418         fread( &int_, 
sizeof(INT), 1, fp_ );
   421 #if !defined(__LP64__)   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_ );
   436         fwrite( &uint, 
sizeof(UINT), 1, fp_ );
   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_ );
   453         fread( &uint, 
sizeof(UINT), 1, fp_ );
   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_ );
   471         fwrite( &float_, 
sizeof(FLOAT), 1, fp_ );
   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_ );
   488         fread( &float_, 
sizeof(FLOAT), 1, fp_ );
   497       if ( padding.
size_ != 0 )
   498         fwrite( &padding.
padding_, 
sizeof(CHAR), padding.
size_, fp_ );
   507       *
this << rectl.left << rectl.top << rectl.right << rectl.bottom;
   516       *
this >> rectl.left >> rectl.top >> rectl.right >> rectl.bottom;
   525       *
this << sizel.cx << sizel.cy;
   534       *
this >> sizel.cx >> sizel.cy;
   543       for ( 
int i = 0; i < wcharstr.
length_; i++ )
   553       for ( 
int i = 0; i < wcharstr.
length_; i++ )
   581       *
this << emr.iType << emr.nSize;
   590       *
this >> emr.iType >> emr.nSize;
   599       *
this << point.x << point.y;
   608       *
this >> point.x >> point.y;
   617       *
this << pointl.x << pointl.y;
   626       *
this >> pointl.x >> pointl.y;
   635       *
this << point.x << point.y;
   644       *
this >> point.x >> point.y;
   653       *
this << xform.eM11 << xform.eM12 << xform.eM21 << xform.eM22
   654             << xform.eDx << xform.eDy;
   663       *
this >> xform.eM11 >> xform.eM12 >> xform.eM21 >> xform.eM22
   664             >> xform.eDx >> xform.eDy;
   673       fwrite( array.
array_, 
sizeof(BYTE), array.
n_, fp_ );
   682       fread( array.
array_, 
sizeof(BYTE), array.
n_, fp_ );
   691       for ( 
unsigned int i = 0; i < array.
n_; i++ )
   701       for ( 
unsigned int i = 0; i < array.
n_; i++ )
   711       for ( 
unsigned int i = 0; i < array.
n_; i++ )
   721       for ( 
unsigned int i = 0; i < array.
n_; i++ )
   731       for ( 
unsigned int i = 0; i < array.
n_; i++ )
   732         *
this << array.
ints_[i];
   741       for ( 
unsigned int i = 0; i < array.
n_; i++ )
   742         *
this >> array.
ints_[i];
   751       for ( 
unsigned int i = 0; i < array.
n_; i++ )
   761       for ( 
unsigned int i = 0; i < array.
n_; i++ )
   771       *
this << text.ptlReference << text.nChars << text.offString << text.fOptions
   772          << text.rcl << text.offDx;
   781       *
this >> text.ptlReference >> text.nChars >> text.offString >> text.fOptions
   782             >> text.rcl >> text.offDx;
   791       *
this << pen.lopnStyle << pen.lopnWidth << pen.lopnColor;
   800       *
this >> pen.lopnStyle >> pen.lopnWidth >> pen.lopnColor;
   810       *
this << pen.elpPenStyle << pen.elpWidth << pen.elpBrushStyle << pen.elpColor
   811             << pen.elpHatch << pen.elpNumEntries;
   821       *
this >> pen.elpPenStyle >> pen.elpWidth >> pen.elpBrushStyle >> pen.elpColor
   822             >> pen.elpHatch >> pen.elpNumEntries;
   831       *
this << brush.lbStyle << brush.lbColor << brush.lbHatch;
   840       *
this >> brush.lbStyle >> brush.lbColor >> brush.lbHatch;
   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 );
   863       WCHARSTR wFaceName( font.lfFaceName, LF_FACESIZE );
   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
   879       fwrite( &panose, 
sizeof(PANOSE), 1, fp_ );
   888       fread( &panose, 
sizeof(PANOSE), 1, fp_ );
   897       *
this << font.elfLogFont
   898             << 
WCHARSTR( const_cast<WCHAR*const>(font.elfFullName),
   900             << 
WCHARSTR( const_cast<WCHAR*const>(font.elfStyle), LF_FACESIZE )
   901             << font.elfVersion << font.elfStyleSize << font.elfMatch
   903             << 
BYTEARRAY( const_cast<BYTE*const>(font.elfVendorId),
   905             << font.elfCulture << font.elfPanose;
   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;
   931       *
this << palette.palVersion << palette.palNumEntries;
   941       *
this >> palette.palVersion >> palette.palNumEntries;
   955     void fread ( 
void* ptr, 
size_t size, 
size_t nmemb, FILE* stream )
   957       size_t res = ::fread( ptr, size, nmemb, stream );
   959         if ( ! feof( stream ) ) {
   960           throw std::runtime_error( 
"error reading EMF stream" );
   973     void fwrite ( 
const void* ptr, 
size_t size, 
size_t nmemb, FILE* stream )
   975       size_t res = ::fwrite( ptr, size, nmemb, stream );
   977         throw std::runtime_error( 
"error writing EMF stream" );
  1006     virtual bool serialize ( 
DATASTREAM ds ) = 0;
  1012     virtual int size ( 
void ) 
const = 0;
  1019 #ifdef ENABLE_EDITING  1024     virtual void edit ( 
void )
 const {}
  1028 #ifdef ENABLE_EDITING  1030   inline void edit_rectl ( 
const char* tag, 
const RECTL& rectl )
  1032 #if defined(__LP64__)  1033     const char* FMT = 
"\t%s\t: (%d, %d) - (%d, %d)\n";
  1035     const char* FMT = 
"\t%s\t: (%ld, %ld) - (%ld, %ld)\n";
  1037     printf( FMT, tag, rectl.left, rectl.top, rectl.right, rectl.bottom );
  1040   inline void edit_xform ( 
const char* tag, 
const XFORM& xform )
  1042     printf( 
"\t%s.eM11\t: %f\n", tag, xform.eM11 );
  1043     printf( 
"\t%s.eM12\t: %f\n", tag, xform.eM12 );
  1044     printf( 
"\t%s.eM21\t: %f\n", tag, xform.eM21 );
  1045     printf( 
"\t%s.eM22\t: %f\n", tag, xform.eM22 );
  1046     printf( 
"\t%s.eDx\t: %f\n", tag, xform.eDx );
  1047     printf( 
"\t%s.eDy\t: %f\n", tag, xform.eDy );
  1050   inline void edit_color ( 
const char* tag, 
const COLORREF& color )
  1052 #if defined(__LP64__)  1053     const char* FMT = 
"\t%s\t: R(0x%02x) G(0x%02x) B(0x%02x)\n";
  1055     const char* FMT = 
"\t%s\t: R(0x%02lx) G(0x%02lx) B(0x%02lx)\n";
  1058             GetRValue( color ), GetGValue( color ), GetBValue( color ) );
  1061   inline void edit_sizel ( 
const char* tag, 
const SIZEL& size )
  1063 #if defined(__LP64__)  1064     const char* FMT = 
"\t%s\t: (%d, %d)\n";
  1066     const char* FMT = 
"\t%s\t: (%ld, %ld)\n";
  1068     printf( FMT, tag, size.cx, size.cy );
  1071   inline void edit_pointl ( 
const char* tag, 
const POINTL& point )
  1073 #if defined(__LP64__)  1074     const char* FMT = 
"\t%s\t: (%d, %d)\n";
  1076     const char* FMT = 
"\t%s\t: (%ld, %ld)\n";
  1078     printf( FMT, tag, point.x, point.y );
  1081   inline void edit_pointlarray ( 
const char* tag, 
const DWORD cptl,
  1082                                   const POINTL* points )
  1084 #if defined(__LP64__)  1085     const char* FMT0 = 
"\tcptl%s\t: %d\n";
  1086     const char* FMT1 = 
"%d, %d\n";
  1087     const char* FMT2 = 
"\t\t%s  %d, %d\n";
  1089     const char* FMT0 = 
"\tcptl%s\t: %ld\n";
  1090     const char* FMT1 = 
"%ld, %ld\n";
  1091     const char* FMT2 = 
"\t\t%s  %ld, %ld\n";
  1093     printf( FMT0, tag, cptl );
  1094     printf( 
"\taptl%s\t: ", tag );
  1096       printf( FMT1, points[0].x, points[0].y );
  1099     for ( DWORD i = 1; i < cptl; i++ )
  1100       printf( FMT2, tag, points[i].x, points[i].y );
  1103   inline void edit_point16array ( 
const char* tag, 
const unsigned int cpts,
  1104                                   const POINT16* points )
  1106     printf( 
"\tcpts%s\t: %d\n", tag, cpts );
  1107     printf( 
"\tapts%s\t: ", tag );
  1109       printf( 
"%d, %d\n", points[0].x, points[0].y );
  1112     for ( 
unsigned int i = 1; i < cpts; i++ )
  1113       printf( 
"\t\t%s  %d, %d\n", tag, points[i].x, points[i].y );
  1116   inline void edit_pen_style ( 
const char* tag, DWORD style )
  1118     printf( 
"\t%s\t: ", tag );
  1119     switch ( style & PS_STYLE_MASK ) {
  1120     case PS_SOLID: printf( 
"PS_SOLID" ); 
break;
  1121     case PS_DASH: printf( 
"PS_DASH" ); 
break;
  1122     case PS_DOT: printf( 
"PS_DOT" ); 
break;
  1123     case PS_DASHDOT: printf( 
"PS_DASHDOT" ); 
break;
  1124     case PS_DASHDOTDOT: printf( 
"PS_DASHDOTDOT" ); 
break;
  1125     case PS_NULL: printf( 
"PS_NULL" ); 
break;
  1126     case PS_INSIDEFRAME: printf( 
"PS_INSIDEFRAME" ); 
break;
  1127     case PS_USERSTYLE: printf( 
"PS_USERSTYLE" ); 
break;
  1128     case PS_ALTERNATE: printf( 
"PS_ALTERNATE" ); 
break;
  1130     switch ( style & PS_ENDCAP_MASK ) {
  1131     case PS_ENDCAP_ROUND: printf( 
" | PS_ENDCAP_ROUND" ); 
break;
  1132     case PS_ENDCAP_SQUARE: printf( 
" | PS_ENDCAP_SQUARE" ); 
break;
  1133     case PS_ENDCAP_FLAT: printf( 
" | PS_ENDCAP_FLAT" ); 
break;
  1135     switch ( style & PS_JOIN_MASK ) {
  1136     case PS_JOIN_ROUND: printf( 
" | PS_JOIN_ROUND" ); 
break;
  1137     case PS_JOIN_BEVEL: printf( 
" | PS_JOIN_BEVEL" ); 
break;
  1138     case PS_JOIN_MITER: printf( 
" | PS_JOIN_MITER" ); 
break;
  1140     switch ( style & PS_TYPE_MASK ) {
  1141     case PS_COSMETIC: printf( 
" | PS_COSMETIC" ); 
break;
  1142     case PS_GEOMETRIC: printf( 
" | PS_GEOMETRIC" ); 
break;
  1147   inline void edit_brush_style ( 
const char* tag, DWORD style )
  1149 #if defined(__LP64__)  1150     const char* FMT = 
"unknown(%d)";
  1152     const char* FMT = 
"unknown(%ld)";
  1154     printf( 
"\t%s\t: ", tag );
  1156     case BS_SOLID: printf( 
"BS_SOLID" ); 
break;
  1157     case BS_NULL: printf( 
"BS_NULL" ); 
break;
  1158     case BS_HATCHED: printf( 
"BS_HATCHED" ); 
break;
  1159     case BS_PATTERN: printf( 
"BS_PATTERN" ); 
break;
  1160     case BS_INDEXED: printf( 
"BS_INDEXED" ); 
break;
  1161     case BS_DIBPATTERN: printf( 
"BS_DIBPATTERN" ); 
break;
  1162     case BS_DIBPATTERNPT: printf( 
"BS_DIBPATTERNPT" ); 
break;
  1163     case BS_PATTERN8X8: printf( 
"BS_PATTERN8X8" ); 
break;
  1164     case BS_DIBPATTERN8X8: printf( 
"BS_DIBPATTERN8X8" ); 
break;
  1165     case BS_MONOPATTERN: printf( 
"BS_DIBPATTERN8X8" ); 
break;
  1166     default: printf( FMT, style );
  1171   inline void edit_brush_hatch ( 
const char* tag, DWORD hatch )
  1173 #if defined(__LP64__)  1174     const char* FMT = 
"unknown(%d)";
  1176     const char* FMT = 
"unknown(%ld)";
  1178     printf( 
"\t%s\t: ", tag );
  1180     case HS_HORIZONTAL: printf( 
"HS_HORIZONTAL" ); 
break;
  1181     case HS_VERTICAL: printf( 
"HS_VERTICAL" ); 
break;
  1182     case HS_FDIAGONAL: printf( 
"HS_FDIAGONAL" ); 
break;
  1183     case HS_BDIAGONAL: printf( 
"HS_BDIAGONAL" ); 
break;
  1184     case HS_CROSS: printf( 
"HS_CROSS" ); 
break;
  1185     case HS_DIAGCROSS: printf( 
"HS_DIAGCROSS" ); 
break;
  1186     default: printf( FMT, hatch );
  1198   enum OBJECTTYPE { O_METAFILEDEVICECONTEXT     = OBJ_METADC,
  1201                     O_EXTPEN                    = OBJ_EXTPEN,
  1202                     O_BRUSH                     = OBJ_BRUSH,
  1203                     O_PALETTE                   = OBJ_PAL };
  1208   static char* typStr ( OBJECTTYPE type )
  1211     case O_METAFILEDEVICECONTEXT:
  1212       return "metafile device context";
  1218       return "extended pen";
  1224     return "unknown object";
  1246     virtual OBJECTTYPE getType ( 
void ) 
const = 0;
  1270     virtual METARECORD* newEMR ( HDC dc, HGDIOBJ handle ) = 0;
  1282     std::vector<OBJECT*> objects;
  1290     std::map< DWORD, METARECORDCTOR > new_records;
  1295     HGDIOBJ add ( 
OBJECT* 
object );
  1296     OBJECT* find ( 
const HGDIOBJ handle );
  1297     void remove ( 
const OBJECT* object );
  1302     std::vector<EMF::OBJECT*>::const_iterator 
begin ( 
void )
 const  1303     { 
return objects.begin(); }
  1307     std::vector<EMF::OBJECT*>::const_iterator 
end ( 
void )
 const  1308     { 
return objects.end(); }
  1310     METARECORDCTOR newRecord ( DWORD iType ) 
const;
  1429     LPWSTR description_w;
  1430     int description_size;
  1440       : description_w( 0 ), description_size( 0 )
  1446       RECTL default_bounds = { 0, 0, 0, 0 };
  1447       rclBounds = default_bounds;
  1448       RECTL default_frame = { 0, 0, 0, 0 };
  1449       rclFrame = default_frame;
  1450       dSignature = ENHMETA_SIGNATURE;
  1459       szlDevice.cx = XMAX_PIXELS;
  1460       szlDevice.cy = YMAX_PIXELS;
  1461       szlMillimeters.cx = XMAX_MM;
  1462       szlMillimeters.cy = YMAX_MM;
  1469       szlMicrometers.cx = 1000 * szlMillimeters.cx;
  1470       szlMicrometers.cy = 1000 * szlMillimeters.cy;
  1472       if ( description ) {
  1474         int description_count = 0, nulls = 0;
  1475         LPCWSTR description_p = description;
  1476         while ( nulls < 3 ) {
  1477           description_count++;
  1478           if ( (*description_p++) == 0 ) nulls++;
  1483         int record_size = ROUND_TO_LONG( 
sizeof( ::
ENHMETAHEADER ) +
  1484                                          sizeof( WCHAR ) * description_count );
  1488         description_w = 
new WCHAR[ description_size ];
  1490         memset( description_w, 0, 
sizeof(WCHAR) * description_size );
  1492         for ( 
int i=0; i<description_count; i++ )
  1493           description_w[i] = *description++;
  1495         nSize = nBytes = record_size;
  1496         nDescription = description_count;
  1506       if ( description_w ) 
delete[] description_w;
  1514       ds << iType << nSize
  1515          << rclBounds << rclFrame
  1516          << dSignature << nVersion << nBytes << nRecords << nHandles << sReserved
  1517          << nDescription << offDescription << nPalEntries
  1518          << szlDevice << szlMillimeters
  1519          << cbPixelFormat << offPixelFormat << bOpenGL
  1523          << 
WCHARSTR( description_w, description_size );
  1531       ds >> iType >> nSize
  1532          >> rclBounds >> rclFrame
  1533          >> dSignature >> nVersion >> nBytes >> nRecords >> nHandles >> sReserved
  1534          >> nDescription >> offDescription >> nPalEntries
  1535          >> szlDevice >> szlMillimeters;
  1539 #define OffsetOf( a, b ) ((unsigned int)(((char*)&(((::ENHMETAHEADER*)a)->b)) - \  1540 (char*)((::ENHMETAHEADER*)a)))  1542       if ( OffsetOf( 
this, szlMicrometers ) <= offDescription )
  1543         ds >> cbPixelFormat >> offPixelFormat >> bOpenGL;
  1546         ds >> cbPixelFormat >> offPixelFormat >> bOpenGL;
  1551         ds >> szlMicrometers;
  1555       description_size = ( nSize - offDescription ) / 
sizeof(WCHAR);
  1556       description_w = 
new WCHAR[ description_size ];
  1558       WCHARSTR description( description_w, description_size );
  1567     int size ( 
void )
 const { 
return nSize; }
  1579 #ifdef ENABLE_EDITING  1583     void edit ( 
void )
 const  1585 #if defined(__LP64__)  1586       const char* FMT0 = 
"\tiType\t\t\t: %d\n";
  1587       const char* FMT1 = 
"\tnSize\t\t\t: %d\n";
  1588       const char* FMT2 = 
"\tnBytes\t\t\t: %d\n";
  1589       const char* FMT3 = 
"\tnRecords\t\t: %d\n";
  1590       const char* FMT4 = 
"\tnDescription\t\t: %d\n";
  1591       const char* FMT5 = 
"\toffDescription\t\t: %d\n";
  1592       const char* FMT6 = 
"\tnPalEntries\t\t: %d\n";
  1593       const char* FMT7 = 
"\tcbPixelFormat\t\t: %d\n";
  1594       const char* FMT8 = 
"\toffPixelFormat\t\t: %d\n";
  1595       const char* FMT9 = 
"\tbOpenGL\t\t\t: %d\n";
  1597       const char* FMT0 = 
"\tiType\t\t\t: %ld\n";
  1598       const char* FMT1 = 
"\tnSize\t\t\t: %ld\n";
  1599       const char* FMT2 = 
"\tnBytes\t\t\t: %ld\n";
  1600       const char* FMT3 = 
"\tnRecords\t\t: %ld\n";
  1601       const char* FMT4 = 
"\tnDescription\t\t: %ld\n";
  1602       const char* FMT5 = 
"\toffDescription\t\t: %ld\n";
  1603       const char* FMT6 = 
"\tnPalEntries\t\t: %ld\n";
  1604       const char* FMT7 = 
"\tcbPixelFormat\t\t: %ld\n";
  1605       const char* FMT8 = 
"\toffPixelFormat\t\t: %ld\n";
  1606       const char* FMT9 = 
"\tbOpenGL\t\t\t: %ld\n";
  1608       printf( 
"*HEADER*\n" );
  1609       printf( FMT0, iType );
  1610       printf( FMT1, nSize );
  1611       edit_rectl( 
"rclBounds\t", rclBounds );
  1612       edit_rectl( 
"rclFrame\t", rclFrame );
  1613       printf( 
"\tdSignature\t\t: %.4s\n", (
const char*)&dSignature );
  1614       printf( 
"\tnVersion\t\t: 0x%x\n", (
unsigned int)nVersion );
  1615       printf( FMT2, nBytes );
  1616       printf( FMT3, nRecords );
  1617       printf( 
"\tnHandles\t\t: %d\n", nHandles );
  1618       printf( FMT4, nDescription );
  1619       printf( FMT5, offDescription );
  1620       printf( FMT6, nPalEntries );
  1621       edit_sizel( 
"szlDevice\t", szlDevice );
  1622       edit_sizel( 
"szlMillimeters\t", szlMillimeters );
  1625 #define OffsetOf( a, b ) ((unsigned int)(((const char*)&(((const ::ENHMETAHEADER*)a)->b)) - \  1626 (const char*)((const ::ENHMETAHEADER*)a)))  1628       if ( OffsetOf( 
this, cbPixelFormat ) <= offDescription ) {
  1629         printf( FMT7, cbPixelFormat );
  1630         printf( FMT8, offPixelFormat );
  1631         printf( FMT9, bOpenGL );
  1634           edit_sizel( 
"szlMicrometers\t", szlMicrometers );
  1641       if ( nDescription != 0 ) {
  1644         WCHAR* description = description_w;
  1646         printf( 
"\tDescription:" );
  1648         for ( DWORD i = 0; i < nDescription; i++ ) {
  1650           wchar_t w = *description++; 
  1654             if ( last_w == 0 ) printf( 
"\n\t\t" );
  1679       emr.iType = EMR_EOF;
  1692       ds >> emr >> nPalEntries >> offPalEntries >> nSizeLast;
  1700       ds << emr << nPalEntries << offPalEntries << nSizeLast;
  1706     int size ( 
void )
 const { 
return emr.nSize; }
  1718 #ifdef ENABLE_EDITING  1722     void edit ( 
void )
 const  1724       printf( 
"*EOF*\n" );
  1743       emr.iType = EMR_SETVIEWPORTORGEX;
  1754       ds >> emr >> ptlOrigin;
  1761       ds << emr << ptlOrigin;
  1767     int size ( 
void )
 const { 
return emr.nSize; }
  1776       SetViewportOrgEx( dc, ptlOrigin.x, ptlOrigin.y, 0 );
  1778 #ifdef ENABLE_EDITING  1782     void edit ( 
void )
 const  1784       printf( 
"*SETVIEWPORTORGEX*\n" );
  1785       edit_pointl( 
"ptlOrigin", ptlOrigin );
  1806       emr.iType = EMR_SETWINDOWORGEX;
  1817       ds >> emr >> ptlOrigin;
  1824       ds << emr << ptlOrigin;
  1830     int size ( 
void )
 const { 
return emr.nSize; }
  1839       SetWindowOrgEx( dc, ptlOrigin.x, ptlOrigin.y, 0 );
  1841 #ifdef ENABLE_EDITING  1845     void edit ( 
void )
 const  1847       printf( 
"*SETWINDOWORGEX*\n" );
  1848       edit_pointl( 
"ptlOrigin", ptlOrigin );
  1867       emr.iType = EMR_SETVIEWPORTEXTEX;
  1878       ds >> emr >> szlExtent;
  1885       ds << emr << szlExtent;
  1891     int size ( 
void )
 const { 
return emr.nSize; }
  1900       SetViewportExtEx( dc, szlExtent.cx, szlExtent.cy, 0 );
  1902 #ifdef ENABLE_EDITING  1906     void edit ( 
void )
 const  1908       printf( 
"*SETVIEWPORTEXTEX*\n" );
  1909       edit_sizel( 
"szlExtent", szlExtent );
  1930       emr.iType = EMR_SCALEVIEWPORTEXTEX;
  1943       ds >> emr >> xNum >> xDenom >> yNum >> yDenom;
  1950       ds << emr << xNum << xDenom << yNum << yDenom;
  1956     int size ( 
void )
 const { 
return emr.nSize; }
  1965       ScaleViewportExtEx( dc, xNum, xDenom, yNum, yDenom, 0 );
  1967 #ifdef ENABLE_EDITING  1971     void edit ( 
void )
 const  1973 #if defined(__LP64__)  1974       const char* FMT0 = 
"\txNum\t: %d\n";
  1975       const char* FMT1 = 
"\txDenom\t: %d\n";
  1976       const char* FMT2 = 
"\tyNum\t: %d\n";
  1977       const char* FMT3 = 
"\tyDenom\t: %d\n";
  1979       const char* FMT0 = 
"\txNum\t: %ld\n";
  1980       const char* FMT1 = 
"\txDenom\t: %ld\n";
  1981       const char* FMT2 = 
"\tyNum\t: %ld\n";
  1982       const char* FMT3 = 
"\tyDenom\t: %ld\n";
  1984       printf( 
"*SCALEVIEWPORTEXTEX*\n" );
  1985       printf( FMT0, xNum );
  1986       printf( FMT1, xDenom );
  1987       printf( FMT2, yNum );
  1988       printf( FMT3, yDenom );
  2007       emr.iType = EMR_SETWINDOWEXTEX;
  2018       ds >> emr >> szlExtent;
  2025       ds << emr << szlExtent;
  2031     int size ( 
void )
 const { 
return emr.nSize; }
  2040       SetWindowExtEx( dc, szlExtent.cx, szlExtent.cy, 0 );
  2042 #ifdef ENABLE_EDITING  2046     void edit ( 
void )
 const  2048       printf( 
"*SETWINDOWEXTEX*\n" );
  2049       edit_sizel( 
"szlExtent", szlExtent );
  2070       emr.iType = EMR_SCALEWINDOWEXTEX;
  2083       ds >> emr >> xNum >> xDenom >> yNum >> yDenom;
  2090       ds << emr << xNum << xDenom << yNum << yDenom;
  2096     int size ( 
void )
 const { 
return emr.nSize; }
  2105       ScaleWindowExtEx( dc, xNum, xDenom, yNum, yDenom, 0 );
  2107 #ifdef ENABLE_EDITING  2111     void edit ( 
void )
 const  2113 #if defined(__LP64__)  2114       const char* FMT0 = 
"\txNum\t: %d\n";
  2115       const char* FMT1 = 
"\txDenom\t: %d\n";
  2116       const char* FMT2 = 
"\tyNum\t: %d\n";
  2117       const char* FMT3 = 
"\tyDenom\t: %d\n";
  2119       const char* FMT0 = 
"\txNum\t: %ld\n";
  2120       const char* FMT1 = 
"\txDenom\t: %ld\n";
  2121       const char* FMT2 = 
"\tyNum\t: %ld\n";
  2122       const char* FMT3 = 
"\tyDenom\t: %ld\n";
  2124       printf( 
"*SCALEWINDOWEXTEX*\n" );
  2125       printf( FMT0, xNum );
  2126       printf( FMT1, xDenom );
  2127       printf( FMT2, yNum );
  2128       printf( FMT3, yDenom );
  2149       emr.iType = EMR_MODIFYWORLDTRANSFORM;
  2160       ds >> emr >> xform >> iMode;
  2167       ds << emr << xform << iMode;
  2173     int size ( 
void )
 const { 
return emr.nSize; }
  2182       ModifyWorldTransform( dc, &xform, iMode );
  2184 #ifdef ENABLE_EDITING  2188     void edit ( 
void )
 const  2190 #if defined(__LP64__)  2191     const char* FMT = 
"unknown(%d)\n";
  2193     const char* FMT = 
"unknown(%ld)\n";
  2195       printf( 
"*MODIFYWORLDTRANSFORM*\n" );
  2196       edit_xform( 
"xform", xform );
  2197       printf( 
"\tiMode\t\t: " );
  2199       case MWT_IDENTITY: printf( 
"MWT_IDENTITY\n" ); 
break;
  2200       case MWT_LEFTMULTIPLY: printf( 
"MWT_LEFTMULTIPLY\n" ); 
break;
  2201       case MWT_RIGHTMULTIPLY: printf( 
"MWT_RIGHTMULTIPLY\n" ); 
break;
  2202       default: printf( FMT, iMode );
  2222       emr.iType = EMR_SETWORLDTRANSFORM;
  2245     int size ( 
void )
 const { 
return emr.nSize; }
  2254       SetWorldTransform( dc, &xform );
  2256 #ifdef ENABLE_EDITING  2260     void edit ( 
void )
 const  2262       printf( 
"*SETWORLDTRANSFORM*\n" );
  2263       edit_xform( 
"xform", xform );
  2279       emr.iType = EMR_SETTEXTALIGN;
  2302     int size ( 
void )
 const { 
return emr.nSize; }
  2311       SetTextAlign( dc, iMode );
  2313 #ifdef ENABLE_EDITING  2317     void edit ( 
void )
 const  2319 #if defined(__LP64__)  2320     const char* FMT = 
"| unknown bits(0x%x)";
  2322     const char* FMT = 
"| unknown bits(0x%lx)";
  2324       unsigned int known_bits = TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING;
  2325       unsigned int unknown_bits = ~known_bits;
  2327       printf( 
"*SETTEXTALIGN*\n" );
  2328       printf( 
"\tiMode\t: " );
  2329       if ( iMode & TA_UPDATECP )
  2330         printf( 
"TA_UPDATECP" );
  2332         printf( 
"TA_NOUPDATECP" );
  2333       if ( iMode & TA_CENTER )
  2334         printf( 
" | TA_CENTER" );
  2335       else if ( iMode & TA_RIGHT )
  2336         printf( 
" | TA_RIGHT" );
  2338         printf( 
" | TA_LEFT" );
  2339       if ( iMode & TA_BASELINE )
  2340         printf( 
" | TA_BASELINE" );
  2341       else if ( iMode & TA_BOTTOM )
  2342         printf( 
" | TA_BOTTOM" );
  2344         printf( 
" | TA_TOP" );
  2345       if ( iMode & TA_RTLREADING )
  2346         printf( 
" | TA_RTLREADING" );
  2347       if ( iMode & unknown_bits )
  2348         printf( FMT, iMode & unknown_bits );
  2365       emr.iType = EMR_SETTEXTCOLOR;
  2375       ds >> emr >> crColor;
  2382       ds << emr << crColor;
  2388     int size ( 
void )
 const { 
return emr.nSize; }
  2397       SetTextColor( dc, crColor );
  2399 #ifdef ENABLE_EDITING  2403     void edit ( 
void )
 const  2405       printf( 
"*SETTEXTCOLOR*\n" );
  2406       edit_color( 
"crColor", crColor );
  2422       emr.iType = EMR_SETBKCOLOR;
  2432       ds >> emr >> crColor;
  2439       ds << emr << crColor;
  2445     int size ( 
void )
 const { 
return emr.nSize; }
  2454       SetBkColor( dc, crColor );
  2456 #ifdef ENABLE_EDITING  2460     void edit ( 
void )
 const  2462       printf( 
"*SETBKCOLOR*\n" );
  2463       edit_color( 
"crColor", crColor );
  2480       emr.iType = EMR_SETBKMODE;
  2503     int size ( 
void )
 const { 
return emr.nSize; }
  2512       SetBkMode( dc, iMode );
  2514 #ifdef ENABLE_EDITING  2518     void edit ( 
void )
 const  2520 #if defined(__LP64__)  2521     const char* FMT = 
"unknown(%d)\n";
  2523     const char* FMT = 
"unknown(%ld)\n";
  2525       printf( 
"*SETBKMODE*\n" );
  2526       printf( 
"\tiMode\t: " );
  2528       case TRANSPARENT: printf( 
"TRANSPARENT\n" ); 
break;
  2529       case OPAQUE: printf( 
"OPAQUE\n" ); 
break;
  2530       default: printf( FMT, iMode );
  2547       emr.iType = EMR_SETPOLYFILLMODE;
  2570     int size ( 
void )
 const { 
return emr.nSize; }
  2579       SetPolyFillMode( dc, iMode );
  2581 #ifdef ENABLE_EDITING  2585     void edit ( 
void )
 const  2587 #if defined(__LP64__)  2588     const char* FMT = 
"unknown(%d)\n";
  2590     const char* FMT = 
"unknown(%ld)\n";
  2592       printf( 
"*SETPOLYFILLMODE*\n" );
  2593       printf( 
"\tiMode: " );
  2595       case ALTERNATE: printf( 
"ALTERNATE\n" ); 
break;
  2596       case WINDING: printf( 
"WINDING\n" ); 
break;
  2597       default: printf( FMT, iMode );
  2615       emr.iType = EMR_SETMAPMODE;
  2638     int size ( 
void )
 const { 
return emr.nSize; }
  2647       SetMapMode( dc, iMode );
  2649 #ifdef ENABLE_EDITING  2653     void edit ( 
void )
 const  2655 #if defined(__LP64__)  2656     const char* FMT = 
"unknown(%d)\n";
  2658     const char* FMT = 
"unknown(%ld)\n";
  2660       printf( 
"*SETMAPMODE*\n" );
  2661       printf( 
"\tiMode\t: " );
  2663       case MM_TEXT: printf( 
"MM_TEXT\n" ); 
break;
  2664       case MM_LOMETRIC: printf( 
"MM_LOMETRIC\n" ); 
break;
  2665       case MM_HIMETRIC: printf( 
"MM_HIMETRIC\n" ); 
break;
  2666       case MM_LOENGLISH: printf( 
"MM_LOENGLISH\n" ); 
break;
  2667       case MM_HIENGLISH: printf( 
"MM_HIENGLISH\n" ); 
break;
  2668       case MM_TWIPS: printf( 
"MM_TWIPS\n" ); 
break;
  2669       case MM_ISOTROPIC: printf( 
"MM_ISOTROPIC\n" ); 
break;
  2670       case MM_ANISOTROPIC: printf( 
"MM_ANISOTROPIC\n" ); 
break;
  2671       default: printf( FMT, iMode );
  2688       emr.iType = EMR_SELECTOBJECT;
  2698       ds >> emr >> ihObject;
  2705       ds << emr << ihObject;
  2711     int size ( 
void )
 const { 
return emr.nSize; }
  2718 #ifdef ENABLE_EDITING  2722     void edit ( 
void )
 const  2724 #if defined(__LP64__)  2725       const char* FMT = 
"\tihObject\t: 0x%x\n";
  2727       const char* FMT = 
"\tihObject\t: 0x%lx\n";
  2729       printf( 
"*SELECTOBJECT*\n" );
  2730       printf( FMT, ihObject );
  2746       emr.iType = EMR_DELETEOBJECT;
  2756       ds >> emr >> ihObject;
  2763       ds << emr << ihObject;
  2769     int size ( 
void )
 const { 
return emr.nSize; }
  2776 #ifdef ENABLE_EDITING  2780     void edit ( 
void )
 const  2782 #if defined(__LP64__)  2783       const char* FMT = 
"\tihObject\t: 0x%x\n";
  2785       const char* FMT = 
"\tihObject\t: 0x%lx\n";
  2787       printf( 
"*DELETEOBJECT*\n" );
  2788       printf( FMT, ihObject );
  2805       emr.iType = EMR_MOVETOEX;
  2829     int size ( 
void )
 const { 
return emr.nSize; }
  2838       MoveToEx( dc,  ptl.x, ptl.y, 0 );
  2840 #ifdef ENABLE_EDITING  2844     void edit ( 
void )
 const  2846       printf( 
"*MOVETOEX*\n" );
  2847       edit_pointl( 
"ptl", ptl );
  2864       emr.iType = EMR_LINETO;
  2888     int size ( 
void )
 const { 
return emr.nSize; }
  2897       LineTo( dc,  ptl.x, ptl.y );
  2899 #ifdef ENABLE_EDITING  2903     void edit ( 
void )
 const  2905       printf( 
"*LINETO*\n" );
  2906       edit_pointl( 
"ptl", ptl );
  2928     EMRARC ( INT left, INT top, INT right, INT bottom, INT xstart,
  2929              INT ystart, INT xend, INT yend )
  2931       emr.iType = EMR_ARC;
  2934       rclBox.right = right;
  2935       rclBox.bottom = bottom;
  2937       ptlStart.x = xstart;
  2938       ptlStart.y = ystart;
  2948       ds >> emr >> rclBox >> ptlStart >> ptlEnd;
  2955       ds << emr << rclBox << ptlStart << ptlEnd;
  2961     int size ( 
void )
 const { 
return emr.nSize; }
  2970       Arc( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom,
  2971            ptlStart.x, ptlStart.y, ptlEnd.x, ptlEnd.y );
  2973 #ifdef ENABLE_EDITING  2977     void edit ( 
void )
 const  2979       printf( 
"*ARC*\n" );
  2980       edit_rectl( 
"rclBox\t", rclBox );
  2981       edit_pointl( 
"ptlStart", ptlStart );
  2982       edit_pointl( 
"ptlEnd\t", ptlEnd );
  3004     EMRARCTO ( INT left, INT top, INT right, INT bottom, INT xstart,
  3005              INT ystart, INT xend, INT yend )
  3007       emr.iType = EMR_ARCTO;
  3010       rclBox.right = right;
  3011       rclBox.bottom = bottom;
  3013       ptlStart.x = xstart;
  3014       ptlStart.y = ystart;
  3024       ds >> emr >> rclBox >> ptlStart >> ptlEnd;
  3031       ds << emr << rclBox << ptlStart << ptlEnd;
  3037     int size ( 
void )
 const { 
return emr.nSize; }
  3046       ArcTo( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom,
  3047              ptlStart.x, ptlStart.y, ptlEnd.x, ptlEnd.y );
  3049 #ifdef ENABLE_EDITING  3053     void edit ( 
void )
 const  3055       printf( 
"*ARCTO*\n" );
  3056       edit_rectl( 
"rclBox\t", rclBox );
  3057       edit_pointl( 
"ptlStart", ptlStart );
  3058       edit_pointl( 
"ptlEnd\t", ptlEnd );
  3077       emr.iType = EMR_RECTANGLE;
  3080       rclBox.right = right;
  3081       rclBox.bottom = bottom;
  3090       ds >> emr >> rclBox;
  3097       ds << emr << rclBox;
  3103     int size ( 
void )
 const { 
return emr.nSize; }
  3112       Rectangle( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom );
  3114 #ifdef ENABLE_EDITING  3118     void edit ( 
void )
 const  3120       printf( 
"*RECTANGLE*\n" );
  3121       edit_rectl( 
"rclBox", rclBox );
  3141       emr.iType = EMR_ELLIPSE;
  3144       rclBox.right = right;
  3145       rclBox.bottom = bottom;
  3154       ds >> emr >> rclBox;
  3161       ds << emr << rclBox;
  3167     int size ( 
void )
 const { 
return emr.nSize; }
  3176       Ellipse( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom );
  3178 #ifdef ENABLE_EDITING  3182     void edit ( 
void )
 const  3184       printf( 
"*ELLIPSE*\n" );
  3185       edit_rectl( 
"rclBox", rclBox );
  3208       emr.iType = EMR_POLYLINE;
  3210       emr.nSize = 
sizeof( 
::EMRPOLYLINE ) + 
sizeof( POINTL ) * ( cptl - 1);
  3212       lpoints = 
new POINTL[cptl];
  3214       for (
int i=0; i<n; i++) {
  3215         lpoints[i].x = points[i].x;
  3216         lpoints[i].y = points[i].y;
  3219       rclBounds = *bounds;
  3226       if ( lpoints ) 
delete[] lpoints;
  3234       ds >> emr >> rclBounds >> cptl;
  3236       lpoints = 
new POINTL[cptl];
  3247       ds << emr << rclBounds << cptl << 
POINTLARRAY( lpoints, cptl );
  3253     int size ( 
void )
 const { 
return emr.nSize; }
  3263       Polyline( dc, (POINT*)lpoints, cptl );
  3265 #ifdef ENABLE_EDITING  3269     void edit ( 
void )
 const  3271       printf( 
"*POLYLINE*\n" );
  3272       edit_rectl( 
"rclBounds", rclBounds );
  3274       printf( 
"\tcptl              : %ld\n", cptl );
  3275       printf( 
"\taptl->\n" );
  3276       for ( 
unsigned int i = 0; i < cptl; i++ )
  3277         printf( 
"\t\t%ld, %ld\n", lpoints[i].x, lpoints[i].y );
  3279       edit_pointlarray( 
"\t", cptl, lpoints );
  3303       emr.iType = EMR_POLYLINE16;
  3305       emr.nSize = 
sizeof( 
::EMRPOLYLINE16 ) + 
sizeof( POINT16 ) * ( cpts - 1);
  3307       lpoints = 
new POINT16[cpts];
  3309       for (
int i=0; i<n; i++) {
  3310         lpoints[i].x = points[i].x;
  3311         lpoints[i].y = points[i].y;
  3314       rclBounds = *bounds;
  3328       emr.iType = EMR_POLYLINE16;
  3330       emr.nSize = 
sizeof( 
::EMRPOLYLINE16 ) + 
sizeof( POINT16 ) * ( cpts - 1);
  3332       lpoints = 
new POINT16[cpts];
  3334       for (
int i=0; i<n; i++) {
  3335         lpoints[i].x = points[i].x;
  3336         lpoints[i].y = points[i].y;
  3339       rclBounds = *bounds;
  3346       if ( lpoints ) 
delete[] lpoints;
  3354       ds >> emr >> rclBounds >> cpts;
  3356       lpoints = 
new POINT16[cpts];
  3367       ds << emr << rclBounds << cpts << 
POINT16ARRAY( lpoints, cpts );
  3373     int size ( 
void )
 const { 
return emr.nSize; }
  3383       Polyline16( dc, lpoints, cpts );
  3385 #ifdef ENABLE_EDITING  3389     void edit ( 
void )
 const  3391       printf( 
"*POLYLINE16*\n" );
  3392       edit_rectl( 
"rclBounds", rclBounds );
  3393       edit_point16array( 
"\t", cpts, lpoints );
  3416       emr.iType = EMR_POLYGON;
  3418       emr.nSize = 
sizeof( 
::EMRPOLYGON ) + 
sizeof( POINTL ) * (cptl-1);
  3420       lpoints = 
new POINTL[cptl];
  3422       for (
int i=0; i<n; i++) {
  3423         lpoints[i].x = points[i].x;
  3424         lpoints[i].y = points[i].y;
  3427       rclBounds = *bounds;
  3435       ds >> emr >> rclBounds >> cptl;
  3437       lpoints = 
new POINTL[cptl];
  3448       if ( lpoints ) 
delete[] lpoints;
  3455       ds << emr << rclBounds << cptl << 
POINTLARRAY( lpoints, cptl );
  3461     int size ( 
void )
 const { 
return emr.nSize; }
  3471       Polygon( dc, (POINT*)lpoints, cptl );
  3473 #ifdef ENABLE_EDITING  3477     void edit ( 
void )
 const  3479       printf( 
"*POLYGON*\n" );
  3480       edit_rectl( 
"rclBounds", rclBounds );
  3482       printf( 
"\tcptl              : %ld\n", cptl );
  3483       printf( 
"\taptl->\n" );
  3484       for ( 
unsigned int i = 0; i < cptl; i++ )
  3485         printf( 
"\t\t%ld, %ld\n", lpoints[i].x, lpoints[i].y );
  3487       edit_pointlarray( 
"\t", cptl, lpoints );
  3511       emr.iType = EMR_POLYGON16;
  3513       emr.nSize = 
sizeof( 
::EMRPOLYGON16 ) + 
sizeof( POINT16 ) * (cpts-1);
  3515       lpoints = 
new POINT16[cpts];
  3517       for (
int i=0; i<n; i++) {
  3518         lpoints[i].x = points[i].x;
  3519         lpoints[i].y = points[i].y;
  3522       rclBounds = *bounds;
  3536       emr.iType = EMR_POLYGON16;
  3538       emr.nSize = 
sizeof( 
::EMRPOLYGON16 ) + 
sizeof( POINT16 ) * (cpts-1);
  3540       lpoints = 
new POINT16[cpts];
  3542       for (
int i=0; i<n; i++) {
  3543         lpoints[i].x = points[i].x;
  3544         lpoints[i].y = points[i].y;
  3547       rclBounds = *bounds;
  3555       ds >> emr >> rclBounds >> cpts;
  3557       lpoints = 
new POINT16[cpts];
  3568       if ( lpoints ) 
delete[] lpoints;
  3575       ds << emr << rclBounds << cpts << 
POINT16ARRAY( lpoints, cpts );
  3581     int size ( 
void )
 const { 
return emr.nSize; }
  3591       Polygon16( dc, lpoints, cpts );
  3593 #ifdef ENABLE_EDITING  3597     void edit ( 
void )
 const  3599       printf( 
"*POLYGON16*\n" );
  3600       edit_rectl( 
"rclBounds", rclBounds );
  3601       edit_point16array( 
"\t", cpts, lpoints );
  3626       for ( 
unsigned int i = 0; i < nPolys; i++ )
  3634       emr.iType = EMR_POLYPOLYGON;
  3638         + 
sizeof( DWORD ) * (nPolys-1);
  3640       lcounts = 
new DWORD[nPolys];
  3642       for ( 
unsigned int i = 0; i < nPolys; i++ )
  3643         lcounts[i] = counts[i];
  3645       lpoints = 
new POINTL[cptl];
  3647       for (
int i=0; i<n; i++) {
  3648         lpoints[i].x = points[i].x;
  3649         lpoints[i].y = points[i].y;
  3652       rclBounds = *bounds;
  3659       if ( lcounts ) 
delete[] lcounts;
  3660       if ( lpoints ) 
delete[] lpoints;
  3668       ds >> emr >> rclBounds >> nPolys >> cptl;
  3670       lcounts = 
new DWORD[nPolys];
  3676       lpoints = 
new POINTL[cptl];
  3687       ds << emr << rclBounds << nPolys << cptl << 
DWORDARRAY( lcounts, nPolys )
  3694     int size ( 
void )
 const { 
return emr.nSize; }
  3705       std::vector<INT> countsv( lcounts, lcounts + nPolys );
  3707       PolyPolygon( dc, (POINT*)lpoints, &countsv[0], nPolys );
  3709 #ifdef ENABLE_EDITING  3713     void edit ( 
void )
 const  3715 #if defined(__LP64__)  3716       const char* FMT0 = 
"\tnPolys\t\t: %d\n";
  3717       const char* FMT1 = 
"\tcptl\t\t: %d\n";
  3718       const char* FMT2 = 
"%d\n";
  3719       const char* FMT3 = 
"\t\t\t  %d\n";
  3720       const char* FMT4 = 
"%d, %d\n";
  3721       const char* FMT5 = 
"\t\t\t  %d, %d\n";
  3723       const char* FMT0 = 
"\tnPolys\t\t: %ld\n";
  3724       const char* FMT1 = 
"\tcptl\t\t: %ld\n";
  3725       const char* FMT2 = 
"%ld\n";
  3726       const char* FMT3 = 
"\t\t\t  %ld\n";
  3727       const char* FMT4 = 
"%ld, %ld\n";
  3728       const char* FMT5 = 
"\t\t\t  %ld, %ld\n";
  3730       printf( 
"*POLYPOLYGON*\n" );
  3731       edit_rectl( 
"rclBounds", rclBounds );
  3732       printf( FMT0, nPolys );
  3733       printf( FMT1, cptl );
  3734       printf( 
"\taPolyCounts\t: " );
  3736         printf( FMT2, lcounts[0] );
  3739       for ( 
unsigned int i = 1; i < nPolys; i++ )
  3740         printf( FMT3, lcounts[i] );
  3741       printf( 
"\tapts\t\t: " );
  3743         printf( FMT4, lpoints[0].x, lpoints[0].y );
  3746       for ( 
unsigned int i = 1; i < cptl; i++ )
  3747         printf( FMT5, lpoints[i].x, lpoints[i].y );
  3767                        const INT* counts, UINT polygons )
  3772       for ( 
unsigned int i = 0; i < nPolys; i++ )
  3780       emr.iType = EMR_POLYPOLYGON16;
  3784         + 
sizeof( DWORD ) * (nPolys-1);
  3786       lcounts = 
new DWORD[nPolys];
  3788       for ( 
unsigned int i = 0; i < nPolys; i++ )
  3789         lcounts[i] = counts[i];
  3791       lpoints = 
new POINT16[cpts];
  3793       for (
int i=0; i<n; i++) {
  3794         lpoints[i].x = points[i].x;
  3795         lpoints[i].y = points[i].y;
  3798       rclBounds = *bounds;
  3808                        const INT* counts, UINT16 polygons )
  3813       for ( 
unsigned int i = 0; i < nPolys; i++ )
  3821       emr.iType = EMR_POLYPOLYGON16;
  3825         + 
sizeof( DWORD ) * (nPolys-1);
  3827       lcounts = 
new DWORD[nPolys];
  3829       for ( 
unsigned int i = 0; i < nPolys; i++ )
  3830         lcounts[i] = counts[i];
  3832       lpoints = 
new POINT16[cpts];
  3834       for (
int i=0; i<n; i++) {
  3835         lpoints[i].x = points[i].x;
  3836         lpoints[i].y = points[i].y;
  3839       rclBounds = *bounds;
  3846       if ( lcounts ) 
delete[] lcounts;
  3847       if ( lpoints ) 
delete[] lpoints;
  3855       ds >> emr >> rclBounds >> nPolys >> cpts;
  3857       lcounts = 
new DWORD[nPolys];
  3863       lpoints = 
new POINT16[cpts];
  3874       ds << emr << rclBounds << nPolys << cpts << 
DWORDARRAY( lcounts, nPolys )
  3881     int size ( 
void )
 const { 
return emr.nSize; }
  3892       std::vector<INT> counts( lcounts, lcounts + nPolys );
  3894       PolyPolygon16( dc, lpoints, &counts[0], nPolys );
  3896 #ifdef ENABLE_EDITING  3900     void edit ( 
void )
 const  3902 #if defined(__LP64__)  3903       const char* FMT0 = 
"\tnPolys\t\t: %d\n";
  3904       const char* FMT1 = 
"\tcptl\t\t: %d\n";
  3905       const char* FMT2 = 
"%d\n";
  3906       const char* FMT3 = 
"\t\t\t  %d\n";
  3908       const char* FMT0 = 
"\tnPolys\t\t: %ld\n";
  3909       const char* FMT1 = 
"\tcptl\t\t: %ld\n";
  3910       const char* FMT2 = 
"%ld\n";
  3911       const char* FMT3 = 
"\t\t\t  %ld\n";
  3913       printf( 
"*POLYPOLYGON16*\n" );
  3914       edit_rectl( 
"rclBounds", rclBounds );
  3915       printf( FMT0, nPolys );
  3916       printf( FMT1, cpts );
  3917       printf( 
"\taPolyCounts\t: " );
  3919         printf( FMT2, lcounts[0] );
  3922       for ( 
unsigned int i = 1; i < nPolys; i++ )
  3923         printf( FMT3, lcounts[i] );
  3924       printf( 
"\tapts\t\t: " );
  3926         printf( 
"%d, %d\n", lpoints[0].x, lpoints[0].y );
  3929       for ( 
unsigned int i = 1; i < cpts; i++ )
  3930         printf( 
"\t\t\t  %d, %d\n", lpoints[i].x, lpoints[i].y );
  3953       emr.iType = EMR_POLYBEZIER;
  3957       lpoints = 
new POINTL[cptl];
  3959       for (
int i=0; i<n; i++) {
  3960         lpoints[i].x = points[i].x;
  3961         lpoints[i].y = points[i].y;
  3964       rclBounds = *bounds;
  3972       ds >> emr >> rclBounds >> cptl;
  3974       lpoints = 
new POINTL[cptl];
  3985       if ( lpoints ) 
delete[] lpoints;
  3992       ds << emr << rclBounds << cptl << 
POINTLARRAY( lpoints, cptl );
  3998     int size ( 
void )
 const { 
return emr.nSize; }
  4008       PolyBezier( dc, (POINT*)lpoints, cptl );
  4010 #ifdef ENABLE_EDITING  4014     void edit ( 
void )
 const  4016       printf( 
"*POLYBEZIER*\n" );
  4017       edit_rectl( 
"rclBounds", rclBounds );
  4019       printf( 
"\tcptl              : %ld\n", cptl );
  4020       printf( 
"\taptl->\n" );
  4021       for ( 
unsigned int i = 0; i < cptl; i++ )
  4022         printf( 
"\t\t%ld, %ld\n", lpoints[i].x, lpoints[i].y );
  4024       edit_pointlarray( 
"\t", cptl, lpoints );
  4048       emr.iType = EMR_POLYBEZIER16;
  4052       lpoints = 
new POINT16[cpts];
  4054       for (
int i=0; i<n; i++) {
  4055         lpoints[i].x = points[i].x;
  4056         lpoints[i].y = points[i].y;
  4059       rclBounds = *bounds;
  4073       emr.iType = EMR_POLYBEZIER16;
  4077       lpoints = 
new POINT16[cpts];
  4079       for (
int i=0; i<n; i++) {
  4080         lpoints[i].x = points[i].x;
  4081         lpoints[i].y = points[i].y;
  4084       rclBounds = *bounds;
  4092       ds >> emr >> rclBounds >> cpts;
  4094       lpoints = 
new POINT16[cpts];
  4105       if ( lpoints ) 
delete[] lpoints;
  4112       ds << emr << rclBounds << cpts << 
POINT16ARRAY( lpoints, cpts );
  4118     int size ( 
void )
 const { 
return emr.nSize; }
  4128       PolyBezier16( dc, lpoints, cpts );
  4130 #ifdef ENABLE_EDITING  4134     void edit ( 
void )
 const  4136       printf( 
"*POLYBEZIER16*\n" );
  4137       edit_rectl( 
"rclBounds", rclBounds );
  4138       edit_point16array( 
"\t", cpts, lpoints );
  4161       emr.iType = EMR_POLYBEZIERTO;
  4165       lpoints = 
new POINTL[cptl];
  4167       for (
int i=0; i<n; i++) {
  4168         lpoints[i].x = points[i].x;
  4169         lpoints[i].y = points[i].y;
  4172       rclBounds = *bounds;
  4180       ds >> emr >> rclBounds >> cptl;
  4182       lpoints = 
new POINTL[cptl];
  4193       if ( lpoints ) 
delete[] lpoints;
  4200       ds << emr << rclBounds << cptl << 
POINTLARRAY( lpoints, cptl );
  4206     int size ( 
void )
 const { 
return emr.nSize; }
  4216       PolyBezierTo( dc, (POINT*)lpoints, cptl );
  4218 #ifdef ENABLE_EDITING  4222     void edit ( 
void )
 const  4224       printf( 
"*POLYBEZIERTO*\n" );
  4225       edit_rectl( 
"rclBounds", rclBounds );
  4227       printf( 
"\tcptl              : %ld\n", cptl );
  4228       printf( 
"\taptl->\n" );
  4229       for ( 
unsigned int i = 0; i < cptl; i++ )
  4230         printf( 
"\t\t%ld, %ld\n", lpoints[i].x, lpoints[i].y );
  4232       edit_pointlarray( 
"\t", cptl, lpoints );
  4256       emr.iType = EMR_POLYBEZIERTO16;
  4260       lpoints = 
new POINT16[cpts];
  4262       for (
int i=0; i<n; i++) {
  4263         lpoints[i].x = points[i].x;
  4264         lpoints[i].y = points[i].y;
  4267       rclBounds = *bounds;
  4281       emr.iType = EMR_POLYBEZIERTO16;
  4285       lpoints = 
new POINT16[cpts];
  4287       for (
int i=0; i<n; i++) {
  4288         lpoints[i].x = points[i].x;
  4289         lpoints[i].y = points[i].y;
  4292       rclBounds = *bounds;
  4300       ds >> emr >> rclBounds >> cpts;
  4302       lpoints = 
new POINT16[cpts];
  4313       if ( lpoints ) 
delete[] lpoints;
  4320       ds << emr << rclBounds << cpts << 
POINT16ARRAY( lpoints, cpts );
  4326     int size ( 
void )
 const { 
return emr.nSize; }
  4336       PolyBezierTo16( dc, lpoints, cpts );
  4338 #ifdef ENABLE_EDITING  4342     void edit ( 
void )
 const  4344       printf( 
"*POLYBEZIERTO16*\n" );
  4345       edit_rectl( 
"rclBounds", rclBounds );
  4346       edit_point16array( 
"\t", cpts, lpoints );
  4369       emr.iType = EMR_POLYLINETO;
  4373       lpoints = 
new POINTL[cptl];
  4375       for (
int i=0; i<n; i++) {
  4376         lpoints[i].x = points[i].x;
  4377         lpoints[i].y = points[i].y;
  4380       rclBounds = *bounds;
  4388       ds >> emr >> rclBounds >> cptl;
  4390       lpoints = 
new POINTL[cptl];
  4401       if ( lpoints ) 
delete[] lpoints;
  4408       ds << emr << rclBounds << cptl << 
POINTLARRAY( lpoints, cptl );
  4414     int size ( 
void )
 const { 
return emr.nSize; }
  4424       PolylineTo( dc, (POINT*)lpoints, cptl );
  4426 #ifdef ENABLE_EDITING  4430     void edit ( 
void )
 const  4432       printf( 
"*POLYLINETO*\n" );
  4433       edit_rectl( 
"rclBounds", rclBounds );
  4435       printf( 
"\tcptl              : %ld\n", cptl );
  4436       printf( 
"\taptl->\n" );
  4437       for ( 
unsigned int i = 0; i < cptl; i++ )
  4438         printf( 
"\t\t%ld, %ld\n", lpoints[i].x, lpoints[i].y );
  4440       edit_pointlarray( 
"\t", cptl, lpoints );
  4464       emr.iType = EMR_POLYLINETO16;
  4468       lpoints = 
new POINT16[cpts];
  4470       for (
int i=0; i<n; i++) {
  4471         lpoints[i].x = points[i].x;
  4472         lpoints[i].y = points[i].y;
  4475       rclBounds = *bounds;
  4489       emr.iType = EMR_POLYLINETO16;
  4493       lpoints = 
new POINT16[cpts];
  4495       for (
int i=0; i<n; i++) {
  4496         lpoints[i].x = points[i].x;
  4497         lpoints[i].y = points[i].y;
  4500       rclBounds = *bounds;
  4508       ds >> emr >> rclBounds >> cpts;
  4510       lpoints = 
new POINT16[cpts];
  4521       if ( lpoints ) 
delete[] lpoints;
  4528       ds << emr << rclBounds << cpts << 
POINT16ARRAY( lpoints, cpts );
  4534     int size ( 
void )
 const { 
return emr.nSize; }
  4544       PolylineTo16( dc, lpoints, cpts );
  4546 #ifdef ENABLE_EDITING  4550     void edit ( 
void )
 const  4552       printf( 
"*POLYLINETO16*\n" );
  4553       edit_rectl( 
"rclBounds", rclBounds );
  4554       edit_point16array( 
"\t", cpts, lpoints );
  4581                      FLOAT yScale, 
const PEMRTEXT text, LPCSTR 
string,
  4584       emr.iType = EMR_EXTTEXTOUTA;
  4587       rclBounds = *bounds;
  4589       iGraphicsMode = graphicsMode;
  4595       string_size = ROUND_TO_LONG( emrtext.nChars );
  4597       string_a = 
new CHAR[ string_size ];
  4599       memset( string_a, 0, 
sizeof(CHAR) * string_size );
  4601       for ( 
unsigned int i=0; i<emrtext.nChars; i++ )
  4602         string_a[i] = *
string++;
  4604       emrtext.offString = emr.nSize;
  4605       emr.nSize += string_size * 
sizeof(CHAR);
  4613         int * dxn = 
new  int [string_size];
  4614         for (
unsigned int i=0; i < string_size; i++) dxn[i] = 10;
  4621         dx_i = 
new INT[ emrtext.nChars ];
  4623         for ( 
unsigned int i=0; i<emrtext.nChars; i++ )
  4626         emrtext.offDx = emr.nSize;
  4627         emr.nSize += emrtext.nChars * 
sizeof(INT);
  4640       ds >> emr >> rclBounds >> iGraphicsMode >> exScale >> eyScale >> emrtext;
  4642       if ( emrtext.offString != 0 ) {
  4643         string_size = ROUND_TO_LONG( emrtext.nChars );
  4645         string_a = 
new CHAR[ string_size ];
  4647         memset( string_a, 0, 
sizeof(CHAR) * string_size );
  4649         CHARSTR string( string_a, string_size );
  4656       if ( emrtext.offDx ) {
  4657         dx_i = 
new INT[ emrtext.nChars ];
  4659         INTARRAY dx_is( dx_i, emrtext.nChars );
  4672       if ( string_a ) 
delete[] string_a;
  4673       if ( dx_i ) 
delete[] dx_i;
  4680       ds << emr << rclBounds << iGraphicsMode << exScale << eyScale
  4681          << emrtext << 
CHARSTR( string_a, string_size );
  4683         ds << 
INTARRAY( dx_i, emrtext.nChars );
  4689     int size ( 
void )
 const { 
return emr.nSize; }
  4699       rect.left = emrtext.rcl.left;
  4700       rect.top = emrtext.rcl.top;
  4701       rect.right = emrtext.rcl.right;
  4702       rect.bottom = emrtext.rcl.bottom;
  4704       ExtTextOutA( dc, emrtext.ptlReference.x, emrtext.ptlReference.y,
  4705                    emrtext.fOptions, &rect, string_a, emrtext.nChars,
  4708 #ifdef ENABLE_EDITING  4712     void edit ( 
void )
 const  4714 #if defined(__LP64__)  4715     const char* FMT0 = 
"unknown(%d)\n";
  4716     const char* FMT1 = 
"\tptlReference\t: (%d,%d)\n";
  4717     const char* FMT2 = 
"\tnChars\t\t: %d\n";
  4718     const char* FMT3 = 
"\toffString\t: %d\n";
  4719     const char* FMT4 = 
"\toffDx\t\t: %d\n";
  4721     const char* FMT0 = 
"unknown(%ld)\n";
  4722     const char* FMT1 = 
"\tptlReference\t: (%ld,%ld)\n";
  4723     const char* FMT2 = 
"\tnChars\t\t: %ld\n";
  4724     const char* FMT3 = 
"\toffString\t: %ld\n";
  4725     const char* FMT4 = 
"\toffDx\t\t: %ld\n";
  4727       printf( 
"*EXTTEXTOUTA*\n" );
  4728       edit_rectl( 
"rclBounds", rclBounds );
  4729       printf( 
"\tiGraphicsMode\t: " );
  4730       switch ( iGraphicsMode ) {
  4731       case GM_COMPATIBLE: printf( 
"GM_COMPATIBLE\n" ); 
break;
  4732       case GM_ADVANCED: printf( 
"GM_ADVANCED\n" ); 
break;
  4733       default: printf( FMT0, iGraphicsMode );
  4735       printf( 
"\texScale\t\t: %f\n", exScale );
  4736       printf( 
"\teyScale\t\t: %f\n", eyScale );
  4737       printf( FMT1, emrtext.ptlReference.x, emrtext.ptlReference.y );
  4738       printf( FMT2, emrtext.nChars );
  4739       printf( FMT3, emrtext.offString );
  4740       printf( 
"\tfOptions\t: " );
  4741       if ( emrtext.fOptions == 0 )
  4744         if ( emrtext.fOptions & ETO_GRAYED ) {
  4745           printf( 
"ETO_GRAYED" );
  4746           if ( emrtext.fOptions & ~ETO_GRAYED )
  4749         if ( emrtext.fOptions & ETO_OPAQUE ) {
  4750           printf( 
"ETO_OPAQUE" );
  4751           if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE) )
  4754         if ( emrtext.fOptions & ETO_CLIPPED ) {
  4755           printf( 
"ETO_CLIPPED" );
  4756           if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED ) )
  4759         if ( emrtext.fOptions & ETO_GLYPH_INDEX ) {
  4760           printf( 
"ETO_GLYPH_INDEX" );
  4761           if ( emrtext.fOptions &
  4762                ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX) )
  4765         if ( emrtext.fOptions & ETO_RTLREADING ) {
  4766           printf( 
"ETO_RTLREADING" );
  4767           if ( emrtext.fOptions &
  4768                ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX |
  4772         if ( emrtext.fOptions & ETO_IGNORELANGUAGE )
  4773           printf( 
"ETO_IGNORELANGUAGE" );
  4776       edit_rectl( 
"rcl\t", emrtext.rcl );
  4777       printf( FMT4, emrtext.offDx );
  4778       printf( 
"\tString:\n\t\t%s\n",  string_a );
  4780       if ( emrtext.offDx != 0 ) {
  4781         printf( 
"\tOffsets:\n\t\t" );
  4782         for ( 
unsigned int i = 0; i < emrtext.nChars; i++ )
  4783           printf( 
"%d ", dx_i[i] );
  4811                      FLOAT yScale, 
const PEMRTEXT text, LPCWSTR 
string,
  4814       emr.iType = EMR_EXTTEXTOUTW;
  4817       rclBounds = *bounds;
  4819       iGraphicsMode = graphicsMode;
  4825       string_size = ROUND_TO_LONG( emrtext.nChars );
  4827       string_a = 
new WCHAR[ string_size ];
  4829       memset( string_a, 0, 
sizeof(WCHAR) * string_size );
  4831       for ( 
unsigned int i=0; i<emrtext.nChars; i++ )
  4832         string_a[i] = *
string++;
  4834       emrtext.offString = emr.nSize;
  4835       emr.nSize += string_size * 
sizeof(WCHAR);
  4843         int * dxn = 
new  int [string_size];
  4844         for (
unsigned int i=0; i < string_size; i++) dxn[i] = 10;
  4851         dx_i = 
new INT[ emrtext.nChars ];
  4853         for ( 
unsigned int i=0; i<emrtext.nChars; i++ )
  4856         emrtext.offDx = emr.nSize;
  4857         emr.nSize += emrtext.nChars * 
sizeof(INT);
  4870       ds >> emr >> rclBounds >> iGraphicsMode >> exScale >> eyScale >> emrtext;
  4872       if ( emrtext.offString != 0 ) {
  4873         string_size = ROUND_TO_LONG( emrtext.nChars );
  4875         string_a = 
new WCHAR[ string_size ];
  4877         memset( string_a, 0, 
sizeof(WCHAR) * string_size );
  4879         WCHARSTR string( string_a, string_size );
  4886       if ( emrtext.offDx ) {
  4887         dx_i = 
new INT[ emrtext.nChars ];
  4889         INTARRAY dx_is( dx_i, emrtext.nChars );
  4902       if ( string_a ) 
delete[] string_a;
  4903       if ( dx_i ) 
delete[] dx_i;
  4910       ds << emr << rclBounds << iGraphicsMode << exScale << eyScale
  4911          << emrtext << 
WCHARSTR( string_a, string_size );
  4913         ds << 
INTARRAY( dx_i, emrtext.nChars );
  4919     int size ( 
void )
 const { 
return emr.nSize; }
  4929       rect.left = emrtext.rcl.left;
  4930       rect.top = emrtext.rcl.top;
  4931       rect.right = emrtext.rcl.right;
  4932       rect.bottom = emrtext.rcl.bottom;
  4934       ExtTextOutW( dc, emrtext.ptlReference.x, emrtext.ptlReference.y,
  4935                    emrtext.fOptions, &rect, string_a, emrtext.nChars,
  4938 #ifdef ENABLE_EDITING  4942     void edit ( 
void )
 const  4944 #if defined(__LP64__)  4945     const char* FMT0 = 
"unknown(%d)\n";
  4946     const char* FMT1 = 
"\tptlReference\t: (%d,%d)\n";
  4947     const char* FMT2 = 
"\tnChars\t\t: %d\n";
  4948     const char* FMT3 = 
"\toffString\t: %d\n";
  4949     const char* FMT4 = 
"\toffDx\t\t: %d\n";
  4951     const char* FMT0 = 
"unknown(%ld)\n";
  4952     const char* FMT1 = 
"\tptlReference\t: (%ld,%ld)\n";
  4953     const char* FMT2 = 
"\tnChars\t\t: %ld\n";
  4954     const char* FMT3 = 
"\toffString\t: %ld\n";
  4955     const char* FMT4 = 
"\toffDx\t\t: %ld\n";
  4957       printf( 
"*EXTTEXTOUTA*\n" );
  4958       edit_rectl( 
"rclBounds", rclBounds );
  4959       printf( 
"\tiGraphicsMode\t: " );
  4960       switch ( iGraphicsMode ) {
  4961       case GM_COMPATIBLE: printf( 
"GM_COMPATIBLE\n" ); 
break;
  4962       case GM_ADVANCED: printf( 
"GM_ADVANCED\n" ); 
break;
  4963       default: printf( FMT0, iGraphicsMode );
  4965       printf( 
"\texScale\t\t: %f\n", exScale );
  4966       printf( 
"\teyScale\t\t: %f\n", eyScale );
  4967       printf( FMT1, emrtext.ptlReference.x, emrtext.ptlReference.y );
  4968       printf( FMT2, emrtext.nChars );
  4969       printf( FMT3, emrtext.offString );
  4970       printf( 
"\tfOptions\t: " );
  4971       if ( emrtext.fOptions == 0 )
  4974         if ( emrtext.fOptions & ETO_GRAYED ) {
  4975           printf( 
"ETO_GRAYED" );
  4976           if ( emrtext.fOptions & ~ETO_GRAYED )
  4979         if ( emrtext.fOptions & ETO_OPAQUE ) {
  4980           printf( 
"ETO_OPAQUE" );
  4981           if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE) )
  4984         if ( emrtext.fOptions & ETO_CLIPPED ) {
  4985           printf( 
"ETO_CLIPPED" );
  4986           if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED ) )
  4989         if ( emrtext.fOptions & ETO_GLYPH_INDEX ) {
  4990           printf( 
"ETO_GLYPH_INDEX" );
  4991           if ( emrtext.fOptions &
  4992                ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX) )
  4995         if ( emrtext.fOptions & ETO_RTLREADING ) {
  4996           printf( 
"ETO_RTLREADING" );
  4997           if ( emrtext.fOptions &
  4998                ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX |
  5002         if ( emrtext.fOptions & ETO_IGNORELANGUAGE )
  5003           printf( 
"ETO_IGNORELANGUAGE" );
  5006       edit_rectl( 
"rcl\t", emrtext.rcl );
  5007       printf( FMT4, emrtext.offDx );
  5009       printf( 
"\tString:\n\t\t%s\n",  string_a );
  5013         iconv_t cvt = iconv_open( 
"UTF-8", 
"UTF-16LE" );
  5014         std::vector<char> utf8_buffer( emrtext.nChars );
  5017         size_t size          = emrtext.nChars * 
sizeof(*string_a);
  5018         size_t in_bytes_left = size;
  5019         size_t converted     = 0;
  5020         char*  in_buffer     = (
char*)string_a;
  5022           char* out_buffer      = &utf8_buffer[converted];
  5023           size_t out_bytes_left = size - converted;
  5025           size_t n = iconv( cvt, &in_buffer, &in_bytes_left,
  5026                             &out_buffer, &out_bytes_left );
  5028           converted = size - out_bytes_left;
  5030           if ( n == (
size_t)-1 ) {
  5031             if ( errno == E2BIG ) {
  5032               size_t new_size = 2 * utf8_buffer.size();
  5033               utf8_buffer.resize( new_size );
  5034               size = utf8_buffer.size();
  5048         if ( converted == utf8_buffer.size() )
  5049           utf8_buffer.push_back( 
'\0' );
  5051           utf8_buffer[converted] = 
'\0';
  5053         printf( 
"\tString:\n\t\t%s\n",  &utf8_buffer[0] );
  5056       if ( emrtext.offDx != 0 ) {
  5057         printf( 
"\tOffsets:\n\t\t" );
  5058         for ( 
unsigned int i = 0; i < emrtext.nChars; i++ )
  5059           printf( 
"%d ", dx_i[i] );
  5079       emr.iType = EMR_SETPIXELV;
  5091       ds >> emr >> ptlPixel >> crColor;
  5098       ds << emr << ptlPixel << crColor;
  5104     int size ( 
void )
 const { 
return emr.nSize; }
  5113       SetPixel( dc, ptlPixel.x, ptlPixel.y, crColor );
  5115 #ifdef ENABLE_EDITING  5119     void edit ( 
void )
 const  5121       printf( 
"*SETPIXELV*\n" );
  5122       edit_pointl( 
"ptlPixel", ptlPixel );
  5123       edit_color( 
"crColor\t", crColor );
  5156       ds << emr << ihPen << lopn;
  5162     int size ( 
void )
 const { 
return emr.nSize; }
  5169 #ifdef ENABLE_EDITING  5173     void edit ( 
void )
 const  5175 #if defined(__LP64__)  5176       const char* FMT0 = 
"\tihPen\t\t: 0x%x\n";
  5177       const char* FMT1 = 
"\tlopn.lopnWidth\t: %d, %d\n";
  5179       const char* FMT0 = 
"\tihPen\t\t: 0x%lx\n";
  5180       const char* FMT1 = 
"\tlopn.lopnWidth\t: %ld, %ld\n";
  5182       printf( 
"*CREATEPEN*\n" );
  5183       printf( FMT0, ihPen );
  5184       edit_pen_style( 
"lopn.lopnStyle", lopn.lopnStyle );
  5185       printf( FMT1, lopn.lopnWidth.x, lopn.lopnWidth.y );
  5186       edit_color( 
"lopn.lopnColor", lopn.lopnColor );
  5214       ds << emr << ihPen << offBmi << cbBmi << offBits << cbBits << elp;
  5220     int size ( 
void )
 const { 
return emr.nSize; }
  5227 #ifdef ENABLE_EDITING  5231     void edit ( 
void )
 const  5233 #if defined(__LP64__)  5234       const char* FMT0 = 
"\tihPen\t\t\t: 0x%x\n";
  5235       const char* FMT1 = 
"\toffBmi\t\t\t: %d\n";
  5236       const char* FMT2 = 
"\tcbBmi\t\t\t: %d\n";
  5237       const char* FMT3 = 
"\toffBits\t\t\t: %d\n";
  5238       const char* FMT4 = 
"\tcbBits\t\t\t: %d\n";
  5239       const char* FMT5 = 
"\telp.elpWidth\t\t: %d\n";
  5240       const char* FMT6 = 
"\telp.elpNumEntries\t: %d\n";
  5242       const char* FMT0 = 
"\tihPen\t\t\t: 0x%lx\n";
  5243       const char* FMT1 = 
"\toffBmi\t\t\t: %ld\n";
  5244       const char* FMT2 = 
"\tcbBmi\t\t\t: %ld\n";
  5245       const char* FMT3 = 
"\toffBits\t\t\t: %ld\n";
  5246       const char* FMT4 = 
"\tcbBits\t\t\t: %ld\n";
  5247       const char* FMT5 = 
"\telp.elpWidth\t\t: %ld\n";
  5248       const char* FMT6 = 
"\telp.elpNumEntries\t: %ld\n";
  5250       printf( 
"*EXTCREATEPEN*\n" );
  5251       printf( FMT0, ihPen );
  5252       printf( FMT1,  offBmi );
  5253       printf( FMT2, cbBmi );
  5254       printf( FMT3, offBits );
  5255       printf( FMT4, cbBits );
  5256       edit_pen_style( 
"elp.elpPenStyle\t", elp.elpPenStyle );
  5257       printf( FMT5, elp.elpWidth );
  5258       edit_brush_style( 
"elp.elpBrushStyle", elp.elpBrushStyle );
  5259       edit_color( 
"elp.elpColor\t", elp.elpColor );
  5260       edit_brush_hatch( 
"elp.elpHatch\t", elp.elpHatch );
  5261       printf( FMT6, elp.elpNumEntries );
  5288       ds << emr << ihBrush << lb;
  5294     int size ( 
void )
 const { 
return emr.nSize; }
  5301 #ifdef ENABLE_EDITING  5305     void edit ( 
void )
 const  5307 #if defined(__LP64__)  5308       const char* FMT = 
"\tihBrush\t\t: 0x%x\n";
  5310       const char* FMT = 
"\tihBrush\t\t: 0x%lx\n";
  5312       printf( 
"*CREATEBRUSHINDIRECT*\n" );
  5313       printf( FMT, ihBrush );
  5314       edit_brush_style( 
"lb.lbStyle", lb.lbStyle );
  5315       edit_color( 
"lb.lbColor", lb.lbColor );
  5316       edit_brush_hatch( 
"lb.lbHatch", lb.lbHatch );
  5347       ds << emr << ihFont << elfw << 
PADDING( 2 );
  5354     int size ( 
void )
 const { 
return emr.nSize; }
  5361 #ifdef ENABLE_EDITING  5365     void edit ( 
void )
 const  5367 #if defined(__LP64__)  5368       const char* FMT0 = 
"\tihFont\t\t\t: %d\n";
  5369       const char* FMT1 = 
"\tlfHeight\t\t: %d\n";
  5370       const char* FMT2 = 
"\tlfWidth\t\t\t: %d\n";
  5371       const char* FMT3 = 
"\tlfEscapement\t\t: %d\n";
  5372       const char* FMT4 = 
"\tlfOrientation\t\t: %d\n";
  5373       const char* FMT5 = 
"\telfVersion\t\t: %d\n";
  5374       const char* FMT6 = 
"\telfStyleSize\t\t: %d\n";
  5375       const char* FMT7 = 
"\telfMatch\t\t: %d\n";
  5376       const char* FMT8 = 
"\telfCulture\t\t: %d\n";
  5378       const char* FMT0 = 
"\tihFont\t\t\t: %ld\n";
  5379       const char* FMT1 = 
"\tlfHeight\t\t: %ld\n";
  5380       const char* FMT2 = 
"\tlfWidth\t\t\t: %ld\n";
  5381       const char* FMT3 = 
"\tlfEscapement\t\t: %ld\n";
  5382       const char* FMT4 = 
"\tlfOrientation\t\t: %ld\n";
  5383       const char* FMT5 = 
"\telfVersion\t\t: %ld\n";
  5384       const char* FMT6 = 
"\telfStyleSize\t\t: %ld\n";
  5385       const char* FMT7 = 
"\telfMatch\t\t: %ld\n";
  5386       const char* FMT8 = 
"\telfCulture\t\t: %ld\n";
  5388       printf( 
"*EXTCREATEFONTINDIRECTW*\n" );
  5389       printf( FMT0, ihFont );
  5390       printf( FMT1, elfw.elfLogFont.lfHeight );
  5391       printf( FMT2, elfw.elfLogFont.lfWidth );
  5392       printf( FMT3, elfw.elfLogFont.lfEscapement );
  5393       printf( FMT4, elfw.elfLogFont.lfOrientation );
  5394       printf( 
"\tlfWeight\t\t: " );
  5395       switch ( elfw.elfLogFont.lfWeight ) {
  5396       case FW_DONTCARE: printf( 
"FW_DONTCARE\n" ); 
break;
  5397       case FW_THIN: printf( 
"FW_THIN\n" ); 
break;
  5398       case FW_EXTRALIGHT: printf( 
"FW_EXTRALIGHT\n" ); 
break;
  5399       case FW_LIGHT: printf( 
"FW_LIGHT\n" ); 
break;
  5400       case FW_NORMAL: printf( 
"FW_NORMAL\n" ); 
break;
  5401       case FW_MEDIUM: printf( 
"FW_MEDIUM\n" ); 
break;
  5402       case FW_SEMIBOLD: printf( 
"FW_SEMIBOLD\n" ); 
break;
  5403       case FW_BOLD: printf( 
"FW_BOLD\n" ); 
break;
  5404       case FW_EXTRABOLD: printf( 
"FW_EXTRABOLD\n" ); 
break;
  5405       case FW_BLACK: printf( 
"FW_BLACK\n" ); 
break;
  5407       printf( 
"\tlfItalic\t\t: %d\n", elfw.elfLogFont.lfItalic );
  5408       printf( 
"\tlfUnderline\t\t: %d\n", elfw.elfLogFont.lfUnderline );
  5409       printf( 
"\tlfStrikeOut\t\t: %d\n", elfw.elfLogFont.lfStrikeOut );
  5410       printf( 
"\tlfCharSet\t\t: %d\n", elfw.elfLogFont.lfCharSet );
  5411       printf( 
"\tlfOutPrecision\t\t: %d\n", elfw.elfLogFont.lfOutPrecision );
  5412       printf( 
"\tlfClipPrecision\t\t: %d\n", elfw.elfLogFont.lfClipPrecision );
  5413       printf( 
"\tlfQuality\t\t: %d\n", elfw.elfLogFont.lfQuality );
  5414       printf( 
"\tlfPitchAndFamily\t: %d\n", elfw.elfLogFont.lfPitchAndFamily );
  5416       printf( 
"\tlfFaceName\t\t: '" );
  5417       while ( elfw.elfLogFont.lfFaceName[i] != 0 && i < LF_FACESIZE ) {
  5418         putchar( elfw.elfLogFont.lfFaceName[i] );
  5424       printf( 
"\telfFullName\t\t: '" );
  5425       while ( elfw.elfFullName[i] != 0 && i < LF_FULLFACESIZE ) {
  5426         putchar( elfw.elfFullName[i] );
  5432       printf( 
"\telfStyle\t\t: '" );
  5433       while ( elfw.elfStyle[i] != 0 && i < LF_FACESIZE ) {
  5434         putchar( elfw.elfStyle[i] );
  5439       printf( FMT5, elfw.elfVersion );
  5440       printf( FMT6, elfw.elfStyleSize );
  5441       printf( FMT7, elfw.elfMatch );
  5442       printf( 
"\telfVendorId\t\t: '%s'\n", elfw.elfVendorId );
  5443       printf( FMT8, elfw.elfCulture );
  5444       printf( 
"\telfPanose\t\t:\n" );
  5445       printf( 
"\t\tbFamilyType\t\t: %d\n", elfw.elfPanose.bFamilyType );
  5446       printf( 
"\t\tbSerifStyle\t\t: %d\n", elfw.elfPanose.bSerifStyle );
  5447       printf( 
"\t\tbWeight\t\t\t: %d\n", elfw.elfPanose.bWeight );
  5448       printf( 
"\t\tbProportion\t\t: %d\n", elfw.elfPanose.bProportion );
  5449       printf( 
"\t\tbContrast\t\t: %d\n", elfw.elfPanose.bContrast );
  5450       printf( 
"\t\tbStrokeVariation\t: %d\n", elfw.elfPanose.bStrokeVariation );
  5451       printf( 
"\t\tbArmStyle\t\t: %d\n", elfw.elfPanose.bArmStyle );
  5452       printf( 
"\t\tbLetterform\t\t: %d\n", elfw.elfPanose.bLetterform );
  5453       printf( 
"\t\tbMidline\t\t: %d\n", elfw.elfPanose.bMidline );
  5454       printf( 
"\t\tbXHeight\t\t: %d\n", elfw.elfPanose.bXHeight );
  5481       ds << emr << ihPal << lgpl;
  5487     int size ( 
void )
 const { 
return emr.nSize; }
  5494 #ifdef ENABLE_EDITING  5498     void edit ( 
void )
 const  5500       printf( 
"*CREATEPALETTE* (not really handled by libEMF)\n" );
  5516       emr.iType = EMR_FILLPATH;
  5518       rclBounds = *bounds;
  5526       ds >> emr >> rclBounds;
  5533       ds << emr << rclBounds;
  5539     int size ( 
void )
 const { 
return emr.nSize; }
  5550 #ifdef ENABLE_EDITING  5554     void edit ( 
void )
 const  5556       printf( 
"*FILLPATH*\n" );
  5557       edit_rectl( 
"rclBounds", rclBounds );
  5572       emr.iType = EMR_STROKEPATH;
  5574       rclBounds = *bounds;
  5582       ds >> emr >> rclBounds;
  5589       ds << emr << rclBounds;
  5595     int size ( 
void )
 const { 
return emr.nSize; }
  5606 #ifdef ENABLE_EDITING  5610     void edit ( 
void )
 const  5612       printf( 
"*STROKEPATH*\n" );
  5613       edit_rectl( 
"rclBounds", rclBounds );
  5628       emr.iType = EMR_STROKEANDFILLPATH;
  5630       rclBounds = *bounds;
  5638       ds >> emr >> rclBounds;
  5645       ds << emr << rclBounds;
  5651     int size ( 
void )
 const { 
return emr.nSize; }
  5660       StrokeAndFillPath( dc );
  5662 #ifdef ENABLE_EDITING  5666     void edit ( 
void )
 const  5668       printf( 
"*STROKEANDFILLPATH*\n" );
  5669       edit_rectl( 
"rclBounds", rclBounds );
  5684       emr.iType = EMR_BEGINPATH;
  5706     int size ( 
void )
 const { 
return emr.nSize; }
  5717 #ifdef ENABLE_EDITING  5721     void edit ( 
void )
 const  5723       printf( 
"*BEGINPATH*\n" );
  5738       emr.iType = EMR_ENDPATH;
  5760     int size ( 
void )
 const { 
return emr.nSize; }
  5771 #ifdef ENABLE_EDITING  5775     void edit ( 
void )
 const  5777       printf( 
"*ENDPATH*\n" );
  5792       emr.iType = EMR_CLOSEFIGURE;
  5814     int size ( 
void )
 const { 
return emr.nSize; }
  5825 #ifdef ENABLE_EDITING  5829     void edit ( 
void )
 const  5831       printf( 
"*CLOSEFIGURE*\n" );
  5847       emr.iType = EMR_SAVEDC;
  5869     int size ( 
void )
 const { 
return emr.nSize; }
  5880 #ifdef ENABLE_EDITING  5884     void edit ( 
void )
 const  5886       printf( 
"*SAVEDC*\n" );
  5901       emr.iType = EMR_RESTOREDC;
  5911       ds >> emr >> iRelative;
  5918       ds << emr << iRelative;
  5924     int size ( 
void )
 const { 
return emr.nSize; }
  5933       RestoreDC( dc, iRelative );
  5935 #ifdef ENABLE_EDITING  5939     void edit ( 
void )
 const  5941 #if defined(__LP64__)  5942       const char* FMT = 
"\tiRelative: %d\n";
  5944       const char* FMT = 
"\tiRelative: %ld\n";
  5946       printf( 
"*RESTOREDC*\n" );
  5947       printf( FMT, iRelative );
  5962       emr.iType = EMR_SETMETARGN;
  5984     int size ( 
void )
 const { 
return emr.nSize; }
  5995 #ifdef ENABLE_EDITING  5999     void edit ( 
void )
 const  6001       printf( 
"*SETMETARGN*\n" );
  6017       lopnStyle = lpen->lopnStyle;
  6018       lopnWidth = lpen->lopnWidth;
  6019       lopnColor = lpen->lopnColor;
  6024     OBJECTTYPE 
getType ( 
void )
 const { 
return O_PEN; }
  6033       contexts[dc] = emf_handle;
  6049       elpPenStyle = lpen->elpPenStyle;
  6050       elpWidth = lpen->elpWidth;
  6051       elpBrushStyle = lpen->elpBrushStyle;
  6052       elpColor = lpen->elpColor;
  6053       elpHatch = lpen->elpHatch;
  6055       elpStyleEntry[0] = 0;
  6060     OBJECTTYPE 
getType ( 
void )
 const { 
return O_EXTPEN; }
  6069       contexts[dc] = emf_handle;
  6085       lbStyle = lbrush->lbStyle;
  6086       lbColor = lbrush->lbColor;
  6087       lbHatch = lbrush->lbHatch;
  6092     OBJECTTYPE 
getType ( 
void )
 const { 
return O_BRUSH; }
  6101       contexts[dc] = emf_handle;
  6117       this->elfLogFont = *lfont;
  6120       memset( &elfFullName, 0, 
sizeof elfFullName );
  6121       memset( &elfStyle, 0, 
sizeof elfStyle );
  6122       elfVersion = ELF_VERSION;
  6126       memset( &elfVendorId, 0, 
sizeof elfVendorId );
  6127       elfCulture = ELF_CULTURE_LATIN;
  6128       memset( &elfPanose, 1, 
sizeof(PANOSE) );
  6133     OBJECTTYPE 
getType ( 
void )
 const { 
return O_FONT; }
  6142       contexts[dc] = emf_handle;
  6158       EMF_UNUSED(lpalette);
  6161       PALETTEENTRY zero_entry = { 0, 0, 0, 0 };
  6162       palPalEntry[0] = zero_entry;
  6167     OBJECTTYPE 
getType ( 
void )
 const { 
return O_PALETTE; }
  6176       contexts[dc] = emf_handle;
  6192       emr.iType = EMR_SETMITERLIMIT;
  6194       eMiterLimit = limit;
  6203        ds >> emr >> miter_limit;
  6204        eMiterLimit = float(miter_limit);
  6211        ds << emr << (int)eMiterLimit;
  6217     int size ( 
void )
 const { 
return emr.nSize; }
  6226       SetMiterLimit( dc, eMiterLimit, 0 );
  6228 #ifdef ENABLE_EDITING  6232     void edit ( 
void )
 const  6234       printf( 
"*SETMITERLIMIT*\n" );
  6235       printf( 
"\teMiterLimit\t: %f\n", eMiterLimit );
  6255     void init ( 
const RECT* size, LPCWSTR description_w ) {
  6260       handles.push_back( 
true );
  6265       records.push_back( header );
  6270         update_frame = 
false;
  6272         header->rclFrame.left = size->left;
  6273         header->rclFrame.top = size->top;
  6274         header->rclFrame.right = size->right;
  6275         header->rclFrame.bottom = size->bottom;
  6277         header->rclBounds.left =
  6278           size->left * header->szlDevice.cx / ( header->szlMillimeters.cx * 100 );
  6279         header->rclBounds.top =
  6280           size->top * header->szlDevice.cy / ( header->szlMillimeters.cy * 100 );
  6281         header->rclBounds.right =
  6282           size->right * header->szlDevice.cx / ( header->szlMillimeters.cx * 100 );
  6283         header->rclBounds.bottom =
  6284           size->bottom * header->szlDevice.cy / ( header->szlMillimeters.cy * 100 );
  6287         update_frame = 
true;
  6289         header->rclBounds.left = -10;
  6290         header->rclBounds.top = -10;
  6291         header->rclBounds.right = 10;
  6292         header->rclBounds.bottom = 10;
  6294         header->rclFrame.left = (LONG)floor( (
float)header->rclBounds.left *
  6295           header->szlMillimeters.cx * 100 / header->szlDevice.cx );
  6296         header->rclFrame.top = (LONG)floor( (
float)header->rclBounds.top *
  6297           header->szlMillimeters.cy * 100 / header->szlDevice.cy );
  6298         header->rclFrame.right = (LONG)ceil( (
float)header->rclBounds.right *
  6299           header->szlMillimeters.cx * 100 / header->szlDevice.cx );
  6300         header->rclFrame.bottom = (LONG)ceil( (
float)header->rclBounds.bottom *
  6301           header->szlMillimeters.cy * 100 / header->szlDevice.cy );
  6306       SIZEL default_resolution = { RESOLUTION, RESOLUTION };
  6307       resolution = default_resolution;
  6308       SIZEL default_viewport_ext = { 1, 1 };
  6309       viewport_ext = default_viewport_ext;
  6310       POINT default_viewport_org = { 0, 0 };
  6311       viewport_org = default_viewport_org;
  6312       SIZEL default_window_ext = { 1, 1 };
  6313       window_ext = default_window_ext;
  6314       POINT default_window_org = { 0, 0 };
  6315       window_org = default_window_org;
  6317       min_device_point = viewport_org;
  6318       max_device_point = viewport_org;
  6320       pen = (
PEN*)globalObjects.
find( BLACK_PEN | ENHMETA_STOCK_OBJECT );
  6321       brush = (
BRUSH*)globalObjects.
find( BLACK_BRUSH | ENHMETA_STOCK_OBJECT );
  6322       font = (
FONT*)globalObjects.
find( DEVICE_DEFAULT_FONT | ENHMETA_STOCK_OBJECT);
  6323       palette = (
PALETTE*)globalObjects.
find( DEFAULT_PALETTE|ENHMETA_STOCK_OBJECT);
  6325       text_alignment = TA_BASELINE;
  6326       text_color = RGB(0,0,0);
  6327       bk_color = RGB(0xff,0xff,0xff);
  6329       polyfill_mode = ALTERNATE;
  6333       handle = globalObjects.
add( 
this );
  6402                               LPCWSTR description_w )
  6403         : fp(fp_), ds( fp_ )
  6405           init( size, description_w );
  6415       if ( records.size() > 0 )
  6421     OBJECTTYPE 
getType ( 
void )
 const { 
return O_METAFILEDEVICECONTEXT; }
  6428       for ( 
unsigned int i = 1; i < handles.size(); i++ ) {
  6429         if ( !handles[i] ) {
  6434       handles.push_back( 
true );
  6437       header->nHandles = handles.
size();
  6438       return handles.size()-1;
  6445       handles[handle] = 
false;
  6454       records.push_back( record );
  6456       header->nBytes += record->
size();
  6466       records.push_back( record );
  6468       header->nBytes += record->
size();
  6477       for ( std::vector<METARECORD*>::const_iterator r = records.begin();
  6506       device_point.x = (LONG)( (
float)( p.x - window_org.x ) / window_ext.cx *
  6507         viewport_ext.cx + viewport_org.x );
  6509       device_point.y = (LONG)( (
float)( p.y - window_org.y ) / window_ext.cy *
  6510         viewport_ext.cy + viewport_org.y );
  6514       if ( device_point.x < min_device_point.x ) {
  6515         min_device_point.x = device_point.x;
  6516         if ( update_frame ) {
  6517           header->rclBounds.left = min_device_point.x - 10;
  6518           header->rclFrame.left = (LONG)floor( (
float)header->rclBounds.left *
  6519             header->szlMillimeters.cx * 100 / header->szlDevice.cx );
  6522       else if ( device_point.x > max_device_point.x ) {
  6523         max_device_point.x = device_point.x;
  6524         if ( update_frame ) {
  6525           header->rclBounds.right = max_device_point.x + 10;
  6526           header->rclFrame.right = (LONG)ceil( (
float)header->rclBounds.right *
  6527             header->szlMillimeters.cx * 100 / header->szlDevice.cx );
  6531       if ( device_point.y < min_device_point.y ) {
  6532         min_device_point.y = device_point.y;
  6533         if ( update_frame ) {
  6534           header->rclBounds.top = min_device_point.y - 10;
  6535           header->rclFrame.top = (LONG)floor( (
float)header->rclBounds.top *
  6536             header->szlMillimeters.cy * 100 / header->szlDevice.cy );
  6539       else if ( device_point.y > max_device_point.y ) {
  6540         max_device_point.y = device_point.y;
  6541         if ( update_frame ) {
  6542           header->rclBounds.bottom = max_device_point.y + 10;
  6543           header->rclFrame.bottom = (LONG)ceil( (
float)header->rclBounds.bottom *
  6544             header->szlMillimeters.cy * 100 / header->szlDevice.cy );
 ~EMRPOLYLINE16()
Definition: libemf.h:3344
int size(void) const 
Definition: libemf.h:1767
bool serialize(DATASTREAM ds)
Definition: libemf.h:4318
bool serialize(DATASTREAM ds)
Definition: libemf.h:4678
int size(void) const 
Definition: libemf.h:3998
bool serialize(DATASTREAM ds)
Definition: libemf.h:5212
bool serialize(DATASTREAM ds)
Definition: libemf.h:4406
int size(void) const 
Definition: libemf.h:4414
bool serialize(DATASTREAM ds)
Definition: libemf.h:5341
EMF Line To. 
Definition: libemf.h:2856
EMRSETBKCOLOR(DATASTREAM &ds)
Definition: libemf.h:2430
void mergePoint(const POINT &p)
Definition: libemf.h:6499
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:4004
EMRSCALEWINDOWEXTEX(LONG x_num, LONG x_den, LONG y_num, LONG y_den)
Definition: libemf.h:2068
EMF End of File Record. 
Definition: libemf.h:1672
EMRENDPATH(void)
Definition: libemf.h:5736
int size(void) const 
Definition: libemf.h:3581
EMF Set Background Color. 
Definition: libemf.h:2415
EMREXTTEXTOUTW(const RECTL *bounds, DWORD graphicsMode, FLOAT xScale, FLOAT yScale, const PEMRTEXT text, LPCWSTR string, const INT *dx)
Definition: libemf.h:4810
EMRARCTO(DATASTREAM &ds)
Definition: libemf.h:3022
FONT(const LOGFONTW *lfont)
Definition: libemf.h:6115
int size(void) const 
Definition: libemf.h:2711
EMRPOLYLINE16(DATASTREAM &ds)
Definition: libemf.h:3352
EMF PolyBezierTo16. 
Definition: libemf.h:4242
COLORREF text_color
The current text foreground color. 
Definition: libemf.h:6370
EMRPOLYBEZIERTO16(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4275
~EMRPOLYBEZIERTO()
Definition: libemf.h:4191
bool serialize(DATASTREAM ds)
Definition: libemf.h:3159
int size(void) const 
Definition: libemf.h:4326
EMRSETVIEWPORTORGEX(DATASTREAM &ds)
Definition: libemf.h:1752
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:5601
~EMRPOLYBEZIER()
Definition: libemf.h:3983
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6067
EMRARC(INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
Definition: libemf.h:2928
EMF Fill path. 
Definition: libemf.h:5509
EMRSTROKEANDFILLPATH(const RECTL *bounds)
Definition: libemf.h:5626
bool serialize(DATASTREAM ds)
Definition: libemf.h:5096
EMRSETBKCOLOR(COLORREF color)
Definition: libemf.h:2420
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:4420
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:2451
int size(void) const 
Definition: libemf.h:2302
Represent an array of points in a simple way. 
Definition: libemf.h:140
EMRELLIPSE(DATASTREAM &ds)
Definition: libemf.h:3152
EMRELLIPSE(INT left, INT top, INT right, INT bottom)
Definition: libemf.h:3139
EMF Extended Text Output Wide character. 
Definition: libemf.h:4795
Represent a byte array in a simple way. 
Definition: libemf.h:124
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:1897
A global graphics object. 
Definition: libemf.h:1255
EMRPOLYGON(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:3410
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:3109
OBJECTTYPE getType(void) const 
Definition: libemf.h:6133
int size(void) const 
Definition: libemf.h:1830
EMRSETWINDOWEXTEX(INT cx, INT cy)
Definition: libemf.h:2005
EMRPOLYLINETO(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4363
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:5545
All metafile records must be padded out to a multiple of 4 bytes. 
Definition: libemf.h:204
bool serialize(DATASTREAM ds)
Definition: libemf.h:2380
bool serialize(DATASTREAM ds)
Definition: libemf.h:3095
EMRPOLYLINE16(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:3322
EMF Stroke and Fill path. 
Definition: libemf.h:5621
EMF Scale Viewport Extents (ex) 
Definition: libemf.h:1920
EMRSCALEVIEWPORTEXTEX(DATASTREAM &ds)
Definition: libemf.h:1941
bool update_frame
Update the frame automatically? 
Definition: libemf.h:6361
EMRPOLYBEZIERTO(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4155
int size(void) const 
Definition: libemf.h:5651
EMF Set Text Color. 
Definition: libemf.h:2358
bool serialize(DATASTREAM ds)
Definition: libemf.h:5861
EMRDELETEOBJECT(HGDIOBJ object)
Definition: libemf.h:2744
EMF Rectangle. 
Definition: libemf.h:3067
EMRMOVETOEX(INT x, INT y)
Definition: libemf.h:2803
virtual ~GRAPHICSOBJECT()
GRAPHICSOBJECTs has a virtual destructor. 
Definition: libemf.h:1258
bool serialize(DATASTREAM ds)
Definition: libemf.h:5286
EMRLINETO(DATASTREAM &ds)
Definition: libemf.h:2873
Graphics Brush. 
Definition: libemf.h:6078
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:1836
EMREOF(void)
Definition: libemf.h:1677
EMF Poly Polygon. 
Definition: libemf.h:3610
EMRARC(DATASTREAM &ds)
Definition: libemf.h:2946
Represent a wide (UNICODE) character string in a simple way. 
Definition: libemf.h:89
void appendHandle(METARECORD *record)
Definition: libemf.h:6464
FONT * font
The current font. 
Definition: libemf.h:6367
EMRPOLYGON16(const RECTL *bounds, const POINT *points, INT16 n)
Definition: libemf.h:3505
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:5110
EMF Polybezier. 
Definition: libemf.h:3939
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:4540
bool serialize(DATASTREAM ds)
Definition: libemf.h:4110
EMREXTTEXTOUTW(DATASTREAM &ds)
Definition: libemf.h:4868
bool serialize(DATASTREAM ds)
Definition: libemf.h:5479
EMRDELETEOBJECT(DATASTREAM &ds)
Definition: libemf.h:2754
int size(void) const 
Definition: libemf.h:5354
int size(void) const 
Definition: libemf.h:1956
bool serialize(DATASTREAM ds)
Definition: libemf.h:5698
int size(void) const 
Definition: libemf.h:3103
EMF Stroke path. 
Definition: libemf.h:5565
int size(void) const 
Definition: libemf.h:1706
EMRMOVETOEX(DATASTREAM &ds)
Definition: libemf.h:2814
EMF MoveTo (ex) 
Definition: libemf.h:2797
EMRPOLYPOLYGON16(const RECTL *bounds, const POINT16 *points, const INT *counts, UINT16 polygons)
Definition: libemf.h:3807
OBJECTTYPE getType(void) const 
Definition: libemf.h:6024
int size(void) const 
Definition: libemf.h:3461
EMF Set Window Extent (ex) 
Definition: libemf.h:1999
EMF SetMiterLimit. 
Definition: libemf.h:6185
EXTPEN(const EXTLOGPEN *lpen)
Definition: libemf.h:6047
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:4212
int size(void) const 
Definition: libemf.h:3253
DWORD nextHandle(void)
Definition: libemf.h:6426
EMF Poly Polygon16. 
Definition: libemf.h:3756
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:2644
POINT window_org
The origin of the window. 
Definition: libemf.h:6360
EMRPOLYBEZIER16(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4067
INT bk_mode
The current background mode. 
Definition: libemf.h:6372
EMRSETTEXTALIGN(DATASTREAM &ds)
Definition: libemf.h:2287
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:6223
int size(void) const 
Definition: libemf.h:4689
EMREOF(DATASTREAM &ds)
Definition: libemf.h:1690
int size(void) const 
Definition: libemf.h:3167
static const char padding_[4]
Pad with '\0's. 
Definition: libemf.h:205
int size(void) const 
Definition: libemf.h:5706
Represent an array of integers in a simple way. 
Definition: libemf.h:172
virtual ~METAFILEDEVICECONTEXT()
Definition: libemf.h:6411
EMF Restore DC. 
Definition: libemf.h:5894
EMF Pen. 
Definition: libemf.h:5138
std::vector< EMF::OBJECT * >::const_iterator end(void) const 
Definition: libemf.h:1307
EMRPOLYGON(DATASTREAM &ds)
Definition: libemf.h:3433
EMF Set Text Alignment. 
Definition: libemf.h:2272
int size(void) const 
Definition: libemf.h:2829
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:5875
EMF Save DC. 
Definition: libemf.h:5840
OBJECT(void)
Definition: libemf.h:1242
int size(void) const 
Definition: libemf.h:3881
std::map< HDC, HGDIOBJ > contexts
Definition: libemf.h:1263
~EMRPOLYLINE()
Definition: libemf.h:3224
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:1773
bool serialize(DATASTREAM ds)
Definition: libemf.h:3872
void deleteMetafile(void)
Definition: libemf.h:6475
int size(void) const 
Definition: libemf.h:2503
bool serialize(DATASTREAM ds)
Definition: libemf.h:2630
bool serialize(DATASTREAM ds)
Definition: libemf.h:2562
bool serialize(DATASTREAM ds)
Definition: libemf.h:3365
EMRPOLYLINE(DATASTREAM &ds)
Definition: libemf.h:3232
EMRSETBKMODE(DATASTREAM &ds)
Definition: libemf.h:2488
int size(void) const 
Definition: libemf.h:2769
bool serialize(DATASTREAM ds)
Definition: libemf.h:3245
int size(void) const 
Definition: libemf.h:2031
EMRPOLYBEZIER(DATASTREAM &ds)
Definition: libemf.h:3970
EMRPOLYLINETO16(const RECTL *bounds, const POINT16 *points, INT n)
Definition: libemf.h:4458
POINT point
The current point. 
Definition: libemf.h:6364
bool serialize(DATASTREAM ds)
Definition: libemf.h:5531
bool serialize(DATASTREAM ds)
Definition: libemf.h:2703
const DWORD n_
Number of POINTLs in array. 
Definition: libemf.h:142
EMRSETVIEWPORTORGEX(INT x, INT y)
Definition: libemf.h:1741
int size(void) const 
Definition: libemf.h:3037
EMRPOLYBEZIERTO16(const RECTL *bounds, const POINT16 *points, INT n)
Definition: libemf.h:4250
EMF Begin Path. 
Definition: libemf.h:5677
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:2894
~EMREXTTEXTOUTW()
Definition: libemf.h:4900
BRUSH * brush
The current brush. 
Definition: libemf.h:6366
int size(void) const 
Definition: libemf.h:5869
Global GDI object. 
Definition: libemf.h:1233
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:2037
Represent an array of double word integers in a simple way. 
Definition: libemf.h:188
~EMRPOLYLINETO()
Definition: libemf.h:4399
PEN(const LOGPEN *lpen)
Definition: libemf.h:6015
void mergePoint(const LONG &x, const LONG &y)
Definition: libemf.h:6488
UINT text_alignment
The current text alignment. 
Definition: libemf.h:6369
int size(void) const 
Definition: libemf.h:5487
Extended Graphics Pen. 
Definition: libemf.h:6042
EMRBEGINPATH(DATASTREAM &ds)
Definition: libemf.h:5691
EMRSTROKEPATH(const RECTL *bounds)
Definition: libemf.h:5570
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:1712
Graphics Font. 
Definition: libemf.h:6110
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:3259
EMF Set Window Origin (ex) 
Definition: libemf.h:1798
EMRSETBKMODE(DWORD mode)
Definition: libemf.h:2478
DWORD *const dwords_
Array of double words. 
Definition: libemf.h:189
EMRSETTEXTCOLOR(DATASTREAM &ds)
Definition: libemf.h:2373
EMF Extended Pen. 
Definition: libemf.h:5196
~EMRPOLYBEZIER16()
Definition: libemf.h:4103
int size(void) const 
Definition: libemf.h:2570
EMRSCALEVIEWPORTEXTEX(LONG x_num, LONG x_den, LONG y_num, LONG y_den)
Definition: libemf.h:1928
EMRSETPOLYFILLMODE(DWORD mode)
Definition: libemf.h:2545
EMRRESTOREDC(DATASTREAM &ds)
Definition: libemf.h:5909
CHARSTR(CHAR *const string, const int length)
Definition: libemf.h:115
EMRSETVIEWPORTEXTEX(DATASTREAM &ds)
Definition: libemf.h:1876
bool serialize(DATASTREAM ds)
Definition: libemf.h:5752
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:3587
~EMRPOLYPOLYGON()
Definition: libemf.h:3657
EMRFILLPATH(DATASTREAM &ds)
Definition: libemf.h:5524
EMF PolylineTo. 
Definition: libemf.h:4355
EMF Set Viewport Origin (ex) 
Definition: libemf.h:1735
OBJECT * find(const HGDIOBJ handle)
Definition: libemf.cpp:213
int size(void) const 
Definition: libemf.h:6217
bool serialize(DATASTREAM ds)
Definition: libemf.h:3990
const int length_
Number of WCHARs in string. 
Definition: libemf.h:91
POINTLARRAY(POINTL *const points, const DWORD n)
Definition: libemf.h:148
int size(void) const 
Definition: libemf.h:3694
::FILE * fp
Definition: libemf.h:6340
EMRRECTANGLE(INT left, INT top, INT right, INT bottom)
Definition: libemf.h:3075
EMRPOLYPOLYGON16(const RECTL *bounds, const POINT *points, const INT *counts, UINT polygons)
Definition: libemf.h:3766
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:3700
POINT viewport_org
The origin of the viewport. 
Definition: libemf.h:6358
INT polyfill_mode
The current polygon fill mode. 
Definition: libemf.h:6373
std::map< HGDIOBJ, HGDIOBJ > emf_handles
Definition: libemf.h:6389
int size(void) const 
Definition: libemf.h:2888
~EMRPOLYPOLYGON16()
Definition: libemf.h:3844
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:2835
void clearHandle(DWORD handle)
Definition: libemf.h:6443
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:5930
PEN * pen
The current pen. 
Definition: libemf.h:6365
FLOAT miter_limit
The current miter length limit. 
Definition: libemf.h:6375
POINT min_device_point
The lft/top-most painted point in device units. 
Definition: libemf.h:6362
EMF Set Viewport Extents (ex) 
Definition: libemf.h:1859
bool serialize(DATASTREAM ds)
Definition: libemf.h:1759
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:3173
EMRPOLYLINE16(const RECTL *bounds, const POINT16 *points, INT n)
Definition: libemf.h:3297
const int length_
Number of single byte characers in array. 
Definition: libemf.h:109
bool serialize(DATASTREAM ds)
Definition: libemf.h:5643
bool serialize(DATASTREAM ds)
Definition: libemf.h:6209
COLORREF bk_color
The current background color. 
Definition: libemf.h:6371
bool serialize(DATASTREAM ds)
Definition: libemf.h:2437
Represent an ASCII character string in a simple way. 
Definition: libemf.h:107
EMRSETPOLYFILLMODE(DATASTREAM &ds)
Definition: libemf.h:2555
EMF Arc To. 
Definition: libemf.h:2991
EMREXTTEXTOUTA(DATASTREAM &ds)
Definition: libemf.h:4638
Represent an array of 16-bit point in a simple way. 
Definition: libemf.h:156
std::vector< EMF::OBJECT * >::const_iterator begin(void) const 
Definition: libemf.h:1302
METAFILEDEVICECONTEXT(FILE *fp_, const RECT *size, LPCWSTR description_w)
Definition: libemf.h:6401
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:3043
EMF Ellipse. 
Definition: libemf.h:3130
void appendRecord(METARECORD *record)
Definition: libemf.h:6452
PADDING(const int size)
Definition: libemf.h:211
int size(void) const 
Definition: libemf.h:5760
EMRSETPIXELV(INT x, INT y, COLORREF color)
Definition: libemf.h:5077
int size(void) const 
Definition: libemf.h:1891
bool serialize(DATASTREAM ds)
Definition: libemf.h:3029
std::vector< EMF::METARECORD * > records
Definition: libemf.h:6353
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:3379
EMF Set Mapping Mode. 
Definition: libemf.h:2608
EMRSAVEDC(DATASTREAM &ds)
Definition: libemf.h:5854
EMRSETMAPMODE(DWORD mode)
Definition: libemf.h:2613
POINT max_device_point
The rgt/btm-most painted point in device units. 
Definition: libemf.h:6363
EMRPOLYLINETO16(DATASTREAM &ds)
Definition: libemf.h:4506
~EMRPOLYBEZIERTO16()
Definition: libemf.h:4311
EMRSTROKEPATH(DATASTREAM &ds)
Definition: libemf.h:5580
EMRSTROKEANDFILLPATH(DATASTREAM &ds)
Definition: libemf.h:5636
int size(void) const 
Definition: libemf.h:4534
~EMRPOLYLINETO16()
Definition: libemf.h:4519
~EMRPOLYGON()
Definition: libemf.h:3446
bool serialize(DATASTREAM ds)
Definition: libemf.h:2495
EMRPOLYPOLYGON(const RECTL *bounds, const POINT *points, const INT *counts, UINT polygons)
Definition: libemf.h:3620
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:4695
PALETTE * palette
The current palette. 
Definition: libemf.h:6368
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:1962
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6031
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:4034
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6099
int size(void) const 
Definition: libemf.h:5539
EMRPOLYBEZIER(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:3947
int size(void) const 
Definition: libemf.h:5162
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:2394
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:3467
int size(void) const 
Definition: libemf.h:4206
DATASTREAM ds
Definition: libemf.h:6345
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:2967
EMRPOLYGON16(DATASTREAM &ds)
Definition: libemf.h:3553
int size(void) const 
Definition: libemf.h:2445
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6174
EMRSETPIXELV(DATASTREAM &ds)
Definition: libemf.h:5089
HGDIOBJ handle
Definition: libemf.h:1235
EMRPOLYPOLYGON(DATASTREAM &ds)
Definition: libemf.h:3666
EMRPOLYBEZIERTO(DATASTREAM &ds)
Definition: libemf.h:4178
bool serialize(DATASTREAM ds)
Definition: libemf.h:2088
EMRSELECTOBJECT(DATASTREAM &ds)
Definition: libemf.h:2696
const DWORD n_
Number of double words in array. 
Definition: libemf.h:190
EMRSELECTOBJECT(HGDIOBJ object)
Definition: libemf.h:2686
EMRSETTEXTCOLOR(COLORREF color)
Definition: libemf.h:2363
~EMRPOLYGON16()
Definition: libemf.h:3566
OBJECTTYPE getType(void) const 
Definition: libemf.h:6167
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6140
EMF Set the Polygon Fill Mode. 
Definition: libemf.h:2540
EMF PolylineTo16. 
Definition: libemf.h:4450
BYTE *const array_
Array of unsigned bytes. 
Definition: libemf.h:125
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:5712
Definition: libemf.cpp:26
EMF Palette. 
Definition: libemf.h:5463
Support different endian modes when reading and writing the metafile. 
Definition: libemf.h:222
bool serialize(DATASTREAM ds)
Definition: libemf.h:1883
EMRPOLYLINETO16(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4483
bool serialize(DATASTREAM ds)
Definition: libemf.h:2023
SIZEL window_ext
The extent of the window. 
Definition: libemf.h:6359
bool serialize(DATASTREAM ds)
Definition: libemf.h:2953
int size(void) const 
Definition: libemf.h:4919
EMF Set Background Mode. 
Definition: libemf.h:2473
EMRARCTO(INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
Definition: libemf.h:3004
bool serialize(DATASTREAM ds)
Definition: libemf.h:5154
bool serialize(DATASTREAM ds)
Definition: libemf.h:5587
EMRPOLYBEZIER16(const RECTL *bounds, const POINT16 *points, INT n)
Definition: libemf.h:4042
OBJECTTYPE getType(void) const 
Definition: libemf.h:6092
DWORDARRAY(DWORD *const dwords, const DWORD n)
Definition: libemf.h:196
int size(void) const 
Definition: libemf.h:4118
bool serialize(DATASTREAM ds)
Definition: libemf.h:3573
SIZEL viewport_ext
The extent of the viewport. 
Definition: libemf.h:6357
const int n_
Number of bytes in array. 
Definition: libemf.h:126
EMRSETWINDOWEXTEX(DATASTREAM &ds)
Definition: libemf.h:2016
EMRPOLYPOLYGON16(DATASTREAM &ds)
Definition: libemf.h:3853
int size(void) const 
Definition: libemf.h:3373
WCHAR *const string_
String of WCHARs. 
Definition: libemf.h:90
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:4124
EMRPOLYGON16(const RECTL *bounds, const POINT16 *points, INT16 n)
Definition: libemf.h:3530
INT *const ints_
Array of ints. 
Definition: libemf.h:173
EMRRESTOREDC(INT n)
Definition: libemf.h:5899
EMF Polyline. 
Definition: libemf.h:3194
INTARRAY(INT *const ints, const DWORD n)
Definition: libemf.h:180
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:5657
BYTEARRAY(BYTE *const array, const int n)
Definition: libemf.h:132
Graphics Device Context. 
Definition: libemf.h:6247
EMRENDPATH(DATASTREAM &ds)
Definition: libemf.h:5745
int size(void) const 
Definition: libemf.h:5220
EMF Extended Text Output ASCII. 
Definition: libemf.h:4565
const DWORD n_
Number of POINT16s in array. 
Definition: libemf.h:158
Graphics Pen. 
Definition: libemf.h:6010
EMRLINETO(INT x, INT y)
Definition: libemf.h:2862
int size(void) const 
Definition: libemf.h:2096
EMRSETMITERLIMIT(FLOAT limit)
Definition: libemf.h:6190
bool serialize(DATASTREAM ds)
Definition: libemf.h:1698
int size(void) const 
Definition: libemf.h:5924
int size(void) const 
Definition: libemf.h:2638
EMRRECTANGLE(DATASTREAM &ds)
Definition: libemf.h:3088
bool serialize(DATASTREAM ds)
Definition: libemf.h:1948
bool serialize(DATASTREAM ds)
Definition: libemf.h:4198
EMRSETMAPMODE(DATASTREAM &ds)
Definition: libemf.h:2623
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:2576
bool serialize(DATASTREAM ds)
Definition: libemf.h:2880
~EMREXTTEXTOUTA()
Definition: libemf.h:4670
bool serialize(DATASTREAM ds)
Definition: libemf.h:3453
EMRSCALEWINDOWEXTEX(DATASTREAM &ds)
Definition: libemf.h:2081
bool serialize(DATASTREAM ds)
Definition: libemf.h:3685
EMF Scale Window Extents (ex) 
Definition: libemf.h:2060
EMF Polyline16. 
Definition: libemf.h:3289
EMRBEGINPATH(void)
Definition: libemf.h:5682
SIZEL resolution
The resolution in DPI of the reference DC. 
Definition: libemf.h:6356
EMRSETVIEWPORTEXTEX(INT cx, INT cy)
Definition: libemf.h:1865
BRUSH(const LOGBRUSH *lbrush)
Definition: libemf.h:6083
INT map_mode
The current mapping mode. 
Definition: libemf.h:6374
POINTL *const points_
Array of POINTLs. 
Definition: libemf.h:141
EMF Font. 
Definition: libemf.h:5325
OBJECTTYPE getType(void) const 
Definition: libemf.h:6421
EMF Select Object. 
Definition: libemf.h:2681
bool serialize(DATASTREAM ds)
Definition: libemf.h:2761
OBJECTTYPE getType(void) const 
Definition: libemf.h:6060
EMRSAVEDC(void)
Definition: libemf.h:5845
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:4332
int size(void) const 
Definition: libemf.h:5595
EMF Arc. 
Definition: libemf.h:2915
EMRPOLYLINETO(DATASTREAM &ds)
Definition: libemf.h:4386
EMRSETTEXTALIGN(UINT mode)
Definition: libemf.h:2277
int size(void) const 
Definition: libemf.h:2388
bool serialize(DATASTREAM ds)
Definition: libemf.h:5916
bool serialize(DATASTREAM ds)
Definition: libemf.h:1822
EMF Set Pixel. 
Definition: libemf.h:5070
int size(void) const 
Definition: libemf.h:5104
DATASTREAM(::FILE *fp=0)
Definition: libemf.h:233
EMF Filled Polygon16. 
Definition: libemf.h:3497
EMRPOLYBEZIERTO16(DATASTREAM &ds)
Definition: libemf.h:4298
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:2509
WCHARSTR(WCHAR *const string, const int length)
Definition: libemf.h:97
EMRPOLYLINE(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:3202
EMF Filled Polygon. 
Definition: libemf.h:3402
EMF PolyBezierTo. 
Definition: libemf.h:4147
Definition: libemf.h:1278
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:4925
EMF Brush. 
Definition: libemf.h:5270
EMRFILLPATH(const RECTL *bounds)
Definition: libemf.h:5514
EMRPOLYBEZIER16(DATASTREAM &ds)
Definition: libemf.h:4090
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:5766
EMREXTTEXTOUTA(const RECTL *bounds, DWORD graphicsMode, FLOAT xScale, FLOAT yScale, const PEMRTEXT text, LPCSTR string, const INT *dx)
Definition: libemf.h:4580
bool serialize(DATASTREAM ds)
Definition: libemf.h:4908
void setStream(::FILE *fp)
Definition: libemf.h:238
const DWORD n_
Number of ints in array. 
Definition: libemf.h:174
int size(void) const 
Definition: libemf.h:5294
EMRSETMITERLIMIT(DATASTREAM &ds)
Definition: libemf.h:6200
EMF Delete Object. 
Definition: libemf.h:2739
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:2308
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:3887
bool serialize(DATASTREAM ds)
Definition: libemf.h:4526
EMRSETWINDOWORGEX(DATASTREAM &ds)
Definition: libemf.h:1815
EMRSETWINDOWORGEX(INT x, INT y)
Definition: libemf.h:1804
bool serialize(DATASTREAM ds)
Definition: libemf.h:2821
ENHMETAHEADER * header
Definition: libemf.h:6349
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const 
Definition: libemf.h:2102
HGDIOBJ add(OBJECT *object)
Definition: libemf.cpp:180
std::vector< bool > handles
Definition: libemf.h:6382
EMF End Path. 
Definition: libemf.h:5731
int size(void) const 
Definition: libemf.h:2961
bool serialize(DATASTREAM ds)
Definition: libemf.h:2294
PALETTE(const LOGPALETTE *lpalette)
Definition: libemf.h:6156
Graphics Palette. 
Definition: libemf.h:6151