зеркало из https://github.com/SixLabors/Core.git
Fixed new StyleCop issues.
This commit is contained in:
Родитель
45a23d8c2d
Коммит
718ed75227
|
@ -4,7 +4,7 @@
|
|||
namespace SixLabors
|
||||
{
|
||||
/// <summary>
|
||||
/// Common constants used throughout the project
|
||||
/// Common constants used throughout the project.
|
||||
/// </summary>
|
||||
internal static class Constants
|
||||
{
|
||||
|
|
|
@ -18,8 +18,8 @@ namespace SixLabors
|
|||
/// </summary>
|
||||
/// <param name="target">The target object, which cannot be null.</param>
|
||||
/// <param name="parameterName">The name of the parameter that is to be checked.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="target"/> is null</exception>
|
||||
/// <typeparam name="T">The type of the object to verify</typeparam>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="target"/> is null.</exception>
|
||||
/// <typeparam name="T">The type of the object to verify.</typeparam>
|
||||
[Conditional("DEBUG")]
|
||||
public static void NotNull<T>(T target, string parameterName)
|
||||
where T : class
|
||||
|
@ -119,12 +119,12 @@ namespace SixLabors
|
|||
/// <summary>
|
||||
/// Verifies, that the `target` array has declared the length or longer.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The element type of the spans</typeparam>
|
||||
/// <typeparam name="T">The element type of the spans.</typeparam>
|
||||
/// <param name="target">The target array.</param>
|
||||
/// <param name="minLength">The min length the array must have.</param>
|
||||
/// <param name="parameterName">The name of the parameter that is to be checked.</param>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// <paramref name="target"/> is true
|
||||
/// <paramref name="target"/> is true.
|
||||
/// </exception>
|
||||
[Conditional("DEBUG")]
|
||||
public static void MustBeSizedAtLeast<T>(T[] target, int minLength, string parameterName)
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace SixLabors
|
|||
/// <summary>
|
||||
/// Verifies, that the `target` span has the length of 'minLength', or longer.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The element type of the spans</typeparam>
|
||||
/// <typeparam name="T">The element type of the spans.</typeparam>
|
||||
/// <param name="value">The target span.</param>
|
||||
/// <param name="minLength">The minimum length.</param>
|
||||
/// <param name="parameterName">The name of the parameter that is to be checked.</param>
|
||||
|
|
|
@ -219,7 +219,7 @@ namespace System
|
|||
/// <paramref name="f" /> parameter Return value Zero or positive The positive square root of <paramref name="f" />.
|
||||
/// Negative <see cref="F:System.Single.NaN" />Equals <see cref="F:System.Single.NaN" />
|
||||
/// <see cref="F:System.Single.NaN" />Equals <see cref="F:System.Single.PositiveInfinity" />
|
||||
/// <see cref="F:System.Single.PositiveInfinity" />
|
||||
/// <see cref="F:System.Single.PositiveInfinity" />.
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Sqrt(float f)
|
||||
|
|
|
@ -9,7 +9,7 @@ using SixLabors.Memory.Internals;
|
|||
namespace SixLabors.Memory
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains <see cref="Buffer{T}"/> and <see cref="ManagedByteBuffer"/>
|
||||
/// Contains <see cref="Buffer{T}"/> and <see cref="ManagedByteBuffer"/>.
|
||||
/// </summary>
|
||||
public partial class ArrayPoolMemoryAllocator
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ namespace SixLabors.Memory
|
|||
where T : struct
|
||||
{
|
||||
/// <summary>
|
||||
/// The length of the buffer
|
||||
/// The length of the buffer.
|
||||
/// </summary>
|
||||
private readonly int length;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace SixLabors.Memory
|
|||
/// <summary>
|
||||
/// This is the default. Should be good for most use cases.
|
||||
/// </summary>
|
||||
/// <returns>The memory manager</returns>
|
||||
/// <returns>The memory manager.</returns>
|
||||
public static ArrayPoolMemoryAllocator CreateDefault()
|
||||
{
|
||||
return new ArrayPoolMemoryAllocator(
|
||||
|
@ -45,7 +45,7 @@ namespace SixLabors.Memory
|
|||
/// <summary>
|
||||
/// For environments with very limited memory capabilities, only small buffers like image rows are pooled.
|
||||
/// </summary>
|
||||
/// <returns>The memory manager</returns>
|
||||
/// <returns>The memory manager.</returns>
|
||||
public static ArrayPoolMemoryAllocator CreateWithMinimalPooling()
|
||||
{
|
||||
return new ArrayPoolMemoryAllocator(64 * 1024, 32 * 1024, 8, 24);
|
||||
|
@ -54,7 +54,7 @@ namespace SixLabors.Memory
|
|||
/// <summary>
|
||||
/// For environments with limited memory capabilities, only small array requests are pooled, which can result in reduced throughput.
|
||||
/// </summary>
|
||||
/// <returns>The memory manager</returns>
|
||||
/// <returns>The memory manager.</returns>
|
||||
public static ArrayPoolMemoryAllocator CreateWithModeratePooling()
|
||||
{
|
||||
return new ArrayPoolMemoryAllocator(1024 * 1024, 32 * 1024, 16, 24);
|
||||
|
@ -63,7 +63,7 @@ namespace SixLabors.Memory
|
|||
/// <summary>
|
||||
/// For environments where memory capabilities are not an issue, the maximum amount of array requests are pooled which results in optimal throughput.
|
||||
/// </summary>
|
||||
/// <returns>The memory manager</returns>
|
||||
/// <returns>The memory manager.</returns>
|
||||
public static ArrayPoolMemoryAllocator CreateWithAggressivePooling()
|
||||
{
|
||||
return new ArrayPoolMemoryAllocator(128 * 1024 * 1024, 32 * 1024 * 1024, 16, 32);
|
||||
|
|
|
@ -58,8 +58,8 @@ namespace SixLabors.Memory
|
|||
/// </summary>
|
||||
/// <param name="maxPoolSizeInBytes">The maximum size of pooled arrays. Arrays over the thershold are gonna be always allocated.</param>
|
||||
/// <param name="poolSelectorThresholdInBytes">The threshold to pool arrays in <see cref="largeArrayPool"/> which has less buckets for memory safety.</param>
|
||||
/// <param name="maxArraysPerBucketLargePool">Max arrays per bucket for the large array pool</param>
|
||||
/// <param name="maxArraysPerBucketNormalPool">Max arrays per bucket for the normal array pool</param>
|
||||
/// <param name="maxArraysPerBucketLargePool">Max arrays per bucket for the large array pool.</param>
|
||||
/// <param name="maxArraysPerBucketNormalPool">Max arrays per bucket for the normal array pool.</param>
|
||||
public ArrayPoolMemoryAllocator(int maxPoolSizeInBytes, int poolSelectorThresholdInBytes, int maxArraysPerBucketLargePool, int maxArraysPerBucketNormalPool)
|
||||
{
|
||||
Guard.MustBeGreaterThan(maxPoolSizeInBytes, 0, nameof(maxPoolSizeInBytes));
|
||||
|
|
|
@ -14,10 +14,10 @@ namespace SixLabors.Memory.Internals
|
|||
where T : struct
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BasicArrayBuffer{T}"/> class
|
||||
/// Initializes a new instance of the <see cref="BasicArrayBuffer{T}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="array">The array</param>
|
||||
/// <param name="length">The length of the buffer</param>
|
||||
/// <param name="array">The array.</param>
|
||||
/// <param name="length">The length of the buffer.</param>
|
||||
public BasicArrayBuffer(T[] array, int length)
|
||||
{
|
||||
DebugGuard.MustBeLessThanOrEqualTo(length, array.Length, nameof(length));
|
||||
|
@ -26,21 +26,21 @@ namespace SixLabors.Memory.Internals
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BasicArrayBuffer{T}"/> class
|
||||
/// Initializes a new instance of the <see cref="BasicArrayBuffer{T}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="array">The array</param>
|
||||
/// <param name="array">The array.</param>
|
||||
public BasicArrayBuffer(T[] array)
|
||||
: this(array, array.Length)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the array
|
||||
/// Gets the array.
|
||||
/// </summary>
|
||||
public T[] Array { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the length
|
||||
/// Gets the length.
|
||||
/// </summary>
|
||||
public int Length { get; }
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ namespace SixLabors.Memory.Internals
|
|||
internal sealed class BasicByteBuffer : BasicArrayBuffer<byte>, IManagedByteBuffer
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BasicByteBuffer"/> class
|
||||
/// Initializes a new instance of the <see cref="BasicByteBuffer"/> class.
|
||||
/// </summary>
|
||||
/// <param name="array">The byte array</param>
|
||||
/// <param name="array">The byte array.</param>
|
||||
internal BasicByteBuffer(byte[] array)
|
||||
: base(array)
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace SixLabors.Memory.Internals
|
|||
/// <summary>
|
||||
/// Provides a base class for <see cref="IMemoryOwner{T}"/> implementations by implementing pinning logic for <see cref="MemoryManager{T}"/> adaption.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The element type</typeparam>
|
||||
/// <typeparam name="T">The element type.</typeparam>
|
||||
internal abstract class ManagedBufferBase<T> : MemoryManager<T>
|
||||
where T : struct
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ namespace SixLabors.Memory.Internals
|
|||
/// <summary>
|
||||
/// Gets the object that should be pinned.
|
||||
/// </summary>
|
||||
/// <returns>The pinnable <see cref="object"/></returns>
|
||||
/// <returns>The pinnable <see cref="object"/>.</returns>
|
||||
protected abstract object GetPinnableObject();
|
||||
}
|
||||
}
|
|
@ -13,8 +13,8 @@ namespace SixLabors.Memory
|
|||
/// <summary>
|
||||
/// Allocates an <see cref="IMemoryOwner{T}" />, holding a <see cref="System.Memory{T}"/> of length <paramref name="length"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of the data stored in the buffer</typeparam>
|
||||
/// <param name="length">Size of the buffer to allocate</param>
|
||||
/// <typeparam name="T">Type of the data stored in the buffer.</typeparam>
|
||||
/// <param name="length">Size of the buffer to allocate.</param>
|
||||
/// <param name="options">The allocation options.</param>
|
||||
/// <returns>A buffer of values of type <typeparamref name="T"/>.</returns>
|
||||
public abstract IMemoryOwner<T> Allocate<T>(int length, AllocationOptions options = AllocationOptions.None)
|
||||
|
@ -23,9 +23,9 @@ namespace SixLabors.Memory
|
|||
/// <summary>
|
||||
/// Allocates an <see cref="IManagedByteBuffer"/>.
|
||||
/// </summary>
|
||||
/// <param name="length">The requested buffer length</param>
|
||||
/// <param name="length">The requested buffer length.</param>
|
||||
/// <param name="options">The allocation options.</param>
|
||||
/// <returns>The <see cref="IManagedByteBuffer"/></returns>
|
||||
/// <returns>The <see cref="IManagedByteBuffer"/>.</returns>
|
||||
public abstract IManagedByteBuffer AllocateManagedByteBuffer(int length, AllocationOptions options = AllocationOptions.None);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Point"/> struct from the given <see cref="Size"/>.
|
||||
/// </summary>
|
||||
/// <param name="size">The size</param>
|
||||
/// <param name="size">The size.</param>
|
||||
public Point(Size size)
|
||||
{
|
||||
this.X = size.Width;
|
||||
|
@ -75,21 +75,21 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Creates a <see cref="PointF"/> with the coordinates of the specified <see cref="Point"/>.
|
||||
/// </summary>
|
||||
/// <param name="point">The point</param>
|
||||
/// <param name="point">The point.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator PointF(Point point) => new PointF(point.X, point.Y);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="Vector2"/> with the coordinates of the specified <see cref="Point"/>.
|
||||
/// </summary>
|
||||
/// <param name="point">The point</param>
|
||||
/// <param name="point">The point.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Vector2(Point point) => new Vector2(point.X, point.Y);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="Size"/> with the coordinates of the specified <see cref="Point"/>.
|
||||
/// </summary>
|
||||
/// <param name="point">The point</param>
|
||||
/// <param name="point">The point.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator Size(Point point) => new Size(point.X, point.Y);
|
||||
|
||||
|
@ -106,7 +106,7 @@ namespace SixLabors.Primitives
|
|||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="size">The size on the right hand of the operand.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="Point"/>
|
||||
/// The <see cref="Point"/>.
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Point operator +(Point point, Size size) => Add(point, size);
|
||||
|
@ -116,7 +116,7 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="size">The size on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="Point"/></returns>
|
||||
/// <returns>The <see cref="Point"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Point operator -(Point point, Size size) => Subtract(point, size);
|
||||
|
||||
|
@ -172,16 +172,16 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="size">The size on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="Point"/></returns>
|
||||
/// <returns>The <see cref="Point"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Point Add(Point point, Size size) => new Point(unchecked(point.X + size.Width), unchecked(point.Y + size.Height));
|
||||
|
||||
/// <summary>
|
||||
/// Translates a <see cref="Point"/> by the negative of a given value
|
||||
/// Translates a <see cref="Point"/> by the negative of a given value.
|
||||
/// </summary>
|
||||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="value">The value on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="Point"/></returns>
|
||||
/// <returns>The <see cref="Point"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Point Multiply(Point point, int value) => new Point(unchecked(point.X * value), unchecked(point.Y * value));
|
||||
|
||||
|
@ -190,56 +190,56 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="size">The size on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="Point"/></returns>
|
||||
/// <returns>The <see cref="Point"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Point Subtract(Point point, Size size) => new Point(unchecked(point.X - size.Width), unchecked(point.Y - size.Height));
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="PointF"/> to a <see cref="Point"/> by performing a ceiling operation on all the coordinates.
|
||||
/// </summary>
|
||||
/// <param name="point">The point</param>
|
||||
/// <returns>The <see cref="Point"/></returns>
|
||||
/// <param name="point">The point.</param>
|
||||
/// <returns>The <see cref="Point"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Point Ceiling(PointF point) => new Point(unchecked((int)MathF.Ceiling(point.X)), unchecked((int)MathF.Ceiling(point.Y)));
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="PointF"/> to a <see cref="Point"/> by performing a round operation on all the coordinates.
|
||||
/// </summary>
|
||||
/// <param name="point">The point</param>
|
||||
/// <returns>The <see cref="Point"/></returns>
|
||||
/// <param name="point">The point.</param>
|
||||
/// <returns>The <see cref="Point"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Point Round(PointF point) => new Point(unchecked((int)MathF.Round(point.X)), unchecked((int)MathF.Round(point.Y)));
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="Vector2"/> to a <see cref="Point"/> by performing a round operation on all the coordinates.
|
||||
/// </summary>
|
||||
/// <param name="vector">The vector</param>
|
||||
/// <returns>The <see cref="Point"/></returns>
|
||||
/// <param name="vector">The vector.</param>
|
||||
/// <returns>The <see cref="Point"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Point Round(Vector2 vector) => new Point(unchecked((int)MathF.Round(vector.X)), unchecked((int)MathF.Round(vector.Y)));
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="PointF"/> to a <see cref="Point"/> by performing a truncate operation on all the coordinates.
|
||||
/// </summary>
|
||||
/// <param name="point">The point</param>
|
||||
/// <returns>The <see cref="Point"/></returns>
|
||||
/// <param name="point">The point.</param>
|
||||
/// <returns>The <see cref="Point"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Point Truncate(PointF point) => new Point(unchecked((int)point.X), unchecked((int)point.Y));
|
||||
|
||||
/// <summary>
|
||||
/// Transforms a point by a specified 3x2 matrix.
|
||||
/// </summary>
|
||||
/// <param name="point">The point to transform</param>
|
||||
/// <param name="matrix">The transformation matrix used</param>
|
||||
/// <returns>The transformed <see cref="PointF"/></returns>
|
||||
/// <param name="point">The point to transform.</param>
|
||||
/// <param name="matrix">The transformation matrix used.</param>
|
||||
/// <returns>The transformed <see cref="PointF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Point Transform(Point point, Matrix3x2 matrix) => Round(Vector2.Transform(new Vector2(point.X, point.Y), matrix));
|
||||
|
||||
/// <summary>
|
||||
/// Deconstructs this point into two integers
|
||||
/// Deconstructs this point into two integers.
|
||||
/// </summary>
|
||||
/// <param name="x">The out value for X</param>
|
||||
/// <param name="y">The out value for Y</param>
|
||||
/// <param name="x">The out value for X.</param>
|
||||
/// <param name="y">The out value for Y.</param>
|
||||
public void Deconstruct(out int x, out int y)
|
||||
{
|
||||
x = this.X;
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PointF"/> struct from the given <see cref="SizeF"/>.
|
||||
/// </summary>
|
||||
/// <param name="size">The size</param>
|
||||
/// <param name="size">The size.</param>
|
||||
public PointF(SizeF size)
|
||||
{
|
||||
this.X = size.Width;
|
||||
|
@ -104,7 +104,7 @@ namespace SixLabors.Primitives
|
|||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="size">The size on the right hand of the operand.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="PointF"/>
|
||||
/// The <see cref="PointF"/>.
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static PointF operator +(PointF point, SizeF size) => Add(point, size);
|
||||
|
@ -114,7 +114,7 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="size">The size on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="PointF"/></returns>
|
||||
/// <returns>The <see cref="PointF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static PointF operator -(PointF point, PointF size) => Subtract(point, size);
|
||||
|
||||
|
@ -124,7 +124,7 @@ namespace SixLabors.Primitives
|
|||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="size">The size on the right hand of the operand.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="PointF"/>
|
||||
/// The <see cref="PointF"/>.
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static PointF operator +(PointF point, PointF size) => Add(point, size);
|
||||
|
@ -134,7 +134,7 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="size">The size on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="PointF"/></returns>
|
||||
/// <returns>The <see cref="PointF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static PointF operator -(PointF point, SizeF size) => Subtract(point, size);
|
||||
|
||||
|
@ -198,7 +198,7 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="size">The size on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="PointF"/></returns>
|
||||
/// <returns>The <see cref="PointF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static PointF Add(PointF point, SizeF size) => new PointF(point.X + size.Width, point.Y + size.Height);
|
||||
|
||||
|
@ -207,7 +207,7 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="pointb">The point on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="PointF"/></returns>
|
||||
/// <returns>The <see cref="PointF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static PointF Add(PointF point, PointF pointb) => new PointF(point.X + pointb.X, point.Y + pointb.Y);
|
||||
|
||||
|
@ -216,7 +216,7 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="size">The size on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="PointF"/></returns>
|
||||
/// <returns>The <see cref="PointF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static PointF Subtract(PointF point, SizeF size) => new PointF(point.X - size.Width, point.Y - size.Height);
|
||||
|
||||
|
@ -225,7 +225,7 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="pointb">The point on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="PointF"/></returns>
|
||||
/// <returns>The <see cref="PointF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static PointF Subtract(PointF point, PointF pointb) => new PointF(point.X - pointb.X, point.Y - pointb.Y);
|
||||
|
||||
|
@ -234,24 +234,24 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="point">The point on the left hand of the operand.</param>
|
||||
/// <param name="right">The value on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="PointF"/></returns>
|
||||
/// <returns>The <see cref="PointF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static PointF Multiply(PointF point, float right) => new PointF(point.X * right, point.Y * right);
|
||||
|
||||
/// <summary>
|
||||
/// Transforms a point by a specified 3x2 matrix.
|
||||
/// </summary>
|
||||
/// <param name="point">The point to transform</param>
|
||||
/// <param name="matrix">The transformation matrix used</param>
|
||||
/// <returns>The transformed <see cref="PointF"/></returns>
|
||||
/// <param name="point">The point to transform.</param>
|
||||
/// <param name="matrix">The transformation matrix used.</param>
|
||||
/// <returns>The transformed <see cref="PointF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static PointF Transform(PointF point, Matrix3x2 matrix) => Vector2.Transform(point, matrix);
|
||||
|
||||
/// <summary>
|
||||
/// Deconstructs this point into two floats
|
||||
/// Deconstructs this point into two floats.
|
||||
/// </summary>
|
||||
/// <param name="x">The out value for X</param>
|
||||
/// <param name="y">The out value for Y</param>
|
||||
/// <param name="x">The out value for X.</param>
|
||||
/// <param name="y">The out value for Y.</param>
|
||||
public void Deconstruct(out float x, out float y)
|
||||
{
|
||||
x = this.X;
|
||||
|
|
|
@ -145,14 +145,14 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Creates a <see cref="RectangleF"/> with the coordinates of the specified <see cref="Rectangle"/>.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator RectangleF(Rectangle rectangle) => new RectangleF(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="Vector4"/> with the coordinates of the specified <see cref="Rectangle"/>.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Vector4(Rectangle rectangle) => new Vector4(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
|
||||
|
||||
|
@ -180,21 +180,21 @@ namespace SixLabors.Primitives
|
|||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Rectangle"/> with the specified location and size. </summary>
|
||||
/// <param name="left">The left coordinate of the rectangle</param>
|
||||
/// <param name="top">The top coordinate of the rectangle</param>
|
||||
/// <param name="right">The right coordinate of the rectangle</param>
|
||||
/// <param name="bottom">The bottom coordinate of the rectangle</param>
|
||||
/// <returns>The <see cref="Rectangle"/></returns>
|
||||
/// <param name="left">The left coordinate of the rectangle.</param>
|
||||
/// <param name="top">The top coordinate of the rectangle.</param>
|
||||
/// <param name="right">The right coordinate of the rectangle.</param>
|
||||
/// <param name="bottom">The bottom coordinate of the rectangle.</param>
|
||||
/// <returns>The <see cref="Rectangle"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static Rectangle FromLTRB(int left, int top, int right, int bottom) => new Rectangle(left, top, unchecked(right - left), unchecked(bottom - top));
|
||||
|
||||
/// <summary>
|
||||
/// Returns the center point of the given <see cref="Rectangle"/>
|
||||
/// Returns the center point of the given <see cref="Rectangle"/>.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <returns>The <see cref="Point"/></returns>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
/// <returns>The <see cref="Point"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Point Center(Rectangle rectangle) => new Point(rectangle.Left + (rectangle.Width / 2), rectangle.Top + (rectangle.Height / 2));
|
||||
|
||||
|
@ -202,9 +202,9 @@ namespace SixLabors.Primitives
|
|||
/// Creates a rectangle that represents the intersection between <paramref name="a"/> and
|
||||
/// <paramref name="b"/>. If there is no intersection, an empty rectangle is returned.
|
||||
/// </summary>
|
||||
/// <param name="a">The first rectangle</param>
|
||||
/// <param name="b">The second rectangle</param>
|
||||
/// <returns>The <see cref="Rectangle"/></returns>
|
||||
/// <param name="a">The first rectangle.</param>
|
||||
/// <param name="b">The second rectangle.</param>
|
||||
/// <returns>The <see cref="Rectangle"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Rectangle Intersect(Rectangle a, Rectangle b)
|
||||
{
|
||||
|
@ -224,10 +224,10 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Creates a <see cref="Rectangle"/> that is inflated by the specified amount.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <param name="x">The amount to inflate the width by</param>
|
||||
/// <param name="y">The amount to inflate the height by</param>
|
||||
/// <returns>A new <see cref="Rectangle"/></returns>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
/// <param name="x">The amount to inflate the width by.</param>
|
||||
/// <param name="y">The amount to inflate the height by.</param>
|
||||
/// <returns>A new <see cref="Rectangle"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Rectangle Inflate(Rectangle rectangle, int x, int y)
|
||||
{
|
||||
|
@ -239,8 +239,8 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Converts a <see cref="RectangleF"/> to a <see cref="Rectangle"/> by performing a ceiling operation on all the coordinates.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <returns>The <see cref="Rectangle"/></returns>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
/// <returns>The <see cref="Rectangle"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Rectangle Ceiling(RectangleF rectangle)
|
||||
{
|
||||
|
@ -270,8 +270,8 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Converts a <see cref="RectangleF"/> to a <see cref="Rectangle"/> by performing a truncate operation on all the coordinates.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <returns>The <see cref="Rectangle"/></returns>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
/// <returns>The <see cref="Rectangle"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Rectangle Truncate(RectangleF rectangle)
|
||||
{
|
||||
|
@ -288,8 +288,8 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Converts a <see cref="RectangleF"/> to a <see cref="Rectangle"/> by performing a round operation on all the coordinates.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <returns>The <see cref="Rectangle"/></returns>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
/// <returns>The <see cref="Rectangle"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Rectangle Round(RectangleF rectangle)
|
||||
{
|
||||
|
@ -306,9 +306,9 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Creates a rectangle that represents the union between <paramref name="a"/> and <paramref name="b"/>.
|
||||
/// </summary>
|
||||
/// <param name="a">The first rectangle</param>
|
||||
/// <param name="b">The second rectangle</param>
|
||||
/// <returns>The <see cref="Rectangle"/></returns>
|
||||
/// <param name="a">The first rectangle.</param>
|
||||
/// <param name="b">The second rectangle.</param>
|
||||
/// <returns>The <see cref="Rectangle"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Rectangle Union(Rectangle a, Rectangle b)
|
||||
{
|
||||
|
@ -321,12 +321,12 @@ namespace SixLabors.Primitives
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deconstructs this rectangle into four integers
|
||||
/// Deconstructs this rectangle into four integers.
|
||||
/// </summary>
|
||||
/// <param name="x">The out value for X</param>
|
||||
/// <param name="y">The out value for Y</param>
|
||||
/// <param name="width">The out value for the width</param>
|
||||
/// <param name="height">The out value for the height</param>
|
||||
/// <param name="x">The out value for X.</param>
|
||||
/// <param name="y">The out value for Y.</param>
|
||||
/// <param name="width">The out value for the width.</param>
|
||||
/// <param name="height">The out value for the height.</param>
|
||||
public void Deconstruct(out int x, out int y, out int width, out int height)
|
||||
{
|
||||
x = this.X;
|
||||
|
@ -338,7 +338,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Creates a Rectangle that represents the intersection between this Rectangle and the <paramref name="rectangle"/>.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Intersect(Rectangle rectangle)
|
||||
{
|
||||
|
@ -353,8 +353,8 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Inflates this <see cref="Rectangle"/> by the specified amount.
|
||||
/// </summary>
|
||||
/// <param name="width">The width</param>
|
||||
/// <param name="height">The height</param>
|
||||
/// <param name="width">The width.</param>
|
||||
/// <param name="height">The height.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Inflate(int width, int height)
|
||||
{
|
||||
|
@ -371,7 +371,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Inflates this <see cref="Rectangle"/> by the specified amount.
|
||||
/// </summary>
|
||||
/// <param name="size">The size</param>
|
||||
/// <param name="size">The size.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Inflate(Size size) => this.Inflate(size.Width, size.Height);
|
||||
|
||||
|
@ -381,15 +381,15 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="x">The x-coordinate of the given point.</param>
|
||||
/// <param name="y">The y-coordinate of the given point.</param>
|
||||
/// <returns>The <see cref="bool"/></returns>
|
||||
/// <returns>The <see cref="bool"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Contains(int x, int y) => this.X <= x && x < this.Right && this.Y <= y && y < this.Bottom;
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the specified point is contained within the rectangular region defined by this <see cref="Rectangle"/> .
|
||||
/// </summary>
|
||||
/// <param name="point">The point</param>
|
||||
/// <returns>The <see cref="bool"/></returns>
|
||||
/// <param name="point">The point.</param>
|
||||
/// <returns>The <see cref="bool"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Contains(Point point) => this.Contains(point.X, point.Y);
|
||||
|
||||
|
@ -397,8 +397,8 @@ namespace SixLabors.Primitives
|
|||
/// Determines if the rectangular region represented by <paramref name="rectangle"/> is entirely contained
|
||||
/// within the rectangular region represented by this <see cref="Rectangle"/> .
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <returns>The <see cref="bool"/></returns>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
/// <returns>The <see cref="bool"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Contains(Rectangle rectangle) =>
|
||||
(this.X <= rectangle.X) && (rectangle.Right <= this.Right) &&
|
||||
|
@ -408,8 +408,8 @@ namespace SixLabors.Primitives
|
|||
/// Determines if the specfied <see cref="Rectangle"/> intersects the rectangular region defined by
|
||||
/// this <see cref="Rectangle"/>.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The other Rectange </param>
|
||||
/// <returns>The <see cref="bool"/></returns>
|
||||
/// <param name="rectangle">The other Rectange. </param>
|
||||
/// <returns>The <see cref="bool"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool IntersectsWith(Rectangle rectangle) =>
|
||||
(rectangle.X < this.Right) && (this.X < rectangle.Right) &&
|
||||
|
@ -418,7 +418,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Adjusts the location of this rectangle by the specified amount.
|
||||
/// </summary>
|
||||
/// <param name="point">The point</param>
|
||||
/// <param name="point">The point.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Offset(Point point) => this.Offset(point.X, point.Y);
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Creates a <see cref="Rectangle"/> with the coordinates of the specified <see cref="RectangleF"/> by truncating each coordinate.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator Rectangle(RectangleF rectangle) => Rectangle.Truncate(rectangle);
|
||||
|
||||
|
@ -173,21 +173,21 @@ namespace SixLabors.Primitives
|
|||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="RectangleF"/> with the specified location and size. </summary>
|
||||
/// <param name="left">The left coordinate of the rectangle</param>
|
||||
/// <param name="top">The top coordinate of the rectangle</param>
|
||||
/// <param name="right">The right coordinate of the rectangle</param>
|
||||
/// <param name="bottom">The bottom coordinate of the rectangle</param>
|
||||
/// <returns>The <see cref="RectangleF"/></returns>
|
||||
/// <param name="left">The left coordinate of the rectangle.</param>
|
||||
/// <param name="top">The top coordinate of the rectangle.</param>
|
||||
/// <param name="right">The right coordinate of the rectangle.</param>
|
||||
/// <param name="bottom">The bottom coordinate of the rectangle.</param>
|
||||
/// <returns>The <see cref="RectangleF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static RectangleF FromLTRB(float left, float top, float right, float bottom) => new RectangleF(left, top, right - left, bottom - top);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the center point of the given <see cref="RectangleF"/>
|
||||
/// Returns the center point of the given <see cref="RectangleF"/>.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <returns>The <see cref="Point"/></returns>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
/// <returns>The <see cref="Point"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static PointF Center(RectangleF rectangle) => new PointF(rectangle.Left + (rectangle.Width / 2), rectangle.Top + (rectangle.Height / 2));
|
||||
|
||||
|
@ -195,9 +195,9 @@ namespace SixLabors.Primitives
|
|||
/// Creates a rectangle that represents the intersection between <paramref name="a"/> and
|
||||
/// <paramref name="b"/>. If there is no intersection, an empty rectangle is returned.
|
||||
/// </summary>
|
||||
/// <param name="a">The first rectangle</param>
|
||||
/// <param name="b">The second rectangle</param>
|
||||
/// <returns>The <see cref="RectangleF"/></returns>
|
||||
/// <param name="a">The first rectangle.</param>
|
||||
/// <param name="b">The second rectangle.</param>
|
||||
/// <returns>The <see cref="RectangleF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static RectangleF Intersect(RectangleF a, RectangleF b)
|
||||
{
|
||||
|
@ -217,10 +217,10 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Creates a <see cref="RectangleF"/> that is inflated by the specified amount.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <param name="x">The amount to inflate the width by</param>
|
||||
/// <param name="y">The amount to inflate the height by</param>
|
||||
/// <returns>A new <see cref="RectangleF"/></returns>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
/// <param name="x">The amount to inflate the width by.</param>
|
||||
/// <param name="y">The amount to inflate the height by.</param>
|
||||
/// <returns>A new <see cref="RectangleF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static RectangleF Inflate(RectangleF rectangle, float x, float y)
|
||||
{
|
||||
|
@ -245,9 +245,9 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Creates a rectangle that represents the union between <paramref name="a"/> and <paramref name="b"/>.
|
||||
/// </summary>
|
||||
/// <param name="a">The first rectangle</param>
|
||||
/// <param name="b">The second rectangle</param>
|
||||
/// <returns>The <see cref="RectangleF"/></returns>
|
||||
/// <param name="a">The first rectangle.</param>
|
||||
/// <param name="b">The second rectangle.</param>
|
||||
/// <returns>The <see cref="RectangleF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static RectangleF Union(RectangleF a, RectangleF b)
|
||||
{
|
||||
|
@ -260,12 +260,12 @@ namespace SixLabors.Primitives
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deconstructs this rectangle into four floats
|
||||
/// Deconstructs this rectangle into four floats.
|
||||
/// </summary>
|
||||
/// <param name="x">The out value for X</param>
|
||||
/// <param name="y">The out value for Y</param>
|
||||
/// <param name="width">The out value for the width</param>
|
||||
/// <param name="height">The out value for the height</param>
|
||||
/// <param name="x">The out value for X.</param>
|
||||
/// <param name="y">The out value for Y.</param>
|
||||
/// <param name="width">The out value for the width.</param>
|
||||
/// <param name="height">The out value for the height.</param>
|
||||
public void Deconstruct(out float x, out float y, out float width, out float height)
|
||||
{
|
||||
x = this.X;
|
||||
|
@ -277,7 +277,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Creates a RectangleF that represents the intersection between this RectangleF and the <paramref name="rectangle"/>.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Intersect(RectangleF rectangle)
|
||||
{
|
||||
|
@ -292,8 +292,8 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Inflates this <see cref="RectangleF"/> by the specified amount.
|
||||
/// </summary>
|
||||
/// <param name="width">The width</param>
|
||||
/// <param name="height">The height</param>
|
||||
/// <param name="width">The width.</param>
|
||||
/// <param name="height">The height.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Inflate(float width, float height)
|
||||
{
|
||||
|
@ -307,7 +307,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Inflates this <see cref="RectangleF"/> by the specified amount.
|
||||
/// </summary>
|
||||
/// <param name="size">The size</param>
|
||||
/// <param name="size">The size.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Inflate(SizeF size) => this.Inflate(size.Width, size.Height);
|
||||
|
||||
|
@ -317,15 +317,15 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="x">The x-coordinate of the given point.</param>
|
||||
/// <param name="y">The y-coordinate of the given point.</param>
|
||||
/// <returns>The <see cref="bool"/></returns>
|
||||
/// <returns>The <see cref="bool"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Contains(float x, float y) => this.X <= x && x < this.Right && this.Y <= y && y < this.Bottom;
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the specified point is contained within the rectangular region defined by this <see cref="RectangleF"/> .
|
||||
/// </summary>
|
||||
/// <param name="point">The point</param>
|
||||
/// <returns>The <see cref="bool"/></returns>
|
||||
/// <param name="point">The point.</param>
|
||||
/// <returns>The <see cref="bool"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Contains(PointF point) => this.Contains(point.X, point.Y);
|
||||
|
||||
|
@ -333,8 +333,8 @@ namespace SixLabors.Primitives
|
|||
/// Determines if the rectangular region represented by <paramref name="rectangle"/> is entirely contained
|
||||
/// within the rectangular region represented by this <see cref="RectangleF"/> .
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle</param>
|
||||
/// <returns>The <see cref="bool"/></returns>
|
||||
/// <param name="rectangle">The rectangle.</param>
|
||||
/// <returns>The <see cref="bool"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Contains(RectangleF rectangle) =>
|
||||
(this.X <= rectangle.X) && (rectangle.Right <= this.Right) &&
|
||||
|
@ -344,8 +344,8 @@ namespace SixLabors.Primitives
|
|||
/// Determines if the specfied <see cref="RectangleF"/> intersects the rectangular region defined by
|
||||
/// this <see cref="RectangleF"/>.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The other Rectange </param>
|
||||
/// <returns>The <see cref="bool"/></returns>
|
||||
/// <param name="rectangle">The other Rectange. </param>
|
||||
/// <returns>The <see cref="bool"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool IntersectsWith(RectangleF rectangle) =>
|
||||
(rectangle.X < this.Right) && (this.X < rectangle.Right) &&
|
||||
|
@ -354,7 +354,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Adjusts the location of this rectangle by the specified amount.
|
||||
/// </summary>
|
||||
/// <param name="point">The point</param>
|
||||
/// <param name="point">The point.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Offset(PointF point) => this.Offset(point.X, point.Y);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Size"/> struct.
|
||||
/// </summary>
|
||||
/// <param name="value">The width and height of the size</param>
|
||||
/// <param name="value">The width and height of the size.</param>
|
||||
public Size(int value)
|
||||
: this()
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Size"/> struct.
|
||||
/// </summary>
|
||||
/// <param name="size">The size</param>
|
||||
/// <param name="size">The size.</param>
|
||||
public Size(Size size)
|
||||
: this()
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Size"/> struct from the given <see cref="Point"/>.
|
||||
/// </summary>
|
||||
/// <param name="point">The point</param>
|
||||
/// <param name="point">The point.</param>
|
||||
public Size(Point point)
|
||||
{
|
||||
this.Width = point.X;
|
||||
|
@ -84,14 +84,14 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Creates a <see cref="SizeF"/> with the dimensions of the specified <see cref="Size"/>.
|
||||
/// </summary>
|
||||
/// <param name="size">The point</param>
|
||||
/// <param name="size">The point.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator SizeF(Size size) => new SizeF(size.Width, size.Height);
|
||||
|
||||
/// <summary>
|
||||
/// Converts the given <see cref="Size"/> into a <see cref="Point"/>.
|
||||
/// </summary>
|
||||
/// <param name="size">The size</param>
|
||||
/// <param name="size">The size.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator Point(Size size) => new Point(size.Width, size.Height);
|
||||
|
||||
|
@ -101,7 +101,7 @@ namespace SixLabors.Primitives
|
|||
/// <param name="left">The size on the left hand of the operand.</param>
|
||||
/// <param name="right">The size on the right hand of the operand.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="Size"/>
|
||||
/// The <see cref="Size"/>.
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Size operator +(Size left, Size right) => Add(left, right);
|
||||
|
@ -112,7 +112,7 @@ namespace SixLabors.Primitives
|
|||
/// <param name="left">The size on the left hand of the operand.</param>
|
||||
/// <param name="right">The size on the right hand of the operand.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="Size"/>
|
||||
/// The <see cref="Size"/>.
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Size operator -(Size left, Size right) => Subtract(left, right);
|
||||
|
@ -201,39 +201,39 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="left">The size on the left hand of the operand.</param>
|
||||
/// <param name="right">The size on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="Size"/></returns>
|
||||
/// <returns>The <see cref="Size"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Size Add(Size left, Size right) => new Size(unchecked(left.Width + right.Width), unchecked(left.Height + right.Height));
|
||||
|
||||
/// <summary>
|
||||
/// Contracts a <see cref="Size"/> by another <see cref="Size"/>
|
||||
/// Contracts a <see cref="Size"/> by another <see cref="Size"/>.
|
||||
/// </summary>
|
||||
/// <param name="left">The size on the left hand of the operand.</param>
|
||||
/// <param name="right">The size on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="Size"/></returns>
|
||||
/// <returns>The <see cref="Size"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Size Subtract(Size left, Size right) => new Size(unchecked(left.Width - right.Width), unchecked(left.Height - right.Height));
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="SizeF"/> to a <see cref="Size"/> by performing a ceiling operation on all the dimensions.
|
||||
/// </summary>
|
||||
/// <param name="size">The size</param>
|
||||
/// <returns>The <see cref="Size"/></returns>
|
||||
/// <param name="size">The size.</param>
|
||||
/// <returns>The <see cref="Size"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Size Ceiling(SizeF size) => new Size(unchecked((int)MathF.Ceiling(size.Width)), unchecked((int)MathF.Ceiling(size.Height)));
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="SizeF"/> to a <see cref="Size"/> by performing a round operation on all the dimensions.
|
||||
/// </summary>
|
||||
/// <param name="size">The size</param>
|
||||
/// <returns>The <see cref="Size"/></returns>
|
||||
/// <param name="size">The size.</param>
|
||||
/// <returns>The <see cref="Size"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Size Round(SizeF size) => new Size(unchecked((int)MathF.Round(size.Width)), unchecked((int)MathF.Round(size.Height)));
|
||||
|
||||
/// <summary>
|
||||
/// Transforms a size by the given matrix.
|
||||
/// </summary>
|
||||
/// <param name="size">The source size</param>
|
||||
/// <param name="size">The source size.</param>
|
||||
/// <param name="matrix">The transformation matrix.</param>
|
||||
/// <returns>A transformed size.</returns>
|
||||
public static SizeF Transform(Size size, Matrix3x2 matrix)
|
||||
|
@ -246,16 +246,16 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Converts a <see cref="SizeF"/> to a <see cref="Size"/> by performing a round operation on all the dimensions.
|
||||
/// </summary>
|
||||
/// <param name="size">The size</param>
|
||||
/// <returns>The <see cref="Size"/></returns>
|
||||
/// <param name="size">The size.</param>
|
||||
/// <returns>The <see cref="Size"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Size Truncate(SizeF size) => new Size(unchecked((int)size.Width), unchecked((int)size.Height));
|
||||
|
||||
/// <summary>
|
||||
/// Deconstructs this size into two integers
|
||||
/// Deconstructs this size into two integers.
|
||||
/// </summary>
|
||||
/// <param name="width">The out value for the width</param>
|
||||
/// <param name="height">The out value for the height</param>
|
||||
/// <param name="width">The out value for the width.</param>
|
||||
/// <param name="height">The out value for the height.</param>
|
||||
public void Deconstruct(out int width, out int height)
|
||||
{
|
||||
width = this.Width;
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SizeF"/> struct.
|
||||
/// </summary>
|
||||
/// <param name="size">The size</param>
|
||||
/// <param name="size">The size.</param>
|
||||
public SizeF(SizeF size)
|
||||
: this()
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SizeF"/> struct from the given <see cref="PointF"/>.
|
||||
/// </summary>
|
||||
/// <param name="point">The point</param>
|
||||
/// <param name="point">The point.</param>
|
||||
public SizeF(PointF point)
|
||||
{
|
||||
this.Width = point.X;
|
||||
|
@ -93,7 +93,7 @@ namespace SixLabors.Primitives
|
|||
/// <summary>
|
||||
/// Converts the given <see cref="SizeF"/> into a <see cref="PointF"/>.
|
||||
/// </summary>
|
||||
/// <param name="size">The size</param>
|
||||
/// <param name="size">The size.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static explicit operator PointF(SizeF size) => new PointF(size.Width, size.Height);
|
||||
|
||||
|
@ -103,7 +103,7 @@ namespace SixLabors.Primitives
|
|||
/// <param name="left">The size on the left hand of the operand.</param>
|
||||
/// <param name="right">The size on the right hand of the operand.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="SizeF"/>
|
||||
/// The <see cref="SizeF"/>.
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static SizeF operator +(SizeF left, SizeF right) => Add(left, right);
|
||||
|
@ -114,7 +114,7 @@ namespace SixLabors.Primitives
|
|||
/// <param name="left">The size on the left hand of the operand.</param>
|
||||
/// <param name="right">The size on the right hand of the operand.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="SizeF"/>
|
||||
/// The <see cref="SizeF"/>.
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static SizeF operator -(SizeF left, SizeF right) => Subtract(left, right);
|
||||
|
@ -171,16 +171,16 @@ namespace SixLabors.Primitives
|
|||
/// </summary>
|
||||
/// <param name="left">The size on the left hand of the operand.</param>
|
||||
/// <param name="right">The size on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="SizeF"/></returns>
|
||||
/// <returns>The <see cref="SizeF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static SizeF Add(SizeF left, SizeF right) => new SizeF(left.Width + right.Width, left.Height + right.Height);
|
||||
|
||||
/// <summary>
|
||||
/// Contracts a <see cref="SizeF"/> by another <see cref="SizeF"/>
|
||||
/// Contracts a <see cref="SizeF"/> by another <see cref="SizeF"/>.
|
||||
/// </summary>
|
||||
/// <param name="left">The size on the left hand of the operand.</param>
|
||||
/// <param name="right">The size on the right hand of the operand.</param>
|
||||
/// <returns>The <see cref="SizeF"/></returns>
|
||||
/// <returns>The <see cref="SizeF"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static SizeF Subtract(SizeF left, SizeF right) => new SizeF(left.Width - right.Width, left.Height - right.Height);
|
||||
|
||||
|
@ -198,10 +198,10 @@ namespace SixLabors.Primitives
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deconstructs this size into two floats
|
||||
/// Deconstructs this size into two floats.
|
||||
/// </summary>
|
||||
/// <param name="width">The out value for the width</param>
|
||||
/// <param name="height">The out value for the height</param>
|
||||
/// <param name="width">The out value for the width.</param>
|
||||
/// <param name="height">The out value for the height.</param>
|
||||
public void Deconstruct(out float width, out float height)
|
||||
{
|
||||
width = this.Width;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace SixLabors.Tests.Helpers
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FloatRoundingComparer"/> struct.
|
||||
/// </summary>
|
||||
/// <param name="precision">The number of decimal places (valid values: 0-7)</param>
|
||||
/// <param name="precision">The number of decimal places (valid values: 0-7).</param>
|
||||
public FloatRoundingComparer(int precision)
|
||||
{
|
||||
Guard.MustBeBetweenOrEqualTo(precision, 0, 7, nameof(precision));
|
||||
|
@ -23,7 +23,7 @@ namespace SixLabors.Tests.Helpers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of decimal places (valid values: 0-7)
|
||||
/// Gets the number of decimal places (valid values: 0-7).
|
||||
/// </summary>
|
||||
public int Precision { get; }
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace SixLabors.Memory.Tests
|
|||
new ArrayPoolMemoryAllocator(MaxPooledBufferSizeInBytes, PoolSelectorThresholdInBytes);
|
||||
|
||||
/// <summary>
|
||||
/// Rent a buffer -> return it -> re-rent -> verify if it's span points to the previous location
|
||||
/// Rent a buffer -> return it -> re-rent -> verify if it's span points to the previous location.
|
||||
/// </summary>
|
||||
private bool CheckIsRentingPooledBuffer<T>(int length)
|
||||
where T : struct
|
||||
|
|
Загрузка…
Ссылка в новой задаче