Metafile

Qualified name: delphivcl.Metafile

class Metafile

Bases: Graphic

TMetafile is an encapsulation of the Win32 Enhanced metafile. TMetafile contains a metafile graphic (EMF file format). Properties of TMetafile indicate the size and characteristics of the metafile. To draw a metafile on a canvas, call the Draw or StretchDraw methods of a TCanvas object, passing a TMetafile as a parameter. The Enhanced property determines how the metafile will be stored on disk. If Enhanced is true, the metafile is stored as an .EMF (Win32 Enhanced Metafile) file. If Enhanced is false, the metafile is stored as a .WMF (Windows 3.1 Metafile, with Aldus header).

Methods

Assign

Copies an object to the metafile.

CanLoadFromStream

Vcl.Graphics.TMetafile.CanLoadFromStream inherits from Vcl.Graphics.TGraphic.CanLoadFromStream.

Clear

LoadFromClipboardFormat

Loads a metafile from the Clipboard.

LoadFromStream

Loads the metafile from a stream.

ReleaseHandle

SaveToClipboardFormat

Saves a metafile to a Clipboard format.

SaveToFile

Writes the metafile to disk.

SaveToStream

Writes the metafile to a stream.

SetSize

Specifies the size of the metafile.

Attributes

ClassName

Returns the TObject.ClassName

CreatedBy

Description

Empty

Enhanced

Handle

HandleAllocated

Height

Inch

IsAnimating

bool:

MMHeight

MMWidth

Modified

Palette

PaletteModified

ScaledDrawer

Returns the reference to the scaled drawer.

SupportsPartialTransparency

Indicate whether graphic supports partial transparency or an alpha channel.

Transparent

Width

Assign(Source: Persistent) None

Copies an object to the metafile. Assign copies the Enhanced and Palette properties of an object to the metafile. If the metafile is nil (Delphi) or NULL (C++), Assign creates one. Otherwise, Assign calls the inherited method. For assignment, metafiles are polymorphic with other TGraphic objects, and with TPicture.

CanLoadFromStream(Stream: Stream) bool

Vcl.Graphics.TMetafile.CanLoadFromStream inherits from Vcl.Graphics.TGraphic.CanLoadFromStream. All content below this line refers to Vcl.Graphics.TGraphic.CanLoadFromStream. CanLoadFromStream returns True when a specified stream contains a streamed image of a specific TGraphic subclass. The method uses current stream position, it does not change current stream position.

Clear()
LoadFromClipboardFormat(AFormat: int, AData: int, APalette: int) None

Loads a metafile from the Clipboard. LoadFromClipboardFormat replaces the current image with the data in the clipboard. LoadFromClipboardFormat ignores the AData and APalette parameters.

LoadFromStream(Stream: Stream) None

Loads the metafile from a stream. Use LoadFromStream by specifying the stream from which the metafile is loaded as the value of Stream. LoadFromStream reads a metafile from a stream and replaces the current image with it.

ReleaseHandle()
SaveToClipboardFormat(AFormat: int, AData: int, APalette: int) None

Saves a metafile to a Clipboard format. Use SaveToClipboardFormat to copy the metafile to a Clipboard format. The resulting values can then be copied to the Windows clipboard using the clipboard’s SetAsHandle method. The metafile’s palette is returned in the APalette parameter, the format in the AFormat parameter, and a handle to the data in the AData parameter. Before the metafile can be saved, an application must have registered the format with the metafile object using the RegisterClipboardFormat method. To save a metafile to a file, call SaveToFile.

SaveToFile(Filename: str) None

Writes the metafile to disk. Use SaveToFile to save the metafile to a file provided by the Filename parameter. To load a metafile from a file, call the LoadFromFile method.

Note: If the Filename parameter has an extension of “.wmf”, the metafile is saved as a WMF file. It is not necessary to set the Enhanced property.

SaveToStream(Stream: Stream) None

Writes the metafile to a stream. Use SaveToStream to save the metafile to the stream specified by the Stream parameter. If the Enhanced property is True, the metafile is saved as an EMF; if False, it it saved as a WMF.

SetSize(AWidth: int, AHeight: int) None

Specifies the size of the metafile. Use the SetSize method to set both the height and width of the metafile. This results in better performance than setting the height and width separately.