// // OdWmf.h // //#ifdef USE_UEMF //#undef USE_UEMF // to test compilation without redirection if the libUEMF folder is present //#endif #ifndef OD_WMF_H #define OD_WMF_H #ifdef _MSC_VER #pragma warning (push) #endif #pragma pack(push,1) // cross-platform or #pragma pack 1 as in #include "TD_PackPush.h" /////////////////////////////////////////////////////////////////////////////// // Native WMF RecordType Enumeration with META_ prefixes // Sources: https://ru.wikipedia.org/wiki/Windows_Metafile // https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-wmf/4813e7fd-52d0-4f42-965f-228c8b7488d2 // wingdi.h of MSVC enum META_TYPES { _META_EOF = 0x0000, // U_WMR_EOF // U_WMREOF _META_SETBKMODE = 0x0102, // U_WMR_SETBKMODE // U_WMRSETBKMODE _META_SETMAPMODE = 0x0103, // U_WMR_SETMAPMODE // U_WMRSETMAPMODE _META_SETROP2 = 0x0104, // U_WMR_SETROP2 // U_WMRSETROP2 _META_SETRELABS = 0x0105, // U_WMR_SETRELABS // U_WMRSETRELABS _META_SETPOLYFILLMODE = 0x0106, // U_WMR_SETPOLYFILLMODE // U_WMRSETPOLYFILLMODE _META_SETSTRETCHBLTMODE = 0x0107, // U_WMR_SETSTRETCHBLTMODE // U_WMRSETSTRETCHBLTMODE _META_SETTEXTCHAREXTRA = 0x0108, // U_WMR_SETTEXTCHAREXTRA // U_WMRSETTEXTCHAREXTRA _META_RESTOREDC = 0x0127, // U_WMR_RESTOREDC // U_WMRRESTOREDC _META_INVERTREGION = 0x012A, // U_WMR_INVERTREGION // U_WMRINVERTREGION _META_PAINTREGION = 0x012B, // U_WMR_PAINTREGION // U_WMRPAINTREGION _META_SELECTCLIPREGION = 0x012C, // U_WMR_SELECTCLIPREGION // U_WMRSELECTCLIPREGION _META_SELECTOBJECT = 0x012D, // U_WMR_SELECTOBJECT // U_WMRSELECTOBJECT _META_SETTEXTALIGN = 0x012E, // U_WMR_SETTEXTALIGN // U_WMRSETTEXTALIGN _META_RESIZEPALETTE = 0x0139, // U_WMR_RESIZEPALETTE // U_WMRRESIZEPALETTE _META_DIBCREATEPATTERNBRUSH = 0x0142, // U_WMR_DIBCREATEPATTERNBRUSH // U_WMRDIBCREATEPATTERNBRUSH _META_SETLAYOUT = 0x0149, // (new in wingdi.h) // for modern WMF support _META_DELETEOBJECT = 0x01F0, // U_WMR_DELETEOBJECT // U_WMRDELETEOBJECT _META_CREATEPATTERNBRUSH = 0x01F9, // U_WMR_CREATEPATTERNBRUSH // U_WMRCREATEPATTERNBRUSH _META_SETBKCOLOR = 0x0201, // U_WMR_SETBKCOLOR // U_WMRSETBKCOLOR _META_SETTEXTCOLOR = 0x0209, // U_WMR_SETTEXTCOLOR // U_WMRSETTEXTCOLOR _META_SETTEXTJUSTIFICATION = 0x020A, // U_WMR_SETTEXTJUSTIFICATION // U_WMRSETTEXTJUSTIFICATION _META_SETWINDOWORG = 0x020B, // U_WMR_SETWINDOWORG // U_WMRSETWINDOWORG _META_SETWINDOWEXT = 0x020C, // U_WMR_SETWINDOWEXT // U_WMRSETWINDOWEXT _META_SETVIEWPORTORG = 0x020D, // U_WMR_SETVIEWPORTORG // U_WMRSETVIEWPORTORG _META_SETVIEWPORTEXT = 0x020E, // U_WMR_SETVIEWPORTEXT // U_WMRSETVIEWPORTEXT _META_OFFSETWINDOWORG = 0x020F, // U_WMR_OFFSETWINDOWORG // U_WMROFFSETWINDOWORG _META_OFFSETVIEWPORTORG = 0x0211, // U_WMR_OFFSETVIEWPORTORG // U_WMROFFSETVIEWPORTORG _META_LINETO = 0x0213, // U_WMR_LINETO // U_WMRLINETO _META_MOVETO = 0x0214, // U_WMR_MOVETO // U_WMRMOVETO _META_OFFSETCLIPRGN = 0x0220, // U_WMR_OFFSETCLIPRGN // U_WMROFFSETCLIPRGN _META_FILLREGION = 0x0228, // U_WMR_FILLREGION // U_WMRFILLREGION _META_SETMAPPERFLAGS = 0x0231, // U_WMR_SETMAPPERFLAGS // U_WMRSETMAPPERFLAGS _META_SELECTPALETTE = 0x0234, // U_WMR_SELECTPALETTE // U_WMRSELECTPALETTE _META_REALIZEPALETTE = 0x0035, // U_WMR_REALIZEPALETTE // U_WMRREALIZEPALETTE _META_SETPALENTRIES = 0x0037, // U_WMR_SETPALENTRIES // U_WMRSETPALENTRIES _META_CREATEPENINDIRECT = 0x02FA, // U_WMR_CREATEPENINDIRECT // U_WMRCREATEPENINDIRECT _META_CREATEFONTINDIRECT = 0x02FB, // U_WMR_CREATEFONTINDIRECT // U_WMRCREATEFONTINDIRECT _META_CREATEBRUSHINDIRECT = 0x02FC, // U_WMR_CREATEBRUSHINDIRECT // U_WMRCREATEBRUSHINDIRECT _META_POLYGON = 0x0324, // U_WMR_POLYGON // U_WMRPOLYGON _META_POLYLINE = 0x0325, // U_WMR_POLYLINE // U_WMRPOLYLINE _META_SCALEWINDOWEXT = 0x0410, // U_WMR_SCALEWINDOWEXT // U_WMRSCALEWINDOWEXT _META_SCALEVIEWPORTEXT = 0x0412, // U_WMR_SCALEVIEWPORTEXT // U_WMRSCALEVIEWPORTEXT _META_EXCLUDECLIPRECT = 0x0415, // U_WMR_EXCLUDECLIPRECT // U_WMREXCLUDECLIPRECT _META_INTERSECTCLIPRECT = 0x0416, // U_WMR_INTERSECTCLIPRECT // U_WMRINTERSECTCLIPRECT _META_ELLIPSE = 0x0418, // U_WMR_ELLIPSE // U_WMRELLIPSE _META_FLOODFILL = 0x0419, // U_WMR_FLOODFILL // U_WMRFLOODFILL _META_RECTANGLE = 0x041B, // U_WMR_RECTANGLE // U_WMRRECTANGLE _META_SETPIXEL = 0x041F, // U_WMR_SETPIXEL // U_WMRSETPIXEL _META_FRAMEREGION = 0x0429, // U_WMR_FRAMEREGION // U_WMRFRAMEREGION _META_ANIMATEPALETTE = 0x0436, // U_WMR_ANIMATEPALETTE // U_WMRANIMATEPALETTE _META_TEXTOUT = 0x0521, // U_WMR_TEXTOUT // U_WMRTEXTOUT _META_POLYPOLYGON = 0x0538, // U_WMR_POLYPOLYGON // U_WMRPOLYPOLYGON _META_EXTFLOODFILL = 0x0548, // U_WMR_EXTFLOODFILL // U_WMREXTFLOODFILL _META_ROUNDRECT = 0x061C, // U_WMR_ROUNDRECT // U_WMRROUNDRECT _META_PATBLT = 0x061D, // U_WMR_PATBLT // U_WMRPATBLT _META_ESCAPE = 0x0626, // U_WMR_ESCAPE // U_WMRESCAPE _META_CREATEREGION = 0x06FF, // U_WMR_CREATEREGION // U_WMRCREATEREGION _META_ARC = 0x0817, // U_WMR_ARC // U_WMRARC _META_PIE = 0x081A, // U_WMR_PIE // U_WMRPIE _META_CHORD = 0x0830, // U_WMR_CHORD // U_WMRCHORD _META_BITBLT = 0x0922, // U_WMR_BITBLT // U_WMRBITBLT _META_EXTTEXTOUT = 0x0A32, // U_WMR_EXTTEXTOUT // U_WMREXTTEXTOUT _META_STRETCHBLT = 0x0B23, // U_WMR_STRETCHBLT // U_WMRSTRETCHBLT _META_DIBSTRETCHBLT = 0x0B41, // U_WMR_DIBSTRETCHBLT // U_WMRDIBSTRETCHBLT _META_SETDIBTODEV = 0x0D33, // U_WMR_SETDIBTODEV // U_WMRSETDIBTODEV _META_STRETCHDIB = 0x0F43, // U_WMR_STRETCHDIB // U_WMRSTRETCHDIB _META_SAVEDC = 0x001E, // U_WMR_SAVEDC // U_WMRSAVEDC _META_CREATEPALETTE = 0x00F7, // U_WMR_CREATEPALETTE // U_WMRCREATEPALETTE _META_DIBBITBLT = 0x0940, // U_WMR_DIBBITBLT // U_WMRDIBBITBLT _META_DRAWTEXT = 0x062F, // U_WMR_DRAWTEXT // U_WMRDRAWTEXT _META_CREATEBITMAPINDIRECT = 0x02FD, // U_WMR_CREATEBITMAPINDIRECT // U_WMRCREATEBITMAPINDIRECT _META_CREATEBITMAP = 0x06FE, // U_WMR_CREATEBITMAP // U_WMRCREATEBITMAP }; // WMF limits and escape constants with native prefixes enum _WMF_LIMITS { _WMR_MIN = 0, // Minimum WMR_ value _WMR_MAX = 255, // Maximum WMR_ value _WMR_MASK = 0xFF, // Mask for enumerator (lower) byte _WMR_INVALID = 0xFFFFFFFF // Indicates "Not a valid WMR_* value" }; // WMF escape constants with native prefixes enum _MF_ESCAPE_TYPES { _MFE_SETLINECAP = 21, // Set line cap style _MFE_SETLINEJOIN = 22, // Set line join style _MFE_SETMITERLIMIT = 23 // Set miter limit }; ///////////////////////////////////////////////////////////////////////////// // Point type for 16 bit typedef struct { OdInt16 x, y; } OdWmfPoint; // U_POINT16 #define OdWmfPointSize sizeof(OdWmfPoint) // Used for any generic pair of OdInt32 typedef struct { OdInt32 x, y; } OdWmfPointL; // U_PAIR U_POINTL // pair of floats. typedef struct { float x, y; } OdWmfPointF; // U_PAIRF // Coordinates of the upper left, lower right corner. // Note that the coordinate system is 0,0 in the upper left corner // of the screen an N,M in the lower right corner. typedef struct { OdUInt16 left, top, right, bottom; } OdWmfRect; // U_RECT16 #define OdWmfRectSize 8 // Coordinates of the upper left, lower right corner. // Note that the coordinate system is 0,0 in the upper left corner // of the screen an N,M in the lower right corner. typedef struct { OdInt32 left, top, right, bottom; } OdWmfRectL; // U_RECTL typedef struct { OdUInt16 Type; // "bitmap type" MS PDF does not define this field beyond this. OdUInt16 Width; // bitmap width in pixels. OdUInt16 Height; // bitmap height in scan lines. OdUInt16 WidthBytes; // bytes per scan line. OdUInt8 Planes; // must be 1. OdUInt8 BitsPixel; // number of adjacent color bits on each plane (R bits + G bits + B bits ????) } OdWmfBitmap; // U_BITMAP16 #define OdWmfBitmapSize 10 typedef struct { OdUInt32 Size; // size of OdWmfBitmapCoreHeader in bytes. OdUInt16 Width; // DIB width in pixels. OdUInt16 Height; // DIB height in pixels. OdUInt16 Planes; // must be 1 OdUInt16 BitCount; // Pixel Format (BitCount Enumeration) } OdWmfBitmapCoreHeader; // U_BITMAPCOREHEADER; // RGBQUAD structure for DIB color tables typedef struct { OdUInt8 Blue, Green, Red, Reserved; // (0-255) (0-255) (0-255) (Not used) } OdWmfQuad; // U_RGBQUAD // that the color order is BGR, even though the name is RGB // BITMAPINFO bmiHeader field typedef struct { OdUInt32 biSize; // Structure size in bytes OdInt32 biWidth; // Bitmap width in pixels OdInt32 biHeight; // Bitmap height in pixels, may be negative. // abs(biHeight) is bitmap height // bitmap may appear in two orientations: // biHeight > 0 origin is LL corner, may be compressed, this is height after decompression. // biHeight < 0 origin is UL corner, may not be compressed OdUInt16 biPlanes; // Planes (must be 1) OdUInt16 biBitCount; // BitCount Enumeration (determines number of RBG colors) OdUInt32 biCompression; // BI_Compression Enumeration OdUInt32 biSizeImage; // Image size in bytes or 0 = "default size (calculated from geometry?)" OdInt32 biXPelsPerMeter; // X Resolution in pixels/meter OdInt32 biYPelsPerMeter; // Y Resolution in pixels/meter OdUInt32 biClrUsed; // Number of bmciColors in OdWmfBitmapInfo/U_BITMAPCOREINFO that are used by the bitmap OdUInt32 biClrImportant; // Number of bmciColors needed (0 means all). } OdWmfBitmapInfoHeader; // U_BITMAPINFOHEADER #define OdWmfBitmapInfoHeaderSize sizeof(OdWmfBitmapInfoHeader) // Description of a Bitmap which in some cases is a Device Independent Bitmap (DIB) typedef struct { OdWmfBitmapInfoHeader bmiHeader; // Geometry and pixel properties OdWmfQuad bmiColors[1]; // Color table. 24 bit images do not use color table values. } OdWmfBitmapInfo; // U_BITMAPINFO typedef struct { OdUInt16 Style; // BrushStyle Enumeration ODCOLORREF Color; // Brush Color value OdUInt16 Hatch; // HatchStyle Enumeration } OdWmfLogBrush; // U_WLOGBRUSH #define OdWmfLogBrushSize 8 // U_SIZE_WLOGBRUSH // First three fields of MOST WMF records (not WMR_HEADER and WMR_PLACEABLE!) // // This Should only used for accessing size and type fields. typedef struct { OdUInt32 Size_4; // Total number of 16bit words in record OdUInt8 iType; // RecordType Enumeration OdUInt8 xb; // Extra high order byte associated with record type } OdWmfRecord; // _METARECORD; #define OdWmfRecordSize 6 // META_PLACEABLE // If present this must immediately precede the header. // It is not enumerated as an WMR record type. // This only ever occurs at the start of a WMF file, so the two uint32 values will always be aligned. typedef struct { OdUInt32 Key; // MUST be 0x9AC6CDD7 OdUInt16 HWmf; // 0. (Always. Manual says total number of 16bit words in record, but no examples found like that) OdWmfRect Dst; // Destination bounding box in logical units OdUInt16 Inch; // Logical units/inch (convention if not specified: 1440 logical units/inch) OdUInt32 Reserved; // must be 0 OdUInt16 Checksum; // Checksum of preceding 10 16 bit values } OdWmfPlaceableHeader; #define OdWmfPlaceableHeaderSize 22 // META_HEADER typedef struct { OdUInt8 iType, xb; // Extra high order byte associated with record type OdUInt16 Size16w; // Total number of 16bit words in record OdUInt16 version; // Metafile version Enumeration OdUInt16 Sizew[2]; // reassemble/store the Size (16 bit words in entire file) using Sizew, the 32 bit value is not aligned OdUInt16 nObjects; // Total number of brushes, pens, and other graphics objects defined in this file OdUInt32 maxSize; // Largest record in file, in number of 16bit words (This OdUInt32 is aligned) OdUInt16 nMembers; // Unused, should be 0 } OdWmfHeader; #define OdWmfHeaderSize 18 typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; ODCOLORREF Color; // Color value, the 32 bit value is not aligned. } OdWmfSetBkColor, OdWmfSetTextColor; #define OdWmfSetBkColorSize 10 #define OdWmfSetTextColorSize 10 typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 Mode; // Various Enumeraton. OdUInt16 Reserved; } OdWmfSetBkMode, OdWmfSetPolyFillMode, OdWmfSetOp2, OdWmfSetStretchBltMode; // U_WMRSETBKMODE, U_WMRSETPOLYFILLMODE, U_WMRSETROP2, U_WMRSETSTRETCHBLTMODE, U_WMRSETTEXTALIGN; #define OdWmfSetBkModeSize 8 #define OdWmfSetPolyFillModeSize 8 #define OdWmfSetOp2Size 8 #define OdWmfSetStretchBltModeSize 8 #define OdWmfSetTextAlignSize 8 //Mode = MapMode Enumeration. typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 Mode; // Various Enumeraton and other } OdWmfSetMapMode; // U_WMRSETMAPMODE, U_WMRSETTEXTCHAREXTRA; #define OdWmfSetMapModeSize 8 // Window X,Y origin typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 y; // Y value (note order!) OdUInt16 x; // X value } OdWmfSetWindowOrg, // U_WMRSETWINDOWORG OdWmfSetWindowExt, // U_WMRSETWINDOWEXT OdWmfSetViewportOrg, // U_WMRSETVIEWPORTORG OdWmfSetViewportText, // U_WMRSETVIEWPORTEXT // U_WMROFFSETWINDOWORG, U_WMROFFSETVIEWPORTORG OdWmfLineTo; // U_WMRLINETO // U_WMRMOVETO, U_WMROFFSETCLIPRGN #define OdWmfSetWindowOrgSize 10 #define OdWmfSetWindowExtSize 10 #define OdWmfSetViewportOrgSize 10 #define OdWmfSetViewportTextSize 10 #define OdWmfLineToSize 10 typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 Bottom; // Coordinates in logical units OdUInt16 Right; // Coordinates in logical units OdUInt16 Top; // Coordinates in logical units OdUInt16 Left; // Coordinates in logical units } OdWmfIntersectClipRect; // U_WMRINTERSECTCLIPRECT, U_WMREXCLUDECLIPRECT #define OdWmfIntersectClipRectSize 14 typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 yEndArc, xEndArc; OdUInt16 yStartArc, xStartArc; OdUInt16 Bottom, Right, Top, Left; } OdWmfAcr; typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 Bottom, Right, Top, Left; } OdWmfEllipse; // U_WMRRECTANGLE #define OdWmfEllipseSize 14 typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 yRadial2; // in logical units OdUInt16 xRadial2; // in logical units OdUInt16 yRadial1; // in logical units OdUInt16 xRadial1; // in logical units OdUInt16 Bottom; // in logical units OdUInt16 Right; // in logical units OdUInt16 Top; // in logical units OdUInt16 Left; // in logical units } // U_WMRPIE OdWmfChord; // U_WMRCHORD #define OdWmfChordSize 22 typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 rop3w[2]; // reassemble/store the rop3 Ternary raster operation using rop3w, as the 32 bit value is not aligned OdUInt16 Height, Width; OdUInt16 yDst, xDst; } OdWmfPatBlt; #define OdWmfPatBltSize 18 typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 Length; // Stringlength in bytes OdUInt8 String; // String to write, storage area must be 2n bytes. } OdWmfTextOut; // U_WMRTEXTOUT #define OdWmfTextOutSize 8 // This is a variable structure the core/invariant part extends to xSrc. // // if RecordSize == ((xb) + 3) then there is no bitmap and use the _NOPX form, otherwise use the _PX form // Use Macro U_TEST_NOPX2 typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 rop3w[2]; // reassemble/store the Ternary raster operation rop3 value using rop3w, the 32 bit value is not aligned. OdUInt16 ySrc; // in logical units (UL corner of Src rect) OdUInt16 xSrc; // in logical units (UL corner of Src rect) OdUInt16 ignore; // ignore OdUInt16 Height; // in logical units (of Src and Dst rects) OdUInt16 Width; // in logical units (of Src and Dst rects) OdUInt16 yDst; // in logical units (UL corner of Dst rect) OdUInt16 xDst; // in logical units (UL corner of Dst rect) } OdWmfBitBltNopx; // U_WMRBITBLT_NOPX; #define OdWmfBitBltNopxSize 24 // This is a variable structure the core/invariant part extends to xSrc. // // if RecordSize == ((xb) + 3) then there is no bitmap and use the _NOPX form, otherwise use the _PX form // Use Macro U_TEST_NOPX2 typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 rop3w[2]; // reassemble/store the Ternary raster operation rop3 value using rop3w, the 32 bit value is not aligned. OdUInt16 ySrc; // in logical units (UL corner of Src rect) OdUInt16 xSrc; // in logical units (UL corner of Src rect) OdUInt16 Height; // in logical units (of Src and Dst rects) OdUInt16 Width; // in logical units (of Src and Dst rects) OdUInt16 yDst; // in logical units (UL corner of Dst rect) OdUInt16 xDst; // in logical units (UL corner of Dst rect) OdWmfBitmap bitmap; // Src bitmap } OdWmfBitBltPx; // U_WMRBITBLT_PX // This is a variable structure the core/invariant part extends to xSrc. // // if RecordSize == ((xb) + 3) then there is no bitmap and use the _NOPX form, otherwise use the _PX form // Use Macro U_TEST_NOPX2. typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 rop3w[2]; // reassemble/store the Ternary raster operation rop3 value using rop3w, the 32 bit value is not aligned. OdUInt16 hSrc; // Height in logical units of Src rect OdUInt16 wSrc; // Wdith in logical units of Dst rect OdUInt16 ySrc; // in logical units (UL corner of Src rect) OdUInt16 xSrc; // in logical units (UL corner of Src rect) OdUInt16 ignore; // ignored OdUInt16 hDst; // Height in logical units of Dst rect OdUInt16 wDst; // Wdith in logical units of Dst rect OdUInt16 yDst; // in logical units (UL corner of Dst rect) OdUInt16 xDst; // in logical units (UL corner of Dst rect) } OdWmfStretchBltNopx; // U_WMRSTRETCHBLT_NOPX; #define OdWmfStretchBltNopxSize 28 // This is a variable structure the core/invariant part extends to xSrc. // // if RecordSize == ((xb) + 3) then there is no bitmap and use the _NOPX form, otherwise use the _PX form // Use Macro U_TEST_NOPX2. typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 rop3w[2]; // reassemble/store the Ternary raster operation rop3 value using rop3w, the 32 bit value is not aligned. OdUInt16 hSrc; // Height in logical units of Src rect OdUInt16 wSrc; // Wdith in logical units of Dst rect OdUInt16 ySrc; // in logical units (UL corner of Src rect) OdUInt16 xSrc; // in logical units (UL corner of Src rect) OdUInt16 hDst; // Height in logical units of Dst rect OdUInt16 wDst; // Wdith in logical units of Dst rect OdUInt16 yDst; // in logical units (UL corner of Dst rect) OdUInt16 xDst; // in logical units (UL corner of Dst rect) OdWmfBitmap bitmap; // Src bitmap } OdWmfStretchBltPx; // U_WMRSTRETCHBLT_PX typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 y; // in logical units (draw point) OdUInt16 x; // in logical units (draw point) OdUInt16 Length; // Stringlength in bytes OdUInt16 Opts; // ExtTextOutOptions Flags } OdWmfExtTextOut; // U_WMREXTTEXTOUT #define OdWmfExtTextOutSize 14 // The PX form is a variable structure the core/invariant part extends to xDst, and that is // followed by a DeviceInvariantBitmap object which starts at "dib". // The NOPX form is a constant structure. // // if RecordSize == ((xb) + 3) then there is no bitmap and use the _NOPX form, otherwise use the _PX form // Use Macro U_TEST_NOPX2. typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 rop3w[2]; // reassemble/store the Ternary raster operation rop3 value using rop3w, the 32 bit value is not aligned. OdUInt16 hSrc; // in logical units (of Src) OdUInt16 wSrc; // in logical units (of Src) OdUInt16 ySrc; // in logical units (UL corner of Src rect) OdUInt16 xSrc; // in logical units (UL corner of Src rect) OdUInt16 ignore; // ignore OdUInt16 hDst; // in logical units (of Dst) OdUInt16 wDst; // in logical units (of Dst) OdUInt16 yDst; // in logical units (UL corner of Dst rect) OdUInt16 xDst; // in logical units (UL corner of Dst rect) } OdWmfDibStretchBltNopx; // U_WMRDIBSTRETCHBLT_NOPX #define OdWmfDibStretchBltNopxSize 28 // The PX form is a variable structure the core/invariant part extends to xDst, and that is // followed by a DeviceInvariantBitmap object which starts at "dib". // The NOPX form is a constant structure. // // if RecordSize == ((xb) + 3) then there is no bitmap and use the _NOPX form, otherwise use the _PX form // Use Macro U_TEST_NOPX2. typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 rop3w[2]; // reassemble/store the Ternary raster operation rop3 value using rop3w, the 32 bit value is not aligned. OdUInt16 hSrc; // in logical units (of Src) OdUInt16 wSrc; // in logical units (of Src) OdUInt16 ySrc; // in logical units (UL corner of Src rect) OdUInt16 xSrc; // in logical units (UL corner of Src rect) OdUInt16 hDst; // in logical units (of Dst) OdUInt16 wDst; // in logical units (of Dst) OdUInt16 yDst; // in logical units (UL corner of Dst rect) OdUInt16 xDst; // in logical units (UL corner of Dst rect) OdUInt8 dib[1]; // DeviceIndependentBitmap object } OdWmfDibStretchBltPx; #define OdWmfDibStretchBltPxSize 26 typedef struct { OdUInt32 Size16_4; OdUInt8 iType, xb; OdUInt16 rop3w[2]; // reassemble/store the Ternary raster operation rop3 value using rop3w, the 32 bit value is not aligned. OdUInt16 cUsage; // ColorUsage Enumeration OdUInt16 hSrc; // in logical units (of Src) OdUInt16 wSrc; // in logical units (of Src) OdUInt16 ySrc; // in logical units (UL corner of Src rect) OdUInt16 xSrc; // in logical units (UL corner of Src rect) OdUInt16 hDst; // in logical units (of Dst) OdUInt16 wDst; // in logical units (of Dst) OdUInt16 yDst; // in logical units (UL corner of Dst rect) OdUInt16 xDst; // in logical units (UL corner of Dst rect) OdUInt8 dib[1]; // DeviceIndependentBitmap object } OdWmfStretchDib; // U_WMRSTRETCHDIB #define OdWmfStretchDibSize 28 // Brush and font structures for WMF compatibility //typedef struct { // OdUInt16 Style; // ODCOLORREF Color; // OdUInt8 Hatch; //} OdWmfBrush; // U_BRUSH; typedef struct { OdInt16 Height; OdInt16 Width; OdInt16 Escapement; OdInt16 Orientation; OdInt16 Weight; OdUInt8 Italic; OdUInt8 Underline; OdUInt8 StrikeOut; OdUInt8 CharSet; OdUInt8 OutPrecision; OdUInt8 ClipPrecision; OdUInt8 Quality; OdUInt8 PitchAndFamily; char FaceName[32]; } OdWmfFont; // U_FONT #define OdWmfFontCoreSize 18 // sizeof(OdWmfFont) - 32 // withot FaceName part // U_SIZE_FONT_CORE /////////////////////////////////////////////////////////////////////////////// int indexToWmr(int idx); /////////////////////////////////////////////////////////////////////////////// #ifndef USE_UEMF size_t getWmfRecordSize(const char* contents, const char* blimit); int getWmfHeader(const char* contents, const char* blimit, OdWmfPlaceableHeader* Placeable, OdWmfHeader* Header); int getWmfArcPoints(OdWmfRect rclBox, OdWmfPoint ArcStart, OdWmfPoint ArcEnd, int* f1, int f2, OdWmfPointF* center, OdWmfPointF* start, OdWmfPointF* end, OdWmfPointF* size); int getWmfSetBkColor(const char* contents, ODCOLORREF* Color); int getWmfSetBkMode(const char* contents, OdUInt16* Mode); int getWmfSetMapMode(const char* contents, OdUInt16* Mode); int getWmfSetOp2(const char* contents, OdUInt16* Mode); int getWmfSetPolyFillMode(const char* contents, OdUInt16* Mode); int getWmfSetStretchBltMode(const char* contents, OdUInt16* Mode); int getWmfSetTextColor(const char* contents, ODCOLORREF* Color); int getOdWmfSetWindowOrg(const char* contents, OdWmfPoint* coord); int getWmfSetWindowExt(const char* contents, OdWmfPoint* extent); int getWmfSetViewportOrg(const char* contents, OdWmfPoint * coord); int getWmfSetViewportText(const char* contents, OdWmfPoint * extent); int getWmfLineTo(const char* contents, OdWmfPoint * coord); int getWmfIntersectClipRect(const char* contents, OdWmfRect* rect); int getWmfArc(const char* contents, OdWmfPoint* StartArc, OdWmfPoint * EndArc, OdWmfRect* rect); int getWmfEllipse(const char* contents, OdWmfRect* rect); int getWmfPie(const char* contents, OdWmfPoint* Radial1, OdWmfPoint* Radial2, OdWmfRect* rect); int getWmfRectangle(const char* contents, OdWmfRect* rect); int getWmfRoundRect(const char* contents, OdInt16* Width, OdInt16* Height, OdWmfRect* rect); int getWmfPatBlt(const char* contents, OdWmfPoint* Dst, OdWmfPoint* cwh, OdUInt32 *dwRop3); int getWmfTextOut(const char* contents, OdWmfPoint* Dst, OdUInt16* Length, const char** string); int getWmfExtTextOut(const char* contents, OdWmfPoint* Dst, OdUInt16 *Length, OdUInt16 *Opts, const char** string, const OdUInt16** dx, OdWmfRect* rect); int getWmfBitBlt(const char* contents, OdWmfPoint* Dst, OdWmfPoint* cwh, OdWmfPoint* Src, OdUInt32* dwRop3, OdWmfBitmap* Bm16, const char** px); int getWmfStretchBlt(const char* contents, OdWmfPoint* Dst, OdWmfPoint* cDst, OdWmfPoint* Src, OdWmfPoint* cSrc, OdUInt32 *dwRop3, OdWmfBitmap* Bm16, const char** px); int getWmfChord(const char* contents, OdWmfPoint* Radial1, OdWmfPoint* Radial2, OdWmfRect* rect); int getWmfDibBitBlt(const char* contents, OdWmfPoint* Dst, OdWmfPoint* cwh, OdWmfPoint* Src, OdUInt32* dwRop3, const char** dib); int getWmfDibStretchBlt(const char* contents, OdWmfPoint* Dst, OdWmfPoint* cDst, OdWmfPoint* Src, OdWmfPoint* cSrc, OdUInt32* dwRop3, const char** dib); int getWmfStretchDib(const char* contents, OdWmfPoint* Dst, OdWmfPoint* cDst, OdWmfPoint* Src, OdWmfPoint* cSrc, OdUInt16* cUsage, OdUInt32* dwRop3, const char** dib); int getWmfPolygon(const char* contents, OdUInt16* cPts, const char** points); int getWmfEscape(const char* contents, OdUInt16* Escape, OdUInt16* elen, const char** text); int getWmfRestoreDc(const char* contents, OdInt16* dc); int getWmfSelectClipRegion(const char* contents, OdUInt16* region); int getWmfSelectObject(const char* contents, OdUInt16* object); int getWmfSetTextAlign(const char* contents, OdUInt16* textAlign); int getWmfPolyPolygon(const char* contents, OdUInt16* nPolys, const OdUInt16** aPolyCounts, const char** Points); int getWmfDeleteObject(const char* contents, OdUInt16* object); int getWmfCreateBrushIndirect(const char* contents, const char** membrush); int getWmfCreateFontIndirect(const char* contents, const char** memfont); int getWmfHeaderPrint(const char *contents, const char *blimit); int getWmfOneRecPrint(const char* contents, const char* blimit, int recnum, OdUInt32 off); OdUInt32 getWmfProperties(OdUInt32 type); // ************************************************************************************************ #else // USE_UEMF // redirect to use UEMF library // // When USE_UEMF is defined, redirect getWmf* functions to libUEMF's U_WMR*_get functions #define getWmfEscape(contents, Escape, elen, text) \ U_WMRESCAPE_get(contents, Escape, elen, text) #define getWmfRestoreDc(contents, dc) \ U_WMRRESTOREDC_get(contents, (int16_t*) dc) #define getWmfSelectClipRegion(contents, Region) \ U_WMRSELECTCLIPREGION_get(contents, (uint16_t*) Region) #define getWmfSelectObject(contents, object) \ U_WMRSELECTOBJECT_get(contents, (uint16_t*) object) #define getWmfSetTextAlign(contents, textAlign) \ U_WMRSETTEXTALIGN_get(contents, textAlign) #define getWmfPolyPolygon(contents, nPolys, aPolyCounts, Points) \ U_WMRPOLYPOLYGON_get(contents, (uint16_t*) nPolys, (const uint16_t**) aPolyCounts, Points) #define getWmfDeleteObject(contents, object) \ U_WMRDELETEOBJECT_get(contents, (uint16_t*) object) #define getWmfCreateBrushIndirect(contents, lb) \ U_WMRCREATEBRUSHINDIRECT_get(contents, lb) #define getWmfCreateFontIndirect(contents, font) \ U_WMRCREATEFONTINDIRECT_get(contents, font) #define getWmfHeaderPrint(contents, blimit) \ wmfheader_print(contents, blimit) #define getWmfOneRecPrint(contents, blimit, recnum, off) \ U_wmf_onerec_print(contents, blimit, recnum, (OdUInt32) off) #define getWmfProperties(type) \ U_wmr_properties(type) //-- #define getWmfRecordSize(contents, blimit) \ U_WMRRECSAFE_get(contents, blimit) #define getWmfHeader(contents, blimit, Placeable, Header) \ wmfheader_get(contents, blimit, (U_WMRPLACEABLE*)Placeable, (U_WMRHEADER*) Header) #define getWmfArcPoints(rclBox, ArcStart, ArcEnd, f1, f2, center, start, end, size) \ wmr_arc_points(*(U_RECT16*)&rclBox, *(U_POINT16*)&ArcStart, *(U_POINT16*)&ArcEnd, \ f1, f2, (U_PAIRF*) center, (U_PAIRF*) start, (U_PAIRF*) end, (U_PAIRF*) size) #define getWmfSetBkColor(contents, Color) \ U_WMRSETBKCOLOR_get(contents, (U_COLORREF*) Color) #define getWmfSetBkMode(contents, Mode) \ U_WMRSETBKMODE_get(contents, (uint16_t*) Mode) #define getWmfSetMapMode(contents, Mode) \ U_WMRSETMAPMODE_get(contents, (uint16_t*) Mode) #define getWmfSetOp2(contents, Mode) \ U_WMRSETROP2_get(contents, (uint16_t*) Mode) #define getWmfSetPolyFillMode(contents, Mode) \ U_WMRSETPOLYFILLMODE_get(contents, (uint16_t*) Mode) #define getWmfSetStretchBltMode(contents, Mode) \ U_WMRSETSTRETCHBLTMODE_get(contents, (uint16_t*) Mode) #define getWmfSetTextColor(contents, Color) \ U_WMRSETTEXTCOLOR_get(contents, (U_COLORREF*) Color) #define getWmfPolygon(contents, cPts, points) \ U_WMRPOLYGON_get(contents, (uint16_t*) cPts, points) #define getOdWmfSetWindowOrg(contents, coord) \ U_WMRSETWINDOWORG_get(contents, (U_POINT16*) coord) #define getWmfSetWindowExt(contents, extent) \ U_WMRSETWINDOWEXT_get(contents, (U_POINT16*) extent) #define getWmfSetViewportOrg(contents, coord) \ U_WMRSETVIEWPORTORG_get(contents, (U_POINT16*) coord) #define getWmfSetViewportText(contents, extent) \ U_WMRSETVIEWPORTEXT_get(contents, (U_POINT16*) extent) #define getWmfLineTo(contents, coord) \ U_WMRLINETO_get(contents, (U_POINT16*) coord) #define getWmfIntersectClipRect(contents, rect) \ U_WMRINTERSECTCLIPRECT_get(contents, (U_RECT16*) rect) #define getWmfArc(contents, StartArc, EndArc, rect) \ U_WMRARC_get(contents, (U_POINT16*) StartArc, (U_POINT16*) EndArc, (U_RECT16*) rect) #define getWmfEllipse(contents, rect) \ U_WMRELLIPSE_get(contents, (U_RECT16*) rect) #define getWmfPie(contents, Radial1, Radial2, rect) \ U_WMRPIE_get(contents, (U_POINT16*) Radial1, (U_POINT16*) Radial2, (U_RECT16*) rect) #define getWmfRectangle(contents, rect) \ U_WMRRECTANGLE_get(contents, (U_RECT16*) rect) #define getWmfRoundRect(contents, Width, Height, rect) \ U_WMRROUNDRECT_get(contents, (int16_t*) Width, (int16_t*) Height, (U_RECT16*) rect) #define getWmfPatBlt(contents, Dst, cwh, dwRop3) \ U_WMRPATBLT_get(contents, (U_POINT16*) Dst, (U_POINT16*) cwh, (uint32_t*) dwRop3) #define getWmfTextOut(contents, Dst, Length, string) \ U_WMRTEXTOUT_get(contents, (U_POINT16*) Dst, (int16_t*) Length, (const char**) string) #define getWmfExtTextOut(contents, Dst, Length, Opts, string, dx, rect) \ U_WMREXTTEXTOUT_get(contents, (U_POINT16*) Dst, (int16_t*) Length, (uint16_t*) Opts, (const char**) string, (const int16_t**) dx, (U_RECT16*) rect) #define getWmfBitBlt(contents, Dst, cwh, Src, dwRop3, Bm16, px) \ U_WMRBITBLT_get(contents, (U_POINT16*) Dst, (U_POINT16*) cwh, (U_POINT16*) Src, (uint32_t*) dwRop3, (U_BITMAP16*) Bm16, (const char**) px) #define getWmfStretchBlt(contents, Dst, cDst, Src, cSrc, dwRop3, Bm16, px) \ U_WMRSTRETCHBLT_get(contents, (U_POINT16*) Dst, (U_POINT16*) cDst, (U_POINT16*) Src, (U_POINT16*) cSrc, (uint32_t*) dwRop3, (U_BITMAP16*) Bm16, (const char**) px) #define getWmfChord(contents, Radial1, Radial2, rect) \ U_WMRCHORD_get(contents, (U_POINT16*) Radial1, (U_POINT16*) Radial2, (U_RECT16*) rect) #define getWmfDibBitBlt(contents, Dst, cwh, Src, dwRop3, dib) \ U_WMRDIBBITBLT_get(contents, (U_POINT16*) Dst, (U_POINT16*) cwh, (U_POINT16*) Src, (uint32_t*) dwRop3, dib) #define getWmfDibStretchBlt(contents, Dst, cDst, Src, cSrc, dwRop3, dib) \ U_WMRDIBSTRETCHBLT_get(contents, (U_POINT16*) Dst, (U_POINT16*) cDst, (U_POINT16*) Src, (U_POINT16*) cSrc, (uint32_t*) dwRop3, dib) #define getWmfStretchDib(contents, Dst, cDst, Src, cSrc, cUsage, dwRop3, dib) \ U_WMRSTRETCHDIB_get(contents, (U_POINT16*) Dst, (U_POINT16*) cDst, (U_POINT16*) Src, (U_POINT16*) cSrc, (uint16_t*) cUsage, (uint32_t*) dwRop3, dib) #endif // USE_UEMF // ************************************************************************************************ #ifdef _MSC_VER #pragma warning (pop) #endif #pragma pack(pop) // cross-platform or #ifdef TD_CLIENT_PACKING_VALUE #pragma pack TD_CLIENT_PACKING_VALUE #endif as in #include "TD_PackPop.h" #endif // OD_WMF_H