32#include <libEMF/emf.h>
34#include <libEMF/wine/w16.h>
41#define EMF_UNUSED(x) (void)x;
49 const int XMAX_PIXELS = 1024;
51 const int XMAX_PIXELS = 1280;
58 const int YMAX_PIXELS = 768;
60 const int YMAX_PIXELS = 1024;
67 const int XMAX_MM = 320;
73 const int YMAX_MM = 240;
77 const int RESOLUTION = 96;
81 static inline DWORD ROUND_TO_LONG ( DWORD n ) {
return ((n+3)/4)*4; }
83 static bool bigEndian (
void );
99 WCHARSTR ( WCHAR *
const string,
const int length )
117 CHARSTR ( CHAR *
const string,
const int length )
233 DATASTREAM ( ::FILE* fp = 0 ) : swap_( bigEndian() ), fp_( fp ) {}
245 fwrite( &
byte,
sizeof(BYTE), 1, fp_ );
254 fread( &
byte,
sizeof(BYTE), 1, fp_ );
264 unsigned char const * p = (
unsigned char const*)&word;
265 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
266 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
269 fwrite( &word,
sizeof(WORD), 1, fp_ );
279 unsigned char* p = (
unsigned char*)&word;
280 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
281 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
284 fread( &word,
sizeof(WORD), 1, fp_ );
294 unsigned char const * p = (
unsigned char const*)&word;
295 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
296 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
299 fwrite( &word,
sizeof(INT16), 1, fp_ );
309 unsigned char* p = (
unsigned char*)&word;
310 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
311 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
314 fread( &word,
sizeof(INT16), 1, fp_ );
324 unsigned char const* p = (
unsigned char const*)&dword;
325 fwrite( &p[3],
sizeof(
unsigned char), 1, fp_ );
326 fwrite( &p[2],
sizeof(
unsigned char), 1, fp_ );
327 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
328 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
331 fwrite( &dword,
sizeof(DWORD), 1, fp_ );
341 unsigned char* p = (
unsigned char*)&dword;
342 fread( &p[3],
sizeof(
unsigned char), 1, fp_ );
343 fread( &p[2],
sizeof(
unsigned char), 1, fp_ );
344 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
345 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
348 fread( &dword,
sizeof(DWORD), 1, fp_ );
351#if !defined( __LP64__ )
359 unsigned char const* p = (
unsigned char const*)&long_;
360 fwrite( &p[3],
sizeof(
unsigned char), 1, fp_ );
361 fwrite( &p[2],
sizeof(
unsigned char), 1, fp_ );
362 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
363 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
366 fwrite( &long_,
sizeof(LONG), 1, fp_ );
376 unsigned char* p = (
unsigned char*)&long_;
377 fread( &p[3],
sizeof(
unsigned char), 1, fp_ );
378 fread( &p[2],
sizeof(
unsigned char), 1, fp_ );
379 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
380 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
383 fread( &long_,
sizeof(LONG), 1, fp_ );
394 unsigned char const* p = (
unsigned char const*)&int_;
395 fwrite( &p[3],
sizeof(
unsigned char), 1, fp_ );
396 fwrite( &p[2],
sizeof(
unsigned char), 1, fp_ );
397 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
398 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
401 fwrite( &int_,
sizeof(INT), 1, fp_ );
411 unsigned char* p = (
unsigned char*)&int_;
412 fread( &p[3],
sizeof(
unsigned char), 1, fp_ );
413 fread( &p[2],
sizeof(
unsigned char), 1, fp_ );
414 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
415 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
418 fread( &int_,
sizeof(INT), 1, fp_ );
421#if !defined(__LP64__)
429 unsigned char const* p = (
unsigned char const*)&uint;
430 fwrite( &p[3],
sizeof(
unsigned char), 1, fp_ );
431 fwrite( &p[2],
sizeof(
unsigned char), 1, fp_ );
432 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
433 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
436 fwrite( &uint,
sizeof(UINT), 1, fp_ );
446 unsigned char* p = (
unsigned char*)&uint;
447 fread( &p[3],
sizeof(
unsigned char), 1, fp_ );
448 fread( &p[2],
sizeof(
unsigned char), 1, fp_ );
449 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
450 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
453 fread( &uint,
sizeof(UINT), 1, fp_ );
464 unsigned char const* p = (
unsigned char const*)&float_;
465 fwrite( &p[3],
sizeof(
unsigned char), 1, fp_ );
466 fwrite( &p[2],
sizeof(
unsigned char), 1, fp_ );
467 fwrite( &p[1],
sizeof(
unsigned char), 1, fp_ );
468 fwrite( &p[0],
sizeof(
unsigned char), 1, fp_ );
471 fwrite( &float_,
sizeof(FLOAT), 1, fp_ );
481 unsigned char* p = (
unsigned char*)&float_;
482 fread( &p[3],
sizeof(
unsigned char), 1, fp_ );
483 fread( &p[2],
sizeof(
unsigned char), 1, fp_ );
484 fread( &p[1],
sizeof(
unsigned char), 1, fp_ );
485 fread( &p[0],
sizeof(
unsigned char), 1, fp_ );
488 fread( &float_,
sizeof(FLOAT), 1, fp_ );
497 if ( padding.
size_ != 0 )
498 fwrite( &padding.
padding_,
sizeof(CHAR), padding.
size_, fp_ );
507 *
this << rectl.left << rectl.top << rectl.right << rectl.bottom;
516 *
this >> rectl.left >> rectl.top >> rectl.right >> rectl.bottom;
525 *
this << sizel.cx << sizel.cy;
534 *
this >> sizel.cx >> sizel.cy;
543 for (
int i = 0; i < wcharstr.
length_; i++ )
553 for (
int i = 0; i < wcharstr.
length_; i++ )
581 *
this << emr.iType << emr.nSize;
590 *
this >> emr.iType >> emr.nSize;
599 *
this << point.x << point.y;
608 *
this >> point.x >> point.y;
617 *
this << pointl.x << pointl.y;
626 *
this >> pointl.x >> pointl.y;
635 *
this << point.x << point.y;
644 *
this >> point.x >> point.y;
653 *
this << xform.eM11 << xform.eM12 << xform.eM21 << xform.eM22
654 << xform.eDx << xform.eDy;
663 *
this >> xform.eM11 >> xform.eM12 >> xform.eM21 >> xform.eM22
664 >> xform.eDx >> xform.eDy;
673 fwrite( array.
array_,
sizeof(BYTE), array.
n_, fp_ );
682 fread( array.
array_,
sizeof(BYTE), array.
n_, fp_ );
691 for (
unsigned int i = 0; i < array.
n_; i++ )
701 for (
unsigned int i = 0; i < array.
n_; i++ )
711 for (
unsigned int i = 0; i < array.
n_; i++ )
721 for (
unsigned int i = 0; i < array.
n_; i++ )
731 for (
unsigned int i = 0; i < array.
n_; i++ )
732 *
this << array.
ints_[i];
741 for (
unsigned int i = 0; i < array.
n_; i++ )
742 *
this >> array.
ints_[i];
751 for (
unsigned int i = 0; i < array.
n_; i++ )
761 for (
unsigned int i = 0; i < array.
n_; i++ )
771 *
this << text.ptlReference << text.nChars << text.offString << text.fOptions
772 << text.rcl << text.offDx;
781 *
this >> text.ptlReference >> text.nChars >> text.offString >> text.fOptions
782 >> text.rcl >> text.offDx;
791 *
this << pen.lopnStyle << pen.lopnWidth << pen.lopnColor;
800 *
this >> pen.lopnStyle >> pen.lopnWidth >> pen.lopnColor;
810 *
this << pen.elpPenStyle << pen.elpWidth << pen.elpBrushStyle << pen.elpColor
811 << pen.elpHatch << pen.elpNumEntries;
821 *
this >> pen.elpPenStyle >> pen.elpWidth >> pen.elpBrushStyle >> pen.elpColor
822 >> pen.elpHatch >> pen.elpNumEntries;
831 *
this << brush.lbStyle << brush.lbColor << brush.lbHatch;
840 *
this >> brush.lbStyle >> brush.lbColor >> brush.lbHatch;
849 *
this << font.lfHeight << font.lfWidth << font.lfEscapement
850 << font.lfOrientation << font.lfWeight << font.lfItalic
851 << font.lfUnderline << font.lfStrikeOut << font.lfCharSet
852 << font.lfOutPrecision << font.lfClipPrecision << font.lfQuality
853 << font.lfPitchAndFamily
854 <<
WCHARSTR(
const_cast<WCHAR*
>(font.lfFaceName), LF_FACESIZE );
863 WCHARSTR wFaceName( font.lfFaceName, LF_FACESIZE );
865 *
this >> font.lfHeight >> font.lfWidth >> font.lfEscapement
866 >> font.lfOrientation >> font.lfWeight >> font.lfItalic
867 >> font.lfUnderline >> font.lfStrikeOut >> font.lfCharSet
868 >> font.lfOutPrecision >> font.lfClipPrecision >> font.lfQuality
869 >> font.lfPitchAndFamily
879 fwrite( &panose,
sizeof(PANOSE), 1, fp_ );
888 fread( &panose,
sizeof(PANOSE), 1, fp_ );
897 *
this << font.elfLogFont
898 <<
WCHARSTR(
const_cast<WCHAR*
>(font.elfFullName),
900 <<
WCHARSTR(
const_cast<WCHAR*
>(font.elfStyle), LF_FACESIZE )
901 << font.elfVersion << font.elfStyleSize << font.elfMatch
903 <<
BYTEARRAY(
const_cast<BYTE*
>(font.elfVendorId),
905 << font.elfCulture << font.elfPanose;
914 WCHARSTR wFullName( font.elfFullName, LF_FULLFACESIZE );
915 WCHARSTR wStyle( font.elfStyle, LF_FACESIZE );
916 BYTEARRAY bVendorId( font.elfVendorId, ELF_VENDOR_SIZE );
917 *
this >> font.elfLogFont
918 >> wFullName >> wStyle
919 >> font.elfVersion >> font.elfStyleSize >> font.elfMatch
920 >> font.elfReserved >> bVendorId
921 >> font.elfCulture >> font.elfPanose;
931 *
this << palette.palVersion << palette.palNumEntries;
941 *
this >> palette.palVersion >> palette.palNumEntries;
954 void fread (
void* ptr,
size_t size,
size_t nmemb, FILE* stream )
956 size_t res = ::fread( ptr, size, nmemb, stream );
958 throw std::runtime_error(
"Premature EOF on EMF stream" );
970 void fwrite (
const void* ptr,
size_t size,
size_t nmemb, FILE* stream )
972 size_t res = ::fwrite( ptr, size, nmemb, stream );
974 throw std::runtime_error(
"error writing EMF stream" );
1009 virtual int size (
void )
const = 0;
1016#ifdef ENABLE_EDITING
1021 virtual void edit (
void )
const {}
1025#ifdef ENABLE_EDITING
1027 inline void edit_rectl (
const char* tag,
const RECTL& rectl )
1029#if defined(__LP64__)
1030 const char* FMT =
"\t%s\t: (%d, %d) - (%d, %d)\n";
1032 const char* FMT =
"\t%s\t: (%ld, %ld) - (%ld, %ld)\n";
1034 printf( FMT, tag, rectl.left, rectl.top, rectl.right, rectl.bottom );
1037 inline void edit_xform (
const char* tag,
const XFORM& xform )
1039 printf(
"\t%s.eM11\t: %f\n", tag, xform.eM11 );
1040 printf(
"\t%s.eM12\t: %f\n", tag, xform.eM12 );
1041 printf(
"\t%s.eM21\t: %f\n", tag, xform.eM21 );
1042 printf(
"\t%s.eM22\t: %f\n", tag, xform.eM22 );
1043 printf(
"\t%s.eDx\t: %f\n", tag, xform.eDx );
1044 printf(
"\t%s.eDy\t: %f\n", tag, xform.eDy );
1047 inline void edit_color (
const char* tag,
const COLORREF& color )
1049#if defined(__LP64__)
1050 const char* FMT =
"\t%s\t: R(0x%02x) G(0x%02x) B(0x%02x)\n";
1052 const char* FMT =
"\t%s\t: R(0x%02lx) G(0x%02lx) B(0x%02lx)\n";
1055 GetRValue( color ), GetGValue( color ), GetBValue( color ) );
1058 inline void edit_sizel (
const char* tag,
const SIZEL& size )
1060#if defined(__LP64__)
1061 const char* FMT =
"\t%s\t: (%d, %d)\n";
1063 const char* FMT =
"\t%s\t: (%ld, %ld)\n";
1065 printf( FMT, tag, size.cx, size.cy );
1068 inline void edit_pointl (
const char* tag,
const POINTL& point )
1070#if defined(__LP64__)
1071 const char* FMT =
"\t%s\t: (%d, %d)\n";
1073 const char* FMT =
"\t%s\t: (%ld, %ld)\n";
1075 printf( FMT, tag, point.x, point.y );
1078 inline void edit_pointlarray (
const char* tag,
const DWORD cptl,
1079 const POINTL* points )
1081#if defined(__LP64__)
1082 const char* FMT0 =
"\tcptl%s\t: %d\n";
1083 const char* FMT1 =
"%d, %d\n";
1084 const char* FMT2 =
"\t\t%s %d, %d\n";
1086 const char* FMT0 =
"\tcptl%s\t: %ld\n";
1087 const char* FMT1 =
"%ld, %ld\n";
1088 const char* FMT2 =
"\t\t%s %ld, %ld\n";
1090 printf( FMT0, tag, cptl );
1091 printf(
"\taptl%s\t: ", tag );
1093 printf( FMT1, points[0].x, points[0].y );
1096 for ( DWORD i = 1; i < cptl; i++ )
1097 printf( FMT2, tag, points[i].x, points[i].y );
1100 inline void edit_point16array (
const char* tag,
const unsigned int cpts,
1101 const POINT16* points )
1103 printf(
"\tcpts%s\t: %d\n", tag, cpts );
1104 printf(
"\tapts%s\t: ", tag );
1106 printf(
"%d, %d\n", points[0].x, points[0].y );
1109 for (
unsigned int i = 1; i < cpts; i++ )
1110 printf(
"\t\t%s %d, %d\n", tag, points[i].x, points[i].y );
1113 inline void edit_pen_style (
const char* tag, DWORD style )
1115 printf(
"\t%s\t: ", tag );
1116 switch ( style & PS_STYLE_MASK ) {
1117 case PS_SOLID: printf(
"PS_SOLID" );
break;
1118 case PS_DASH: printf(
"PS_DASH" );
break;
1119 case PS_DOT: printf(
"PS_DOT" );
break;
1120 case PS_DASHDOT: printf(
"PS_DASHDOT" );
break;
1121 case PS_DASHDOTDOT: printf(
"PS_DASHDOTDOT" );
break;
1122 case PS_NULL: printf(
"PS_NULL" );
break;
1123 case PS_INSIDEFRAME: printf(
"PS_INSIDEFRAME" );
break;
1124 case PS_USERSTYLE: printf(
"PS_USERSTYLE" );
break;
1125 case PS_ALTERNATE: printf(
"PS_ALTERNATE" );
break;
1127 switch ( style & PS_ENDCAP_MASK ) {
1128 case PS_ENDCAP_ROUND: printf(
" | PS_ENDCAP_ROUND" );
break;
1129 case PS_ENDCAP_SQUARE: printf(
" | PS_ENDCAP_SQUARE" );
break;
1130 case PS_ENDCAP_FLAT: printf(
" | PS_ENDCAP_FLAT" );
break;
1132 switch ( style & PS_JOIN_MASK ) {
1133 case PS_JOIN_ROUND: printf(
" | PS_JOIN_ROUND" );
break;
1134 case PS_JOIN_BEVEL: printf(
" | PS_JOIN_BEVEL" );
break;
1135 case PS_JOIN_MITER: printf(
" | PS_JOIN_MITER" );
break;
1137 switch ( style & PS_TYPE_MASK ) {
1138 case PS_COSMETIC: printf(
" | PS_COSMETIC" );
break;
1139 case PS_GEOMETRIC: printf(
" | PS_GEOMETRIC" );
break;
1144 inline void edit_brush_style (
const char* tag, DWORD style )
1146#if defined(__LP64__)
1147 const char* FMT =
"unknown(%d)";
1149 const char* FMT =
"unknown(%ld)";
1151 printf(
"\t%s\t: ", tag );
1153 case BS_SOLID: printf(
"BS_SOLID" );
break;
1154 case BS_NULL: printf(
"BS_NULL" );
break;
1155 case BS_HATCHED: printf(
"BS_HATCHED" );
break;
1156 case BS_PATTERN: printf(
"BS_PATTERN" );
break;
1157 case BS_INDEXED: printf(
"BS_INDEXED" );
break;
1158 case BS_DIBPATTERN: printf(
"BS_DIBPATTERN" );
break;
1159 case BS_DIBPATTERNPT: printf(
"BS_DIBPATTERNPT" );
break;
1160 case BS_PATTERN8X8: printf(
"BS_PATTERN8X8" );
break;
1161 case BS_DIBPATTERN8X8: printf(
"BS_DIBPATTERN8X8" );
break;
1162 case BS_MONOPATTERN: printf(
"BS_DIBPATTERN8X8" );
break;
1163 default: printf( FMT, style );
1168 inline void edit_brush_hatch (
const char* tag, DWORD hatch )
1170#if defined(__LP64__)
1171 const char* FMT =
"unknown(%d)";
1173 const char* FMT =
"unknown(%ld)";
1175 printf(
"\t%s\t: ", tag );
1177 case HS_HORIZONTAL: printf(
"HS_HORIZONTAL" );
break;
1178 case HS_VERTICAL: printf(
"HS_VERTICAL" );
break;
1179 case HS_FDIAGONAL: printf(
"HS_FDIAGONAL" );
break;
1180 case HS_BDIAGONAL: printf(
"HS_BDIAGONAL" );
break;
1181 case HS_CROSS: printf(
"HS_CROSS" );
break;
1182 case HS_DIAGCROSS: printf(
"HS_DIAGCROSS" );
break;
1183 default: printf( FMT, hatch );
1195 enum OBJECTTYPE { O_METAFILEDEVICECONTEXT = OBJ_METADC,
1198 O_EXTPEN = OBJ_EXTPEN,
1199 O_BRUSH = OBJ_BRUSH,
1200 O_PALETTE = OBJ_PAL };
1205 static char* typStr ( OBJECTTYPE type )
1208 case O_METAFILEDEVICECONTEXT:
1209 return "metafile device context";
1215 return "extended pen";
1221 return "unknown object";
1275 class GLOBALOBJECTS {
1279 std::vector<OBJECT*> objects;
1287 std::map< DWORD, METARECORDCTOR > new_records;
1290 GLOBALOBJECTS (
void );
1291 ~GLOBALOBJECTS (
void );
1299 auto begin (
void )
const {
return objects.begin(); }
1304 auto end (
void )
const {
return objects.end(); }
1306 METARECORDCTOR
newRecord ( DWORD iType )
const;
1414 extern GLOBALOBJECTS globalObjects;
1425 LPWSTR description_w{
nullptr };
1426 int description_size{ 0 };
1436 : description_w( 0 ), description_size( 0 )
1442 RECTL default_bounds = { 0, 0, 0, 0 };
1443 rclBounds = default_bounds;
1444 RECTL default_frame = { 0, 0, 0, 0 };
1445 rclFrame = default_frame;
1446 dSignature = ENHMETA_SIGNATURE;
1455 szlDevice.cx = XMAX_PIXELS;
1456 szlDevice.cy = YMAX_PIXELS;
1457 szlMillimeters.cx = XMAX_MM;
1458 szlMillimeters.cy = YMAX_MM;
1465 szlMicrometers.cx = 1000 * szlMillimeters.cx;
1466 szlMicrometers.cy = 1000 * szlMillimeters.cy;
1468 if ( description ) {
1470 int description_count = 0, nulls = 0;
1471 LPCWSTR description_p = description;
1472 while ( nulls < 3 ) {
1473 description_count++;
1474 if ( (*description_p++) == 0 ) nulls++;
1480 sizeof( WCHAR ) * description_count );
1484 std::unique_ptr<WCHAR[]>
1485 description_tmp(
new WCHAR[ description_size ] );
1487 description_w = description_tmp.release();
1489 memset( description_w, 0,
sizeof(WCHAR) * description_size );
1491 for (
int i=0; i<description_count; i++ )
1492 description_w[i] = *description++;
1494 nSize = nBytes = record_size;
1495 nDescription = description_count;
1505 if ( description_w )
delete[] description_w;
1513 ds << iType << nSize
1514 << rclBounds << rclFrame
1515 << dSignature << nVersion << nBytes << nRecords << nHandles << sReserved
1516 << nDescription << offDescription << nPalEntries
1517 << szlDevice << szlMillimeters
1518 << cbPixelFormat << offPixelFormat << bOpenGL
1520 <<
WCHARSTR( description_w, description_size );
1528 ds >> iType >> nSize
1529 >> rclBounds >> rclFrame
1530 >> dSignature >> nVersion >> nBytes >> nRecords >> nHandles >> sReserved
1531 >> nDescription >> offDescription >> nPalEntries
1532 >> szlDevice >> szlMillimeters;
1536#define OffsetOf( a, b ) ((unsigned int)(((char*)&(((::ENHMETAHEADER*)a)->b)) - \
1537(char*)((::ENHMETAHEADER*)a)))
1538 if ( OffsetOf(
this, szlMicrometers ) <= offDescription )
1539 ds >> cbPixelFormat >> offPixelFormat >> bOpenGL;
1542 ds >> szlMicrometers;
1546 int description_size_to_read = ( nSize - offDescription ) /
sizeof(WCHAR);
1548 if ( description_size_to_read < (
int)nDescription ) {
1549 throw std::runtime_error(
"record size inconsistent with description size" );
1552 description_size = max( 2, description_size_to_read );
1554 std::unique_ptr<WCHAR[]> buffer(
new WCHAR[description_size] );
1556 WCHARSTR description( buffer.get(), description_size_to_read );
1560 description_w = buffer.release();
1563 description_w[description_size-1] = 0;
1564 description_w[description_size-2] = 0;
1571 int size (
void )
const {
return nSize; }
1583#ifdef ENABLE_EDITING
1587 void edit (
void )
const
1589#if defined(__LP64__)
1590 const char* FMT0 =
"\tiType\t\t\t: %d\n";
1591 const char* FMT1 =
"\tnSize\t\t\t: %d\n";
1592 const char* FMT2 =
"\tnBytes\t\t\t: %d\n";
1593 const char* FMT3 =
"\tnRecords\t\t: %d\n";
1594 const char* FMT4 =
"\tnDescription\t\t: %d\n";
1595 const char* FMT5 =
"\toffDescription\t\t: %d\n";
1596 const char* FMT6 =
"\tnPalEntries\t\t: %d\n";
1597 const char* FMT7 =
"\tcbPixelFormat\t\t: %d\n";
1598 const char* FMT8 =
"\toffPixelFormat\t\t: %d\n";
1599 const char* FMT9 =
"\tbOpenGL\t\t\t: %d\n";
1601 const char* FMT0 =
"\tiType\t\t\t: %ld\n";
1602 const char* FMT1 =
"\tnSize\t\t\t: %ld\n";
1603 const char* FMT2 =
"\tnBytes\t\t\t: %ld\n";
1604 const char* FMT3 =
"\tnRecords\t\t: %ld\n";
1605 const char* FMT4 =
"\tnDescription\t\t: %ld\n";
1606 const char* FMT5 =
"\toffDescription\t\t: %ld\n";
1607 const char* FMT6 =
"\tnPalEntries\t\t: %ld\n";
1608 const char* FMT7 =
"\tcbPixelFormat\t\t: %ld\n";
1609 const char* FMT8 =
"\toffPixelFormat\t\t: %ld\n";
1610 const char* FMT9 =
"\tbOpenGL\t\t\t: %ld\n";
1612 printf(
"*HEADER*\n" );
1613 printf( FMT0, iType );
1614 printf( FMT1, nSize );
1615 edit_rectl(
"rclBounds\t", rclBounds );
1616 edit_rectl(
"rclFrame\t", rclFrame );
1617 printf(
"\tdSignature\t\t: %.4s\n", (
const char*)&dSignature );
1618 printf(
"\tnVersion\t\t: 0x%x\n", (
unsigned int)nVersion );
1619 printf( FMT2, nBytes );
1620 printf( FMT3, nRecords );
1621 printf(
"\tnHandles\t\t: %d\n", nHandles );
1622 printf( FMT4, nDescription );
1623 printf( FMT5, offDescription );
1624 printf( FMT6, nPalEntries );
1625 edit_sizel(
"szlDevice\t", szlDevice );
1626 edit_sizel(
"szlMillimeters\t", szlMillimeters );
1629#define OffsetOf( a, b ) ((unsigned int)(((const char*)&(((const ::ENHMETAHEADER*)a)->b)) - \
1630(const char*)((const ::ENHMETAHEADER*)a)))
1632 if ( OffsetOf(
this, cbPixelFormat ) <= offDescription ) {
1633 printf( FMT7, cbPixelFormat );
1634 printf( FMT8, offPixelFormat );
1635 printf( FMT9, bOpenGL );
1638 edit_sizel(
"szlMicrometers\t", szlMicrometers );
1645 if ( nDescription != 0 ) {
1648 WCHAR* description = description_w;
1650 printf(
"\tDescription:" );
1652 for ( DWORD i = 0; i < nDescription; i++ ) {
1654 wchar_t w = *description++;
1658 if ( last_w == 0 ) printf(
"\n\t\t" );
1683 emr.iType = EMR_EOF;
1696 ds >> emr >> nPalEntries >> offPalEntries >> nSizeLast;
1704 ds << emr << nPalEntries << offPalEntries << nSizeLast;
1710 int size (
void )
const {
return emr.nSize; }
1722#ifdef ENABLE_EDITING
1726 void edit (
void )
const
1728 printf(
"*EOF*\n" );
1747 emr.iType = EMR_SETVIEWPORTORGEX;
1758 ds >> emr >> ptlOrigin;
1765 ds << emr << ptlOrigin;
1771 int size (
void )
const {
return emr.nSize; }
1780 SetViewportOrgEx( dc, ptlOrigin.x, ptlOrigin.y, 0 );
1782#ifdef ENABLE_EDITING
1786 void edit (
void )
const
1788 printf(
"*SETVIEWPORTORGEX*\n" );
1789 edit_pointl(
"ptlOrigin", ptlOrigin );
1810 emr.iType = EMR_SETWINDOWORGEX;
1821 ds >> emr >> ptlOrigin;
1828 ds << emr << ptlOrigin;
1834 int size (
void )
const {
return emr.nSize; }
1843 SetWindowOrgEx( dc, ptlOrigin.x, ptlOrigin.y, 0 );
1845#ifdef ENABLE_EDITING
1849 void edit (
void )
const
1851 printf(
"*SETWINDOWORGEX*\n" );
1852 edit_pointl(
"ptlOrigin", ptlOrigin );
1871 emr.iType = EMR_SETVIEWPORTEXTEX;
1882 ds >> emr >> szlExtent;
1889 ds << emr << szlExtent;
1895 int size (
void )
const {
return emr.nSize; }
1904 SetViewportExtEx( dc, szlExtent.cx, szlExtent.cy, 0 );
1906#ifdef ENABLE_EDITING
1910 void edit (
void )
const
1912 printf(
"*SETVIEWPORTEXTEX*\n" );
1913 edit_sizel(
"szlExtent", szlExtent );
1934 emr.iType = EMR_SCALEVIEWPORTEXTEX;
1947 ds >> emr >> xNum >> xDenom >> yNum >> yDenom;
1954 ds << emr << xNum << xDenom << yNum << yDenom;
1960 int size (
void )
const {
return emr.nSize; }
1969 ScaleViewportExtEx( dc, xNum, xDenom, yNum, yDenom, 0 );
1971#ifdef ENABLE_EDITING
1975 void edit (
void )
const
1977#if defined(__LP64__)
1978 const char* FMT0 =
"\txNum\t: %d\n";
1979 const char* FMT1 =
"\txDenom\t: %d\n";
1980 const char* FMT2 =
"\tyNum\t: %d\n";
1981 const char* FMT3 =
"\tyDenom\t: %d\n";
1983 const char* FMT0 =
"\txNum\t: %ld\n";
1984 const char* FMT1 =
"\txDenom\t: %ld\n";
1985 const char* FMT2 =
"\tyNum\t: %ld\n";
1986 const char* FMT3 =
"\tyDenom\t: %ld\n";
1988 printf(
"*SCALEVIEWPORTEXTEX*\n" );
1989 printf( FMT0, xNum );
1990 printf( FMT1, xDenom );
1991 printf( FMT2, yNum );
1992 printf( FMT3, yDenom );
2011 emr.iType = EMR_SETWINDOWEXTEX;
2022 ds >> emr >> szlExtent;
2029 ds << emr << szlExtent;
2035 int size (
void )
const {
return emr.nSize; }
2044 SetWindowExtEx( dc, szlExtent.cx, szlExtent.cy, 0 );
2046#ifdef ENABLE_EDITING
2050 void edit (
void )
const
2052 printf(
"*SETWINDOWEXTEX*\n" );
2053 edit_sizel(
"szlExtent", szlExtent );
2074 emr.iType = EMR_SCALEWINDOWEXTEX;
2087 ds >> emr >> xNum >> xDenom >> yNum >> yDenom;
2094 ds << emr << xNum << xDenom << yNum << yDenom;
2100 int size (
void )
const {
return emr.nSize; }
2109 ScaleWindowExtEx( dc, xNum, xDenom, yNum, yDenom, 0 );
2111#ifdef ENABLE_EDITING
2115 void edit (
void )
const
2117#if defined(__LP64__)
2118 const char* FMT0 =
"\txNum\t: %d\n";
2119 const char* FMT1 =
"\txDenom\t: %d\n";
2120 const char* FMT2 =
"\tyNum\t: %d\n";
2121 const char* FMT3 =
"\tyDenom\t: %d\n";
2123 const char* FMT0 =
"\txNum\t: %ld\n";
2124 const char* FMT1 =
"\txDenom\t: %ld\n";
2125 const char* FMT2 =
"\tyNum\t: %ld\n";
2126 const char* FMT3 =
"\tyDenom\t: %ld\n";
2128 printf(
"*SCALEWINDOWEXTEX*\n" );
2129 printf( FMT0, xNum );
2130 printf( FMT1, xDenom );
2131 printf( FMT2, yNum );
2132 printf( FMT3, yDenom );
2153 emr.iType = EMR_MODIFYWORLDTRANSFORM;
2164 ds >> emr >> xform >> iMode;
2171 ds << emr << xform << iMode;
2177 int size (
void )
const {
return emr.nSize; }
2186 ModifyWorldTransform( dc, &xform, iMode );
2188#ifdef ENABLE_EDITING
2192 void edit (
void )
const
2194#if defined(__LP64__)
2195 const char* FMT =
"unknown(%d)\n";
2197 const char* FMT =
"unknown(%ld)\n";
2199 printf(
"*MODIFYWORLDTRANSFORM*\n" );
2200 edit_xform(
"xform", xform );
2201 printf(
"\tiMode\t\t: " );
2203 case MWT_IDENTITY: printf(
"MWT_IDENTITY\n" );
break;
2204 case MWT_LEFTMULTIPLY: printf(
"MWT_LEFTMULTIPLY\n" );
break;
2205 case MWT_RIGHTMULTIPLY: printf(
"MWT_RIGHTMULTIPLY\n" );
break;
2206 default: printf( FMT, iMode );
2226 emr.iType = EMR_SETWORLDTRANSFORM;
2249 int size (
void )
const {
return emr.nSize; }
2258 SetWorldTransform( dc, &xform );
2260#ifdef ENABLE_EDITING
2264 void edit (
void )
const
2266 printf(
"*SETWORLDTRANSFORM*\n" );
2267 edit_xform(
"xform", xform );
2283 emr.iType = EMR_SETTEXTALIGN;
2306 int size (
void )
const {
return emr.nSize; }
2315 SetTextAlign( dc, iMode );
2317#ifdef ENABLE_EDITING
2321 void edit (
void )
const
2323#if defined(__LP64__)
2324 const char* FMT =
"| unknown bits(0x%x)";
2326 const char* FMT =
"| unknown bits(0x%lx)";
2328 unsigned int known_bits = TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING;
2329 unsigned int unknown_bits = ~known_bits;
2331 printf(
"*SETTEXTALIGN*\n" );
2332 printf(
"\tiMode\t: " );
2333 if ( iMode & TA_UPDATECP )
2334 printf(
"TA_UPDATECP" );
2336 printf(
"TA_NOUPDATECP" );
2337 if ( iMode & TA_CENTER )
2338 printf(
" | TA_CENTER" );
2339 else if ( iMode & TA_RIGHT )
2340 printf(
" | TA_RIGHT" );
2342 printf(
" | TA_LEFT" );
2343 if ( iMode & TA_BASELINE )
2344 printf(
" | TA_BASELINE" );
2345 else if ( iMode & TA_BOTTOM )
2346 printf(
" | TA_BOTTOM" );
2348 printf(
" | TA_TOP" );
2349 if ( iMode & TA_RTLREADING )
2350 printf(
" | TA_RTLREADING" );
2351 if ( iMode & unknown_bits )
2352 printf( FMT, iMode & unknown_bits );
2369 emr.iType = EMR_SETTEXTCOLOR;
2379 ds >> emr >> crColor;
2386 ds << emr << crColor;
2392 int size (
void )
const {
return emr.nSize; }
2401 SetTextColor( dc, crColor );
2403#ifdef ENABLE_EDITING
2407 void edit (
void )
const
2409 printf(
"*SETTEXTCOLOR*\n" );
2410 edit_color(
"crColor", crColor );
2426 emr.iType = EMR_SETBKCOLOR;
2436 ds >> emr >> crColor;
2443 ds << emr << crColor;
2449 int size (
void )
const {
return emr.nSize; }
2458 SetBkColor( dc, crColor );
2460#ifdef ENABLE_EDITING
2464 void edit (
void )
const
2466 printf(
"*SETBKCOLOR*\n" );
2467 edit_color(
"crColor", crColor );
2484 emr.iType = EMR_SETBKMODE;
2507 int size (
void )
const {
return emr.nSize; }
2516 SetBkMode( dc, iMode );
2518#ifdef ENABLE_EDITING
2522 void edit (
void )
const
2524#if defined(__LP64__)
2525 const char* FMT =
"unknown(%d)\n";
2527 const char* FMT =
"unknown(%ld)\n";
2529 printf(
"*SETBKMODE*\n" );
2530 printf(
"\tiMode\t: " );
2532 case TRANSPARENT: printf(
"TRANSPARENT\n" );
break;
2533 case OPAQUE: printf(
"OPAQUE\n" );
break;
2534 default: printf( FMT, iMode );
2551 emr.iType = EMR_SETPOLYFILLMODE;
2574 int size (
void )
const {
return emr.nSize; }
2583 SetPolyFillMode( dc, iMode );
2585#ifdef ENABLE_EDITING
2589 void edit (
void )
const
2591#if defined(__LP64__)
2592 const char* FMT =
"unknown(%d)\n";
2594 const char* FMT =
"unknown(%ld)\n";
2596 printf(
"*SETPOLYFILLMODE*\n" );
2597 printf(
"\tiMode: " );
2599 case ALTERNATE: printf(
"ALTERNATE\n" );
break;
2600 case WINDING: printf(
"WINDING\n" );
break;
2601 default: printf( FMT, iMode );
2619 emr.iType = EMR_SETMAPMODE;
2642 int size (
void )
const {
return emr.nSize; }
2651 SetMapMode( dc, iMode );
2653#ifdef ENABLE_EDITING
2657 void edit (
void )
const
2659#if defined(__LP64__)
2660 const char* FMT =
"unknown(%d)\n";
2662 const char* FMT =
"unknown(%ld)\n";
2664 printf(
"*SETMAPMODE*\n" );
2665 printf(
"\tiMode\t: " );
2667 case MM_TEXT: printf(
"MM_TEXT\n" );
break;
2668 case MM_LOMETRIC: printf(
"MM_LOMETRIC\n" );
break;
2669 case MM_HIMETRIC: printf(
"MM_HIMETRIC\n" );
break;
2670 case MM_LOENGLISH: printf(
"MM_LOENGLISH\n" );
break;
2671 case MM_HIENGLISH: printf(
"MM_HIENGLISH\n" );
break;
2672 case MM_TWIPS: printf(
"MM_TWIPS\n" );
break;
2673 case MM_ISOTROPIC: printf(
"MM_ISOTROPIC\n" );
break;
2674 case MM_ANISOTROPIC: printf(
"MM_ANISOTROPIC\n" );
break;
2675 default: printf( FMT, iMode );
2692 emr.iType = EMR_SELECTOBJECT;
2702 ds >> emr >> ihObject;
2709 ds << emr << ihObject;
2715 int size (
void )
const {
return emr.nSize; }
2722#ifdef ENABLE_EDITING
2726 void edit (
void )
const
2728#if defined(__LP64__)
2729 const char* FMT =
"\tihObject\t: 0x%x\n";
2731 const char* FMT =
"\tihObject\t: 0x%lx\n";
2733 printf(
"*SELECTOBJECT*\n" );
2734 printf( FMT, ihObject );
2750 emr.iType = EMR_DELETEOBJECT;
2760 ds >> emr >> ihObject;
2767 ds << emr << ihObject;
2773 int size (
void )
const {
return emr.nSize; }
2780#ifdef ENABLE_EDITING
2784 void edit (
void )
const
2786#if defined(__LP64__)
2787 const char* FMT =
"\tihObject\t: 0x%x\n";
2789 const char* FMT =
"\tihObject\t: 0x%lx\n";
2791 printf(
"*DELETEOBJECT*\n" );
2792 printf( FMT, ihObject );
2809 emr.iType = EMR_MOVETOEX;
2833 int size (
void )
const {
return emr.nSize; }
2842 MoveToEx( dc, ptl.x, ptl.y, 0 );
2844#ifdef ENABLE_EDITING
2848 void edit (
void )
const
2850 printf(
"*MOVETOEX*\n" );
2851 edit_pointl(
"ptl", ptl );
2868 emr.iType = EMR_LINETO;
2892 int size (
void )
const {
return emr.nSize; }
2901 LineTo( dc, ptl.x, ptl.y );
2903#ifdef ENABLE_EDITING
2907 void edit (
void )
const
2909 printf(
"*LINETO*\n" );
2910 edit_pointl(
"ptl", ptl );
2932 EMRARC ( INT left, INT top, INT right, INT bottom, INT xstart,
2933 INT ystart, INT xend, INT yend )
2935 emr.iType = EMR_ARC;
2938 rclBox.right = right;
2939 rclBox.bottom = bottom;
2941 ptlStart.x = xstart;
2942 ptlStart.y = ystart;
2952 ds >> emr >> rclBox >> ptlStart >> ptlEnd;
2959 ds << emr << rclBox << ptlStart << ptlEnd;
2965 int size (
void )
const {
return emr.nSize; }
2974 Arc( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom,
2975 ptlStart.x, ptlStart.y, ptlEnd.x, ptlEnd.y );
2977#ifdef ENABLE_EDITING
2981 void edit (
void )
const
2983 printf(
"*ARC*\n" );
2984 edit_rectl(
"rclBox\t", rclBox );
2985 edit_pointl(
"ptlStart", ptlStart );
2986 edit_pointl(
"ptlEnd\t", ptlEnd );
3008 EMRARCTO ( INT left, INT top, INT right, INT bottom, INT xstart,
3009 INT ystart, INT xend, INT yend )
3011 emr.iType = EMR_ARCTO;
3014 rclBox.right = right;
3015 rclBox.bottom = bottom;
3017 ptlStart.x = xstart;
3018 ptlStart.y = ystart;
3028 ds >> emr >> rclBox >> ptlStart >> ptlEnd;
3035 ds << emr << rclBox << ptlStart << ptlEnd;
3041 int size (
void )
const {
return emr.nSize; }
3050 ArcTo( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom,
3051 ptlStart.x, ptlStart.y, ptlEnd.x, ptlEnd.y );
3053#ifdef ENABLE_EDITING
3057 void edit (
void )
const
3059 printf(
"*ARCTO*\n" );
3060 edit_rectl(
"rclBox\t", rclBox );
3061 edit_pointl(
"ptlStart", ptlStart );
3062 edit_pointl(
"ptlEnd\t", ptlEnd );
3081 emr.iType = EMR_RECTANGLE;
3084 rclBox.right = right;
3085 rclBox.bottom = bottom;
3094 ds >> emr >> rclBox;
3101 ds << emr << rclBox;
3107 int size (
void )
const {
return emr.nSize; }
3116 Rectangle( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom );
3118#ifdef ENABLE_EDITING
3122 void edit (
void )
const
3124 printf(
"*RECTANGLE*\n" );
3125 edit_rectl(
"rclBox", rclBox );
3145 emr.iType = EMR_ELLIPSE;
3148 rclBox.right = right;
3149 rclBox.bottom = bottom;
3158 ds >> emr >> rclBox;
3165 ds << emr << rclBox;
3171 int size (
void )
const {
return emr.nSize; }
3180 Ellipse( dc, rclBox.left, rclBox.top, rclBox.right, rclBox.bottom );
3182#ifdef ENABLE_EDITING
3186 void edit (
void )
const
3188 printf(
"*ELLIPSE*\n" );
3189 edit_rectl(
"rclBox", rclBox );
3199 POINTL* lpoints{
nullptr};
3212 emr.iType = EMR_POLYLINE;
3214 emr.nSize =
sizeof(
::EMRPOLYLINE ) +
sizeof( POINTL ) * ( cptl - 1);
3216 lpoints =
new POINTL[cptl];
3218 for (
int i=0; i<n; i++) {
3219 lpoints[i].x = points[i].x;
3220 lpoints[i].y = points[i].y;
3223 rclBounds = *bounds;
3230 if ( lpoints )
delete[] lpoints;
3238 ds >> emr >> rclBounds >> cptl;
3241 sizeof(POINTL) * cptl ) {
3242 throw std::runtime_error(
"Invalid record size" );
3245 std::unique_ptr<POINTL[]> buffer(
new POINTL[cptl] );
3250 lpoints = buffer.release();
3257 ds << emr << rclBounds << cptl <<
POINTLARRAY( lpoints, cptl );
3263 int size (
void )
const {
return emr.nSize; }
3273 Polyline( dc, (POINT*)lpoints, cptl );
3275#ifdef ENABLE_EDITING
3279 void edit (
void )
const
3281 printf(
"*POLYLINE*\n" );
3282 edit_rectl(
"rclBounds", rclBounds );
3283 edit_pointlarray(
"\t", cptl, lpoints );
3293 POINT16* lpoints{
nullptr };
3306 emr.iType = EMR_POLYLINE16;
3308 emr.nSize =
sizeof(
::EMRPOLYLINE16 ) +
sizeof( POINT16 ) * ( cpts - 1);
3310 lpoints =
new POINT16[cpts];
3312 for (
int i=0; i<n; i++) {
3313 lpoints[i].x = points[i].x;
3314 lpoints[i].y = points[i].y;
3317 rclBounds = *bounds;
3331 emr.iType = EMR_POLYLINE16;
3333 emr.nSize =
sizeof(
::EMRPOLYLINE16 ) +
sizeof( POINT16 ) * ( cpts - 1);
3335 lpoints =
new POINT16[cpts];
3337 for (
int i=0; i<n; i++) {
3338 lpoints[i].x = points[i].x;
3339 lpoints[i].y = points[i].y;
3342 rclBounds = *bounds;
3349 if ( lpoints )
delete[] lpoints;
3357 ds >> emr >> rclBounds >> cpts;
3360 sizeof(POINT16) * cpts ) {
3361 throw std::runtime_error(
"Invalid record size" );
3364 std::unique_ptr<POINT16[]> buffer(
new POINT16[cpts] );
3370 lpoints = buffer.release();
3377 ds << emr << rclBounds << cpts <<
POINT16ARRAY( lpoints, cpts );
3383 int size (
void )
const {
return emr.nSize; }
3393 Polyline16( dc, lpoints, cpts );
3395#ifdef ENABLE_EDITING
3399 void edit (
void )
const
3401 printf(
"*POLYLINE16*\n" );
3402 edit_rectl(
"rclBounds", rclBounds );
3403 edit_point16array(
"\t", cpts, lpoints );
3413 POINTL* lpoints{
nullptr };
3426 emr.iType = EMR_POLYGON;
3428 emr.nSize =
sizeof(
::EMRPOLYGON ) +
sizeof( POINTL ) * (cptl-1);
3430 lpoints =
new POINTL[cptl];
3432 for (
int i=0; i<n; i++) {
3433 lpoints[i].x = points[i].x;
3434 lpoints[i].y = points[i].y;
3437 rclBounds = *bounds;
3445 ds >> emr >> rclBounds >> cptl;
3447 if ( emr.nSize - (
sizeof(
::EMRPOLYGON) -
sizeof(POINTL)) <
3448 cptl *
sizeof(POINTL) ) {
3449 throw std::runtime_error(
"Invalid record size" );
3452 std::unique_ptr<POINTL[]> buffer(
new POINTL[cptl] );
3458 lpoints = buffer.release();
3465 if ( lpoints )
delete[] lpoints;
3472 ds << emr << rclBounds << cptl <<
POINTLARRAY( lpoints, cptl );
3478 int size (
void )
const {
return emr.nSize; }
3488 Polygon( dc, (POINT*)lpoints, cptl );
3490#ifdef ENABLE_EDITING
3494 void edit (
void )
const
3496 printf(
"*POLYGON*\n" );
3497 edit_rectl(
"rclBounds", rclBounds );
3498 edit_pointlarray(
"\t", cptl, lpoints );
3508 POINT16* lpoints{
nullptr };
3521 emr.iType = EMR_POLYGON16;
3523 emr.nSize =
sizeof(
::EMRPOLYGON16 ) +
sizeof( POINT16 ) * (cpts-1);
3525 lpoints =
new POINT16[cpts];
3527 for (
int i=0; i<n; i++) {
3528 lpoints[i].x = points[i].x;
3529 lpoints[i].y = points[i].y;
3532 rclBounds = *bounds;
3546 emr.iType = EMR_POLYGON16;
3548 emr.nSize =
sizeof(
::EMRPOLYGON16 ) +
sizeof( POINT16 ) * (cpts-1);
3550 lpoints =
new POINT16[cpts];
3552 for (
int i=0; i<n; i++) {
3553 lpoints[i].x = points[i].x;
3554 lpoints[i].y = points[i].y;
3557 rclBounds = *bounds;
3565 ds >> emr >> rclBounds >> cpts;
3568 cpts *
sizeof(POINT16) ) {
3569 throw std::runtime_error(
"Invalid record size" );
3572 std::unique_ptr<POINT16[]> buffer(
new POINT16[cpts] );
3578 lpoints = buffer.release();
3585 if ( lpoints )
delete[] lpoints;
3592 ds << emr << rclBounds << cpts <<
POINT16ARRAY( lpoints, cpts );
3598 int size (
void )
const {
return emr.nSize; }
3608 Polygon16( dc, lpoints, cpts );
3610#ifdef ENABLE_EDITING
3614 void edit (
void )
const
3616 printf(
"*POLYGON16*\n" );
3617 edit_rectl(
"rclBounds", rclBounds );
3618 edit_point16array(
"\t", cpts, lpoints );
3628 DWORD* lcounts{
nullptr };
3629 POINTL* lpoints{
nullptr };
3643 for (
unsigned int i = 0; i < nPolys; i++ )
3651 emr.iType = EMR_POLYPOLYGON;
3655 +
sizeof( DWORD ) * (nPolys-1);
3657 lcounts =
new DWORD[nPolys];
3659 for (
unsigned int i = 0; i < nPolys; i++ )
3660 lcounts[i] = counts[i];
3662 lpoints =
new POINTL[cptl];
3664 for (
int i=0; i<n; i++) {
3665 lpoints[i].x = points[i].x;
3666 lpoints[i].y = points[i].y;
3669 rclBounds = *bounds;
3676 if ( lcounts )
delete[] lcounts;
3677 if ( lpoints )
delete[] lpoints;
3685 ds >> emr >> rclBounds >> nPolys >> cptl;
3687 if ( emr.nSize - (
sizeof(
::EMRPOLYPOLYGON ) -
sizeof(POINTL) -
sizeof(DWORD) ) <
3688 sizeof( POINTL ) * cptl +
sizeof( DWORD ) * nPolys ) {
3689 throw std::runtime_error(
"Invalid record size" );
3692 std::unique_ptr<DWORD[]> cbuffer(
new DWORD[nPolys] );
3700 DWORD n{0}, n_old{0};
3701 for ( DWORD c{0}; c < nPolys; ++c ) {
3705 throw std::runtime_error(
"Unsigned overflow" );
3709 throw std::runtime_error(
"Too few points" );
3712 std::unique_ptr<POINTL[]> pbuffer(
new POINTL[cptl] );
3719 lcounts = cbuffer.release();
3720 lpoints = pbuffer.release();
3727 ds << emr << rclBounds << nPolys << cptl <<
DWORDARRAY( lcounts, nPolys )
3734 int size (
void )
const {
return emr.nSize; }
3745 std::vector<INT> countsv( lcounts, lcounts + nPolys );
3747 PolyPolygon( dc, (POINT*)lpoints, countsv.data(), nPolys );
3749#ifdef ENABLE_EDITING
3753 void edit (
void )
const
3755#if defined(__LP64__)
3756 const char* FMT0 =
"\tnPolys\t\t: %d\n";
3757 const char* FMT1 =
"\tcptl\t\t: %d\n";
3758 const char* FMT2 =
"%d\n";
3759 const char* FMT3 =
"\t\t\t %d\n";
3760 const char* FMT4 =
"%d, %d\n";
3761 const char* FMT5 =
"\t\t\t %d, %d\n";
3763 const char* FMT0 =
"\tnPolys\t\t: %ld\n";
3764 const char* FMT1 =
"\tcptl\t\t: %ld\n";
3765 const char* FMT2 =
"%ld\n";
3766 const char* FMT3 =
"\t\t\t %ld\n";
3767 const char* FMT4 =
"%ld, %ld\n";
3768 const char* FMT5 =
"\t\t\t %ld, %ld\n";
3770 printf(
"*POLYPOLYGON*\n" );
3771 edit_rectl(
"rclBounds", rclBounds );
3772 printf( FMT0, nPolys );
3773 printf( FMT1, cptl );
3774 printf(
"\taPolyCounts\t: " );
3776 printf( FMT2, lcounts[0] );
3779 for (
unsigned int i = 1; i < nPolys; i++ )
3780 printf( FMT3, lcounts[i] );
3781 printf(
"\tapts\t\t: " );
3783 printf( FMT4, lpoints[0].x, lpoints[0].y );
3786 for (
unsigned int i = 1; i < cptl; i++ )
3787 printf( FMT5, lpoints[i].x, lpoints[i].y );
3797 DWORD* lcounts{
nullptr };
3798 POINT16* lpoints{
nullptr };
3807 const INT* counts, UINT polygons )
3812 for (
unsigned int i = 0; i < nPolys; i++ )
3820 emr.iType = EMR_POLYPOLYGON16;
3824 +
sizeof( DWORD ) * (nPolys-1);
3826 lcounts =
new DWORD[nPolys];
3828 for (
unsigned int i = 0; i < nPolys; i++ )
3829 lcounts[i] = counts[i];
3831 lpoints =
new POINT16[cpts];
3833 for (
int i=0; i<n; i++) {
3834 lpoints[i].x = points[i].x;
3835 lpoints[i].y = points[i].y;
3838 rclBounds = *bounds;
3848 const INT* counts, UINT16 polygons )
3853 for (
unsigned int i = 0; i < nPolys; i++ )
3861 emr.iType = EMR_POLYPOLYGON16;
3865 +
sizeof( DWORD ) * (nPolys-1);
3867 lcounts =
new DWORD[nPolys];
3869 for (
unsigned int i = 0; i < nPolys; i++ )
3870 lcounts[i] = counts[i];
3872 lpoints =
new POINT16[cpts];
3874 for (
int i=0; i<n; i++) {
3875 lpoints[i].x = points[i].x;
3876 lpoints[i].y = points[i].y;
3879 rclBounds = *bounds;
3886 if ( lcounts )
delete[] lcounts;
3887 if ( lpoints )
delete[] lpoints;
3895 ds >> emr >> rclBounds >> nPolys >> cpts;
3897 if ( emr.nSize - (
sizeof(
::EMRPOLYPOLYGON16 ) -
sizeof(POINT16) -
sizeof(DWORD) ) <
3898 sizeof( POINT16 ) * cpts +
sizeof( DWORD ) * nPolys ) {
3899 throw std::runtime_error(
"Invalid record size" );
3902 std::unique_ptr<DWORD[]> cbuffer(
new DWORD[nPolys] );
3910 DWORD n{0}, n_old{0};
3911 for ( DWORD c{0}; c < nPolys; ++c ) {
3915 throw std::runtime_error(
"Unsigned overflow" );
3919 throw std::runtime_error(
"Too few points" );
3922 std::unique_ptr<POINT16[]> pbuffer(
new POINT16[cpts] );
3928 lcounts = cbuffer.release();
3929 lpoints = pbuffer.release();
3936 ds << emr << rclBounds << nPolys << cpts <<
DWORDARRAY( lcounts, nPolys )
3943 int size (
void )
const {
return emr.nSize; }
3954 std::vector<INT> counts( lcounts, lcounts + nPolys );
3956 PolyPolygon16( dc, lpoints, counts.data(), nPolys );
3958#ifdef ENABLE_EDITING
3962 void edit (
void )
const
3964#if defined(__LP64__)
3965 const char* FMT0 =
"\tnPolys\t\t: %d\n";
3966 const char* FMT1 =
"\tcptl\t\t: %d\n";
3967 const char* FMT2 =
"%d\n";
3968 const char* FMT3 =
"\t\t\t %d\n";
3970 const char* FMT0 =
"\tnPolys\t\t: %ld\n";
3971 const char* FMT1 =
"\tcptl\t\t: %ld\n";
3972 const char* FMT2 =
"%ld\n";
3973 const char* FMT3 =
"\t\t\t %ld\n";
3975 printf(
"*POLYPOLYGON16*\n" );
3976 edit_rectl(
"rclBounds", rclBounds );
3977 printf( FMT0, nPolys );
3978 printf( FMT1, cpts );
3979 printf(
"\taPolyCounts\t: " );
3981 printf( FMT2, lcounts[0] );
3984 for (
unsigned int i = 1; i < nPolys; i++ )
3985 printf( FMT3, lcounts[i] );
3986 printf(
"\tapts\t\t: " );
3988 printf(
"%d, %d\n", lpoints[0].x, lpoints[0].y );
3991 for (
unsigned int i = 1; i < cpts; i++ )
3992 printf(
"\t\t\t %d, %d\n", lpoints[i].x, lpoints[i].y );
4002 POINTL* lpoints{
nullptr };
4015 emr.iType = EMR_POLYBEZIER;
4019 lpoints =
new POINTL[cptl];
4021 for (
int i=0; i<n; i++) {
4022 lpoints[i].x = points[i].x;
4023 lpoints[i].y = points[i].y;
4026 rclBounds = *bounds;
4034 ds >> emr >> rclBounds >> cptl;
4037 sizeof( POINTL ) * cptl ) {
4038 throw std::runtime_error(
"Invalid record size" );
4041 std::unique_ptr<POINTL[]> buffer(
new POINTL[cptl] );
4047 lpoints = buffer.release();
4054 if ( lpoints )
delete[] lpoints;
4061 ds << emr << rclBounds << cptl <<
POINTLARRAY( lpoints, cptl );
4067 int size (
void )
const {
return emr.nSize; }
4077 PolyBezier( dc, (POINT*)lpoints, cptl );
4079#ifdef ENABLE_EDITING
4083 void edit (
void )
const
4085 printf(
"*POLYBEZIER*\n" );
4086 edit_rectl(
"rclBounds", rclBounds );
4087 edit_pointlarray(
"\t", cptl, lpoints );
4097 POINT16* lpoints{
nullptr };
4110 emr.iType = EMR_POLYBEZIER16;
4114 lpoints =
new POINT16[cpts];
4116 for (
int i=0; i<n; i++) {
4117 lpoints[i].x = points[i].x;
4118 lpoints[i].y = points[i].y;
4121 rclBounds = *bounds;
4135 emr.iType = EMR_POLYBEZIER16;
4139 lpoints =
new POINT16[cpts];
4141 for (
int i=0; i<n; i++) {
4142 lpoints[i].x = points[i].x;
4143 lpoints[i].y = points[i].y;
4146 rclBounds = *bounds;
4154 ds >> emr >> rclBounds >> cpts;
4157 sizeof( POINT16 ) * cpts ) {
4158 throw std::runtime_error(
"Invalid record size" );
4161 std::unique_ptr<POINT16[]> buffer(
new POINT16[cpts] );
4167 lpoints = buffer.release();
4174 if ( lpoints )
delete[] lpoints;
4181 ds << emr << rclBounds << cpts <<
POINT16ARRAY( lpoints, cpts );
4187 int size (
void )
const {
return emr.nSize; }
4197 PolyBezier16( dc, lpoints, cpts );
4199#ifdef ENABLE_EDITING
4203 void edit (
void )
const
4205 printf(
"*POLYBEZIER16*\n" );
4206 edit_rectl(
"rclBounds", rclBounds );
4207 edit_point16array(
"\t", cpts, lpoints );
4217 POINTL* lpoints{
nullptr };
4230 emr.iType = EMR_POLYBEZIERTO;
4234 lpoints =
new POINTL[cptl];
4236 for (
int i=0; i<n; i++) {
4237 lpoints[i].x = points[i].x;
4238 lpoints[i].y = points[i].y;
4241 rclBounds = *bounds;
4249 ds >> emr >> rclBounds >> cptl;
4252 sizeof( POINTL ) * cptl ) {
4253 throw std::runtime_error(
"Invalid record size" );
4256 std::unique_ptr<POINTL[]> buffer(
new POINTL[cptl] );
4262 lpoints = buffer.release();
4269 if ( lpoints )
delete[] lpoints;
4276 ds << emr << rclBounds << cptl <<
POINTLARRAY( lpoints, cptl );
4282 int size (
void )
const {
return emr.nSize; }
4292 PolyBezierTo( dc, (POINT*)lpoints, cptl );
4294#ifdef ENABLE_EDITING
4298 void edit (
void )
const
4300 printf(
"*POLYBEZIERTO*\n" );
4301 edit_rectl(
"rclBounds", rclBounds );
4302 edit_pointlarray(
"\t", cptl, lpoints );
4312 POINT16* lpoints{
nullptr };
4325 emr.iType = EMR_POLYBEZIERTO16;
4329 lpoints =
new POINT16[cpts];
4331 for (
int i=0; i<n; i++) {
4332 lpoints[i].x = points[i].x;
4333 lpoints[i].y = points[i].y;
4336 rclBounds = *bounds;
4350 emr.iType = EMR_POLYBEZIERTO16;
4354 lpoints =
new POINT16[cpts];
4356 for (
int i=0; i<n; i++) {
4357 lpoints[i].x = points[i].x;
4358 lpoints[i].y = points[i].y;
4361 rclBounds = *bounds;
4369 ds >> emr >> rclBounds >> cpts;
4372 sizeof( POINT16 ) * cpts ) {
4373 throw std::runtime_error(
"Invalid record size" );
4376 std::unique_ptr<POINT16[]> buffer(
new POINT16[cpts] );
4382 lpoints = buffer.release();
4389 if ( lpoints )
delete[] lpoints;
4396 ds << emr << rclBounds << cpts <<
POINT16ARRAY( lpoints, cpts );
4402 int size (
void )
const {
return emr.nSize; }
4412 PolyBezierTo16( dc, lpoints, cpts );
4414#ifdef ENABLE_EDITING
4418 void edit (
void )
const
4420 printf(
"*POLYBEZIERTO16*\n" );
4421 edit_rectl(
"rclBounds", rclBounds );
4422 edit_point16array(
"\t", cpts, lpoints );
4432 POINTL* lpoints{
nullptr };
4445 emr.iType = EMR_POLYLINETO;
4449 lpoints =
new POINTL[cptl];
4451 for (
int i=0; i<n; i++) {
4452 lpoints[i].x = points[i].x;
4453 lpoints[i].y = points[i].y;
4456 rclBounds = *bounds;
4464 ds >> emr >> rclBounds >> cptl;
4467 sizeof( POINTL ) * cptl ) {
4468 throw std::runtime_error(
"Invalid record size" );
4471 std::unique_ptr<POINTL[]> buffer(
new POINTL[cptl] );
4477 lpoints = buffer.release();
4484 if ( lpoints )
delete[] lpoints;
4491 ds << emr << rclBounds << cptl <<
POINTLARRAY( lpoints, cptl );
4497 int size (
void )
const {
return emr.nSize; }
4507 PolylineTo( dc, (POINT*)lpoints, cptl );
4509#ifdef ENABLE_EDITING
4513 void edit (
void )
const
4515 printf(
"*POLYLINETO*\n" );
4516 edit_rectl(
"rclBounds", rclBounds );
4517 edit_pointlarray(
"\t", cptl, lpoints );
4527 POINT16* lpoints{
nullptr };
4540 emr.iType = EMR_POLYLINETO16;
4544 lpoints =
new POINT16[cpts];
4546 for (
int i=0; i<n; i++) {
4547 lpoints[i].x = points[i].x;
4548 lpoints[i].y = points[i].y;
4551 rclBounds = *bounds;
4565 emr.iType = EMR_POLYLINETO16;
4569 lpoints =
new POINT16[cpts];
4571 for (
int i=0; i<n; i++) {
4572 lpoints[i].x = points[i].x;
4573 lpoints[i].y = points[i].y;
4576 rclBounds = *bounds;
4584 ds >> emr >> rclBounds >> cpts;
4587 sizeof( POINT16 ) * cpts ) {
4588 throw std::runtime_error(
"Invalid record size" );
4591 std::unique_ptr<POINT16[]> buffer(
new POINT16[cpts] );
4597 lpoints = buffer.release();
4604 if ( lpoints )
delete[] lpoints;
4611 ds << emr << rclBounds << cpts <<
POINT16ARRAY( lpoints, cpts );
4617 int size (
void )
const {
return emr.nSize; }
4627 PolylineTo16( dc, lpoints, cpts );
4629#ifdef ENABLE_EDITING
4633 void edit (
void )
const
4635 printf(
"*POLYLINETO16*\n" );
4636 edit_rectl(
"rclBounds", rclBounds );
4637 edit_point16array(
"\t", cpts, lpoints );
4649 PSTR string_a{
nullptr };
4652 INT* dx_i{
nullptr };
4664 FLOAT yScale,
const PEMRTEXT text, LPCSTR
string,
4667 emr.iType = EMR_EXTTEXTOUTA;
4670 rclBounds = *bounds;
4672 iGraphicsMode = graphicsMode;
4678 string_size = ROUND_TO_LONG( emrtext.nChars );
4680 string_a =
new CHAR[ string_size ];
4682 memset( string_a, 0,
sizeof(CHAR) * string_size );
4684 for (
unsigned int i=0; i<emrtext.nChars; i++ )
4685 string_a[i] = *
string++;
4687 emrtext.offString = emr.nSize;
4688 emr.nSize += string_size *
sizeof(CHAR);
4696 int * dxn =
new int [string_size];
4697 for (
unsigned int i=0; i < string_size; i++) dxn[i] = 10;
4704 dx_i =
new INT[ emrtext.nChars ];
4706 for (
unsigned int i=0; i<emrtext.nChars; i++ )
4709 emrtext.offDx = emr.nSize;
4710 emr.nSize += emrtext.nChars *
sizeof(INT);
4723 ds >> emr >> rclBounds >> iGraphicsMode >> exScale >> eyScale >> emrtext;
4725 if ( emrtext.nChars > 0 and emrtext.offString == 0 ) {
4726 throw std::runtime_error(
"Invalid text specification" );
4729 if ( emrtext.nChars > emr.nSize - emrtext.offString ) {
4730 throw std::runtime_error(
"Invalid text specification" );
4733 std::unique_ptr<char[]> cbuffer;
4734 std::unique_ptr<INT[]> ibuffer;
4736 if ( emrtext.offString != 0 ) {
4737 string_size = ROUND_TO_LONG( emrtext.nChars );
4739 cbuffer.reset(
new char[string_size] );
4741 memset( cbuffer.get(), 0,
sizeof(CHAR) * string_size );
4743 CHARSTR string( cbuffer.get(), string_size );
4748 if ( emrtext.offDx ) {
4749 ibuffer.reset(
new INT[emrtext.nChars] );
4751 INTARRAY dx_is( ibuffer.get(), emrtext.nChars );
4756 string_a = cbuffer.release();
4757 dx_i = ibuffer.release();
4765 if ( string_a )
delete[] string_a;
4766 if ( dx_i )
delete[] dx_i;
4773 ds << emr << rclBounds << iGraphicsMode << exScale << eyScale
4774 << emrtext <<
CHARSTR( string_a, string_size );
4776 ds <<
INTARRAY( dx_i, emrtext.nChars );
4782 int size (
void )
const {
return emr.nSize; }
4792 rect.left = emrtext.rcl.left;
4793 rect.top = emrtext.rcl.top;
4794 rect.right = emrtext.rcl.right;
4795 rect.bottom = emrtext.rcl.bottom;
4797 ExtTextOutA( dc, emrtext.ptlReference.x, emrtext.ptlReference.y,
4798 emrtext.fOptions, &rect, string_a, emrtext.nChars,
4801#ifdef ENABLE_EDITING
4805 void edit (
void )
const
4807#if defined(__LP64__)
4808 const char* FMT0 =
"unknown(%d)\n";
4809 const char* FMT1 =
"\tptlReference\t: (%d,%d)\n";
4810 const char* FMT2 =
"\tnChars\t\t: %d\n";
4811 const char* FMT3 =
"\toffString\t: %d\n";
4812 const char* FMT4 =
"\toffDx\t\t: %d\n";
4814 const char* FMT0 =
"unknown(%ld)\n";
4815 const char* FMT1 =
"\tptlReference\t: (%ld,%ld)\n";
4816 const char* FMT2 =
"\tnChars\t\t: %ld\n";
4817 const char* FMT3 =
"\toffString\t: %ld\n";
4818 const char* FMT4 =
"\toffDx\t\t: %ld\n";
4820 printf(
"*EXTTEXTOUTA*\n" );
4821 edit_rectl(
"rclBounds", rclBounds );
4822 printf(
"\tiGraphicsMode\t: " );
4823 switch ( iGraphicsMode ) {
4824 case GM_COMPATIBLE: printf(
"GM_COMPATIBLE\n" );
break;
4825 case GM_ADVANCED: printf(
"GM_ADVANCED\n" );
break;
4826 default: printf( FMT0, iGraphicsMode );
4828 printf(
"\texScale\t\t: %f\n", exScale );
4829 printf(
"\teyScale\t\t: %f\n", eyScale );
4830 printf( FMT1, emrtext.ptlReference.x, emrtext.ptlReference.y );
4831 printf( FMT2, emrtext.nChars );
4832 printf( FMT3, emrtext.offString );
4833 printf(
"\tfOptions\t: " );
4834 if ( emrtext.fOptions == 0 )
4837 if ( emrtext.fOptions & ETO_GRAYED ) {
4838 printf(
"ETO_GRAYED" );
4839 if ( emrtext.fOptions & ~ETO_GRAYED )
4842 if ( emrtext.fOptions & ETO_OPAQUE ) {
4843 printf(
"ETO_OPAQUE" );
4844 if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE) )
4847 if ( emrtext.fOptions & ETO_CLIPPED ) {
4848 printf(
"ETO_CLIPPED" );
4849 if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED ) )
4852 if ( emrtext.fOptions & ETO_GLYPH_INDEX ) {
4853 printf(
"ETO_GLYPH_INDEX" );
4854 if ( emrtext.fOptions &
4855 ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX) )
4858 if ( emrtext.fOptions & ETO_RTLREADING ) {
4859 printf(
"ETO_RTLREADING" );
4860 if ( emrtext.fOptions &
4861 ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX |
4865 if ( emrtext.fOptions & ETO_IGNORELANGUAGE )
4866 printf(
"ETO_IGNORELANGUAGE" );
4869 edit_rectl(
"rcl\t", emrtext.rcl );
4870 printf( FMT4, emrtext.offDx );
4871 printf(
"\tString:\n\t\t" );
4872 if ( emrtext.nChars > 0 ) {
4873 for ( DWORD i = 0; i < emrtext.nChars; ++i ) {
4874 putchar( string_a[i] );
4878 printf(
"<empty>" );
4881 if ( emrtext.offDx != 0 ) {
4882 printf(
"\tOffsets:\n\t\t" );
4883 for (
unsigned int i = 0; i < emrtext.nChars; i++ )
4884 printf(
"%d ", dx_i[i] );
4897 PWSTR string_a{
nullptr };
4900 INT* dx_i{
nullptr };
4912 FLOAT yScale,
const PEMRTEXT text, LPCWSTR
string,
4915 emr.iType = EMR_EXTTEXTOUTW;
4918 rclBounds = *bounds;
4920 iGraphicsMode = graphicsMode;
4926 string_size = ROUND_TO_LONG( emrtext.nChars );
4928 string_a =
new WCHAR[ string_size ];
4930 memset( string_a, 0,
sizeof(WCHAR) * string_size );
4932 for (
unsigned int i=0; i<emrtext.nChars; i++ )
4933 string_a[i] = *
string++;
4935 emrtext.offString = emr.nSize;
4936 emr.nSize += string_size *
sizeof(WCHAR);
4944 int * dxn =
new int [string_size];
4945 for (
unsigned int i=0; i < string_size; i++) dxn[i] = 10;
4952 dx_i =
new INT[ emrtext.nChars ];
4954 for (
unsigned int i=0; i<emrtext.nChars; i++ )
4957 emrtext.offDx = emr.nSize;
4958 emr.nSize += emrtext.nChars *
sizeof(INT);
4971 ds >> emr >> rclBounds >> iGraphicsMode >> exScale >> eyScale >> emrtext;
4973 if ( emrtext.nChars > 0 and emrtext.offString == 0 ) {
4974 throw std::runtime_error(
"Invalid text specification" );
4977 if ( emrtext.nChars > emr.nSize - emrtext.offString ) {
4978 throw std::runtime_error(
"Invalid text specification" );
4981 std::unique_ptr<WCHAR[]> cbuffer;
4982 std::unique_ptr<INT[]> ibuffer;
4984 if ( emrtext.offString != 0 ) {
4985 string_size = ROUND_TO_LONG( emrtext.nChars );
4987 cbuffer.reset(
new WCHAR[string_size] );
4989 memset( cbuffer.get(), 0,
sizeof(WCHAR) * string_size );
4991 WCHARSTR string( cbuffer.get(), string_size );
4996 if ( emrtext.offDx ) {
4997 ibuffer.reset(
new INT[ emrtext.nChars ] );
4999 INTARRAY dx_is( ibuffer.get(), emrtext.nChars );
5004 string_a = cbuffer.release();
5005 dx_i = ibuffer.release();
5013 if ( string_a )
delete[] string_a;
5014 if ( dx_i )
delete[] dx_i;
5021 ds << emr << rclBounds << iGraphicsMode << exScale << eyScale
5022 << emrtext <<
WCHARSTR( string_a, string_size );
5024 ds <<
INTARRAY( dx_i, emrtext.nChars );
5030 int size (
void )
const {
return emr.nSize; }
5040 rect.left = emrtext.rcl.left;
5041 rect.top = emrtext.rcl.top;
5042 rect.right = emrtext.rcl.right;
5043 rect.bottom = emrtext.rcl.bottom;
5045 ExtTextOutW( dc, emrtext.ptlReference.x, emrtext.ptlReference.y,
5046 emrtext.fOptions, &rect, string_a, emrtext.nChars,
5049#ifdef ENABLE_EDITING
5053 void edit (
void )
const
5055#if defined(__LP64__)
5056 const char* FMT0 =
"unknown(%d)\n";
5057 const char* FMT1 =
"\tptlReference\t: (%d,%d)\n";
5058 const char* FMT2 =
"\tnChars\t\t: %d\n";
5059 const char* FMT3 =
"\toffString\t: %d\n";
5060 const char* FMT4 =
"\toffDx\t\t: %d\n";
5062 const char* FMT0 =
"unknown(%ld)\n";
5063 const char* FMT1 =
"\tptlReference\t: (%ld,%ld)\n";
5064 const char* FMT2 =
"\tnChars\t\t: %ld\n";
5065 const char* FMT3 =
"\toffString\t: %ld\n";
5066 const char* FMT4 =
"\toffDx\t\t: %ld\n";
5068 printf(
"*EXTTEXTOUTW*\n" );
5069 edit_rectl(
"rclBounds", rclBounds );
5070 printf(
"\tiGraphicsMode\t: " );
5071 switch ( iGraphicsMode ) {
5072 case GM_COMPATIBLE: printf(
"GM_COMPATIBLE\n" );
break;
5073 case GM_ADVANCED: printf(
"GM_ADVANCED\n" );
break;
5074 default: printf( FMT0, iGraphicsMode );
5076 printf(
"\texScale\t\t: %f\n", exScale );
5077 printf(
"\teyScale\t\t: %f\n", eyScale );
5078 printf( FMT1, emrtext.ptlReference.x, emrtext.ptlReference.y );
5079 printf( FMT2, emrtext.nChars );
5080 printf( FMT3, emrtext.offString );
5081 printf(
"\tfOptions\t: " );
5082 if ( emrtext.fOptions == 0 )
5085 if ( emrtext.fOptions & ETO_GRAYED ) {
5086 printf(
"ETO_GRAYED" );
5087 if ( emrtext.fOptions & ~ETO_GRAYED )
5090 if ( emrtext.fOptions & ETO_OPAQUE ) {
5091 printf(
"ETO_OPAQUE" );
5092 if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE) )
5095 if ( emrtext.fOptions & ETO_CLIPPED ) {
5096 printf(
"ETO_CLIPPED" );
5097 if ( emrtext.fOptions & ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED ) )
5100 if ( emrtext.fOptions & ETO_GLYPH_INDEX ) {
5101 printf(
"ETO_GLYPH_INDEX" );
5102 if ( emrtext.fOptions &
5103 ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX) )
5106 if ( emrtext.fOptions & ETO_RTLREADING ) {
5107 printf(
"ETO_RTLREADING" );
5108 if ( emrtext.fOptions &
5109 ~(ETO_GRAYED | ETO_OPAQUE | ETO_CLIPPED | ETO_GLYPH_INDEX |
5113 if ( emrtext.fOptions & ETO_IGNORELANGUAGE )
5114 printf(
"ETO_IGNORELANGUAGE" );
5117 edit_rectl(
"rcl\t", emrtext.rcl );
5118 printf( FMT4, emrtext.offDx );
5120 if ( emrtext.nChars > 0 ) {
5122 iconv_t cvt = iconv_open(
"UTF-8",
"UTF-16LE" );
5123 std::vector<char> utf8_buffer( emrtext.nChars );
5126 size_t size = emrtext.nChars;
5127 size_t in_bytes_left = emrtext.nChars *
sizeof(*string_a);
5128 size_t converted = 0;
5129 char* in_buffer = (
char*)string_a;
5131 char* out_buffer = &utf8_buffer[converted];
5132 size_t out_bytes_left =
size - converted;
5134 size_t n = iconv( cvt, &in_buffer, &in_bytes_left,
5135 &out_buffer, &out_bytes_left );
5137 converted =
size - out_bytes_left;
5139 if ( n == (
size_t)-1 ) {
5140 if ( errno == E2BIG ) {
5141 size_t new_size = 2 * utf8_buffer.size();
5142 utf8_buffer.resize( new_size );
5143 size = utf8_buffer.size();
5157 if ( converted == utf8_buffer.size() )
5158 utf8_buffer.push_back(
'\0' );
5160 utf8_buffer[converted] =
'\0';
5162 printf(
"\tString:\n\t\t%s\n", utf8_buffer.data() );
5165 puts(
"\tString:\n\t\t<empty>\n" );
5168 if ( emrtext.offDx != 0 and emrtext.nChars > 0 ) {
5169 printf(
"\tOffsets:\n\t\t" );
5170 for (
unsigned int i = 0; i < emrtext.nChars; i++ )
5171 printf(
"%d ", dx_i[i] );
5191 emr.iType = EMR_SETPIXELV;
5203 ds >> emr >> ptlPixel >> crColor;
5210 ds << emr << ptlPixel << crColor;
5216 int size (
void )
const {
return emr.nSize; }
5225 SetPixel( dc, ptlPixel.x, ptlPixel.y, crColor );
5227#ifdef ENABLE_EDITING
5231 void edit (
void )
const
5233 printf(
"*SETPIXELV*\n" );
5234 edit_pointl(
"ptlPixel", ptlPixel );
5235 edit_color(
"crColor\t", crColor );
5268 ds << emr << ihPen << lopn;
5274 int size (
void )
const {
return emr.nSize; }
5281#ifdef ENABLE_EDITING
5285 void edit (
void )
const
5287#if defined(__LP64__)
5288 const char* FMT0 =
"\tihPen\t\t: 0x%x\n";
5289 const char* FMT1 =
"\tlopn.lopnWidth\t: %d, %d\n";
5291 const char* FMT0 =
"\tihPen\t\t: 0x%lx\n";
5292 const char* FMT1 =
"\tlopn.lopnWidth\t: %ld, %ld\n";
5294 printf(
"*CREATEPEN*\n" );
5295 printf( FMT0, ihPen );
5296 edit_pen_style(
"lopn.lopnStyle", lopn.lopnStyle );
5297 printf( FMT1, lopn.lopnWidth.x, lopn.lopnWidth.y );
5298 edit_color(
"lopn.lopnColor", lopn.lopnColor );
5326 ds << emr << ihPen << offBmi << cbBmi << offBits << cbBits << elp;
5332 int size (
void )
const {
return emr.nSize; }
5339#ifdef ENABLE_EDITING
5343 void edit (
void )
const
5345#if defined(__LP64__)
5346 const char* FMT0 =
"\tihPen\t\t\t: 0x%x\n";
5347 const char* FMT1 =
"\toffBmi\t\t\t: %d\n";
5348 const char* FMT2 =
"\tcbBmi\t\t\t: %d\n";
5349 const char* FMT3 =
"\toffBits\t\t\t: %d\n";
5350 const char* FMT4 =
"\tcbBits\t\t\t: %d\n";
5351 const char* FMT5 =
"\telp.elpWidth\t\t: %d\n";
5352 const char* FMT6 =
"\telp.elpNumEntries\t: %d\n";
5354 const char* FMT0 =
"\tihPen\t\t\t: 0x%lx\n";
5355 const char* FMT1 =
"\toffBmi\t\t\t: %ld\n";
5356 const char* FMT2 =
"\tcbBmi\t\t\t: %ld\n";
5357 const char* FMT3 =
"\toffBits\t\t\t: %ld\n";
5358 const char* FMT4 =
"\tcbBits\t\t\t: %ld\n";
5359 const char* FMT5 =
"\telp.elpWidth\t\t: %ld\n";
5360 const char* FMT6 =
"\telp.elpNumEntries\t: %ld\n";
5362 printf(
"*EXTCREATEPEN*\n" );
5363 printf( FMT0, ihPen );
5364 printf( FMT1, offBmi );
5365 printf( FMT2, cbBmi );
5366 printf( FMT3, offBits );
5367 printf( FMT4, cbBits );
5368 edit_pen_style(
"elp.elpPenStyle\t", elp.elpPenStyle );
5369 printf( FMT5, elp.elpWidth );
5370 edit_brush_style(
"elp.elpBrushStyle", elp.elpBrushStyle );
5371 edit_color(
"elp.elpColor\t", elp.elpColor );
5372 edit_brush_hatch(
"elp.elpHatch\t", elp.elpHatch );
5373 printf( FMT6, elp.elpNumEntries );
5400 ds << emr << ihBrush << lb;
5406 int size (
void )
const {
return emr.nSize; }
5413#ifdef ENABLE_EDITING
5417 void edit (
void )
const
5419#if defined(__LP64__)
5420 const char* FMT =
"\tihBrush\t\t: 0x%x\n";
5422 const char* FMT =
"\tihBrush\t\t: 0x%lx\n";
5424 printf(
"*CREATEBRUSHINDIRECT*\n" );
5425 printf( FMT, ihBrush );
5426 edit_brush_style(
"lb.lbStyle", lb.lbStyle );
5427 edit_color(
"lb.lbColor", lb.lbColor );
5428 edit_brush_hatch(
"lb.lbHatch", lb.lbHatch );
5459 ds << emr << ihFont << elfw <<
PADDING( 2 );
5466 int size (
void )
const {
return emr.nSize; }
5473#ifdef ENABLE_EDITING
5477 void edit (
void )
const
5479#if defined(__LP64__)
5480 const char* FMT0 =
"\tihFont\t\t\t: %d\n";
5481 const char* FMT1 =
"\tlfHeight\t\t: %d\n";
5482 const char* FMT2 =
"\tlfWidth\t\t\t: %d\n";
5483 const char* FMT3 =
"\tlfEscapement\t\t: %d\n";
5484 const char* FMT4 =
"\tlfOrientation\t\t: %d\n";
5485 const char* FMT5 =
"\telfVersion\t\t: %d\n";
5486 const char* FMT6 =
"\telfStyleSize\t\t: %d\n";
5487 const char* FMT7 =
"\telfMatch\t\t: %d\n";
5488 const char* FMT8 =
"\telfCulture\t\t: %d\n";
5490 const char* FMT0 =
"\tihFont\t\t\t: %ld\n";
5491 const char* FMT1 =
"\tlfHeight\t\t: %ld\n";
5492 const char* FMT2 =
"\tlfWidth\t\t\t: %ld\n";
5493 const char* FMT3 =
"\tlfEscapement\t\t: %ld\n";
5494 const char* FMT4 =
"\tlfOrientation\t\t: %ld\n";
5495 const char* FMT5 =
"\telfVersion\t\t: %ld\n";
5496 const char* FMT6 =
"\telfStyleSize\t\t: %ld\n";
5497 const char* FMT7 =
"\telfMatch\t\t: %ld\n";
5498 const char* FMT8 =
"\telfCulture\t\t: %ld\n";
5500 printf(
"*EXTCREATEFONTINDIRECTW*\n" );
5501 printf( FMT0, ihFont );
5502 printf( FMT1, elfw.elfLogFont.lfHeight );
5503 printf( FMT2, elfw.elfLogFont.lfWidth );
5504 printf( FMT3, elfw.elfLogFont.lfEscapement );
5505 printf( FMT4, elfw.elfLogFont.lfOrientation );
5506 printf(
"\tlfWeight\t\t: " );
5507 switch ( elfw.elfLogFont.lfWeight ) {
5508 case FW_DONTCARE: printf(
"FW_DONTCARE\n" );
break;
5509 case FW_THIN: printf(
"FW_THIN\n" );
break;
5510 case FW_EXTRALIGHT: printf(
"FW_EXTRALIGHT\n" );
break;
5511 case FW_LIGHT: printf(
"FW_LIGHT\n" );
break;
5512 case FW_NORMAL: printf(
"FW_NORMAL\n" );
break;
5513 case FW_MEDIUM: printf(
"FW_MEDIUM\n" );
break;
5514 case FW_SEMIBOLD: printf(
"FW_SEMIBOLD\n" );
break;
5515 case FW_BOLD: printf(
"FW_BOLD\n" );
break;
5516 case FW_EXTRABOLD: printf(
"FW_EXTRABOLD\n" );
break;
5517 case FW_BLACK: printf(
"FW_BLACK\n" );
break;
5519 printf(
"\tlfItalic\t\t: %d\n", elfw.elfLogFont.lfItalic );
5520 printf(
"\tlfUnderline\t\t: %d\n", elfw.elfLogFont.lfUnderline );
5521 printf(
"\tlfStrikeOut\t\t: %d\n", elfw.elfLogFont.lfStrikeOut );
5522 printf(
"\tlfCharSet\t\t: %d\n", elfw.elfLogFont.lfCharSet );
5523 printf(
"\tlfOutPrecision\t\t: %d\n", elfw.elfLogFont.lfOutPrecision );
5524 printf(
"\tlfClipPrecision\t\t: %d\n", elfw.elfLogFont.lfClipPrecision );
5525 printf(
"\tlfQuality\t\t: %d\n", elfw.elfLogFont.lfQuality );
5526 printf(
"\tlfPitchAndFamily\t: %d\n", elfw.elfLogFont.lfPitchAndFamily );
5528 printf(
"\tlfFaceName\t\t: '" );
5529 while ( elfw.elfLogFont.lfFaceName[i] != 0 && i < LF_FACESIZE ) {
5530 putchar( elfw.elfLogFont.lfFaceName[i] );
5536 printf(
"\telfFullName\t\t: '" );
5537 while ( elfw.elfFullName[i] != 0 && i < LF_FULLFACESIZE ) {
5538 putchar( elfw.elfFullName[i] );
5544 printf(
"\telfStyle\t\t: '" );
5545 while ( elfw.elfStyle[i] != 0 && i < LF_FACESIZE ) {
5546 putchar( elfw.elfStyle[i] );
5551 printf( FMT5, elfw.elfVersion );
5552 printf( FMT6, elfw.elfStyleSize );
5553 printf( FMT7, elfw.elfMatch );
5554 printf(
"\telfVendorId\t\t: '%s'\n", elfw.elfVendorId );
5555 printf( FMT8, elfw.elfCulture );
5556 printf(
"\telfPanose\t\t:\n" );
5557 printf(
"\t\tbFamilyType\t\t: %d\n", elfw.elfPanose.bFamilyType );
5558 printf(
"\t\tbSerifStyle\t\t: %d\n", elfw.elfPanose.bSerifStyle );
5559 printf(
"\t\tbWeight\t\t\t: %d\n", elfw.elfPanose.bWeight );
5560 printf(
"\t\tbProportion\t\t: %d\n", elfw.elfPanose.bProportion );
5561 printf(
"\t\tbContrast\t\t: %d\n", elfw.elfPanose.bContrast );
5562 printf(
"\t\tbStrokeVariation\t: %d\n", elfw.elfPanose.bStrokeVariation );
5563 printf(
"\t\tbArmStyle\t\t: %d\n", elfw.elfPanose.bArmStyle );
5564 printf(
"\t\tbLetterform\t\t: %d\n", elfw.elfPanose.bLetterform );
5565 printf(
"\t\tbMidline\t\t: %d\n", elfw.elfPanose.bMidline );
5566 printf(
"\t\tbXHeight\t\t: %d\n", elfw.elfPanose.bXHeight );
5593 ds << emr << ihPal << lgpl;
5599 int size (
void )
const {
return emr.nSize; }
5606#ifdef ENABLE_EDITING
5610 void edit (
void )
const
5612 printf(
"*CREATEPALETTE* (not really handled by libEMF)\n" );
5628 emr.iType = EMR_FILLPATH;
5630 rclBounds = *bounds;
5638 ds >> emr >> rclBounds;
5645 ds << emr << rclBounds;
5651 int size (
void )
const {
return emr.nSize; }
5662#ifdef ENABLE_EDITING
5666 void edit (
void )
const
5668 printf(
"*FILLPATH*\n" );
5669 edit_rectl(
"rclBounds", rclBounds );
5684 emr.iType = EMR_STROKEPATH;
5686 rclBounds = *bounds;
5694 ds >> emr >> rclBounds;
5701 ds << emr << rclBounds;
5707 int size (
void )
const {
return emr.nSize; }
5718#ifdef ENABLE_EDITING
5722 void edit (
void )
const
5724 printf(
"*STROKEPATH*\n" );
5725 edit_rectl(
"rclBounds", rclBounds );
5740 emr.iType = EMR_STROKEANDFILLPATH;
5742 rclBounds = *bounds;
5750 ds >> emr >> rclBounds;
5757 ds << emr << rclBounds;
5763 int size (
void )
const {
return emr.nSize; }
5772 StrokeAndFillPath( dc );
5774#ifdef ENABLE_EDITING
5778 void edit (
void )
const
5780 printf(
"*STROKEANDFILLPATH*\n" );
5781 edit_rectl(
"rclBounds", rclBounds );
5796 emr.iType = EMR_BEGINPATH;
5818 int size (
void )
const {
return emr.nSize; }
5829#ifdef ENABLE_EDITING
5833 void edit (
void )
const
5835 printf(
"*BEGINPATH*\n" );
5850 emr.iType = EMR_ENDPATH;
5872 int size (
void )
const {
return emr.nSize; }
5883#ifdef ENABLE_EDITING
5887 void edit (
void )
const
5889 printf(
"*ENDPATH*\n" );
5904 emr.iType = EMR_CLOSEFIGURE;
5926 int size (
void )
const {
return emr.nSize; }
5937#ifdef ENABLE_EDITING
5941 void edit (
void )
const
5943 printf(
"*CLOSEFIGURE*\n" );
5959 emr.iType = EMR_SAVEDC;
5981 int size (
void )
const {
return emr.nSize; }
5992#ifdef ENABLE_EDITING
5996 void edit (
void )
const
5998 printf(
"*SAVEDC*\n" );
6013 emr.iType = EMR_RESTOREDC;
6023 ds >> emr >> iRelative;
6030 ds << emr << iRelative;
6036 int size (
void )
const {
return emr.nSize; }
6045 RestoreDC( dc, iRelative );
6047#ifdef ENABLE_EDITING
6051 void edit (
void )
const
6053#if defined(__LP64__)
6054 const char* FMT =
"\tiRelative: %d\n";
6056 const char* FMT =
"\tiRelative: %ld\n";
6058 printf(
"*RESTOREDC*\n" );
6059 printf( FMT, iRelative );
6074 emr.iType = EMR_SETMETARGN;
6096 int size (
void )
const {
return emr.nSize; }
6107#ifdef ENABLE_EDITING
6111 void edit (
void )
const
6113 printf(
"*SETMETARGN*\n" );
6129 lopnStyle = lpen->lopnStyle;
6130 lopnWidth = lpen->lopnWidth;
6131 lopnColor = lpen->lopnColor;
6136 OBJECTTYPE
getType (
void )
const {
return O_PEN; }
6161 elpPenStyle = lpen->elpPenStyle;
6162 elpWidth = lpen->elpWidth;
6163 elpBrushStyle = lpen->elpBrushStyle;
6164 elpColor = lpen->elpColor;
6165 elpHatch = lpen->elpHatch;
6167 elpStyleEntry[0] = 0;
6172 OBJECTTYPE
getType (
void )
const {
return O_EXTPEN; }
6197 lbStyle = lbrush->lbStyle;
6198 lbColor = lbrush->lbColor;
6199 lbHatch = lbrush->lbHatch;
6204 OBJECTTYPE
getType (
void )
const {
return O_BRUSH; }
6229 this->elfLogFont = *lfont;
6232 memset( &elfFullName, 0,
sizeof elfFullName );
6233 memset( &elfStyle, 0,
sizeof elfStyle );
6234 elfVersion = ELF_VERSION;
6238 memset( &elfVendorId, 0,
sizeof elfVendorId );
6239 elfCulture = ELF_CULTURE_LATIN;
6240 memset( &elfPanose, 1,
sizeof(PANOSE) );
6245 OBJECTTYPE
getType (
void )
const {
return O_FONT; }
6270 EMF_UNUSED(lpalette);
6273 PALETTEENTRY zero_entry = { 0, 0, 0, 0 };
6274 palPalEntry[0] = zero_entry;
6279 OBJECTTYPE
getType (
void )
const {
return O_PALETTE; }
6304 emr.iType = EMR_SETMITERLIMIT;
6306 eMiterLimit = limit;
6315 ds >> emr >> miter_limit;
6316 eMiterLimit = float(miter_limit);
6323 ds << emr << (int)eMiterLimit;
6329 int size (
void )
const {
return emr.nSize; }
6338 SetMiterLimit( dc, eMiterLimit, 0 );
6340#ifdef ENABLE_EDITING
6344 void edit (
void )
const
6346 printf(
"*SETMITERLIMIT*\n" );
6347 printf(
"\teMiterLimit\t: %f\n", eMiterLimit );
6367 void init (
const RECT* size, LPCWSTR description_w ) {
6384 header->rclFrame.left = size->left;
6385 header->rclFrame.top = size->top;
6386 header->rclFrame.right = size->right;
6387 header->rclFrame.bottom = size->bottom;
6390 size->left *
header->szlDevice.cx / (
header->szlMillimeters.cx * 100 );
6392 size->top *
header->szlDevice.cy / (
header->szlMillimeters.cy * 100 );
6393 header->rclBounds.right =
6394 size->right *
header->szlDevice.cx / (
header->szlMillimeters.cx * 100 );
6395 header->rclBounds.bottom =
6396 size->bottom *
header->szlDevice.cy / (
header->szlMillimeters.cy * 100 );
6401 header->rclBounds.left = -10;
6402 header->rclBounds.top = -10;
6403 header->rclBounds.right = 10;
6404 header->rclBounds.bottom = 10;
6406 header->rclFrame.left = (LONG)floor( (
float)
header->rclBounds.left *
6407 header->szlMillimeters.cx * 100 /
header->szlDevice.cx );
6408 header->rclFrame.top = (LONG)floor( (
float)
header->rclBounds.top *
6409 header->szlMillimeters.cy * 100 /
header->szlDevice.cy );
6410 header->rclFrame.right = (LONG)ceil( (
float)
header->rclBounds.right *
6411 header->szlMillimeters.cx * 100 /
header->szlDevice.cx );
6412 header->rclFrame.bottom = (LONG)ceil( (
float)
header->rclBounds.bottom *
6413 header->szlMillimeters.cy * 100 /
header->szlDevice.cy );
6418 SIZEL default_resolution = { RESOLUTION, RESOLUTION };
6420 SIZEL default_viewport_ext = { 1, 1 };
6422 POINT default_viewport_org = { 0, 0 };
6424 SIZEL default_window_ext = { 1, 1 };
6426 POINT default_window_org = { 0, 0 };
6432 pen = (
PEN*)globalObjects.find( BLACK_PEN | ENHMETA_STOCK_OBJECT );
6433 brush = (
BRUSH*)globalObjects.find( BLACK_BRUSH | ENHMETA_STOCK_OBJECT );
6434 font = (
FONT*)globalObjects.find( DEVICE_DEFAULT_FONT | ENHMETA_STOCK_OBJECT);
6435 palette = (
PALETTE*)globalObjects.find( DEFAULT_PALETTE|ENHMETA_STOCK_OBJECT);
6445 handle = globalObjects.add(
this );
6514 LPCWSTR description_w )
6515 :
fp(fp_),
ds( fp_ )
6517 init( size, description_w );
6533 OBJECTTYPE
getType (
void )
const {
return O_METAFILEDEVICECONTEXT; }
6540 for (
unsigned int i = 1; i <
handles.size(); i++ ) {
6621 device_point.x = (LONG)( (
float)( p.x -
window_org.x ) / window_width *
6624 device_point.y = (LONG)( (
float)( p.y -
window_org.y ) / window_height *
6633 int device_width =
header->szlDevice.cx <= 0 ? 1 :
header->szlDevice.cx;
6634 header->rclFrame.left = (LONG)floor( (
float)
header->rclBounds.left *
6635 header->szlMillimeters.cx * 100 / device_width );
6642 int device_width =
header->szlDevice.cx <= 0 ? 1 :
header->szlDevice.cx;
6643 header->rclFrame.right = (LONG)ceil( (
float)
header->rclBounds.right *
6644 header->szlMillimeters.cx * 100 / device_width );
6652 int device_height =
header->szlDevice.cy <= 0 ? 1 :
header->szlDevice.cy;
6653 header->rclFrame.top = (LONG)floor( (
float)
header->rclBounds.top *
6654 header->szlMillimeters.cy * 100 / device_height );
6661 int device_height =
header->szlDevice.cy <= 0 ? 1 :
header->szlDevice.cy;
6662 header->rclFrame.bottom = (LONG)ceil( (
float)
header->rclBounds.bottom *
6663 header->szlMillimeters.cy * 100 / device_height );
Graphics Brush.
Definition libemf.h:6190
OBJECTTYPE getType(void) const
Definition libemf.h:6204
BRUSH(const LOGBRUSH *lbrush)
Definition libemf.h:6195
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition libemf.h:6211
Support different endian modes when reading and writing the metafile.
Definition libemf.h:224
void setStream(::FILE *fp)
Definition libemf.h:238
DATASTREAM & operator>>(BYTE &byte)
Definition libemf.h:252
DATASTREAM(::FILE *fp=0)
Definition libemf.h:233
DATASTREAM & operator<<(const BYTE &byte)
Definition libemf.h:243
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:3047
bool serialize(DATASTREAM ds)
Definition libemf.h:3033
EMRARCTO(INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
Definition libemf.h:3008
EMRARCTO(DATASTREAM &ds)
Definition libemf.h:3026
int size(void) const
Definition libemf.h:3041
EMRARC(INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
Definition libemf.h:2932
bool serialize(DATASTREAM ds)
Definition libemf.h:2957
EMRARC(DATASTREAM &ds)
Definition libemf.h:2950
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:2971
int size(void) const
Definition libemf.h:2965
EMRBEGINPATH(DATASTREAM &ds)
Definition libemf.h:5803
EMRBEGINPATH(void)
Definition libemf.h:5794
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:5824
int size(void) const
Definition libemf.h:5818
bool serialize(DATASTREAM ds)
Definition libemf.h:5810
EMF Brush.
Definition libemf.h:5383
int size(void) const
Definition libemf.h:5406
bool serialize(DATASTREAM ds)
Definition libemf.h:5398
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.cpp:640
EMRCREATEBRUSHINDIRECT(BRUSH *brush, HGDIOBJ handle)
Definition libemf.cpp:632
EMF Palette.
Definition libemf.h:5576
EMRCREATEPALETTE(PALETTE *palette, HGDIOBJ handle)
Definition libemf.cpp:687
int size(void) const
Definition libemf.h:5599
bool serialize(DATASTREAM ds)
Definition libemf.h:5591
EMRCREATEPALETTE(DATASTREAM &ds)
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.cpp:695
EMF Pen.
Definition libemf.h:5251
EMRCREATEPEN(PEN *pen, HGDIOBJ handle)
Definition libemf.cpp:539
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.cpp:582
bool serialize(DATASTREAM ds)
Definition libemf.h:5266
int size(void) const
Definition libemf.h:5274
bool serialize(DATASTREAM ds)
Definition libemf.h:2765
EMRDELETEOBJECT(DATASTREAM &ds)
Definition libemf.h:2758
EMRDELETEOBJECT(HGDIOBJ object)
Definition libemf.h:2748
int size(void) const
Definition libemf.h:2773
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.cpp:562
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:3177
bool serialize(DATASTREAM ds)
Definition libemf.h:3163
EMRELLIPSE(INT left, INT top, INT right, INT bottom)
Definition libemf.h:3143
int size(void) const
Definition libemf.h:3171
EMRELLIPSE(DATASTREAM &ds)
Definition libemf.h:3156
bool serialize(DATASTREAM ds)
Definition libemf.h:5864
int size(void) const
Definition libemf.h:5872
EMRENDPATH(void)
Definition libemf.h:5848
EMRENDPATH(DATASTREAM &ds)
Definition libemf.h:5857
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:5878
int size(void) const
Definition libemf.h:1710
bool serialize(DATASTREAM ds)
Definition libemf.h:1702
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:1716
EMREOF(DATASTREAM &ds)
Definition libemf.h:1694
EMREOF(void)
Definition libemf.h:1681
EMF Font.
Definition libemf.h:5438
bool serialize(DATASTREAM ds)
Definition libemf.h:5453
int size(void) const
Definition libemf.h:5466
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.cpp:673
EMREXTCREATEFONTINDIRECTW(FONT *font, HGDIOBJ handle)
Definition libemf.cpp:659
EMF Extended Pen.
Definition libemf.h:5309
int size(void) const
Definition libemf.h:5332
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.cpp:607
EMREXTCREATEPEN(EXTPEN *pen, HGDIOBJ handle)
Definition libemf.cpp:595
bool serialize(DATASTREAM ds)
Definition libemf.h:5324
EMREXTTEXTOUTA(DATASTREAM &ds)
Definition libemf.h:4721
bool serialize(DATASTREAM ds)
Definition libemf.h:4771
~EMREXTTEXTOUTA()
Definition libemf.h:4763
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:4788
int size(void) const
Definition libemf.h:4782
EMREXTTEXTOUTA(const RECTL *bounds, DWORD graphicsMode, FLOAT xScale, FLOAT yScale, const PEMRTEXT text, LPCSTR string, const INT *dx)
Definition libemf.h:4663
bool serialize(DATASTREAM ds)
Definition libemf.h:5019
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:5036
~EMREXTTEXTOUTW()
Definition libemf.h:5011
EMREXTTEXTOUTW(const RECTL *bounds, DWORD graphicsMode, FLOAT xScale, FLOAT yScale, const PEMRTEXT text, LPCWSTR string, const INT *dx)
Definition libemf.h:4911
int size(void) const
Definition libemf.h:5030
EMREXTTEXTOUTW(DATASTREAM &ds)
Definition libemf.h:4969
EMRFILLPATH(DATASTREAM &ds)
Definition libemf.h:5636
bool serialize(DATASTREAM ds)
Definition libemf.h:5643
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:5657
int size(void) const
Definition libemf.h:5651
EMRFILLPATH(const RECTL *bounds)
Definition libemf.h:5626
bool serialize(DATASTREAM ds)
Definition libemf.h:2884
EMRLINETO(DATASTREAM &ds)
Definition libemf.h:2877
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:2898
EMRLINETO(INT x, INT y)
Definition libemf.h:2866
int size(void) const
Definition libemf.h:2892
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:2839
EMRMOVETOEX(INT x, INT y)
Definition libemf.h:2807
int size(void) const
Definition libemf.h:2833
EMRMOVETOEX(DATASTREAM &ds)
Definition libemf.h:2818
bool serialize(DATASTREAM ds)
Definition libemf.h:2825
int size(void) const
Definition libemf.h:4187
EMRPOLYBEZIER16(DATASTREAM &ds)
Definition libemf.h:4152
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:4193
~EMRPOLYBEZIER16()
Definition libemf.h:4172
EMRPOLYBEZIER16(const RECTL *bounds, const POINT *points, INT n)
Definition libemf.h:4129
bool serialize(DATASTREAM ds)
Definition libemf.h:4179
EMRPOLYBEZIER16(const RECTL *bounds, const POINT16 *points, INT n)
Definition libemf.h:4104
EMRPOLYBEZIERTO16(const RECTL *bounds, const POINT *points, INT n)
Definition libemf.h:4344
bool serialize(DATASTREAM ds)
Definition libemf.h:4394
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:4408
EMRPOLYBEZIERTO16(DATASTREAM &ds)
Definition libemf.h:4367
int size(void) const
Definition libemf.h:4402
EMRPOLYBEZIERTO16(const RECTL *bounds, const POINT16 *points, INT n)
Definition libemf.h:4319
~EMRPOLYBEZIERTO16()
Definition libemf.h:4387
~EMRPOLYBEZIERTO()
Definition libemf.h:4267
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:4288
int size(void) const
Definition libemf.h:4282
bool serialize(DATASTREAM ds)
Definition libemf.h:4274
EMRPOLYBEZIERTO(const RECTL *bounds, const POINT *points, INT n)
Definition libemf.h:4224
EMRPOLYBEZIERTO(DATASTREAM &ds)
Definition libemf.h:4247
EMRPOLYBEZIER(DATASTREAM &ds)
Definition libemf.h:4032
int size(void) const
Definition libemf.h:4067
~EMRPOLYBEZIER()
Definition libemf.h:4052
bool serialize(DATASTREAM ds)
Definition libemf.h:4059
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:4073
EMRPOLYBEZIER(const RECTL *bounds, const POINT *points, INT n)
Definition libemf.h:4009
~EMRPOLYGON16()
Definition libemf.h:3583
EMRPOLYGON16(const RECTL *bounds, const POINT16 *points, INT16 n)
Definition libemf.h:3540
bool serialize(DATASTREAM ds)
Definition libemf.h:3590
int size(void) const
Definition libemf.h:3598
EMRPOLYGON16(DATASTREAM &ds)
Definition libemf.h:3563
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:3604
EMRPOLYGON16(const RECTL *bounds, const POINT *points, INT16 n)
Definition libemf.h:3515
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:3484
int size(void) const
Definition libemf.h:3478
EMRPOLYGON(const RECTL *bounds, const POINT *points, INT n)
Definition libemf.h:3420
bool serialize(DATASTREAM ds)
Definition libemf.h:3470
EMRPOLYGON(DATASTREAM &ds)
Definition libemf.h:3443
~EMRPOLYGON()
Definition libemf.h:3463
bool serialize(DATASTREAM ds)
Definition libemf.h:3375
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:3389
EMRPOLYLINE16(const RECTL *bounds, const POINT16 *points, INT n)
Definition libemf.h:3300
EMRPOLYLINE16(const RECTL *bounds, const POINT *points, INT n)
Definition libemf.h:3325
EMRPOLYLINE16(DATASTREAM &ds)
Definition libemf.h:3355
int size(void) const
Definition libemf.h:3383
~EMRPOLYLINE16()
Definition libemf.h:3347
EMRPOLYLINETO16(const RECTL *bounds, const POINT *points, INT n)
Definition libemf.h:4559
EMRPOLYLINETO16(DATASTREAM &ds)
Definition libemf.h:4582
bool serialize(DATASTREAM ds)
Definition libemf.h:4609
~EMRPOLYLINETO16()
Definition libemf.h:4602
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:4623
EMRPOLYLINETO16(const RECTL *bounds, const POINT16 *points, INT n)
Definition libemf.h:4534
int size(void) const
Definition libemf.h:4617
EMRPOLYLINETO(const RECTL *bounds, const POINT *points, INT n)
Definition libemf.h:4439
~EMRPOLYLINETO()
Definition libemf.h:4482
EMRPOLYLINETO(DATASTREAM &ds)
Definition libemf.h:4462
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:4503
bool serialize(DATASTREAM ds)
Definition libemf.h:4489
int size(void) const
Definition libemf.h:4497
int size(void) const
Definition libemf.h:3263
bool serialize(DATASTREAM ds)
Definition libemf.h:3255
EMRPOLYLINE(const RECTL *bounds, const POINT *points, INT n)
Definition libemf.h:3206
~EMRPOLYLINE()
Definition libemf.h:3228
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:3269
EMRPOLYLINE(DATASTREAM &ds)
Definition libemf.h:3236
int size(void) const
Definition libemf.h:3943
bool serialize(DATASTREAM ds)
Definition libemf.h:3934
EMRPOLYPOLYGON16(const RECTL *bounds, const POINT16 *points, const INT *counts, UINT16 polygons)
Definition libemf.h:3847
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:3949
EMRPOLYPOLYGON16(DATASTREAM &ds)
Definition libemf.h:3893
EMRPOLYPOLYGON16(const RECTL *bounds, const POINT *points, const INT *counts, UINT polygons)
Definition libemf.h:3806
~EMRPOLYPOLYGON16()
Definition libemf.h:3884
EMRPOLYPOLYGON(DATASTREAM &ds)
Definition libemf.h:3683
EMRPOLYPOLYGON(const RECTL *bounds, const POINT *points, const INT *counts, UINT polygons)
Definition libemf.h:3637
bool serialize(DATASTREAM ds)
Definition libemf.h:3725
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:3740
int size(void) const
Definition libemf.h:3734
~EMRPOLYPOLYGON()
Definition libemf.h:3674
EMRRECTANGLE(DATASTREAM &ds)
Definition libemf.h:3092
bool serialize(DATASTREAM ds)
Definition libemf.h:3099
int size(void) const
Definition libemf.h:3107
EMRRECTANGLE(INT left, INT top, INT right, INT bottom)
Definition libemf.h:3079
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:3113
EMRRESTOREDC(INT n)
Definition libemf.h:6011
EMRRESTOREDC(DATASTREAM &ds)
Definition libemf.h:6021
int size(void) const
Definition libemf.h:6036
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:6042
bool serialize(DATASTREAM ds)
Definition libemf.h:6028
EMRSAVEDC(DATASTREAM &ds)
Definition libemf.h:5966
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:5987
int size(void) const
Definition libemf.h:5981
EMRSAVEDC(void)
Definition libemf.h:5957
bool serialize(DATASTREAM ds)
Definition libemf.h:5973
EMRSCALEVIEWPORTEXTEX(DATASTREAM &ds)
Definition libemf.h:1945
int size(void) const
Definition libemf.h:1960
EMRSCALEVIEWPORTEXTEX(LONG x_num, LONG x_den, LONG y_num, LONG y_den)
Definition libemf.h:1932
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:1966
bool serialize(DATASTREAM ds)
Definition libemf.h:1952
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:2106
bool serialize(DATASTREAM ds)
Definition libemf.h:2092
int size(void) const
Definition libemf.h:2100
EMRSCALEWINDOWEXTEX(DATASTREAM &ds)
Definition libemf.h:2085
EMRSCALEWINDOWEXTEX(LONG x_num, LONG x_den, LONG y_num, LONG y_den)
Definition libemf.h:2072
EMRSELECTOBJECT(HGDIOBJ object)
Definition libemf.h:2690
bool serialize(DATASTREAM ds)
Definition libemf.h:2707
EMRSELECTOBJECT(DATASTREAM &ds)
Definition libemf.h:2700
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.cpp:547
int size(void) const
Definition libemf.h:2715
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:2455
int size(void) const
Definition libemf.h:2449
EMRSETBKCOLOR(COLORREF color)
Definition libemf.h:2424
EMRSETBKCOLOR(DATASTREAM &ds)
Definition libemf.h:2434
bool serialize(DATASTREAM ds)
Definition libemf.h:2441
EMRSETBKMODE(DWORD mode)
Definition libemf.h:2482
int size(void) const
Definition libemf.h:2507
bool serialize(DATASTREAM ds)
Definition libemf.h:2499
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:2513
EMRSETBKMODE(DATASTREAM &ds)
Definition libemf.h:2492
EMRSETMAPMODE(DWORD mode)
Definition libemf.h:2617
EMRSETMAPMODE(DATASTREAM &ds)
Definition libemf.h:2627
int size(void) const
Definition libemf.h:2642
bool serialize(DATASTREAM ds)
Definition libemf.h:2634
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:2648
bool serialize(DATASTREAM ds)
Definition libemf.h:6321
EMRSETMITERLIMIT(FLOAT limit)
Definition libemf.h:6302
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:6335
int size(void) const
Definition libemf.h:6329
EMRSETMITERLIMIT(DATASTREAM &ds)
Definition libemf.h:6312
EMRSETPIXELV(DATASTREAM &ds)
Definition libemf.h:5201
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:5222
bool serialize(DATASTREAM ds)
Definition libemf.h:5208
EMRSETPIXELV(INT x, INT y, COLORREF color)
Definition libemf.h:5189
int size(void) const
Definition libemf.h:5216
bool serialize(DATASTREAM ds)
Definition libemf.h:2566
EMRSETPOLYFILLMODE(DATASTREAM &ds)
Definition libemf.h:2559
int size(void) const
Definition libemf.h:2574
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:2580
EMRSETPOLYFILLMODE(DWORD mode)
Definition libemf.h:2549
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:2312
bool serialize(DATASTREAM ds)
Definition libemf.h:2298
int size(void) const
Definition libemf.h:2306
EMRSETTEXTALIGN(DATASTREAM &ds)
Definition libemf.h:2291
EMRSETTEXTALIGN(UINT mode)
Definition libemf.h:2281
EMRSETTEXTCOLOR(DATASTREAM &ds)
Definition libemf.h:2377
EMRSETTEXTCOLOR(COLORREF color)
Definition libemf.h:2367
bool serialize(DATASTREAM ds)
Definition libemf.h:2384
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:2398
int size(void) const
Definition libemf.h:2392
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:1901
int size(void) const
Definition libemf.h:1895
EMRSETVIEWPORTEXTEX(INT cx, INT cy)
Definition libemf.h:1869
bool serialize(DATASTREAM ds)
Definition libemf.h:1887
EMRSETVIEWPORTEXTEX(DATASTREAM &ds)
Definition libemf.h:1880
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:1777
EMRSETVIEWPORTORGEX(INT x, INT y)
Definition libemf.h:1745
bool serialize(DATASTREAM ds)
Definition libemf.h:1763
EMRSETVIEWPORTORGEX(DATASTREAM &ds)
Definition libemf.h:1756
int size(void) const
Definition libemf.h:1771
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:2041
bool serialize(DATASTREAM ds)
Definition libemf.h:2027
EMRSETWINDOWEXTEX(DATASTREAM &ds)
Definition libemf.h:2020
EMRSETWINDOWEXTEX(INT cx, INT cy)
Definition libemf.h:2009
int size(void) const
Definition libemf.h:2035
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:1840
bool serialize(DATASTREAM ds)
Definition libemf.h:1826
int size(void) const
Definition libemf.h:1834
EMRSETWINDOWORGEX(INT x, INT y)
Definition libemf.h:1808
EMRSETWINDOWORGEX(DATASTREAM &ds)
Definition libemf.h:1819
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:5769
EMRSTROKEANDFILLPATH(DATASTREAM &ds)
Definition libemf.h:5748
EMRSTROKEANDFILLPATH(const RECTL *bounds)
Definition libemf.h:5738
bool serialize(DATASTREAM ds)
Definition libemf.h:5755
int size(void) const
Definition libemf.h:5763
EMRSTROKEPATH(const RECTL *bounds)
Definition libemf.h:5682
int size(void) const
Definition libemf.h:5707
void execute(METAFILEDEVICECONTEXT *source, HDC dc) const
Definition libemf.h:5713
EMRSTROKEPATH(DATASTREAM &ds)
Definition libemf.h:5692
bool serialize(DATASTREAM ds)
Definition libemf.h:5699
Extended Graphics Pen.
Definition libemf.h:6154
EXTPEN(const EXTLOGPEN *lpen)
Definition libemf.h:6159
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition libemf.h:6179
OBJECTTYPE getType(void) const
Definition libemf.h:6172
Graphics Font.
Definition libemf.h:6222
FONT(const LOGFONTW *lfont)
Definition libemf.h:6227
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition libemf.h:6252
OBJECTTYPE getType(void) const
Definition libemf.h:6245
static EMF::METARECORD * new_extcreatefontindirectw(DATASTREAM &ds)
Create a new EXTCREATEFONTINDIRECTW record.
Definition libemf.cpp:484
static EMF::METARECORD * new_exttextoutw(DATASTREAM &ds)
Create a new EXTTEXTOUTW record.
Definition libemf.cpp:459
static EMF::METARECORD * new_arc(DATASTREAM &ds)
Create a new ARC record.
Definition libemf.cpp:374
static EMF::METARECORD * new_polypolygon16(DATASTREAM &ds)
Create a new POLYPOLYGON16 record.
Definition libemf.cpp:419
static EMF::METARECORD * new_modifyworldtransform(DATASTREAM &ds)
Create a new MODIFYWORLDTRANSFORM record.
Definition libemf.cpp:314
static EMF::METARECORD * new_createbrushindirect(DATASTREAM &ds)
Create a new CREATEBRUSHINDIRECT record.
Definition libemf.cpp:479
static EMF::METARECORD * new_ellipse(DATASTREAM &ds)
Create a new ELLIPSE record.
Definition libemf.cpp:389
static EMF::METARECORD * new_savedc(DATASTREAM &ds)
Create a new SAVEDC record.
Definition libemf.cpp:519
static EMF::METARECORD * new_polybezierto(DATASTREAM &ds)
Create a new POLYBEZIERTO record.
Definition libemf.cpp:434
static EMF::METARECORD * new_createpen(DATASTREAM &ds)
Create a new CREATEPEN record.
Definition libemf.cpp:469
static EMF::METARECORD * new_exttextouta(DATASTREAM &ds)
Create a new EXTTEXTOUTA record.
Definition libemf.cpp:454
static EMF::METARECORD * new_scaleviewportextex(DATASTREAM &ds)
Create a new SCALEVIEWPORTEXTEX record.
Definition libemf.cpp:304
static EMF::METARECORD * new_extcreatepen(DATASTREAM &ds)
Create a new EXTCREATEPEN record.
Definition libemf.cpp:474
static EMF::METARECORD * new_setviewportorgex(DATASTREAM &ds)
Create a new EMRSETVIEWPORTORGEX record.
Definition libemf.cpp:284
static EMF::METARECORD * new_setmiterlimit(DATASTREAM &ds)
Create a new SETMITERLIMIT record.
Definition libemf.cpp:534
auto end(void) const
Definition libemf.h:1304
static EMF::METARECORD * new_setbkmode(DATASTREAM &ds)
Create a new SETBKMODE record.
Definition libemf.cpp:339
METARECORDCTOR newRecord(DWORD iType) const
Definition libemf.cpp:269
static EMF::METARECORD * new_polyline(DATASTREAM &ds)
Create a new POLYLINE record.
Definition libemf.cpp:394
static EMF::METARECORD * new_setviewportextex(DATASTREAM &ds)
Create a new EMRSETVIEWPORTEXTEX record.
Definition libemf.cpp:294
static EMF::METARECORD * new_deleteobject(DATASTREAM &ds)
Create a new DELETEOBJECT record.
Definition libemf.cpp:359
static EMF::METARECORD * new_polylineto(DATASTREAM &ds)
Create a new POLYLINETO record.
Definition libemf.cpp:444
static EMF::METARECORD * new_polylineto16(DATASTREAM &ds)
Create a new POLYLINETO16 record.
Definition libemf.cpp:449
static EMF::METARECORD * new_settextalign(DATASTREAM &ds)
Create a new SETTEXTALIGN record.
Definition libemf.cpp:324
void remove(const OBJECT *object)
Definition libemf.cpp:255
static EMF::METARECORD * new_polybezier16(DATASTREAM &ds)
Create a new POLYBEZIER16 record.
Definition libemf.cpp:429
auto begin(void) const
Definition libemf.h:1299
static EMF::METARECORD * new_polypolygon(DATASTREAM &ds)
Create a new POLYPOLYGON record.
Definition libemf.cpp:414
static EMF::METARECORD * new_setwindowextex(DATASTREAM &ds)
Create a new EMRSETWINDOWEXTEX record.
Definition libemf.cpp:299
static EMF::METARECORD * new_polyline16(DATASTREAM &ds)
Create a new POLYLINE16 record.
Definition libemf.cpp:399
static EMF::METARECORD * new_endpath(DATASTREAM &ds)
Create a new ENDPATH record.
Definition libemf.cpp:509
static EMF::METARECORD * new_setpixelv(DATASTREAM &ds)
Create a new SETPIXELV record.
Definition libemf.cpp:464
static EMF::METARECORD * new_restoredc(DATASTREAM &ds)
Create a new RESTOREDC record.
Definition libemf.cpp:524
static EMF::METARECORD * new_beginpath(DATASTREAM &ds)
Create a new BEGINPATH record.
Definition libemf.cpp:504
static EMF::METARECORD * new_scalewindowextex(DATASTREAM &ds)
Create a new SCALEWINDOWEXTEX record.
Definition libemf.cpp:309
static EMF::METARECORD * new_setmapmode(DATASTREAM &ds)
Create a new SETMAPMODE record.
Definition libemf.cpp:349
static EMF::METARECORD * new_polybezierto16(DATASTREAM &ds)
Create a new POLYBEZIERTO16 record.
Definition libemf.cpp:439
static EMF::METARECORD * new_eof(DATASTREAM &ds)
Create a new EMREOF record.
Definition libemf.cpp:279
static EMF::METARECORD * new_setbkcolor(DATASTREAM &ds)
Create a new SETBKCOLOR record.
Definition libemf.cpp:334
static EMF::METARECORD * new_setworldtransform(DATASTREAM &ds)
Create a new SETWORLDTRANSFORM record.
Definition libemf.cpp:319
static EMF::METARECORD * new_setwindoworgex(DATASTREAM &ds)
Create a new EMRSETWINDOWORGEX record.
Definition libemf.cpp:289
static EMF::METARECORD * new_strokeandfillpath(DATASTREAM &ds)
Create a new STROKEANDFILLPATH record.
Definition libemf.cpp:499
HGDIOBJ add(OBJECT *object)
Definition libemf.cpp:200
static EMF::METARECORD * new_polygon(DATASTREAM &ds)
Create a new POLYGON record.
Definition libemf.cpp:404
static EMF::METARECORD * new_strokepath(DATASTREAM &ds)
Create a new STROKEPATH record.
Definition libemf.cpp:494
static EMF::METARECORD * new_polygon16(DATASTREAM &ds)
Create a new POLYGON16 record.
Definition libemf.cpp:409
static EMF::METARECORD * new_fillpath(DATASTREAM &ds)
Create a new FILLPATH record.
Definition libemf.cpp:489
static EMF::METARECORD * new_arcto(DATASTREAM &ds)
Create a new ARCTO record.
Definition libemf.cpp:379
static EMF::METARECORD * new_lineto(DATASTREAM &ds)
Create a new LINETO record.
Definition libemf.cpp:369
static EMF::METARECORD * new_setpolyfillmode(DATASTREAM &ds)
Create a new SETPOLYFILLMODE record.
Definition libemf.cpp:344
static EMF::METARECORD * new_settextcolor(DATASTREAM &ds)
Create a new SETTEXTCOLOR record.
Definition libemf.cpp:329
static EMF::METARECORD * new_rectangle(DATASTREAM &ds)
Create a new RECTANGLE record.
Definition libemf.cpp:384
static EMF::METARECORD * new_movetoex(DATASTREAM &ds)
Create a new MOVETOEX record.
Definition libemf.cpp:364
static EMF::METARECORD * new_closefigure(DATASTREAM &ds)
Create a new CLOSEFIGURE record.
Definition libemf.cpp:514
static EMF::METARECORD * new_polybezier(DATASTREAM &ds)
Create a new POLYBEZIER record.
Definition libemf.cpp:424
static EMF::METARECORD * new_selectobject(DATASTREAM &ds)
Create a new SELECTOBJECT record.
Definition libemf.cpp:354
static EMF::METARECORD * new_setmetargn(DATASTREAM &ds)
Create a new SETMETARGN record.
Definition libemf.cpp:529
OBJECT * find(const HGDIOBJ handle)
Definition libemf.cpp:232
A global graphics object.
Definition libemf.h:1252
std::map< HDC, HGDIOBJ > contexts
Definition libemf.h:1260
virtual METARECORD * newEMR(HDC dc, HGDIOBJ handle)=0
virtual ~GRAPHICSOBJECT()
GRAPHICSOBJECTs has a virtual destructor.
Definition libemf.h:1255
Graphics Device Context.
Definition libemf.h:6359
void clearHandle(DWORD handle)
Definition libemf.h:6555
OBJECTTYPE getType(void) const
Definition libemf.h:6533
void appendHandle(METARECORD *record)
Definition libemf.h:6578
ENHMETAHEADER * header
Definition libemf.h:6461
INT polyfill_mode
The current polygon fill mode.
Definition libemf.h:6485
POINT window_org
The origin of the window.
Definition libemf.h:6472
void deleteMetafile(void)
Definition libemf.h:6589
::FILE * fp
Definition libemf.h:6452
PEN * pen
The current pen.
Definition libemf.h:6477
FONT * font
The current font.
Definition libemf.h:6479
BRUSH * brush
The current brush.
Definition libemf.h:6478
SIZEL viewport_ext
The extent of the viewport.
Definition libemf.h:6469
bool update_frame
Update the frame automatically?
Definition libemf.h:6473
SIZEL resolution
The resolution in DPI of the reference DC.
Definition libemf.h:6468
UINT text_alignment
The current text alignment.
Definition libemf.h:6481
virtual ~METAFILEDEVICECONTEXT()
Definition libemf.h:6523
void appendRecord(METARECORD *record)
Definition libemf.h:6566
FLOAT miter_limit
The current miter length limit.
Definition libemf.h:6487
POINT min_device_point
The lft/top-most painted point in device units.
Definition libemf.h:6474
void mergePoint(const LONG &x, const LONG &y)
Definition libemf.h:6600
POINT point
The current point.
Definition libemf.h:6476
INT map_mode
The current mapping mode.
Definition libemf.h:6486
COLORREF bk_color
The current background color.
Definition libemf.h:6483
DATASTREAM ds
Definition libemf.h:6457
std::vector< bool > handles
Definition libemf.h:6494
POINT max_device_point
The rgt/btm-most painted point in device units.
Definition libemf.h:6475
METAFILEDEVICECONTEXT(FILE *fp_, const RECT *size, LPCWSTR description_w)
Definition libemf.h:6513
COLORREF text_color
The current text foreground color.
Definition libemf.h:6482
PALETTE * palette
The current palette.
Definition libemf.h:6480
POINT viewport_org
The origin of the viewport.
Definition libemf.h:6470
SIZEL window_ext
The extent of the window.
Definition libemf.h:6471
INT bk_mode
The current background mode.
Definition libemf.h:6484
std::vector< EMF::METARECORD * > records
Definition libemf.h:6465
void mergePoint(const POINT &p)
Definition libemf.h:6611
std::map< HGDIOBJ, HGDIOBJ > emf_handles
Definition libemf.h:6501
DWORD nextHandle(void)
Definition libemf.h:6538
Global GDI object.
Definition libemf.h:1230
OBJECT(void)
Definition libemf.h:1239
virtual OBJECTTYPE getType(void) const =0
HGDIOBJ handle
Definition libemf.h:1232
virtual ~OBJECT()
OBJECTs have a virtual destructor.
Definition libemf.h:1234
Graphics Palette.
Definition libemf.h:6263
OBJECTTYPE getType(void) const
Definition libemf.h:6279
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition libemf.h:6286
PALETTE(const LOGPALETTE *lpalette)
Definition libemf.h:6268
Graphics Pen.
Definition libemf.h:6122
PEN(const LOGPEN *lpen)
Definition libemf.h:6127
METARECORD * newEMR(HDC dc, HGDIOBJ emf_handle)
Definition libemf.h:6143
OBJECTTYPE getType(void) const
Definition libemf.h:6136
Represent a byte array in a simple way.
Definition libemf.h:126
const int n_
Number of bytes in array.
Definition libemf.h:128
BYTE *const array_
Array of unsigned bytes.
Definition libemf.h:127
BYTEARRAY(BYTE *const array, const int n)
Definition libemf.h:134
Represent an ASCII character string in a simple way.
Definition libemf.h:109
const int length_
Number of single byte characters in array.
Definition libemf.h:111
CHARSTR(CHAR *const string, const int length)
Definition libemf.h:117
CHAR *const string_
Array of single byte characters.
Definition libemf.h:110
Represent an array of double word integers in a simple way.
Definition libemf.h:190
DWORD *const dwords_
Array of double words.
Definition libemf.h:191
const DWORD n_
Number of double words in array.
Definition libemf.h:192
DWORDARRAY(DWORD *const dwords, const DWORD n)
Definition libemf.h:198
Represent an array of integers in a simple way.
Definition libemf.h:174
INT *const ints_
Array of ints.
Definition libemf.h:175
const DWORD n_
Number of ints in array.
Definition libemf.h:176
INTARRAY(INT *const ints, const DWORD n)
Definition libemf.h:182
All metafile records must be padded out to a multiple of 4 bytes.
Definition libemf.h:206
static const char padding_[4]
Pad with '\0's.
Definition libemf.h:207
PADDING(const int size)
Definition libemf.h:213
const int size_
Number of bytes of padding.
Definition libemf.h:208
Represent an array of 16-bit point in a simple way.
Definition libemf.h:158
POINT16 *const points_
Array of POINT16s.
Definition libemf.h:159
const DWORD n_
Number of POINT16s in array.
Definition libemf.h:160
POINT16ARRAY(POINT16 *const points, const DWORD n)
Definition libemf.h:166
Represent an array of points in a simple way.
Definition libemf.h:142
const DWORD n_
Number of POINTLs in array.
Definition libemf.h:144
POINTL *const points_
Array of POINTLs.
Definition libemf.h:143
POINTLARRAY(POINTL *const points, const DWORD n)
Definition libemf.h:150
Represent a wide (UNICODE) character string in a simple way.
Definition libemf.h:91
const int length_
Number of WCHARs in string.
Definition libemf.h:93
WCHARSTR(WCHAR *const string, const int length)
Definition libemf.h:99
WCHAR *const string_
String of WCHARs.
Definition libemf.h:92