Этап 2
This commit is contained in:
35
Minint.Core/Models/MinintContainer.cs
Normal file
35
Minint.Core/Models/MinintContainer.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
namespace Minint.Core.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Top-level container: holds dimensions shared by all documents/layers,
|
||||
/// and a list of documents (frames).
|
||||
/// </summary>
|
||||
public sealed class MinintContainer
|
||||
{
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public List<MinintDocument> Documents { get; }
|
||||
|
||||
public int PixelCount => Width * Height;
|
||||
|
||||
public MinintContainer(int width, int height)
|
||||
{
|
||||
ArgumentOutOfRangeException.ThrowIfLessThan(width, 1);
|
||||
ArgumentOutOfRangeException.ThrowIfLessThan(height, 1);
|
||||
|
||||
Width = width;
|
||||
Height = height;
|
||||
Documents = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new document with a single transparent layer and adds it to the container.
|
||||
/// </summary>
|
||||
public MinintDocument AddNewDocument(string name)
|
||||
{
|
||||
var doc = new MinintDocument(name);
|
||||
doc.Layers.Add(new MinintLayer("Layer 1", PixelCount));
|
||||
Documents.Add(doc);
|
||||
return doc;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user