Этап 2
This commit is contained in:
42
Minint.Core/Models/MinintLayer.cs
Normal file
42
Minint.Core/Models/MinintLayer.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
namespace Minint.Core.Models;
|
||||
|
||||
/// <summary>
|
||||
/// A single raster layer. Pixels are indices into the parent document's palette.
|
||||
/// Array layout is row-major: Pixels[y * width + x].
|
||||
/// </summary>
|
||||
public sealed class MinintLayer
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool IsVisible { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Per-layer opacity (0 = fully transparent, 255 = fully opaque).
|
||||
/// Used during compositing: effective alpha = paletteColor.A * Opacity / 255.
|
||||
/// </summary>
|
||||
public byte Opacity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Palette indices, length must equal container Width * Height.
|
||||
/// Index 0 = transparent by convention.
|
||||
/// </summary>
|
||||
public int[] Pixels { get; }
|
||||
|
||||
public MinintLayer(string name, int pixelCount)
|
||||
{
|
||||
Name = name;
|
||||
IsVisible = true;
|
||||
Opacity = 255;
|
||||
Pixels = new int[pixelCount];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for deserialization — accepts a pre-filled pixel buffer.
|
||||
/// </summary>
|
||||
public MinintLayer(string name, bool isVisible, byte opacity, int[] pixels)
|
||||
{
|
||||
Name = name;
|
||||
IsVisible = isVisible;
|
||||
Opacity = opacity;
|
||||
Pixels = pixels;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user