diff --git a/source/Cosmos.System2/Graphics/Bitmap.cs b/source/Cosmos.System2/Graphics/Bitmap.cs
index a7e2812a5..e497d2616 100644
--- a/source/Cosmos.System2/Graphics/Bitmap.cs
+++ b/source/Cosmos.System2/Graphics/Bitmap.cs
@@ -1,6 +1,7 @@
//#define COSMOSDEBUG
using System;
using System.IO;
+using System.Security;
namespace Cosmos.System.Graphics
{
@@ -23,10 +24,15 @@ namespace Cosmos.System.Graphics
///
/// Create a bitmap from a byte array representing the pixels.
///
- /// Width of the bitmap
- /// Height of the bitmap
- /// Byte array which includes the values for each pixel
- /// Format of pixel data
+ /// Width of the bitmap.
+ /// Height of the bitmap.
+ /// Byte array which includes the values for each pixel.
+ /// Format of pixel data.
+ /// Thrwon if color depth is not 32.
+ /// Thrown if bitmap size is bigger than Int32.MaxValue.
+ /// Thrown on fatal error (contact support).
+ /// Thrown on memory error.
+ /// Thrown on fatal error (contact support).
public Bitmap(uint Width, uint Height, byte[] pixelData, ColorDepth colorDepth) : base(Width, Height, colorDepth)
{
rawData = new int[Width * Height];
@@ -48,6 +54,44 @@ namespace Cosmos.System.Graphics
}
}
+ ///
+ /// Create new inctanse of the class, with a specified path to a BMP file.
+ ///
+ /// Path to file.
+ ///
+ ///
+ /// - Thrown if path is invalid.
+ /// - Memory error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown if path is null.
+ /// - Memory error.
+ ///
+ ///
+ /// Thrown on fatal error (contact support).
+ /// Thrown on IO error.
+ ///
+ ///
+ /// - Thrown on fatal error (contact support).
+ /// - The path refers to non-file.
+ ///
+ ///
+ /// Thrown if the stream is closed.
+ ///
+ ///
+ /// - Thrown if header is not from a BMP.
+ /// - Info header size has the wrong value.
+ /// - Number of planes is not 1. Can not read file.
+ /// - Total Image Size is smaller than pure image size.
+ ///
+ ///
+ /// Thrown if pixelsize is other then 32 / 24 or the file compressed.
+ /// Thrown if the caller does not have permissions to read / write the file.
+ /// Thrown if the file cannot be found.
+ /// Thrown if the specified path is invalid.
+ /// Thrown if the specified path is exceed the system-defined max length.
public Bitmap(string path) : base(0, 0, ColorDepth.ColorDepth32) //Call the image constructor with wrong values
{
using (var fs = new FileStream(path, FileMode.Open))
@@ -57,10 +101,25 @@ namespace Cosmos.System.Graphics
}
///
- /// Creates a bitmaps from a byte array in the format of a bitmap file.
+ /// Create new inctanse of the class, with a specified image data byte array.
/// WARNING: Unitl IL2CPU problems have been fixed, Memory Streams do not work
///
- ///
+ /// byte array.
+ /// Thrown if imageData is null / memory error.
+ /// Thrown on memory error.
+ /// Thrown on fatal error (contact support).
+ /// Thrown on IO error.
+ /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error (contact support).
+ ///
+ ///
+ /// - Thrown if header is not from a BMP.
+ /// - Info header size has the wrong value.
+ /// - Number of planes is not 1.
+ /// - Total Image Size is smaller than pure image size.
+ ///
+ ///
+ /// Thrown if pixelsize is other then 32 / 24 or the file compressed.
public Bitmap(byte[] imageData) : base(0, 0, ColorDepth.ColorDepth32) //Call the image constructor with wrong values
{
using (var ms = new MemoryStream(imageData))