diff --git a/src/ImageSharp/ColorSpaces/HunterLab.cs b/src/ImageSharp/ColorSpaces/HunterLab.cs
index 2288abf4cb..c273c1213d 100644
--- a/src/ImageSharp/ColorSpaces/HunterLab.cs
+++ b/src/ImageSharp/ColorSpaces/HunterLab.cs
@@ -8,6 +8,7 @@ namespace ImageSharp.ColorSpaces
using System;
using System.ComponentModel;
using System.Numerics;
+ using System.Runtime.CompilerServices;
///
/// Represents an Hunter LAB 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 HunterLab(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 HunterLab(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 HunterLab(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 HunterLab(Vector3 vector, CieXyz whitePoint)
: this()
{
@@ -86,19 +91,31 @@ namespace ImageSharp.ColorSpaces
/// 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 +124,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 +142,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is equal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(HunterLab left, HunterLab right)
{
return left.Equals(right);
@@ -138,6 +160,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is unequal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(HunterLab left, HunterLab right)
{
return !left.Equals(right);
@@ -161,6 +184,7 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj)
{
if (obj is HunterLab)
@@ -172,12 +196,14 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(HunterLab other)
{
return this.backingVector.Equals(other.backingVector);
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool AlmostEquals(HunterLab other, float precision)
{
Vector3 result = Vector3.Abs(this.backingVector - other.backingVector);
diff --git a/src/ImageSharp/ColorSpaces/LinearRgb.cs b/src/ImageSharp/ColorSpaces/LinearRgb.cs
index 1bc788ce67..b4cb668627 100644
--- a/src/ImageSharp/ColorSpaces/LinearRgb.cs
+++ b/src/ImageSharp/ColorSpaces/LinearRgb.cs
@@ -8,6 +8,7 @@ namespace ImageSharp.ColorSpaces
using System;
using System.ComponentModel;
using System.Numerics;
+ using System.Runtime.CompilerServices;
///
/// Represents an linear Rgb color with specified working space
@@ -35,6 +36,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 LinearRgb(float r, float g, float b)
: this(new Vector3(r, g, b))
{
@@ -47,6 +49,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 LinearRgb(float r, float g, float b, IRgbWorkingSpace workingSpace)
: this(new Vector3(r, g, b), workingSpace)
{
@@ -56,6 +59,7 @@ namespace ImageSharp.ColorSpaces
/// Initializes a new instance of the struct.
///
/// The vector representing the r, g, b components.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public LinearRgb(Vector3 vector)
: this(vector, DefaultWorkingSpace)
{
@@ -66,6 +70,7 @@ namespace ImageSharp.ColorSpaces
///
/// The vector representing the r, g, b components.
/// The LinearRgb working space.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public LinearRgb(Vector3 vector, IRgbWorkingSpace workingSpace)
: this()
{
@@ -78,19 +83,31 @@ 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 LinearRgb color space
@@ -104,7 +121,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.
@@ -118,6 +139,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is equal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(LinearRgb left, LinearRgb right)
{
return left.Equals(right);
@@ -135,6 +157,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is unequal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(LinearRgb left, LinearRgb right)
{
return !left.Equals(right);
@@ -158,6 +181,7 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj)
{
if (obj is LinearRgb)
@@ -169,12 +193,14 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(LinearRgb other)
{
return this.backingVector.Equals(other.backingVector);
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool AlmostEquals(LinearRgb other, float precision)
{
Vector3 result = Vector3.Abs(this.backingVector - other.backingVector);
diff --git a/src/ImageSharp/ColorSpaces/Lms.cs b/src/ImageSharp/ColorSpaces/Lms.cs
index 44856060ed..2b6eae809c 100644
--- a/src/ImageSharp/ColorSpaces/Lms.cs
+++ b/src/ImageSharp/ColorSpaces/Lms.cs
@@ -8,6 +8,7 @@ namespace ImageSharp.ColorSpaces
using System;
using System.ComponentModel;
using System.Numerics;
+ using System.Runtime.CompilerServices;
///
/// LMS is a color space represented by the response of the three types of cones of the human eye,
@@ -32,6 +33,7 @@ namespace ImageSharp.ColorSpaces
/// L represents the responsivity at long wavelengths.
/// M represents the responsivity at medium wavelengths.
/// S represents the responsivity at short wavelengths.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Lms(float l, float m, float s)
: this(new Vector3(l, m, s))
{
@@ -41,6 +43,7 @@ namespace ImageSharp.ColorSpaces
/// Initializes a new instance of the struct.
///
/// The vector representing the x, y, z components.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Lms(Vector3 vector)
: this()
{
@@ -52,19 +55,31 @@ namespace ImageSharp.ColorSpaces
/// Gets the L long component.
/// A value usually ranging between -1 and 1.
///
- public float L => this.backingVector.X;
+ public float L
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.X;
+ }
///
/// Gets the M medium component.
/// A value usually ranging between -1 and 1.
///
- public float M => this.backingVector.Y;
+ public float M
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Y;
+ }
///
/// Gets the S short component.
/// A value usually ranging between -1 and 1.
///
- public float S => this.backingVector.Z;
+ public float S
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => this.backingVector.Z;
+ }
///
/// Gets a value indicating whether this is empty.
@@ -73,7 +88,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.
@@ -87,6 +106,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is equal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Lms left, Lms right)
{
return left.Equals(right);
@@ -104,6 +124,7 @@ namespace ImageSharp.ColorSpaces
///
/// True if the current left is unequal to the parameter; otherwise, false.
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Lms left, Lms right)
{
return !left.Equals(right);
@@ -127,6 +148,7 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj)
{
if (obj is Lms)
@@ -138,12 +160,14 @@ namespace ImageSharp.ColorSpaces
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Lms other)
{
return this.backingVector.Equals(other.backingVector);
}
///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool AlmostEquals(Lms other, float precision)
{
Vector3 result = Vector3.Abs(this.backingVector - other.backingVector);