// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using System.Runtime.CompilerServices;
namespace SixLabors.PolygonClipper {
///
/// Provides helper methods for querying values.
///
internal static class PathCommandExtensions
{
///
/// Returns whether the command emits a vertex coordinate.
///
/// The command to evaluate.
///
/// when the command is a vertex-emitting command; otherwise, .
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool Vertex(this PathCommand command) => command is >= PathCommand.MoveTo and < PathCommand.EndPoly;
///
/// Returns whether the command is .
///
/// The command to evaluate.
/// if the command is stop; otherwise, .
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool Stop(this PathCommand command) => command == PathCommand.Stop;
///
/// Returns whether the command is .
///
/// The command to evaluate.
/// if the command is move-to; otherwise, .
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool MoveTo(this PathCommand command) => command == PathCommand.MoveTo;
///
/// Returns whether the masked command type is .
///
/// The command to evaluate.
/// if the command type is end-poly; otherwise, .
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool EndPoly(this PathCommand command) => (command & PathCommand.Mask) == PathCommand.EndPoly;
///
/// Extracts the close-path flag from the command.
///
/// The command to evaluate.
/// The command value masked with .
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int GetCloseFlag(this PathCommand command) => (int)command & (int)PathFlags.Close;
}
}