EMF::METAFILEDEVICECONTEXT(3)
π EMF::METAFILEDEVICECONTEXT π
okay bestie, welcome to the libemf man page for EMF::METAFILEDEVICECONTEXT β yes it's a mouthful, yes it's iconic, and yes it is literally the Graphics Device Context. This is the group chat recap you needed. π
β¨ NAME β¨
EMF::METAFILEDEVICECONTEXT β Graphics Device Context. that's it, that's the vibe. π
π¦ SYNOPSIS π¦
#include <libemf.h>
Inherits EMF::OBJECT. (yes she's got lineage, main character energy runs in the family π)
πΈ Public Member Functions πΈ
METAFILEDEVICECONTEXT (FILE *fp_, const RECT *size, LPCWSTR description_w)β the constructor, we'll get into her whole deal belowvirtual ~METAFILEDEVICECONTEXT ()β the destructor, she cleans up after the party π§ΉOBJECTTYPE getType (void) constβ tells you what type of object this isDWORD nextHandle (void)β hands you the next free handlevoid clearHandle (DWORD handle)β marks a handle as no longer in usevoid appendRecord (METARECORD *record)β shove a record into the metafilevoid appendHandle (METARECORD *record)β shove a record in and bump the handle countvoid deleteMetafile (void)β nukes all the recordsvoid mergePoint (const LONG &x, const LONG &y)β the long-and-lat version of mergePointvoid mergePoint (const POINT &p)β the POINT version, this one actually does the work
π Public Member Functions inherited from EMF::OBJECT π
virtual ~OBJECT ()β OBJECTs have a virtual destructor.OBJECT (void)β default constructor, no thoughts, head empty π
π Data Fields π
::FILE * fpDATASTREAM dsENHMETAHEADER * headerstd::vector< EMF::METARECORD * > recordsSIZEL resolutionβ The resolution in DPI of the reference DC.SIZEL viewport_extβ The extent of the viewport.POINT viewport_orgβ The origin of the viewport.SIZEL window_extβ The extent of the window.POINT window_orgβ The origin of the window.bool update_frameβ Update the frame automatically?POINT min_device_pointβ The lft/top-most painted point in device units.POINT max_device_pointβ The rgt/btm-most painted point in device units.POINT pointβ The current point.PEN * penβ The current pen.BRUSH * brushβ The current brush.FONT * fontβ The current font.PALETTE * paletteβ The current palette.UINT text_alignmentβ The current text alignment.COLORREF text_colorβ The current text foreground color.COLORREF bk_colorβ The current background color.INT bk_modeβ The current background mode.INT polyfill_modeβ The current polygon fill mode.INT map_modeβ The current mapping mode.FLOAT miter_limitβ The current miter length limit.std::vector< bool > handlesstd::map< HGDIOBJ, HGDIOBJ > emf_handles
π Data Fields inherited from EMF::OBJECT π
HGDIOBJ handle
π Detailed Description π
Graphics Device Context.
okay so, real talk: almost all GDI graphics calls need a device context β the only exceptions being the ones that literally create graphics objects, like pens and fonts. periodt.
This particular one is a specific context which renders to a metafile. And bestie, listen β there is a one-to-one correspondence between the device context and the metafile. they're matched. soulmates. you don't separate them. π
β¨ Constructor & Destructor Documentation β¨
π EMF::METAFILEDEVICECONTEXT::METAFILEDEVICECONTEXT (FILE * fp_, const RECT * size, LPCWSTR description_w) [inline] π
so the tea here is that most graphics programs seem to want to handle the opening and closing of files themselves, so this is an extension to the w32 interface. thoughtful of her honestly. π«Ά
Parameters
fp_β stdio pointer to an open file. May be null.sizeβ the rectangle describing the position and size of the metafile on the 'page'. May be null.description_wβ a UNICODE string describing the metafile. The format must be'some text\0some more text\0\0'. May be null.
β οΈ bestie, note that format string literally β 'some text\0some more text\0\0' β those null terminators are not a suggestion, they're the whole assignment. π
π§ virtual EMF::METAFILEDEVICECONTEXT::~METAFILEDEVICECONTEXT () [inline], [virtual] π§
Destructor frees all the graphics objects which may have been allocated. And now, it also frees any metarecords which it might hold, too. she's thorough, she doesn't leave a mess. πΈ
References deleteMetafile(), and records.
π Member Function Documentation π
π void EMF::METAFILEDEVICECONTEXT::appendHandle (METARECORD * record) [inline] π
Add this record to the metafile.
Parameters
recordβ this record is an object so it increments the handle count as well. two birds, one iconic move. β¨
References header, records, and EMF::METARECORD::size().
π void EMF::METAFILEDEVICECONTEXT::appendRecord (METARECORD * record) [inline] π
Add this record to the metafile.
Parameters
recordβ standard graphics record. no handle-count drama here, just the record itself.
References header, records, and EMF::METARECORD::size().
π void EMF::METAFILEDEVICECONTEXT::clearHandle (DWORD handle) [inline] π
Clear the usage of this handle. freeing her up for reuse, we love recycling π«Ά
References EMF::OBJECT::handle, and handles.
π void EMF::METAFILEDEVICECONTEXT::deleteMetafile (void) [inline] π
Delete all the records from the metafile. and ngl, this would seem to include deleting the header record as well. π gone. all of it.
References records.
Referenced by ~METAFILEDEVICECONTEXT().
π OBJECTTYPE EMF::METAFILEDEVICECONTEXT::getType (void) const [inline], [virtual] π
Return the type of this object (could probably do better with RTTI()). we're keeping it real, we're keeping it honest. π
Implements EMF::OBJECT.
π void EMF::METAFILEDEVICECONTEXT::mergePoint (const LONG & x, const LONG & y) [inline] π
Somewhat superfluous, except checker doesn't understand the initialization of automatic structures in the declaration. she's just here so the checker stops being weird about it. π
References mergePoint().
Referenced by mergePoint().
π void EMF::METAFILEDEVICECONTEXT::mergePoint (const POINT & p) [inline] π
Take the given point and determine if it enlarges the 'painted' area of the device. the real one. the one that does the math. π
References header, max_device_point, min_device_point, update_frame, viewport_ext, viewport_org, window_ext, and window_org.
π DWORD EMF::METAFILEDEVICECONTEXT::nextHandle (void) [inline] π
Scan the bit vector of used handles and return the index of the first free bit as this objects metafile handle. first free spot wins, no queue-jumping. π
References handles, header, and EMF::ENHMETAHEADER::size().
π Field Documentation π
π DATASTREAM EMF::METAFILEDEVICECONTEXT::ds π
All i/o to the metafile is wrapped by this class so that byte swapping on big-endian machines is transparent. she's bilingual, she just doesn't make it your problem. π
π std::map< HGDIOBJ, HGDIOBJ > EMF::METAFILEDEVICECONTEXT::emf_handles π
This map holds the current mapping between EMF handles and global object handles as a metafile is played back (with PlayEnhMetaFile). it's the contact list, fr fr. π
Referenced by EMF::EMRSELECTOBJECT::execute(), EMF::EMRDELETEOBJECT::execute(), EMF::EMRCREATEPEN::execute(), EMF::EMREXTCREATEPEN::execute(), EMF::EMRCREATEBRUSHINDIRECT::execute(), and EMF::EMREXTCREATEFONTINDIRECTW::execute().
π ::FILE* EMF::METAFILEDEVICECONTEXT::fp π
If it is a file-based metafile, then this pointer is not null. that's the whole test. if it's pointing, it's file-based. π―
π std::vector< bool > EMF::METAFILEDEVICECONTEXT::handles π
For compatibility, it appears that metafile handles are reused as objects are deleted. Attempt to emulate that behavior with a bit vector of used metafile handles. cosplay, but make it faithful. π
Referenced by clearHandle(), and nextHandle().
π ENHMETAHEADER* EMF::METAFILEDEVICECONTEXT::header π
Serves double duty as the physical device description. two jobs, one pointer, she's booked and busy. π
Referenced by appendHandle(), appendRecord(), mergePoint(), and nextHandle().
π std::vector< EMF::METARECORD* > EMF::METAFILEDEVICECONTEXT::records π
All of the metafile records are stored in memory. every single one. in memory. π§ β¨
Referenced by appendHandle(), appendRecord(), deleteMetafile(), and ~METAFILEDEVICECONTEXT().
π Author π
Generated automatically by Doxygen for libemf from the source code. not a human, just a very diligent little robot. be nice to her. π€π
and that's the whole page bestie!! π¦β¨ you made it to the end, that's Version 1.0.9, dated Thu Jun 6 2024 23:01:0 β go forth and render to metafiles, you absolute icon. π
ππ
π¦ where this page comes from
- debian trixie: libemf-doc 1.0.13-8 Β· GPL-2.0-only
- ubuntu questing: libemf-doc 1.0.13-8
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms