mirror of https://github.com/SixLabors/ImageSharp
Browse Source
* temporarily disable target frameworks * drop DelegateProcessor * drop IImageProcessingContext<TPixel> * drop NamedColors<T> * drop ColorBuilder<T> * drop the *Base postfix for clean class hierarchies * re-enable target frameworks * use MathF in gradient brushes * Move PngFilterMethod to the correct namespace.af/merge-core
committed by
James Jackson-South
60 changed files with 223 additions and 1347 deletions
@ -1,7 +1,7 @@ |
|||||
// Copyright (c) Six Labors and contributors.
|
// Copyright (c) Six Labors and contributors.
|
||||
// Licensed under the Apache License, Version 2.0.
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
|
||||
namespace SixLabors.ImageSharp.Formats |
namespace SixLabors.ImageSharp.Formats.Png |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Provides enumeration of available PNG filter methods.
|
/// Provides enumeration of available PNG filter methods.
|
||||
@ -1,104 +0,0 @@ |
|||||
// Copyright (c) Six Labors and contributors.
|
|
||||
// Licensed under the Apache License, Version 2.0.
|
|
||||
|
|
||||
using System; |
|
||||
using System.Buffers.Binary; |
|
||||
using System.Globalization; |
|
||||
|
|
||||
namespace SixLabors.ImageSharp.PixelFormats |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// A set of named colors mapped to the provided Color space.
|
|
||||
/// </summary>
|
|
||||
/// <typeparam name="TPixel">The type of the color.</typeparam>
|
|
||||
public static class ColorBuilder<TPixel> |
|
||||
where TPixel : struct, IPixel<TPixel> |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Creates a new <typeparamref name="TPixel"/> representation from the string representing a color.
|
|
||||
/// </summary>
|
|
||||
/// <param name="hex">
|
|
||||
/// The hexadecimal representation of the combined color components arranged
|
|
||||
/// in rgb, rgba, rrggbb, or rrggbbaa format to match web syntax.
|
|
||||
/// </param>
|
|
||||
/// <returns>Returns a <typeparamref name="TPixel"/> that represents the color defined by the provided RGBA hex string.</returns>
|
|
||||
public static TPixel FromHex(string hex) |
|
||||
{ |
|
||||
Guard.NotNullOrWhiteSpace(hex, nameof(hex)); |
|
||||
|
|
||||
hex = ToRgbaHex(hex); |
|
||||
|
|
||||
if (hex is null || !uint.TryParse(hex, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out uint packedValue)) |
|
||||
{ |
|
||||
throw new ArgumentException("Hexadecimal string is not in the correct format.", nameof(hex)); |
|
||||
} |
|
||||
|
|
||||
TPixel result = default; |
|
||||
var rgba = new Rgba32(BinaryPrimitives.ReverseEndianness(packedValue)); |
|
||||
|
|
||||
result.FromRgba32(rgba); |
|
||||
return result; |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Creates a new <typeparamref name="TPixel"/> representation from standard RGB bytes with 100% opacity.
|
|
||||
/// </summary>
|
|
||||
/// <param name="red">The red intensity.</param>
|
|
||||
/// <param name="green">The green intensity.</param>
|
|
||||
/// <param name="blue">The blue intensity.</param>
|
|
||||
/// <returns>Returns a <typeparamref name="TPixel"/> that represents the color defined by the provided RGB values with 100% opacity.</returns>
|
|
||||
public static TPixel FromRgb(byte red, byte green, byte blue) => FromRgba(red, green, blue, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Creates a new <typeparamref name="TPixel"/> representation from standard RGBA bytes.
|
|
||||
/// </summary>
|
|
||||
/// <param name="red">The red intensity.</param>
|
|
||||
/// <param name="green">The green intensity.</param>
|
|
||||
/// <param name="blue">The blue intensity.</param>
|
|
||||
/// <param name="alpha">The alpha intensity.</param>
|
|
||||
/// <returns>Returns a <typeparamref name="TPixel"/> that represents the color defined by the provided RGBA values.</returns>
|
|
||||
public static TPixel FromRgba(byte red, byte green, byte blue, byte alpha) |
|
||||
{ |
|
||||
TPixel color = default; |
|
||||
color.FromRgba32(new Rgba32(red, green, blue, alpha)); |
|
||||
return color; |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Converts the specified hex value to an rrggbbaa hex value.
|
|
||||
/// </summary>
|
|
||||
/// <param name="hex">The hex value to convert.</param>
|
|
||||
/// <returns>
|
|
||||
/// A rrggbbaa hex value.
|
|
||||
/// </returns>
|
|
||||
private static string ToRgbaHex(string hex) |
|
||||
{ |
|
||||
if (hex[0] == '#') |
|
||||
{ |
|
||||
hex = hex.Substring(1); |
|
||||
} |
|
||||
|
|
||||
if (hex.Length == 8) |
|
||||
{ |
|
||||
return hex; |
|
||||
} |
|
||||
|
|
||||
if (hex.Length == 6) |
|
||||
{ |
|
||||
return hex + "FF"; |
|
||||
} |
|
||||
|
|
||||
if (hex.Length < 3 || hex.Length > 4) |
|
||||
{ |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
char r = hex[0]; |
|
||||
char g = hex[1]; |
|
||||
char b = hex[2]; |
|
||||
char a = hex.Length == 3 ? 'F' : hex[3]; |
|
||||
|
|
||||
return new string(new[] { r, r, g, g, b, b, a, a }); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,761 +0,0 @@ |
|||||
// Copyright (c) Six Labors and contributors.
|
|
||||
// Licensed under the Apache License, Version 2.0.
|
|
||||
|
|
||||
using System; |
|
||||
using System.Runtime.InteropServices; |
|
||||
|
|
||||
namespace SixLabors.ImageSharp.PixelFormats |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// A set of named colors mapped to the provided color space.
|
|
||||
/// </summary>
|
|
||||
/// <typeparam name="TPixel">The type of the color.</typeparam>
|
|
||||
public static class NamedColors<TPixel> |
|
||||
where TPixel : struct, IPixel<TPixel> |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Thread-safe backing field for the constant palettes.
|
|
||||
/// </summary>
|
|
||||
private static readonly Lazy<TPixel[]> WebSafePaletteLazy = new Lazy<TPixel[]>(GetWebSafePalette, true); |
|
||||
private static readonly Lazy<TPixel[]> WernerPaletteLazy = new Lazy<TPixel[]>(GetWernerPalette, true); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #F0F8FF.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel AliceBlue = ColorBuilder<TPixel>.FromRgba(240, 248, 255, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FAEBD7.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel AntiqueWhite = ColorBuilder<TPixel>.FromRgba(250, 235, 215, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #00FFFF.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Aqua = ColorBuilder<TPixel>.FromRgba(0, 255, 255, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #7FFFD4.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Aquamarine = ColorBuilder<TPixel>.FromRgba(127, 255, 212, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #F0FFFF.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Azure = ColorBuilder<TPixel>.FromRgba(240, 255, 255, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #F5F5DC.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Beige = ColorBuilder<TPixel>.FromRgba(245, 245, 220, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFE4C4.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Bisque = ColorBuilder<TPixel>.FromRgba(255, 228, 196, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #000000.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Black = ColorBuilder<TPixel>.FromRgba(0, 0, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFEBCD.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel BlanchedAlmond = ColorBuilder<TPixel>.FromRgba(255, 235, 205, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #0000FF.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Blue = ColorBuilder<TPixel>.FromRgba(0, 0, 255, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #8A2BE2.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel BlueViolet = ColorBuilder<TPixel>.FromRgba(138, 43, 226, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #A52A2A.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Brown = ColorBuilder<TPixel>.FromRgba(165, 42, 42, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #DEB887.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel BurlyWood = ColorBuilder<TPixel>.FromRgba(222, 184, 135, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #5F9EA0.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel CadetBlue = ColorBuilder<TPixel>.FromRgba(95, 158, 160, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #7FFF00.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Chartreuse = ColorBuilder<TPixel>.FromRgba(127, 255, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #D2691E.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Chocolate = ColorBuilder<TPixel>.FromRgba(210, 105, 30, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FF7F50.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Coral = ColorBuilder<TPixel>.FromRgba(255, 127, 80, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #6495ED.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel CornflowerBlue = ColorBuilder<TPixel>.FromRgba(100, 149, 237, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFF8DC.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Cornsilk = ColorBuilder<TPixel>.FromRgba(255, 248, 220, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #DC143C.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Crimson = ColorBuilder<TPixel>.FromRgba(220, 20, 60, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #00FFFF.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Cyan = ColorBuilder<TPixel>.FromRgba(0, 255, 255, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #00008B.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkBlue = ColorBuilder<TPixel>.FromRgba(0, 0, 139, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #008B8B.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkCyan = ColorBuilder<TPixel>.FromRgba(0, 139, 139, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #B8860B.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkGoldenrod = ColorBuilder<TPixel>.FromRgba(184, 134, 11, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #A9A9A9.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkGray = ColorBuilder<TPixel>.FromRgba(169, 169, 169, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #006400.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkGreen = ColorBuilder<TPixel>.FromRgba(0, 100, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #BDB76B.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkKhaki = ColorBuilder<TPixel>.FromRgba(189, 183, 107, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #8B008B.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkMagenta = ColorBuilder<TPixel>.FromRgba(139, 0, 139, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #556B2F.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkOliveGreen = ColorBuilder<TPixel>.FromRgba(85, 107, 47, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FF8C00.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkOrange = ColorBuilder<TPixel>.FromRgba(255, 140, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #9932CC.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkOrchid = ColorBuilder<TPixel>.FromRgba(153, 50, 204, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #8B0000.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkRed = ColorBuilder<TPixel>.FromRgba(139, 0, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #E9967A.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkSalmon = ColorBuilder<TPixel>.FromRgba(233, 150, 122, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #8FBC8B.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkSeaGreen = ColorBuilder<TPixel>.FromRgba(143, 188, 139, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #483D8B.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkSlateBlue = ColorBuilder<TPixel>.FromRgba(72, 61, 139, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #2F4F4F.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkSlateGray = ColorBuilder<TPixel>.FromRgba(47, 79, 79, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #00CED1.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkTurquoise = ColorBuilder<TPixel>.FromRgba(0, 206, 209, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #9400D3.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DarkViolet = ColorBuilder<TPixel>.FromRgba(148, 0, 211, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FF1493.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DeepPink = ColorBuilder<TPixel>.FromRgba(255, 20, 147, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #00BFFF.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DeepSkyBlue = ColorBuilder<TPixel>.FromRgba(0, 191, 255, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #696969.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DimGray = ColorBuilder<TPixel>.FromRgba(105, 105, 105, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #1E90FF.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel DodgerBlue = ColorBuilder<TPixel>.FromRgba(30, 144, 255, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #B22222.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Firebrick = ColorBuilder<TPixel>.FromRgba(178, 34, 34, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFFAF0.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel FloralWhite = ColorBuilder<TPixel>.FromRgba(255, 250, 240, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #228B22.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel ForestGreen = ColorBuilder<TPixel>.FromRgba(34, 139, 34, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FF00FF.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Fuchsia = ColorBuilder<TPixel>.FromRgba(255, 0, 255, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #DCDCDC.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Gainsboro = ColorBuilder<TPixel>.FromRgba(220, 220, 220, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #F8F8FF.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel GhostWhite = ColorBuilder<TPixel>.FromRgba(248, 248, 255, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFD700.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Gold = ColorBuilder<TPixel>.FromRgba(255, 215, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #DAA520.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Goldenrod = ColorBuilder<TPixel>.FromRgba(218, 165, 32, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #808080.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Gray = ColorBuilder<TPixel>.FromRgba(128, 128, 128, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #008000.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Green = ColorBuilder<TPixel>.FromRgba(0, 128, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #ADFF2F.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel GreenYellow = ColorBuilder<TPixel>.FromRgba(173, 255, 47, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #F0FFF0.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Honeydew = ColorBuilder<TPixel>.FromRgba(240, 255, 240, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FF69B4.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel HotPink = ColorBuilder<TPixel>.FromRgba(255, 105, 180, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #CD5C5C.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel IndianRed = ColorBuilder<TPixel>.FromRgba(205, 92, 92, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #4B0082.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Indigo = ColorBuilder<TPixel>.FromRgba(75, 0, 130, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFFFF0.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Ivory = ColorBuilder<TPixel>.FromRgba(255, 255, 240, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #F0E68C.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Khaki = ColorBuilder<TPixel>.FromRgba(240, 230, 140, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #E6E6FA.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Lavender = ColorBuilder<TPixel>.FromRgba(230, 230, 250, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFF0F5.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LavenderBlush = ColorBuilder<TPixel>.FromRgba(255, 240, 245, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #7CFC00.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LawnGreen = ColorBuilder<TPixel>.FromRgba(124, 252, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFFACD.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LemonChiffon = ColorBuilder<TPixel>.FromRgba(255, 250, 205, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #ADD8E6.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LightBlue = ColorBuilder<TPixel>.FromRgba(173, 216, 230, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #F08080.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LightCoral = ColorBuilder<TPixel>.FromRgba(240, 128, 128, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #E0FFFF.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LightCyan = ColorBuilder<TPixel>.FromRgba(224, 255, 255, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FAFAD2.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LightGoldenrodYellow = ColorBuilder<TPixel>.FromRgba(250, 250, 210, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #D3D3D3.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LightGray = ColorBuilder<TPixel>.FromRgba(211, 211, 211, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #90EE90.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LightGreen = ColorBuilder<TPixel>.FromRgba(144, 238, 144, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFB6C1.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LightPink = ColorBuilder<TPixel>.FromRgba(255, 182, 193, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFA07A.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LightSalmon = ColorBuilder<TPixel>.FromRgba(255, 160, 122, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #20B2AA.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LightSeaGreen = ColorBuilder<TPixel>.FromRgba(32, 178, 170, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #87CEFA.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LightSkyBlue = ColorBuilder<TPixel>.FromRgba(135, 206, 250, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #778899.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LightSlateGray = ColorBuilder<TPixel>.FromRgba(119, 136, 153, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #B0C4DE.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LightSteelBlue = ColorBuilder<TPixel>.FromRgba(176, 196, 222, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFFFE0.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LightYellow = ColorBuilder<TPixel>.FromRgba(255, 255, 224, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #00FF00.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Lime = ColorBuilder<TPixel>.FromRgba(0, 255, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #32CD32.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel LimeGreen = ColorBuilder<TPixel>.FromRgba(50, 205, 50, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FAF0E6.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Linen = ColorBuilder<TPixel>.FromRgba(250, 240, 230, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FF00FF.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Magenta = ColorBuilder<TPixel>.FromRgba(255, 0, 255, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #800000.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Maroon = ColorBuilder<TPixel>.FromRgba(128, 0, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #66CDAA.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel MediumAquamarine = ColorBuilder<TPixel>.FromRgba(102, 205, 170, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #0000CD.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel MediumBlue = ColorBuilder<TPixel>.FromRgba(0, 0, 205, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #BA55D3.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel MediumOrchid = ColorBuilder<TPixel>.FromRgba(186, 85, 211, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #9370DB.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel MediumPurple = ColorBuilder<TPixel>.FromRgba(147, 112, 219, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #3CB371.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel MediumSeaGreen = ColorBuilder<TPixel>.FromRgba(60, 179, 113, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #7B68EE.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel MediumSlateBlue = ColorBuilder<TPixel>.FromRgba(123, 104, 238, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #00FA9A.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel MediumSpringGreen = ColorBuilder<TPixel>.FromRgba(0, 250, 154, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #48D1CC.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel MediumTurquoise = ColorBuilder<TPixel>.FromRgba(72, 209, 204, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #C71585.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel MediumVioletRed = ColorBuilder<TPixel>.FromRgba(199, 21, 133, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #191970.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel MidnightBlue = ColorBuilder<TPixel>.FromRgba(25, 25, 112, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #F5FFFA.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel MintCream = ColorBuilder<TPixel>.FromRgba(245, 255, 250, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFE4E1.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel MistyRose = ColorBuilder<TPixel>.FromRgba(255, 228, 225, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFE4B5.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Moccasin = ColorBuilder<TPixel>.FromRgba(255, 228, 181, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFDEAD.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel NavajoWhite = ColorBuilder<TPixel>.FromRgba(255, 222, 173, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #000080.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Navy = ColorBuilder<TPixel>.FromRgba(0, 0, 128, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FDF5E6.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel OldLace = ColorBuilder<TPixel>.FromRgba(253, 245, 230, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #808000.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Olive = ColorBuilder<TPixel>.FromRgba(128, 128, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #6B8E23.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel OliveDrab = ColorBuilder<TPixel>.FromRgba(107, 142, 35, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFA500.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Orange = ColorBuilder<TPixel>.FromRgba(255, 165, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FF4500.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel OrangeRed = ColorBuilder<TPixel>.FromRgba(255, 69, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #DA70D6.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Orchid = ColorBuilder<TPixel>.FromRgba(218, 112, 214, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #EEE8AA.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel PaleGoldenrod = ColorBuilder<TPixel>.FromRgba(238, 232, 170, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #98FB98.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel PaleGreen = ColorBuilder<TPixel>.FromRgba(152, 251, 152, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #AFEEEE.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel PaleTurquoise = ColorBuilder<TPixel>.FromRgba(175, 238, 238, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #DB7093.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel PaleVioletRed = ColorBuilder<TPixel>.FromRgba(219, 112, 147, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFEFD5.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel PapayaWhip = ColorBuilder<TPixel>.FromRgba(255, 239, 213, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFDAB9.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel PeachPuff = ColorBuilder<TPixel>.FromRgba(255, 218, 185, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #CD853F.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Peru = ColorBuilder<TPixel>.FromRgba(205, 133, 63, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFC0CB.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Pink = ColorBuilder<TPixel>.FromRgba(255, 192, 203, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #DDA0DD.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Plum = ColorBuilder<TPixel>.FromRgba(221, 160, 221, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #B0E0E6.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel PowderBlue = ColorBuilder<TPixel>.FromRgba(176, 224, 230, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #800080.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Purple = ColorBuilder<TPixel>.FromRgba(128, 0, 128, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #663399.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel RebeccaPurple = ColorBuilder<TPixel>.FromRgba(102, 51, 153, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FF0000.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Red = ColorBuilder<TPixel>.FromRgba(255, 0, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #BC8F8F.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel RosyBrown = ColorBuilder<TPixel>.FromRgba(188, 143, 143, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #4169E1.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel RoyalBlue = ColorBuilder<TPixel>.FromRgba(65, 105, 225, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #8B4513.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel SaddleBrown = ColorBuilder<TPixel>.FromRgba(139, 69, 19, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FA8072.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Salmon = ColorBuilder<TPixel>.FromRgba(250, 128, 114, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #F4A460.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel SandyBrown = ColorBuilder<TPixel>.FromRgba(244, 164, 96, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #2E8B57.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel SeaGreen = ColorBuilder<TPixel>.FromRgba(46, 139, 87, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFF5EE.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel SeaShell = ColorBuilder<TPixel>.FromRgba(255, 245, 238, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #A0522D.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Sienna = ColorBuilder<TPixel>.FromRgba(160, 82, 45, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #C0C0C0.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Silver = ColorBuilder<TPixel>.FromRgba(192, 192, 192, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #87CEEB.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel SkyBlue = ColorBuilder<TPixel>.FromRgba(135, 206, 235, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #6A5ACD.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel SlateBlue = ColorBuilder<TPixel>.FromRgba(106, 90, 205, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #708090.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel SlateGray = ColorBuilder<TPixel>.FromRgba(112, 128, 144, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFFAFA.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Snow = ColorBuilder<TPixel>.FromRgba(255, 250, 250, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #00FF7F.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel SpringGreen = ColorBuilder<TPixel>.FromRgba(0, 255, 127, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #4682B4.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel SteelBlue = ColorBuilder<TPixel>.FromRgba(70, 130, 180, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #D2B48C.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Tan = ColorBuilder<TPixel>.FromRgba(210, 180, 140, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #008080.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Teal = ColorBuilder<TPixel>.FromRgba(0, 128, 128, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #D8BFD8.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Thistle = ColorBuilder<TPixel>.FromRgba(216, 191, 216, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FF6347.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Tomato = ColorBuilder<TPixel>.FromRgba(255, 99, 71, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFFFFF.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Transparent = ColorBuilder<TPixel>.FromRgba(255, 255, 255, 0); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #40E0D0.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Turquoise = ColorBuilder<TPixel>.FromRgba(64, 224, 208, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #EE82EE.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Violet = ColorBuilder<TPixel>.FromRgba(238, 130, 238, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #F5DEB3.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Wheat = ColorBuilder<TPixel>.FromRgba(245, 222, 179, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFFFFF.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel White = ColorBuilder<TPixel>.FromRgba(255, 255, 255, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #F5F5F5.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel WhiteSmoke = ColorBuilder<TPixel>.FromRgba(245, 245, 245, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #FFFF00.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel Yellow = ColorBuilder<TPixel>.FromRgba(255, 255, 0, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Represents a <see paramref="TPixel"/> matching the W3C definition that has an hex value of #9ACD32.
|
|
||||
/// </summary>
|
|
||||
public static readonly TPixel YellowGreen = ColorBuilder<TPixel>.FromRgba(154, 205, 50, 255); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Gets a <see cref="T:TPixel[]"/> collection of web safe, colors as defined in the CSS Color Module Level 4.
|
|
||||
/// </summary>
|
|
||||
public static TPixel[] WebSafePalette => WebSafePaletteLazy.Value; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Gets a <see cref="T:TPixel[]"/> collection of colors as defined in the original second edition of Werner’s Nomenclature of Colours 1821.
|
|
||||
/// The hex codes were collected and defined by Nicholas Rougeux <see href="https://www.c82.net/werner"/>
|
|
||||
/// </summary>
|
|
||||
public static TPixel[] WernerPalette => WernerPaletteLazy.Value; |
|
||||
|
|
||||
private static TPixel[] GetWebSafePalette() => GetPalette(ColorConstants.WebSafeColors); |
|
||||
|
|
||||
private static TPixel[] GetWernerPalette() => GetPalette(ColorConstants.WernerColors); |
|
||||
|
|
||||
private static TPixel[] GetPalette(Rgba32[] palette) |
|
||||
{ |
|
||||
var converted = new TPixel[palette.Length]; |
|
||||
|
|
||||
Span<byte> constantsBytes = MemoryMarshal.Cast<Rgba32, byte>(palette.AsSpan()); |
|
||||
PixelOperations<TPixel>.Instance.FromRgba32Bytes( |
|
||||
Configuration.Default, |
|
||||
constantsBytes, |
|
||||
converted, |
|
||||
palette.Length); |
|
||||
|
|
||||
return converted; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,46 +0,0 @@ |
|||||
// Copyright (c) Six Labors and contributors.
|
|
||||
// Licensed under the Apache License, Version 2.0.
|
|
||||
|
|
||||
using SixLabors.ImageSharp.PixelFormats; |
|
||||
using SixLabors.ImageSharp.Processing.Processors; |
|
||||
using SixLabors.Primitives; |
|
||||
|
|
||||
namespace SixLabors.ImageSharp.Processing |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// A pixel-specific interface to queue up image operations to apply to an image.
|
|
||||
/// </summary>
|
|
||||
/// <typeparam name="TPixel">The pixel format</typeparam>
|
|
||||
public interface IImageProcessingContext<TPixel> : IImageProcessingContext |
|
||||
where TPixel : struct, IPixel<TPixel> |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Adds the processor to the current set of image operations to be applied.
|
|
||||
/// </summary>
|
|
||||
/// <param name="processor">The processor to apply.</param>
|
|
||||
/// <param name="rectangle">The area to apply it to.</param>
|
|
||||
/// <returns>The current operations class to allow chaining of operations.</returns>
|
|
||||
IImageProcessingContext<TPixel> ApplyProcessor(IImageProcessor<TPixel> processor, Rectangle rectangle); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Adds the processor to the current set of image operations to be applied.
|
|
||||
/// </summary>
|
|
||||
/// <param name="processor">The processor to apply</param>
|
|
||||
/// <returns>The current operations class to allow chaining of operations.</returns>
|
|
||||
IImageProcessingContext<TPixel> ApplyProcessor(IImageProcessor<TPixel> processor); |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// An internal interface to queue up image operations and have a method to apply them to and return a result
|
|
||||
/// </summary>
|
|
||||
/// <typeparam name="TPixel">The pixel format</typeparam>
|
|
||||
internal interface IInternalImageProcessingContext<TPixel> : IImageProcessingContext<TPixel> |
|
||||
where TPixel : struct, IPixel<TPixel> |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Adds the processors to the current image
|
|
||||
/// </summary>
|
|
||||
/// <returns>The current image or a new image depending on whether this is allowed to mutate the source image.</returns>
|
|
||||
Image<TPixel> Apply(); |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,22 @@ |
|||||
|
// Copyright (c) Six Labors and contributors.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
|
||||
|
using SixLabors.ImageSharp.PixelFormats; |
||||
|
|
||||
|
namespace SixLabors.ImageSharp.Processing |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// An interface for internal operations we don't want to expose on <see cref="IImageProcessingContext"/>.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="TPixel">The pixel type.</typeparam>
|
||||
|
internal interface IInternalImageProcessingContext<TPixel> : IImageProcessingContext |
||||
|
where TPixel : struct, IPixel<TPixel> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Returns the result image to return by <see cref="ProcessingExtensions.Clone"/>
|
||||
|
/// (and other overloads).
|
||||
|
/// </summary>
|
||||
|
/// <returns>The current image or a new image depending on whether it is requested to mutate the source image.</returns>
|
||||
|
Image<TPixel> GetResultImage(); |
||||
|
} |
||||
|
} |
||||
@ -1,43 +0,0 @@ |
|||||
// Copyright (c) Six Labors and contributors.
|
|
||||
// Licensed under the Apache License, Version 2.0.
|
|
||||
|
|
||||
using System; |
|
||||
using SixLabors.ImageSharp.PixelFormats; |
|
||||
using SixLabors.Primitives; |
|
||||
|
|
||||
namespace SixLabors.ImageSharp.Processing.Processors |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Allows the application of processing algorithms to images via an action delegate
|
|
||||
/// </summary>
|
|
||||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
||||
internal class DelegateProcessor<TPixel> : ImageProcessor<TPixel> |
|
||||
where TPixel : struct, IPixel<TPixel> |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Initializes a new instance of the <see cref="DelegateProcessor{TPixel}"/> class.
|
|
||||
/// </summary>
|
|
||||
/// <param name="action">The action.</param>
|
|
||||
public DelegateProcessor(Action<Image<TPixel>> action) |
|
||||
{ |
|
||||
this.Action = action; |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Gets the action that will be applied to the image.
|
|
||||
/// </summary>
|
|
||||
internal Action<Image<TPixel>> Action { get; } |
|
||||
|
|
||||
/// <inheritdoc/>
|
|
||||
protected override void BeforeImageApply(Image<TPixel> source, Rectangle sourceRectangle) |
|
||||
{ |
|
||||
this.Action?.Invoke(source); |
|
||||
} |
|
||||
|
|
||||
/// <inheritdoc/>
|
|
||||
protected override void OnFrameApply(ImageFrame<TPixel> source, Rectangle sourceRectangle, Configuration configuration) |
|
||||
{ |
|
||||
// NOP, we did all we wanted to do inside BeforeImageApply
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,60 +0,0 @@ |
|||||
// Copyright (c) Six Labors and contributors.
|
|
||||
// Licensed under the Apache License, Version 2.0.
|
|
||||
|
|
||||
using SixLabors.ImageSharp.PixelFormats; |
|
||||
using SixLabors.ImageSharp.Processing; |
|
||||
using SixLabors.Primitives; |
|
||||
using Xunit; |
|
||||
|
|
||||
namespace SixLabors.ImageSharp.Tests |
|
||||
{ |
|
||||
public class ImageProcessingContextTests |
|
||||
{ |
|
||||
// [Fact]
|
|
||||
// public void MutatedSizeIsAccuratePerOperation()
|
|
||||
// {
|
|
||||
// var x500 = new Size(500, 500);
|
|
||||
// var x400 = new Size(400, 400);
|
|
||||
// var x300 = new Size(300, 300);
|
|
||||
// var x200 = new Size(200, 200);
|
|
||||
// var x100 = new Size(100, 100);
|
|
||||
// using (var image = new Image<Rgba32>(500, 500))
|
|
||||
// {
|
|
||||
// image.Mutate(x =>
|
|
||||
// x.AssertSize(x500)
|
|
||||
// .Resize(x400).AssertSize(x400)
|
|
||||
// .Resize(x300).AssertSize(x300)
|
|
||||
// .Resize(x200).AssertSize(x200)
|
|
||||
// .Resize(x100).AssertSize(x100));
|
|
||||
// }
|
|
||||
// }
|
|
||||
//
|
|
||||
// [Fact]
|
|
||||
// public void ClonedSizeIsAccuratePerOperation()
|
|
||||
// {
|
|
||||
// var x500 = new Size(500, 500);
|
|
||||
// var x400 = new Size(400, 400);
|
|
||||
// var x300 = new Size(300, 300);
|
|
||||
// var x200 = new Size(200, 200);
|
|
||||
// var x100 = new Size(100, 100);
|
|
||||
// using (var image = new Image<Rgba32>(500, 500))
|
|
||||
// {
|
|
||||
// image.Clone(x =>
|
|
||||
// x.AssertSize(x500)
|
|
||||
// .Resize(x400).AssertSize(x400)
|
|
||||
// .Resize(x300).AssertSize(x300)
|
|
||||
// .Resize(x200).AssertSize(x200)
|
|
||||
// .Resize(x100).AssertSize(x100));
|
|
||||
// }
|
|
||||
// }
|
|
||||
} |
|
||||
|
|
||||
public static class SizeAssertationExtensions |
|
||||
{ |
|
||||
public static IImageProcessingContext<Rgba32> AssertSize(this IImageProcessingContext<Rgba32> context, Size size) |
|
||||
{ |
|
||||
Assert.Equal(size, context.GetCurrentSize()); |
|
||||
return context; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,40 +0,0 @@ |
|||||
// Copyright (c) Six Labors and contributors.
|
|
||||
// Licensed under the Apache License, Version 2.0.
|
|
||||
|
|
||||
using System; |
|
||||
using SixLabors.ImageSharp.PixelFormats; |
|
||||
|
|
||||
using Xunit; |
|
||||
|
|
||||
namespace SixLabors.ImageSharp.Tests.Colors |
|
||||
{ |
|
||||
public class ColorBuilderTests |
|
||||
{ |
|
||||
[Fact] |
|
||||
public void ParseShortHex() |
|
||||
{ |
|
||||
Assert.Equal(new Rgb24(255, 255, 255), ColorBuilder<Rgb24>.FromHex("#fff")); |
|
||||
Assert.Equal(new Rgb24(255, 255, 255), ColorBuilder<Rgb24>.FromHex("fff")); |
|
||||
Assert.Equal(new Rgba32(0, 0, 0, 255), ColorBuilder<Rgba32>.FromHex("000f")); |
|
||||
} |
|
||||
|
|
||||
[Fact] |
|
||||
public void ParseHexLeadingPoundIsOptional() |
|
||||
{ |
|
||||
Assert.Equal(new Rgb24(0, 128, 128), ColorBuilder<Rgb24>.FromHex("#008080")); |
|
||||
Assert.Equal(new Rgb24(0, 128, 128), ColorBuilder<Rgb24>.FromHex("008080")); |
|
||||
} |
|
||||
|
|
||||
[Fact] |
|
||||
public void ParseHexThrowsOnEmpty() |
|
||||
{ |
|
||||
Assert.Throws<ArgumentException>(() => ColorBuilder<Rgb24>.FromHex("")); |
|
||||
} |
|
||||
|
|
||||
[Fact] |
|
||||
public void ParseHexThrowsOnNull() |
|
||||
{ |
|
||||
Assert.Throws<ArgumentNullException>(() => ColorBuilder<Rgb24>.FromHex(null)); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,46 +0,0 @@ |
|||||
// Copyright (c) Six Labors and contributors.
|
|
||||
// Licensed under the Apache License, Version 2.0.
|
|
||||
|
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Reflection; |
|
||||
using SixLabors.ImageSharp.PixelFormats; |
|
||||
using Xunit; |
|
||||
|
|
||||
namespace SixLabors.ImageSharp.Tests |
|
||||
{ |
|
||||
public class ColorDefinitionTests |
|
||||
{ |
|
||||
public static TheoryData<string> ColorNames |
|
||||
{ |
|
||||
get |
|
||||
{ |
|
||||
var result = new TheoryData<string>(); |
|
||||
foreach (string name in typeof(NamedColors<Rgba32>).GetTypeInfo() |
|
||||
.GetFields().Where(x => x.Name != nameof(NamedColors<Rgba32>.WebSafePalette)).Select(x => x.Name)) |
|
||||
{ |
|
||||
result.Add(name); |
|
||||
} |
|
||||
return result; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
[Theory] |
|
||||
[MemberData(nameof(ColorNames))] |
|
||||
public void AllColorsAreOnGenericAndBaseColor(string name) |
|
||||
{ |
|
||||
FieldInfo generic = typeof(NamedColors<Rgba32>).GetTypeInfo().GetField(name); |
|
||||
FieldInfo specific = typeof(Rgba32).GetTypeInfo().GetField(name); |
|
||||
|
|
||||
Assert.NotNull(specific); |
|
||||
Assert.NotNull(generic); |
|
||||
Assert.True(specific.Attributes.HasFlag(FieldAttributes.Public), "specific must be public"); |
|
||||
Assert.True(specific.Attributes.HasFlag(FieldAttributes.Static), "specific must be static"); |
|
||||
Assert.True(generic.Attributes.HasFlag(FieldAttributes.Public), "generic must be public"); |
|
||||
Assert.True(generic.Attributes.HasFlag(FieldAttributes.Static), "generic must be static"); |
|
||||
Rgba32 expected = (Rgba32)generic.GetValue(null); |
|
||||
Rgba32 actual = (Rgba32)specific.GetValue(null); |
|
||||
Assert.Equal(expected, actual); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,25 +0,0 @@ |
|||||
// Copyright (c) Six Labors and contributors.
|
|
||||
// Licensed under the Apache License, Version 2.0.
|
|
||||
|
|
||||
using System; |
|
||||
using SixLabors.ImageSharp.PixelFormats; |
|
||||
using SixLabors.ImageSharp.Processing; |
|
||||
using Xunit; |
|
||||
|
|
||||
namespace SixLabors.ImageSharp.Tests.Processing |
|
||||
{ |
|
||||
using SixLabors.ImageSharp.Processing.Processors; |
|
||||
|
|
||||
public class DelegateTest : BaseImageOperationsExtensionTest |
|
||||
{ |
|
||||
[Fact] |
|
||||
public void Run_CreatedDelegateProcessor() |
|
||||
{ |
|
||||
Action<Image<Rgba32>> action = (i) => { }; |
|
||||
this.operations.Apply(action); |
|
||||
|
|
||||
DelegateProcessor<Rgba32> processor = this.Verify<DelegateProcessor<Rgba32>>(); |
|
||||
Assert.Equal(action, processor.Action); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue