Class Bitmap
Represents a bitmap image.
Inherited Members
Namespace: Cosmos.System.Graphics
Assembly: Cosmos.System2.dll
Syntax
public class Bitmap : Image
Constructors
| Improve this Doc View SourceBitmap(Byte[])
Initializes a new instance of the Bitmap class, with the 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. |
System.IO.IOException | Thrown on IO error. |
System.NotSupportedException | Thrown on fatal error. |
System.ObjectDisposedException | Thrown on fatal error. |
System.Exception |
|
System.NotImplementedException | Thrown if pixelsize is other then 32 / 24 or the file compressed. |
Bitmap(Byte[], ColorOrder)
Initializes a new instance of the Bitmap class, with the 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. |
System.IO.IOException | Thrown on IO error. |
System.NotSupportedException | Thrown on fatal error. |
System.ObjectDisposedException | Thrown on fatal error. |
System.Exception |
|
System.NotImplementedException | Thrown if pixelsize is other then 32 / 24 or the file compressed. |
Bitmap(String)
Initializes a new instance of the Bitmap class, using the 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. |
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)
Initializes a 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. |
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)
Initializes a new instance of Bitmap class.
Declaration
public Bitmap(uint width, uint height, ColorDepth colorDepth)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | width | The width of the image. |
System.UInt32 | height | The height of the image. |
ColorDepth | colorDepth | The color depth. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown when either the width or height is lower than 0. |
Bitmap(UInt32, UInt32, Byte[], ColorDepth)
Initializes a new instance of Bitmap class 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 | The width of the bitmap. |
System.UInt32 | height | The height of the bitmap. |
System.Byte[] | pixelData | A byte array which includes the values for each pixel. |
ColorDepth | colorDepth | The format of the pixel data. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Thrown if color depth is not 32. |
System.OverflowException | Thrown if bitmap size is bigger than Int32.MaxValue. |
System.ArgumentException | Thrown on fatal error. |
System.ArgumentNullException | Thrown on memory error. |
System.ArgumentOutOfRangeException | Thrown on fatal error. |
Methods
| Improve this Doc View SourceSave(Stream, ImageFormat)
Saves the image to the given stream.
Declaration
public void Save(Stream stream, ImageFormat imageFormat = ImageFormat.BMP)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The target stream. |
ImageFormat | imageFormat | The format to save the image with. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown on memory error. |
System.RankException | Thrown on fatal error. |
System.ArrayTypeMismatchException | Thrown on fatal error. |
System.InvalidCastException | Thrown on fatal error. |
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)
Saves the given image as a BMP file.
Declaration
public void Save(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path to the file. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown on memory error. |
System.RankException | Thrown on fatal error. |
System.ArrayTypeMismatchException | Thrown on fatal error. |
System.InvalidCastException | Thrown on fatal error. |
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. |
System.ObjectDisposedException | Thrown on fatal error. |