Icon
Inheritance: java.lang.Object
All Implemented Interfaces: com.aspose.ms.System.ICloneable, com.aspose.ms.System.IDisposable
public final class Icon implements System.ICloneable, System.IDisposable
Represents a Windows icon, which is a small bitmap image that is used to represent an object. Icons can be thought of as transparent bitmaps, although their size is determined by the system.
Constructors
Constructor | Description |
---|---|
Icon(String fileName) | Initializes a new instance of the Icon class from the specified file name. |
Icon(InputStream stream) | Initializes a new instance of the Icon class from the specified data stream. |
Icon(String fileName, Size size) | Initializes a new instance of the Icon class of the specified size from the specified file. |
Icon(Icon original, Size size) | Initializes a new instance of the Icon class and attempts to find a version of the icon that matches the requested size. |
Icon(Object type, String resource) | Initializes a new instance of the Icon class from a resource in the specified assembly. |
Icon(InputStream stream, Size size) | Initializes a new instance of the Icon class of the specified size from the specified stream. |
Icon(String fileName, int width, int height) | Initializes a new instance of the Icon class with the specified width and height from the specified file. |
Icon(Icon original, int width, int height) | Initializes a new instance of the Icon class and attempts to find a version of the icon that matches the requested size.. |
Icon(InputStream stream, int width, int height) | Initializes a new instance of the Icon class from the specified data stream and with the specified width and height. |
Methods
Method | Description |
---|---|
getHandle() | Gets the handle for this Icon. |
getHeight() | Gets the height of this Icon. |
getSize() | Gets the size of this Icon. |
getWidth() | Gets the width of this Icon. |
extractAssociatedIcon(String filePath) | Returns an icon representation of an image that is contained in the specified file. |
fromHandle(byte[] handle) | Creates a GDI+ Icon from the specified Windows handle to an icon (HICON). |
deepClone() | Clones the Icon, creating a duplicate image. |
dispose() | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
save(OutputStream outputStream) | Saves this Icon to the specified output java.io.InputStream. |
toBitmap() | Converts this Icon to a GDI+ Bitmap. |
toString() | Gets a human-readable string that describes the Icon. |
Icon(String fileName)
public Icon(String fileName)
Initializes a new instance of the Icon class from the specified file name.
Parameters:
Parameter | Type | Description |
---|---|---|
fileName | java.lang.String | The file to load the Icon from. |
Icon(InputStream stream)
public Icon(InputStream stream)
Initializes a new instance of the Icon class from the specified data stream.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The data stream from which to load the Icon. |
Icon(String fileName, Size size)
public Icon(String fileName, Size size)
Initializes a new instance of the Icon class of the specified size from the specified file.
Parameters:
Parameter | Type | Description |
---|---|---|
fileName | java.lang.String | The name and path to the file that contains the icon data. |
size | Size | The desired size of the icon. |
Icon(Icon original, Size size)
public Icon(Icon original, Size size)
Initializes a new instance of the Icon class and attempts to find a version of the icon that matches the requested size.
Parameters:
Parameter | Type | Description |
---|---|---|
original | Icon | The Icon from which to load the newly sized icon. |
size | Size | A Size (.getSize) structure that specifies the height and width of the new Icon. |
Icon(Object type, String resource)
public Icon(Object type, String resource)
Initializes a new instance of the Icon class from a resource in the specified assembly.
Parameters:
Parameter | Type | Description |
---|---|---|
type | java.lang.Object | A Type that specifies the assembly in which to look for the resource. |
resource | java.lang.String | The resource name to load. |
Icon(InputStream stream, Size size)
public Icon(InputStream stream, Size size)
Initializes a new instance of the Icon class of the specified size from the specified stream.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The stream that contains the icon data. |
size | Size | The desired size of the icon. |
Icon(String fileName, int width, int height)
public Icon(String fileName, int width, int height)
Initializes a new instance of the Icon class with the specified width and height from the specified file.
Parameters:
Parameter | Type | Description |
---|---|---|
fileName | java.lang.String | The name and path to the file that contains the Icon data. |
width | int | The desired width of the Icon. |
height | int | The desired height of the Icon. |
Icon(Icon original, int width, int height)
public Icon(Icon original, int width, int height)
Initializes a new instance of the Icon class and attempts to find a version of the icon that matches the requested size..
Parameters:
Parameter | Type | Description |
---|---|---|
original | Icon | The icon to load the different size from. |
width | int | The width of the new icon. |
height | int | The height of the new icon. |
Icon(InputStream stream, int width, int height)
public Icon(InputStream stream, int width, int height)
Initializes a new instance of the Icon class from the specified data stream and with the specified width and height.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The data stream from which to load the icon. |
width | int | The width, in pixels, of the icon. |
height | int | The height, in pixels, of the icon. |
getHandle()
public System.IntPtr getHandle()
Gets the handle for this Icon. This is not a copy of the handle; do not free it.
Value: The Windows handle for the icon.
Returns: com.aspose.ms.System.IntPtr
getHeight()
public int getHeight()
Gets the height of this Icon.
Value: The height of this Icon.
Returns: int
getSize()
public Size getSize()
Gets the size of this Icon.
Value: A Size
(.getSize) structure that specifies the width and height of this Icon.
Returns: Size
getWidth()
public int getWidth()
Gets the width of this Icon.
Value: The width of this Icon.
Returns: int
extractAssociatedIcon(String filePath)
public static Icon extractAssociatedIcon(String filePath)
Returns an icon representation of an image that is contained in the specified file.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The path to the file that contains an image. |
Returns: Icon - The Icon representation of the image that is contained in the specified file.
fromHandle(byte[] handle)
public static Icon fromHandle(byte[] handle)
Creates a GDI+ Icon from the specified Windows handle to an icon (HICON).
Parameters:
Parameter | Type | Description |
---|---|---|
handle | byte[] | A Windows handle to an icon. |
Returns: Icon - The Icon this method creates.
deepClone()
public Object deepClone()
Clones the Icon, creating a duplicate image.
Returns: java.lang.Object - An object that can be cast to an Icon.
dispose()
public void dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
save(OutputStream outputStream)
public void save(OutputStream outputStream)
Saves this Icon to the specified output java.io.InputStream.
Parameters:
Parameter | Type | Description |
---|---|---|
outputStream | java.io.OutputStream | The java.io.InputStream to save to. |
toBitmap()
public Bitmap toBitmap()
Converts this Icon to a GDI+ Bitmap.
Returns: Bitmap - A Bitmap that represents the converted Icon.
toString()
public String toString()
Gets a human-readable string that describes the Icon.
Returns: java.lang.String - A string that describes the Icon.