|
|
|
@ -22,6 +22,7 @@ namespace SixLabors.ImageSharp |
|
|
|
{ |
|
|
|
private readonly Configuration configuration; |
|
|
|
private readonly ImageFrameCollection<TPixel> frames; |
|
|
|
private readonly TPixel? clearColor; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="Image{TPixel}"/> class
|
|
|
|
@ -37,6 +38,21 @@ namespace SixLabors.ImageSharp |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="Image{TPixel}"/> class
|
|
|
|
/// with the height and the width of the image.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="configuration">
|
|
|
|
/// The configuration providing initialization code which allows extending the library.
|
|
|
|
/// </param>
|
|
|
|
/// <param name="width">The width of the image in pixels.</param>
|
|
|
|
/// <param name="height">The height of the image in pixels.</param>
|
|
|
|
/// <param name="clearColor">The color to initialize the pixels with.</param>
|
|
|
|
public Image(Configuration configuration, int width, int height, TPixel clearColor) |
|
|
|
: this(configuration, width, height, clearColor, new ImageMetaData()) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="Image{TPixel}"/> class
|
|
|
|
/// with the height and the width of the image.
|
|
|
|
@ -66,6 +82,25 @@ namespace SixLabors.ImageSharp |
|
|
|
this.frames = new ImageFrameCollection<TPixel>(this, width, height); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="Image{TPixel}"/> class
|
|
|
|
/// with the height and the width of the image.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="configuration">
|
|
|
|
/// The configuration providing initialization code which allows extending the library.
|
|
|
|
/// </param>
|
|
|
|
/// <param name="width">The width of the image in pixels.</param>
|
|
|
|
/// <param name="height">The height of the image in pixels.</param>
|
|
|
|
/// <param name="clearColor">The clear color.</param>
|
|
|
|
/// <param name="metadata">The images metadata.</param>
|
|
|
|
internal Image(Configuration configuration, int width, int height, TPixel clearColor, ImageMetaData metadata) { |
|
|
|
this.configuration = configuration ?? Configuration.Default; |
|
|
|
this.PixelType = new PixelTypeInfo(Unsafe.SizeOf<TPixel>() * 8); |
|
|
|
this.MetaData = metadata ?? new ImageMetaData(); |
|
|
|
this.clearColor = clearColor; |
|
|
|
this.frames = new ImageFrameCollection<TPixel>(this, width, height); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="Image{TPixel}" /> class
|
|
|
|
/// with the height and the width of the image.
|
|
|
|
@ -104,6 +139,11 @@ namespace SixLabors.ImageSharp |
|
|
|
/// </summary>
|
|
|
|
public IImageFrameCollection<TPixel> Frames => this.frames; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the clear color to initialize the image frame pixels with.
|
|
|
|
/// </summary>
|
|
|
|
internal TPixel? ClearColor => this.clearColor; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the root frame.
|
|
|
|
/// </summary>
|
|
|
|
|