//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp.Drawing.Processors
{
using System;
using System.Buffers;
using System.Numerics;
using System.Threading.Tasks;
using Drawing;
using ImageSharp.Processing;
using SixLabors.Shapes;
using Rectangle = ImageSharp.Rectangle;
///
/// Extension methods for helping to bridge Shaper2D and ImageSharp primitives.
///
internal static class RectangleExtensions
{
///
/// Converts a Shaper2D to an ImageSharp by creating a the entirely surrounds the source.
///
/// The source.
/// A representation of this
public static Rectangle Convert(this SixLabors.Shapes.Rectangle source)
{
int left = (int)Math.Floor(source.Left);
int right = (int)Math.Ceiling(source.Right);
int top = (int)Math.Floor(source.Top);
int bottom = (int)Math.Ceiling(source.Bottom);
return new Rectangle(left, top, right - left, bottom - top);
}
}
}