Class Image
Represents a 2d graphical in-memory Image.
The purpose of this object is to provide basic image processing capabilities cross-platform.
Graphics objects are NOT thread-safe
Inheritance
System.Object
Image
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: NFX.dll
Syntax
public sealed class Image : DisposableObject, IDisposable
Constructors
Image(IPALImage)
Declaration
public Image(IPALImage handle)
Parameters
Fields
DEFAULT_RESOLUTION_PPI
Declaration
public const int DEFAULT_RESOLUTION_PPI = 72
Field Value
| Type |
Description |
| System.Int32 |
|
Properties
Dimensions
Declaration
public Rectangle Dimensions { get; }
Property Value
| Type |
Description |
| System.Drawing.Rectangle |
|
Height
Declaration
public int Height { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
Declaration
public ImagePixelFormat PixelFormat { get; }
Property Value
Size
Declaration
public Size Size { get; }
Property Value
| Type |
Description |
| System.Drawing.Size |
|
Width
Declaration
public int Width { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
XResolution
Declaration
public int XResolution { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
YResolution
Declaration
public int YResolution { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
Methods
CreateCanvas()
Create a canvas object for this image. Canvases are used to draw on images.
Canvas must be disposed after drawing is finished.
Check Canvas.OwnsAssets to determine cacing for graphics primitives (suchs as pens, brushes etc.) beyond the
lifecycle of Canvas
Declaration
public Canvas CreateCanvas()
Returns
Destructor()
Declaration
protected override void Destructor()
Overrides
FromBytes(Byte[])
Creates a new image instance from image content contained in a byte[]
Declaration
public static Image FromBytes(byte[] data)
Parameters
| Type |
Name |
Description |
| System.Byte[] |
data |
|
Returns
FromFile(String)
Creates a new image instance from a named image file
Declaration
public static Image FromFile(string fileName)
Parameters
| Type |
Name |
Description |
| System.String |
fileName |
|
Returns
FromStream(Stream)
Creates a new image instance from image content contained in a stream
Declaration
public static Image FromStream(Stream stream)
Parameters
| Type |
Name |
Description |
| System.IO.Stream |
stream |
|
Returns
GetPixel(Point)
Declaration
public Color GetPixel(Point p)
Parameters
| Type |
Name |
Description |
| System.Drawing.Point |
p |
|
Returns
| Type |
Description |
| System.Drawing.Color |
|
GetPixel(PointF)
Declaration
public Color GetPixel(PointF p)
Parameters
| Type |
Name |
Description |
| System.Drawing.PointF |
p |
|
Returns
| Type |
Description |
| System.Drawing.Color |
|
GetPixel(Int32, Int32)
Declaration
public Color GetPixel(int x, int y)
Parameters
| Type |
Name |
Description |
| System.Int32 |
x |
|
| System.Int32 |
y |
|
Returns
| Type |
Description |
| System.Drawing.Color |
|
GetPixel(Single, Single)
Declaration
public Color GetPixel(float x, float y)
Parameters
| Type |
Name |
Description |
| System.Single |
x |
|
| System.Single |
y |
|
Returns
| Type |
Description |
| System.Drawing.Color |
|
MakeTransparent(Nullable<Color>)
Declaration
public void MakeTransparent(Color? dflt = default (Color? ))
Parameters
| Type |
Name |
Description |
| System.Nullable<System.Drawing.Color> |
dflt |
|
Of(Size)
Creates a new image instance of the specified properties
Declaration
public static Image Of(Size size)
Parameters
| Type |
Name |
Description |
| System.Drawing.Size |
size |
|
Returns
Creates a new image instance of the specified properties
Declaration
public static Image Of(Size size, ImagePixelFormat pixFormat)
Parameters
Returns
Of(Size, Size)
Creates a new image instance of the specified properties
Declaration
public static Image Of(Size size, Size resolution)
Parameters
| Type |
Name |
Description |
| System.Drawing.Size |
size |
|
| System.Drawing.Size |
resolution |
|
Returns
Creates a new image instance of the specified properties
Declaration
public static Image Of(Size size, Size resolution, ImagePixelFormat format)
Parameters
| Type |
Name |
Description |
| System.Drawing.Size |
size |
|
| System.Drawing.Size |
resolution |
|
| ImagePixelFormat |
format |
|
Returns
Of(Int32, Int32)
Creates a new image instance of the specified properties
Declaration
public static Image Of(int width, int height)
Parameters
| Type |
Name |
Description |
| System.Int32 |
width |
|
| System.Int32 |
height |
|
Returns
Creates a new image instance of the specified properties
Declaration
public static Image Of(int width, int height, ImagePixelFormat pixFormat)
Parameters
| Type |
Name |
Description |
| System.Int32 |
width |
|
| System.Int32 |
height |
|
| ImagePixelFormat |
pixFormat |
|
Returns
Of(Int32, Int32, Int32, Int32)
Creates a new image instance of the specified properties
Declaration
public static Image Of(int width, int height, int xDPI, int yDPI)
Parameters
| Type |
Name |
Description |
| System.Int32 |
width |
|
| System.Int32 |
height |
|
| System.Int32 |
xDPI |
|
| System.Int32 |
yDPI |
|
Returns
Creates a new image instance of the specified properties
Declaration
public static Image Of(int width, int height, int xDPI, int yDPI, ImagePixelFormat pixFormat)
Parameters
| Type |
Name |
Description |
| System.Int32 |
width |
|
| System.Int32 |
height |
|
| System.Int32 |
xDPI |
|
| System.Int32 |
yDPI |
|
| ImagePixelFormat |
pixFormat |
|
Returns
ResizeTo(Size, InterpolationMode)
Declaration
public Image ResizeTo(Size newSize, InterpolationMode interpolation = InterpolationMode.Default)
Parameters
Returns
ResizeTo(Int32, Int32, InterpolationMode)
Declaration
public Image ResizeTo(int newWidth, int newHeight, InterpolationMode interpolation = InterpolationMode.Default)
Parameters
| Type |
Name |
Description |
| System.Int32 |
newWidth |
|
| System.Int32 |
newHeight |
|
| InterpolationMode |
interpolation |
|
Returns
Declaration
public byte[] Save(ImageFormat format)
Parameters
Returns
| Type |
Description |
| System.Byte[] |
|
Declaration
public void Save(Stream stream, ImageFormat format)
Parameters
| Type |
Name |
Description |
| System.IO.Stream |
stream |
|
| ImageFormat |
format |
|
Saves image to the named file
Declaration
public void Save(string fileName, ImageFormat format)
Parameters
| Type |
Name |
Description |
| System.String |
fileName |
|
| ImageFormat |
format |
|
SetPixel(Point, Color)
Declaration
public void SetPixel(Point p, Color color)
Parameters
| Type |
Name |
Description |
| System.Drawing.Point |
p |
|
| System.Drawing.Color |
color |
|
SetPixel(PointF, Color)
Declaration
public void SetPixel(PointF p, Color color)
Parameters
| Type |
Name |
Description |
| System.Drawing.PointF |
p |
|
| System.Drawing.Color |
color |
|
SetPixel(Int32, Int32, Color)
Declaration
public void SetPixel(int x, int y, Color color)
Parameters
| Type |
Name |
Description |
| System.Int32 |
x |
|
| System.Int32 |
y |
|
| System.Drawing.Color |
color |
|
SetPixel(Single, Single, Color)
Declaration
public void SetPixel(float x, float y, Color color)
Parameters
| Type |
Name |
Description |
| System.Single |
x |
|
| System.Single |
y |
|
| System.Drawing.Color |
color |
|
SetResolution(Int32, Int32)
Declaration
public void SetResolution(int xDPI, int yDPI)
Parameters
| Type |
Name |
Description |
| System.Int32 |
xDPI |
|
| System.Int32 |
yDPI |
|
Implements
System.IDisposable
Extension Methods