Metafile

Inheritance: java.lang.Object, com.aspose.drawing.Image

public final class Metafile extends Image

Defines a graphic metafile. A metafile contains records that describe a sequence of graphics operations that can be recorded (constructed) and played back (displayed). This class is not inheritable.

Constructors

ConstructorDescription
Metafile(byte[] henhmetafile, boolean deleteEmf)Initializes a new instance of the Metafile class from the specified handle.
Metafile(byte[] referenceHdc, int emfType)Initializes a new instance of the Metafile class from the specified handle to a device context and an EmfType enumeration that specifies the format of the Metafile.
Metafile(String filename)Initializes a new instance of the Metafile class from the specified file name.
Metafile(String filename, byte[] referenceHdc)Initializes a new instance of the Metafile class from the specified file name.
Metafile(InputStream stream)Initializes a new instance of the Metafile class from the specified data stream.
Metafile(InputStream stream, byte[] referenceHdc)Initializes a new instance of the Metafile class from the specified data stream and a Windows handle to a device context.
Metafile(System.IO.Stream stream, int type)Initializes a new instance of the Metafile class from the specified data stream and a Windows handle to a device context.
Metafile(InputStream stream, byte[] referenceHdc, int type)Initializes a new instance of the Metafile class from the specified data stream, a Windows handle to a device context, and an EmfType enumeration that specifies the format of the Metafile.
Metafile(InputStream stream, byte[] referenceHdc, RectangleF frameRect, int frameUnit, int type)Initializes a new instance of the Metafile class from the specified data stream, a Windows handle to a device context, and an EmfType enumeration that specifies the format of the Metafile.

Methods

MethodDescription
getWidth()Gets the width, in pixels, of this Metafile.
getHeight()Gets the height, in pixels, of this Metafile.
getRawFormat()Gets the file format of this Image.
getPixelFormat()Gets the pixel format for this Image.
getPalette()Gets or sets the color palette used for this Image.
setPalette(ColorPalette value)Gets or sets the color palette used for this Image.
getFrameDimensionsList()Gets an array of GUIDs that represent the dimensions of frames within this Image.
getPropertyIdList()Gets IDs of the property items stored in this Image.
getPropertyItems()Gets all the property items (pieces of metadata) stored in this Image.
getMetafileHeader(InputStream stream)Returns the MetafileHeader associated with the specified Metafile.
getMetafileHeader(String fileName)Returns the MetafileHeader associated with the specified Metafile.
rotateFlip(int rotateFlipType)This method rotates, flips, or rotates and flips the Image.
getHenhmetafile()Returns a Windows handle to an enhanced Metafile.
playRecord(int recordType, int flags, int dataSize, byte[] dataArray)Plays an individual metafile record.
getMetafileHeader()Returns the MetafileHeader associated with this Metafile.
getPropertyItem(int propid)Gets the specified property item from this Image.
removePropertyItem(int propid)Removes the specified property item from this Image.
setPropertyItem(PropertyItem propitem)Stores a property item (piece of metadata) in this Image.

Metafile(byte[] henhmetafile, boolean deleteEmf)

public Metafile(byte[] henhmetafile, boolean deleteEmf)

Initializes a new instance of the Metafile class from the specified handle.

Parameters:

ParameterTypeDescription
henhmetafilebyte[]A handle to an enhanced metafile.
deleteEmfbooleantrue to delete the enhanced metafile handle when the Metafile is deleted; otherwise, false.

Metafile(byte[] referenceHdc, int emfType)

public Metafile(byte[] referenceHdc, int emfType)

Initializes a new instance of the Metafile class from the specified handle to a device context and an EmfType enumeration that specifies the format of the Metafile.

Parameters:

ParameterTypeDescription
referenceHdcbyte[]The handle to a device context.
emfTypeintAn EmfType that specifies the format of the Metafile.

Metafile(String filename)

public Metafile(String filename)

Initializes a new instance of the Metafile class from the specified file name.

Parameters:

ParameterTypeDescription
filenamejava.lang.StringA String that represents the file name from which to create the new Metafile.

Metafile(String filename, byte[] referenceHdc)

public Metafile(String filename, byte[] referenceHdc)

Initializes a new instance of the Metafile class from the specified file name.

Parameters:

ParameterTypeDescription
filenamejava.lang.StringA String that represents the file name from which to create the new Metafile.
referenceHdcbyte[]A Windows handle to a device context.

Metafile(InputStream stream)

public Metafile(InputStream stream)

Initializes a new instance of the Metafile class from the specified data stream.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe InputStream from which to create the new Metafile.

Metafile(InputStream stream, byte[] referenceHdc)

public Metafile(InputStream stream, byte[] referenceHdc)

Initializes a new instance of the Metafile class from the specified data stream and a Windows handle to a device context. />.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamA InputStream that contains the data for this Metafile.
referenceHdcbyte[]A Windows handle to a device context of the Metafile object.

Metafile(System.IO.Stream stream, int type)

public Metafile(System.IO.Stream stream, int type)

Initializes a new instance of the Metafile class from the specified data stream and a Windows handle to a device context. />.

Parameters:

ParameterTypeDescription
streamcom.aspose.ms.System.IO.StreamA InputStream that contains the data for this Metafile.
typeintmust be int 1.

