Skip to content

Layer Requirements

The following layer requirement class attributes are currently defined.

[AttributeUsage(AttributeTargets.Class)]
public abstract class LayerRequirementAttribute : Attribute
{

}

/// <summary>
/// The project width has to be greater than or equal to the given minimum width.
/// </summary>
public class MinWidth : LayerRequirementAttribute
{
    public int Width { get; }

    public MinWidth(int width)
    {
        Width = width;
    }
}

/// <summary>
/// The project width has to be less than or equal to the given maximum width.
/// </summary>
public class MaxWidth : LayerRequirementAttribute
{
    public int Width { get; }

    public MaxWidth(int width)
    {
        Width = width;
    }
}

/// <summary>
/// The project height has to be greater than or equal to the given minimum height.
/// </summary>
public class MinHeight : LayerRequirementAttribute
{
    public int Height { get; }

    public MinHeight(int height)
    {
        Height = height;
    }
}

/// <summary>
/// The project height has to be less than or equal to the given maximum height.
/// </summary>
public class MaxHeight : LayerRequirementAttribute
{
    public int Height { get; }

    public MaxHeight(int height)
    {
        Height = height;
    }
}

/// <summary>
/// The project width has to be greater than or equal to the given minimum width
/// and project height has to be greater than or equal to the given minimum height.
/// </summary>
public class MinDimensions : LayerRequirementAttribute
{
    public int Width { get; }
    public int Height { get; }

    public MinDimensions(int width, int height)
    {
        Width = width;
        Height = height;
    }
}

/// <summary>
/// The project width has to be less than or equal to the given maximum width
/// and project height has to be less than or equal to the given maximum height.
/// </summary>
public class MaxDimensions : LayerRequirementAttribute
{
    public int Width { get; }
    public int Height { get; }

    public MaxDimensions(int width, int height)
    {
        Width = width;
        Height = height;
    }
}

/// <summary>
/// The project width has to be equal to the given fixed width.
/// </summary>
public class FixedWidth : LayerRequirementAttribute
{
    public int Width { get; }

    public FixedWidth(int width)
    {
        Width = width;
    }
}

/// <summary>
/// The project height has to be equal to the given fixed height.
/// </summary>
public class FixedHeight : LayerRequirementAttribute
{
    public int Height { get; }

    public FixedHeight(int height)
    {
        Height = height;
    }
}

/// <summary>
/// The project width and height have to be equal to the given
/// fixed width and height, respectively.
/// </summary>
public class FixedDimensions : LayerRequirementAttribute
{
    public int Width { get; }
    public int Height { get; }

    public FixedDimensions(int width, int height)
    {
        Width = width;
        Height = height;
    }
}

/// <summary>
/// The number of pixels in the project has to be greater than
/// or equal to the given minimum number of pixels.
/// </summary>
public class MinNumberOfPixels : LayerRequirementAttribute
{
    public int NumberOfPixels { get; }

    public MinNumberOfPixels(int numberOfPixels)
    {
        NumberOfPixels = numberOfPixels;
    }
}

/// <summary>
/// The number of pixels in the project has to be less than
/// or equal to the given maximum number of pixels.
/// </summary>
public class MaxNumberOfPixels : LayerRequirementAttribute
{
    public int NumberOfPixels { get; }

    public MaxNumberOfPixels(int numberOfPixels)
    {
        NumberOfPixels = numberOfPixels;
    }
}

/// <summary>
/// The number of pixels in the project has to be equal
/// to the given fixed number of pixels.
/// </summary>
public class FixedNumberOfPixels : LayerRequirementAttribute
{
    public int NumberOfPixels { get; }

    public FixedNumberOfPixels(int numberOfPixels)
    {
        NumberOfPixels = numberOfPixels;
    }
}

/// <summary>
/// The aspect ratio of the project has to be greater than
/// or equal to the given minimum aspect ratio.
/// </summary>
public class MinAspectRatio : LayerRequirementAttribute
{
    public float AspectRatio { get; }

    public MinAspectRatio(int aspectRatio)
    {
        AspectRatio = aspectRatio;
    }

    public MinAspectRatio(int width, int height)
    {
        AspectRatio = (float) width / height;
    }
}

/// <summary>
/// The aspect ratio of the project has to be less than
/// or equal to the given maximum aspect ratio.
/// </summary>
public class MaxAspectRatio : LayerRequirementAttribute
{
    public float AspectRatio { get; }

    public MaxAspectRatio(int aspectRatio)
    {
        AspectRatio = aspectRatio;
    }
    public MaxAspectRatio(int width, int height)
    {
        AspectRatio = (float)width / height;
    }
}

/// <summary>
/// The aspect ratio of the project has to be equal to
/// the given fixed aspect ratio.
/// </summary>
public class FixedAspectRatio : LayerRequirementAttribute
{
    public float AspectRatio { get; }

    public FixedAspectRatio(int aspectRatio)
    {
        AspectRatio = aspectRatio;
    }
    public FixedAspectRatio(int width, int height)
    {
        AspectRatio = (float)width / height;
    }
}

/// <summary>
/// The aspect ratio of the project has to be greater than
/// or equal to 1. Thus, the project width has to be greater
/// than or equal to the project height.
/// </summary>
public class LandscapeAspectRatio : LayerRequirementAttribute
{

}

/// <summary>
/// The aspect ratio of the project has to be less than or
/// equal to 1. Thus, the project width has to be less than
/// or equal to the project height.
/// </summary>
public class PortraitAspectRatio : LayerRequirementAttribute
{

}