/// <summary> /// Initializes a new instance of <see cref="Bitmap"/> class with the specified /// array of pixels, width and height. /// </summary> /// <param name="data">The array of pixels of <see cref="Color4"/> type.</param> /// <param name="width">The width, in pixels, of the new bitmap.</param> /// <param name="height">The height, in pixels, of the new bitmap.</param> public Bitmap(Color4[] data, int width, int height) { if (width * height != data.Length) { throw new ArgumentException("Pixel data doesn't fit width and height."); } implementation = new BitmapImplementation(data, width, height); Width = width; Height = height; }
private void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (implementation != null) { implementation.Dispose(); implementation = null; } } disposed = true; } }
/// <summary> /// Initialized a new instance of <see cref="Bitmap"/> class with specified bitmap implementation. /// </summary> /// <param name="implementation">The native implementation of bitmap to wrap by <see cref="Bitmap"/>.</param> private Bitmap(IBitmapImplementation implementation) { this.implementation = implementation; CacheDimensions(); }
/// <summary> /// Initializes a new instance of <see cref="Bitmap"/> class from the specified data stream. /// </summary> /// <param name="stream">The data stream used to load the image.</param> public Bitmap(Stream stream) { implementation = new BitmapImplementation(stream); CacheDimensions(); }