diff --git a/src/ImageSharp.Drawing/Brushes/Brushes.cs b/src/ImageSharp.Drawing/Brushes/Brushes.cs
index 5912dbd51..e8269848c 100644
--- a/src/ImageSharp.Drawing/Brushes/Brushes.cs
+++ b/src/ImageSharp.Drawing/Brushes/Brushes.cs
@@ -6,7 +6,7 @@
namespace ImageSharp.Drawing.Brushes
{
///
- /// A collection of methods for creating brushes. Brushes use for painting.
+ /// A collection of methods for creating brushes. Brushes use for painting.
///
public class Brushes
{
@@ -15,7 +15,7 @@ namespace ImageSharp.Drawing.Brushes
///
/// The color.
/// A Brush
- public static SolidBrush Solid(Color32 color)
+ public static SolidBrush Solid(Color color)
=> new SolidBrush(color);
///
@@ -24,8 +24,8 @@ namespace ImageSharp.Drawing.Brushes
///
/// Color of the foreground.
/// A Brush
- public static PatternBrush Percent10(Color32 foreColor)
- => new PatternBrush(Brushes.Percent10(foreColor, Color32.Transparent));
+ public static PatternBrush Percent10(Color foreColor)
+ => new PatternBrush(Brushes.Percent10(foreColor, Color.Transparent));
///
/// Create as brush that will paint a Percent10 Hatch Pattern with
@@ -34,8 +34,8 @@ namespace ImageSharp.Drawing.Brushes
/// Color of the foreground.
/// Color of the background.
/// A Brush
- public static PatternBrush Percent10(Color32 foreColor, Color32 backColor)
- => new PatternBrush(Brushes.Percent10(foreColor, backColor));
+ public static PatternBrush Percent10(Color foreColor, Color backColor)
+ => new PatternBrush(Brushes.Percent10(foreColor, backColor));
///
/// Create as brush that will paint a Percent20 Hatch Pattern with
@@ -43,8 +43,8 @@ namespace ImageSharp.Drawing.Brushes
///
/// Color of the foreground.
/// A Brush
- public static PatternBrush Percent20(Color32 foreColor)
- => new PatternBrush(Brushes.Percent20(foreColor, Color32.Transparent));
+ public static PatternBrush Percent20(Color foreColor)
+ => new PatternBrush(Brushes.Percent20(foreColor, Color.Transparent));
///
/// Create as brush that will paint a Percent20 Hatch Pattern with
@@ -53,8 +53,8 @@ namespace ImageSharp.Drawing.Brushes
/// Color of the foreground.
/// Color of the background.
/// A Brush
- public static PatternBrush Percent20(Color32 foreColor, Color32 backColor)
- => new PatternBrush(Brushes.Percent20(foreColor, backColor));
+ public static PatternBrush Percent20(Color foreColor, Color backColor)
+ => new PatternBrush(Brushes.Percent20(foreColor, backColor));
///
/// Create as brush that will paint a Horizontal Hatch Pattern with
@@ -62,8 +62,8 @@ namespace ImageSharp.Drawing.Brushes
///
/// Color of the foreground.
/// A Brush
- public static PatternBrush Horizontal(Color32 foreColor)
- => new PatternBrush(Brushes.Horizontal(foreColor, Color32.Transparent));
+ public static PatternBrush Horizontal(Color foreColor)
+ => new PatternBrush(Brushes.Horizontal(foreColor, Color.Transparent));
///
/// Create as brush that will paint a Horizontal Hatch Pattern with
@@ -72,8 +72,8 @@ namespace ImageSharp.Drawing.Brushes
/// Color of the foreground.
/// Color of the background.
/// A Brush
- public static PatternBrush Horizontal(Color32 foreColor, Color32 backColor)
- => new PatternBrush(Brushes.Horizontal(foreColor, backColor));
+ public static PatternBrush Horizontal(Color foreColor, Color backColor)
+ => new PatternBrush(Brushes.Horizontal(foreColor, backColor));
///
/// Create as brush that will paint a Min Hatch Pattern with
@@ -81,8 +81,8 @@ namespace ImageSharp.Drawing.Brushes
///
/// Color of the foreground.
/// A Brush
- public static PatternBrush Min(Color32 foreColor)
- => new PatternBrush(Brushes.Min(foreColor, Color32.Transparent));
+ public static PatternBrush Min(Color foreColor)
+ => new PatternBrush(Brushes.Min(foreColor, Color.Transparent));
///
/// Create as brush that will paint a Min Hatch Pattern with
@@ -91,8 +91,8 @@ namespace ImageSharp.Drawing.Brushes
/// Color of the foreground.
/// Color of the background.
/// A Brush
- public static PatternBrush Min(Color32 foreColor, Color32 backColor)
- => new PatternBrush(Brushes.Min(foreColor, backColor));
+ public static PatternBrush Min(Color foreColor, Color backColor)
+ => new PatternBrush(Brushes.Min(foreColor, backColor));
///
/// Create as brush that will paint a Vertical Hatch Pattern with
@@ -100,8 +100,8 @@ namespace ImageSharp.Drawing.Brushes
///
/// Color of the foreground.
/// A Brush
- public static PatternBrush Vertical(Color32 foreColor)
- => new PatternBrush(Brushes.Vertical(foreColor, Color32.Transparent));
+ public static PatternBrush Vertical(Color foreColor)
+ => new PatternBrush(Brushes.Vertical(foreColor, Color.Transparent));
///
/// Create as brush that will paint a Vertical Hatch Pattern with
@@ -110,8 +110,8 @@ namespace ImageSharp.Drawing.Brushes
/// Color of the foreground.
/// Color of the background.
/// A Brush
- public static PatternBrush Vertical(Color32 foreColor, Color32 backColor)
- => new PatternBrush(Brushes.Vertical(foreColor, backColor));
+ public static PatternBrush Vertical(Color foreColor, Color backColor)
+ => new PatternBrush(Brushes.Vertical(foreColor, backColor));
///
/// Create as brush that will paint a Forward Diagonal Hatch Pattern with
@@ -119,8 +119,8 @@ namespace ImageSharp.Drawing.Brushes
///
/// Color of the foreground.
/// A Brush
- public static PatternBrush ForwardDiagonal(Color32 foreColor)
- => new PatternBrush(Brushes.ForwardDiagonal(foreColor, Color32.Transparent));
+ public static PatternBrush ForwardDiagonal(Color foreColor)
+ => new PatternBrush(Brushes.ForwardDiagonal(foreColor, Color.Transparent));
///
/// Create as brush that will paint a Forward Diagonal Hatch Pattern with
@@ -129,8 +129,8 @@ namespace ImageSharp.Drawing.Brushes
/// Color of the foreground.
/// Color of the background.
/// A Brush
- public static PatternBrush ForwardDiagonal(Color32 foreColor, Color32 backColor)
- => new PatternBrush(Brushes.ForwardDiagonal(foreColor, backColor));
+ public static PatternBrush ForwardDiagonal(Color foreColor, Color backColor)
+ => new PatternBrush(Brushes.ForwardDiagonal(foreColor, backColor));
///
/// Create as brush that will paint a Backward Diagonal Hatch Pattern with
@@ -138,8 +138,8 @@ namespace ImageSharp.Drawing.Brushes
///
/// Color of the foreground.
/// A Brush
- public static PatternBrush BackwardDiagonal(Color32 foreColor)
- => new PatternBrush(Brushes.BackwardDiagonal(foreColor, Color32.Transparent));
+ public static PatternBrush BackwardDiagonal(Color foreColor)
+ => new PatternBrush(Brushes.BackwardDiagonal(foreColor, Color.Transparent));
///
/// Create as brush that will paint a Backward Diagonal Hatch Pattern with
@@ -148,7 +148,7 @@ namespace ImageSharp.Drawing.Brushes
/// Color of the foreground.
/// Color of the background.
/// A Brush
- public static PatternBrush BackwardDiagonal(Color32 foreColor, Color32 backColor)
- => new PatternBrush(Brushes.BackwardDiagonal(foreColor, backColor));
+ public static PatternBrush BackwardDiagonal(Color foreColor, Color backColor)
+ => new PatternBrush(Brushes.BackwardDiagonal(foreColor, backColor));
}
}
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Brushes/ImageBrush.cs b/src/ImageSharp.Drawing/Brushes/ImageBrush.cs
index 9ffd7e42b..a7124bfe8 100644
--- a/src/ImageSharp.Drawing/Brushes/ImageBrush.cs
+++ b/src/ImageSharp.Drawing/Brushes/ImageBrush.cs
@@ -6,15 +6,15 @@
namespace ImageSharp.Drawing.Brushes
{
///
- /// Provides an implementation of a solid brush for painting with repeating images. The brush uses for painting.
+ /// Provides an implementation of a solid brush for painting with repeating images. The brush uses for painting.
///
- public class ImageBrush : ImageBrush
+ public class ImageBrush : ImageBrush
{
///
/// Initializes a new instance of the class.
///
/// The image to paint.
- public ImageBrush(IImageBase image)
+ public ImageBrush(IImageBase image)
: base(image)
{
}
diff --git a/src/ImageSharp.Drawing/Brushes/PatternBrush.cs b/src/ImageSharp.Drawing/Brushes/PatternBrush.cs
index 027029718..5093a7df0 100644
--- a/src/ImageSharp.Drawing/Brushes/PatternBrush.cs
+++ b/src/ImageSharp.Drawing/Brushes/PatternBrush.cs
@@ -6,9 +6,9 @@
namespace ImageSharp.Drawing.Brushes
{
///
- /// Provides an implementation of a pattern brush for painting patterns. The brush use for painting.
+ /// Provides an implementation of a pattern brush for painting patterns. The brush use for painting.
///
- public class PatternBrush : PatternBrush
+ public class PatternBrush : PatternBrush
{
///
/// Initializes a new instance of the class.
@@ -16,7 +16,7 @@ namespace ImageSharp.Drawing.Brushes
/// Color of the fore.
/// Color of the back.
/// The pattern.
- public PatternBrush(Color32 foreColor, Color32 backColor, bool[,] pattern)
+ public PatternBrush(Color foreColor, Color backColor, bool[,] pattern)
: base(foreColor, backColor, pattern)
{
}
@@ -25,7 +25,7 @@ namespace ImageSharp.Drawing.Brushes
/// Initializes a new instance of the class.
///
/// The brush.
- internal PatternBrush(PatternBrush brush)
+ internal PatternBrush(PatternBrush brush)
: base(brush)
{
}
diff --git a/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs b/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs
index fce052cb8..0452a3f01 100644
--- a/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs
+++ b/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs
@@ -8,7 +8,7 @@ namespace ImageSharp.Drawing.Brushes
///
/// Provides an implementation of a recolor brush for painting color changes.
///
- public class RecolorBrush : RecolorBrush
+ public class RecolorBrush : RecolorBrush
{
///
/// Initializes a new instance of the class.
@@ -16,7 +16,7 @@ namespace ImageSharp.Drawing.Brushes
/// Color of the source.
/// Color of the target.
/// The threshold.
- public RecolorBrush(Color32 sourceColor, Color32 targetColor, float threshold)
+ public RecolorBrush(Color sourceColor, Color targetColor, float threshold)
: base(sourceColor, targetColor, threshold)
{
}
diff --git a/src/ImageSharp.Drawing/Brushes/SolidBrush.cs b/src/ImageSharp.Drawing/Brushes/SolidBrush.cs
index 93e2af6a4..123d8a7e3 100644
--- a/src/ImageSharp.Drawing/Brushes/SolidBrush.cs
+++ b/src/ImageSharp.Drawing/Brushes/SolidBrush.cs
@@ -6,15 +6,15 @@
namespace ImageSharp.Drawing.Brushes
{
///
- /// Provides an implementation of a solid brush for painting solid color areas. The brush uses for painting.
+ /// Provides an implementation of a solid brush for painting solid color areas. The brush uses for painting.
///
- public class SolidBrush : SolidBrush
+ public class SolidBrush : SolidBrush
{
///
/// Initializes a new instance of the class.
///
/// The color.
- public SolidBrush(Color32 color)
+ public SolidBrush(Color color)
: base(color)
{
}
diff --git a/src/ImageSharp.Drawing/Pens/Pen.cs b/src/ImageSharp.Drawing/Pens/Pen.cs
index 1b75c38b7..09fe89419 100644
--- a/src/ImageSharp.Drawing/Pens/Pen.cs
+++ b/src/ImageSharp.Drawing/Pens/Pen.cs
@@ -6,16 +6,16 @@
namespace ImageSharp.Drawing.Pens
{
///
- /// Represents a in the color space.
+ /// Represents a in the color space.
///
- public class Pen : Pen
+ public class Pen : Pen
{
///
/// Initializes a new instance of the class.
///
/// The color.
/// The width.
- public Pen(Color32 color, float width)
+ public Pen(Color color, float width)
: base(color, width)
{
}
@@ -25,7 +25,7 @@ namespace ImageSharp.Drawing.Pens
///
/// The brush.
/// The width.
- public Pen(IBrush brush, float width)
+ public Pen(IBrush brush, float width)
: base(brush, width)
{
}
@@ -36,7 +36,7 @@ namespace ImageSharp.Drawing.Pens
/// The brush.
/// The width.
/// The pattern.
- public Pen(IBrush brush, float width, float[] pattern)
+ public Pen(IBrush brush, float width, float[] pattern)
: base(brush, width, pattern)
{
}
@@ -45,7 +45,7 @@ namespace ImageSharp.Drawing.Pens
/// Initializes a new instance of the class.
///
/// The pen.
- internal Pen(Pen pen)
+ internal Pen(Pen pen)
: base(pen)
{
}
diff --git a/src/ImageSharp.Drawing/Pens/Pens.cs b/src/ImageSharp.Drawing/Pens/Pens.cs
index b45695ceb..039b7113f 100644
--- a/src/ImageSharp.Drawing/Pens/Pens.cs
+++ b/src/ImageSharp.Drawing/Pens/Pens.cs
@@ -16,7 +16,7 @@ namespace ImageSharp.Drawing.Pens
/// The color.
/// The width.
/// The Pen
- public static Pen Solid(Color32 color, float width) => new Pen(color, width);
+ public static Pen Solid(Color color, float width) => new Pen(color, width);
///
/// Create a solid pen with out any drawing patterns
@@ -24,7 +24,7 @@ namespace ImageSharp.Drawing.Pens
/// The brush.
/// The width.
/// The Pen
- public static Pen Solid(IBrush brush, float width) => new Pen(brush, width);
+ public static Pen Solid(IBrush brush, float width) => new Pen(brush, width);
///
/// Create a pen with a 'Dash' drawing patterns
@@ -32,7 +32,7 @@ namespace ImageSharp.Drawing.Pens
/// The color.
/// The width.
/// The Pen
- public static Pen Dash(Color32 color, float width) => new Pen(Pens.Dash(color, width));
+ public static Pen Dash(Color color, float width) => new Pen(Pens.Dash(color, width));
///
/// Create a pen with a 'Dash' drawing patterns
@@ -40,7 +40,7 @@ namespace ImageSharp.Drawing.Pens
/// The brush.
/// The width.
/// The Pen
- public static Pen Dash(IBrush brush, float width) => new Pen(Pens.Dash(brush, width));
+ public static Pen Dash(IBrush brush, float width) => new Pen(Pens.Dash(brush, width));
///
/// Create a pen with a 'Dot' drawing patterns
@@ -48,7 +48,7 @@ namespace ImageSharp.Drawing.Pens
/// The color.
/// The width.
/// The Pen
- public static Pen Dot(Color32 color, float width) => new Pen(Pens.Dot(color, width));
+ public static Pen Dot(Color color, float width) => new Pen(Pens.Dot(color, width));
///
/// Create a pen with a 'Dot' drawing patterns
@@ -56,7 +56,7 @@ namespace ImageSharp.Drawing.Pens
/// The brush.
/// The width.
/// The Pen
- public static Pen Dot(IBrush brush, float width) => new Pen(Pens.Dot(brush, width));
+ public static Pen Dot(IBrush brush, float width) => new Pen(Pens.Dot(brush, width));
///
/// Create a pen with a 'Dash Dot' drawing patterns
@@ -64,7 +64,7 @@ namespace ImageSharp.Drawing.Pens
/// The color.
/// The width.
/// The Pen
- public static Pen DashDot(Color32 color, float width) => new Pen(Pens.DashDot(color, width));
+ public static Pen DashDot(Color color, float width) => new Pen(Pens.DashDot(color, width));
///
/// Create a pen with a 'Dash Dot' drawing patterns
@@ -72,7 +72,7 @@ namespace ImageSharp.Drawing.Pens
/// The brush.
/// The width.
/// The Pen
- public static Pen DashDot(IBrush brush, float width) => new Pen(Pens.DashDot(brush, width));
+ public static Pen DashDot(IBrush brush, float width) => new Pen(Pens.DashDot(brush, width));
///
/// Create a pen with a 'Dash Dot Dot' drawing patterns
@@ -80,7 +80,7 @@ namespace ImageSharp.Drawing.Pens
/// The color.
/// The width.
/// The Pen
- public static Pen DashDotDot(Color32 color, float width) => new Pen(Pens.DashDotDot(color, width));
+ public static Pen DashDotDot(Color color, float width) => new Pen(Pens.DashDotDot(color, width));
///
/// Create a pen with a 'Dash Dot Dot' drawing patterns
@@ -88,6 +88,6 @@ namespace ImageSharp.Drawing.Pens
/// The brush.
/// The width.
/// The Pen
- public static Pen DashDotDot(IBrush brush, float width) => new Pen(Pens.DashDotDot(brush, width));
+ public static Pen DashDotDot(IBrush brush, float width) => new Pen(Pens.DashDotDot(brush, width));
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Colors/Color.BulkOperations.cs b/src/ImageSharp/Colors/Color.BulkOperations.cs
index 671578e4c..2de8222d6 100644
--- a/src/ImageSharp/Colors/Color.BulkOperations.cs
+++ b/src/ImageSharp/Colors/Color.BulkOperations.cs
@@ -1,11 +1,17 @@
-namespace ImageSharp
+//
+// Copyright (c) James Jackson-South and contributors.
+// Licensed under the Apache License, Version 2.0.
+//
+
+namespace ImageSharp
{
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
+ using System.Runtime.InteropServices;
///
- /// Unpacked pixel type containing four 16-bit unsigned normalized values ranging from 0 to 1.
+ /// Unpacked pixel type containing four 8-bit unsigned normalized values ranging from 0 to 255.
/// The color components are stored in red, green, blue, and alpha order.
///
///
@@ -19,17 +25,265 @@
///
internal class BulkOperations : BulkPixelOperations
{
+ ///
+ /// SIMD optimized bulk implementation of
+ /// that works only with `count` divisible by .
+ ///
+ /// The to the source colors.
+ /// The to the dstination vectors.
+ /// The number of pixels to convert.
+ ///
+ /// Implementation adapted from:
+ ///
+ /// http://stackoverflow.com/a/5362789
+ ///
+ /// TODO: We can replace this implementation in the future using new Vector API-s:
+ ///
+ /// https://github.com/dotnet/corefx/issues/15957
+ ///
+ ///
+ internal static unsafe void ToVector4SimdAligned(BufferSpan sourceColors, BufferSpan destVectors, int count)
+ {
+ if (!Vector.IsHardwareAccelerated)
+ {
+ throw new InvalidOperationException(
+ "Color32.BulkOperations.ToVector4SimdAligned() should not be called when Vector.IsHardwareAccelerated == false!");
+ }
+
+ int vecSize = Vector.Count;
+
+ DebugGuard.IsTrue(
+ count % vecSize == 0,
+ nameof(count),
+ "Argument 'count' should divisible by Vector.Count!");
+
+ Vector bVec = new Vector(256.0f / 255.0f);
+ Vector magicFloat = new Vector(32768.0f);
+ Vector magicInt = new Vector(1191182336); // reinterpreded value of 32768.0f
+ Vector mask = new Vector(255);
+
+ int unpackedRawCount = count * 4;
+
+ ref uint src = ref Unsafe.As(ref sourceColors.DangerousGetPinnableReference());
+
+ using (Buffer tempBuf = new Buffer(
+ unpackedRawCount + Vector.Count))
+ {
+ uint[] temp = tempBuf.Array;
+ float[] fTemp = Unsafe.As(temp);
+
+ ref UnpackedRGBA tempBase = ref Unsafe.As(ref tempBuf[0]);
+
+ for (int i = 0; i < count; i++)
+ {
+ uint sVal = Unsafe.Add(ref src, i);
+ ref UnpackedRGBA dst = ref Unsafe.Add(ref tempBase, i);
+
+ // This call is the bottleneck now:
+ dst.Load(sVal);
+ }
+
+ for (int i = 0; i < unpackedRawCount; i += vecSize)
+ {
+ Vector vi = new Vector(temp, i);
+
+ vi &= mask;
+ vi |= magicInt;
+
+ Vector vf = Vector.AsVectorSingle(vi);
+ vf = (vf - magicFloat) * bVec;
+ vf.CopyTo(fTemp, i);
+ }
+
+ BufferSpan.Copy(tempBuf.Span.AsBytes(), destVectors.AsBytes(), unpackedRawCount * sizeof(uint));
+ }
+ }
+
///
internal override void ToVector4(BufferSpan sourceColors, BufferSpan destVectors, int count)
{
- ref Vector4 sourceRef = ref Unsafe.As(ref sourceColors.DangerousGetPinnableReference());
- ref Vector4 destRef = ref destVectors.DangerousGetPinnableReference();
+ if (count < 256 || !Vector.IsHardwareAccelerated)
+ {
+ // Doesn't worth to bother with SIMD:
+ base.ToVector4(sourceColors, destVectors, count);
+ return;
+ }
+
+ int remainder = count % Vector.Count;
+
+ int alignedCount = count - remainder;
+
+ if (alignedCount > 0)
+ {
+ ToVector4SimdAligned(sourceColors, destVectors, alignedCount);
+ }
+
+ if (remainder > 0)
+ {
+ sourceColors = sourceColors.Slice(alignedCount);
+ destVectors = destVectors.Slice(alignedCount);
+ base.ToVector4(sourceColors, destVectors, remainder);
+ }
+ }
+
+ ///
+ internal override void PackFromXyzBytes(BufferSpan sourceBytes, BufferSpan destColors, int count)
+ {
+ ref RGB24 sourceRef = ref Unsafe.As(ref sourceBytes.DangerousGetPinnableReference());
+ ref Color destRef = ref destColors.DangerousGetPinnableReference();
for (int i = 0; i < count; i++)
{
- ref Vector4 sp = ref Unsafe.Add(ref sourceRef, i);
- ref Vector4 dp = ref Unsafe.Add(ref destRef, i);
- dp = sp;
+ ref RGB24 sp = ref Unsafe.Add(ref sourceRef, i);
+ ref Color dp = ref Unsafe.Add(ref destRef, i);
+
+ Unsafe.As(ref dp) = sp;
+ dp.A = 255;
+ }
+ }
+
+ ///
+ internal override void ToXyzBytes(BufferSpan sourceColors, BufferSpan destBytes, int count)
+ {
+ ref Color sourceRef = ref sourceColors.DangerousGetPinnableReference();
+ ref RGB24 destRef = ref Unsafe.As(ref destBytes.DangerousGetPinnableReference());
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Color sp = ref Unsafe.Add(ref sourceRef, i);
+ ref RGB24 dp = ref Unsafe.Add(ref destRef, i);
+
+ dp = Unsafe.As(ref sp);
+ }
+ }
+
+ ///
+ internal override unsafe void PackFromXyzwBytes(BufferSpan sourceBytes, BufferSpan destColors, int count)
+ {
+ BufferSpan.Copy(sourceBytes, destColors.AsBytes(), count * sizeof(Color));
+ }
+
+ ///
+ internal override unsafe void ToXyzwBytes(BufferSpan sourceColors, BufferSpan destBytes, int count)
+ {
+ BufferSpan.Copy(sourceColors.AsBytes(), destBytes, count * sizeof(Color));
+ }
+
+ ///
+ internal override void PackFromZyxBytes(BufferSpan sourceBytes, BufferSpan destColors, int count)
+ {
+ ref RGB24 sourceRef = ref Unsafe.As(ref sourceBytes.DangerousGetPinnableReference());
+ ref Color destRef = ref destColors.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref RGB24 sp = ref Unsafe.Add(ref sourceRef, i);
+ ref Color dp = ref Unsafe.Add(ref destRef, i);
+
+ Unsafe.As(ref dp) = sp.ToZyx();
+ dp.A = 255;
+ }
+ }
+
+ ///
+ internal override void ToZyxBytes(BufferSpan sourceColors, BufferSpan destBytes, int count)
+ {
+ ref Color sourceRef = ref sourceColors.DangerousGetPinnableReference();
+ ref RGB24 destRef = ref Unsafe.As(ref destBytes.DangerousGetPinnableReference());
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Color sp = ref Unsafe.Add(ref sourceRef, i);
+ ref RGB24 dp = ref Unsafe.Add(ref destRef, i);
+
+ dp = Unsafe.As(ref sp).ToZyx();
+ }
+ }
+
+ ///
+ internal override void PackFromZyxwBytes(BufferSpan sourceBytes, BufferSpan destColors, int count)
+ {
+ ref RGBA32 sourceRef = ref Unsafe.As(ref sourceBytes.DangerousGetPinnableReference());
+ ref Color destRef = ref destColors.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref RGBA32 sp = ref Unsafe.Add(ref sourceRef, i);
+ ref Color dp = ref Unsafe.Add(ref destRef, i);
+ RGBA32 zyxw = sp.ToZyxw();
+ dp = Unsafe.As(ref zyxw);
+ }
+ }
+
+ ///
+ internal override void ToZyxwBytes(BufferSpan sourceColors, BufferSpan destBytes, int count)
+ {
+ ref Color sourceRef = ref sourceColors.DangerousGetPinnableReference();
+ ref RGBA32 destRef = ref Unsafe.As(ref destBytes.DangerousGetPinnableReference());
+
+ for (int i = 0; i < count; i++)
+ {
+ ref RGBA32 sp = ref Unsafe.As(ref Unsafe.Add(ref sourceRef, i));
+ ref RGBA32 dp = ref Unsafe.Add(ref destRef, i);
+ dp = sp.ToZyxw();
+ }
+ }
+
+ ///
+ /// Helper struct to manipulate 3-byte RGB data.
+ ///
+ [StructLayout(LayoutKind.Sequential)]
+ private struct RGB24
+ {
+ private byte x;
+
+ private byte y;
+
+ private byte z;
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public RGB24 ToZyx() => new RGB24 { x = this.z, y = this.y, z = this.x };
+ }
+
+ ///
+ /// Helper struct to manipulate 4-byte RGBA data.
+ ///
+ [StructLayout(LayoutKind.Sequential)]
+ private struct RGBA32
+ {
+ private byte x;
+
+ private byte y;
+
+ private byte z;
+
+ private byte w;
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public RGBA32 ToZyxw() => new RGBA32 { x = this.z, y = this.y, z = this.x, w = this.w };
+ }
+
+ ///
+ /// Value type to store -s unpacked into multiple -s.
+ ///
+ [StructLayout(LayoutKind.Sequential)]
+ private struct UnpackedRGBA
+ {
+ private uint r;
+
+ private uint g;
+
+ private uint b;
+
+ private uint a;
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Load(uint p)
+ {
+ this.r = p;
+ this.g = p >> GreenShift;
+ this.b = p >> BlueShift;
+ this.a = p >> AlphaShift;
}
}
}
diff --git a/src/ImageSharp/Colors/Color.Definitions.cs b/src/ImageSharp/Colors/Color.Definitions.cs
new file mode 100644
index 000000000..4bc0d486a
--- /dev/null
+++ b/src/ImageSharp/Colors/Color.Definitions.cs
@@ -0,0 +1,728 @@
+//
+// Copyright (c) James Jackson-South and contributors.
+// Licensed under the Apache License, Version 2.0.
+//
+
+namespace ImageSharp
+{
+ ///
+ /// Packed vector type containing four 8-bit unsigned normalized values ranging from 0 to 255.
+ /// The color components are stored in red, green, blue, and alpha order.
+ ///
+ ///
+ /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance,
+ /// as it avoids the need to create new values for modification operations.
+ ///
+ public partial struct Color
+ {
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #F0F8FF.
+ ///
+ public static readonly Color AliceBlue = NamedColors.AliceBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FAEBD7.
+ ///
+ public static readonly Color AntiqueWhite = NamedColors.AntiqueWhite;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #00FFFF.
+ ///
+ public static readonly Color Aqua = NamedColors.Aqua;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #7FFFD4.
+ ///
+ public static readonly Color Aquamarine = NamedColors.Aquamarine;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #F0FFFF.
+ ///
+ public static readonly Color Azure = NamedColors.Azure;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #F5F5DC.
+ ///
+ public static readonly Color Beige = NamedColors.Beige;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFE4C4.
+ ///
+ public static readonly Color Bisque = NamedColors.Bisque;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #000000.
+ ///
+ public static readonly Color Black = NamedColors.Black;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFEBCD.
+ ///
+ public static readonly Color BlanchedAlmond = NamedColors.BlanchedAlmond;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #0000FF.
+ ///
+ public static readonly Color Blue = NamedColors.Blue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #8A2BE2.
+ ///
+ public static readonly Color BlueViolet = NamedColors.BlueViolet;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #A52A2A.
+ ///
+ public static readonly Color Brown = NamedColors.Brown;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #DEB887.
+ ///
+ public static readonly Color BurlyWood = NamedColors.BurlyWood;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #5F9EA0.
+ ///
+ public static readonly Color CadetBlue = NamedColors.CadetBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #7FFF00.
+ ///
+ public static readonly Color Chartreuse = NamedColors.Chartreuse;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #D2691E.
+ ///
+ public static readonly Color Chocolate = NamedColors.Chocolate;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FF7F50.
+ ///
+ public static readonly Color Coral = NamedColors.Coral;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #6495ED.
+ ///
+ public static readonly Color CornflowerBlue = NamedColors.CornflowerBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFF8DC.
+ ///
+ public static readonly Color Cornsilk = NamedColors.Cornsilk;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #DC143C.
+ ///
+ public static readonly Color Crimson = NamedColors.Crimson;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #00FFFF.
+ ///
+ public static readonly Color Cyan = NamedColors.Cyan;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #00008B.
+ ///
+ public static readonly Color DarkBlue = NamedColors.DarkBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #008B8B.
+ ///
+ public static readonly Color DarkCyan = NamedColors.DarkCyan;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #B8860B.
+ ///
+ public static readonly Color DarkGoldenrod = NamedColors.DarkGoldenrod;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #A9A9A9.
+ ///
+ public static readonly Color DarkGray = NamedColors.DarkGray;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #006400.
+ ///
+ public static readonly Color DarkGreen = NamedColors.DarkGreen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #BDB76B.
+ ///
+ public static readonly Color DarkKhaki = NamedColors.DarkKhaki;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #8B008B.
+ ///
+ public static readonly Color DarkMagenta = NamedColors.DarkMagenta;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #556B2F.
+ ///
+ public static readonly Color DarkOliveGreen = NamedColors.DarkOliveGreen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FF8C00.
+ ///
+ public static readonly Color DarkOrange = NamedColors.DarkOrange;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #9932CC.
+ ///
+ public static readonly Color DarkOrchid = NamedColors.DarkOrchid;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #8B0000.
+ ///
+ public static readonly Color DarkRed = NamedColors.DarkRed;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #E9967A.
+ ///
+ public static readonly Color DarkSalmon = NamedColors.DarkSalmon;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #8FBC8B.
+ ///
+ public static readonly Color DarkSeaGreen = NamedColors.DarkSeaGreen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #483D8B.
+ ///
+ public static readonly Color DarkSlateBlue = NamedColors.DarkSlateBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #2F4F4F.
+ ///
+ public static readonly Color DarkSlateGray = NamedColors.DarkSlateGray;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #00CED1.
+ ///
+ public static readonly Color DarkTurquoise = NamedColors.DarkTurquoise;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #9400D3.
+ ///
+ public static readonly Color DarkViolet = NamedColors.DarkViolet;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FF1493.
+ ///
+ public static readonly Color DeepPink = NamedColors.DeepPink;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #00BFFF.
+ ///
+ public static readonly Color DeepSkyBlue = NamedColors.DeepSkyBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #696969.
+ ///
+ public static readonly Color DimGray = NamedColors.DimGray;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #1E90FF.
+ ///
+ public static readonly Color DodgerBlue = NamedColors.DodgerBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #B22222.
+ ///
+ public static readonly Color Firebrick = NamedColors.Firebrick;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFFAF0.
+ ///
+ public static readonly Color FloralWhite = NamedColors.FloralWhite;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #228B22.
+ ///
+ public static readonly Color ForestGreen = NamedColors.ForestGreen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FF00FF.
+ ///
+ public static readonly Color Fuchsia = NamedColors.Fuchsia;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #DCDCDC.
+ ///
+ public static readonly Color Gainsboro = NamedColors.Gainsboro;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #F8F8FF.
+ ///
+ public static readonly Color GhostWhite = NamedColors.GhostWhite;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFD700.
+ ///
+ public static readonly Color Gold = NamedColors.Gold;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #DAA520.
+ ///
+ public static readonly Color Goldenrod = NamedColors.Goldenrod;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #808080.
+ ///
+ public static readonly Color Gray = NamedColors.Gray;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #008000.
+ ///
+ public static readonly Color Green = NamedColors.Green;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #ADFF2F.
+ ///
+ public static readonly Color GreenYellow = NamedColors.GreenYellow;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #F0FFF0.
+ ///
+ public static readonly Color Honeydew = NamedColors.Honeydew;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FF69B4.
+ ///
+ public static readonly Color HotPink = NamedColors.HotPink;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #CD5C5C.
+ ///
+ public static readonly Color IndianRed = NamedColors.IndianRed;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #4B0082.
+ ///
+ public static readonly Color Indigo = NamedColors.Indigo;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFFFF0.
+ ///
+ public static readonly Color Ivory = NamedColors.Ivory;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #F0E68C.
+ ///
+ public static readonly Color Khaki = NamedColors.Khaki;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #E6E6FA.
+ ///
+ public static readonly Color Lavender = NamedColors.Lavender;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFF0F5.
+ ///
+ public static readonly Color LavenderBlush = NamedColors.LavenderBlush;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #7CFC00.
+ ///
+ public static readonly Color LawnGreen = NamedColors.LawnGreen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFFACD.
+ ///
+ public static readonly Color LemonChiffon = NamedColors.LemonChiffon;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #ADD8E6.
+ ///
+ public static readonly Color LightBlue = NamedColors.LightBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #F08080.
+ ///
+ public static readonly Color LightCoral = NamedColors.LightCoral;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #E0FFFF.
+ ///
+ public static readonly Color LightCyan = NamedColors.LightCyan;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FAFAD2.
+ ///
+ public static readonly Color LightGoldenrodYellow = NamedColors.LightGoldenrodYellow;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #D3D3D3.
+ ///
+ public static readonly Color LightGray = NamedColors.LightGray;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #90EE90.
+ ///
+ public static readonly Color LightGreen = NamedColors.LightGreen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFB6C1.
+ ///
+ public static readonly Color LightPink = NamedColors.LightPink;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFA07A.
+ ///
+ public static readonly Color LightSalmon = NamedColors.LightSalmon;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #20B2AA.
+ ///
+ public static readonly Color LightSeaGreen = NamedColors.LightSeaGreen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #87CEFA.
+ ///
+ public static readonly Color LightSkyBlue = NamedColors.LightSkyBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #778899.
+ ///
+ public static readonly Color LightSlateGray = NamedColors.LightSlateGray;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #B0C4DE.
+ ///
+ public static readonly Color LightSteelBlue = NamedColors.LightSteelBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFFFE0.
+ ///
+ public static readonly Color LightYellow = NamedColors.LightYellow;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #00FF00.
+ ///
+ public static readonly Color Lime = NamedColors.Lime;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #32CD32.
+ ///
+ public static readonly Color LimeGreen = NamedColors.LimeGreen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FAF0E6.
+ ///
+ public static readonly Color Linen = NamedColors.Linen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FF00FF.
+ ///
+ public static readonly Color Magenta = NamedColors.Magenta;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #800000.
+ ///
+ public static readonly Color Maroon = NamedColors.Maroon;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #66CDAA.
+ ///
+ public static readonly Color MediumAquamarine = NamedColors.MediumAquamarine;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #0000CD.
+ ///
+ public static readonly Color MediumBlue = NamedColors.MediumBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #BA55D3.
+ ///
+ public static readonly Color MediumOrchid = NamedColors.MediumOrchid;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #9370DB.
+ ///
+ public static readonly Color MediumPurple = NamedColors.MediumPurple;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #3CB371.
+ ///
+ public static readonly Color MediumSeaGreen = NamedColors.MediumSeaGreen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #7B68EE.
+ ///
+ public static readonly Color MediumSlateBlue = NamedColors.MediumSlateBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #00FA9A.
+ ///
+ public static readonly Color MediumSpringGreen = NamedColors.MediumSpringGreen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #48D1CC.
+ ///
+ public static readonly Color MediumTurquoise = NamedColors.MediumTurquoise;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #C71585.
+ ///
+ public static readonly Color MediumVioletRed = NamedColors.MediumVioletRed;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #191970.
+ ///
+ public static readonly Color MidnightBlue = NamedColors.MidnightBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #F5FFFA.
+ ///
+ public static readonly Color MintCream = NamedColors.MintCream;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFE4E1.
+ ///
+ public static readonly Color MistyRose = NamedColors.MistyRose;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFE4B5.
+ ///
+ public static readonly Color Moccasin = NamedColors.Moccasin;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFDEAD.
+ ///
+ public static readonly Color NavajoWhite = NamedColors.NavajoWhite;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #000080.
+ ///
+ public static readonly Color Navy = NamedColors.Navy;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FDF5E6.
+ ///
+ public static readonly Color OldLace = NamedColors.OldLace;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #808000.
+ ///
+ public static readonly Color Olive = NamedColors.Olive;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #6B8E23.
+ ///
+ public static readonly Color OliveDrab = NamedColors.OliveDrab;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFA500.
+ ///
+ public static readonly Color Orange = NamedColors.Orange;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FF4500.
+ ///
+ public static readonly Color OrangeRed = NamedColors.OrangeRed;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #DA70D6.
+ ///
+ public static readonly Color Orchid = NamedColors.Orchid;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #EEE8AA.
+ ///
+ public static readonly Color PaleGoldenrod = NamedColors.PaleGoldenrod;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #98FB98.
+ ///
+ public static readonly Color PaleGreen = NamedColors.PaleGreen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #AFEEEE.
+ ///
+ public static readonly Color PaleTurquoise = NamedColors.PaleTurquoise;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #DB7093.
+ ///
+ public static readonly Color PaleVioletRed = NamedColors.PaleVioletRed;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFEFD5.
+ ///
+ public static readonly Color PapayaWhip = NamedColors.PapayaWhip;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFDAB9.
+ ///
+ public static readonly Color PeachPuff = NamedColors.PeachPuff;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #CD853F.
+ ///
+ public static readonly Color Peru = NamedColors.Peru;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFC0CB.
+ ///
+ public static readonly Color Pink = NamedColors.Pink;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #DDA0DD.
+ ///
+ public static readonly Color Plum = NamedColors.Plum;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #B0E0E6.
+ ///
+ public static readonly Color PowderBlue = NamedColors.PowderBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #800080.
+ ///
+ public static readonly Color Purple = NamedColors.Purple;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #663399.
+ ///
+ public static readonly Color RebeccaPurple = NamedColors.RebeccaPurple;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FF0000.
+ ///
+ public static readonly Color Red = NamedColors.Red;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #BC8F8F.
+ ///
+ public static readonly Color RosyBrown = NamedColors.RosyBrown;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #4169E1.
+ ///
+ public static readonly Color RoyalBlue = NamedColors.RoyalBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #8B4513.
+ ///
+ public static readonly Color SaddleBrown = NamedColors.SaddleBrown;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FA8072.
+ ///
+ public static readonly Color Salmon = NamedColors.Salmon;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #F4A460.
+ ///
+ public static readonly Color SandyBrown = NamedColors.SandyBrown;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #2E8B57.
+ ///
+ public static readonly Color SeaGreen = NamedColors.SeaGreen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFF5EE.
+ ///
+ public static readonly Color SeaShell = NamedColors.SeaShell;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #A0522D.
+ ///
+ public static readonly Color Sienna = NamedColors.Sienna;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #C0C0C0.
+ ///
+ public static readonly Color Silver = NamedColors.Silver;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #87CEEB.
+ ///
+ public static readonly Color SkyBlue = NamedColors.SkyBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #6A5ACD.
+ ///
+ public static readonly Color SlateBlue = NamedColors.SlateBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #708090.
+ ///
+ public static readonly Color SlateGray = NamedColors.SlateGray;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFFAFA.
+ ///
+ public static readonly Color Snow = NamedColors.Snow;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #00FF7F.
+ ///
+ public static readonly Color SpringGreen = NamedColors.SpringGreen;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #4682B4.
+ ///
+ public static readonly Color SteelBlue = NamedColors.SteelBlue;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #D2B48C.
+ ///
+ public static readonly Color Tan = NamedColors.Tan;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #008080.
+ ///
+ public static readonly Color Teal = NamedColors.Teal;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #D8BFD8.
+ ///
+ public static readonly Color Thistle = NamedColors.Thistle;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FF6347.
+ ///
+ public static readonly Color Tomato = NamedColors.Tomato;
+
+ ///
+ /// Represents a matching the W3C definition that has an hex value of #FFFFFF.
+ ///
+ public static readonly Color Transparent = NamedColors.Transparent;
+
+ ///
+ /// Represents a