33 #include <libEMF/emf.h>
35 #include <libEMF/wine/w16.h>
42 #define EMF_UNUSED(x) (void)x;
50 const int XMAX_PIXELS = 1024;
52 const int XMAX_PIXELS = 1280;
59 const int YMAX_PIXELS = 768;
61 const int YMAX_PIXELS = 1024;
68 const int XMAX_MM = 320;
74 const int YMAX_MM = 240;
78 const int RESOLUTION = 96;
82 static inline DWORD ROUND_TO_LONG ( DWORD n ) {
return ((n+3)/4)*4; }
84 static bool bigEndian (
void );
118 CHARSTR ( CHAR *
const string,
const int length )
234 DATASTREAM ( ::FILE* fp = 0 ) : swap_( bigEndian() ), fp_( fp ) {}
246 fwrite( &
byte,
sizeof(BYTE), 1, fp_ );
255 fread( &
byte,
sizeof(BYTE), 1, fp_ );
265 unsigned char const * p = (
unsigned char const*)&word;
266 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
267 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
270 fwrite( &word,
sizeof(WORD), 1, fp_ );
280 unsigned char* p = (
unsigned char*)&word;
281 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
282 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
285 fread( &word,
sizeof(WORD), 1, fp_ );
295 unsigned char const * p = (
unsigned char const*)&word;
296 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
297 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
300 fwrite( &word,
sizeof(INT16), 1, fp_ );
310 unsigned char* p = (
unsigned char*)&word;
311 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
312 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
315 fread( &word,
sizeof(INT16), 1, fp_ );
325 unsigned char const* p = (
unsigned char const*)&dword;
326 fwrite( &p[3],
sizeof(
unsigned char), 1, fp_ );
327 fwrite( &p[2],
sizeof(
unsigned char), 1, fp_ );
328 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
329 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
332 fwrite( &dword,
sizeof(DWORD), 1, fp_ );
342 unsigned char* p = (
unsigned char*)&dword;
343 fread( &p[3],
sizeof(
unsigned char), 1, fp_ );
344 fread( &p[2],
sizeof(
unsigned char), 1, fp_ );
345 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
346 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
349 fread( &dword,
sizeof(DWORD), 1, fp_ );
352 #if !defined( __LP64__ )
360 unsigned char const* p = (
unsigned char const*)&long_;
361 fwrite( &p[3],
sizeof(
unsigned char), 1, fp_ );
362 fwrite( &p[2],
sizeof(
unsigned char), 1, fp_ );
363 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
364 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
367 fwrite( &long_,
sizeof(LONG), 1, fp_ );
377 unsigned char* p = (
unsigned char*)&long_;
378 fread( &p[3],
sizeof(
unsigned char), 1, fp_ );
379 fread( &p[2],
sizeof(
unsigned char), 1, fp_ );
380 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
381 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
384 fread( &long_,
sizeof(LONG), 1, fp_ );
395 unsigned char const* p = (
unsigned char const*)&int_;
396 fwrite( &p[3],
sizeof(
unsigned char), 1, fp_ );
397 fwrite( &p[2],
sizeof(
unsigned char), 1, fp_ );
398 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
399 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
402 fwrite( &int_,
sizeof(INT), 1, fp_ );
412 unsigned char* p = (
unsigned char*)&int_;
413 fread( &p[3],
sizeof(
unsigned char), 1, fp_ );
414 fread( &p[2],
sizeof(
unsigned char), 1, fp_ );
415 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
416 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
419 fread( &int_,
sizeof(INT), 1, fp_ );
422 #if !defined(__LP64__)
430 unsigned char const* p = (
unsigned char const*)&uint;
431 fwrite( &p[3],
sizeof(
unsigned char), 1, fp_ );
432 fwrite( &p[2],
sizeof(
unsigned char), 1, fp_ );
433 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
434 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
437 fwrite( &uint,
sizeof(UINT), 1, fp_ );
447 unsigned char* p = (
unsigned char*)&uint;
448 fread( &p[3],
sizeof(
unsigned char), 1, fp_ );
449 fread( &p[2],
sizeof(
unsigned char), 1, fp_ );
450 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
451 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
454 fread( &uint,
sizeof(UINT), 1, fp_ );
465 unsigned char const* p = (
unsigned char const*)&float_;
466 fwrite( &p[3],
sizeof(
unsigned char), 1, fp_ );
467 fwrite( &p[2],
sizeof(
unsigned char), 1, fp_ );
468 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
469 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
472 fwrite( &float_,
sizeof(FLOAT), 1, fp_ );
482 unsigned char* p = (
unsigned char*)&float_;
483 fread( &p[3],
sizeof(
unsigned char), 1, fp_ );
484 fread( &p[2],
sizeof(
unsigned char), 1, fp_ );
485 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
486 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
489 fread( &float_,
sizeof(FLOAT), 1, fp_ );
498 if ( padding.
size_ != 0 )
499 fwrite( &padding.
padding_,
sizeof(CHAR), padding.
size_, fp_ );
508 *
this << rectl.left << rectl.top << rectl.right << rectl.bottom;
517 *
this >> rectl.left >> rectl.top >> rectl.right >> rectl.bottom;
526 *
this << sizel.cx << sizel.cy;
535 *
this >> sizel.cx >> sizel.cy;
544 for (
int i = 0; i < wcharstr.
length_; i++ )
554 for (
int i = 0; i < wcharstr.
length_; i++ )
582 *
this << emr.iType << emr.nSize;
591 *
this >> emr.iType >> emr.nSize;
600 *
this << point.x << point.y;
609 *
this >> point.x >> point.y;
618 *
this << pointl.x << pointl.y;
627 *
this >> pointl.x >> pointl.y;
636 *
this << point.x << point.y;
645 *
this >> point.x >> point.y;
654 *
this << xform.eM11 << xform.eM12 << xform.eM21 << xform.eM22
655 << xform.eDx << xform.eDy;
664 *
this >> xform.eM11 >> xform.eM12 >> xform.eM21 >> xform.eM22
665 >> xform.eDx >> xform.eDy;
674 fwrite( array.
array_,
sizeof(BYTE), array.
n_, fp_ );
683 fread( array.
array_,
sizeof(BYTE), array.
n_, fp_ );
692 for (
unsigned int i = 0; i < array.
n_; i++ )
702 for (
unsigned int i = 0; i < array.
n_; i++ )
712 for (
unsigned int i = 0; i < array.
n_; i++ )
722 for (
unsigned int i = 0; i < array.
n_; i++ )
732 for (
unsigned int i = 0; i < array.
n_; i++ )
733 *
this << array.
ints_[i];
742 for (
unsigned int i = 0; i < array.
n_; i++ )
743 *
this >> array.
ints_[i];
752 for (
unsigned int i = 0; i < array.
n_; i++ )
762 for (
unsigned int i = 0; i < array.
n_; i++ )
772 *
this << text.ptlReference << text.nChars << text.offString << text.fOptions
773 << text.rcl << text.offDx;
782 *
this >> text.ptlReference >> text.nChars >> text.offString >> text.fOptions
783 >> text.rcl >> text.offDx;
792 *
this << pen.lopnStyle << pen.lopnWidth << pen.lopnColor;
801 *
this >> pen.lopnStyle >> pen.lopnWidth >> pen.lopnColor;
811 *
this << pen.elpPenStyle << pen.elpWidth << pen.elpBrushStyle << pen.elpColor
812 << pen.elpHatch << pen.elpNumEntries;
822 *
this >> pen.elpPenStyle >> pen.elpWidth >> pen.elpBrushStyle >> pen.elpColor
823 >> pen.elpHatch >> pen.elpNumEntries;
832 *
this << brush.lbStyle << brush.lbColor << brush.lbHatch;
841 *
this >> brush.lbStyle >> brush.lbColor >> brush.lbHatch;
850 *
this << font.lfHeight << font.lfWidth << font.lfEscapement
851 << font.lfOrientation << font.lfWeight << font.lfItalic
852 << font.lfUnderline << font.lfStrikeOut << font.lfCharSet
853 << font.lfOutPrecision << font.lfClipPrecision << font.lfQuality
854 << font.lfPitchAndFamily
855 <<
WCHARSTR(
const_cast<WCHAR*
>(font.lfFaceName), LF_FACESIZE );
864 WCHARSTR wFaceName( font.lfFaceName, LF_FACESIZE );
866 *
this >> font.lfHeight >> font.lfWidth >> font.lfEscapement
867 >> font.lfOrientation >> font.lfWeight >> font.lfItalic
868 >> font.lfUnderline >> font.lfStrikeOut >> font.lfCharSet
869 >> font.lfOutPrecision >> font.lfClipPrecision >> font.lfQuality
870 >> font.lfPitchAndFamily
880 fwrite( &panose,
sizeof(PANOSE), 1, fp_ );
889 fread( &panose,
sizeof(PANOSE), 1, fp_ );
898 *
this << font.elfLogFont
899 <<
WCHARSTR(
const_cast<WCHAR*
>(font.elfFullName),
901 <<
WCHARSTR(
const_cast<WCHAR*
>(font.elfStyle), LF_FACESIZE )
902 << font.elfVersion << font.elfStyleSize << font.elfMatch
904 <<
BYTEARRAY(
const_cast<BYTE*
>(font.elfVendorId),
906 << font.elfCulture << font.elfPanose;
915 WCHARSTR wFullName( font.elfFullName, LF_FULLFACESIZE );
916 WCHARSTR wStyle( font.elfStyle, LF_FACESIZE );
917 BYTEARRAY bVendorId( font.elfVendorId, ELF_VENDOR_SIZE );
918 *
this >> font.elfLogFont
919 >> wFullName >> wStyle
920 >> font.elfVersion >> font.elfStyleSize >> font.elfMatch
921 >> font.elfReserved >> bVendorId
922 >> font.elfCulture >> font.elfPanose;
932 *
this << palette.palVersion << palette.palNumEntries;
942 *
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 throw std::runtime_error(
"Premature EOF on EMF stream" );
971 void fwrite (
const void* ptr,
size_t size,
size_t nmemb, FILE* stream )
973 size_t res = ::fwrite( ptr, size, nmemb, stream );
975 throw std::runtime_error(
"error writing EMF stream" );
980 class METAFILEDEVICECONTEXT;
1010 virtual int size (
void )
const = 0;
1017 #ifdef ENABLE_EDITING
1022 virtual void edit (
void )
const {}
1026 #ifdef ENABLE_EDITING
1028 inline void edit_rectl (
const char* tag,
const RECTL& rectl )
1030 #if defined(__LP64__)
1031 const char* FMT =
"\t%s\t: (%d, %d) - (%d, %d)\n";
1033 const char* FMT =
"\t%s\t: (%ld, %ld) - (%ld, %ld)\n";
1035 printf( FMT, tag, rectl.left, rectl.top, rectl.right, rectl.bottom );
1038 inline void edit_xform (
const char* tag,
const XFORM& xform )
1040 printf(
"\t%s.eM11\t: %f\n", tag, xform.eM11 );
1041 printf(
"\t%s.eM12\t: %f\n", tag, xform.eM12 );
1042 printf(
"\t%s.eM21\t: %f\n", tag, xform.eM21 );
1043 printf(
"\t%s.eM22\t: %f\n", tag, xform.eM22 );
1044 printf(
"\t%s.eDx\t: %f\n", tag, xform.eDx );
1045 printf(
"\t%s.eDy\t: %f\n", tag, xform.eDy );
1048 inline void edit_color (
const char* tag,
const COLORREF& color )
1050 #if defined(__LP64__)
1051 const char* FMT =
"\t%s\t: R(0x%02x) G(0x%02x) B(0x%02x)\n";
1053 const char* FMT =
"\t%s\t: R(0x%02lx) G(0x%02lx) B(0x%02lx)\n";
1056 GetRValue( color ), GetGValue( color ), GetBValue( color ) );
1059 inline void edit_sizel (
const char* tag,
const SIZEL& size )
1061 #if defined(__LP64__)
1062 const char* FMT =
"\t%s\t: (%d, %d)\n";
1064 const char* FMT =
"\t%s\t: (%ld, %ld)\n";
1066 printf( FMT, tag, size.cx, size.cy );
1069 inline void edit_pointl (
const char* tag,
const POINTL& point )
1071 #if defined(__LP64__)
1072 const char* FMT =
"\t%s\t: (%d, %d)\n";
1074 const char* FMT =
"\t%s\t: (%ld, %ld)\n";
1076 printf( FMT, tag, point.x, point.y );
1079 inline void edit_pointlarray (
const char* tag,
const DWORD cptl,
1080 const POINTL* points )
1082 #if defined(__LP64__)
1083 const char* FMT0 =
"\tcptl%s\t: %d\n";
1084 const char* FMT1 =
"%d, %d\n";
1085 const char* FMT2 =
"\t\t%s %d, %d\n";
1087 const char* FMT0 =
"\tcptl%s\t: %ld\n";
1088 const char* FMT1 =
"%ld, %ld\n";
1089 const char* FMT2 =
"\t\t%s %ld, %ld\n";
1091 printf( FMT0, tag, cptl );
1092 printf(
"\taptl%s\t: ", tag );
1094 printf( FMT1, points[0].x, points[0].y );
1097 for ( DWORD i = 1; i < cptl; i++ )
1098 printf( FMT2, tag, points[i].x, points[i].y );
1101 inline void edit_point16array (
const char* tag,
const unsigned int cpts,
1102 const POINT16* points )
1104 printf(
"\tcpts%s\t: %d\n", tag, cpts );
1105 printf(
"\tapts%s\t: ", tag );
1107 printf(
"%d, %d\n", points[0].x, points[0].y );
1110 for (
unsigned int i = 1; i < cpts; i++ )
1111 printf(
"\t\t%s %d, %d\n", tag, points[i].x, points[i].y );
1114 inline void edit_pen_style (
const char* tag, DWORD style )
1116 printf(
"\t%s\t: ", tag );
1117 switch ( style & PS_STYLE_MASK ) {
1118 case PS_SOLID: printf(
"PS_SOLID" );
break;
1119 case PS_DASH: printf(
"PS_DASH" );
break;
1120 case PS_DOT: printf(
"PS_DOT" );
break;
1121 case PS_DASHDOT: printf(
"PS_DASHDOT" );
break;
1122 case PS_DASHDOTDOT: printf(
"PS_DASHDOTDOT" );
break;
1123 case PS_NULL: printf(
"PS_NULL" );
break;
1124 case PS_INSIDEFRAME: printf(
"PS_INSIDEFRAME" );
break;
1125 case PS_USERSTYLE: printf(
"PS_USERSTYLE" );
break;
1126 case PS_ALTERNATE: printf(
"PS_ALTERNATE" );
break;
1128 switch ( style & PS_ENDCAP_MASK ) {
1129 case PS_ENDCAP_ROUND: printf(
" | PS_ENDCAP_ROUND" );
break;
1130 case PS_ENDCAP_SQUARE: printf(
" | PS_ENDCAP_SQUARE" );
break;
1131 case PS_ENDCAP_FLAT: printf(
" | PS_ENDCAP_FLAT" );
break;
1133 switch ( style & PS_JOIN_MASK ) {
1134 case PS_JOIN_ROUND: printf(
" | PS_JOIN_ROUND" );
break;
1135 case PS_JOIN_BEVEL: printf(
" | PS_JOIN_BEVEL" );
break;
1136 case PS_JOIN_MITER: printf(
" | PS_JOIN_MITER" );
break;
1138 switch ( style & PS_TYPE_MASK ) {
1139 case PS_COSMETIC: printf(
" | PS_COSMETIC" );
break;
1140 case PS_GEOMETRIC: printf(
" | PS_GEOMETRIC" );
break;
1145 inline void edit_brush_style (
const char* tag, DWORD style )
1147 #if defined(__LP64__)
1148 const char* FMT =
"unknown(%d)";
1150 const char* FMT =
"unknown(%ld)";
1152 printf(
"\t%s\t: ", tag );
1154 case BS_SOLID: printf(
"BS_SOLID" );
break;
1155 case BS_NULL: printf(
"BS_NULL" );
break;
1156 case BS_HATCHED: printf(
"BS_HATCHED" );
break;
1157 case BS_PATTERN: printf(
"BS_PATTERN" );
break;
1158 case BS_INDEXED: printf(
"BS_INDEXED" );
break;
1159 case BS_DIBPATTERN: printf(
"BS_DIBPATTERN" );
break;
1160 case BS_DIBPATTERNPT: printf(
"BS_DIBPATTERNPT" );
break;
1161 case BS_PATTERN8X8: printf(
"BS_PATTERN8X8" );
break;
1162 case BS_DIBPATTERN8X8: printf(
"BS_DIBPATTERN8X8" );
break;
1163 case BS_MONOPATTERN: printf(
"BS_DIBPATTERN8X8" );
break;
1164 default: printf( FMT, style );
1169 inline void edit_brush_hatch (
const char* tag, DWORD hatch )
1171 #if defined(__LP64__)
1172 const char* FMT =
"unknown(%d)";
1174 const char* FMT =
"unknown(%ld)";
1176 printf(
"\t%s\t: ", tag );
1178 case HS_HORIZONTAL: printf(
"HS_HORIZONTAL" );
break;
1179 case HS_VERTICAL: printf(
"HS_VERTICAL" );
break;
1180 case HS_FDIAGONAL: printf(
"HS_FDIAGONAL" );
break;
1181 case HS_BDIAGONAL: printf(
"HS_BDIAGONAL" );
break;
1182 case HS_CROSS: printf(
"HS_CROSS" );
break;
1183 case HS_DIAGCROSS: printf(
"HS_DIAGCROSS" );
break;
1184 default: printf( FMT, hatch );
1196 enum OBJECTTYPE { O_METAFILEDEVICECONTEXT = OBJ_METADC,
1199 O_EXTPEN = OBJ_EXTPEN,
1200 O_BRUSH = OBJ_BRUSH,
1201 O_PALETTE = OBJ_PAL };
1206 static char* typStr ( OBJECTTYPE type )
1209 case O_METAFILEDEVICECONTEXT:
1210 return "metafile device context";
1216 return "extended pen";
1222 return "unknown object";
1280 std::vector<OBJECT*> objects;
1288 std::map< DWORD, METARECORDCTOR > new_records;
1300 auto begin (
void )
const {
return objects.begin(); }
1305 auto end (
void )
const {
return objects.end(); }
1307 METARECORDCTOR
newRecord ( DWORD iType )
const;
1415 extern GLOBALOBJECTS globalObjects;
1426 LPWSTR description_w{
nullptr };
1427 int description_size{ 0 };
1437 : description_w( 0 ), description_size( 0 )
1443 RECTL default_bounds = { 0, 0, 0, 0 };
1444 rclBounds = default_bounds;
1445 RECTL default_frame = { 0, 0, 0, 0 };
1446 rclFrame = default_frame;
1447 dSignature = ENHMETA_SIGNATURE;
1456 szlDevice.cx = XMAX_PIXELS;
1457 szlDevice.cy = YMAX_PIXELS;
1458 szlMillimeters.cx = XMAX_MM;
1459 szlMillimeters.cy = YMAX_MM;
1466 szlMicrometers.cx = 1000 * szlMillimeters.cx;
1467 szlMicrometers.cy = 1000 * szlMillimeters.cy;
1469 if ( description ) {
1471 int description_count = 0, nulls = 0;
1472 LPCWSTR description_p = description;
1473 while ( nulls < 3 ) {
1474 description_count++;
1475 if ( (*description_p++) == 0 ) nulls++;
1480 int record_size = ROUND_TO_LONG(
sizeof( ::
ENHMETAHEADER ) +
1481 sizeof( WCHAR ) * description_count );
1485 std::unique_ptr<WCHAR[]>
1486 description_tmp(
new WCHAR[ description_size ] );
1488 description_w = description_tmp.release();
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
1521 <<
WCHARSTR( description_w, description_size );
1529 ds >> iType >> nSize
1530 >> rclBounds >> rclFrame
1531 >> dSignature >> nVersion >> nBytes >> nRecords >> nHandles >> sReserved
1532 >> nDescription >> offDescription >> nPalEntries
1533 >> szlDevice >> szlMillimeters;
1537 #define OffsetOf( a, b ) ((unsigned int)(((char*)&(((::ENHMETAHEADER*)a)->b)) - \
1538 (char*)((::ENHMETAHEADER*)a)))
1539 if ( OffsetOf(
this, szlMicrometers ) <= offDescription )
1540 ds >> cbPixelFormat >> offPixelFormat >> bOpenGL;
1543 ds >> szlMicrometers;
1547 int description_size_to_read = ( nSize - offDescription ) /
sizeof(WCHAR);
1549 if ( description_size_to_read < (
int)nDescription ) {
1550 throw std::runtime_error(
"record size inconsistent with description size" );
1553 description_size = max( 2, description_size_to_read );
1555 std::unique_ptr<WCHAR[]> buffer(
new WCHAR[description_size] );
1557 WCHARSTR description( buffer.get(), description_size_to_read );
1561 description_w = buffer.release();
1564 description_w[description_size-1] = 0;
1565 description_w[description_size-2] = 0;
1572 int size (
void )
const {
return nSize; }
1584 #ifdef ENABLE_EDITING
1588 void edit (
void )
const
1590 #if defined(__LP64__)
1591 const char* FMT0 =
"\tiType\t\t\t: %d\n";
1592 const char* FMT1 =
"\tnSize\t\t\t: %d\n";
1593 const char* FMT2 =
"\tnBytes\t\t\t: %d\n";
1594 const char* FMT3 =
"\tnRecords\t\t: %d\n";
1595 const char* FMT4 =
"\tnDescription\t\t: %d\n";
1596 const char* FMT5 =
"\toffDescription\t\t: %d\n";
1597 const char* FMT6 =
"\tnPalEntries\t\t: %d\n";
1598 const char* FMT7 =
"\tcbPixelFormat\t\t: %d\n";
1599 const char* FMT8 =
"\toffPixelFormat\t\t: %d\n";
1600 const char* FMT9 =
"\tbOpenGL\t\t\t: %d\n";
1602 const char* FMT0 =
"\tiType\t\t\t: %ld\n";
1603 const char* FMT1 =
"\tnSize\t\t\t: %ld\n";
1604 const char* FMT2 =
"\tnBytes\t\t\t: %ld\n";
1605 const char* FMT3 =
"\tnRecords\t\t: %ld\n";
1606 const char* FMT4 =
"\tnDescription\t\t: %ld\n";
1607 const char* FMT5 =
"\toffDescription\t\t: %ld\n";
1608 const char* FMT6 =
"\tnPalEntries\t\t: %ld\n";
1609 const char* FMT7 =
"\tcbPixelFormat\t\t: %ld\n";
1610 const char* FMT8 =
"\toffPixelFormat\t\t: %ld\n";
1611 const char* FMT9 =
"\tbOpenGL\t\t\t: %ld\n";
1613 printf(
"*HEADER*\n" );
1614 printf( FMT0, iType );
1615 printf( FMT1, nSize );
1616 edit_rectl(
"rclBounds\t", rclBounds );
1617 edit_rectl(
"rclFrame\t", rclFrame );
1618 printf(
"\tdSignature\t\t: %.4s\n", (
const char*)&dSignature );
1619 printf(
"\tnVersion\t\t: 0x%x\n", (
unsigned int)nVersion );
1620 printf( FMT2, nBytes );
1621 printf( FMT3, nRecords );
1622 printf(
"\tnHandles\t\t: %d\n", nHandles );
1623 printf( FMT4, nDescription );
1624 printf( FMT5, offDescription );
1625 printf( FMT6, nPalEntries );
1626 edit_sizel(
"szlDevice\t", szlDevice );
1627 edit_sizel(
"szlMillimeters\t", szlMillimeters );
1630 #define OffsetOf( a, b ) ((unsigned int)(((const char*)&(((const ::ENHMETAHEADER*)a)->b)) - \
1631 (const char*)((const ::ENHMETAHEADER*)a)))
1633 if ( OffsetOf(
this, cbPixelFormat ) <= offDescription ) {
1634 printf( FMT7, cbPixelFormat );
1635 printf( FMT8, offPixelFormat );
1636 printf( FMT9, bOpenGL );
1639 edit_sizel(
"szlMicrometers\t", szlMicrometers );
1646 if ( nDescription != 0 ) {
1649 WCHAR* description = description_w;
1651 printf(
"\tDescription:" );
1653 for ( DWORD i = 0; i < nDescription; i++ ) {
1655 wchar_t w = *description++;
1659 if ( last_w == 0 ) printf(
"\n\t\t" );
1684 emr.iType = EMR_EOF;
1697 ds >> emr >> nPalEntries >> offPalEntries >> nSizeLast;
1705 ds << emr << nPalEntries << offPalEntries << nSizeLast;
1711 int size (
void )
const {
return emr.nSize; }
1723 #ifdef ENABLE_EDITING
1727 void edit (
void )
const
1729 printf(
"*EOF*\n" );
1748 emr.iType = EMR_SETVIEWPORTORGEX;
1759 ds >> emr >> ptlOrigin;
1766 ds << emr << ptlOrigin;
1772 int size (
void )
const {
return emr.nSize; }
1781 SetViewportOrgEx( dc, ptlOrigin.x, ptlOrigin.y, 0 );
1783 #ifdef ENABLE_EDITING
1787 void edit (
void )
const
1789 printf(
"*SETVIEWPORTORGEX*\n" );
1790 edit_pointl(
"ptlOrigin", ptlOrigin );
1811 emr.iType = EMR_SETWINDOWORGEX;
1822 ds >> emr >> ptlOrigin;
1829 ds << emr << ptlOrigin;
1835 int size (
void )
const {
return emr.nSize; }
1844 SetWindowOrgEx( dc, ptlOrigin.x, ptlOrigin.y, 0 );
1846 #ifdef ENABLE_EDITING
1850 void edit (
void )
const
1852 printf(
"*SETWINDOWORGEX*\n" );
1853 edit_pointl(
"ptlOrigin", ptlOrigin );
1872 emr.iType = EMR_SETVIEWPORTEXTEX;
1883 ds >> emr >> szlExtent;
1890 ds << emr << szlExtent;
1896 int size (
void )
const {
return emr.nSize; }
1905 SetViewportExtEx( dc, szlExtent.cx, szlExtent.cy, 0 );
1907 #ifdef ENABLE_EDITING
1911 void edit (
void )
const
1913 printf(
"*SETVIEWPORTEXTEX*\n" );
1914 edit_sizel(
"szlExtent", szlExtent );
1935 emr.iType = EMR_SCALEVIEWPORTEXTEX;
1948 ds >> emr >> xNum >> xDenom >> yNum >> yDenom;
1955 ds << emr << xNum << xDenom << yNum << yDenom;
1961 int size (
void )
const {
return emr.nSize; }
1970 ScaleViewportExtEx( dc, xNum, xDenom, yNum, yDenom, 0 );
1972 #ifdef ENABLE_EDITING
1976 void edit (
void )
const
1978 #if defined(__LP64__)
1979 const char* FMT0 =
"\txNum\t: %d\n";
1980 const char* FMT1 =
"\txDenom\t: %d\n";
1981 const char* FMT2 =
"\tyNum\t: %d\n";
1982 const char* FMT3 =
"\tyDenom\t: %d\n";
1984 const char* FMT0 =
"\txNum\t: %ld\n";
1985 const char* FMT1 =
"\txDenom\t: %ld\n";
1986 const char* FMT2 =
"\tyNum\t: %ld\n";
1987 const char* FMT3 =
"\tyDenom\t: %ld\n";
1989 printf(
"*SCALEVIEWPORTEXTEX*\n" );
1990 printf( FMT0, xNum );
1991 printf( FMT1, xDenom );
1992 printf( FMT2, yNum );
1993 printf( FMT3, yDenom );
2012 emr.iType = EMR_SETWINDOWEXTEX;
2023 ds >> emr >> szlExtent;
2030 ds << emr << szlExtent;
2036 int size (
void )
const {
return emr.nSize; }
2045 SetWindowExtEx( dc, szlExtent.cx, szlExtent.cy, 0 );
2047 #ifdef ENABLE_EDITING
2051 void edit (
void )
const
2053 printf(
"*SETWINDOWEXTEX*\n" );
2054 edit_sizel(
"szlExtent", szlExtent );
2075 emr.iType = EMR_SCALEWINDOWEXTEX;
2088 ds >> emr >> xNum >> xDenom >> yNum >> yDenom;
2095 ds << emr << xNum << xDenom << yNum << yDenom;
2101 int size (
void )
const {
return emr.nSize; }
2110 ScaleWindowExtEx( dc, xNum, xDenom, yNum, yDenom, 0 );
2112 #ifdef ENABLE_EDITING
2116 void edit (
void )
const
2118 #if defined(__LP64__)
2119 const char* FMT0 =
"\txNum\t: %d\n";
2120 const char* FMT1 =
"\txDenom\t: %d\n";
2121 const char* FMT2 =
"\tyNum\t: %d\n";
2122 const char* FMT3 =
"\tyDenom\t: %d\n";
2124 const char* FMT0 =
"\txNum\t: %ld\n";
2125 const char* FMT1 =
"\txDenom\t: %ld\n";
2126 const char* FMT2 =
"\tyNum\t: %ld\n";
2127 const char* FMT3 =
"\tyDenom\t: %ld\n";
2129 printf(
"*SCALEWINDOWEXTEX*\n" );
2130 printf( FMT0, xNum );
2131 printf( FMT1, xDenom );
2132 printf( FMT2, yNum );
2133 printf( FMT3, yDenom );
2154 emr.iType = EMR_MODIFYWORLDTRANSFORM;
2165 ds >> emr >> xform >> iMode;
2172 ds << emr << xform << iMode;
2178 int size (
void )
const {
return emr.nSize; }
2187 ModifyWorldTransform( dc, &xform, iMode );
2189 #ifdef ENABLE_EDITING
2193 void edit (
void )
const
2195 #if defined(__LP64__)
2196 const char* FMT =
"unknown(%d)\n";
2198 const char* FMT =
"unknown(%ld)\n";
2200 printf(
"*MODIFYWORLDTRANSFORM*\n" );
2201 edit_xform(
"xform", xform );
2202 printf(
"\tiMode\t\t: " );
2204 case MWT_IDENTITY: printf(
"MWT_IDENTITY\n" );
break;
2205 case MWT_LEFTMULTIPLY: printf(
"MWT_LEFTMULTIPLY\n" );
break;
2206 case MWT_RIGHTMULTIPLY: printf(
"MWT_RIGHTMULTIPLY\n" );
break;
2207 default: printf( FMT, iMode );
2227 emr.iType = EMR_SETWORLDTRANSFORM;
2250 int size (
void )
const {
return emr.nSize; }
2259 SetWorldTransform( dc, &xform );
2261 #ifdef ENABLE_EDITING
2265 void edit (
void )
const
2267 printf(
"*SETWORLDTRANSFORM*\n" );
2268 edit_xform(
"xform", xform );
2284 emr.iType = EMR_SETTEXTALIGN;
2307 int size (
void )
const {
return emr.nSize; }
2316 SetTextAlign( dc, iMode );
2318 #ifdef ENABLE_EDITING
2322 void edit (
void )
const
2324 #if defined(__LP64__)
2325 const char* FMT =
"| unknown bits(0x%x)";
2327 const char* FMT =
"| unknown bits(0x%lx)";
2329 unsigned int known_bits = TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING;
2330 unsigned int unknown_bits = ~known_bits;
2332 printf(
"*SETTEXTALIGN*\n" );
2333 printf(
"\tiMode\t: " );
2334 if ( iMode & TA_UPDATECP )
2335 printf(
"TA_UPDATECP" );
2337 printf(
"TA_NOUPDATECP" );
2338 if ( iMode & TA_CENTER )
2339 printf(
" | TA_CENTER" );
2340 else if ( iMode & TA_RIGHT )
2341 printf(
" | TA_RIGHT" );
2343 printf(
" | TA_LEFT" );
2344 if ( iMode & TA_BASELINE )
2345 printf(
" | TA_BASELINE" );
2346 else if ( iMode & TA_BOTTOM )
2347 printf(
" | TA_BOTTOM" );
2349 printf(
" | TA_TOP" );
2350 if ( iMode & TA_RTLREADING )
2351 printf(
" | TA_RTLREADING" );
2352 if ( iMode & unknown_bits )
2353 printf( FMT, iMode & unknown_bits );
2370 emr.iType = EMR_SETTEXTCOLOR;
2380 ds >> emr >> crColor;
2387 ds << emr << crColor;
2393 int size (
void )
const {
return emr.nSize; }
2402 SetTextColor( dc, crColor );
2404 #ifdef ENABLE_EDITING
2408 void edit (
void )
const
2410 printf(
"*SETTEXTCOLOR*\n" );
2411 edit_color(
"crColor", crColor );
2427 emr.iType = EMR_SETBKCOLOR;
2437 ds >> emr >> crColor;
2444 ds << emr << crColor;
2450 int size (
void )
const {
return emr.nSize; }
2459 SetBkColor( dc, crColor );
2461 #ifdef ENABLE_EDITING
2465 void edit (
void )
const
2467 printf(
"*SETBKCOLOR*\n" );
2468 edit_color(
"crColor", crColor );
2485 emr.iType = EMR_SETBKMODE;
2508 int size (
void )
const {
return emr.nSize; }
2517 SetBkMode( dc, iMode );
2519 #ifdef ENABLE_EDITING
2523 void edit (
void )
const
2525 #if defined(__LP64__)
2526 const char* FMT =
"unknown(%d)\n";
2528 const char* FMT =
"unknown(%ld)\n";
2530 printf(
"*SETBKMODE*\n" );
2531 printf(
"\tiMode\t: " );
2533 case TRANSPARENT: printf(
"TRANSPARENT\n" );
break;
2534 case OPAQUE: printf(
"OPAQUE\n" );
break;
2535 default: printf( FMT, iMode );
2552 emr.iType = EMR_SETPOLYFILLMODE;
2575 int size (
void )
const {
return emr.nSize; }
2584 SetPolyFillMode( dc, iMode );
2586 #ifdef ENABLE_EDITING
2590 void edit (
void )
const
2592 #if defined(__LP64__)
2593 const char* FMT =
"unknown(%d)\n";
2595 const char* FMT =
"unknown(%ld)\n";
2597 printf(
"*SETPOLYFILLMODE*\n" );
2598 printf(
"\tiMode: " );
2600 case ALTERNATE: printf(
"ALTERNATE\n" );
break;
2601 case WINDING: printf(
"WINDING\n" );
break;
2602 default: printf( FMT, iMode );
2620 emr.iType = EMR_SETMAPMODE;
2643 int size (
void )
const {
return emr.nSize; }
2652 SetMapMode( dc, iMode );
2654 #ifdef ENABLE_EDITING
2658 void edit (
void )
const
2660 #if defined(__LP64__)
2661 const char* FMT =
"unknown(%d)\n";
2663 const char* FMT =
"unknown(%ld)\n";
2665 printf(
"*SETMAPMODE*\n" );
2666 printf(
"\tiMode\t: " );
2668 case MM_TEXT: printf(
"MM_TEXT\n" );
break;
2669 case MM_LOMETRIC: printf(
"MM_LOMETRIC\n" );
break;
2670 case MM_HIMETRIC: printf(
"MM_HIMETRIC\n" );
break;
2671 case MM_LOENGLISH: printf(
"MM_LOENGLISH\n" );
break;
2672 case MM_HIENGLISH: printf(
"MM_HIENGLISH\n" );
break;
2673 case MM_TWIPS: printf(
"MM_TWIPS\n" );
break;
2674 case MM_ISOTROPIC: printf(
"MM_ISOTROPIC\n" );
break;
2675 case MM_ANISOTROPIC: printf(
"MM_ANISOTROPIC\n" );
break;
2676 default: printf( FMT, iMode );
2693 emr.iType = EMR_SELECTOBJECT;
2703 ds >> emr >> ihObject;
2710 ds << emr << ihObject;
2716 int size (
void )
const {
return emr.nSize; }
2723 #ifdef ENABLE_EDITING
2727 void edit (
void )
const
2729 #if defined(__LP64__)
2730 const char* FMT =
"\tihObject\t: 0x%x\n";
2732 const char* FMT =
"\tihObject\t: 0x%lx\n";
2734 printf(
"*SELECTOBJECT*\n" );
2735 printf( FMT, ihObject );
2751 emr.iType = EMR_DELETEOBJECT;
2761 ds >> emr >> ihObject;
2768 ds << emr << ihObject;
2774 int size (
void )
const {
return emr.nSize; }
2781 #ifdef ENABLE_EDITING
2785 void edit (
void )
const
2787 #if defined(__LP64__)
2788 const char* FMT =
"\tihObject\t: 0x%x\n";
2790 const char* FMT =
"\tihObject\t: 0x%lx\n";
2792 printf(
"*DELETEOBJECT*\n" );
2793 printf( FMT, ihObject );
2810 emr.iType = EMR_MOVETOEX;
2834 int size (
void )
const {
return emr.nSize; }
2843 MoveToEx( dc, ptl.x, ptl.y, 0 );
2845 #ifdef ENABLE_EDITING
2849 void edit (
void )
const
2851 printf(
"*MOVETOEX*\n" );
2852 edit_pointl(
"ptl", ptl );
2869 emr.iType = EMR_LINETO;
2893 int size (
void )
const {
return emr.nSize; }
2902 LineTo( dc, ptl.x, ptl.y );
2904 #ifdef ENABLE_EDITING
2908 void edit (
void )
const
2910 printf(
"*LINETO*\n" );
2911 edit_pointl(
"ptl", ptl );
2933 EMRARC ( INT left, INT top, INT right, INT bottom, INT xstart,
2934 INT ystart, INT xend, INT yend )
2936 emr.iType = EMR_ARC;
2939 rclBox.right = right;
2940 rclBox.bottom = bottom;
2942 ptlStart.x = xstart;
2943 ptlStart.y = ystart;
2953 ds >> emr >> rclBox >> ptlStart >> ptlEnd;
2960 ds << emr << rclBox << ptlStart << ptlEnd;
2966 int size (
void )
const {
return emr.nSize; }
2975 Arc( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom,
2976 ptlStart.x, ptlStart.y, ptlEnd.x, ptlEnd.y );
2978 #ifdef ENABLE_EDITING
2982 void edit (
void )
const
2984 printf(
"*ARC*\n" );
2985 edit_rectl(
"rclBox\t", rclBox );
2986 edit_pointl(
"ptlStart", ptlStart );
2987 edit_pointl(
"ptlEnd\t", ptlEnd );
3009 EMRARCTO ( INT left, INT top, INT right, INT bottom, INT xstart,
3010 INT ystart, INT xend, INT yend )
3012 emr.iType = EMR_ARCTO;
3015 rclBox.right = right;
3016 rclBox.bottom = bottom;
3018 ptlStart.x = xstart;
3019 ptlStart.y = ystart;
3029 ds >> emr >> rclBox >> ptlStart >> ptlEnd;
3036 ds << emr << rclBox << ptlStart << ptlEnd;
3042 int size (
void )
const {
return emr.nSize; }
3051 ArcTo( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom,
3052 ptlStart.x, ptlStart.y, ptlEnd.x, ptlEnd.y );
3054 #ifdef ENABLE_EDITING
3058 void edit (
void )
const
3060 printf(
"*ARCTO*\n" );
3061 edit_rectl(
"rclBox\t", rclBox );
3062 edit_pointl(
"ptlStart", ptlStart );
3063 edit_pointl(
"ptlEnd\t", ptlEnd );
3082 emr.iType = EMR_RECTANGLE;
3085 rclBox.right = right;
3086 rclBox.bottom = bottom;
3095 ds >> emr >> rclBox;
3102 ds << emr << rclBox;
3108 int size (
void )
const {
return emr.nSize; }
3117 Rectangle( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom );
3119 #ifdef ENABLE_EDITING
3123 void edit (
void )
const
3125 printf(
"*RECTANGLE*\n" );
3126 edit_rectl(
"rclBox", rclBox );
3146 emr.iType = EMR_ELLIPSE;
3149 rclBox.right = right;
3150 rclBox.bottom = bottom;
3159 ds >> emr >> rclBox;
3166 ds << emr << rclBox;
3172 int size (
void )
const {
return emr.nSize; }
3181 Ellipse( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom );
3183 #ifdef ENABLE_EDITING
3187 void edit (
void )
const
3189 printf(
"*ELLIPSE*\n" );
3190 edit_rectl(
"rclBox", rclBox );
3200 POINTL* lpoints{
nullptr};
3213 emr.iType = EMR_POLYLINE;
3215 emr.nSize =
sizeof(
::EMRPOLYLINE ) +
sizeof( POINTL ) * ( cptl - 1);
3217 lpoints =
new POINTL[cptl];
3219 for (
int i=0; i<n; i++) {
3220 lpoints[i].x = points[i].x;
3221 lpoints[i].y = points[i].y;
3224 rclBounds = *bounds;
3231 if ( lpoints )
delete[] lpoints;
3239 ds >> emr >> rclBounds >> cptl;
3241 if ( emr.nSize - (
sizeof(::
EMRPOLYLINE)-
sizeof(POINTL) ) <
3242 sizeof(POINTL) * cptl ) {
3243 throw std::runtime_error(
"Invalid record size" );
3246 std::unique_ptr<POINTL[]> buffer(
new POINTL[cptl] );
3251 lpoints = buffer.release();
3258 ds << emr << rclBounds << cptl <<
POINTLARRAY( lpoints, cptl );
3264 int size (
void )
const {
return emr.nSize; }
3274 Polyline( dc, (POINT*)lpoints, cptl );
3276 #ifdef ENABLE_EDITING
3280 void edit (
void )
const
3282 printf(
"*POLYLINE*\n" );
3283 edit_rectl(
"rclBounds", rclBounds );
3284 edit_pointlarray(
"\t", cptl, lpoints );
3294 POINT16* lpoints{
nullptr };
3307 emr.iType = EMR_POLYLINE16;
3309 emr.nSize =
sizeof(
::EMRPOLYLINE16 ) +
sizeof( POINT16 ) * ( cpts - 1);
3311 lpoints =
new POINT16[cpts];
3313 for (
int i=0; i<n; i++) {
3314 lpoints[i].x = points[i].x;
3315 lpoints[i].y = points[i].y;
3318 rclBounds = *bounds;
3332 emr.iType = EMR_POLYLINE16;
3334 emr.nSize =
sizeof(
::EMRPOLYLINE16 ) +
sizeof( POINT16 ) * ( cpts - 1);
3336 lpoints =
new POINT16[cpts];
3338 for (
int i=0; i<n; i++) {
3339 lpoints[i].x = points[i].x;
3340 lpoints[i].y = points[i].y;
3343 rclBounds = *bounds;
3350 if ( lpoints )
delete[] lpoints;
3358 ds >> emr >> rclBounds >> cpts;
3360 if ( emr.nSize - (
sizeof(::
EMRPOLYLINE16)-
sizeof(POINT16) ) <
3361 sizeof(POINT16) * cpts ) {
3362 throw std::runtime_error(
"Invalid record size" );
3365 std::unique_ptr<POINT16[]> buffer(
new POINT16[cpts] );
3371 lpoints = buffer.release();
3378 ds << emr << rclBounds << cpts <<
POINT16ARRAY( lpoints, cpts );
3384 int size (
void )
const {
return emr.nSize; }
3394 Polyline16( dc, lpoints, cpts );
3396 #ifdef ENABLE_EDITING
3400 void edit (
void )
const
3402 printf(
"*POLYLINE16*\n" );
3403 edit_rectl(
"rclBounds", rclBounds );
3404 edit_point16array(
"\t", cpts, lpoints );
3414 POINTL* lpoints{
nullptr };
3427 emr.iType = EMR_POLYGON;
3429 emr.nSize =
sizeof(
::EMRPOLYGON ) +
sizeof( POINTL ) * (cptl-1);
3431 lpoints =
new POINTL[cptl];
3433 for (
int i=0; i<n; i++) {
3434 lpoints[i].x = points[i].x;
3435 lpoints[i].y = points[i].y;
3438 rclBounds = *bounds;
3446 ds >> emr >> rclBounds >> cptl;
3448 if ( emr.nSize - (
sizeof(::
EMRPOLYGON) -
sizeof(POINTL)) <
3449 cptl *
sizeof(POINTL) ) {
3450 throw std::runtime_error(
"Invalid record size" );
3453 std::unique_ptr<POINTL[]> buffer(
new POINTL[cptl] );
3459 lpoints = buffer.release();
3466 if ( lpoints )
delete[] lpoints;
3473 ds << emr << rclBounds << cptl <<
POINTLARRAY( lpoints, cptl );
3479 int size (
void )
const {
return emr.nSize; }
3489 Polygon( dc, (POINT*)lpoints, cptl );
3491 #ifdef ENABLE_EDITING
3495 void edit (
void )
const
3497 printf(
"*POLYGON*\n" );
3498 edit_rectl(
"rclBounds", rclBounds );
3499 edit_pointlarray(
"\t", cptl, lpoints );
3509 POINT16* lpoints{
nullptr };
3522 emr.iType = EMR_POLYGON16;
3524 emr.nSize =
sizeof(
::EMRPOLYGON16 ) +
sizeof( POINT16 ) * (cpts-1);
3526 lpoints =
new POINT16[cpts];
3528 for (
int i=0; i<n; i++) {
3529 lpoints[i].x = points[i].x;
3530 lpoints[i].y = points[i].y;
3533 rclBounds = *bounds;
3547 emr.iType = EMR_POLYGON16;
3549 emr.nSize =
sizeof(
::EMRPOLYGON16 ) +
sizeof( POINT16 ) * (cpts-1);
3551 lpoints =
new POINT16[cpts];
3553 for (
int i=0; i<n; i++) {
3554 lpoints[i].x = points[i].x;
3555 lpoints[i].y = points[i].y;
3558 rclBounds = *bounds;
3566 ds >> emr >> rclBounds >> cpts;
3568 if ( emr.nSize - (
sizeof(::
EMRPOLYGON16) -
sizeof(POINT16)) <
3569 cpts *
sizeof(POINT16) ) {
3570 throw std::runtime_error(
"Invalid record size" );
3573 std::unique_ptr<POINT16[]> buffer(
new POINT16[cpts] );
3579 lpoints = buffer.release();
3586 if ( lpoints )
delete[] lpoints;
3593 ds << emr << rclBounds << cpts <<
POINT16ARRAY( lpoints, cpts );
3599 int size (
void )
const {
return emr.nSize; }
3609 Polygon16( dc, lpoints, cpts );
3611 #ifdef ENABLE_EDITING
3615 void edit (
void )
const
3617 printf(
"*POLYGON16*\n" );
3618 edit_rectl(
"rclBounds", rclBounds );
3619 edit_point16array(
"\t", cpts, lpoints );
3629 DWORD* lcounts{
nullptr };
3630 POINTL* lpoints{
nullptr };
3644 for (
unsigned int i = 0; i < nPolys; i++ )
3652 emr.iType = EMR_POLYPOLYGON;
3656 +
sizeof( DWORD ) * (nPolys-1);
3658 lcounts =
new DWORD[nPolys];
3660 for (
unsigned int i = 0; i < nPolys; i++ )
3661 lcounts[i] = counts[i];
3663 lpoints =
new POINTL[cptl];
3665 for (
int i=0; i<n; i++) {
3666 lpoints[i].x = points[i].x;
3667 lpoints[i].y = points[i].y;
3670 rclBounds = *bounds;
3677 if ( lcounts )
delete[] lcounts;
3678 if ( lpoints )
delete[] lpoints;
3686 ds >> emr >> rclBounds >> nPolys >> cptl;
3688 if ( emr.nSize - (
sizeof( ::
EMRPOLYPOLYGON ) -
sizeof(POINTL) -
sizeof(DWORD) ) <
3689 sizeof( POINTL ) * cptl +
sizeof( DWORD ) * nPolys ) {
3690 throw std::runtime_error(
"Invalid record size" );
3693 std::unique_ptr<DWORD[]> cbuffer(
new DWORD[nPolys] );
3701 DWORD n{0}, n_old{0};
3702 for ( DWORD c{0}; c < nPolys; ++c ) {
3706 throw std::runtime_error(
"Unsigned overflow" );
3710 throw std::runtime_error(
"Too few points" );
3713 std::unique_ptr<POINTL[]> pbuffer(
new POINTL[cptl] );
3720 lcounts = cbuffer.release();
3721 lpoints = pbuffer.release();
3728 ds << emr << rclBounds << nPolys << cptl <<
DWORDARRAY( lcounts, nPolys )
3735 int size (
void )
const {
return emr.nSize; }
3746 std::vector<INT> countsv( lcounts, lcounts + nPolys );
3748 PolyPolygon( dc, (POINT*)lpoints, countsv.data(), nPolys );
3750 #ifdef ENABLE_EDITING
3754 void edit (
void )
const
3756 #if defined(__LP64__)
3757 const char* FMT0 =
"\tnPolys\t\t: %d\n";
3758 const char* FMT1 =
"\tcptl\t\t: %d\n";
3759 const char* FMT2 =
"%d\n";
3760 const char* FMT3 =
"\t\t\t %d\n";
3761 const char* FMT4 =
"%d, %d\n";
3762 const char* FMT5 =
"\t\t\t %d, %d\n";
3764 const char* FMT0 =
"\tnPolys\t\t: %ld\n";
3765 const char* FMT1 =
"\tcptl\t\t: %ld\n";
3766 const char* FMT2 =
"%ld\n";
3767 const char* FMT3 =
"\t\t\t %ld\n";
3768 const char* FMT4 =
"%ld, %ld\n";
3769 const char* FMT5 =
"\t\t\t %ld, %ld\n";
3771 printf(
"*POLYPOLYGON*\n" );
3772 edit_rectl(
"rclBounds", rclBounds );
3773 printf( FMT0, nPolys );
3774 printf( FMT1, cptl );
3775 printf(
"\taPolyCounts\t: " );
3777 printf( FMT2, lcounts[0] );
3780 for (
unsigned int i = 1; i < nPolys; i++ )
3781 printf( FMT3, lcounts[i] );
3782 printf(
"\tapts\t\t: " );
3784 printf( FMT4, lpoints[0].x, lpoints[0].y );
3787 for (
unsigned int i = 1; i < cptl; i++ )
3788 printf( FMT5, lpoints[i].x, lpoints[i].y );
3798 DWORD* lcounts{
nullptr };
3799 POINT16* lpoints{
nullptr };
3808 const INT* counts, UINT 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;
3849 const INT* counts, UINT16 polygons )
3854 for (
unsigned int i = 0; i < nPolys; i++ )
3862 emr.iType = EMR_POLYPOLYGON16;
3866 +
sizeof( DWORD ) * (nPolys-1);
3868 lcounts =
new DWORD[nPolys];
3870 for (
unsigned int i = 0; i < nPolys; i++ )
3871 lcounts[i] = counts[i];
3873 lpoints =
new POINT16[cpts];
3875 for (
int i=0; i<n; i++) {
3876 lpoints[i].x = points[i].x;
3877 lpoints[i].y = points[i].y;
3880 rclBounds = *bounds;
3887 if ( lcounts )
delete[] lcounts;
3888 if ( lpoints )
delete[] lpoints;
3896 ds >> emr >> rclBounds >> nPolys >> cpts;
3898 if ( emr.nSize - (
sizeof( ::
EMRPOLYPOLYGON16 ) -
sizeof(POINT16) -
sizeof(DWORD) ) <
3899 sizeof( POINT16 ) * cpts +
sizeof( DWORD ) * nPolys ) {
3900 throw std::runtime_error(
"Invalid record size" );
3903 std::unique_ptr<DWORD[]> cbuffer(
new DWORD[nPolys] );
3911 DWORD n{0}, n_old{0};
3912 for ( DWORD c{0}; c < nPolys; ++c ) {
3916 throw std::runtime_error(
"Unsigned overflow" );
3920 throw std::runtime_error(
"Too few points" );
3923 std::unique_ptr<POINT16[]> pbuffer(
new POINT16[cpts] );
3929 lcounts = cbuffer.release();
3930 lpoints = pbuffer.release();
3937 ds << emr << rclBounds << nPolys << cpts <<
DWORDARRAY( lcounts, nPolys )
3944 int size (
void )
const {
return emr.nSize; }
3955 std::vector<INT> counts( lcounts, lcounts + nPolys );
3957 PolyPolygon16( dc, lpoints, counts.data(), nPolys );
3959 #ifdef ENABLE_EDITING
3963 void edit (
void )
const
3965 #if defined(__LP64__)
3966 const char* FMT0 =
"\tnPolys\t\t: %d\n";
3967 const char* FMT1 =
"\tcptl\t\t: %d\n";
3968 const char* FMT2 =
"%d\n";
3969 const char* FMT3 =
"\t\t\t %d\n";
3971 const char* FMT0 =
"\tnPolys\t\t: %ld\n";
3972 const char* FMT1 =
"\tcptl\t\t: %ld\n";
3973 const char* FMT2 =
"%ld\n";
3974 const char* FMT3 =
"\t\t\t %ld\n";
3976 printf(
"*POLYPOLYGON16*\n" );
3977 edit_rectl(
"rclBounds", rclBounds );
3978 printf( FMT0, nPolys );
3979 printf( FMT1, cpts );
3980 printf(
"\taPolyCounts\t: " );
3982 printf( FMT2, lcounts[0] );
3985 for (
unsigned int i = 1; i < nPolys; i++ )
3986 printf( FMT3, lcounts[i] );
3987 printf(
"\tapts\t\t: " );
3989 printf(
"%d, %d\n", lpoints[0].x, lpoints[0].y );
3992 for (
unsigned int i = 1; i < cpts; i++ )
3993 printf(
"\t\t\t %d, %d\n", lpoints[i].x, lpoints[i].y );
4003 POINTL* lpoints{
nullptr };
4016 emr.iType = EMR_POLYBEZIER;
4020 lpoints =
new POINTL[cptl];
4022 for (
int i=0; i<n; i++) {
4023 lpoints[i].x = points[i].x;
4024 lpoints[i].y = points[i].y;
4027 rclBounds = *bounds;
4035 ds >> emr >> rclBounds >> cptl;
4037 if ( emr.nSize - (
sizeof( ::
EMRPOLYBEZIER ) -
sizeof(POINTL)) <
4038 sizeof( POINTL ) * cptl ) {
4039 throw std::runtime_error(
"Invalid record size" );
4042 std::unique_ptr<POINTL[]> buffer(
new POINTL[cptl] );
4048 lpoints = buffer.release();
4055 if ( lpoints )
delete[] lpoints;
4062 ds << emr << rclBounds << cptl <<
POINTLARRAY( lpoints, cptl );
4068 int size (
void )
const {
return emr.nSize; }
4078 PolyBezier( dc, (POINT*)lpoints, cptl );
4080 #ifdef ENABLE_EDITING
4084 void edit (
void )
const
4086 printf(
"*POLYBEZIER*\n" );
4087 edit_rectl(
"rclBounds", rclBounds );
4088 edit_pointlarray(
"\t", cptl, lpoints );
4098 POINT16* lpoints{
nullptr };
4111 emr.iType = EMR_POLYBEZIER16;
4115 lpoints =
new POINT16[cpts];
4117 for (
int i=0; i<n; i++) {
4118 lpoints[i].x = points[i].x;
4119 lpoints[i].y = points[i].y;
4122 rclBounds = *bounds;
4136 emr.iType = EMR_POLYBEZIER16;
4140 lpoints =
new POINT16[cpts];
4142 for (
int i=0; i<n; i++) {
4143 lpoints[i].x = points[i].x;
4144 lpoints[i].y = points[i].y;
4147 rclBounds = *bounds;
4155 ds >> emr >> rclBounds >> cpts;
4158 sizeof( POINT16 ) * cpts ) {
4159 throw std::runtime_error(
"Invalid record size" );
4162 std::unique_ptr<POINT16[]> buffer(
new POINT16[cpts] );
4168 lpoints = buffer.release();
4175 if ( lpoints )
delete[] lpoints;
4182 ds << emr << rclBounds << cpts <<
POINT16ARRAY( lpoints, cpts );
4188 int size (
void )
const {
return emr.nSize; }
4198 PolyBezier16( dc, lpoints, cpts );
4200 #ifdef ENABLE_EDITING
4204 void edit (
void )
const
4206 printf(
"*POLYBEZIER16*\n" );
4207 edit_rectl(
"rclBounds", rclBounds );
4208 edit_point16array(
"\t", cpts, lpoints );
4218 POINTL* lpoints{
nullptr };
4231 emr.iType = EMR_POLYBEZIERTO;
4235 lpoints =
new POINTL[cptl];
4237 for (
int i=0; i<n; i++) {
4238 lpoints[i].x = points[i].x;
4239 lpoints[i].y = points[i].y;
4242 rclBounds = *bounds;
4250 ds >> emr >> rclBounds >> cptl;
4253 sizeof( POINTL ) * cptl ) {
4254 throw std::runtime_error(
"Invalid record size" );
4257 std::unique_ptr<POINTL[]> buffer(
new POINTL[cptl] );
4263 lpoints = buffer.release();
4270 if ( lpoints )
delete[] lpoints;
4277 ds << emr << rclBounds << cptl <<
POINTLARRAY( lpoints, cptl );
4283 int size (
void )
const {
return emr.nSize; }
4293 PolyBezierTo( dc, (POINT*)lpoints, cptl );
4295 #ifdef ENABLE_EDITING
4299 void edit (
void )
const
4301 printf(
"*POLYBEZIERTO*\n" );
4302 edit_rectl(
"rclBounds", rclBounds );
4303 edit_pointlarray(
"\t", cptl, lpoints );
4313 POINT16* lpoints{
nullptr };
4326 emr.iType = EMR_POLYBEZIERTO16;
4330 lpoints =
new POINT16[cpts];
4332 for (
int i=0; i<n; i++) {
4333 lpoints[i].x = points[i].x;
4334 lpoints[i].y = points[i].y;
4337 rclBounds = *bounds;
4351 emr.iType = EMR_POLYBEZIERTO16;
4355 lpoints =
new POINT16[cpts];
4357 for (
int i=0; i<n; i++) {
4358 lpoints[i].x = points[i].x;
4359 lpoints[i].y = points[i].y;
4362 rclBounds = *bounds;
4370 ds >> emr >> rclBounds >> cpts;
4373 sizeof( POINT16 ) * cpts ) {
4374 throw std::runtime_error(
"Invalid record size" );
4377 std::unique_ptr<POINT16[]> buffer(
new POINT16[cpts] );
4383 lpoints = buffer.release();
4390 if ( lpoints )
delete[] lpoints;
4397 ds << emr << rclBounds << cpts <<
POINT16ARRAY( lpoints, cpts );
4403 int size (
void )
const {
return emr.nSize; }
4413 PolyBezierTo16( dc, lpoints, cpts );
4415 #ifdef ENABLE_EDITING
4419 void edit (
void )
const
4421 printf(
"*POLYBEZIERTO16*\n" );
4422 edit_rectl(
"rclBounds", rclBounds );
4423 edit_point16array(
"\t", cpts, lpoints );
4433 POINTL* lpoints{
nullptr };
4446 emr.iType = EMR_POLYLINETO;
4450 lpoints =
new POINTL[cptl];
4452 for (
int i=0; i<n; i++) {
4453 lpoints[i].x = points[i].x;
4454 lpoints[i].y = points[i].y;
4457 rclBounds = *bounds;
4465 ds >> emr >> rclBounds >> cptl;
4467 if ( emr.nSize - (
sizeof( ::
EMRPOLYLINETO ) -
sizeof(POINTL)) <
4468 sizeof( POINTL ) * cptl ) {
4469 throw std::runtime_error(
"Invalid record size" );
4472 std::unique_ptr<POINTL[]> buffer(
new POINTL[cptl] );
4478 lpoints = buffer.release();
4485 if ( lpoints )
delete[] lpoints;
4492 ds << emr << rclBounds << cptl <<
POINTLARRAY( lpoints, cptl );
4498 int size (
void )
const {
return emr.nSize; }
4508 PolylineTo( dc, (POINT*)lpoints, cptl );
4510 #ifdef ENABLE_EDITING
4514 void edit (
void )
const
4516 printf(
"*POLYLINETO*\n" );
4517 edit_rectl(
"rclBounds", rclBounds );
4518 edit_pointlarray(
"\t", cptl, lpoints );
4528 POINT16* lpoints{
nullptr };
4541 emr.iType = EMR_POLYLINETO16;
4545 lpoints =
new POINT16[cpts];
4547 for (
int i=0; i<n; i++) {
4548 lpoints[i].x = points[i].x;
4549 lpoints[i].y = points[i].y;
4552 rclBounds = *bounds;
4566 emr.iType = EMR_POLYLINETO16;
4570 lpoints =
new POINT16[cpts];
4572 for (
int i=0; i<n; i++) {
4573 lpoints[i].x = points[i].x;
4574 lpoints[i].y = points[i].y;
4577 rclBounds = *bounds;
4585 ds >> emr >> rclBounds >> cpts;
4588 sizeof( POINT16 ) * cpts ) {
4589 throw std::runtime_error(
"Invalid record size" );
4592 std::unique_ptr<POINT16[]> buffer(
new POINT16[cpts] );
4598 lpoints = buffer.release();
4605 if ( lpoints )
delete[] lpoints;
4612 ds << emr << rclBounds << cpts <<
POINT16ARRAY( lpoints, cpts );
4618 int size (
void )
const {
return emr.nSize; }
4628 PolylineTo16( dc, lpoints, cpts );
4630 #ifdef ENABLE_EDITING
4634 void edit (
void )
const
4636 printf(
"*POLYLINETO16*\n" );
4637 edit_rectl(
"rclBounds", rclBounds );
4638 edit_point16array(
"\t", cpts, lpoints );
4650 PSTR string_a{
nullptr };
4653 INT* dx_i{
nullptr };
4665 FLOAT yScale,
const PEMRTEXT text, LPCSTR
string,
4668 emr.iType = EMR_EXTTEXTOUTA;
4671 rclBounds = *bounds;
4673 iGraphicsMode = graphicsMode;
4679 string_size = ROUND_TO_LONG( emrtext.nChars );
4681 string_a =
new CHAR[ string_size ];
4683 memset( string_a, 0,
sizeof(CHAR) * string_size );
4685 for (
unsigned int i=0; i<emrtext.nChars; i++ )
4686 string_a[i] = *
string++;
4688 emrtext.offString = emr.nSize;
4689 emr.nSize += string_size *
sizeof(CHAR);
4697 int * dxn =
new int [string_size];
4698 for (
unsigned int i=0; i < string_size; i++) dxn[i] = 10;
4705 dx_i =
new INT[ emrtext.nChars ];
4707 for (
unsigned int i=0; i<emrtext.nChars; i++ )
4710 emrtext.offDx = emr.nSize;
4711 emr.nSize += emrtext.nChars *
sizeof(INT);
4724 ds >> emr >> rclBounds >> iGraphicsMode >> exScale >> eyScale >> emrtext;
4726 if ( emrtext.nChars > 0 and emrtext.offString == 0 ) {
4727 throw std::runtime_error(
"Invalid text specification" );
4730 if ( emrtext.nChars > emr.nSize - emrtext.offString ) {
4731 throw std::runtime_error(
"Invalid text specification" );
4734 std::unique_ptr<char[]> cbuffer;
4735 std::unique_ptr<INT[]> ibuffer;
4737 if ( emrtext.offString != 0 ) {
4738 string_size = ROUND_TO_LONG( emrtext.nChars );
4740 cbuffer.reset(
new char[string_size] );
4742 memset( cbuffer.get(), 0,
sizeof(CHAR) * string_size );
4744 CHARSTR string( cbuffer.get(), string_size );
4749 if ( emrtext.offDx ) {
4750 ibuffer.reset(
new INT[emrtext.nChars] );
4752 INTARRAY dx_is( ibuffer.get(), emrtext.nChars );
4757 string_a = cbuffer.release();
4758 dx_i = ibuffer.release();
4766 if ( string_a )
delete[] string_a;
4767 if ( dx_i )
delete[] dx_i;
4774 ds << emr << rclBounds << iGraphicsMode << exScale << eyScale
4775 << emrtext <<
CHARSTR( string_a, string_size );
4777 ds <<
INTARRAY( dx_i, emrtext.nChars );
4783 int size (
void )
const {
return emr.nSize; }
4793 rect.left = emrtext.rcl.left;
4794 rect.top = emrtext.rcl.top;
4795 rect.right = emrtext.rcl.right;
4796 rect.bottom = emrtext.rcl.bottom;
4798 ExtTextOutA( dc, emrtext.ptlReference.x, emrtext.ptlReference.y,
4799 emrtext.fOptions, &rect, string_a, emrtext.nChars,
4802 #ifdef ENABLE_EDITING
4806 void edit (
void )
const
4808 #if defined(__LP64__)
4809 const char* FMT0 =
"unknown(%d)\n";
4810 const char* FMT1 =
"\tptlReference\t: (%d,%d)\n";
4811 const char* FMT2 =
"\tnChars\t\t: %d\n";
4812 const char* FMT3 =
"\toffString\t: %d\n";
4813 const char* FMT4 =
"\toffDx\t\t: %d\n";
4815 const char* FMT0 =
"unknown(%ld)\n";
4816 const char* FMT1 =
"\tptlReference\t: (%ld,%ld)\n";
4817 const char* FMT2 =
"\tnChars\t\t: %ld\n";
4818 const char* FMT3 =
"\toffString\t: %ld\n";
4819 const char* FMT4 =
"\toffDx\t\t: %ld\n";
4821 printf(
"*EXTTEXTOUTA*\n" );
4822 edit_rectl(
"rclBounds", rclBounds );
4823 printf(
"\tiGraphicsMode\t: " );
4824 switch ( iGraphicsMode ) {
4825 case GM_COMPATIBLE: printf(
"GM_COMPATIBLE\n" );
break;
4826 case GM_ADVANCED: printf(
"GM_ADVANCED\n" );
break;
4827 default: printf( FMT0, iGraphicsMode );
4829 printf(
"\texScale\t\t: %f\n", exScale );
4830 printf(
"\teyScale\t\t: %f\n", eyScale );
4831 printf( FMT1, emrtext.ptlReference.x, emrtext.ptlReference.y );
4832 printf( FMT2, emrtext.nChars );
4833 printf( FMT3, emrtext.offString );
4834 printf(
"\tfOptions\t: " );
4835 if ( emrtext.fOptions == 0 )
4838 if ( emrtext.fOptions & ETO_GRAYED ) {
4839 printf(
"ETO_GRAYED" );
4840 if ( emrtext.fOptions & ~ETO_GRAYED )
4843 if ( emrtext.fOptions & ETO_OPAQUE ) {
4844 printf(
"ETO_OPAQUE" );
4845 if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE) )
4848 if ( emrtext.fOptions & ETO_CLIPPED ) {
4849 printf(
"ETO_CLIPPED" );
4850 if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED ) )
4853 if ( emrtext.fOptions & ETO_GLYPH_INDEX ) {
4854 printf(
"ETO_GLYPH_INDEX" );
4855 if ( emrtext.fOptions &
4856 ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX) )
4859 if ( emrtext.fOptions & ETO_RTLREADING ) {
4860 printf(
"ETO_RTLREADING" );
4861 if ( emrtext.fOptions &
4862 ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX |
4866 if ( emrtext.fOptions & ETO_IGNORELANGUAGE )
4867 printf(
"ETO_IGNORELANGUAGE" );
4870 edit_rectl(
"rcl\t", emrtext.rcl );
4871 printf( FMT4, emrtext.offDx );
4872 printf(
"\tString:\n\t\t" );
4873 if ( emrtext.nChars > 0 ) {
4874 for ( DWORD i = 0; i < emrtext.nChars; ++i ) {
4875 putchar( string_a[i] );
4879 printf(
"<empty>" );
4882 if ( emrtext.offDx != 0 ) {
4883 printf(
"\tOffsets:\n\t\t" );
4884 for (
unsigned int i = 0; i < emrtext.nChars; i++ )
4885 printf(
"%d ", dx_i[i] );
4898 PWSTR string_a{
nullptr };
4901 INT* dx_i{
nullptr };
4913 FLOAT yScale,
const PEMRTEXT text, LPCWSTR
string,
4916 emr.iType = EMR_EXTTEXTOUTW;
4919 rclBounds = *bounds;
4921 iGraphicsMode = graphicsMode;
4927 string_size = ROUND_TO_LONG( emrtext.nChars );
4929 string_a =
new WCHAR[ string_size ];
4931 memset( string_a, 0,
sizeof(WCHAR) * string_size );
4933 for (
unsigned int i=0; i<emrtext.nChars; i++ )
4934 string_a[i] = *
string++;
4936 emrtext.offString = emr.nSize;
4937 emr.nSize += string_size *
sizeof(WCHAR);
4945 int * dxn =
new int [string_size];
4946 for (
unsigned int i=0; i < string_size; i++) dxn[i] = 10;
4953 dx_i =
new INT[ emrtext.nChars ];
4955 for (
unsigned int i=0; i<emrtext.nChars; i++ )
4958 emrtext.offDx = emr.nSize;
4959 emr.nSize += emrtext.nChars *
sizeof(INT);
4972 ds >> emr >> rclBounds >> iGraphicsMode >> exScale >> eyScale >> emrtext;
4974 if ( emrtext.nChars > 0 and emrtext.offString == 0 ) {
4975 throw std::runtime_error(
"Invalid text specification" );
4978 if ( emrtext.nChars > emr.nSize - emrtext.offString ) {
4979 throw std::runtime_error(
"Invalid text specification" );
4982 std::unique_ptr<WCHAR[]> cbuffer;
4983 std::unique_ptr<INT[]> ibuffer;
4985 if ( emrtext.offString != 0 ) {
4986 string_size = ROUND_TO_LONG( emrtext.nChars );
4988 cbuffer.reset(
new WCHAR[string_size] );
4990 memset( cbuffer.get(), 0,
sizeof(WCHAR) * string_size );
4992 WCHARSTR string( cbuffer.get(), string_size );
4997 if ( emrtext.offDx ) {
4998 ibuffer.reset(
new INT[ emrtext.nChars ] );
5000 INTARRAY dx_is( ibuffer.get(), emrtext.nChars );
5005 string_a = cbuffer.release();
5006 dx_i = ibuffer.release();
5014 if ( string_a )
delete[] string_a;
5015 if ( dx_i )
delete[] dx_i;
5022 ds << emr << rclBounds << iGraphicsMode << exScale << eyScale
5023 << emrtext <<
WCHARSTR( string_a, string_size );
5025 ds <<
INTARRAY( dx_i, emrtext.nChars );
5031 int size (
void )
const {
return emr.nSize; }
5041 rect.left = emrtext.rcl.left;
5042 rect.top = emrtext.rcl.top;
5043 rect.right = emrtext.rcl.right;
5044 rect.bottom = emrtext.rcl.bottom;
5046 ExtTextOutW( dc, emrtext.ptlReference.x, emrtext.ptlReference.y,
5047 emrtext.fOptions, &rect, string_a, emrtext.nChars,
5050 #ifdef ENABLE_EDITING
5054 void edit (
void )
const
5056 #if defined(__LP64__)
5057 const char* FMT0 =
"unknown(%d)\n";
5058 const char* FMT1 =
"\tptlReference\t: (%d,%d)\n";
5059 const char* FMT2 =
"\tnChars\t\t: %d\n";
5060 const char* FMT3 =
"\toffString\t: %d\n";
5061 const char* FMT4 =
"\toffDx\t\t: %d\n";
5063 const char* FMT0 =
"unknown(%ld)\n";
5064 const char* FMT1 =
"\tptlReference\t: (%ld,%ld)\n";
5065 const char* FMT2 =
"\tnChars\t\t: %ld\n";
5066 const char* FMT3 =
"\toffString\t: %ld\n";
5067 const char* FMT4 =
"\toffDx\t\t: %ld\n";
5069 printf(
"*EXTTEXTOUTW*\n" );
5070 edit_rectl(
"rclBounds", rclBounds );
5071 printf(
"\tiGraphicsMode\t: " );
5072 switch ( iGraphicsMode ) {
5073 case GM_COMPATIBLE: printf(
"GM_COMPATIBLE\n" );
break;
5074 case GM_ADVANCED: printf(
"GM_ADVANCED\n" );
break;
5075 default: printf( FMT0, iGraphicsMode );
5077 printf(
"\texScale\t\t: %f\n", exScale );
5078 printf(
"\teyScale\t\t: %f\n", eyScale );
5079 printf( FMT1, emrtext.ptlReference.x, emrtext.ptlReference.y );
5080 printf( FMT2, emrtext.nChars );
5081 printf( FMT3, emrtext.offString );
5082 printf(
"\tfOptions\t: " );
5083 if ( emrtext.fOptions == 0 )
5086 if ( emrtext.fOptions & ETO_GRAYED ) {
5087 printf(
"ETO_GRAYED" );
5088 if ( emrtext.fOptions & ~ETO_GRAYED )
5091 if ( emrtext.fOptions & ETO_OPAQUE ) {
5092 printf(
"ETO_OPAQUE" );
5093 if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE) )
5096 if ( emrtext.fOptions & ETO_CLIPPED ) {
5097 printf(
"ETO_CLIPPED" );
5098 if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED ) )
5101 if ( emrtext.fOptions & ETO_GLYPH_INDEX ) {
5102 printf(
"ETO_GLYPH_INDEX" );
5103 if ( emrtext.fOptions &
5104 ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX) )
5107 if ( emrtext.fOptions & ETO_RTLREADING ) {
5108 printf(
"ETO_RTLREADING" );
5109 if ( emrtext.fOptions &
5110 ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX |
5114 if ( emrtext.fOptions & ETO_IGNORELANGUAGE )
5115 printf(
"ETO_IGNORELANGUAGE" );
5118 edit_rectl(
"rcl\t", emrtext.rcl );
5119 printf( FMT4, emrtext.offDx );
5121 if ( emrtext.nChars > 0 ) {
5123 iconv_t cvt = iconv_open(
"UTF-8",
"UTF-16LE" );
5124 std::vector<char> utf8_buffer( emrtext.nChars );
5127 size_t size = emrtext.nChars;
5128 size_t in_bytes_left = emrtext.nChars *
sizeof(*string_a);
5129 size_t converted = 0;
5130 char* in_buffer = (
char*)string_a;
5132 char* out_buffer = &utf8_buffer[converted];
5133 size_t out_bytes_left =
size - converted;
5135 size_t n = iconv( cvt, &in_buffer, &in_bytes_left,
5136 &out_buffer, &out_bytes_left );
5138 converted =
size - out_bytes_left;
5140 if ( n == (
size_t)-1 ) {
5141 if ( errno == E2BIG ) {
5142 size_t new_size = 2 * utf8_buffer.size();
5143 utf8_buffer.resize( new_size );
5144 size = utf8_buffer.size();
5158 if ( converted == utf8_buffer.size() )
5159 utf8_buffer.push_back(
'\0' );
5161 utf8_buffer[converted] =
'\0';
5163 printf(
"\tString:\n\t\t%s\n", utf8_buffer.data() );
5166 puts(
"\tString:\n\t\t<empty>\n" );
5169 if ( emrtext.offDx != 0 and emrtext.nChars > 0 ) {
5170 printf(
"\tOffsets:\n\t\t" );
5171 for (
unsigned int i = 0; i < emrtext.nChars; i++ )
5172 printf(
"%d ", dx_i[i] );
5192 emr.iType = EMR_SETPIXELV;
5204 ds >> emr >> ptlPixel >> crColor;
5211 ds << emr << ptlPixel << crColor;
5217 int size (
void )
const {
return emr.nSize; }
5226 SetPixel( dc, ptlPixel.x, ptlPixel.y, crColor );
5228 #ifdef ENABLE_EDITING
5232 void edit (
void )
const
5234 printf(
"*SETPIXELV*\n" );
5235 edit_pointl(
"ptlPixel", ptlPixel );
5236 edit_color(
"crColor\t", crColor );
5269 ds << emr << ihPen << lopn;
5275 int size (
void )
const {
return emr.nSize; }
5282 #ifdef ENABLE_EDITING
5286 void edit (
void )
const
5288 #if defined(__LP64__)
5289 const char* FMT0 =
"\tihPen\t\t: 0x%x\n";
5290 const char* FMT1 =
"\tlopn.lopnWidth\t: %d, %d\n";
5292 const char* FMT0 =
"\tihPen\t\t: 0x%lx\n";
5293 const char* FMT1 =
"\tlopn.lopnWidth\t: %ld, %ld\n";
5295 printf(
"*CREATEPEN*\n" );
5296 printf( FMT0, ihPen );
5297 edit_pen_style(
"lopn.lopnStyle", lopn.lopnStyle );
5298 printf( FMT1, lopn.lopnWidth.x, lopn.lopnWidth.y );
5299 edit_color(
"lopn.lopnColor", lopn.lopnColor );
5327 ds << emr << ihPen << offBmi << cbBmi << offBits << cbBits << elp;
5333 int size (
void )
const {
return emr.nSize; }
5340 #ifdef ENABLE_EDITING
5344 void edit (
void )
const
5346 #if defined(__LP64__)
5347 const char* FMT0 =
"\tihPen\t\t\t: 0x%x\n";
5348 const char* FMT1 =
"\toffBmi\t\t\t: %d\n";
5349 const char* FMT2 =
"\tcbBmi\t\t\t: %d\n";
5350 const char* FMT3 =
"\toffBits\t\t\t: %d\n";
5351 const char* FMT4 =
"\tcbBits\t\t\t: %d\n";
5352 const char* FMT5 =
"\telp.elpWidth\t\t: %d\n";
5353 const char* FMT6 =
"\telp.elpNumEntries\t: %d\n";
5355 const char* FMT0 =
"\tihPen\t\t\t: 0x%lx\n";
5356 const char* FMT1 =
"\toffBmi\t\t\t: %ld\n";
5357 const char* FMT2 =
"\tcbBmi\t\t\t: %ld\n";
5358 const char* FMT3 =
"\toffBits\t\t\t: %ld\n";
5359 const char* FMT4 =
"\tcbBits\t\t\t: %ld\n";
5360 const char* FMT5 =
"\telp.elpWidth\t\t: %ld\n";
5361 const char* FMT6 =
"\telp.elpNumEntries\t: %ld\n";
5363 printf(
"*EXTCREATEPEN*\n" );
5364 printf( FMT0, ihPen );
5365 printf( FMT1, offBmi );
5366 printf( FMT2, cbBmi );
5367 printf( FMT3, offBits );
5368 printf( FMT4, cbBits );
5369 edit_pen_style(
"elp.elpPenStyle\t", elp.elpPenStyle );
5370 printf( FMT5, elp.elpWidth );
5371 edit_brush_style(
"elp.elpBrushStyle", elp.elpBrushStyle );
5372 edit_color(
"elp.elpColor\t", elp.elpColor );
5373 edit_brush_hatch(
"elp.elpHatch\t", elp.elpHatch );
5374 printf( FMT6, elp.elpNumEntries );
5401 ds << emr << ihBrush << lb;
5407 int size (
void )
const {
return emr.nSize; }
5414 #ifdef ENABLE_EDITING
5418 void edit (
void )
const
5420 #if defined(__LP64__)
5421 const char* FMT =
"\tihBrush\t\t: 0x%x\n";
5423 const char* FMT =
"\tihBrush\t\t: 0x%lx\n";
5425 printf(
"*CREATEBRUSHINDIRECT*\n" );
5426 printf( FMT, ihBrush );
5427 edit_brush_style(
"lb.lbStyle", lb.lbStyle );
5428 edit_color(
"lb.lbColor", lb.lbColor );
5429 edit_brush_hatch(
"lb.lbHatch", lb.lbHatch );
5460 ds << emr << ihFont << elfw <<
PADDING( 2 );
5467 int size (
void )
const {
return emr.nSize; }
5474 #ifdef ENABLE_EDITING
5478 void edit (
void )
const
5480 #if defined(__LP64__)
5481 const char* FMT0 =
"\tihFont\t\t\t: %d\n";
5482 const char* FMT1 =
"\tlfHeight\t\t: %d\n";
5483 const char* FMT2 =
"\tlfWidth\t\t\t: %d\n";
5484 const char* FMT3 =
"\tlfEscapement\t\t: %d\n";
5485 const char* FMT4 =
"\tlfOrientation\t\t: %d\n";
5486 const char* FMT5 =
"\telfVersion\t\t: %d\n";
5487 const char* FMT6 =
"\telfStyleSize\t\t: %d\n";
5488 const char* FMT7 =
"\telfMatch\t\t: %d\n";
5489 const char* FMT8 =
"\telfCulture\t\t: %d\n";
5491 const char* FMT0 =
"\tihFont\t\t\t: %ld\n";
5492 const char* FMT1 =
"\tlfHeight\t\t: %ld\n";
5493 const char* FMT2 =
"\tlfWidth\t\t\t: %ld\n";
5494 const char* FMT3 =
"\tlfEscapement\t\t: %ld\n";
5495 const char* FMT4 =
"\tlfOrientation\t\t: %ld\n";
5496 const char* FMT5 =
"\telfVersion\t\t: %ld\n";
5497 const char* FMT6 =
"\telfStyleSize\t\t: %ld\n";
5498 const char* FMT7 =
"\telfMatch\t\t: %ld\n";
5499 const char* FMT8 =
"\telfCulture\t\t: %ld\n";
5501 printf(
"*EXTCREATEFONTINDIRECTW*\n" );
5502 printf( FMT0, ihFont );
5503 printf( FMT1, elfw.elfLogFont.lfHeight );
5504 printf( FMT2, elfw.elfLogFont.lfWidth );
5505 printf( FMT3, elfw.elfLogFont.lfEscapement );
5506 printf( FMT4, elfw.elfLogFont.lfOrientation );
5507 printf(
"\tlfWeight\t\t: " );
5508 switch ( elfw.elfLogFont.lfWeight ) {
5509 case FW_DONTCARE: printf(
"FW_DONTCARE\n" );
break;
5510 case FW_THIN: printf(
"FW_THIN\n" );
break;
5511 case FW_EXTRALIGHT: printf(
"FW_EXTRALIGHT\n" );
break;
5512 case FW_LIGHT: printf(
"FW_LIGHT\n" );
break;
5513 case FW_NORMAL: printf(
"FW_NORMAL\n" );
break;
5514 case FW_MEDIUM: printf(
"FW_MEDIUM\n" );
break;
5515 case FW_SEMIBOLD: printf(
"FW_SEMIBOLD\n" );
break;
5516 case FW_BOLD: printf(
"FW_BOLD\n" );
break;
5517 case FW_EXTRABOLD: printf(
"FW_EXTRABOLD\n" );
break;
5518 case FW_BLACK: printf(
"FW_BLACK\n" );
break;
5520 printf(
"\tlfItalic\t\t: %d\n", elfw.elfLogFont.lfItalic );
5521 printf(
"\tlfUnderline\t\t: %d\n", elfw.elfLogFont.lfUnderline );
5522 printf(
"\tlfStrikeOut\t\t: %d\n", elfw.elfLogFont.lfStrikeOut );
5523 printf(
"\tlfCharSet\t\t: %d\n", elfw.elfLogFont.lfCharSet );
5524 printf(
"\tlfOutPrecision\t\t: %d\n", elfw.elfLogFont.lfOutPrecision );
5525 printf(
"\tlfClipPrecision\t\t: %d\n", elfw.elfLogFont.lfClipPrecision );
5526 printf(
"\tlfQuality\t\t: %d\n", elfw.elfLogFont.lfQuality );
5527 printf(
"\tlfPitchAndFamily\t: %d\n", elfw.elfLogFont.lfPitchAndFamily );
5529 printf(
"\tlfFaceName\t\t: '" );
5530 while ( elfw.elfLogFont.lfFaceName[i] != 0 && i < LF_FACESIZE ) {
5531 putchar( elfw.elfLogFont.lfFaceName[i] );
5537 printf(
"\telfFullName\t\t: '" );
5538 while ( elfw.elfFullName[i] != 0 && i < LF_FULLFACESIZE ) {
5539 putchar( elfw.elfFullName[i] );
5545 printf(
"\telfStyle\t\t: '" );
5546 while ( elfw.elfStyle[i] != 0 && i < LF_FACESIZE ) {
5547 putchar( elfw.elfStyle[i] );
5552 printf( FMT5, elfw.elfVersion );
5553 printf( FMT6, elfw.elfStyleSize );
5554 printf( FMT7, elfw.elfMatch );
5555 printf(
"\telfVendorId\t\t: '%s'\n", elfw.elfVendorId );
5556 printf( FMT8, elfw.elfCulture );
5557 printf(
"\telfPanose\t\t:\n" );
5558 printf(
"\t\tbFamilyType\t\t: %d\n", elfw.elfPanose.bFamilyType );
5559 printf(
"\t\tbSerifStyle\t\t: %d\n", elfw.elfPanose.bSerifStyle );
5560 printf(
"\t\tbWeight\t\t\t: %d\n", elfw.elfPanose.bWeight );
5561 printf(
"\t\tbProportion\t\t: %d\n", elfw.elfPanose.bProportion );
5562 printf(
"\t\tbContrast\t\t: %d\n", elfw.elfPanose.bContrast );
5563 printf(
"\t\tbStrokeVariation\t: %d\n", elfw.elfPanose.bStrokeVariation );
5564 printf(
"\t\tbArmStyle\t\t: %d\n", elfw.elfPanose.bArmStyle );
5565 printf(
"\t\tbLetterform\t\t: %d\n", elfw.elfPanose.bLetterform );
5566 printf(
"\t\tbMidline\t\t: %d\n", elfw.elfPanose.bMidline );
5567 printf(
"\t\tbXHeight\t\t: %d\n", elfw.elfPanose.bXHeight );
5594 ds << emr << ihPal << lgpl;
5600 int size (
void )
const {
return emr.nSize; }
5607 #ifdef ENABLE_EDITING
5611 void edit (
void )
const
5613 printf(
"*CREATEPALETTE* (not really handled by libEMF)\n" );
5629 emr.iType = EMR_FILLPATH;
5631 rclBounds = *bounds;
5639 ds >> emr >> rclBounds;
5646 ds << emr << rclBounds;
5652 int size (
void )
const {
return emr.nSize; }
5663 #ifdef ENABLE_EDITING
5667 void edit (
void )
const
5669 printf(
"*FILLPATH*\n" );
5670 edit_rectl(
"rclBounds", rclBounds );
5685 emr.iType = EMR_STROKEPATH;
5687 rclBounds = *bounds;
5695 ds >> emr >> rclBounds;
5702 ds << emr << rclBounds;
5708 int size (
void )
const {
return emr.nSize; }
5719 #ifdef ENABLE_EDITING
5723 void edit (
void )
const
5725 printf(
"*STROKEPATH*\n" );
5726 edit_rectl(
"rclBounds", rclBounds );
5741 emr.iType = EMR_STROKEANDFILLPATH;
5743 rclBounds = *bounds;
5751 ds >> emr >> rclBounds;
5758 ds << emr << rclBounds;
5764 int size (
void )
const {
return emr.nSize; }
5773 StrokeAndFillPath( dc );
5775 #ifdef ENABLE_EDITING
5779 void edit (
void )
const
5781 printf(
"*STROKEANDFILLPATH*\n" );
5782 edit_rectl(
"rclBounds", rclBounds );
5797 emr.iType = EMR_BEGINPATH;
5819 int size (
void )
const {
return emr.nSize; }
5830 #ifdef ENABLE_EDITING
5834 void edit (
void )
const
5836 printf(
"*BEGINPATH*\n" );
5851 emr.iType = EMR_ENDPATH;
5873 int size (
void )
const {
return emr.nSize; }
5884 #ifdef ENABLE_EDITING
5888 void edit (
void )
const
5890 printf(
"*ENDPATH*\n" );
5905 emr.iType = EMR_CLOSEFIGURE;
5927 int size (
void )
const {
return emr.nSize; }
5938 #ifdef ENABLE_EDITING
5942 void edit (
void )
const
5944 printf(
"*CLOSEFIGURE*\n" );
5960 emr.iType = EMR_SAVEDC;
5982 int size (
void )
const {
return emr.nSize; }
5993 #ifdef ENABLE_EDITING
5997 void edit (
void )
const
5999 printf(
"*SAVEDC*\n" );
6014 emr.iType = EMR_RESTOREDC;
6024 ds >> emr >> iRelative;
6031 ds << emr << iRelative;
6037 int size (
void )
const {
return emr.nSize; }
6046 RestoreDC( dc, iRelative );
6048 #ifdef ENABLE_EDITING
6052 void edit (
void )
const
6054 #if defined(__LP64__)
6055 const char* FMT =
"\tiRelative: %d\n";
6057 const char* FMT =
"\tiRelative: %ld\n";
6059 printf(
"*RESTOREDC*\n" );
6060 printf( FMT, iRelative );
6075 emr.iType = EMR_SETMETARGN;
6097 int size (
void )
const {
return emr.nSize; }
6108 #ifdef ENABLE_EDITING
6112 void edit (
void )
const
6114 printf(
"*SETMETARGN*\n" );
6130 lopnStyle = lpen->lopnStyle;
6131 lopnWidth = lpen->lopnWidth;
6132 lopnColor = lpen->lopnColor;
6137 OBJECTTYPE
getType (
void )
const {
return O_PEN; }
6162 elpPenStyle = lpen->elpPenStyle;
6163 elpWidth = lpen->elpWidth;
6164 elpBrushStyle = lpen->elpBrushStyle;
6165 elpColor = lpen->elpColor;
6166 elpHatch = lpen->elpHatch;
6168 elpStyleEntry[0] = 0;
6173 OBJECTTYPE
getType (
void )
const {
return O_EXTPEN; }
6198 lbStyle = lbrush->lbStyle;
6199 lbColor = lbrush->lbColor;
6200 lbHatch = lbrush->lbHatch;
6205 OBJECTTYPE
getType (
void )
const {
return O_BRUSH; }
6230 this->elfLogFont = *lfont;
6233 memset( &elfFullName, 0,
sizeof elfFullName );
6234 memset( &elfStyle, 0,
sizeof elfStyle );
6235 elfVersion = ELF_VERSION;
6239 memset( &elfVendorId, 0,
sizeof elfVendorId );
6240 elfCulture = ELF_CULTURE_LATIN;
6241 memset( &elfPanose, 1,
sizeof(PANOSE) );
6246 OBJECTTYPE
getType (
void )
const {
return O_FONT; }
6271 EMF_UNUSED(lpalette);
6274 PALETTEENTRY zero_entry = { 0, 0, 0, 0 };
6275 palPalEntry[0] = zero_entry;
6280 OBJECTTYPE
getType (
void )
const {
return O_PALETTE; }
6305 emr.iType = EMR_SETMITERLIMIT;
6307 eMiterLimit = limit;
6316 ds >> emr >> miter_limit;
6317 eMiterLimit = float(miter_limit);
6324 ds << emr << (int)eMiterLimit;
6330 int size (
void )
const {
return emr.nSize; }
6339 SetMiterLimit( dc, eMiterLimit, 0 );
6341 #ifdef ENABLE_EDITING
6345 void edit (
void )
const
6347 printf(
"*SETMITERLIMIT*\n" );
6348 printf(
"\teMiterLimit\t: %f\n", eMiterLimit );
6368 void init (
const RECT* size, LPCWSTR description_w ) {
6385 header->rclFrame.left = size->left;
6386 header->rclFrame.top = size->top;
6387 header->rclFrame.right = size->right;
6388 header->rclFrame.bottom = size->bottom;
6391 size->left *
header->szlDevice.cx / (
header->szlMillimeters.cx * 100 );
6393 size->top *
header->szlDevice.cy / (
header->szlMillimeters.cy * 100 );
6394 header->rclBounds.right =
6395 size->right *
header->szlDevice.cx / (
header->szlMillimeters.cx * 100 );
6396 header->rclBounds.bottom =
6397 size->bottom *
header->szlDevice.cy / (
header->szlMillimeters.cy * 100 );
6402 header->rclBounds.left = -10;
6403 header->rclBounds.top = -10;
6404 header->rclBounds.right = 10;
6405 header->rclBounds.bottom = 10;
6407 header->rclFrame.left = (LONG)floor( (
float)
header->rclBounds.left *
6408 header->szlMillimeters.cx * 100 /
header->szlDevice.cx );
6409 header->rclFrame.top = (LONG)floor( (
float)
header->rclBounds.top *
6410 header->szlMillimeters.cy * 100 /
header->szlDevice.cy );
6411 header->rclFrame.right = (LONG)ceil( (
float)
header->rclBounds.right *
6412 header->szlMillimeters.cx * 100 /
header->szlDevice.cx );
6413 header->rclFrame.bottom = (LONG)ceil( (
float)
header->rclBounds.bottom *
6414 header->szlMillimeters.cy * 100 /
header->szlDevice.cy );
6419 SIZEL default_resolution = { RESOLUTION, RESOLUTION };
6421 SIZEL default_viewport_ext = { 1, 1 };
6423 POINT default_viewport_org = { 0, 0 };
6425 SIZEL default_window_ext = { 1, 1 };
6427 POINT default_window_org = { 0, 0 };
6433 pen = (
PEN*)globalObjects.
find( BLACK_PEN | ENHMETA_STOCK_OBJECT );
6434 brush = (
BRUSH*)globalObjects.
find( BLACK_BRUSH | ENHMETA_STOCK_OBJECT );
6435 font = (
FONT*)globalObjects.
find( DEVICE_DEFAULT_FONT | ENHMETA_STOCK_OBJECT);
6515 LPCWSTR description_w )
6516 :
fp(fp_),
ds( fp_ )
6518 init( size, description_w );
6534 OBJECTTYPE
getType (
void )
const {
return O_METAFILEDEVICECONTEXT; }
6541 for (
unsigned int i = 1; i <
handles.size(); i++ ) {
6622 device_point.x = (LONG)( (
float)( p.x -
window_org.x ) / window_width *
6625 device_point.y = (LONG)( (
float)( p.y -
window_org.y ) / window_height *
6634 int device_width =
header->szlDevice.cx <= 0 ? 1 :
header->szlDevice.cx;
6635 header->rclFrame.left = (LONG)floor( (
float)
header->rclBounds.left *
6636 header->szlMillimeters.cx * 100 / device_width );
6643 int device_width =
header->szlDevice.cx <= 0 ? 1 :
header->szlDevice.cx;
6644 header->rclFrame.right = (LONG)ceil( (
float)
header->rclBounds.right *
6645 header->szlMillimeters.cx * 100 / device_width );
6653 int device_height =
header->szlDevice.cy <= 0 ? 1 :
header->szlDevice.cy;
6654 header->rclFrame.top = (LONG)floor( (
float)
header->rclBounds.top *
6655 header->szlMillimeters.cy * 100 / device_height );
6662 int device_height =
header->szlDevice.cy <= 0 ? 1 :
header->szlDevice.cy;
6663 header->rclFrame.bottom = (LONG)ceil( (
float)
header->rclBounds.bottom *
6664 header->szlMillimeters.cy * 100 / device_height );
Graphics Brush.
Definition: libemf.h:6191
OBJECTTYPE getType(void) const
Definition: libemf.h:6205
BRUSH(const LOGBRUSH *lbrush)
Definition: libemf.h:6196
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6212
Support different endian modes when reading and writing the metafile.
Definition: libemf.h:225
DATASTREAM & operator>>(BYTE &byte)
Definition: libemf.h:253
void setStream(::FILE *fp)
Definition: libemf.h:239
DATASTREAM & operator<<(const BYTE &byte)
Definition: libemf.h:244
DATASTREAM(::FILE *fp=0)
Definition: libemf.h:234
EMF Arc To.
Definition: libemf.h:2996
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3048
bool serialize(DATASTREAM ds)
Definition: libemf.h:3034
EMRARCTO(INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
Definition: libemf.h:3009
EMRARCTO(DATASTREAM &ds)
Definition: libemf.h:3027
int size(void) const
Definition: libemf.h:3042
EMF Arc.
Definition: libemf.h:2920
EMRARC(INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
Definition: libemf.h:2933
bool serialize(DATASTREAM ds)
Definition: libemf.h:2958
EMRARC(DATASTREAM &ds)
Definition: libemf.h:2951
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2972
int size(void) const
Definition: libemf.h:2966
EMF Begin Path.
Definition: libemf.h:5790
EMRBEGINPATH(DATASTREAM &ds)
Definition: libemf.h:5804
EMRBEGINPATH(void)
Definition: libemf.h:5795
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5825
int size(void) const
Definition: libemf.h:5819
bool serialize(DATASTREAM ds)
Definition: libemf.h:5811
EMF Brush.
Definition: libemf.h:5384
int size(void) const
Definition: libemf.h:5407
bool serialize(DATASTREAM ds)
Definition: libemf.h:5399
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.cpp:633
EMRCREATEBRUSHINDIRECT(BRUSH *brush, HGDIOBJ handle)
Definition: libemf.cpp:625
EMF Palette.
Definition: libemf.h:5577
EMRCREATEPALETTE(PALETTE *palette, HGDIOBJ handle)
Definition: libemf.cpp:680
int size(void) const
Definition: libemf.h:5600
bool serialize(DATASTREAM ds)
Definition: libemf.h:5592
EMRCREATEPALETTE(DATASTREAM &ds)
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.cpp:688
EMF Pen.
Definition: libemf.h:5252
EMRCREATEPEN(PEN *pen, HGDIOBJ handle)
Definition: libemf.cpp:532
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.cpp:575
bool serialize(DATASTREAM ds)
Definition: libemf.h:5267
int size(void) const
Definition: libemf.h:5275
EMF Delete Object.
Definition: libemf.h:2744
bool serialize(DATASTREAM ds)
Definition: libemf.h:2766
EMRDELETEOBJECT(DATASTREAM &ds)
Definition: libemf.h:2759
EMRDELETEOBJECT(HGDIOBJ object)
Definition: libemf.h:2749
int size(void) const
Definition: libemf.h:2774
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.cpp:555
EMF Ellipse.
Definition: libemf.h:3135
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3178
bool serialize(DATASTREAM ds)
Definition: libemf.h:3164
EMRELLIPSE(INT left, INT top, INT right, INT bottom)
Definition: libemf.h:3144
int size(void) const
Definition: libemf.h:3172
EMRELLIPSE(DATASTREAM &ds)
Definition: libemf.h:3157
EMF End Path.
Definition: libemf.h:5844
bool serialize(DATASTREAM ds)
Definition: libemf.h:5865
int size(void) const
Definition: libemf.h:5873
EMRENDPATH(void)
Definition: libemf.h:5849
EMRENDPATH(DATASTREAM &ds)
Definition: libemf.h:5858
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5879
EMF End of File Record.
Definition: libemf.h:1677
int size(void) const
Definition: libemf.h:1711
bool serialize(DATASTREAM ds)
Definition: libemf.h:1703
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:1717
EMREOF(DATASTREAM &ds)
Definition: libemf.h:1695
EMREOF(void)
Definition: libemf.h:1682
EMF Font.
Definition: libemf.h:5439
bool serialize(DATASTREAM ds)
Definition: libemf.h:5454
int size(void) const
Definition: libemf.h:5467
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.cpp:666
EMREXTCREATEFONTINDIRECTW(FONT *font, HGDIOBJ handle)
Definition: libemf.cpp:652
EMF Extended Pen.
Definition: libemf.h:5310
int size(void) const
Definition: libemf.h:5333
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.cpp:600
EMREXTCREATEPEN(EXTPEN *pen, HGDIOBJ handle)
Definition: libemf.cpp:588
bool serialize(DATASTREAM ds)
Definition: libemf.h:5325
EMF Extended Text Output ASCII.
Definition: libemf.h:4649
EMREXTTEXTOUTA(DATASTREAM &ds)
Definition: libemf.h:4722
bool serialize(DATASTREAM ds)
Definition: libemf.h:4772
~EMREXTTEXTOUTA()
Definition: libemf.h:4764
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4789
int size(void) const
Definition: libemf.h:4783
EMREXTTEXTOUTA(const RECTL *bounds, DWORD graphicsMode, FLOAT xScale, FLOAT yScale, const PEMRTEXT text, LPCSTR string, const INT *dx)
Definition: libemf.h:4664
EMF Extended Text Output Wide character.
Definition: libemf.h:4897
bool serialize(DATASTREAM ds)
Definition: libemf.h:5020
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5037
~EMREXTTEXTOUTW()
Definition: libemf.h:5012
EMREXTTEXTOUTW(const RECTL *bounds, DWORD graphicsMode, FLOAT xScale, FLOAT yScale, const PEMRTEXT text, LPCWSTR string, const INT *dx)
Definition: libemf.h:4912
int size(void) const
Definition: libemf.h:5031
EMREXTTEXTOUTW(DATASTREAM &ds)
Definition: libemf.h:4970
EMF Fill path.
Definition: libemf.h:5622
EMRFILLPATH(DATASTREAM &ds)
Definition: libemf.h:5637
bool serialize(DATASTREAM ds)
Definition: libemf.h:5644
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5658
int size(void) const
Definition: libemf.h:5652
EMRFILLPATH(const RECTL *bounds)
Definition: libemf.h:5627
EMF Line To.
Definition: libemf.h:2861
bool serialize(DATASTREAM ds)
Definition: libemf.h:2885
EMRLINETO(DATASTREAM &ds)
Definition: libemf.h:2878
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2899
EMRLINETO(INT x, INT y)
Definition: libemf.h:2867
int size(void) const
Definition: libemf.h:2893
EMF MoveTo (ex)
Definition: libemf.h:2802
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2840
EMRMOVETOEX(INT x, INT y)
Definition: libemf.h:2808
int size(void) const
Definition: libemf.h:2834
EMRMOVETOEX(DATASTREAM &ds)
Definition: libemf.h:2819
bool serialize(DATASTREAM ds)
Definition: libemf.h:2826
EMF Polybezier16.
Definition: libemf.h:4097
int size(void) const
Definition: libemf.h:4188
EMRPOLYBEZIER16(DATASTREAM &ds)
Definition: libemf.h:4153
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4194
~EMRPOLYBEZIER16()
Definition: libemf.h:4173
EMRPOLYBEZIER16(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4130
bool serialize(DATASTREAM ds)
Definition: libemf.h:4180
EMRPOLYBEZIER16(const RECTL *bounds, const POINT16 *points, INT n)
Definition: libemf.h:4105
EMF PolyBezierTo16.
Definition: libemf.h:4312
EMRPOLYBEZIERTO16(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4345
bool serialize(DATASTREAM ds)
Definition: libemf.h:4395
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4409
EMRPOLYBEZIERTO16(DATASTREAM &ds)
Definition: libemf.h:4368
int size(void) const
Definition: libemf.h:4403
EMRPOLYBEZIERTO16(const RECTL *bounds, const POINT16 *points, INT n)
Definition: libemf.h:4320
~EMRPOLYBEZIERTO16()
Definition: libemf.h:4388
EMF PolyBezierTo.
Definition: libemf.h:4217
~EMRPOLYBEZIERTO()
Definition: libemf.h:4268
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4289
int size(void) const
Definition: libemf.h:4283
bool serialize(DATASTREAM ds)
Definition: libemf.h:4275
EMRPOLYBEZIERTO(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4225
EMRPOLYBEZIERTO(DATASTREAM &ds)
Definition: libemf.h:4248
EMF Polybezier.
Definition: libemf.h:4002
EMRPOLYBEZIER(DATASTREAM &ds)
Definition: libemf.h:4033
int size(void) const
Definition: libemf.h:4068
~EMRPOLYBEZIER()
Definition: libemf.h:4053
bool serialize(DATASTREAM ds)
Definition: libemf.h:4060
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4074
EMRPOLYBEZIER(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4010
EMF Filled Polygon16.
Definition: libemf.h:3508
~EMRPOLYGON16()
Definition: libemf.h:3584
EMRPOLYGON16(const RECTL *bounds, const POINT16 *points, INT16 n)
Definition: libemf.h:3541
bool serialize(DATASTREAM ds)
Definition: libemf.h:3591
int size(void) const
Definition: libemf.h:3599
EMRPOLYGON16(DATASTREAM &ds)
Definition: libemf.h:3564
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3605
EMRPOLYGON16(const RECTL *bounds, const POINT *points, INT16 n)
Definition: libemf.h:3516
EMF Filled Polygon.
Definition: libemf.h:3413
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3485
int size(void) const
Definition: libemf.h:3479
EMRPOLYGON(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:3421
bool serialize(DATASTREAM ds)
Definition: libemf.h:3471
EMRPOLYGON(DATASTREAM &ds)
Definition: libemf.h:3444
~EMRPOLYGON()
Definition: libemf.h:3464
EMF Polyline16.
Definition: libemf.h:3293
bool serialize(DATASTREAM ds)
Definition: libemf.h:3376
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3390
EMRPOLYLINE16(const RECTL *bounds, const POINT16 *points, INT n)
Definition: libemf.h:3301
EMRPOLYLINE16(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:3326
EMRPOLYLINE16(DATASTREAM &ds)
Definition: libemf.h:3356
int size(void) const
Definition: libemf.h:3384
~EMRPOLYLINE16()
Definition: libemf.h:3348
EMF PolylineTo16.
Definition: libemf.h:4527
EMRPOLYLINETO16(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4560
EMRPOLYLINETO16(DATASTREAM &ds)
Definition: libemf.h:4583
bool serialize(DATASTREAM ds)
Definition: libemf.h:4610
~EMRPOLYLINETO16()
Definition: libemf.h:4603
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4624
EMRPOLYLINETO16(const RECTL *bounds, const POINT16 *points, INT n)
Definition: libemf.h:4535
int size(void) const
Definition: libemf.h:4618
EMF PolylineTo.
Definition: libemf.h:4432
EMRPOLYLINETO(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:4440
~EMRPOLYLINETO()
Definition: libemf.h:4483
EMRPOLYLINETO(DATASTREAM &ds)
Definition: libemf.h:4463
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:4504
bool serialize(DATASTREAM ds)
Definition: libemf.h:4490
int size(void) const
Definition: libemf.h:4498
EMF Polyline.
Definition: libemf.h:3199
int size(void) const
Definition: libemf.h:3264
bool serialize(DATASTREAM ds)
Definition: libemf.h:3256
EMRPOLYLINE(const RECTL *bounds, const POINT *points, INT n)
Definition: libemf.h:3207
~EMRPOLYLINE()
Definition: libemf.h:3229
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3270
EMRPOLYLINE(DATASTREAM &ds)
Definition: libemf.h:3237
EMF Poly Polygon16.
Definition: libemf.h:3797
int size(void) const
Definition: libemf.h:3944
bool serialize(DATASTREAM ds)
Definition: libemf.h:3935
EMRPOLYPOLYGON16(const RECTL *bounds, const POINT16 *points, const INT *counts, UINT16 polygons)
Definition: libemf.h:3848
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3950
EMRPOLYPOLYGON16(DATASTREAM &ds)
Definition: libemf.h:3894
EMRPOLYPOLYGON16(const RECTL *bounds, const POINT *points, const INT *counts, UINT polygons)
Definition: libemf.h:3807
~EMRPOLYPOLYGON16()
Definition: libemf.h:3885
EMF Poly Polygon.
Definition: libemf.h:3628
EMRPOLYPOLYGON(DATASTREAM &ds)
Definition: libemf.h:3684
EMRPOLYPOLYGON(const RECTL *bounds, const POINT *points, const INT *counts, UINT polygons)
Definition: libemf.h:3638
bool serialize(DATASTREAM ds)
Definition: libemf.h:3726
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3741
int size(void) const
Definition: libemf.h:3735
~EMRPOLYPOLYGON()
Definition: libemf.h:3675
EMF Rectangle.
Definition: libemf.h:3072
EMRRECTANGLE(DATASTREAM &ds)
Definition: libemf.h:3093
bool serialize(DATASTREAM ds)
Definition: libemf.h:3100
int size(void) const
Definition: libemf.h:3108
EMRRECTANGLE(INT left, INT top, INT right, INT bottom)
Definition: libemf.h:3080
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:3114
EMF Restore DC.
Definition: libemf.h:6007
EMRRESTOREDC(INT n)
Definition: libemf.h:6012
EMRRESTOREDC(DATASTREAM &ds)
Definition: libemf.h:6022
int size(void) const
Definition: libemf.h:6037
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:6043
bool serialize(DATASTREAM ds)
Definition: libemf.h:6029
EMF Save DC.
Definition: libemf.h:5953
EMRSAVEDC(DATASTREAM &ds)
Definition: libemf.h:5967
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5988
int size(void) const
Definition: libemf.h:5982
EMRSAVEDC(void)
Definition: libemf.h:5958
bool serialize(DATASTREAM ds)
Definition: libemf.h:5974
EMF Scale Viewport Extents (ex)
Definition: libemf.h:1925
EMRSCALEVIEWPORTEXTEX(DATASTREAM &ds)
Definition: libemf.h:1946
int size(void) const
Definition: libemf.h:1961
EMRSCALEVIEWPORTEXTEX(LONG x_num, LONG x_den, LONG y_num, LONG y_den)
Definition: libemf.h:1933
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:1967
bool serialize(DATASTREAM ds)
Definition: libemf.h:1953
EMF Scale Window Extents (ex)
Definition: libemf.h:2065
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2107
bool serialize(DATASTREAM ds)
Definition: libemf.h:2093
int size(void) const
Definition: libemf.h:2101
EMRSCALEWINDOWEXTEX(DATASTREAM &ds)
Definition: libemf.h:2086
EMRSCALEWINDOWEXTEX(LONG x_num, LONG x_den, LONG y_num, LONG y_den)
Definition: libemf.h:2073
EMF Select Object.
Definition: libemf.h:2686
EMRSELECTOBJECT(HGDIOBJ object)
Definition: libemf.h:2691
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.cpp:540
bool serialize(DATASTREAM ds)
Definition: libemf.h:2708
EMRSELECTOBJECT(DATASTREAM &ds)
Definition: libemf.h:2701
int size(void) const
Definition: libemf.h:2716
EMF Set Background Color.
Definition: libemf.h:2420
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2456
int size(void) const
Definition: libemf.h:2450
EMRSETBKCOLOR(COLORREF color)
Definition: libemf.h:2425
EMRSETBKCOLOR(DATASTREAM &ds)
Definition: libemf.h:2435
bool serialize(DATASTREAM ds)
Definition: libemf.h:2442
EMF Set Background Mode.
Definition: libemf.h:2478
EMRSETBKMODE(DWORD mode)
Definition: libemf.h:2483
int size(void) const
Definition: libemf.h:2508
bool serialize(DATASTREAM ds)
Definition: libemf.h:2500
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2514
EMRSETBKMODE(DATASTREAM &ds)
Definition: libemf.h:2493
EMF Set Mapping Mode.
Definition: libemf.h:2613
EMRSETMAPMODE(DWORD mode)
Definition: libemf.h:2618
EMRSETMAPMODE(DATASTREAM &ds)
Definition: libemf.h:2628
int size(void) const
Definition: libemf.h:2643
bool serialize(DATASTREAM ds)
Definition: libemf.h:2635
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2649
EMF SetMiterLimit.
Definition: libemf.h:6298
bool serialize(DATASTREAM ds)
Definition: libemf.h:6322
EMRSETMITERLIMIT(FLOAT limit)
Definition: libemf.h:6303
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:6336
int size(void) const
Definition: libemf.h:6330
EMRSETMITERLIMIT(DATASTREAM &ds)
Definition: libemf.h:6313
EMF Set Pixel.
Definition: libemf.h:5183
EMRSETPIXELV(DATASTREAM &ds)
Definition: libemf.h:5202
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5223
bool serialize(DATASTREAM ds)
Definition: libemf.h:5209
EMRSETPIXELV(INT x, INT y, COLORREF color)
Definition: libemf.h:5190
int size(void) const
Definition: libemf.h:5217
EMF Set the Polygon Fill Mode.
Definition: libemf.h:2545
bool serialize(DATASTREAM ds)
Definition: libemf.h:2567
EMRSETPOLYFILLMODE(DATASTREAM &ds)
Definition: libemf.h:2560
int size(void) const
Definition: libemf.h:2575
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2581
EMRSETPOLYFILLMODE(DWORD mode)
Definition: libemf.h:2550
EMF Set Text Alignment.
Definition: libemf.h:2277
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2313
bool serialize(DATASTREAM ds)
Definition: libemf.h:2299
int size(void) const
Definition: libemf.h:2307
EMRSETTEXTALIGN(DATASTREAM &ds)
Definition: libemf.h:2292
EMRSETTEXTALIGN(UINT mode)
Definition: libemf.h:2282
EMF Set Text Color.
Definition: libemf.h:2363
EMRSETTEXTCOLOR(DATASTREAM &ds)
Definition: libemf.h:2378
EMRSETTEXTCOLOR(COLORREF color)
Definition: libemf.h:2368
bool serialize(DATASTREAM ds)
Definition: libemf.h:2385
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2399
int size(void) const
Definition: libemf.h:2393
EMF Set Viewport Extents (ex)
Definition: libemf.h:1864
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:1902
int size(void) const
Definition: libemf.h:1896
EMRSETVIEWPORTEXTEX(INT cx, INT cy)
Definition: libemf.h:1870
bool serialize(DATASTREAM ds)
Definition: libemf.h:1888
EMRSETVIEWPORTEXTEX(DATASTREAM &ds)
Definition: libemf.h:1881
EMF Set Viewport Origin (ex)
Definition: libemf.h:1740
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:1778
EMRSETVIEWPORTORGEX(INT x, INT y)
Definition: libemf.h:1746
bool serialize(DATASTREAM ds)
Definition: libemf.h:1764
EMRSETVIEWPORTORGEX(DATASTREAM &ds)
Definition: libemf.h:1757
int size(void) const
Definition: libemf.h:1772
EMF Set Window Extent (ex)
Definition: libemf.h:2004
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:2042
bool serialize(DATASTREAM ds)
Definition: libemf.h:2028
EMRSETWINDOWEXTEX(DATASTREAM &ds)
Definition: libemf.h:2021
EMRSETWINDOWEXTEX(INT cx, INT cy)
Definition: libemf.h:2010
int size(void) const
Definition: libemf.h:2036
EMF Set Window Origin (ex)
Definition: libemf.h:1803
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:1841
bool serialize(DATASTREAM ds)
Definition: libemf.h:1827
int size(void) const
Definition: libemf.h:1835
EMRSETWINDOWORGEX(INT x, INT y)
Definition: libemf.h:1809
EMRSETWINDOWORGEX(DATASTREAM &ds)
Definition: libemf.h:1820
EMF Stroke and Fill path.
Definition: libemf.h:5734
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5770
EMRSTROKEANDFILLPATH(DATASTREAM &ds)
Definition: libemf.h:5749
EMRSTROKEANDFILLPATH(const RECTL *bounds)
Definition: libemf.h:5739
bool serialize(DATASTREAM ds)
Definition: libemf.h:5756
int size(void) const
Definition: libemf.h:5764
EMF Stroke path.
Definition: libemf.h:5678
EMRSTROKEPATH(const RECTL *bounds)
Definition: libemf.h:5683
int size(void) const
Definition: libemf.h:5708
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition: libemf.h:5714
EMRSTROKEPATH(DATASTREAM &ds)
Definition: libemf.h:5693
bool serialize(DATASTREAM ds)
Definition: libemf.h:5700
Extended Graphics Pen.
Definition: libemf.h:6155
EXTPEN(const EXTLOGPEN *lpen)
Definition: libemf.h:6160
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6180
OBJECTTYPE getType(void) const
Definition: libemf.h:6173
Graphics Font.
Definition: libemf.h:6223
FONT(const LOGFONTW *lfont)
Definition: libemf.h:6228
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6253
OBJECTTYPE getType(void) const
Definition: libemf.h:6246
Definition: libemf.h:1276
static EMF::METARECORD * new_extcreatefontindirectw(DATASTREAM &ds)
Create a new EXTCREATEFONTINDIRECTW record.
Definition: libemf.cpp:477
static EMF::METARECORD * new_exttextoutw(DATASTREAM &ds)
Create a new EXTTEXTOUTW record.
Definition: libemf.cpp:452
static EMF::METARECORD * new_arc(DATASTREAM &ds)
Create a new ARC record.
Definition: libemf.cpp:367
static EMF::METARECORD * new_polypolygon16(DATASTREAM &ds)
Create a new POLYPOLYGON16 record.
Definition: libemf.cpp:412
static EMF::METARECORD * new_modifyworldtransform(DATASTREAM &ds)
Create a new MODIFYWORLDTRANSFORM record.
Definition: libemf.cpp:307
static EMF::METARECORD * new_createbrushindirect(DATASTREAM &ds)
Create a new CREATEBRUSHINDIRECT record.
Definition: libemf.cpp:472
static EMF::METARECORD * new_ellipse(DATASTREAM &ds)
Create a new ELLIPSE record.
Definition: libemf.cpp:382
static EMF::METARECORD * new_savedc(DATASTREAM &ds)
Create a new SAVEDC record.
Definition: libemf.cpp:512
static EMF::METARECORD * new_polybezierto(DATASTREAM &ds)
Create a new POLYBEZIERTO record.
Definition: libemf.cpp:427
static EMF::METARECORD * new_createpen(DATASTREAM &ds)
Create a new CREATEPEN record.
Definition: libemf.cpp:462
static EMF::METARECORD * new_exttextouta(DATASTREAM &ds)
Create a new EXTTEXTOUTA record.
Definition: libemf.cpp:447
static EMF::METARECORD * new_scaleviewportextex(DATASTREAM &ds)
Create a new SCALEVIEWPORTEXTEX record.
Definition: libemf.cpp:297
static EMF::METARECORD * new_extcreatepen(DATASTREAM &ds)
Create a new EXTCREATEPEN record.
Definition: libemf.cpp:467
static EMF::METARECORD * new_setviewportorgex(DATASTREAM &ds)
Create a new EMRSETVIEWPORTORGEX record.
Definition: libemf.cpp:277
static EMF::METARECORD * new_setmiterlimit(DATASTREAM &ds)
Create a new SETMITERLIMIT record.
Definition: libemf.cpp:527
auto end(void) const
Definition: libemf.h:1305
static EMF::METARECORD * new_setbkmode(DATASTREAM &ds)
Create a new SETBKMODE record.
Definition: libemf.cpp:332
METARECORDCTOR newRecord(DWORD iType) const
Definition: libemf.cpp:262
static EMF::METARECORD * new_polyline(DATASTREAM &ds)
Create a new POLYLINE record.
Definition: libemf.cpp:387
static EMF::METARECORD * new_setviewportextex(DATASTREAM &ds)
Create a new EMRSETVIEWPORTEXTEX record.
Definition: libemf.cpp:287
static EMF::METARECORD * new_deleteobject(DATASTREAM &ds)
Create a new DELETEOBJECT record.
Definition: libemf.cpp:352
static EMF::METARECORD * new_polylineto(DATASTREAM &ds)
Create a new POLYLINETO record.
Definition: libemf.cpp:437
static EMF::METARECORD * new_polylineto16(DATASTREAM &ds)
Create a new POLYLINETO16 record.
Definition: libemf.cpp:442
static EMF::METARECORD * new_settextalign(DATASTREAM &ds)
Create a new SETTEXTALIGN record.
Definition: libemf.cpp:317
void remove(const OBJECT *object)
Definition: libemf.cpp:248
static EMF::METARECORD * new_polybezier16(DATASTREAM &ds)
Create a new POLYBEZIER16 record.
Definition: libemf.cpp:422
auto begin(void) const
Definition: libemf.h:1300
static EMF::METARECORD * new_polypolygon(DATASTREAM &ds)
Create a new POLYPOLYGON record.
Definition: libemf.cpp:407
static EMF::METARECORD * new_setwindowextex(DATASTREAM &ds)
Create a new EMRSETWINDOWEXTEX record.
Definition: libemf.cpp:292
static EMF::METARECORD * new_polyline16(DATASTREAM &ds)
Create a new POLYLINE16 record.
Definition: libemf.cpp:392
static EMF::METARECORD * new_endpath(DATASTREAM &ds)
Create a new ENDPATH record.
Definition: libemf.cpp:502
static EMF::METARECORD * new_setpixelv(DATASTREAM &ds)
Create a new SETPIXELV record.
Definition: libemf.cpp:457
static EMF::METARECORD * new_restoredc(DATASTREAM &ds)
Create a new RESTOREDC record.
Definition: libemf.cpp:517
static EMF::METARECORD * new_beginpath(DATASTREAM &ds)
Create a new BEGINPATH record.
Definition: libemf.cpp:497
static EMF::METARECORD * new_scalewindowextex(DATASTREAM &ds)
Create a new SCALEWINDOWEXTEX record.
Definition: libemf.cpp:302
static EMF::METARECORD * new_setmapmode(DATASTREAM &ds)
Create a new SETMAPMODE record.
Definition: libemf.cpp:342
static EMF::METARECORD * new_polybezierto16(DATASTREAM &ds)
Create a new POLYBEZIERTO16 record.
Definition: libemf.cpp:432
static EMF::METARECORD * new_eof(DATASTREAM &ds)
Create a new EMREOF record.
Definition: libemf.cpp:272
static EMF::METARECORD * new_setbkcolor(DATASTREAM &ds)
Create a new SETBKCOLOR record.
Definition: libemf.cpp:327
static EMF::METARECORD * new_setworldtransform(DATASTREAM &ds)
Create a new SETWORLDTRANSFORM record.
Definition: libemf.cpp:312
static EMF::METARECORD * new_setwindoworgex(DATASTREAM &ds)
Create a new EMRSETWINDOWORGEX record.
Definition: libemf.cpp:282
static EMF::METARECORD * new_strokeandfillpath(DATASTREAM &ds)
Create a new STROKEANDFILLPATH record.
Definition: libemf.cpp:492
HGDIOBJ add(OBJECT *object)
Definition: libemf.cpp:193
static EMF::METARECORD * new_polygon(DATASTREAM &ds)
Create a new POLYGON record.
Definition: libemf.cpp:397
static EMF::METARECORD * new_strokepath(DATASTREAM &ds)
Create a new STROKEPATH record.
Definition: libemf.cpp:487
static EMF::METARECORD * new_polygon16(DATASTREAM &ds)
Create a new POLYGON16 record.
Definition: libemf.cpp:402
static EMF::METARECORD * new_fillpath(DATASTREAM &ds)
Create a new FILLPATH record.
Definition: libemf.cpp:482
static EMF::METARECORD * new_arcto(DATASTREAM &ds)
Create a new ARCTO record.
Definition: libemf.cpp:372
static EMF::METARECORD * new_lineto(DATASTREAM &ds)
Create a new LINETO record.
Definition: libemf.cpp:362
static EMF::METARECORD * new_setpolyfillmode(DATASTREAM &ds)
Create a new SETPOLYFILLMODE record.
Definition: libemf.cpp:337
static EMF::METARECORD * new_settextcolor(DATASTREAM &ds)
Create a new SETTEXTCOLOR record.
Definition: libemf.cpp:322
static EMF::METARECORD * new_rectangle(DATASTREAM &ds)
Create a new RECTANGLE record.
Definition: libemf.cpp:377
static EMF::METARECORD * new_movetoex(DATASTREAM &ds)
Create a new MOVETOEX record.
Definition: libemf.cpp:357
static EMF::METARECORD * new_closefigure(DATASTREAM &ds)
Create a new CLOSEFIGURE record.
Definition: libemf.cpp:507
static EMF::METARECORD * new_polybezier(DATASTREAM &ds)
Create a new POLYBEZIER record.
Definition: libemf.cpp:417
static EMF::METARECORD * new_selectobject(DATASTREAM &ds)
Create a new SELECTOBJECT record.
Definition: libemf.cpp:347
static EMF::METARECORD * new_setmetargn(DATASTREAM &ds)
Create a new SETMETARGN record.
Definition: libemf.cpp:522
OBJECT * find(const HGDIOBJ handle)
Definition: libemf.cpp:225
A global graphics object.
Definition: libemf.h:1253
virtual METARECORD * newEMR(HDC dc, HGDIOBJ handle)=0
std::map< HDC, HGDIOBJ > contexts
Definition: libemf.h:1261
virtual ~GRAPHICSOBJECT()
GRAPHICSOBJECTs has a virtual destructor.
Definition: libemf.h:1256
Graphics Device Context.
Definition: libemf.h:6360
void clearHandle(DWORD handle)
Definition: libemf.h:6556
OBJECTTYPE getType(void) const
Definition: libemf.h:6534
void appendHandle(METARECORD *record)
Definition: libemf.h:6579
ENHMETAHEADER * header
Definition: libemf.h:6462
INT polyfill_mode
The current polygon fill mode.
Definition: libemf.h:6486
POINT window_org
The origin of the window.
Definition: libemf.h:6473
void deleteMetafile(void)
Definition: libemf.h:6590
::FILE * fp
Definition: libemf.h:6453
PEN * pen
The current pen.
Definition: libemf.h:6478
FONT * font
The current font.
Definition: libemf.h:6480
BRUSH * brush
The current brush.
Definition: libemf.h:6479
SIZEL viewport_ext
The extent of the viewport.
Definition: libemf.h:6470
bool update_frame
Update the frame automatically?
Definition: libemf.h:6474
SIZEL resolution
The resolution in DPI of the reference DC.
Definition: libemf.h:6469
UINT text_alignment
The current text alignment.
Definition: libemf.h:6482
virtual ~METAFILEDEVICECONTEXT()
Definition: libemf.h:6524
void appendRecord(METARECORD *record)
Definition: libemf.h:6567
FLOAT miter_limit
The current miter length limit.
Definition: libemf.h:6488
POINT min_device_point
The lft/top-most painted point in device units.
Definition: libemf.h:6475
void mergePoint(const LONG &x, const LONG &y)
Definition: libemf.h:6601
POINT point
The current point.
Definition: libemf.h:6477
INT map_mode
The current mapping mode.
Definition: libemf.h:6487
COLORREF bk_color
The current background color.
Definition: libemf.h:6484
DATASTREAM ds
Definition: libemf.h:6458
std::vector< bool > handles
Definition: libemf.h:6495
POINT max_device_point
The rgt/btm-most painted point in device units.
Definition: libemf.h:6476
METAFILEDEVICECONTEXT(FILE *fp_, const RECT *size, LPCWSTR description_w)
Definition: libemf.h:6514
COLORREF text_color
The current text foreground color.
Definition: libemf.h:6483
PALETTE * palette
The current palette.
Definition: libemf.h:6481
POINT viewport_org
The origin of the viewport.
Definition: libemf.h:6471
SIZEL window_ext
The extent of the window.
Definition: libemf.h:6472
INT bk_mode
The current background mode.
Definition: libemf.h:6485
std::vector< EMF::METARECORD * > records
Definition: libemf.h:6466
void mergePoint(const POINT &p)
Definition: libemf.h:6612
std::map< HGDIOBJ, HGDIOBJ > emf_handles
Definition: libemf.h:6502
DWORD nextHandle(void)
Definition: libemf.h:6539
Global GDI object.
Definition: libemf.h:1231
OBJECT(void)
Definition: libemf.h:1240
virtual OBJECTTYPE getType(void) const =0
HGDIOBJ handle
Definition: libemf.h:1233
virtual ~OBJECT()
OBJECTs have a virtual destructor.
Definition: libemf.h:1235
Graphics Palette.
Definition: libemf.h:6264
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6287
OBJECTTYPE getType(void) const
Definition: libemf.h:6280
PALETTE(const LOGPALETTE *lpalette)
Definition: libemf.h:6269
Graphics Pen.
Definition: libemf.h:6123
PEN(const LOGPEN *lpen)
Definition: libemf.h:6128
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition: libemf.h:6144
OBJECTTYPE getType(void) const
Definition: libemf.h:6137
Represent a byte array in a simple way.
Definition: libemf.h:127
const int n_
Number of bytes in array.
Definition: libemf.h:129
BYTE *const array_
Array of unsigned bytes.
Definition: libemf.h:128
BYTEARRAY(BYTE *const array, const int n)
Definition: libemf.h:135
Represent an ASCII character string in a simple way.
Definition: libemf.h:110
const int length_
Number of single byte characters in array.
Definition: libemf.h:112
CHARSTR(CHAR *const string, const int length)
Definition: libemf.h:118
CHAR *const string_
Array of single byte characters.
Definition: libemf.h:111
Represent an array of double word integers in a simple way.
Definition: libemf.h:191
DWORD *const dwords_
Array of double words.
Definition: libemf.h:192
const DWORD n_
Number of double words in array.
Definition: libemf.h:193
DWORDARRAY(DWORD *const dwords, const DWORD n)
Definition: libemf.h:199
Represent an array of integers in a simple way.
Definition: libemf.h:175
INT *const ints_
Array of ints.
Definition: libemf.h:176
const DWORD n_
Number of ints in array.
Definition: libemf.h:177
INTARRAY(INT *const ints, const DWORD n)
Definition: libemf.h:183
All metafile records must be padded out to a multiple of 4 bytes.
Definition: libemf.h:207
static const char padding_[4]
Pad with '\0's.
Definition: libemf.h:208
PADDING(const int size)
Definition: libemf.h:214
const int size_
Number of bytes of padding.
Definition: libemf.h:209
Represent an array of 16-bit point in a simple way.
Definition: libemf.h:159
POINT16 *const points_
Array of POINT16s.
Definition: libemf.h:160
const DWORD n_
Number of POINT16s in array.
Definition: libemf.h:161
POINT16ARRAY(POINT16 *const points, const DWORD n)
Definition: libemf.h:167
Represent an array of points in a simple way.
Definition: libemf.h:143
const DWORD n_
Number of POINTLs in array.
Definition: libemf.h:145
POINTL *const points_
Array of POINTLs.
Definition: libemf.h:144
POINTLARRAY(POINTL *const points, const DWORD n)
Definition: libemf.h:151
Represent a wide (UNICODE) character string in a simple way.
Definition: libemf.h:92
const int length_
Number of WCHARs in string.
Definition: libemf.h:94
WCHARSTR(WCHAR *const string, const int length)
Definition: libemf.h:100
WCHAR *const string_
String of WCHARs.
Definition: libemf.h:93