Metafile(InputStream stream, byte[] referenceHdc, int type)

public Metafile(InputStream stream, byte[] referenceHdc, int type)

Initializes a new instance of the Metafile class from the specified data stream, a Windows handle to a device context, and an EmfType enumeration that specifies the format of the Metafile.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamA InputStream that contains the data for this Metafile.
referenceHdcbyte[]A Windows handle to a device context.
typeintAn EmfType that specifies the format of the Metafile.

Metafile(InputStream stream, byte[] referenceHdc, RectangleF frameRect, int frameUnit, int type)

public Metafile(InputStream stream, byte[] referenceHdc, RectangleF frameRect, int frameUnit, int type)

Initializes a new instance of the Metafile class from the specified data stream, a Windows handle to a device context, and an EmfType enumeration that specifies the format of the Metafile.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamA InputStream that contains the data for this Metafile.
referenceHdcbyte[]A Windows handle to a device context.
frameRectRectangleFA Rectangle that represents the rectangle that bounds the new Metafile.
frameUnitintA MetafileFrameUnit that specifies the unit of measure for frameRect.
typeintAn EmfType that specifies the format of the Metafile.

getWidth()

public int getWidth()

Gets the width, in pixels, of this Metafile.

Returns: int

getHeight()

public int getHeight()

Gets the height, in pixels, of this Metafile.

Returns: int - the height, in pixels, of this Metafile.

getRawFormat()

public ImageFormat getRawFormat()

Gets the file format of this Image.

Returns: ImageFormat - The ImageFormat that represents the file format of this Image.

getPixelFormat()

public int getPixelFormat()

Gets the pixel format for this Image.

Returns: int - A PixelFormat(Image.getPixelFormat) that represents the pixel format for this Image.

getPalette()

public ColorPalette getPalette()

Gets or sets the color palette used for this Image.

Returns: ColorPalette - A ColorPalette that represents the color palette used for this Image.

setPalette(ColorPalette value)

public void setPalette(ColorPalette value)

Gets or sets the color palette used for this Image.

Parameters:

ParameterTypeDescription
valueColorPalette

getFrameDimensionsList()

public UUID[] getFrameDimensionsList()

Gets an array of GUIDs that represent the dimensions of frames within this Image.

Returns: java.util.UUID[] - An array of GUIDs that specify the dimensions of frames within this Image from most significant to least significant.

getPropertyIdList()

public int[] getPropertyIdList()

Gets IDs of the property items stored in this Image.

Returns: int[] - An array of the property IDs, one for each property item stored in this image.

getPropertyItems()

public PropertyItem[] getPropertyItems()

Gets all the property items (pieces of metadata) stored in this Image.

Returns: com.aspose.drawing.imaging.PropertyItem[] - An array of PropertyItem objects, one for each property item stored in the image.

getMetafileHeader(InputStream stream)

public static MetafileHeader getMetafileHeader(InputStream stream)

Returns the MetafileHeader associated with the specified Metafile.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamA InputStream containing the Metafile for which a header is retrieved.

Returns: MetafileHeader - The MetafileHeader associated with the specified Metafile.

getMetafileHeader(String fileName)

public static MetafileHeader getMetafileHeader(String fileName)

Returns the MetafileHeader associated with the specified Metafile.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringA String containing the name of the Metafile for which a header is retrieved.

Returns: MetafileHeader - The MetafileHeader associated with the specified Metafile.

rotateFlip(int rotateFlipType)

public void rotateFlip(int rotateFlipType)

This method rotates, flips, or rotates and flips the Image.

Parameters:

ParameterTypeDescription
rotateFlipTypeintA RotateFlipType member that specifies the type of rotation and flip to apply to the image.

getHenhmetafile()

public System.IntPtr getHenhmetafile()

Returns a Windows handle to an enhanced Metafile.

Returns: com.aspose.ms.System.IntPtr - A Windows handle to this enhanced Metafile.

playRecord(int recordType, int flags, int dataSize, byte[] dataArray)

public void playRecord(int recordType, int flags, int dataSize, byte[] dataArray)

Plays an individual metafile record.

Parameters:

ParameterTypeDescription
recordTypeintElement of the EmfPlusRecordType that specifies the type of metafile record being played.
flagsintA set of flags that specify attributes of the record.
dataSizeintThe number of bytes in the record data.
dataArraybyte[]An array of bytes that contains the record data.

getMetafileHeader()

public MetafileHeader getMetafileHeader()

Returns the MetafileHeader associated with this Metafile.

Returns: MetafileHeader - The MetafileHeader associated with this Metafile.

getPropertyItem(int propid)

public PropertyItem getPropertyItem(int propid)

Gets the specified property item from this Image.

Parameters:

ParameterTypeDescription
propidintThe ID of the property item to get.

Returns: PropertyItem - The PropertyItem this method gets.

removePropertyItem(int propid)

public void removePropertyItem(int propid)

Removes the specified property item from this Image.

Parameters:

ParameterTypeDescription
propidintThe ID of the property item to remove.

setPropertyItem(PropertyItem propitem)

public void setPropertyItem(PropertyItem propitem)

Stores a property item (piece of metadata) in this Image.

Parameters:

ParameterTypeDescription
propitemPropertyItemThe PropertyItem to be stored.