diff --git a/src/Umbraco.Web.Common/ImageProcessors/CropWebProcessor.cs b/src/Umbraco.Web.Common/ImageProcessors/CropWebProcessor.cs index fec27a8591..3fe4db8344 100644 --- a/src/Umbraco.Web.Common/ImageProcessors/CropWebProcessor.cs +++ b/src/Umbraco.Web.Common/ImageProcessors/CropWebProcessor.cs @@ -41,6 +41,13 @@ namespace Umbraco.Cms.Web.Common.ImageProcessors public IEnumerable Commands { get; } = CropCommands; + /// + /// Gets a rectangle that is calculated from crop coordinates. + /// + /// The width of the image being cropped. + /// The height of the image being cropped. + /// Coordinate set to calculate rectangle from. + /// Rectangle with the position and sized described in coordinates. private static Rectangle GetCropRectangle(int width, int height, ImageCropperCropCoordinates coordinates) { // Get coordinates of top left corner of the rectangle @@ -57,8 +64,20 @@ namespace Umbraco.Cms.Web.Common.ImageProcessors return new Rectangle(topX, topY, cropWidth, cropHeight); } + /// + /// Converts a decimal to an int with rounding. + /// + /// Decimal to convert. + /// The decimal rounded to an int. private static int RoundToInt(decimal number) => decimal.ToInt32(Math.Round(number)); + /// + /// Gets the crop coordinates from the query string. + /// + /// Commands dictionary to parse the coordinates from. + /// Parser provided by imagesharp. + /// Culture to use for parsing. + /// Coordinates of the crop. private static ImageCropperCropCoordinates GetCropCoordinates(IDictionary commands, CommandParser parser, CultureInfo culture) { decimal[] crops = parser.ParseValue(commands.GetValueOrDefault(Crop), culture);