4 The GDIMetaFile class reads, writes, manipulates and replays metafiles via the VCL module.
6 A typical use case is to initialize a new GDIMetaFile, open the actual stored metafile and
7 read it in via GDIMetaFile::Read( aIStream ). This reads in the metafile into the GDIMetafile
8 object - it can read in an old-style VCLMTF metafile (back in the days that Microsoft didn't
9 document the metafile format this was used), as well as EMF+ files - and adds them to a list
10 (vector) of MetaActions. You can also populate your own GDIMetaFile via AddAction(),
11 RemoveAction(), ReplaceAction(), etc.
13 Once the GDIMetafile object is read to be used, you can "play" the metafile, pause it, wind
14 forward or rewind the metafile. The metafile can be moved, scaled, rotated and clipped, as
15 well have the colours adjusted or replaced, or even made monochrome.
17 The GDIMetafile can be used to get an OutputDevice's metafile via the Linker() and Record()
24 First, create a new GDIMetafile, this can be done via the default constructor. It can then
25 be constructed manually, or you can use Record() on an OutputDevice to populate the
26 GDIMetaFile, or of course you can read it from file with Read(). From here you can then
27 elect to manipulate the metafile, or play it back to another GDIMetafile or to an
28 OutputDevice via Play(). To store the file, use Write().
30 CONSTRUCTORS AND DESTRUCTORS
33 - GDIMetaFile( cosnt GDIMetaFile& rMtf ) - copy constructor
44 RECORDING AND PLAYBACK FUNCTIONS
46 - Play(GDIMetaFile&, size_t) - play back metafile into another metafile up
48 - Play(OutputDevice*, size_t) - play back metafile into OutputDevice up to
50 - Play(OutputDevice*, Point, Size, size_t) - play back metafile into OutputDevice at a
51 particular location on the OutputDevice, up
52 to the position in the metafile
53 - Pause - pauses or continues the playback
55 - Stop - stop playback fully
56 - WindStart - windback to start of the metafile
57 - windPrev - windback one record
58 - GetActionSize - get the number of records in the metafile
61 METAFILE RECORD FUNCTIONS
63 - FirstAction - get the first metafile record
64 - NextAction - get the next metafile record from the
66 - GetAction(size_t) - get the metafile record at location in file
67 - GetCurAction - get the current metafile record
68 - AddAction(MetaAction*) - appends a metafile record
69 - AddAction(MetaAction*, size_t) - adds a metafile record to a particular
71 - RemoveAction - removes record at file location
72 - Clear - first stops if recording, then removes all
74 - push_back - pushes back, basically a thin wrapper to the
86 DISPLACEMENT FUNCTIONS
88 - Move( long nX, long nX)
89 - Move( long nX, long nX, long nDPIX, long nDPIY ) - Move method getting specifics how to
90 handle MapMode( MapUnit::MapPixel )
93 TRANSFORMATION FUNCTIONS
95 - Scale( double fScaleX, double fScaleY )
96 - Scale( const Fraction& rScaleX, const Fraction& rScaleY )
98 - Rotate( long nAngle10 )
99 - Clip( const Rectangle& )
102 COLOR ADJUSTMENT FUNCTIONS
104 - Adjust - change luminance, contrast, gamma and RGB via a
106 - Convert - colour conversion
114 MetaAction: a base class used by all records. It implements a command-like pattern, and also
115 acts as a prototype for other actions.
118 CONSTRUCTORS AND DESTRUCTORS
120 - MetaAction() - default constructor, sets mnRefCount to 1 and
121 mnType, in this case MetaActionType::NONE
122 - MetaAction(sal_uInt16 nType) - virtual constructor, sets mnType to nType, and
129 - Execute(OutputDevice*) - execute the functionality of the record to the
130 OutputDevice. Part of command pattern.
135 - Clone() - prototype clone function
138 MANIPULATION FUNCTIONS
140 - Move(long nHorzMove, long nVerMove)
141 - Scale(double fScaleX, double fScaleY)
144 READ AND WRITE FUNCTIONS
148 - ReadMetaAction - a static function, only used to determine which
149 MetaAction to call on to read the record, which
150 means that this is the function that must be used.
153 INTROSPECTIVE FUNCTIONS
159 A note about MetaCommentAction:
160 -------------------------------
162 So this class is the most interesting - a comment record is what is used to extended metafiles, to
163 make what we call an "Enhanced Metafile". This basically gets the OutputDevice's connect metafile
164 and adds the record via this when it runs Execute(). It doesn't actually do anything else, unlike
165 other MetaActions which invoke functions from OutputDevice. And if there is no connect metafile in
166 OutputDevice, then it just does nothing at all in Execute. Everything else works as normal (Read,
174 The following illustrates an exceptionally basic and incomplete implementation of how to use
175 GDIMetafile. An example can be found at vcl/workben/mtfdemo.cxx
180 // assume that VCL has been initialized and a new application created
182 Window* pWin = new WorkWindow();
183 GDIMetaFile* pMtf = new GDIMetaFile();
185 SvFileStream aFileStream("example.emf", STEAM_READ);
187 ReadWindowMetafile(aFileStream, pMtf);