Class XbpMetaFile() Foundation

Class function of the XbpMetaFile class.

Description

Objects of the XbpMetaFile() class are used to load, display and save metafiles. Metafiles contain graphic information created by the Xbase++ GRA engine. XbpMetaFile objects allow drawings to be saved in a file as a series of graphic primitives and later redisplayed by "playing back" the metafile. Metafiles are also suitable for exchanging graphic data between two work stations. Metafiles can contain bitmaps (raster images) or raster operations (see the function GraBitBlt()). If bitmaps are included, the graphic data is device dependent and exchanging graphic data between work stations with different screen resolutions and/or different numbers of display colors can lead to unexpected results.

Metafiles can be used to temporarily store data in the clipboard. They are also used to import drawings from one application into another.

An XbpMetaFile object can only load and display metafiles that were previously created and saved. The metafile contains graphic data that was recorded using an XbpFileDev object. The initial creation of a metafile always uses an XbpFileDev object that generates an XbpMetaFile object. XbpMetaFile objects can be generated in two different ways: either by a call to XbpMetaFile():new() or by the :metaFile()method of an XbpFileDev object.

Class methods
:new()
Creates an instances of the XbpMetaFile class.
Life cycle
:create()
Requests system resources for managing a metafile.
:configure()
This method has no effect in the XbpMetaFile() class.
:destroy()
Releases the system resources of the object.
Manipulation
:draw()
Replays the metafile in a presentation space (display the image).
:load()
Loads a metafile.
:save()
Saves graphic data in a metafile.
:setBuffer()
Sets or retrieves the graphic data in the buffer.
:setIPicture()
Initializes the metafile through an IPicture automation object.
Examples
Load and display metafiles

// This example demonstrates how metafiles can be loaded 
// and displayed. The metafiles TESTA.MET and TESTB.MET 
// must exist. The contents of both files are displayed 
// using a single XbpMetaFile object. 

PROCEDURE Main 
   LOCAL oMF, cBuffer 

   SetColor( "N/W" )                   // Fill window pale gray 
   CLS 

   oMF := XbpMetaFile():new():create() // XbpMetaFile object 
   oMF:load( "TestA.met" )             // Load metafile 

   oMF:draw()                          // Display TESTA.MET 
   cBuffer := oMF:setBuffer()          // Read graphic data 

   oMF:load( "TestB.met" )             // Load TESTB.MET 
                                       // metafile 
   WAIT "oMF:setBuffer() has changed"  // Wait for keypress 

   CLS 
   oMF:draw()                          // Display TESTB.MET 

   WAIT "Redisplay original data, press key..." 

   oMF:setBuffer( cBuffer ) 
   oMF:draw() 

   WAIT                                // Wait for keypress 
RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.