Class Image
Abstract base class for raster and vector images. Full save/load codecs are added in later batches; BMP I/O is available in Batch 6.
Implements
Inherited Members
Namespace: DRIT.Drawing.Imaging
Assembly: DRIT.Drawing.dll
Syntax
public abstract class Image : IDisposable
Constructors
Image()
Initializes an empty Image instance.
Declaration
protected Image()
Properties
Flags
Gets the flags for this image.
Declaration
public virtual int Flags { get; }
Property Value
| Type | Description |
|---|---|
| int |
Height
Gets the height of this image in pixels.
Declaration
public abstract int Height { get; }
Property Value
| Type | Description |
|---|---|
| int |
HorizontalResolution
Gets the horizontal resolution in pixels per inch.
Declaration
public virtual float HorizontalResolution { get; }
Property Value
| Type | Description |
|---|---|
| float |
PhysicalDimension
Gets the physical size of this image in pixels.
Declaration
public SizeF PhysicalDimension { get; }
Property Value
| Type | Description |
|---|---|
| SizeF |
PixelFormat
Gets the pixel format of this image.
Declaration
public abstract PixelFormat PixelFormat { get; }
Property Value
| Type | Description |
|---|---|
| PixelFormat |
PropertyItems
Gets all property items.
Declaration
public virtual PropertyItem[] PropertyItems { get; }
Property Value
| Type | Description |
|---|---|
| PropertyItem[] | An array of property items. |
RawFormat
Gets the format of this image.
Declaration
public abstract ImageFormat RawFormat { get; }
Property Value
| Type | Description |
|---|---|
| ImageFormat |
Size
Gets the size of this image in pixels.
Declaration
public Size Size { get; }
Property Value
| Type | Description |
|---|---|
| Size |
VerticalResolution
Gets the vertical resolution in pixels per inch.
Declaration
public virtual float VerticalResolution { get; }
Property Value
| Type | Description |
|---|---|
| float |
Width
Gets the width of this image in pixels.
Declaration
public abstract int Width { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Clone()
Creates an exact copy of this image.
Declaration
public abstract Image Clone()
Returns
| Type | Description |
|---|---|
| Image | A new Image with the same content. |
Dispose()
Releases all resources used by this image.
Declaration
public void Dispose()
Dispose(bool)
Releases the unmanaged resources used by this image and optionally releases the managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
|
FromFile(string)
Creates an Image from the specified file.
Declaration
public static Image FromFile(string filename)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filename | The file to load from. |
Returns
| Type | Description |
|---|---|
| Image | The loaded image. |
FromStream(Stream)
Creates an Image from the specified stream.
Declaration
public static Image FromStream(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to load from. |
Returns
| Type | Description |
|---|---|
| Image | The loaded image. |
GetBounds(ref GraphicsUnit)
Gets the bounds of this image in the specified unit.
Declaration
public RectangleF GetBounds(ref GraphicsUnit pageUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| GraphicsUnit | pageUnit | The unit to use for the bounds. |
Returns
| Type | Description |
|---|---|
| RectangleF | The bounds of the image. |
GetEncoderParameterList(Guid)
Gets the encoder parameters for the specified encoder.
Declaration
public virtual EncoderParameters GetEncoderParameterList(Guid encoderClsid)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | encoderClsid | The encoder CLSID. |
Returns
| Type | Description |
|---|---|
| EncoderParameters | The encoder parameters. |
GetFrameCount(FrameDimension)
Gets the number of frames in the specified dimension.
Declaration
public virtual int GetFrameCount(FrameDimension dimension)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameDimension | dimension | The dimension to count frames in. |
Returns
| Type | Description |
|---|---|
| int | The number of frames. |
GetPropertyIdList()
Gets the property IDs for all property items.
Declaration
public virtual int[] GetPropertyIdList()
Returns
| Type | Description |
|---|---|
| int[] | An array of property IDs. |
GetPropertyItem(int)
Gets the property item for the specified property ID.
Declaration
public virtual PropertyItem? GetPropertyItem(int propid)
Parameters
| Type | Name | Description |
|---|---|---|
| int | propid | The property ID. |
Returns
| Type | Description |
|---|---|
| PropertyItem | The property item, or |
GetThumbnailImage(int, int, GetThumbnailImageAbort?, IntPtr)
Returns a thumbnail image of the specified size.
Declaration
public virtual Image GetThumbnailImage(int thumbWidth, int thumbHeight, GetThumbnailImageAbort? callback, IntPtr callbackData)
Parameters
| Type | Name | Description |
|---|---|---|
| int | thumbWidth | The width of the thumbnail. |
| int | thumbHeight | The height of the thumbnail. |
| GetThumbnailImageAbort | callback | The callback for aborting the operation. |
| IntPtr | callbackData | Callback data. |
Returns
| Type | Description |
|---|---|
| Image | The thumbnail image. |
RotateFlip(RotateFlipType)
Rotates and flips the image.
Declaration
public abstract void RotateFlip(RotateFlipType rotateFlipType)
Parameters
| Type | Name | Description |
|---|---|---|
| RotateFlipType | rotateFlipType | The rotation and flip type. |
Save(Stream, ImageFormat)
Saves this image to the specified stream in the specified format.
Declaration
public abstract void Save(Stream stream, ImageFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to save to. |
| ImageFormat | format | The format to save in. |
Save(Stream, ImageFormat, EncoderParameters?)
Saves this image to the specified stream in the specified format with encoder parameters.
Declaration
public virtual void Save(Stream stream, ImageFormat format, EncoderParameters? encoderParams)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to save to. |
| ImageFormat | format | The format to save in. |
| EncoderParameters | encoderParams | The encoder parameters. |
Save(string)
Saves this image to the specified file.
Declaration
public abstract void Save(string filename)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filename | The file name to save to. |
Save(string, ImageFormat)
Saves this image to the specified file in the specified format.
Declaration
public abstract void Save(string filename, ImageFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filename | The file name to save to. |
| ImageFormat | format | The format to save in. |
SelectActiveFrame(FrameDimension, int)
Selects the frame in the specified dimension.
Declaration
public virtual int SelectActiveFrame(FrameDimension dimension, int idx)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameDimension | dimension | The dimension to select the frame in. |
| int | idx | The index of the frame to select. |
Returns
| Type | Description |
|---|---|
| int | The index of the previously selected frame. |