uemf.h revision 3eb34f9726277927ccb46091b08045b9fe658c29
/**
@file uemf.h Structures and functions prototypes for EMF files.
EMF file Record structure information has been derived from Mingw, Wine, and libEMF header files, and from
Microsoft's EMF Information pdf, release date March 28,2012, link from here:
If the direct link fails the document may be found
by searching for: "[MS-EMF]: Enhanced Metafile Format"
*/
/*
File: uemf.h
Version: 0.0.9
Date: 04-OCT-2012
Author: David Mathog, Biology Division, Caltech
email: mathog@caltech.edu
Copyright: 2012 David Mathog and California Institute of Technology (Caltech)
*/
#ifndef _UEMF_
#define _UEMF_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>
#include "uemf_endian.h"
// ***********************************************************************************
// defines not placed yet
#define U_PAN_CULTURE_LATIN 0
#define U_SYSPAL_ERROR 0
#define U_SYSPAL_STATIC 1
#define U_SYSPAL_NOSTATIC 2
#define U_ELF_VENDOR_SIZE 4
// ***********************************************************************************
// Value enumerations and other predefined constants, alphabetical order by group
/** \defgroup Font_struct_widths Font name and style widths in characters
For U_LOGFONT and U_LOGFONT_PANOSE,
@{
*/
#define U_LF_FACESIZE 32 //!< U_LOGFONT lfFaceName and U_LOGFONT_PANOSE elfStyle fields maximum width
/** @} */
/** \defgroup U_EMR_Qualifiers RecordType Enumeration
(RecordType Enumeration)
For U_EMR iType field
@{
*/
/** @} */
/** \defgroup U_DRAW_PROPERTIES
Used in draw_properties(). These are the bit definitions.
@{
*/
/** @} */
/** \defgroup U_EMRSETARCDIRECTION_Qualifiers ArcDirection Enumeration
For U_EMRSETARCDIRECTION iArcDirection field
@{
*/
#define U_AD_COUNTERCLOCKWISE 1
#define U_AD_CLOCKWISE 2
/** @} */
/** \defgroup U_PANOSE_bArmStyle_Qualifiers ArmStyle Enumeration
For U_PANOSE bArmStyle field
@{
*/
#define U_PAN_STRAIGHT_ARMS_HORZ 2
#define U_PAN_STRAIGHT_ARMS_WEDGE 3
#define U_PAN_STRAIGHT_ARMS_VERT 4
#define U_PAN_STRAIGHT_ARMS_SINGLE_SERIF 5
#define U_PAN_STRAIGHT_ARMS_DOUBLE_SERIF 6
#define U_PAN_BENT_ARMS_HORZ 7
#define U_PAN_BENT_ARMS_WEDGE 8
#define U_PAN_BENT_ARMS_VERT 9
#define U_PAN_BENT_ARMS_SINGLE_SERIF 10
#define U_PAN_BENT_ARMS_DOUBLE_SERIF 11
/** @} */
/** \defgroup U_EMRSETBKMODE_iMode_Qualifiers BackgroundMode enumeration
For U_EMRSETBKMODE iMode field
@{
*/
#define U_TRANSPARENT 1
#define U_OPAQUE 2
/** @} */
/** \defgroup U_BITMAPINFOHEADER_biBitCount_Qualifiers BitCount Enumeration
For U_BITMAPINFOHEADER biBitCount field.
@{
*/
#define U_BCBM_EXPLICIT 0 //!< Derived from JPG or PNG compressed image or ?
#define U_BCBM_COLOR16 16 //!< 2^16 colors. bmiColors is not used. Pixels are 5 bits B,G,R with 1 unused bit
/** @} */
/** \defgroup U_BITMAPINFOHEADER_biCompression_Qualifiers BI_Compression Enumeration
For U_BITMAPINFOHEADER biCompression field
@{
*/
#define U_BI_RGB 0 //!< This is the only one supported by UEMF at present
#define U_BI_RLE8 1
#define U_BI_RLE4 2
#define U_BI_BITFIELDS 3
#define U_BI_JPEG 4
#define U_BI_PNG 5
/** @} */
/** \defgroup U_COLORADJUSTMENT_caFlags_Qualifiers ColorAdjustment Enumeration
For U_COLORADJUSTMENT caFlags field
@{
*/
#define U_CA_NEGATIVE 0x0001
#define U_CA_LOG_FILTER 0x0002
/** @} */
/** \defgroup U_EMRCOLORMATCHTOTARGETW_dwAction_Qualifiers ColorMatchToTarget Enumeration
For U_EMRCOLORMATCHTOTARGETW dwFlags field
@{
*/
#define U_COLORMATCHTOTARGET_NOTEMBEDDED 0
#define U_COLORMATCHTOTARGET_EMBEDDED 1
/** @} */
/** \defgroup U_EMRCOLORMATCHTOTARGETW_dwAction_Qualifiers ColorSpace Enumeration
For U_EMRCOLORMATCHTOTARGETW dwAction field
@{
*/
#define U_CS_ENABLE 1
#define U_CS_DISABLE 2
#define U_CS_DELETE_TRANSFORM 3
/** @} */
/** \defgroup U_PANOSE_bContrast_Qualifiers Contrast Enumeration
For U_PANOSE bContrast field
@{
*/
#define U_PAN_CONTRAST_NONE 2
#define U_PAN_CONTRAST_VERY_LOW 3
#define U_PAN_CONTRAST_LOW 4
#define U_PAN_CONTRAST_MEDIUM_LOW 5
#define U_PAN_CONTRAST_MEDIUM 6
#define U_PAN_CONTRAST_MEDIUM_HIGH 7
#define U_PAN_CONTRAST_HIGH 8
#define U_PAN_CONTRAST_VERY_HIGH 9
/** @} */
/** \defgroup U_DIBITS_iUsageSrc_Qualifiers DIBColors Enumeration
For U_EMRSETDIBITSTODEIVCE and U_EMRSTRETCHDIBITS iUsageSrc fields.
@{
*/
#define U_DIB_RGB_COLORS 0
#define U_DIB_PAL_COLORS 1
/** @} */
/** \defgroup U_EMRCOMMENT_* cIdent Qualifiers
For U_EMRCOMMENT_* cIdent fields
@{
*/
#define U_EMR_COMMENT_PUBLIC 0x43494447
#define U_EMR_COMMENT_SPOOL 0x00000000
#define U_EMR_COMMENT_SPOOLFONTDEF 0x544F4E46
#define U_EMR_COMMENT_EMFPLUSRECORD 0x2B464D45
/** @} */
/** \defgroup U_EMR_COMMENT_PUBLIC, AKA EMRComment Enumeration
For U_EMRCOMMENT_PUBLI pcIdent fields
@{
*/
#define U_EMR_COMMENT_WINDOWS_METAFILE 0x80000001
#define U_EMR_COMMENT_BEGINGROUP 0x00000002
#define U_EMR_COMMENT_ENDGROUP 0x00000003
#define U_EMR_COMMENT_MULTIFORMATS 0x40000004
#define U_EMR_COMMENT_UNICODE_STRING 0x00000040
#define U_EMR_COMMENT_UNICODE_END 0x00000080
/** @} */
/** \defgroup U_EMRTEXT_foptions_Qualifiers ExtTextOutOptions Enumeration
For U_EMRTEXT foptions field
@{
*/
#define U_ETO_NONE 0x00000000
#define U_ETO_GRAYED 0x00000001
#define U_ETO_OPAQUE 0x00000002
#define U_ETO_CLIPPED 0x00000004
#define U_ETO_GLYPH_INDEX 0x00000010
#define U_ETO_RTLREADING 0x00000080
#define U_ETO_NO_RECT 0x00000100
#define U_ETO_SMALL_CHARS 0x00000200 // For EMRSMALLTEXTOUT ONLY, does not affect EMRTEXTOUTA or EMRTEXTOUTW
#define U_ETO_NUMERICSLOCAL 0x00000400
#define U_ETO_NUMERICSLATIN 0x00000800
#define U_ETO_IGNORELANGUAGE 0x00001000
#define U_ETO_PDY 0x00002000
#define U_ETO_REVERSE_INDEX_MAP 0x00010000
/** @} */
/** \defgroup U_PANOSE_bFamilyType_Qualifiers FamilyType Enumeration
For U_PANOSE bFamilyType field
@{
*/
#define U_PAN_FAMILY_TEXT_DISPLAY 2
#define U_PAN_FAMILY_SCRIPT 3
#define U_PAN_FAMILY_DECORATIVE 4
#define U_PAN_FAMILY_PICTORIAL 5
/** @} */
/** \defgroup U_EMREXTFLOODFILL_iMode_Qualifiers FloodFill Enumeration
For U_EMREXTFLOODFILL iMode field
@{
*/
#define U_FLOODFILLBORDER 0x00000000
#define U_FLOODFILLSURFACE 0x00000000
/** @} */
/** \defgroup U_DESIGNVECTOR_Signature_Qualifiers Signature Enumeration
For U_DESIGNVECTOR Signature field
@{
*/
#define U_EPS_SIGNATURE 0x46535045
/** @} */
/** \defgroup U_EMRGRADIENTFILL_ulMode_Qualifiers GradientFill Enumeration
For U_EMRGRADIENTFILL ulMode field
@{
*/
#define U_GRADIENT_FILL_RECT_H 0x00000000
#define U_GRADIENT_FILL_RECT_V 0x00000001
#define U_GRADIENT_FILL_TRIANGLE 0x00000002
/** @} */
/** \defgroup U_EMREXTTEXTOUT_iGraphicsMode_Qualifiers GraphicsMode Enumeration
For U_EMREXTTEXTOUTA/U_EMREXTTEXTOUTW and all other iGraphicsMode fields
@{
*/
#define U_GM_COMPATIBLE 1
#define U_GM_ADVANCED 2
#define U_GM_LAST 2
/** @} */
/** \defgroup U_LOGBRUSH_lbHatch_Qualifiers HatchStyle Enumeration
For U_LOGBRUSH lbHatch field
@{
*/
#define U_HS_HORIZONTAL 0
#define U_HS_VERTICAL 1
#define U_HS_FDIAGONAL 2
#define U_HS_BDIAGONAL 3
#define U_HS_CROSS 4
#define U_HS_DIAGCROSS 5
#define U_HS_SOLIDCLR 6
#define U_HS_DITHEREDCLR 7
#define U_HS_SOLIDTEXTCLR 8
#define U_HS_DITHEREDTEXTCLR 9
#define U_HS_SOLIDBKCLR 10
#define U_HS_DITHEREDBKCLR 11
/** @} */
/** \defgroup U_EMRSETICMMODE_iMode_Qualifiers ICMMode Enumeration
For EMF U_EMR_SETICMMODE iMode field
@{
*/
#define U_ICM_OFF 1
#define U_ICM_ON 2
#define U_ICM_QUERY 3
/** @} */
/** \defgroup U_COLORADJUSTMENT_caIlluminantIndex_Qualifiers Illuminant Enumeration
For U_COLORADJUSTMENT caIlluminantIndex field
@{
*/
#define U_ILLUMINANT_DEVICE_DEFAULT 0
#define U_ILLUMINANT_A 1
#define U_ILLUMINANT_B 2
#define U_ILLUMINANT_C 3
#define U_ILLUMINANT_D50 4
#define U_ILLUMINANT_D55 5
#define U_ILLUMINANT_D65 6
#define U_ILLUMINANT_D75 7
#define U_ILLUMINANT_F2 8
#define U_ILLUMINANT_MAX_INDEX ILLUMINANT_F2
#define U_ILLUMINANT_TUNGSTEN ILLUMINANT_A
#define U_ILLUMINANT_DAYLIGHT ILLUMINANT_C
#define U_ILLUMINANT_NTSC ILLUMINANT_C
/** @} */
/** \defgroup U_LOGBRUSH_lbStyle_Qualifiers LB_Style Enumeration
For U_LOGBRUSH lbStyle field
@{
*/
#define U_BS_SOLID 0
#define U_BS_NULL 1
#define U_BS_HOLLOW 1
#define U_BS_HATCHED 2
#define U_BS_PATTERN 3
#define U_BS_INDEXED 4
#define U_BS_DIBPATTERN 5
#define U_BS_DIBPATTERNPT 6
#define U_BS_PATTERN8X8 7
#define U_BS_DIBPATTERN8X8 8
#define U_BS_MONOPATTERN 9
/** @} */
/** \defgroup _LOGCOLORSPACE_lcsCSType_Qualifiers LCS_CSType Enumeration
For U_LOGCOLORSPACEA/U_LOGCOLORSPACEW lcsCSType field
@{
*/
#define U_LCS_CALIBRATED_RGB 0x00000000L
#define U_LCS_DEVICE_RGB 0x00000001L
#define U_LCS_DEVICE_CMYK 0x00000002L
/** @} */
/** \defgroup U_LOGCOLORSPACE_lcsIntent_Qualifiers LCS_Intent Enumeration
For U_LOGCOLORSPACEA/U_LOGCOLORSPACEW lcsIntent field
@{
*/
#define U_LCS_GM_BUSINESS 0x00000001L
#define U_LCS_GM_GRAPHICS 0x00000002L
#define U_LCS_GM_IMAGES 0x00000004L
#define U_LCS_GM_ABS_COLORIMETRIC 0x00000008L
/** @} */
/** \defgroup U_PANOSE_bLetterForm_Qualifiers Letterform Enumeration
For U_PANOSE bLetterForm field
@{
*/
#define U_PAN_LETT_NORMAL_COMPACT 2
#define U_PAN_LETT_NORMAL_WEIGHTED 3
#define U_PAN_LETT_NORMAL_BOXED 4
#define U_PAN_LETT_NORMAL_FLATTENED 5
#define U_PAN_LETT_NORMAL_ROUNDED 6
#define U_PAN_LETT_NORMAL_OFF_CENTER 7
#define U_PAN_LETT_NORMAL_SQUARE 8
#define U_PAN_LETT_OBLIQUE_COMPACT 9
#define U_PAN_LETT_OBLIQUE_WEIGHTED 10
#define U_PAN_LETT_OBLIQUE_BOXED 11
#define U_PAN_LETT_OBLIQUE_FLATTENED 12
#define U_PAN_LETT_OBLIQUE_ROUNDED 13
#define U_PAN_LETT_OBLIQUE_OFF_CENTER 14
#define U_PAN_LETT_OBLIQUE_SQUARE 15
/** @} */
/** \defgroup U_LOGFONT_lfWeight_Qualifiers LF_Weight Enumeration
For U_LOGFONT lfWeight field
@{
*/
#define U_FW_DONTCARE 0
#define U_FW_THIN 100
#define U_FW_EXTRALIGHT 200
#define U_FW_ULTRALIGHT 200
#define U_FW_LIGHT 300
#define U_FW_NORMAL 400
#define U_FW_REGULAR 400
#define U_FW_MEDIUM 500
#define U_FW_SEMIBOLD 600
#define U_FW_DEMIBOLD 600
#define U_FW_BOLD 700
#define U_FW_EXTRABOLD 800
#define U_FW_ULTRABOLD 800
#define U_FW_HEAVY 900
#define U_FW_BLACK 900
/** @} */
/** \defgroup U_LOGFONT_lfItalic_Qualifiers LF_Italic Enumeration
For U_LOGFONT lfItalic field
@{
*/
#define U_FW_NOITALIC 0
#define U_FW_ITALIC 1
/** @} */
/** \defgroup U_LOGFONT_lfunderline_Qualifiers LF_Underline Enumeration
For U_LOGFONT lfunderline field
@{
*/
#define U_FW_NOUNDERLINE 0
#define U_FW_UNDERLINE 1
/** @} */
/** \defgroup U_LOGFONT_lfStrikeOut_Qualifiers LF_StrikeOut Enumeration
For U_LOGFONT lfStrikeOut field
@{
*/
#define U_FW_NOSTRIKEOUT 0
#define U_FW_STRIKEOUT 1
/** @} */
/** \defgroup U_LOGFONT_lfCharSet_Qualifiers LF_CharSet Enumeration
For U_LOGFONT lfCharSet field
@{
*/
#define U_HANGUL_CHARSET U_HANGEUL_CHARSET
#define U_EASTEUROPE_CHARSET U_EE_CHARSET
/* I don't know if the values of *_CHARSET macros are defined in Windows
* or if we can choose them as we want. -- srtxg
*/
/** @} */
/** \defgroup U_LOGFONT_lfOutPrecision_Qualifiers LF_OutPrecision Enumeration
For U_LOGFONT lfOutPrecision field
@{
*/
#define U_OUT_DEFAULT_PRECIS 0
#define U_OUT_STRING_PRECIS 1
#define U_OUT_CHARACTER_PRECIS 2
#define U_OUT_STROKE_PRECIS 3
#define U_OUT_TT_PRECIS 4
#define U_OUT_DEVICE_PRECIS 5
#define U_OUT_RASTER_PRECIS 6
#define U_OUT_TT_ONLY_PRECIS 7
#define U_OUT_OUTLINE_PRECIS 8
/** @} */
/** \defgroup U_LOGFONT_lfClipPrecision_Qualifiers LF_ClipPrecision Enumeration
For U_LOGFONT lfClipPrecision field
@{
*/
#define U_CLIP_DEFAULT_PRECIS 0x00
#define U_CLIP_CHARACTER_PRECIS 0x01
#define U_CLIP_STROKE_PRECIS 0x02
#define U_CLIP_MASK 0x0F
#define U_CLIP_LH_ANGLES 0x10
#define U_CLIP_TT_ALWAYS 0x20
#define U_CLIP_EMBEDDED 0x80
/** @} */
/** \defgroup U_LOGFONT_lfQuality_Qualifiers LF_Quality Enumeration
For For U_LOGFONT lfQuality field
@{
*/
#define U_DEFAULT_QUALITY 0
#define U_DRAFT_QUALITY 1
#define U_PROOF_QUALITY 2
#define U_NONANTIALIASED_QUALITY 3
#define U_ANTIALIASED_QUALITY 4
/** @} */
/** \defgroup U_LOGFONT_lfPitchAndFamily_Qualifiers LF_PitchAndFamily Enumeration
For U_LOGFONT lfPitchAndFamily field
@{
*/
#define U_DEFAULT_PITCH 0x00
#define U_FIXED_PITCH 0x01
#define U_VARIABLE_PITCH 0x02
#define U_MONO_FONT 0x08
#define U_FF_DONTCARE 0x00
#define U_FF_ROMAN 0x10
#define U_FF_SWISS 0x20
#define U_FF_MODERN 0x30
#define U_FF_SCRIPT 0x40
#define U_FF_DECORATIVE 0x50
/** @} */
/** \defgroup U_EMRSETMAPMODE_iMode_Qualifiers MapMode Enumeration
For U_EMRSETMAPMODE iMode field
@{
*/
#define U_MM_TEXT 1
#define U_MM_LOMETRIC 2
#define U_MM_HIMETRIC 3
#define U_MM_LOENGLISH 4
#define U_MM_HIENGLISH 5
#define U_MM_TWIPS 6
#define U_MM_ISOTROPIC 7
#define U_MM_ANISOTROPIC 8
#define U_MM_MAX U_MM_ANISOTROPIC
#define U_MM_MAX_FIXEDSCALE U_MM_TWIPS
/** @} */
/** \defgroup U_PANOSE_bMidline_Qualifiers MidLine Enumeration
For U_PANOSE bMidline field
@{
*/
#define U_PAN_MIDLINE_STANDARD_TRIMMED 2
#define U_PAN_MIDLINE_STANDARD_POINTED 3
#define U_PAN_MIDLINE_STANDARD_SERIFED 4
#define U_PAN_MIDLINE_HIGH_TRIMMED 5
#define U_PAN_MIDLINE_HIGH_POINTED 6
#define U_PAN_MIDLINE_HIGH_SERIFED 7
#define U_PAN_MIDLINE_CONSTANT_TRIMMED 8
#define U_PAN_MIDLINE_CONSTANT_POINTED 9
#define U_PAN_MIDLINE_CONSTANT_SERIFED 10
#define U_PAN_MIDLINE_LOW_TRIMMED 11
#define U_PAN_MIDLINE_LOW_POINTED 12
#define U_PAN_MIDLINE_LOW_SERIFED 13
/** @} */
/** \defgroup U_EMRSETLAYOUT_iMode_Qualifiers Mirroring Enumeration
For U_EMRSETLAYOUT iMode field
@{
*/
#define U_LAYOUT_LTR 0x00000000
#define U_LAYOUT_RTL 0x00000001
#define U_LAYOUT_BITMAPORIENTATIONPRESERVED 0x00000008
#define U_NOMIRRORBITMAP 0x80000000
/** @} */
/** \defgroup U_EMRMODIFYWORLDTRANSFORM_iMode_Qualifiers ModifyWorldTransformMode Enumeration
For U_EMRMODIFYWORLDTRANSFORM iMode
@{
*/
#define U_MWT_IDENTITY 1
#define U_MWT_LEFTMULTIPLY 2
#define U_MWT_RIGHTMULTIPLY 3
#define U_MWT_MIN U_MWT_IDENTITY
#define U_MWT_MAX U_MWT_RIGHTMULTIPLY
/** @} */
/** \defgroup U_PANOSE_common_Qualifiers PanoseCommon Enumeration
Used by all PAN_* enumerations, but only defined once here.
See also U_PAN_ALL1 after the U_PANOSE structure
@{
*/
#define U_PAN_ANY 0
#define U_PAN_NO_FIT 1
/** @} */
/** \defgroup U_PANOSE_index PanoseIndex Enumeration
Fositions of each field in U_PANOSE structure.
@{
*/
#define U_PANOSE_COUNT 10
#define U_PANOSE_FAMILYTYPE_INDEX 0
#define U_PAN_SERIFSTYLE_INDEX 1
#define U_PAN_WEIGHT_INDEX 2
#define U_PAN_PROPORTION_INDEX 3
#define U_PAN_CONTRAST_INDEX 4
#define U_PAN_STROKEVARIATION_INDEX 5
#define U_PAN_ARMSTYLE_INDEX 6
#define U_PAN_LETTERFORM_INDEX 7
#define U_PAN_MIDLINE_INDEX 8
#define U_PAN_XHEIGHT_INDEX 9
/** @} */
/** \defgroup U_*LOGPEN_elpPenStyle_Qualifiers PenStyle Enumeration
For U_LOGPEN lopnStyle and U_EXTLOGPEN elpPenStyle fields
@{
*/
#define U_PS_SOLID 0x00000000
#define U_PS_DASH 0x00000001 //!< This only works when NO other U_PS is set. Line width is minimum no matter what pen is set to.
#define U_PS_DOT 0x00000002 //!< This only works when NO other U_PS is set. Line width is minimum no matter what pen is set to.
#define U_PS_DASHDOT 0x00000003 //!< This only works when NO other U_PS is set. Line width is minimum no matter what pen is set to.
#define U_PS_DASHDOTDOT 0x00000004 //!< This only works when NO other U_PS is set. Line width is minimum no matter what pen is set to.
#define U_PS_NULL 0x00000005
#define U_PS_INSIDEFRAME 0x00000006
#define U_PS_USERSTYLE 0x00000007
#define U_PS_ALTERNATE 0x00000008
#define U_PS_STYLE_MASK 0x0000000f
#define U_PS_ENDCAP_SQUARE 0x00000100
#define U_PS_ENDCAP_FLAT 0x00000200
#define U_PS_ENDCAP_MASK 0x00000f00
#define U_PS_JOIN_BEVEL 0x00001000
#define U_PS_JOIN_MITER 0x00002000
#define U_PS_JOIN_MASK 0x0000f000
#define U_PS_COSMETIC 0x00000000 //!< width may only be 1 pixel. (If set higher it is still drawn as 1).
#define U_PS_GEOMETRIC 0x00010000 //!< width may be >1 pixel, but style may only be U_PS_SOLID or U_PS_NULL.
#define U_PS_TYPE_MASK 0x000f0000
/** @} */
/** \defgroup U_PIXELFORMATDESCRIPTOR_dwFlags_Qualifiers PFD_dwFlags Enumeration
For U_PIXELFORMATDESCRIPTOR dwFlags field
@{
*/
#define U_PFD_DOUBLEBUFFER 0x00000001
#define U_PFD_STEREO 0x00000002
#define U_PFD_DRAW_TO_WINDOW 0x00000004
#define U_PFD_DRAW_TO_BITMAP 0x00000008
#define U_PFD_SUPPORT_GDI 0x00000010
#define U_PFD_SUPPORT_OPENGL 0x00000020
#define U_PFD_GENERIC_FORMAT 0x00000040
#define U_PFD_NEED_PALETTE 0x00000080
#define U_PFD_NEED_SYSTEM_PALETTE 0x00000100
#define U_PFD_SWAP_EXCHANGE 0x00000200
#define U_PFD_SWAP_COPY 0x00000400
#define U_PFD_SWAP_LAYER_BUFFERS 0x00000800
#define U_PFD_GENERIC_ACCELERATED 0x00001000
/** @} */
/** \defgroup U_PIXELFORMATDESCRIPTOR_iLayerType_Qualifiers PFD_iLayerType Enumeration
For U_PIXELFORMATDESCRIPTOR iLayerType field
@{
*/
#define U_PFD_MAIN_PLANE 0
#define U_PFD_OVERLAY_PLANE 1
#define U_PFD_UNDERLAY_PLANE (-1)
/** @} */
/** \defgroup U_PIXELFORMATDESCRIPTOR_iPixelType_Qualifiers PFD_iPixelType Enumeration
For U_PIXELFORMATDESCRIPTOR iPixelType field
@{
*/
#define U_PFD_TYPE_RGBA 0
#define U_PFD_TYPE_COLORINDEX 1
/** @} */
/** \defgroup U_EMRPOLY_iMode_Qualifiers Point Enumeration
For U_EMRPOLYDRAW and U_EMRPOLAYDRAW16 abTypes fields.
@{
*/
#define U_PT_CLOSEFIGURE 0x0001
#define U_PT_LINETO 0x0002
#define U_PT_BEZIERTO 0x0004
#define U_PT_MOVETO 0x0006
/** @} */
/** \defgroup U_EMRSETPOLYFILLMODE_iMode_Qualifiers PolygonFillMode Enumeration
For U_EMRSETPOLYFILLMODE iMode field
@{
*/
#define U_ALTERNATE 1
#define U_WINDING 2
#define U_POLYFILL_LAST 2
/** @} */
/** \defgroup U_BITMAPV5HEADER_bV5CSType_Qualifiers Profile Enumeration
For U_BITMAPV5HEADER bV5CSType field
@{
*/
#define U_PROFILE_LINKED 'LINK'
#define U_PROFILE_EMBEDDED 'MBED'
/** @} */
/** \defgroup U_PANOSE_bProportion_Qualifiers Proportion Enumeration
For U_PANOSE bProportion field
@{
*/
#define U_PAN_PROP_OLD_STYLE 2
#define U_PAN_PROP_MODERN 3
#define U_PAN_PROP_EVEN_WIDTH 4
#define U_PAN_PROP_EXPANDED 5
#define U_PAN_PROP_CONDENSED 6
#define U_PAN_PROP_VERY_EXPANDED 7
#define U_PAN_PROP_VERY_CONDENSED 8
#define U_PAN_PROP_MONOSPACED 9
/** @} */
/** \defgroup U_EMR_dwROP_Qualifiers Ternary Raster Operation enumeration
For U_EMR* dwROP fields.
These codes specify:
1. an order of operands (composed of various orders and combinations of: Dest, Src, Pen)
(There are 3, hence "Ternary Raster Operation")
2. an order of operators to apply to the operands (composed of Not, Xor, Or, And)
Only a few of the more common operations are provided here.
When the Operation does not use a Src operand the corresponding source bitmap may be
omitted from the record.
For more details see:
@{
*/
#define U_SRCCOPY 0xcc0020
#define U_SRCPAINT 0xee0086
#define U_SRCAND 0x8800c6
#define U_SRCINVERT 0x660046
#define U_SRCERASE 0x440328
#define U_NOTSRCCOPY 0x330008
#define U_NOTSRCERASE 0x1100a6
#define U_MERGECOPY 0xc000ca
#define U_MERGEPAINT 0xbb0226
#define U_PATCOPY 0xf00021
#define U_PATPAINT 0xfb0a09
#define U_PATINVERT 0x5a0049
#define U_DSTINVERT 0x550009
#define U_BLACKNESS 0x000042
#define U_WHITENESS 0xff0062
/** @} */
/** \defgroup U_EMRSETROP2_iMode_Qualifiers Binary Raster Operation Enumeration
For U_EMRSETROP2 iMode field
These codes specify:
1. an order of operands (composed of various orders and combinations of: Dest, Pen)
(There are 2, hence "Binary Raster Operation")
2. an order of operators to apply to the operands (composed of Not, Xor, Or, And)
Only a few of the more common operations are provided here.
The default is U_R2_COPYPEN. If this value is changed to something else all subsequenty
draw operations will use the altered logic. For instance, if it is set to U_R2_BLACK and
a red rectangle is drawn it will appear as a black rectangle.
@{
*/
#define U_R2_BLACK 1
#define U_R2_NOTMERGEPEN 2
#define U_R2_MASKNOTPEN 3
#define U_R2_NOTCOPYPEN 4
#define U_R2_MASKPENNOT 5
#define U_R2_NOT 6
#define U_R2_XORPEN 7
#define U_R2_NOTMASKPEN 8
#define U_R2_MASKPEN 9
#define U_R2_NOTXORPEN 10
#define U_R2_NOP 11
#define U_R2_MERGENOTPEN 12
#define U_R2_COPYPEN 13
#define U_R2_MERGEPENNOT 14
#define U_R2_MERGEPEN 15
#define U_R2_WHITE 16
#define U_R2_LAST 16
/** @} */
/** \defgroup U_EMRSELECTCLIP_iMode_Qualifiers RegionMode Enumeration
For U_EMRSELECTCLIPPATH and U_EMREXTSELECTCLIPRGN iMode field
@{
*/
#define U_RGN_AND 1
#define U_RGN_OR 2
#define U_RGN_XOR 3
#define U_RGN_DIFF 4
#define U_RGN_COPY 5
#define U_RGN_MAX U_RGN_COPY
/** @} */
/** \defgroup U_PANOSE_bSerifStyle_Qualifiers SerifType Enumeration
For U_PANOSE bSerifStyle field
@{
*/
#define U_PAN_SERIF_COVE 2
#define U_PAN_SERIF_OBTUSE_COVE 3
#define U_PAN_SERIF_SQUARE_COVE 4
#define U_PAN_SERIF_OBTUSE_SQUARE_COVE 5
#define U_PAN_SERIF_SQUARE 6
#define U_PAN_SERIF_THIN 7
#define U_PAN_SERIF_BONE 8
#define U_PAN_SERIF_EXAGGERATED 9
#define U_PAN_SERIF_TRIANGLE 10
#define U_PAN_SERIF_NORMAL_SANS 11
#define U_PAN_SERIF_OBTUSE_SANS 12
#define U_PAN_SERIF_PERP_SANS 13
#define U_PAN_SERIF_FLARED 14
#define U_PAN_SERIF_ROUNDED 15
/** @} */
/** \defgroup U_EMRSELECTOBJECT_ihObject_Qualifiers StockObject Enumeration
For U_EMRSELECTOBJECT ihObject field.
@{
*/
#define U_STOCK_OBJECT 0x80000000
#define U_WHITE_BRUSH 0x80000000
#define U_LTGRAY_BRUSH 0x80000001
#define U_GRAY_BRUSH 0x80000002
#define U_DKGRAY_BRUSH 0x80000003
#define U_BLACK_BRUSH 0x80000004
#define U_NULL_BRUSH 0x80000005
#define U_HOLLOW_BRUSH 0x80000005
#define U_WHITE_PEN 0x80000006
#define U_BLACK_PEN 0x80000007
#define U_NULL_PEN 0x80000008
#define U_OEM_FIXED_FONT 0x8000000A
#define U_ANSI_FIXED_FONT 0x8000000B
#define U_ANSI_VAR_FONT 0x8000000C
#define U_SYSTEM_FONT 0x8000000D
#define U_DEVICE_DEFAULT_FONT 0x8000000E
#define U_DEFAULT_PALETTE 0x8000000F
#define U_SYSTEM_FIXED_FONT 0x80000010
#define U_DEFAULT_GUI_FONT 0x80000011
#define U_STOCK_LAST 0x80000011
/** @} */
/** \defgroup U_EMRSETSTRETCHBLTMODE_iMode_Qualifiers StretchMode Enumeration
For EMF U_EMRSETSTRETCHBLTMODE iMode field
@{
*/
#define U_BLACKONWHITE 1
#define U_WHITEONBLACK 2
#define U_COLORONCOLOR 3
#define U_HALFTONE 4
#define U_MAXSTRETCHBLTMODE 4
#define U_STRETCH_ANDSCANS 1
#define U_STRETCH_ORSCANS 2
#define U_STRETCH_DELETESCANS 3
#define U_STRETCH_HALFTONE 4
/** @} */
/** \defgroup U_PANOSE_bStrokeVariation_Qualifiers StrokeVariation Enumeration
For U_PANOSE bStrokeVariation field
@{
*/
#define U_PAN_STROKE_GRADUAL_DIAG 2
#define U_PAN_STROKE_GRADUAL_TRAN 3
#define U_PAN_STROKE_GRADUAL_VERT 4
#define U_PAN_STROKE_GRADUAL_HORZ 5
#define U_PAN_STROKE_RAPID_VERT 6
#define U_PAN_STROKE_RAPID_HORZ 7
#define U_PAN_STROKE_INSTANT_VERT 8
/** @} */
/** \defgroup U_EMRSETTEXTALIGN_iMode_Qualifiers TextAlignment Enumeration
For U_EMRSETTEXTALIGN iMode field
Recall that EMF coordinates have UL closest to {0,0}, LR is below and to the right of UL and so has LARGER
{x,y} coordinates. In the following "TOP" is on the horizontal line defined by LR, as it has larger y coordinates,
which when viewing the EMF file, would actually be on the BOTTOM of the bounding rectangle. Similarly, left and right
are reversed.
Microsoft documentation (WMF manual, section 2.1.2.3) says that the text starts on certain edges of the bounding rectangle.
That is apparently not true, whether the bounding rectangle is {0,0,-1,-1}, which is effectively no bounding rectangle,
or if a valid bounding rectangle is specified. In all cases the text (in Windows XP Preview) starts, has center at, or ends
at the center point. Vertical offsets seem to be defined analogously, but with respect to the height of the font. The bounding
rectangle defined for the U_EMRTEXT record appears to be ignored.
Microsoft documentation (EMF manual,section 2.2.5) says that the same rectangle is used for "clipping or opaquing" by ExtTextOutA/W.
That does not seem to occur either.
@{
*/
// Horizontal text flags
#define U_TA_BASEBIT 0x10 // Reference point is on baseline of text if this bit is set, for 0x10 <-> 0x18
// Vertical text flags
#define U_VTA_LEFT U_TA_BOTTOM
#define U_VTA_RIGHT U_TA_TOP
#define U_VTA_CENTER U_TA_CENTER
#define U_VTA_BOTTOM U_TA_RIGHT
/** @} */
/** \defgroup U_PANOSE_bWeight_Qualifiers Weight Enumeration
For U_PANOSE bWeight field
@{
*/
#define U_PAN_WEIGHT_VERY_LIGHT 2
#define U_PAN_WEIGHT_LIGHT 3
#define U_PAN_WEIGHT_THIN 4
#define U_PAN_WEIGHT_BOOK 5
#define U_PAN_WEIGHT_MEDIUM 6
#define U_PAN_WEIGHT_DEMI 7
#define U_PAN_WEIGHT_BOLD 8
#define U_PAN_WEIGHT_HEAVY 9
#define U_PAN_WEIGHT_BLACK 10
#define U_PAN_WEIGHT_NORD 11
/** @} */
/** \defgroup U_PANOSE_bXHeight_Qualifiers XHeight Enumeration
For U_PANOSE bXHeight field
@{
*/
#define U_PAN_XHEIGHT_CONSTANT_SMALL 2
#define U_PAN_XHEIGHT_CONSTANT_STANDARD 3
#define U_PAN_XHEIGHT_CONSTANT_LARGE 4
#define U_PAN_XHEIGHT_DUCKING_SMALL 5
#define U_PAN_XHEIGHT_DUCKING_STANDARD 6
#define U_PAN_XHEIGHT_DUCKING_LARGE 7
/** @} */
/** \defgroup U_BLEND_Op_Qualifiers Blend Enumeration
For U_BLEND Op field
@{
*/
#define U_AC_SRC_GLOBAL 0
#define U_AC_SRC_CONST 0
#define U_AC_SRC_ALPHA 1
/** @} */
// ***************************************************************************
/** \defgroup Miscellaneous_values Miscellaneous Values
@{
*/
#define U_NONE 0 //!< Generic for nothing selected for all flag fields
#define U_READ 1
#define U_WRITE 0
#define U_COLOR_ADJ_MIN ((int16_t)-100) //!< For U_COLORADJUSTMENT ca[Contrast|Brightness|Colorfulness|RedGreenTint] fields
#define U_COLOR_ADJ_MAX (int16_t) 100 //!< For U_COLORADJUSTMENT ca[Contrast|Brightness|Colorfulness|RedGreenTint] fields
#define U_REC_KEEP 0 //!< used with emf_append
/** @} */
// ***************************************************************************
// Macros
/** \defgroup Common_macros Common Macros
@{
*/
// These are used in EMF structures and the byte order must be the same in memory or on disk.
//!< Get RGB from Palette by index.
// These are used in EMF structures and the byte order must be the same in memory or on disk.
// These MAY be used in PNG and other libraries if these enforce byte order in memory,otherwise
// U_swap4 may need to also be employed.
// color type conversions
#define U_RGB2BGR(rgb) (U_RGBQUAD){ U_RGBAGetB(rgb),U_RGBAGetG(rgb),U_RGBAGetR(rgb),0} //!< Set any BGR color from an RGB color
#define U_BGR2RGB(rgb) (U_COLORREF){U_BGRAGetR(rgb),U_BGRAGetG(rgb),U_BGRAGetB(rgb),0} //!< Set any RGB color from an BGR color
#define U_RGBA2BGRA(rgb) (U_RGBQUAD){ U_RGBAGetB(rgb),U_RGBAGetG(rgb),U_RGBAGetR(rgb),U_RGBAGetA(rgb)} //!< Set any BGRA color from an RGBA color
#define U_BGRA2RGBA(rgb) (U_COLORREF){U_BGRAGetR(rgb),U_BGRAGetG(rgb),U_BGRAGetB(rgb),U_BGRAGetA(rgb)} //!< Set any RGBA color from an BGRA color
#define U_CMYK(c,m,y,k)\
((COLOREF)((((uint8_t)(k)|((uint16_t)((uint8_t)(y))<<8))|(((uint32_t)(uint8_t)(m))<<16))|(((uint32_t)(uint8_t)(c))<<24))) \
//!< Color CMYK Set Macro.
// Other macros
#define U_Gamma(A) (A < U_RGB_GAMMA_MIN ? U_RGB_GAMMA_MIN : (A > U_RGB_GAMMA_MAX ? U_RGB_GAMMA_MAX: A)) \
//!< Gamma set Macro (enforce range).
#define U_PM(A,B) ((A)<-(B)?-(B):((A)>(B)?(B):(A))) //!< Plus/Minus Range Macro (B must be postitive!).
#define U_MIN(A,B) ((A)>(B)?(B):(A)) //!< Minimum of A,B
#define U_MAX(A,B) ((A)>(B)?(A):(B)) //!< Maximum of A,B
// basic EMR macros.
// Utility macro
/** @} */
typedef float U_FLOAT;
typedef uint32_t U_CBBITSMSK;
typedef uint32_t U_CBBITSSRC;
typedef uint32_t U_CBBMIMSK;
typedef uint32_t U_CBBMISRC;
typedef uint32_t U_CBPLENTRIES;
typedef uint32_t U_CBPXLFMT;
typedef uint32_t U_CBRGNDATA;
typedef uint32_t U_OFFBITS; // Describes byte offset to TYPE, always measured from the start of the RECORD (not the struct)
typedef uint32_t U_OFFBITSMSK;
typedef uint32_t U_OFFBITSSRC;
typedef uint32_t U_OFFBMIMSK;
typedef uint32_t U_OFFBMISRC;
typedef uint32_t U_OFFPLENTRIES;
typedef uint32_t U_OFFPXLFMT;
// "Types" For array components in structures, where not otherwise defined as a structure
// "Counts" for array components in structures
/**
\brief Pair of values indicating x and y sizes.
Microsoft name: SIZE Object
Microsoft name: SIZEL Object
*/
typedef struct {
/**
\brief Used for any generic pair of floats
Microsoft name: (none)
*/
typedef struct {
float x; //!< X value
float y; //!< Y value
/**
\brief Used for any generic pair of uint32_t
Microsoft name: POINT Object
*/
typedef struct {
int32_t x; //!< X value
int32_t y; //!< Y value
/**
\brief Point type for 16 bit EMR drawing functions.
Microsoft name: POINTS Object
Microsoft name: POINTS16 Object
*/
typedef struct {
int16_t x; //!< X size (16 bit)
int16_t y; //!< Y size (16 bit)
} U_POINT16, *PU_POINT16;
/**
\brief 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.
Microsoft name: RECT Object
*/
typedef struct {
/* ************************************************************
EMF structures OTHER than those corresponding to complete U_EMR_* records
************************************************************ */
/**
\brief For U_BITMAPINFO bmiColors field
NOTE that the color order is BGR, even though the name is RGB!
Microsoft name: RGBQUAD Object
*/
typedef struct {
} U_RGBQUAD, *PU_RGBQUAD;
/**
\brief For U_BITMAPINFO crColor field
NOTE that the color order is RGB reserved, flipped around from the preceding.
Microsoft name: COLORREF Object
*/
typedef struct {
} U_COLORREF, *PU_COLORREF;
/**
\brief For U_POINT28_4 x and y fields.
Microsoft name: BitFIX28_4 Object.
*/
typedef struct {
/**
\brief For U_LCS_GAMMARGB lcsGamma* fields
Microsoft name:(unknown) Object
*/
typedef struct {
} U_LCS_GAMMA, *PU_LCS_GAMMA;
/**
\brief For U_LOGCOLORSPACEA and U_LOGCOLORSPACEW lcsGammaRGB field
Microsoft name:(unknown) Object
*/
typedef struct {
/**
\brief For U_EMRSETOLORADJUSTMENT ColorAdjustment field
Note, range constants are: RGB_GAMMA_[MIN|MAX],REFERENCE_[WHITE|BLACK]_[MIN|MAX],COLOR_ADJ_[MIN|MAX]
Microsoft name: ColorAdjustment Object
*/
typedef struct {
/**
\brief For ? (not implemented yet)
Microsoft name: DesignVector Object
*/
typedef struct {
/**
\brief For U_EMR_COMMENT_MULTIFORMATS record, where an array of these is used
Microsoft name: EmrFormat Object
*/
typedef struct {
} U_EMRFORMAT, *PU_EMRFORMAT;
/**
\brief For U_EMR[POLY]EXTTEXTOUT[A|W] emrtext field
Differs from implementation in Mingw and Wine in that the core struct has a fixed size.
Optional and movable components must be handled with offsets.
Microsoft name: EmrText Object
U_OFFDX offDx; (required) but position isn't static. Offset in bytes to the character spacing array measured
from the start of the RECORD, NOT from the start of this structure.
The order of the next two may be reversed, they are found from their offsets.
char string (required) String buffer holding nChars (padded to a multiple of 4 bytes in length).
uint32_t Dx[1] (required) character spacing, array with one entry per glyph.
*/
typedef struct {
} U_EMRTEXT, *PU_EMRTEXT;
/**
\brief For U_EPS_DATA Points field
Microsoft name: Point28_4 Object
*/
typedef struct {
U_BITFIX28_4 x; //!< X coordinate
U_BITFIX28_4 y; //!< Y coordinate
} U_POINT28_4, *PU_POINT28_4;
/**
\brief For embedding EPS in EMF via U_EMRFORMAT offData array in U_EMR_COMMENT_MULTIFORMATS
Microsoft name: EpsData Object
*/
typedef struct {
} U_EPS_DATA, *PU_EPS_DATA;
/**
\brief For GRADIENT_[TRIANGLE|U_RECT]
Microsoft name: TriVertex Object
*/
typedef struct {
int32_t x; //!< X coord
int32_t y; //!< Y coord
} U_TRIVERTEX, *PU_TRIVERTEX;
/**
\brief For U_EMRGRADIENTFILL GradObj field
Gradient object notes. The next two structures are used to define the shape with reference to an existing array
of points stored in an array of TriVertex objects in the U_EMRGRADIENTFILL record. The tricky part
is that these two structures are different sizes. In some implementations (MingW) the array is cast to uint32_t
and basically the cast is then ignored. For libUEMF we leave this out of the structure entirely and get to it with offsets.
Microsoft name: GradientTriangle Object
*/
typedef struct {
} U_GRADIENT3, *PU_GRADIENT3;
/**
\brief For U_EMRGRADIENTFILL GradObj field
Microsoft name: GradientRectangle Object
*/
typedef struct {
} U_GRADIENT4, *PU_GRADIENT4;
/**
\brief For U_EMRCREATEBRUSHINDIRECT lb field
Microsoft name: LogBrushEx Object
*/
typedef struct { //!< In MS documentation this is LogBrushEx Object
} U_LOGBRUSH, *PU_LOGBRUSH;
/**
\brief For U_LOGFONT_PANOSE elfLogFont field
Microsoft name: LogFont Object
*/
typedef struct {
uint16_t lfFaceName[U_LF_FACESIZE]; //!< Name of font. If <U_LF_FACESIZE chars must be null terminated
} U_LOGFONT, *PU_LOGFONT;
/**
\brief For U_LOGFONT_PANOSE elfPanose field
Microsoft name: Panose Object
*/
typedef struct {
#define U_PAN_ALL0 (U_PANOSE){0,0,0,0,0,0,0,0,0,0} // all U_PAN_ANY, have not seen this in an EMF file
#define U_PAN_ALL1 (U_PANOSE){1,1,1,1,1,1,1,1,1,1} // all U_PAN_NO_FIT, this is what createfont() would have made
// Microsoft name: LogFontEx Object (not implemented)
// Microsoft name: LogFontExDv Object (not implemented)
/**
\brief For U_EMREXTCREATEFONTINDIRECTW elfw field
Microsoft name: LogFont_Panose Object
*/
typedef struct {
uint16_t elfStyle[U_LF_FACESIZE]; //!< Font style (if <U_LF_FACESIZE characters, null terminate string)
/**
\brief For U_LOGPALETTE palPalEntry field(s)
Microsoft name: LogPaletteEntry Object
*/
typedef struct {
/**
\brief For U_EMRCREATEPALETTE lgpl field
Microsoft name: LogPalette Object
*/
typedef struct {
/**
\brief For U_EMRCREATEPEN lopn field
Microsoft name: LogPen Object
*/
typedef struct {
// Microsoft name: LogPenEx Object (not implemented)
/**
\brief For U_EMRPIXELFORMAT pfd field
Microsoft name: PixelFormatDescriptor Object
*/
typedef struct {
/**
\brief For U_RGNDATA rdb field
Microsoft name: RegionDataHeader Object (RGNDATAHEADER)
*/
typedef struct {
/**
\brief For U_EMRFILLRGN RgnData field(s)
Microsoft name: RegionData Object
*/
typedef struct {
} U_RGNDATA,*PU_RGNDATA;
// Microsoft name: UniversalFontId Object (not implemented)
/**
\brief For U_EMR[FILLRGN|STRETCHBLT|MASKBLT|PLGBLT] xformSrc field
Microsoft name: Xform Object
*/
typedef struct {
/**
\brief For U_CIEXYZTRIPLE (all) fields
Microsoft name: CIEXYZ Object
*/
typedef struct {
/**
\brief For U_LOGCOLORSPACEA and U_LOGCOLORSPACEW lcsEndpints field
defines a CIE colorspace
Microsoft name: CIEXYZTRIPLE Object
*/
typedef struct {
/**
\brief For U_EMRCREATECOLORSPACE lcs field
Microsoft name: LOGCOLORSPACEA Object
*/
typedef struct {
/**
\brief For U_EMRCREATECOLORSPACEW lcs field
Microsoft name: LOGCOLORSPACEW Object
*/
typedef struct {
uint16_t lcsFilename[U_MAX_PATH]; //!< Could name an external color profile file, otherwise empty string
/**
\brief For U_EMREXTCREATEPEN lopn field
Microsoft name: EXTLOGPEN Object
*/
typedef struct {
} U_EXTLOGPEN, *PU_EXTLOGPEN;
/**
\brief For U_BITMAPINFO bmiHeader field
Microsoft name: BITMAPINFOHEADER Object
*/
typedef struct {
//!< 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
U_NUM_RGBQUAD biClrUsed; //!< Number of bmciColors in U_BITMAPINFO/U_BITMAPCOREINFO that are used by the bitmap
#if 0
// Do EMF files ever use any of these???
// Microsoft name: BITMAPV4HEADER Object
typedef struct {
// Microsoft name: BITMAPV5HEADER Object
typedef struct {
// Microsoft name: BITMAPCOREHEADER Object
typedef struct {
// Microsoft name: BITMAPCOREINFO Object
// Description of a simple Device Independent Bitmap (DIB) - no compression or color maps
typedef struct {
// Microsoft name: RGBTRIPLE Object
// NOTE that the color order is BGR, even though the name is RGB!
typedef struct {
#endif // elements possibly never used by an EMF file
/**
\brief For U_EMR_* OffBmi* fields
Description of a Bitmap which in some cases is a Device Independent Bitmap (DIB)
Microsoft name: BITMAPINFO Object
*/
typedef struct {
/**
\brief U_EMRALPHABLEND Blend field
*/
typedef struct {
#
/**
General form of an EMF record.
Microsoft name: ENHMETARECORD Object
For generic cast of other U_EMR_* records
*/
typedef struct {
/** First two fields of all EMF records
For accessing iType and nSize files in all U_EMR* records
Microsoft name: EMR Object
*/
typedef struct {
typedef struct {
// ***********************************************************************************
// The following have U_EMR_# records
/* Index 1 */
/**
\brief The firstU_ENHMETARECORD record in the metafile.
Microsoft names instead: Header, HeaderExtension1, and HeaderExtension2 objects. These are
used nowhere else, so they are combined here, along with the first two fields which were not listed in the Header.
Note also that three fields in this file (nBytes, nRecords, nHandles) must be (re)set after the entire EMF
is constructed, since typically they are not known until then. bOpenGL may or may not be knowable when this
header is written.
Note also that rclBounds and rclFrame are supposed to be the region bounding the drawn content within the
EMF. This is generally smaller than the size from szlDevice. However, since libUEMF does not actually draw
anything it has no way of knowing what these values are. Instead when it creates a header it sets these to
match the szl* fields.
*/
typedef struct {
/** Fields for winver >= win95 */
U_OFFPXLFMT offPixelFormat; //!< Offset in bytes to PixelFormatDescriptor from the start of the RECORD, 0 if no PFD
/** Fields for winver >= win98 */
//!< Record may include optional Description, UTF-16BE string
//!< Record may include optional PxlFmtDescriptor, U_PIXELFORMATDESCRIPTOR
} U_EMRHEADER, *PU_EMRHEADER;
/* Index 2,3,4,5,6*/
typedef struct {
/* Index 7,8 */
typedef struct {
// This will appear somewhere but is not really part of the core structure.
// U_POINTL aptl[1]; //!< array of points
/* Index 9,11 (numbers interleave with next one) */
typedef struct {
/* Index 10,12,13 */
typedef struct {
/* Index 14
*/
/**
This is a very odd structure because the nSizeLast follows an optional variable size field. Consequently
even though nSizeLast has a name it cannot actually be accessed by it! Following the core appear these fields:
U_LOGPLTNTRY PalEntries[1]; Record may include optional array of PalEntries
uint32_t nSizeLast; Mandatory, but position isn't fixed. Must have same value as emr.nSize in header record
*/
typedef struct {
/* Index 15 */
typedef struct {
/* Index 16 */
typedef struct {
/* Index 17,18,19,20,21,22,67,98,115 */
typedef struct {
/* Index 23 */
typedef struct {
/* Index 24, 25 */
typedef struct {
/* Index 26 */
typedef struct {
/* Index 27, 54 */
typedef struct {
/* Index 28,33,52,59,60,61,65,66,68 */
typedef struct {
}
/* Index 29,30 */
typedef struct {
/* Index 31,32 */
typedef struct {
/* Index 33 (see 28) */
/* Index 34 */
typedef struct {
/* Index 35 */
typedef struct {
/* Index 36 */
typedef struct {
/* Index 37,40 */
typedef struct {
/* Index 38 */
typedef struct {
/* Index 39 */
typedef struct {
/* Index 40 see 37 */
/* Index 41 */
typedef struct {
/* Index 42,43 */
typedef struct {
/* Index 44 */
typedef struct {
/* Index 45, 46 ,47, 55 */
typedef struct {
/* Index 48 */
typedef struct {
/* Index 49 */
typedef struct {
/* Index 50 */
typedef struct {
/* Index 51 */
typedef struct {
/* Index 52 (see 28) */
/* Index 53 */
typedef struct {
/* Index 54 (see 27) */
/* Index 55 (see 45) */
/* Index 56 */
typedef struct {
/* Index 57 */
typedef struct {
/* Index 58
IMPORTANT!!!! The Microsoft structure uses a float for the miterlimit but the EMF file record
uses an unsigned int. The latter form is used in this structure.
*/
typedef struct {
/* Index 59,60,61 (see 28) */
/* Index 62,63,64 */
typedef struct {
/* Index 65,66 (see 28) */
/* Index 67 (see 17) */
/* Index 68 (see 28) */
/* Index 69 (not a defined U_EMR record type ) */
/* Index 70 */
typedef struct {
/* variant comment types */
typedef struct {
typedef struct {
typedef struct {
/* Index 71 */
typedef struct {
/* Index 72 */
typedef struct {
/* Index 73,74 */
typedef struct {
/* Index 75 */
typedef struct {
/* Index 76 */
typedef struct {
//!< Record may include optional bitmapbuffer
} U_EMRBITBLT, *PU_EMRBITBLT;
/* Index 77 */
typedef struct {
//!< Record may include optional bitmapbuffer
/* Index 78 */
typedef struct {
//!< Record may include optional Source and mask bitmapbuffers
/* Index 79 */
typedef struct {
//!< Record may include optional Source and mask bitmapbuffers
} U_EMRPLGBLT, *PU_EMRPLGBLT;
/* Index 80 */
typedef struct {
//!< Record may includes optional bitmapbuffer
/* Index 81 */
typedef struct {
//!< Record may includes optional bitmapbuffer
/* Index 82 */
typedef struct {
U_LOGFONT_PANOSE elfw; //!< Font parameters, either U_LOGFONT or U_LOGFONT_PANOSE, the latter is bigger so use that type here
/* Index 83,84 */
/**
Variable and optional fields may follow core structure in record:
U_OFFDX offDx; (required) Offset in bytes to the character spacing array from the start of the RECORD
uint32_t Dx (optional) character spacing array (Required, but position is not static.)
*/
typedef struct {
// U_OFFDX offDx; (required) but position isn't static. Offset in bytes to the character spacing array from the start of the RECORD
// Record may include optional Dx, character spacing, array of uint32_t
/* Index 85,86,87,88,89 */
typedef struct {
/* Index 90,91 */
typedef struct {
// This will appear somewhere but is not really part of the core structure.
// U_POINT16 apts[1]; //!< array of point16
/* Index 92 */
typedef struct {
/* Index 93 */
typedef struct {
//!< Record may include optional DIB bitmapbuffer
/* Index 94 */
typedef struct {
//!< Record may include optional DIB bitmapbuffer
/* Index 95 */
typedef struct {
//!< Record may include optional DIB bitmap
/* Index 96.97 */
typedef struct {
/* Index 98 (see 17) */
/* Index 99 */
typedef struct {
/* Index 100,101 */
typedef struct {
/* Index 102 */
typedef struct {
/* Index 103 */
typedef struct {
/* Index 104 */
typedef struct {
/* Index 105 */
typedef struct {
/* Index 106 */
typedef struct {
/* Index 107 (not implemented ) */
/* Index 108 */
typedef struct {
//!< the tail end of this record is variable.
//!< U_RECTL rclBounds; Record may include optional Bounding rectangle (absent when: fuOPtions & ETO_NO_U_RECT)
//!< uint32_t TextString; text to output (fuOptions & ETO_SMALL_CHARS ? 8 bit : 16 bit)
/* Index 109 (not implemented ) */
/* Index 110 */
typedef struct {
/* Index 111-113 (not implemented ) */
/* Index 114 */
typedef struct {
//!< Record may include optional DIB bitmap
/* Index 115 (see 17) */
/* Index 116 */
typedef struct {
//!< Record may includes optional bitmapbuffer
/* Index 117 (not a defined U_EMR record type ) */
/* Index 118 */
typedef struct {
//parts that are required but which are not included in the core structure
// U_TRIVERTEX TriVert[1]; Array of TriVertex objects
// uint32_t GradObj[1]; Array of gradient objects (each has 2 or 3 indices into TriVert array)
/* Index 119,120 (not implemented ) */
/* Index 121 */
typedef struct {
/* Index 122 */
typedef struct {
// ************************************************************************************************
// Utility function structures
typedef struct {
char *buf; //!< Buffer for constructing the EMF in memory
} EMFTRACK;
/**
The various create functions need a place to put their handles, which here are stored in the table below.
We don't actually do anything much with these handles, that is up to whatever program finally plays back the EMF, but
we do need to keep track of the numbers so that they are not accidentally reused. This structure is used for that,
and all *_set functions that touch a handle reference it.
Stock objects are not used in this limited model, so libUEMF cannot detect if a handle is still in use. Nor can it
tell when a handle has been deselected, but selecting another handle for the same type of graphic object, and thus
made deleteable. End user code must keep track of this for itself.
*/
typedef struct {
} EMFHANDLES;
/**
2 x 2 matrix, used by xform_alt_set() function.
*/
typedef struct {
double M11;
double M12;
double M21;
double M22;
// ************************************************************************************************
// Prototypes
void wchar8show(const char *src);
char *U_strdup(const char *s);
int emr_arc_points(PU_ENHMETARECORD record, int *f1, int f2, PU_PAIRF center, PU_PAIRF start, PU_PAIRF end, PU_PAIRF size);
int drawing_size(const int xmm, const int yum, const float dpmm, U_RECTL *rclBounds, U_RECTL *rclFrame);
#define point_set point32_set
#define pointl_set point32_set
U_XFORM xform_set(U_FLOAT eM11, U_FLOAT eM12, U_FLOAT eM21, U_FLOAT eM22, U_FLOAT eDx, U_FLOAT eDy);
U_XFORM xform_alt_set(U_FLOAT scale, U_FLOAT ratio, U_FLOAT rot, U_FLOAT axisrot, U_FLOAT eDx, U_FLOAT eDy);
U_COLORREF elpColor, int32_t elpHatch, U_NUM_STYLEENTRY elpNumEntries, U_STYLEENTRY *elpStyleEntry );
U_LOGFONT logfont_set( int32_t lfHeight, int32_t lfWidth, int32_t lfEscapement, int32_t lfOrientation,
char *emrtext_set(U_POINTL ptlReference, U_NUM_STR NumString, uint32_t cbChar, void *String, uint32_t fOptions, U_RECTL rcl, uint32_t *Dx);
U_PIXELFORMATDESCRIPTOR pixelformatdescriptor_set( uint32_t dwFlags, uint8_t iPixelType, uint8_t cColorBits,
char *textcomment_set(char *string);
// These generate the handle and then call the underlying function
char *extcreatefontindirectw_set(uint32_t *ihFont, EMFHANDLES *eht, const char *elf, const char *elfw);
char *setpaletteentries_set(uint32_t *ihPal, EMFHANDLES *eht, uint32_t iStart, U_NUM_LOGPLTNTRY cEntries, PU_LOGPLTNTRY aPalEntries);
char *framergn_set(uint32_t *ihBrush, EMFHANDLES *eht, U_RECTL rclBounds, U_SIZEL szlStroke, PU_RGNDATA RgnData);
char *createcolorspacew_set(uint32_t *ihCS, EMFHANDLES *eht, U_LOGCOLORSPACEW lcs, uint32_t dwFlags, U_CBDATA cbData, uint8_t *Data);
char *U_EMRHEADER_set( const U_RECTL rclBounds, const U_RECTL rclFrame, U_PIXELFORMATDESCRIPTOR* const pfmtDesc,
char *U_EMRPOLYPOLYLINE_set(const U_RECTL rclBounds, const uint32_t nPolys, const uint32_t *aPolyCounts,
char *U_EMRPOLYPOLYGON_set(const U_RECTL rclBounds, const uint32_t nPolys, const uint32_t *aPolyCounts,
char *U_EMRSETMAPPERFLAGS_set(void);
char *U_EMRSETMETARGN_set(void);
char *U_EMRSCALEVIEWPORTEXTEX_set(const int32_t xNum, const int32_t xDenom, const int32_t yNum, const int32_t yDenom);
char *U_EMRSCALEWINDOWEXTEX_set(const int32_t xNum, const int32_t xDenom, const int32_t yNum, const int32_t yDenom);
char *U_EMRSAVEDC_set(void);
char *U_EMRANGLEARC_set(const U_POINTL ptlCenter, const uint32_t nRadius, const U_FLOAT eStartAngle, const U_FLOAT eSweepAngle);
char *U_EMRSETPALETTEENTRIES_set(const uint32_t ihPal, const uint32_t iStart, const U_NUM_LOGPLTNTRY cEntries, const PU_LOGPLTNTRY aPalEntries);
char *U_EMRREALIZEPALETTE_set(void);
char *U_EMREXTFLOODFILL_set(const U_POINTL ptlStart, const U_COLORREF crColor, const uint32_t iMode);
char *U_EMRPOLYDRAW_set(const U_RECTL rclBounds,const U_NUM_POINTL cptl,const U_POINTL *aptl,const uint8_t *abTypes);
char *U_EMRBEGINPATH_set(void);
char *U_EMRENDPATH_set(void);
char *U_EMRCLOSEFIGURE_set(void);
char *U_EMRFLATTENPATH_set(void);
char *U_EMRWIDENPATH_set(void);
char *U_EMRABORTPATH_set(void);
// EMR_ENDEF69
char *U_EMRFRAMERGN_set(const U_RECTL rclBounds, const uint32_t ihBrush, const U_SIZEL szlStroke, const PU_RGNDATA RgnData);
const U_POINTL Src, const U_POINTL cSrc, const U_XFORM xformSrc, const U_COLORREF crBkColorSrc, const uint32_t iUsageSrc,
const U_POINTL Src, const U_XFORM xformSrc, const U_COLORREF crBkColorSrc, const uint32_t iUsageSrc,
const U_POINTL Src, const U_POINTL cSrc, const U_XFORM xformSrc, const U_COLORREF crBkColorSrc, const uint32_t iUsageSrc,
char *U_EMREXTTEXTOUTA_set(U_RECTL rclBounds, uint32_t iGraphicsMode, U_FLOAT exScale, U_FLOAT eyScale, PU_EMRTEXT emrtext);
char *U_EMREXTTEXTOUTW_set(U_RECTL rclBounds, uint32_t iGraphicsMode, U_FLOAT exScale, U_FLOAT eyScale, PU_EMRTEXT emrtext);
char *U_EMRPOLYBEZIERTO16_set(const U_RECTL rclBounds, const uint32_t cpts, const U_POINT16 *points);
char *U_EMRPOLYPOLYLINE16_set(const U_RECTL rclBounds, const uint32_t nPolys, const uint32_t *aPolyCounts,const uint32_t cpts, const U_POINT16 *points);
char *U_EMRPOLYPOLYGON16_set(const U_RECTL rclBounds, const uint32_t nPolys, const uint32_t *aPolyCounts,const uint32_t cpts, const U_POINT16 *points);
char *U_EMRPOLYDRAW16_set(const U_RECTL rclBounds,const U_NUM_POINT16 cpts, const U_POINT16 *aptl, const uint8_t *abTypes);
char *U_EMREXTCREATEPEN_set(const uint32_t ihPen, const PU_BITMAPINFO Bmi, const uint32_t cbPx, char *Px, const PU_EXTLOGPEN elp );
// U_EMRPOLYTEXTOUTA_set 96 NOT IMPLEMENTED, denigrated after Windows NT
// U_EMRPOLYTEXTOUTW_set 97 NOT IMPLEMENTED, denigrated after Windows NT
// U_EMRGLSRECORD_set 102 Not implemented
// U_EMRGLSBOUNDEDRECORD_set 103 Not implemented
char *U_EMRSMALLTEXTOUT_set(const U_POINTL Dest, const U_NUM_STR cChars, const uint32_t fuOptions, const uint32_t iGraphicsMode,
// U_EMRDRAWESCAPE_set 105 Not implemented
// U_EMREXTESCAPE_set 106 Not implemented
// U_EMRUNDEF107_set 107 Not implemented
// U_EMRSMALLTEXTOUT_set 108
// U_EMRFORCEUFIMAPPING_set 109 Not implemented
// U_EMRNAMEDESCAPE_set 110 Not implemented
// U_EMRCOLORCORRECTPALETTE_set 111 Not implemented
// U_EMRSETICMPROFILEA_set 112 Not implemented
// U_EMRSETICMPROFILEW_set 113 Not implemented
// U_EMRUNDEF117_set 117 Not implemented
char *U_EMRGRADIENTFILL_set(const U_RECTL rclBounds, const U_NUM_TRIVERTEX nTriVert, const U_NUM_GRADOBJ nGradObj,
// U_EMRSETLINKEDUFIS_set 119 Not implemented
// U_EMRSETTEXTJUSTIFICATION_set 120 Not implemented (denigrated)
// U_EMRCOLORMATCHTOTARGETW_set 121 Not implemented
char *U_EMRCREATECOLORSPACEW_set(const uint32_t ihCS, const U_LOGCOLORSPACEW lcs, const uint32_t dwFlags,
#ifdef __cplusplus
}
#endif
#endif /* _UEMF_ */