// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) James South.
// Licensed under the Apache License, Version 2.0.
//
//
// Encapsulates the properties required to crop an image.
//
// --------------------------------------------------------------------------------------------------------------------
namespace ImageProcessor.Imaging
{
using System;
///
/// Encapsulates the properties required to crop an image.
///
public class CropLayer
{
///
/// Initializes a new instance of the class.
///
///
/// The left coordinate of the crop layer.
///
///
/// The top coordinate of the crop layer.
///
///
/// The right coordinate of the crop layer.
///
///
/// The bottom coordinate of the crop layer.
///
///
/// The .
///
///
/// If the is set to CropMode.Percentage then the four coordinates
/// become percentages to reduce from each edge.
///
public CropLayer(float left, float top, float right, float bottom, CropMode cropMode = CropMode.Percentage)
{
if (left < 0 || top < 0 || right < 0 || bottom < 0)
{
throw new ArgumentOutOfRangeException();
}
this.Left = left;
this.Top = top;
this.Right = right;
this.Bottom = bottom;
this.CropMode = cropMode;
}
///
/// Gets or sets the left coordinate of the crop layer.
///
public float Left { get; set; }
///
/// Gets or sets the top coordinate of the crop layer.
///
public float Top { get; set; }
///
/// Gets or sets the right coordinate of the crop layer.
///
public float Right { get; set; }
///
/// Gets or sets the bottom coordinate of the crop layer.
///
public float Bottom { get; set; }
///
/// Gets or sets the .
///
public CropMode CropMode { get; set; }
}
}