diff --git a/src/ImageSharp/ColorSpaces/CieLab.cs b/src/ImageSharp/ColorSpaces/CieLab.cs
index 0d7dd29aa4..40dfb9e6a0 100644
--- a/src/ImageSharp/ColorSpaces/CieLab.cs
+++ b/src/ImageSharp/ColorSpaces/CieLab.cs
@@ -8,6 +8,7 @@ namespace ImageSharp.ColorSpaces
using System;
using System.ComponentModel;
using System.Numerics;
+ using System.Runtime.CompilerServices;
///
/// Represents a CIE L*a*b* 1976 color.
@@ -38,6 +39,7 @@ namespace ImageSharp.ColorSpaces
/// The a (green - magenta) component.
/// The b (blue - yellow) component.
/// Uses as white point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieLab(float l, float a, float b)
: this(new Vector3(l, a, b), DefaultWhitePoint)
{
@@ -50,6 +52,7 @@ namespace ImageSharp.ColorSpaces
/// The a (green - magenta) component.
/// The b (blue - yellow) component.
/// The reference white point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieLab(float l, float a, float b, CieXyz whitePoint)
: this(new Vector3(l, a, b), whitePoint)
{
@@ -60,6 +63,7 @@ namespace ImageSharp.ColorSpaces
///
/// The vector representing the l, a, b components.
/// Uses as white point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieLab(Vector3 vector)
: this(vector, DefaultWhitePoint)
{
@@ -70,6 +74,7 @@ namespace ImageSharp.ColorSpaces
///
/// The vector representing the l, a, b components.
/// The reference white point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieLab(Vector3 vector, CieXyz whitePoint)
: this()
{
@@ -80,25 +85,41 @@ namespace ImageSharp.ColorSpaces
///
/// Gets the reference white point of this color
///
- public CieXyz WhitePoint { get; }
+ public CieXyz WhitePoint
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get;
+ }
///
/// Gets the lightness dimension.
/// A value ranging between 0 (black), 100 (diffuse white) or higher (specular white).
///
- public float L => this.backingVector.X;
+ public float L
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.X;
+ }
///
/// Gets the a color component.
/// A value ranging from -100 to 100. Negative is green, positive magenta.
///
- public float A => this.backingVector.Y;
+ public float A
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Y;
+ }
///
/// Gets the b color component.
/// A value ranging from -100 to 100. Negative is blue, positive is yellow
///
- public float B => this.backingVector.Z;
+ public float B
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Z;
+ }
///
/// Gets a value indicating whether this is empty.
@@ -107,7 +128,11 @@ namespace ImageSharp.ColorSpaces
public bool IsEmpty => this.Equals(Empty);
///
- public Vector3 Vector => this.backingVector;
+ public Vector3 Vector
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector;
+ }
///
/// Compares two objects for equality.
@@ -121,6 +146,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is equal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(CieLab left, CieLab right)
{
return left.Equals(right);
@@ -138,6 +164,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is unequal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(CieLab left, CieLab right)
{
return !left.Equals(right);
@@ -161,6 +188,7 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj)
{
if (obj is CieLab)
@@ -172,12 +200,14 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(CieLab other)
{
return this.backingVector.Equals(other.backingVector);
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool AlmostEquals(CieLab other, float precision)
{
Vector3 result = Vector3.Abs(this.backingVector - other.backingVector);
diff --git a/src/ImageSharp/ColorSpaces/CieLch.cs b/src/ImageSharp/ColorSpaces/CieLch.cs
index bfdd3f5784..866e1870f0 100644
--- a/src/ImageSharp/ColorSpaces/CieLch.cs
+++ b/src/ImageSharp/ColorSpaces/CieLch.cs
@@ -8,6 +8,7 @@ namespace ImageSharp.ColorSpaces
using System;
using System.ComponentModel;
using System.Numerics;
+ using System.Runtime.CompilerServices;
///
/// Represents the CIE L*C*h°, cylindrical form of the CIE L*a*b* 1976 color.
@@ -38,6 +39,7 @@ namespace ImageSharp.ColorSpaces
/// The chroma, relative saturation.
/// The hue in degrees.
/// Uses as white point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieLch(float l, float c, float h)
: this(new Vector3(l, c, h), DefaultWhitePoint)
{
@@ -50,6 +52,7 @@ namespace ImageSharp.ColorSpaces
/// The chroma, relative saturation.
/// The hue in degrees.
/// The reference white point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieLch(float l, float c, float h, CieXyz whitePoint)
: this(new Vector3(l, c, h), whitePoint)
{
@@ -60,6 +63,7 @@ namespace ImageSharp.ColorSpaces
///
/// The vector representing the l, c, h components.
/// Uses as white point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieLch(Vector3 vector)
: this(vector, DefaultWhitePoint)
{
@@ -70,6 +74,7 @@ namespace ImageSharp.ColorSpaces
///
/// The vector representing the l, c, h components.
/// The reference white point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieLch(Vector3 vector, CieXyz whitePoint)
: this()
{
@@ -80,25 +85,41 @@ namespace ImageSharp.ColorSpaces
///
/// Gets the reference white point of this color
///
- public CieXyz WhitePoint { get; }
+ public CieXyz WhitePoint
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get;
+ }
///
/// Gets the lightness dimension.
/// A value ranging between 0 (black), 100 (diffuse white) or higher (specular white).
///
- public float L => this.backingVector.X;
+ public float L
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.X;
+ }
///
/// Gets the a chroma component.
/// A value ranging from 0 to 100.
///
- public float C => this.backingVector.Y;
+ public float C
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Y;
+ }
///
/// Gets the h° hue component in degrees.
/// A value ranging from 0 to 360.
///
- public float H => this.backingVector.Z;
+ public float H
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Z;
+ }
///
/// Gets a value indicating whether this is empty.
@@ -107,7 +128,11 @@ namespace ImageSharp.ColorSpaces
public bool IsEmpty => this.Equals(Empty);
///
- public Vector3 Vector => this.backingVector;
+ public Vector3 Vector
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector;
+ }
///
/// Compares two objects for equality.
@@ -121,6 +146,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is equal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(CieLch left, CieLch right)
{
return left.Equals(right);
@@ -138,6 +164,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is unequal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(CieLch left, CieLch right)
{
return !left.Equals(right);
@@ -161,6 +188,7 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj)
{
if (obj is CieLch)
@@ -172,12 +200,14 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(CieLch other)
{
return this.backingVector.Equals(other.backingVector);
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool AlmostEquals(CieLch other, float precision)
{
Vector3 result = Vector3.Abs(this.backingVector - other.backingVector);
@@ -194,6 +224,7 @@ namespace ImageSharp.ColorSpaces
/// A value ranging from 0 to 100.
///
/// The
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public float Saturation()
{
float result = 100 * (this.C / this.L);
diff --git a/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs b/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs
index 049c880faf..756c05c6d0 100644
--- a/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs
+++ b/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs
@@ -8,6 +8,7 @@ namespace ImageSharp.ColorSpaces
using System;
using System.ComponentModel;
using System.Numerics;
+ using System.Runtime.CompilerServices;
///
/// Represents the coordinates of CIEXY chromaticity space
@@ -29,6 +30,7 @@ namespace ImageSharp.ColorSpaces
///
/// Chromaticity coordinate x (usually from 0 to 1)
/// Chromaticity coordinate y (usually from 0 to 1)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyChromaticityCoordinates(float x, float y)
: this(new Vector2(x, y))
{
@@ -38,6 +40,7 @@ namespace ImageSharp.ColorSpaces
/// Initializes a new instance of the struct.
///
/// The vector containing the XY Chromaticity coordinates
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyChromaticityCoordinates(Vector2 vector)
{
this.backingVector = vector;
@@ -49,7 +52,11 @@ namespace ImageSharp.ColorSpaces
///
/// Ranges usually from 0 to 1.
///
- public float X => this.backingVector.X;
+ public float X
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.X;
+ }
///
/// Gets the chromaticity Y-coordinate
@@ -57,7 +64,11 @@ namespace ImageSharp.ColorSpaces
///
/// Ranges usually from 0 to 1.
///
- public float Y => this.backingVector.Y;
+ public float Y
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Y;
+ }
///
/// Gets a value indicating whether this is empty.
@@ -77,6 +88,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is equal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(CieXyChromaticityCoordinates left, CieXyChromaticityCoordinates right)
{
return left.Equals(right);
@@ -94,6 +106,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is unequal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(CieXyChromaticityCoordinates left, CieXyChromaticityCoordinates right)
{
return !left.Equals(right);
@@ -117,6 +130,7 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj)
{
if (obj is CieXyChromaticityCoordinates)
@@ -128,12 +142,14 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(CieXyChromaticityCoordinates other)
{
return this.backingVector.Equals(other.backingVector);
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool AlmostEquals(CieXyChromaticityCoordinates other, float precision)
{
Vector2 result = Vector2.Abs(this.backingVector - other.backingVector);
diff --git a/src/ImageSharp/ColorSpaces/CieXyy.cs b/src/ImageSharp/ColorSpaces/CieXyy.cs
index 9c4ce4e122..c6efc92756 100644
--- a/src/ImageSharp/ColorSpaces/CieXyy.cs
+++ b/src/ImageSharp/ColorSpaces/CieXyy.cs
@@ -8,6 +8,7 @@ namespace ImageSharp.ColorSpaces
using System;
using System.ComponentModel;
using System.Numerics;
+ using System.Runtime.CompilerServices;
///
/// Represents an CIE xyY 1931 color
@@ -31,6 +32,7 @@ namespace ImageSharp.ColorSpaces
/// The x chroma component.
/// The y chroma component.
/// The y luminance component.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyy(float x, float y, float yl)
: this(new Vector3(x, y, yl))
{
@@ -40,6 +42,7 @@ namespace ImageSharp.ColorSpaces
/// Initializes a new instance of the struct.
///
/// The vector representing the x, y, Y components.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyy(Vector3 vector)
: this()
{
@@ -51,19 +54,31 @@ namespace ImageSharp.ColorSpaces
/// Gets the X chrominance component.
/// A value usually ranging between 0 and 1.
///
- public float X => this.backingVector.X;
+ public float X
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.X;
+ }
///
/// Gets the Y chrominance component.
/// A value usually ranging between 0 and 1.
///
- public float Y => this.backingVector.Y;
+ public float Y
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Y;
+ }
///
/// Gets the Y luminance component.
/// A value usually ranging between 0 and 1.
///
- public float Yl => this.backingVector.Z;
+ public float Yl
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Z;
+ }
///
/// Gets a value indicating whether this is empty.
@@ -72,7 +87,11 @@ namespace ImageSharp.ColorSpaces
public bool IsEmpty => this.Equals(Empty);
///
- public Vector3 Vector => this.backingVector;
+ public Vector3 Vector
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector;
+ }
///
/// Compares two objects for equality.
@@ -86,6 +105,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is equal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(CieXyy left, CieXyy right)
{
return left.Equals(right);
@@ -103,6 +123,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is unequal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(CieXyy left, CieXyy right)
{
return !left.Equals(right);
@@ -126,6 +147,7 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj)
{
if (obj is CieXyy)
@@ -137,12 +159,14 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(CieXyy other)
{
return this.backingVector.Equals(other.backingVector);
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool AlmostEquals(CieXyy other, float precision)
{
Vector3 result = Vector3.Abs(this.backingVector - other.backingVector);
diff --git a/src/ImageSharp/ColorSpaces/CieXyz.cs b/src/ImageSharp/ColorSpaces/CieXyz.cs
index 0199be79cf..5af00ccbd1 100644
--- a/src/ImageSharp/ColorSpaces/CieXyz.cs
+++ b/src/ImageSharp/ColorSpaces/CieXyz.cs
@@ -8,6 +8,7 @@ namespace ImageSharp.ColorSpaces
using System;
using System.ComponentModel;
using System.Numerics;
+ using System.Runtime.CompilerServices;
///
/// Represents an CIE XYZ 1931 color
@@ -31,6 +32,7 @@ namespace ImageSharp.ColorSpaces
/// X is a mix (a linear combination) of cone response curves chosen to be nonnegative
/// The y luminance component.
/// Z is quasi-equal to blue stimulation, or the S cone of the human eye.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyz(float x, float y, float z)
: this(new Vector3(x, y, z))
{
@@ -40,6 +42,7 @@ namespace ImageSharp.ColorSpaces
/// Initializes a new instance of the struct.
///
/// The vector representing the x, y, z components.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyz(Vector3 vector)
: this()
{
@@ -51,19 +54,31 @@ namespace ImageSharp.ColorSpaces
/// Gets the X component. A mix (a linear combination) of cone response curves chosen to be nonnegative.
/// A value usually ranging between 0 and 1.
///
- public float X => this.backingVector.X;
+ public float X
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.X;
+ }
///
/// Gets the Y luminance component.
/// A value usually ranging between 0 and 1.
///
- public float Y => this.backingVector.Y;
+ public float Y
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Y;
+ }
///
/// Gets the Z component. Quasi-equal to blue stimulation, or the S cone response
/// A value usually ranging between 0 and 1.
///
- public float Z => this.backingVector.Z;
+ public float Z
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Z;
+ }
///
/// Gets a value indicating whether this is empty.
@@ -72,7 +87,11 @@ namespace ImageSharp.ColorSpaces
public bool IsEmpty => this.Equals(Empty);
///
- public Vector3 Vector => this.backingVector;
+ public Vector3 Vector
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector;
+ }
///
/// Compares two objects for equality.
@@ -86,6 +105,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is equal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(CieXyz left, CieXyz right)
{
return left.Equals(right);
@@ -103,6 +123,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is unequal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(CieXyz left, CieXyz right)
{
return !left.Equals(right);
@@ -126,6 +147,7 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj)
{
if (obj is CieXyz)
@@ -137,12 +159,14 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(CieXyz other)
{
return this.backingVector.Equals(other.backingVector);
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool AlmostEquals(CieXyz other, float precision)
{
Vector3 result = Vector3.Abs(this.backingVector - other.backingVector);
diff --git a/src/ImageSharp/ColorSpaces/Cmyk.cs b/src/ImageSharp/ColorSpaces/Cmyk.cs
index 131d0b4655..531835a6f7 100644
--- a/src/ImageSharp/ColorSpaces/Cmyk.cs
+++ b/src/ImageSharp/ColorSpaces/Cmyk.cs
@@ -8,6 +8,7 @@ namespace ImageSharp.ColorSpaces
using System;
using System.ComponentModel;
using System.Numerics;
+ using System.Runtime.CompilerServices;
///
/// Represents an CMYK (cyan, magenta, yellow, keyline) color.
@@ -31,6 +32,7 @@ namespace ImageSharp.ColorSpaces
/// The magenta component.
/// The yellow component.
/// The keyline black component.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Cmyk(float c, float m, float y, float k)
: this(new Vector4(c, m, y, k))
{
@@ -40,6 +42,7 @@ namespace ImageSharp.ColorSpaces
/// Initializes a new instance of the struct.
///
/// The vector representing the c, m, y, k components.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Cmyk(Vector4 vector)
: this()
{
@@ -50,25 +53,41 @@ namespace ImageSharp.ColorSpaces
/// Gets the cyan color component.
/// A value ranging between 0 and 1.
///
- public float C => this.backingVector.X;
+ public float C
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.X;
+ }
///
/// Gets the magenta color component.
/// A value ranging between 0 and 1.
///
- public float M => this.backingVector.Y;
+ public float M
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Y;
+ }
///
/// Gets the yellow color component.
/// A value ranging between 0 and 1.
///
- public float Y => this.backingVector.Z;
+ public float Y
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Z;
+ }
///
/// Gets the keyline black color component.
/// A value ranging between 0 and 1.
///
- public float K => this.backingVector.W;
+ public float K
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.W;
+ }
///
/// Gets a value indicating whether this is empty.
@@ -88,6 +107,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is equal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Cmyk left, Cmyk right)
{
return left.Equals(right);
@@ -105,6 +125,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is unequal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Cmyk left, Cmyk right)
{
return !left.Equals(right);
@@ -128,6 +149,7 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj)
{
if (obj is Cmyk)
@@ -139,12 +161,14 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Cmyk other)
{
return this.backingVector.Equals(other.backingVector);
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool AlmostEquals(Cmyk other, float precision)
{
Vector4 result = Vector4.Abs(this.backingVector - other.backingVector);
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLab/CieLabToCieXyzConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLab/CieLabToCieXyzConverter.cs
index 3aaab9eef2..71b1596cac 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLab/CieLabToCieXyzConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLab/CieLabToCieXyzConverter.cs
@@ -5,6 +5,8 @@
namespace ImageSharp.ColorSpaces.Conversion.Implementation.CieLab
{
+ using System.Runtime.CompilerServices;
+
using ImageSharp.ColorSpaces;
///
@@ -13,6 +15,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.CieLab
internal class CieLabToCieXyzConverter : IColorConversion
{
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyz Convert(CieLab input)
{
DebugGuard.NotNull(input, nameof(input));
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLab/CieXyzToCieLabConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLab/CieXyzToCieLabConverter.cs
index 38a415ed24..8d877503a2 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLab/CieXyzToCieLabConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLab/CieXyzToCieLabConverter.cs
@@ -5,6 +5,8 @@
namespace ImageSharp.ColorSpaces.Conversion.Implementation.CieLab
{
+ using System.Runtime.CompilerServices;
+
using ImageSharp.ColorSpaces;
///
@@ -15,6 +17,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.CieLab
///
/// Initializes a new instance of the class.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyzToCieLabConverter()
: this(CieLab.DefaultWhitePoint)
{
@@ -24,6 +27,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.CieLab
/// Initializes a new instance of the class.
///
/// The target reference lab white point
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyzToCieLabConverter(CieXyz labWhitePoint)
{
this.LabWhitePoint = labWhitePoint;
@@ -32,9 +36,14 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.CieLab
///
/// Gets the target reference whitepoint. When not set, is used.
///
- public CieXyz LabWhitePoint { get; }
+ public CieXyz LabWhitePoint
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get;
+ }
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieLab Convert(CieXyz input)
{
DebugGuard.NotNull(input, nameof(input));
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLch/CIeLchToCieLabConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLch/CIeLchToCieLabConverter.cs
index 844be74925..4cde7e330d 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLch/CIeLchToCieLabConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLch/CIeLchToCieLabConverter.cs
@@ -5,6 +5,8 @@
namespace ImageSharp.ColorSpaces.Conversion.Implementation.CieLch
{
+ using System.Runtime.CompilerServices;
+
using ImageSharp.ColorSpaces;
///
@@ -13,6 +15,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.CieLch
public class CieLchToCieLabConverter : IColorConversion
{
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieLab Convert(CieLch input)
{
DebugGuard.NotNull(input, nameof(input));
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLch/CieLabToCieLchConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLch/CieLabToCieLchConverter.cs
index 0fcb22317a..502c9337ae 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLch/CieLabToCieLchConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieLch/CieLabToCieLchConverter.cs
@@ -5,6 +5,8 @@
namespace ImageSharp.ColorSpaces.Conversion.Implementation.CieLch
{
+ using System.Runtime.CompilerServices;
+
using ImageSharp.ColorSpaces;
///
@@ -13,6 +15,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.CieLch
internal class CieLabToCieLchConverter : IColorConversion
{
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieLch Convert(CieLab input)
{
DebugGuard.NotNull(input, nameof(input));
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieXyy/CieXyzAndCieXyyConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieXyy/CieXyzAndCieXyyConverter.cs
index dedf453bf5..dc4a5ccf4a 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieXyy/CieXyzAndCieXyyConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieXyy/CieXyzAndCieXyyConverter.cs
@@ -5,6 +5,8 @@
namespace ImageSharp.ColorSpaces.Conversion.Implementation.CieXyy
{
+ using System.Runtime.CompilerServices;
+
using ImageSharp.ColorSpaces;
///
@@ -14,6 +16,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.CieXyy
internal class CieXyzAndCieXyyConverter : IColorConversion, IColorConversion
{
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyy Convert(CieXyz input)
{
DebugGuard.NotNull(input, nameof(input));
@@ -30,6 +33,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.CieXyy
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyz Convert(CieXyy input)
{
DebugGuard.NotNull(input, nameof(input));
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Cmyk/CmykAndRgbConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Cmyk/CmykAndRgbConverter.cs
index 34e8b5b089..b50e89b18c 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Cmyk/CmykAndRgbConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Cmyk/CmykAndRgbConverter.cs
@@ -6,6 +6,7 @@
namespace ImageSharp.ColorSpaces.Conversion.Implementation.Cmyk
{
using System;
+ using System.Runtime.CompilerServices;
using ImageSharp.ColorSpaces;
@@ -15,6 +16,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.Cmyk
internal class CmykAndRgbConverter : IColorConversion, IColorConversion
{
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Rgb Convert(Cmyk input)
{
float r = (1F - input.C) * (1F - input.K);
@@ -25,6 +27,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.Cmyk
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Cmyk Convert(Rgb input)
{
// To CMYK
@@ -35,7 +38,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.Cmyk
// To CMYK
float k = MathF.Min(c, MathF.Min(m, y));
- if (Math.Abs(k - 1F) < Constants.Epsilon)
+ if (MathF.Abs(k - 1F) < Constants.Epsilon)
{
return new Cmyk(0, 0, 0, 1F);
}
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Hsl/HslAndRgbConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Hsl/HslAndRgbConverter.cs
index e61c9727ef..6c72cf294a 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Hsl/HslAndRgbConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Hsl/HslAndRgbConverter.cs
@@ -16,8 +16,11 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.Hsl
internal class HslAndRgbConverter : IColorConversion, IColorConversion
{
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Rgb Convert(Hsl input)
{
+ DebugGuard.NotNull(input, nameof(input));
+
float rangedH = input.H / 360F;
float r = 0;
float g = 0;
@@ -46,8 +49,11 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.Hsl
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Hsl Convert(Rgb input)
{
+ DebugGuard.NotNull(input, nameof(input));
+
float r = input.R;
float g = input.G;
float b = input.B;
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzAndHunterLabConverterBase.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzAndHunterLabConverterBase.cs
index cc2698a1de..19fc78e9a2 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzAndHunterLabConverterBase.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzAndHunterLabConverterBase.cs
@@ -24,10 +24,10 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.HunterLab
if (whitePoint.Equals(Illuminants.C))
{
- return 175;
+ return 175F;
}
- return 100 * (175 / 198.04F) * (whitePoint.X + whitePoint.Y);
+ return 100F * (175F / 198.04F) * (whitePoint.X + whitePoint.Y);
}
///
@@ -42,10 +42,10 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.HunterLab
if (whitePoint == Illuminants.C)
{
- return 70;
+ return 70F;
}
- return 100 * (70 / 218.11F) * (whitePoint.Y + whitePoint.Z);
+ return 100F * (70F / 218.11F) * (whitePoint.Y + whitePoint.Z);
}
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzToHunterLabConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzToHunterLabConverter.cs
index 51f0af14c4..7f2df8336e 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzToHunterLabConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzToHunterLabConverter.cs
@@ -5,7 +5,9 @@
namespace ImageSharp.ColorSpaces.Conversion.Implementation.HunterLab
{
- using HunterLab = ImageSharp.ColorSpaces.HunterLab;
+ using System.Runtime.CompilerServices;
+
+ using ImageSharp.ColorSpaces;
///
/// Color converter between CieXyz and HunterLab
@@ -15,6 +17,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.HunterLab
///
/// Initializes a new instance of the class.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyzToHunterLabConverter()
: this(HunterLab.DefaultWhitePoint)
{
@@ -24,6 +27,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.HunterLab
/// Initializes a new instance of the class.
///
/// The hunter Lab white point.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyzToHunterLabConverter(CieXyz labWhitePoint)
{
this.HunterLabWhitePoint = labWhitePoint;
@@ -32,9 +36,14 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.HunterLab
///
/// Gets the target reference white. When not set, is used.
///
- public CieXyz HunterLabWhitePoint { get; }
+ public CieXyz HunterLabWhitePoint
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get;
+ }
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public HunterLab Convert(CieXyz input)
{
DebugGuard.NotNull(input, nameof(input));
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/HunterLabToCieXyzConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/HunterLabToCieXyzConverter.cs
index 6caf3b4493..af7f4f3708 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/HunterLabToCieXyzConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/HunterLabToCieXyzConverter.cs
@@ -5,7 +5,9 @@
namespace ImageSharp.ColorSpaces.Conversion.Implementation.HunterLab
{
- using HunterLab = ImageSharp.ColorSpaces.HunterLab;
+ using System.Runtime.CompilerServices;
+
+ using ImageSharp.ColorSpaces;
///
/// Color converter between HunterLab and CieXyz
@@ -13,6 +15,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.HunterLab
internal class HunterLabToCieXyzConverter : CieXyzAndHunterLabConverterBase, IColorConversion
{
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyz Convert(HunterLab input)
{
DebugGuard.NotNull(input, nameof(input));
@@ -31,4 +34,4 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.HunterLab
return new CieXyz(x, y, z);
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Lms/CieXyzAndLmsConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Lms/CieXyzAndLmsConverter.cs
index 944910ce58..c856c7ff74 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Lms/CieXyzAndLmsConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Lms/CieXyzAndLmsConverter.cs
@@ -6,6 +6,7 @@
namespace ImageSharp.ColorSpaces.Conversion.Implementation.Lms
{
using System.Numerics;
+ using System.Runtime.CompilerServices;
using ImageSharp.ColorSpaces;
@@ -26,6 +27,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.Lms
///
/// Initializes a new instance of the class.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyzAndLmsConverter()
: this(DefaultTransformationMatrix)
{
@@ -38,6 +40,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.Lms
/// Definition of the cone response domain (see ),
/// if not set will be used.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyzAndLmsConverter(Matrix4x4 transformationMatrix)
{
this.TransformationMatrix = transformationMatrix;
@@ -49,10 +52,8 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.Lms
///
public Matrix4x4 TransformationMatrix
{
- get
- {
- return this.transformationMatrix;
- }
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.transformationMatrix;
set
{
@@ -62,6 +63,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.Lms
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Lms Convert(CieXyz input)
{
DebugGuard.NotNull(input, nameof(input));
@@ -71,6 +73,7 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.Lms
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyz Convert(Lms input)
{
DebugGuard.NotNull(input, nameof(input));
@@ -79,4 +82,4 @@ namespace ImageSharp.ColorSpaces.Conversion.Implementation.Lms
return new CieXyz(vector);
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/ColorSpaces/Hsl.cs b/src/ImageSharp/ColorSpaces/Hsl.cs
index e8133d7207..c2c2899fb5 100644
--- a/src/ImageSharp/ColorSpaces/Hsl.cs
+++ b/src/ImageSharp/ColorSpaces/Hsl.cs
@@ -8,6 +8,7 @@ namespace ImageSharp.ColorSpaces
using System;
using System.ComponentModel;
using System.Numerics;
+ using System.Runtime.CompilerServices;
///
/// Represents a Hsl (hue, saturation, lightness) color.
@@ -35,6 +36,7 @@ namespace ImageSharp.ColorSpaces
/// The h hue component.
/// The s saturation component.
/// The l value (lightness) component.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Hsl(float h, float s, float l)
: this(new Vector3(h, s, l))
{
@@ -44,6 +46,7 @@ namespace ImageSharp.ColorSpaces
/// Initializes a new instance of the struct.
///
/// The vector representing the h, s, l components.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Hsl(Vector3 vector)
{
this.backingVector = Vector3.Clamp(vector, Vector3.Zero, VectorMax);
@@ -53,19 +56,31 @@ namespace ImageSharp.ColorSpaces
/// Gets the hue component.
/// A value ranging between 0 and 360.
///
- public float H => this.backingVector.X;
+ public float H
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.X;
+ }
///
/// Gets the saturation component.
/// A value ranging between 0 and 1.
///
- public float S => this.backingVector.Y;
+ public float S
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Y;
+ }
///
/// Gets the lightness component.
/// A value ranging between 0 and 1.
///
- public float L => this.backingVector.Z;
+ public float L
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Z;
+ }
///
/// Gets a value indicating whether this is empty.
@@ -74,7 +89,11 @@ namespace ImageSharp.ColorSpaces
public bool IsEmpty => this.Equals(Empty);
///
- public Vector3 Vector => this.backingVector;
+ public Vector3 Vector
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector;
+ }
///
/// Compares two objects for equality.
@@ -88,6 +107,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is equal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Hsl left, Hsl right)
{
return left.Equals(right);
@@ -105,6 +125,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is unequal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Hsl left, Hsl right)
{
return !left.Equals(right);
@@ -128,6 +149,7 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj)
{
if (obj is Hsl)
@@ -139,12 +161,14 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Hsl other)
{
return this.backingVector.Equals(other.backingVector);
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool AlmostEquals(Hsl other, float precision)
{
Vector3 result = Vector3.Abs(this.backingVector - other.backingVector);
diff --git a/src/ImageSharp/ColorSpaces/Rgb.cs b/src/ImageSharp/ColorSpaces/Rgb.cs
index adc7c68165..36b93a0033 100644
--- a/src/ImageSharp/ColorSpaces/Rgb.cs
+++ b/src/ImageSharp/ColorSpaces/Rgb.cs
@@ -38,6 +38,7 @@ namespace ImageSharp.ColorSpaces
/// The red component ranging between 0 and 1.
/// The green component ranging between 0 and 1.
/// The blue component ranging between 0 and 1.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Rgb(float r, float g, float b)
: this(new Vector3(r, g, b))
{
@@ -50,6 +51,7 @@ namespace ImageSharp.ColorSpaces
/// The green component ranging between 0 and 1.
/// The blue component ranging between 0 and 1.
/// The rgb working space.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Rgb(float r, float g, float b, IRgbWorkingSpace workingSpace)
: this(new Vector3(r, g, b), workingSpace)
{
@@ -59,6 +61,7 @@ namespace ImageSharp.ColorSpaces
/// Initializes a new instance of the struct.
///
/// The vector representing the r, g, b components.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Rgb(Vector3 vector)
: this(vector, DefaultWorkingSpace)
{
@@ -69,6 +72,7 @@ namespace ImageSharp.ColorSpaces
///
/// The vector representing the r, g, b components.
/// The rgb working space.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Rgb(Vector3 vector, IRgbWorkingSpace workingSpace)
: this()
{
@@ -81,24 +85,40 @@ namespace ImageSharp.ColorSpaces
/// Gets the red component.
/// A value usually ranging between 0 and 1.
///
- public float R => this.backingVector.X;
+ public float R
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.X;
+ }
///
/// Gets the green component.
/// A value usually ranging between 0 and 1.
///
- public float G => this.backingVector.Y;
+ public float G
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Y;
+ }
///
/// Gets the blue component.
/// A value usually ranging between 0 and 1.
///
- public float B => this.backingVector.Z;
+ public float B
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Z;
+ }
///
/// Gets the Rgb color space
///
- public IRgbWorkingSpace WorkingSpace { get; }
+ public IRgbWorkingSpace WorkingSpace
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get;
+ }
///
/// Gets a value indicating whether this is empty.
@@ -107,7 +127,11 @@ namespace ImageSharp.ColorSpaces
public bool IsEmpty => this.Equals(Empty);
///
- public Vector3 Vector => this.backingVector;
+ public Vector3 Vector
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector;
+ }
///
/// Allows the implicit conversion of an instance of to a
@@ -137,6 +161,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is equal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Rgb left, Rgb right)
{
return left.Equals(right);
@@ -154,6 +179,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is unequal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Rgb left, Rgb right)
{
return !left.Equals(right);
@@ -177,6 +203,7 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj)
{
if (obj is Rgb)
@@ -188,12 +215,14 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Rgb other)
{
return this.backingVector.Equals(other.backingVector);
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool AlmostEquals(Rgb other, float precision)
{
Vector3 result = Vector3.Abs(this.backingVector - other.backingVector);
diff --git a/src/ImageSharp/PixelFormats/Rgba32.cs b/src/ImageSharp/PixelFormats/Rgba32.cs
index ff6c0bd2a5..d04c493bb8 100644
--- a/src/ImageSharp/PixelFormats/Rgba32.cs
+++ b/src/ImageSharp/PixelFormats/Rgba32.cs
@@ -227,6 +227,7 @@ namespace ImageSharp.PixelFormats
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public BulkPixelOperations CreateBulkOperations() => new BulkOperations();
///