Class Bitmap
Bitmap class, used to represent image of the type of Bitmap. See also: Image.
Inherited Members
Namespace: Cosmos.System.Graphics
Assembly: Cosmos.System2.dll
Syntax
public class Bitmap : Image
Constructors
| Improve this Doc View SourceBitmap(Byte[])
Create new instance of the Bitmap class, with a specified image data byte array.
Declaration
public Bitmap(byte[] imageData)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | imageData | byte array. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if imageData is null / memory error. |
System.ArgumentException | Thrown on memory error. |
System.ArgumentOutOfRangeException | Thrown on fatal error (contact support). |
System.IO.IOException | Thrown on IO error. |
System.NotSupportedException | Thrown on fatal error (contact support). |
System.ObjectDisposedException | Thrown on fatal error (contact support). |
System.Exception |
|
System.NotImplementedException | Thrown if pixelsize is other then 32 / 24 or the file compressed. |
Bitmap(Byte[], ColorOrder)
Create new instance of the Bitmap class, with a specified image data byte array.
Declaration
public Bitmap(byte[] imageData, ColorOrder colorOrder = ColorOrder.BGR)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | imageData | byte array. |
ColorOrder | colorOrder | Order of colors in each pixel. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if imageData is null / memory error. |
System.ArgumentException | Thrown on memory error. |
System.ArgumentOutOfRangeException | Thrown on fatal error (contact support). |
System.IO.IOException | Thrown on IO error. |
System.NotSupportedException | Thrown on fatal error (contact support). |
System.ObjectDisposedException | Thrown on fatal error (contact support). |
System.Exception |
|
System.NotImplementedException | Thrown if pixelsize is other then 32 / 24 or the file compressed. |
Bitmap(String)
Create new instance of the Bitmap class, with a specified path to a BMP file.
Declaration
public Bitmap(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path to file. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException |
|
System.ArgumentNullException |
|
System.ArgumentOutOfRangeException | Thrown on fatal error (contact support). |
System.IO.IOException | Thrown on IO error. |
System.NotSupportedException |
|
System.ObjectDisposedException | Thrown if the stream is closed. |
System.Exception |
|
System.NotImplementedException | Thrown if pixelsize is other then 32 / 24 or the file compressed. |
System.Security.SecurityException | Thrown if the caller does not have permissions to read / write the file. |
System.IO.FileNotFoundException | Thrown if the file cannot be found. |
System.IO.DirectoryNotFoundException | Thrown if the specified path is invalid. |
System.IO.PathTooLongException | Thrown if the specified path is exceed the system-defined max length. |
Bitmap(String, ColorOrder)
Create new instance of the Bitmap class, with a specified path to a BMP file.
Declaration
public Bitmap(string path, ColorOrder colorOrder = ColorOrder.BGR)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path to file. |
ColorOrder | colorOrder | Order of colors in each pixel. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException |
|
System.ArgumentNullException |
|
System.ArgumentOutOfRangeException | Thrown on fatal error (contact support). |
System.IO.IOException | Thrown on IO error. |
System.NotSupportedException |
|
System.ObjectDisposedException | Thrown if the stream is closed. |
System.Exception |
|
System.NotImplementedException | Thrown if pixelsize is other then 32 / 24 or the file compressed. |
System.Security.SecurityException | Thrown if the caller does not have permissions to read / write the file. |
System.IO.FileNotFoundException | Thrown if the file cannot be found. |
System.IO.DirectoryNotFoundException | Thrown if the specified path is invalid. |
System.IO.PathTooLongException | Thrown if the specified path is exceed the system-defined max length. |
Bitmap(UInt32, UInt32, ColorDepth)
Create new instance of Bitmap class.
Declaration
public Bitmap(uint Width, uint Height, ColorDepth colorDepth)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | Width | Image width (greater then 0). |
System.UInt32 | Height | Image height (greater then 0). |
ColorDepth | colorDepth | Color depth. |
Bitmap(UInt32, UInt32, Byte[], ColorDepth)
Create a bitmap from a byte array representing the pixels.
Declaration
public Bitmap(uint Width, uint Height, byte[] pixelData, ColorDepth colorDepth)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | Width | Width of the bitmap. |
System.UInt32 | Height | Height of the bitmap. |
System.Byte[] | pixelData | Byte array which includes the values for each pixel. |
ColorDepth | colorDepth | Format of pixel data. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Thrwon if color depth is not 32. |
System.OverflowException | Thrown if bitmap size is bigger than Int32.MaxValue. |
System.ArgumentException | Thrown on fatal error (contact support). |
System.ArgumentNullException | Thrown on memory error. |
System.ArgumentOutOfRangeException | Thrown on fatal error (contact support). |
Methods
| Improve this Doc View SourceSave(Stream, ImageFormat)
Save image to stream.
Declaration
public void Save(Stream stream, ImageFormat imageFormat)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream. |
ImageFormat | imageFormat | Image format. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown on memory error. |
System.RankException | Thrown on fatal error (contact support). |
System.ArrayTypeMismatchException | Thrown on fatal error (contact support). |
System.InvalidCastException | Thrown on fatal error (contact support). |
System.ArgumentOutOfRangeException | Thrown on memory error. |
System.ArgumentException | Thrown on memory error. |
System.OverflowException | Thrown on memory error. |
System.IO.IOException | Thrown on IO error. |
System.NotSupportedException | Thrown if the stream does not support writing. |
System.ObjectDisposedException | Thrown if the stream is closed. |
Save(String)
Save image as bmp file.
Declaration
public void Save(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path to the file. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown on memory error. |
System.RankException | Thrown on fatal error (contact support). |
System.ArrayTypeMismatchException | Thrown on fatal error (contact support). |
System.InvalidCastException | Thrown on fatal error (contact support). |
System.ArgumentOutOfRangeException | Thrown on memory error. |
System.ArgumentException | Thrown on memory error. |
System.OverflowException | Thrown on memory error. |
System.IO.IOException | Thrown on IO error. |
System.NotSupportedException | Thrown on fatal error (contact support). |
System.ObjectDisposedException | Thrown on fatal error (contact support). |