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
| Constructor | Description |
|---|---|
| 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
| Method | Description |
|---|---|
| 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:
| Parameter | Type | Description |
|---|---|---|
| henhmetafile | byte[] | A handle to an enhanced metafile. |
| deleteEmf | boolean | true 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:
| Parameter | Type | Description |
|---|---|---|
| referenceHdc | byte[] | The handle to a device context. |
| emfType | int | An 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:
| Parameter | Type | Description |
|---|---|---|
| filename | java.lang.String | A 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:
| Parameter | Type | Description |
|---|---|---|
| filename | java.lang.String | A String that represents the file name from which to create the new Metafile. |
| referenceHdc | byte[] | 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:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.InputStream | The 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:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.InputStream | A InputStream that contains the data for this Metafile. |
| referenceHdc | byte[] | 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:
| Parameter | Type | Description |
|---|---|---|
| stream | com.aspose.ms.System.IO.Stream | A InputStream that contains the data for this Metafile. |
| type | int | must 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:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.InputStream | A InputStream that contains the data for this Metafile. |
| referenceHdc | byte[] | A Windows handle to a device context. |
| type | int | An 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:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.InputStream | A InputStream that contains the data for this Metafile. |
| referenceHdc | byte[] | A Windows handle to a device context. |
| frameRect | RectangleF | A Rectangle that represents the rectangle that bounds the new Metafile. |
| frameUnit | int | A MetafileFrameUnit that specifies the unit of measure for frameRect. |
| type | int | An 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:
| Parameter | Type | Description |
|---|---|---|
| value | ColorPalette |
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:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.InputStream | A 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:
| Parameter | Type | Description |
|---|---|---|
| fileName | java.lang.String | A 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:
| Parameter | Type | Description |
|---|---|---|
| rotateFlipType | int | A 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:
| Parameter | Type | Description |
|---|---|---|
| recordType | int | Element of the EmfPlusRecordType that specifies the type of metafile record being played. |
| flags | int | A set of flags that specify attributes of the record. |
| dataSize | int | The number of bytes in the record data. |
| dataArray | byte[] | 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:
| Parameter | Type | Description |
|---|---|---|
| propid | int | The 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:
| Parameter | Type | Description |
|---|---|---|
| propid | int | The 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:
| Parameter | Type | Description |
|---|---|---|
| propitem | PropertyItem | The PropertyItem to be stored. |