mirror of https://github.com/SixLabors/ImageSharp
80 changed files with 4015 additions and 3460 deletions
@ -0,0 +1,21 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Runtime.CompilerServices; |
|||
using SixLabors.ImageSharp.Memory; |
|||
|
|||
namespace SixLabors.ImageSharp.Advanced |
|||
{ |
|||
/// <summary>
|
|||
/// Defines the contract for an action that operates on a row interval.
|
|||
/// </summary>
|
|||
public interface IRowIntervalOperation |
|||
{ |
|||
/// <summary>
|
|||
/// Invokes the method passing the row interval.
|
|||
/// </summary>
|
|||
/// <param name="rows">The row interval.</param>
|
|||
void Invoke(in RowInterval rows); |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Buffers; |
|||
using System.Runtime.CompilerServices; |
|||
using SixLabors.ImageSharp.Memory; |
|||
|
|||
namespace SixLabors.ImageSharp.Advanced |
|||
{ |
|||
/// <summary>
|
|||
/// Defines the contract for an action that operates on a row interval with a temporary buffer.
|
|||
/// </summary>
|
|||
/// <typeparam name="TBuffer">The type of buffer elements.</typeparam>
|
|||
public interface IRowIntervalOperation<TBuffer> |
|||
where TBuffer : unmanaged |
|||
{ |
|||
/// <summary>
|
|||
/// Invokes the method passing the row interval and a buffer.
|
|||
/// </summary>
|
|||
/// <param name="rows">The row interval.</param>
|
|||
/// <param name="span">The contiguous region of memory.</param>
|
|||
void Invoke(in RowInterval rows, Span<TBuffer> span); |
|||
} |
|||
} |
|||
@ -0,0 +1,110 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Buffers; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Threading.Tasks; |
|||
using SixLabors.ImageSharp.Memory; |
|||
|
|||
namespace SixLabors.ImageSharp.Advanced |
|||
{ |
|||
/// <content>
|
|||
/// Utility methods for batched processing of pixel row intervals.
|
|||
/// Parallel execution is optimized for image processing based on values defined
|
|||
/// <see cref="ParallelExecutionSettings"/> or <see cref="Configuration"/>.
|
|||
/// Using this class is preferred over direct usage of <see cref="Parallel"/> utility methods.
|
|||
/// </content>
|
|||
public static partial class ParallelRowIterator |
|||
{ |
|||
private readonly struct IterationParameters |
|||
{ |
|||
public readonly int MinY; |
|||
public readonly int MaxY; |
|||
public readonly int StepY; |
|||
public readonly int Width; |
|||
|
|||
public IterationParameters(int minY, int maxY, int stepY) |
|||
: this(minY, maxY, stepY, 0) |
|||
{ |
|||
} |
|||
|
|||
public IterationParameters(int minY, int maxY, int stepY, int width) |
|||
{ |
|||
this.MinY = minY; |
|||
this.MaxY = maxY; |
|||
this.StepY = stepY; |
|||
this.Width = width; |
|||
} |
|||
} |
|||
|
|||
private readonly struct RowIntervalOperationWrapper<T> |
|||
where T : struct, IRowIntervalOperation |
|||
{ |
|||
private readonly IterationParameters info; |
|||
private readonly T operation; |
|||
|
|||
[MethodImpl(InliningOptions.ShortMethod)] |
|||
public RowIntervalOperationWrapper(in IterationParameters info, in T operation) |
|||
{ |
|||
this.info = info; |
|||
this.operation = operation; |
|||
} |
|||
|
|||
[MethodImpl(InliningOptions.ShortMethod)] |
|||
public void Invoke(int i) |
|||
{ |
|||
int yMin = this.info.MinY + (i * this.info.StepY); |
|||
|
|||
if (yMin >= this.info.MaxY) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
int yMax = Math.Min(yMin + this.info.StepY, this.info.MaxY); |
|||
var rows = new RowInterval(yMin, yMax); |
|||
|
|||
// Skip the safety copy when invoking a potentially impure method on a readonly field
|
|||
Unsafe.AsRef(in this.operation).Invoke(in rows); |
|||
} |
|||
} |
|||
|
|||
private readonly struct RowIntervalOperationWrapper<T, TBuffer> |
|||
where T : struct, IRowIntervalOperation<TBuffer> |
|||
where TBuffer : unmanaged |
|||
{ |
|||
private readonly IterationParameters info; |
|||
private readonly MemoryAllocator allocator; |
|||
private readonly T operation; |
|||
|
|||
[MethodImpl(InliningOptions.ShortMethod)] |
|||
public RowIntervalOperationWrapper( |
|||
in IterationParameters info, |
|||
MemoryAllocator allocator, |
|||
in T operation) |
|||
{ |
|||
this.info = info; |
|||
this.allocator = allocator; |
|||
this.operation = operation; |
|||
} |
|||
|
|||
[MethodImpl(InliningOptions.ShortMethod)] |
|||
public void Invoke(int i) |
|||
{ |
|||
int yMin = this.info.MinY + (i * this.info.StepY); |
|||
|
|||
if (yMin >= this.info.MaxY) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
int yMax = Math.Min(yMin + this.info.StepY, this.info.MaxY); |
|||
var rows = new RowInterval(yMin, yMax); |
|||
|
|||
using IMemoryOwner<TBuffer> buffer = this.allocator.Allocate<TBuffer>(this.info.Width); |
|||
|
|||
Unsafe.AsRef(in this.operation).Invoke(in rows, buffer.Memory.Span); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,162 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Buffers; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Threading.Tasks; |
|||
using SixLabors.ImageSharp.Memory; |
|||
|
|||
namespace SixLabors.ImageSharp.Advanced |
|||
{ |
|||
/// <summary>
|
|||
/// Utility methods for batched processing of pixel row intervals.
|
|||
/// Parallel execution is optimized for image processing based on values defined
|
|||
/// <see cref="ParallelExecutionSettings"/> or <see cref="Configuration"/>.
|
|||
/// Using this class is preferred over direct usage of <see cref="Parallel"/> utility methods.
|
|||
/// </summary>
|
|||
public static partial class ParallelRowIterator |
|||
{ |
|||
/// <summary>
|
|||
/// Iterate through the rows of a rectangle in optimized batches defined by <see cref="RowInterval"/>-s.
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The type of row operation to perform.</typeparam>
|
|||
/// <param name="configuration">The <see cref="Configuration"/> to get the parallel settings from.</param>
|
|||
/// <param name="rectangle">The <see cref="Rectangle"/>.</param>
|
|||
/// <param name="operation">The operation defining the iteration logic on a single <see cref="RowInterval"/>.</param>
|
|||
[MethodImpl(InliningOptions.ShortMethod)] |
|||
public static void IterateRows<T>(Configuration configuration, Rectangle rectangle, in T operation) |
|||
where T : struct, IRowIntervalOperation |
|||
{ |
|||
var parallelSettings = ParallelExecutionSettings.FromConfiguration(configuration); |
|||
IterateRows(rectangle, in parallelSettings, in operation); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Iterate through the rows of a rectangle in optimized batches defined by <see cref="RowInterval"/>-s.
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The type of row operation to perform.</typeparam>
|
|||
/// <param name="rectangle">The <see cref="Rectangle"/>.</param>
|
|||
/// <param name="parallelSettings">The <see cref="ParallelExecutionSettings"/>.</param>
|
|||
/// <param name="operation">The operation defining the iteration logic on a single <see cref="RowInterval"/>.</param>
|
|||
public static void IterateRows<T>( |
|||
Rectangle rectangle, |
|||
in ParallelExecutionSettings parallelSettings, |
|||
in T operation) |
|||
where T : struct, IRowIntervalOperation |
|||
{ |
|||
ValidateRectangle(rectangle); |
|||
|
|||
int top = rectangle.Top; |
|||
int bottom = rectangle.Bottom; |
|||
int width = rectangle.Width; |
|||
int height = rectangle.Height; |
|||
|
|||
int maxSteps = DivideCeil(width * height, parallelSettings.MinimumPixelsProcessedPerTask); |
|||
int numOfSteps = Math.Min(parallelSettings.MaxDegreeOfParallelism, maxSteps); |
|||
|
|||
// Avoid TPL overhead in this trivial case:
|
|||
if (numOfSteps == 1) |
|||
{ |
|||
var rows = new RowInterval(top, bottom); |
|||
Unsafe.AsRef(in operation).Invoke(in rows); |
|||
return; |
|||
} |
|||
|
|||
int verticalStep = DivideCeil(rectangle.Height, numOfSteps); |
|||
var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = numOfSteps }; |
|||
var info = new IterationParameters(top, bottom, verticalStep); |
|||
var wrappingOperation = new RowIntervalOperationWrapper<T>(in info, in operation); |
|||
|
|||
Parallel.For( |
|||
0, |
|||
numOfSteps, |
|||
parallelOptions, |
|||
wrappingOperation.Invoke); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Iterate through the rows of a rectangle in optimized batches defined by <see cref="RowInterval"/>-s
|
|||
/// instantiating a temporary buffer for each <paramref name="operation"/> invocation.
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The type of row operation to perform.</typeparam>
|
|||
/// <typeparam name="TBuffer">The type of buffer elements.</typeparam>
|
|||
/// <param name="configuration">The <see cref="Configuration"/> to get the parallel settings from.</param>
|
|||
/// <param name="rectangle">The <see cref="Rectangle"/>.</param>
|
|||
/// <param name="operation">The operation defining the iteration logic on a single <see cref="RowInterval"/>.</param>
|
|||
public static void IterateRows<T, TBuffer>(Configuration configuration, Rectangle rectangle, in T operation) |
|||
where T : struct, IRowIntervalOperation<TBuffer> |
|||
where TBuffer : unmanaged |
|||
{ |
|||
var parallelSettings = ParallelExecutionSettings.FromConfiguration(configuration); |
|||
IterateRows<T, TBuffer>(rectangle, in parallelSettings, in operation); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Iterate through the rows of a rectangle in optimized batches defined by <see cref="RowInterval"/>-s
|
|||
/// instantiating a temporary buffer for each <paramref name="operation"/> invocation.
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The type of row operation to perform.</typeparam>
|
|||
/// <typeparam name="TBuffer">The type of buffer elements.</typeparam>
|
|||
/// <param name="rectangle">The <see cref="Rectangle"/>.</param>
|
|||
/// <param name="parallelSettings">The <see cref="ParallelExecutionSettings"/>.</param>
|
|||
/// <param name="operation">The operation defining the iteration logic on a single <see cref="RowInterval"/>.</param>
|
|||
public static void IterateRows<T, TBuffer>( |
|||
Rectangle rectangle, |
|||
in ParallelExecutionSettings parallelSettings, |
|||
in T operation) |
|||
where T : struct, IRowIntervalOperation<TBuffer> |
|||
where TBuffer : unmanaged |
|||
{ |
|||
ValidateRectangle(rectangle); |
|||
|
|||
int top = rectangle.Top; |
|||
int bottom = rectangle.Bottom; |
|||
int width = rectangle.Width; |
|||
int height = rectangle.Height; |
|||
|
|||
int maxSteps = DivideCeil(width * height, parallelSettings.MinimumPixelsProcessedPerTask); |
|||
int numOfSteps = Math.Min(parallelSettings.MaxDegreeOfParallelism, maxSteps); |
|||
MemoryAllocator allocator = parallelSettings.MemoryAllocator; |
|||
|
|||
// Avoid TPL overhead in this trivial case:
|
|||
if (numOfSteps == 1) |
|||
{ |
|||
var rows = new RowInterval(top, bottom); |
|||
using (IMemoryOwner<TBuffer> buffer = allocator.Allocate<TBuffer>(width)) |
|||
{ |
|||
Unsafe.AsRef(operation).Invoke(in rows, buffer.Memory.Span); |
|||
} |
|||
|
|||
return; |
|||
} |
|||
|
|||
int verticalStep = DivideCeil(height, numOfSteps); |
|||
var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = numOfSteps }; |
|||
var info = new IterationParameters(top, bottom, verticalStep, width); |
|||
var wrappingOperation = new RowIntervalOperationWrapper<T, TBuffer>(in info, allocator, in operation); |
|||
|
|||
Parallel.For( |
|||
0, |
|||
numOfSteps, |
|||
parallelOptions, |
|||
wrappingOperation.Invoke); |
|||
} |
|||
|
|||
[MethodImpl(InliningOptions.ShortMethod)] |
|||
private static int DivideCeil(int dividend, int divisor) => 1 + ((dividend - 1) / divisor); |
|||
|
|||
private static void ValidateRectangle(Rectangle rectangle) |
|||
{ |
|||
Guard.MustBeGreaterThan( |
|||
rectangle.Width, |
|||
0, |
|||
$"{nameof(rectangle)}.{nameof(rectangle.Width)}"); |
|||
|
|||
Guard.MustBeGreaterThan( |
|||
rectangle.Height, |
|||
0, |
|||
$"{nameof(rectangle)}.{nameof(rectangle.Height)}"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,160 +0,0 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Buffers; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Threading.Tasks; |
|||
|
|||
using SixLabors.ImageSharp.Memory; |
|||
|
|||
namespace SixLabors.ImageSharp.Advanced.ParallelUtils |
|||
{ |
|||
/// <summary>
|
|||
/// Utility methods for batched processing of pixel row intervals.
|
|||
/// Parallel execution is optimized for image processing based on values defined
|
|||
/// <see cref="ParallelExecutionSettings"/> or <see cref="Configuration"/>.
|
|||
/// Using this class is preferred over direct usage of <see cref="Parallel"/> utility methods.
|
|||
/// </summary>
|
|||
public static class ParallelHelper |
|||
{ |
|||
/// <summary>
|
|||
/// Iterate through the rows of a rectangle in optimized batches defined by <see cref="RowInterval"/>-s.
|
|||
/// </summary>
|
|||
/// <param name="rectangle">The <see cref="Rectangle"/>.</param>
|
|||
/// <param name="configuration">The <see cref="Configuration"/> to get the parallel settings from.</param>
|
|||
/// <param name="body">The method body defining the iteration logic on a single <see cref="RowInterval"/>.</param>
|
|||
public static void IterateRows(Rectangle rectangle, Configuration configuration, Action<RowInterval> body) |
|||
{ |
|||
var parallelSettings = ParallelExecutionSettings.FromConfiguration(configuration); |
|||
|
|||
IterateRows(rectangle, parallelSettings, body); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Iterate through the rows of a rectangle in optimized batches defined by <see cref="RowInterval"/>-s.
|
|||
/// </summary>
|
|||
/// <param name="rectangle">The <see cref="Rectangle"/>.</param>
|
|||
/// <param name="parallelSettings">The <see cref="ParallelExecutionSettings"/>.</param>
|
|||
/// <param name="body">The method body defining the iteration logic on a single <see cref="RowInterval"/>.</param>
|
|||
public static void IterateRows( |
|||
Rectangle rectangle, |
|||
in ParallelExecutionSettings parallelSettings, |
|||
Action<RowInterval> body) |
|||
{ |
|||
ValidateRectangle(rectangle); |
|||
|
|||
int maxSteps = DivideCeil( |
|||
rectangle.Width * rectangle.Height, |
|||
parallelSettings.MinimumPixelsProcessedPerTask); |
|||
|
|||
int numOfSteps = Math.Min(parallelSettings.MaxDegreeOfParallelism, maxSteps); |
|||
|
|||
// Avoid TPL overhead in this trivial case:
|
|||
if (numOfSteps == 1) |
|||
{ |
|||
var rows = new RowInterval(rectangle.Top, rectangle.Bottom); |
|||
body(rows); |
|||
return; |
|||
} |
|||
|
|||
int verticalStep = DivideCeil(rectangle.Height, numOfSteps); |
|||
|
|||
var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = numOfSteps }; |
|||
|
|||
Parallel.For( |
|||
0, |
|||
numOfSteps, |
|||
parallelOptions, |
|||
i => |
|||
{ |
|||
int yMin = rectangle.Top + (i * verticalStep); |
|||
int yMax = Math.Min(yMin + verticalStep, rectangle.Bottom); |
|||
|
|||
var rows = new RowInterval(yMin, yMax); |
|||
body(rows); |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Iterate through the rows of a rectangle in optimized batches defined by <see cref="RowInterval"/>-s
|
|||
/// instantiating a temporary buffer for each <paramref name="body"/> invocation.
|
|||
/// </summary>
|
|||
internal static void IterateRowsWithTempBuffer<T>( |
|||
Rectangle rectangle, |
|||
in ParallelExecutionSettings parallelSettings, |
|||
Action<RowInterval, Memory<T>> body) |
|||
where T : unmanaged |
|||
{ |
|||
ValidateRectangle(rectangle); |
|||
|
|||
int maxSteps = DivideCeil(rectangle.Width * rectangle.Height, parallelSettings.MinimumPixelsProcessedPerTask); |
|||
|
|||
int numOfSteps = Math.Min(parallelSettings.MaxDegreeOfParallelism, maxSteps); |
|||
|
|||
MemoryAllocator memoryAllocator = parallelSettings.MemoryAllocator; |
|||
|
|||
// Avoid TPL overhead in this trivial case:
|
|||
if (numOfSteps == 1) |
|||
{ |
|||
var rows = new RowInterval(rectangle.Top, rectangle.Bottom); |
|||
using (IMemoryOwner<T> buffer = memoryAllocator.Allocate<T>(rectangle.Width)) |
|||
{ |
|||
body(rows, buffer.Memory); |
|||
} |
|||
|
|||
return; |
|||
} |
|||
|
|||
int verticalStep = DivideCeil(rectangle.Height, numOfSteps); |
|||
|
|||
var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = numOfSteps }; |
|||
|
|||
Parallel.For( |
|||
0, |
|||
numOfSteps, |
|||
parallelOptions, |
|||
i => |
|||
{ |
|||
int yMin = rectangle.Top + (i * verticalStep); |
|||
int yMax = Math.Min(yMin + verticalStep, rectangle.Bottom); |
|||
|
|||
var rows = new RowInterval(yMin, yMax); |
|||
|
|||
using (IMemoryOwner<T> buffer = memoryAllocator.Allocate<T>(rectangle.Width)) |
|||
{ |
|||
body(rows, buffer.Memory); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Iterate through the rows of a rectangle in optimized batches defined by <see cref="RowInterval"/>-s
|
|||
/// instantiating a temporary buffer for each <paramref name="body"/> invocation.
|
|||
/// </summary>
|
|||
internal static void IterateRowsWithTempBuffer<T>( |
|||
Rectangle rectangle, |
|||
Configuration configuration, |
|||
Action<RowInterval, Memory<T>> body) |
|||
where T : unmanaged |
|||
{ |
|||
IterateRowsWithTempBuffer(rectangle, ParallelExecutionSettings.FromConfiguration(configuration), body); |
|||
} |
|||
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
private static int DivideCeil(int dividend, int divisor) => 1 + ((dividend - 1) / divisor); |
|||
|
|||
private static void ValidateRectangle(Rectangle rectangle) |
|||
{ |
|||
Guard.MustBeGreaterThan( |
|||
rectangle.Width, |
|||
0, |
|||
$"{nameof(rectangle)}.{nameof(rectangle.Width)}"); |
|||
|
|||
Guard.MustBeGreaterThan( |
|||
rectangle.Height, |
|||
0, |
|||
$"{nameof(rectangle)}.{nameof(rectangle.Height)}"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,278 +0,0 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <summary>
|
|||
/// Provides useful color definitions.
|
|||
/// </summary>
|
|||
public static class ColorConstants |
|||
{ |
|||
/// <summary>
|
|||
/// Gets a collection of named, web safe, colors as defined in the CSS Color Module Level 4.
|
|||
/// </summary>
|
|||
public static readonly Rgba32[] WebSafeColors = |
|||
{ |
|||
Rgba32.AliceBlue, |
|||
Rgba32.AntiqueWhite, |
|||
Rgba32.Aqua, |
|||
Rgba32.Aquamarine, |
|||
Rgba32.Azure, |
|||
Rgba32.Beige, |
|||
Rgba32.Bisque, |
|||
Rgba32.Black, |
|||
Rgba32.BlanchedAlmond, |
|||
Rgba32.Blue, |
|||
Rgba32.BlueViolet, |
|||
Rgba32.Brown, |
|||
Rgba32.BurlyWood, |
|||
Rgba32.CadetBlue, |
|||
Rgba32.Chartreuse, |
|||
Rgba32.Chocolate, |
|||
Rgba32.Coral, |
|||
Rgba32.CornflowerBlue, |
|||
Rgba32.Cornsilk, |
|||
Rgba32.Crimson, |
|||
Rgba32.Cyan, |
|||
Rgba32.DarkBlue, |
|||
Rgba32.DarkCyan, |
|||
Rgba32.DarkGoldenrod, |
|||
Rgba32.DarkGray, |
|||
Rgba32.DarkGreen, |
|||
Rgba32.DarkKhaki, |
|||
Rgba32.DarkMagenta, |
|||
Rgba32.DarkOliveGreen, |
|||
Rgba32.DarkOrange, |
|||
Rgba32.DarkOrchid, |
|||
Rgba32.DarkRed, |
|||
Rgba32.DarkSalmon, |
|||
Rgba32.DarkSeaGreen, |
|||
Rgba32.DarkSlateBlue, |
|||
Rgba32.DarkSlateGray, |
|||
Rgba32.DarkTurquoise, |
|||
Rgba32.DarkViolet, |
|||
Rgba32.DeepPink, |
|||
Rgba32.DeepSkyBlue, |
|||
Rgba32.DimGray, |
|||
Rgba32.DodgerBlue, |
|||
Rgba32.Firebrick, |
|||
Rgba32.FloralWhite, |
|||
Rgba32.ForestGreen, |
|||
Rgba32.Fuchsia, |
|||
Rgba32.Gainsboro, |
|||
Rgba32.GhostWhite, |
|||
Rgba32.Gold, |
|||
Rgba32.Goldenrod, |
|||
Rgba32.Gray, |
|||
Rgba32.Green, |
|||
Rgba32.GreenYellow, |
|||
Rgba32.Honeydew, |
|||
Rgba32.HotPink, |
|||
Rgba32.IndianRed, |
|||
Rgba32.Indigo, |
|||
Rgba32.Ivory, |
|||
Rgba32.Khaki, |
|||
Rgba32.Lavender, |
|||
Rgba32.LavenderBlush, |
|||
Rgba32.LawnGreen, |
|||
Rgba32.LemonChiffon, |
|||
Rgba32.LightBlue, |
|||
Rgba32.LightCoral, |
|||
Rgba32.LightCyan, |
|||
Rgba32.LightGoldenrodYellow, |
|||
Rgba32.LightGray, |
|||
Rgba32.LightGreen, |
|||
Rgba32.LightPink, |
|||
Rgba32.LightSalmon, |
|||
Rgba32.LightSeaGreen, |
|||
Rgba32.LightSkyBlue, |
|||
Rgba32.LightSlateGray, |
|||
Rgba32.LightSteelBlue, |
|||
Rgba32.LightYellow, |
|||
Rgba32.Lime, |
|||
Rgba32.LimeGreen, |
|||
Rgba32.Linen, |
|||
Rgba32.Magenta, |
|||
Rgba32.Maroon, |
|||
Rgba32.MediumAquamarine, |
|||
Rgba32.MediumBlue, |
|||
Rgba32.MediumOrchid, |
|||
Rgba32.MediumPurple, |
|||
Rgba32.MediumSeaGreen, |
|||
Rgba32.MediumSlateBlue, |
|||
Rgba32.MediumSpringGreen, |
|||
Rgba32.MediumTurquoise, |
|||
Rgba32.MediumVioletRed, |
|||
Rgba32.MidnightBlue, |
|||
Rgba32.MintCream, |
|||
Rgba32.MistyRose, |
|||
Rgba32.Moccasin, |
|||
Rgba32.NavajoWhite, |
|||
Rgba32.Navy, |
|||
Rgba32.OldLace, |
|||
Rgba32.Olive, |
|||
Rgba32.OliveDrab, |
|||
Rgba32.Orange, |
|||
Rgba32.OrangeRed, |
|||
Rgba32.Orchid, |
|||
Rgba32.PaleGoldenrod, |
|||
Rgba32.PaleGreen, |
|||
Rgba32.PaleTurquoise, |
|||
Rgba32.PaleVioletRed, |
|||
Rgba32.PapayaWhip, |
|||
Rgba32.PeachPuff, |
|||
Rgba32.Peru, |
|||
Rgba32.Pink, |
|||
Rgba32.Plum, |
|||
Rgba32.PowderBlue, |
|||
Rgba32.Purple, |
|||
Rgba32.RebeccaPurple, |
|||
Rgba32.Red, |
|||
Rgba32.RosyBrown, |
|||
Rgba32.RoyalBlue, |
|||
Rgba32.SaddleBrown, |
|||
Rgba32.Salmon, |
|||
Rgba32.SandyBrown, |
|||
Rgba32.SeaGreen, |
|||
Rgba32.SeaShell, |
|||
Rgba32.Sienna, |
|||
Rgba32.Silver, |
|||
Rgba32.SkyBlue, |
|||
Rgba32.SlateBlue, |
|||
Rgba32.SlateGray, |
|||
Rgba32.Snow, |
|||
Rgba32.SpringGreen, |
|||
Rgba32.SteelBlue, |
|||
Rgba32.Tan, |
|||
Rgba32.Teal, |
|||
Rgba32.Thistle, |
|||
Rgba32.Tomato, |
|||
Rgba32.Transparent, |
|||
Rgba32.Turquoise, |
|||
Rgba32.Violet, |
|||
Rgba32.Wheat, |
|||
Rgba32.White, |
|||
Rgba32.WhiteSmoke, |
|||
Rgba32.Yellow, |
|||
Rgba32.YellowGreen |
|||
}; |
|||
|
|||
/// <summary>
|
|||
/// Gets a 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 readonly Rgba32[] WernerColors = |
|||
{ |
|||
Rgba32.FromHex("#f1e9cd"), |
|||
Rgba32.FromHex("#f2e7cf"), |
|||
Rgba32.FromHex("#ece6d0"), |
|||
Rgba32.FromHex("#f2eacc"), |
|||
Rgba32.FromHex("#f3e9ca"), |
|||
Rgba32.FromHex("#f2ebcd"), |
|||
Rgba32.FromHex("#e6e1c9"), |
|||
Rgba32.FromHex("#e2ddc6"), |
|||
Rgba32.FromHex("#cbc8b7"), |
|||
Rgba32.FromHex("#bfbbb0"), |
|||
Rgba32.FromHex("#bebeb3"), |
|||
Rgba32.FromHex("#b7b5ac"), |
|||
Rgba32.FromHex("#bab191"), |
|||
Rgba32.FromHex("#9c9d9a"), |
|||
Rgba32.FromHex("#8a8d84"), |
|||
Rgba32.FromHex("#5b5c61"), |
|||
Rgba32.FromHex("#555152"), |
|||
Rgba32.FromHex("#413f44"), |
|||
Rgba32.FromHex("#454445"), |
|||
Rgba32.FromHex("#423937"), |
|||
Rgba32.FromHex("#433635"), |
|||
Rgba32.FromHex("#252024"), |
|||
Rgba32.FromHex("#241f20"), |
|||
Rgba32.FromHex("#281f3f"), |
|||
Rgba32.FromHex("#1c1949"), |
|||
Rgba32.FromHex("#4f638d"), |
|||
Rgba32.FromHex("#383867"), |
|||
Rgba32.FromHex("#5c6b8f"), |
|||
Rgba32.FromHex("#657abb"), |
|||
Rgba32.FromHex("#6f88af"), |
|||
Rgba32.FromHex("#7994b5"), |
|||
Rgba32.FromHex("#6fb5a8"), |
|||
Rgba32.FromHex("#719ba2"), |
|||
Rgba32.FromHex("#8aa1a6"), |
|||
Rgba32.FromHex("#d0d5d3"), |
|||
Rgba32.FromHex("#8590ae"), |
|||
Rgba32.FromHex("#3a2f52"), |
|||
Rgba32.FromHex("#39334a"), |
|||
Rgba32.FromHex("#6c6d94"), |
|||
Rgba32.FromHex("#584c77"), |
|||
Rgba32.FromHex("#533552"), |
|||
Rgba32.FromHex("#463759"), |
|||
Rgba32.FromHex("#bfbac0"), |
|||
Rgba32.FromHex("#77747f"), |
|||
Rgba32.FromHex("#4a475c"), |
|||
Rgba32.FromHex("#b8bfaf"), |
|||
Rgba32.FromHex("#b2b599"), |
|||
Rgba32.FromHex("#979c84"), |
|||
Rgba32.FromHex("#5d6161"), |
|||
Rgba32.FromHex("#61ac86"), |
|||
Rgba32.FromHex("#a4b6a7"), |
|||
Rgba32.FromHex("#adba98"), |
|||
Rgba32.FromHex("#93b778"), |
|||
Rgba32.FromHex("#7d8c55"), |
|||
Rgba32.FromHex("#33431e"), |
|||
Rgba32.FromHex("#7c8635"), |
|||
Rgba32.FromHex("#8e9849"), |
|||
Rgba32.FromHex("#c2c190"), |
|||
Rgba32.FromHex("#67765b"), |
|||
Rgba32.FromHex("#ab924b"), |
|||
Rgba32.FromHex("#c8c76f"), |
|||
Rgba32.FromHex("#ccc050"), |
|||
Rgba32.FromHex("#ebdd99"), |
|||
Rgba32.FromHex("#ab9649"), |
|||
Rgba32.FromHex("#dbc364"), |
|||
Rgba32.FromHex("#e6d058"), |
|||
Rgba32.FromHex("#ead665"), |
|||
Rgba32.FromHex("#d09b2c"), |
|||
Rgba32.FromHex("#a36629"), |
|||
Rgba32.FromHex("#a77d35"), |
|||
Rgba32.FromHex("#f0d696"), |
|||
Rgba32.FromHex("#d7c485"), |
|||
Rgba32.FromHex("#f1d28c"), |
|||
Rgba32.FromHex("#efcc83"), |
|||
Rgba32.FromHex("#f3daa7"), |
|||
Rgba32.FromHex("#dfa837"), |
|||
Rgba32.FromHex("#ebbc71"), |
|||
Rgba32.FromHex("#d17c3f"), |
|||
Rgba32.FromHex("#92462f"), |
|||
Rgba32.FromHex("#be7249"), |
|||
Rgba32.FromHex("#bb603c"), |
|||
Rgba32.FromHex("#c76b4a"), |
|||
Rgba32.FromHex("#a75536"), |
|||
Rgba32.FromHex("#b63e36"), |
|||
Rgba32.FromHex("#b5493a"), |
|||
Rgba32.FromHex("#cd6d57"), |
|||
Rgba32.FromHex("#711518"), |
|||
Rgba32.FromHex("#e9c49d"), |
|||
Rgba32.FromHex("#eedac3"), |
|||
Rgba32.FromHex("#eecfbf"), |
|||
Rgba32.FromHex("#ce536b"), |
|||
Rgba32.FromHex("#b74a70"), |
|||
Rgba32.FromHex("#b7757c"), |
|||
Rgba32.FromHex("#612741"), |
|||
Rgba32.FromHex("#7a4848"), |
|||
Rgba32.FromHex("#3f3033"), |
|||
Rgba32.FromHex("#8d746f"), |
|||
Rgba32.FromHex("#4d3635"), |
|||
Rgba32.FromHex("#6e3b31"), |
|||
Rgba32.FromHex("#864735"), |
|||
Rgba32.FromHex("#553d3a"), |
|||
Rgba32.FromHex("#613936"), |
|||
Rgba32.FromHex("#7a4b3a"), |
|||
Rgba32.FromHex("#946943"), |
|||
Rgba32.FromHex("#c39e6d"), |
|||
Rgba32.FromHex("#513e32"), |
|||
Rgba32.FromHex("#8b7859"), |
|||
Rgba32.FromHex("#9b856b"), |
|||
Rgba32.FromHex("#766051"), |
|||
Rgba32.FromHex("#453b32") |
|||
}; |
|||
} |
|||
} |
|||
@ -1,721 +0,0 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides standardized definitions for named colors.
|
|||
/// </content>
|
|||
public partial struct Rgba32 |
|||
{ |
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #F0F8FF.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 AliceBlue = Color.AliceBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FAEBD7.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 AntiqueWhite = Color.AntiqueWhite; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #00FFFF.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Aqua = Color.Aqua; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #7FFFD4.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Aquamarine = Color.Aquamarine; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #F0FFFF.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Azure = Color.Azure; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #F5F5DC.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Beige = Color.Beige; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFE4C4.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Bisque = Color.Bisque; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #000000.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Black = Color.Black; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFEBCD.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 BlanchedAlmond = Color.BlanchedAlmond; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #0000FF.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Blue = Color.Blue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #8A2BE2.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 BlueViolet = Color.BlueViolet; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #A52A2A.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Brown = Color.Brown; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #DEB887.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 BurlyWood = Color.BurlyWood; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #5F9EA0.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 CadetBlue = Color.CadetBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #7FFF00.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Chartreuse = Color.Chartreuse; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #D2691E.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Chocolate = Color.Chocolate; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FF7F50.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Coral = Color.Coral; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #6495ED.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 CornflowerBlue = Color.CornflowerBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFF8DC.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Cornsilk = Color.Cornsilk; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #DC143C.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Crimson = Color.Crimson; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #00FFFF.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Cyan = Color.Cyan; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #00008B.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkBlue = Color.DarkBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #008B8B.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkCyan = Color.DarkCyan; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #B8860B.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkGoldenrod = Color.DarkGoldenrod; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #A9A9A9.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkGray = Color.DarkGray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #006400.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkGreen = Color.DarkGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #BDB76B.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkKhaki = Color.DarkKhaki; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #8B008B.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkMagenta = Color.DarkMagenta; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #556B2F.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkOliveGreen = Color.DarkOliveGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FF8C00.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkOrange = Color.DarkOrange; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #9932CC.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkOrchid = Color.DarkOrchid; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #8B0000.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkRed = Color.DarkRed; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #E9967A.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkSalmon = Color.DarkSalmon; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #8FBC8B.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkSeaGreen = Color.DarkSeaGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #483D8B.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkSlateBlue = Color.DarkSlateBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #2F4F4F.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkSlateGray = Color.DarkSlateGray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #00CED1.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkTurquoise = Color.DarkTurquoise; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #9400D3.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DarkViolet = Color.DarkViolet; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FF1493.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DeepPink = Color.DeepPink; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #00BFFF.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DeepSkyBlue = Color.DeepSkyBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #696969.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DimGray = Color.DimGray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #1E90FF.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 DodgerBlue = Color.DodgerBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #B22222.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Firebrick = Color.Firebrick; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFFAF0.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 FloralWhite = Color.FloralWhite; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #228B22.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 ForestGreen = Color.ForestGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FF00FF.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Fuchsia = Color.Fuchsia; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #DCDCDC.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Gainsboro = Color.Gainsboro; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #F8F8FF.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 GhostWhite = Color.GhostWhite; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFD700.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Gold = Color.Gold; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #DAA520.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Goldenrod = Color.Goldenrod; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #808080.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Gray = Color.Gray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #008000.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Green = Color.Green; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #ADFF2F.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 GreenYellow = Color.GreenYellow; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #F0FFF0.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Honeydew = Color.Honeydew; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FF69B4.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 HotPink = Color.HotPink; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #CD5C5C.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 IndianRed = Color.IndianRed; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #4B0082.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Indigo = Color.Indigo; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFFFF0.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Ivory = Color.Ivory; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #F0E68C.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Khaki = Color.Khaki; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #E6E6FA.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Lavender = Color.Lavender; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFF0F5.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LavenderBlush = Color.LavenderBlush; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #7CFC00.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LawnGreen = Color.LawnGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFFACD.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LemonChiffon = Color.LemonChiffon; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #ADD8E6.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LightBlue = Color.LightBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #F08080.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LightCoral = Color.LightCoral; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #E0FFFF.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LightCyan = Color.LightCyan; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FAFAD2.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LightGoldenrodYellow = Color.LightGoldenrodYellow; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #D3D3D3.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LightGray = Color.LightGray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #90EE90.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LightGreen = Color.LightGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFB6C1.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LightPink = Color.LightPink; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFA07A.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LightSalmon = Color.LightSalmon; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #20B2AA.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LightSeaGreen = Color.LightSeaGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #87CEFA.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LightSkyBlue = Color.LightSkyBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #778899.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LightSlateGray = Color.LightSlateGray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #B0C4DE.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LightSteelBlue = Color.LightSteelBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFFFE0.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LightYellow = Color.LightYellow; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #00FF00.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Lime = Color.Lime; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #32CD32.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 LimeGreen = Color.LimeGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FAF0E6.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Linen = Color.Linen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FF00FF.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Magenta = Color.Magenta; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #800000.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Maroon = Color.Maroon; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #66CDAA.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 MediumAquamarine = Color.MediumAquamarine; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #0000CD.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 MediumBlue = Color.MediumBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #BA55D3.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 MediumOrchid = Color.MediumOrchid; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #9370DB.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 MediumPurple = Color.MediumPurple; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #3CB371.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 MediumSeaGreen = Color.MediumSeaGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #7B68EE.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 MediumSlateBlue = Color.MediumSlateBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #00FA9A.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 MediumSpringGreen = Color.MediumSpringGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #48D1CC.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 MediumTurquoise = Color.MediumTurquoise; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #C71585.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 MediumVioletRed = Color.MediumVioletRed; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #191970.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 MidnightBlue = Color.MidnightBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #F5FFFA.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 MintCream = Color.MintCream; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFE4E1.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 MistyRose = Color.MistyRose; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFE4B5.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Moccasin = Color.Moccasin; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFDEAD.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 NavajoWhite = Color.NavajoWhite; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #000080.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Navy = Color.Navy; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FDF5E6.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 OldLace = Color.OldLace; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #808000.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Olive = Color.Olive; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #6B8E23.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 OliveDrab = Color.OliveDrab; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFA500.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Orange = Color.Orange; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FF4500.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 OrangeRed = Color.OrangeRed; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #DA70D6.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Orchid = Color.Orchid; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #EEE8AA.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 PaleGoldenrod = Color.PaleGoldenrod; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #98FB98.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 PaleGreen = Color.PaleGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #AFEEEE.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 PaleTurquoise = Color.PaleTurquoise; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #DB7093.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 PaleVioletRed = Color.PaleVioletRed; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFEFD5.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 PapayaWhip = Color.PapayaWhip; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFDAB9.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 PeachPuff = Color.PeachPuff; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #CD853F.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Peru = Color.Peru; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFC0CB.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Pink = Color.Pink; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #DDA0DD.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Plum = Color.Plum; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #B0E0E6.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 PowderBlue = Color.PowderBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #800080.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Purple = Color.Purple; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #663399.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 RebeccaPurple = Color.RebeccaPurple; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FF0000.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Red = Color.Red; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #BC8F8F.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 RosyBrown = Color.RosyBrown; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #4169E1.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 RoyalBlue = Color.RoyalBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #8B4513.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 SaddleBrown = Color.SaddleBrown; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FA8072.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Salmon = Color.Salmon; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #F4A460.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 SandyBrown = Color.SandyBrown; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #2E8B57.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 SeaGreen = Color.SeaGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFF5EE.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 SeaShell = Color.SeaShell; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #A0522D.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Sienna = Color.Sienna; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #C0C0C0.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Silver = Color.Silver; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #87CEEB.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 SkyBlue = Color.SkyBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #6A5ACD.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 SlateBlue = Color.SlateBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #708090.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 SlateGray = Color.SlateGray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFFAFA.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Snow = Color.Snow; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #00FF7F.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 SpringGreen = Color.SpringGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #4682B4.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 SteelBlue = Color.SteelBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #D2B48C.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Tan = Color.Tan; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #008080.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Teal = Color.Teal; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #D8BFD8.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Thistle = Color.Thistle; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FF6347.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Tomato = Color.Tomato; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFFFFF.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Transparent = Color.Transparent; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #40E0D0.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Turquoise = Color.Turquoise; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #EE82EE.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Violet = Color.Violet; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #F5DEB3.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Wheat = Color.Wheat; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFFFFF.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 White = Color.White; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #F5F5F5.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 WhiteSmoke = Color.WhiteSmoke; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #FFFF00.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 Yellow = Color.Yellow; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Rgba32"/> matching the W3C definition that has an hex value of #9ACD32.
|
|||
/// </summary>
|
|||
public static readonly Rgba32 YellowGreen = Color.YellowGreen; |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Numerics; |
|||
|
|||
namespace SixLabors.ImageSharp.Processing.Processors.Effects |
|||
{ |
|||
/// <summary>
|
|||
/// An <see langword="interface"/> used by the row delegates for a given <see cref="PixelRowDelegateProcessor{TPixel,TDelegate}"/> instance
|
|||
/// </summary>
|
|||
public interface IPixelRowDelegate |
|||
{ |
|||
/// <summary>
|
|||
/// Applies the current pixel row delegate to a target row of preprocessed pixels.
|
|||
/// </summary>
|
|||
/// <param name="span">The target row of <see cref="Vector4"/> pixels to process.</param>
|
|||
/// <param name="offset">The initial horizontal and vertical offset for the input pixels to process.</param>
|
|||
void Invoke(Span<Vector4> span, Point offset); |
|||
} |
|||
} |
|||
@ -1,70 +0,0 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Numerics; |
|||
using SixLabors.ImageSharp.Advanced; |
|||
using SixLabors.ImageSharp.Advanced.ParallelUtils; |
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
namespace SixLabors.ImageSharp.Processing.Processors.Effects |
|||
{ |
|||
/// <summary>
|
|||
/// The base class for all processors that accept a user defined row processing delegate.
|
|||
/// </summary>
|
|||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|||
internal abstract class PixelRowDelegateProcessorBase<TPixel> : ImageProcessor<TPixel> |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
/// <summary>
|
|||
/// The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.
|
|||
/// </summary>
|
|||
private readonly PixelConversionModifiers modifiers; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="PixelRowDelegateProcessorBase{TPixel}"/> class.
|
|||
/// </summary>
|
|||
/// <param name="configuration">The configuration which allows altering default behaviour or extending the library.</param>
|
|||
/// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param>
|
|||
/// <param name="source">The source <see cref="Image{TPixel}"/> for the current processor instance.</param>
|
|||
/// <param name="sourceRectangle">The source area to process for the current processor instance.</param>
|
|||
protected PixelRowDelegateProcessorBase(Configuration configuration, PixelConversionModifiers modifiers, Image<TPixel> source, Rectangle sourceRectangle) |
|||
: base(configuration, source, sourceRectangle) |
|||
=> this.modifiers = modifiers; |
|||
|
|||
/// <inheritdoc/>
|
|||
protected override void OnFrameApply(ImageFrame<TPixel> source) |
|||
{ |
|||
var interest = Rectangle.Intersect(this.SourceRectangle, source.Bounds()); |
|||
int startX = interest.X; |
|||
Configuration configuration = this.Configuration; |
|||
PixelConversionModifiers modifiers = this.modifiers; |
|||
|
|||
ParallelHelper.IterateRowsWithTempBuffer<Vector4>( |
|||
interest, |
|||
this.Configuration, |
|||
(rows, vectorBuffer) => |
|||
{ |
|||
for (int y = rows.Min; y < rows.Max; y++) |
|||
{ |
|||
Span<Vector4> vectorSpan = vectorBuffer.Span; |
|||
int length = vectorSpan.Length; |
|||
Span<TPixel> rowSpan = source.GetPixelRowSpan(y).Slice(startX, length); |
|||
PixelOperations<TPixel>.Instance.ToVector4(configuration, rowSpan, vectorSpan, modifiers); |
|||
|
|||
// Run the user defined pixel shader to the current row of pixels
|
|||
this.ApplyPixelRowDelegate(vectorSpan, new Point(startX, y)); |
|||
|
|||
PixelOperations<TPixel>.Instance.FromVector4Destructive(configuration, vectorSpan, rowSpan, modifiers); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Applies the current pixel row delegate to a target row of preprocessed pixels.
|
|||
/// </summary>
|
|||
/// <param name="span">The target row of <see cref="Vector4"/> pixels to process.</param>
|
|||
/// <param name="offset">The initial horizontal and vertical offset for the input pixels to process.</param>
|
|||
protected abstract void ApplyPixelRowDelegate(Span<Vector4> span, Point offset); |
|||
} |
|||
} |
|||
@ -0,0 +1,104 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Numerics; |
|||
using System.Runtime.CompilerServices; |
|||
using SixLabors.ImageSharp.Advanced; |
|||
using SixLabors.ImageSharp.Memory; |
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
namespace SixLabors.ImageSharp.Processing.Processors.Effects |
|||
{ |
|||
/// <summary>
|
|||
/// The base class for all processors that accept a user defined row processing delegate.
|
|||
/// </summary>
|
|||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|||
/// <typeparam name="TDelegate">The row processor type.</typeparam>
|
|||
internal sealed class PixelRowDelegateProcessor<TPixel, TDelegate> : ImageProcessor<TPixel> |
|||
where TPixel : struct, IPixel<TPixel> |
|||
where TDelegate : struct, IPixelRowDelegate |
|||
{ |
|||
private readonly TDelegate rowDelegate; |
|||
|
|||
/// <summary>
|
|||
/// The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.
|
|||
/// </summary>
|
|||
private readonly PixelConversionModifiers modifiers; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="PixelRowDelegateProcessor{TPixel,TDelegate}"/> class.
|
|||
/// </summary>
|
|||
/// <param name="rowDelegate">The row processor to use to process each pixel row</param>
|
|||
/// <param name="configuration">The configuration which allows altering default behaviour or extending the library.</param>
|
|||
/// <param name="modifiers">The <see cref="PixelConversionModifiers"/> to apply during the pixel conversions.</param>
|
|||
/// <param name="source">The source <see cref="Image{TPixel}"/> for the current processor instance.</param>
|
|||
/// <param name="sourceRectangle">The source area to process for the current processor instance.</param>
|
|||
public PixelRowDelegateProcessor( |
|||
in TDelegate rowDelegate, |
|||
Configuration configuration, |
|||
PixelConversionModifiers modifiers, |
|||
Image<TPixel> source, |
|||
Rectangle sourceRectangle) |
|||
: base(configuration, source, sourceRectangle) |
|||
{ |
|||
this.rowDelegate = rowDelegate; |
|||
this.modifiers = modifiers; |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
protected override void OnFrameApply(ImageFrame<TPixel> source) |
|||
{ |
|||
var interest = Rectangle.Intersect(this.SourceRectangle, source.Bounds()); |
|||
var operation = new RowIntervalOperation(interest.X, source, this.Configuration, this.modifiers, this.rowDelegate); |
|||
|
|||
ParallelRowIterator.IterateRows<RowIntervalOperation, Vector4>( |
|||
this.Configuration, |
|||
interest, |
|||
in operation); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// A <see langword="struct"/> implementing the convolution logic for <see cref="PixelRowDelegateProcessor{TPixel,TDelegate}"/>.
|
|||
/// </summary>
|
|||
private readonly struct RowIntervalOperation : IRowIntervalOperation<Vector4> |
|||
{ |
|||
private readonly int startX; |
|||
private readonly ImageFrame<TPixel> source; |
|||
private readonly Configuration configuration; |
|||
private readonly PixelConversionModifiers modifiers; |
|||
private readonly TDelegate rowProcessor; |
|||
|
|||
[MethodImpl(InliningOptions.ShortMethod)] |
|||
public RowIntervalOperation( |
|||
int startX, |
|||
ImageFrame<TPixel> source, |
|||
Configuration configuration, |
|||
PixelConversionModifiers modifiers, |
|||
in TDelegate rowProcessor) |
|||
{ |
|||
this.startX = startX; |
|||
this.source = source; |
|||
this.configuration = configuration; |
|||
this.modifiers = modifiers; |
|||
this.rowProcessor = rowProcessor; |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
[MethodImpl(InliningOptions.ShortMethod)] |
|||
public void Invoke(in RowInterval rows, Span<Vector4> span) |
|||
{ |
|||
for (int y = rows.Min; y < rows.Max; y++) |
|||
{ |
|||
Span<TPixel> rowSpan = this.source.GetPixelRowSpan(y).Slice(this.startX, span.Length); |
|||
PixelOperations<TPixel>.Instance.ToVector4(this.configuration, rowSpan, span, this.modifiers); |
|||
|
|||
// Run the user defined pixel shader to the current row of pixels
|
|||
Unsafe.AsRef(this.rowProcessor).Invoke(span, new Point(this.startX, y)); |
|||
|
|||
PixelOperations<TPixel>.Instance.FromVector4Destructive(this.configuration, span, rowSpan, this.modifiers); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,39 +0,0 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Numerics; |
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
namespace SixLabors.ImageSharp.Processing.Processors.Effects |
|||
{ |
|||
/// <summary>
|
|||
/// Applies a user defined row processing delegate to the image.
|
|||
/// </summary>
|
|||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|||
internal sealed class PixelRowDelegateProcessor<TPixel> : PixelRowDelegateProcessorBase<TPixel> |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
/// <summary>
|
|||
/// The user defined pixel row processing delegate.
|
|||
/// </summary>
|
|||
private readonly PixelRowOperation pixelRowOperation; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="PixelRowDelegateProcessor{TPixel}"/> class.
|
|||
/// </summary>
|
|||
/// <param name="configuration">The configuration which allows altering default behaviour or extending the library.</param>
|
|||
/// <param name="definition">The <see cref="PixelRowDelegateProcessor"/> defining the processor parameters.</param>
|
|||
/// <param name="source">The source <see cref="Image{TPixel}"/> for the current processor instance.</param>
|
|||
/// <param name="sourceRectangle">The source area to process for the current processor instance.</param>
|
|||
public PixelRowDelegateProcessor(Configuration configuration, PixelRowDelegateProcessor definition, Image<TPixel> source, Rectangle sourceRectangle) |
|||
: base(configuration, definition.Modifiers, source, sourceRectangle) |
|||
{ |
|||
this.pixelRowOperation = definition.PixelRowOperation; |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
protected override void ApplyPixelRowDelegate(Span<Vector4> span, Point offset) => this.pixelRowOperation(span); |
|||
} |
|||
} |
|||
@ -1,36 +0,0 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System; |
|||
using System.Numerics; |
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
namespace SixLabors.ImageSharp.Processing.Processors.Effects |
|||
{ |
|||
/// <summary>
|
|||
/// Applies a user defined, position aware, row processing delegate to the image.
|
|||
/// </summary>
|
|||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|||
internal sealed class PositionAwarePixelRowDelegateProcessor<TPixel> : PixelRowDelegateProcessorBase<TPixel> |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
private readonly PixelRowOperation<Point> pixelRowOperation; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="PositionAwarePixelRowDelegateProcessor{TPixel}"/> class.
|
|||
/// </summary>
|
|||
/// <param name="configuration">The configuration which allows altering default behaviour or extending the library.</param>
|
|||
/// <param name="definition">The <see cref="PositionAwarePixelRowDelegateProcessor"/> defining the processor parameters.</param>
|
|||
/// <param name="source">The source <see cref="Image{TPixel}"/> for the current processor instance.</param>
|
|||
/// <param name="sourceRectangle">The source area to process for the current processor instance.</param>
|
|||
public PositionAwarePixelRowDelegateProcessor(Configuration configuration, PositionAwarePixelRowDelegateProcessor definition, Image<TPixel> source, Rectangle sourceRectangle) |
|||
: base(configuration, definition.Modifiers, source, sourceRectangle) |
|||
{ |
|||
this.pixelRowOperation = definition.PixelRowOperation; |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
protected override void ApplyPixelRowDelegate(Span<Vector4> span, Point offset) => this.pixelRowOperation(span, offset); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue