// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using System; using System.Collections.Generic; namespace SixLabors.ImageSharp.Drawing.Processing.Backends { /// /// One prepared draw-order command batch consumed by a drawing backend. /// public readonly struct DrawingCommandBatch { /// /// Initializes a new instance of the struct. /// /// The draw-order scene commands. /// Indicates whether the command stream contains layer boundaries. public DrawingCommandBatch( IReadOnlyList commands, bool hasLayers) { this.Commands = commands; this.HasLayers = hasLayers; } /// /// Initializes a new instance of the struct. /// /// The backing command buffer. /// The number of commands in the prepared batch. /// Indicates whether the command stream contains layer boundaries. internal DrawingCommandBatch( CompositionSceneCommand[] commands, int commandCount, bool hasLayers) : this(new ArraySegment(commands, 0, commandCount), hasLayers) { } /// /// Initializes a new instance of the struct. /// /// The backing command buffer. /// The first command index. /// The number of commands in the prepared batch. /// Indicates whether the command stream contains layer boundaries. internal DrawingCommandBatch( CompositionSceneCommand[] commands, int startIndex, int commandCount, bool hasLayers) : this(new ArraySegment(commands, startIndex, commandCount), hasLayers) { } /// /// Gets the draw-order scene commands. /// public IReadOnlyList Commands { get; } /// /// Gets the total number of draw-order commands in the scene. /// public int CommandCount => this.Commands.Count; /// /// Gets a value indicating whether this scene contains inline layer commands. /// public bool HasLayers { get; } } }