|
|
@ -8,7 +8,7 @@ namespace SixLabors.ImageSharp.Processing |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// A collection of methods for creating generic brushes.
|
|
|
/// A collection of methods for creating generic brushes.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
public static class Brushes |
|
|
public static class Brushes |
|
|
{ |
|
|
{ |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
@ -94,163 +94,131 @@ namespace SixLabors.ImageSharp.Processing |
|
|
/// Create as brush that will paint a solid color
|
|
|
/// Create as brush that will paint a solid color
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="color">The color.</param>
|
|
|
/// <param name="color">The color.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static SolidBrush Solid(Color color) => new SolidBrush(color); |
|
|
public static SolidBrush<TPixel> Solid<TPixel>(TPixel color) |
|
|
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new SolidBrush<TPixel>(color); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Percent10 Hatch Pattern with the specified colors
|
|
|
/// Create as brush that will paint a Percent10 Hatch Pattern with the specified colors
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush Percent10(Color foreColor) => |
|
|
public static PatternBrush<TPixel> Percent10<TPixel>(TPixel foreColor) |
|
|
new PatternBrush(foreColor, Color.Transparent, Percent10Pattern); |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, NamedColors<TPixel>.Transparent, Percent10Pattern); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Percent10 Hatch Pattern with the specified colors
|
|
|
/// Create as brush that will paint a Percent10 Hatch Pattern with the specified colors
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush Percent10(Color foreColor, Color backColor) => |
|
|
public static PatternBrush<TPixel> Percent10<TPixel>(TPixel foreColor, TPixel backColor) |
|
|
new PatternBrush(foreColor, backColor, Percent10Pattern); |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, backColor, Percent10Pattern); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Percent20 Hatch Pattern with the specified foreground color and a
|
|
|
/// Create as brush that will paint a Percent20 Hatch Pattern with the specified foreground color and a
|
|
|
/// transparent background.
|
|
|
/// transparent background.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush Percent20(Color foreColor) => |
|
|
public static PatternBrush<TPixel> Percent20<TPixel>(TPixel foreColor) |
|
|
new PatternBrush(foreColor, Color.Transparent, Percent20Pattern); |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, NamedColors<TPixel>.Transparent, Percent20Pattern); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Percent20 Hatch Pattern with the specified colors
|
|
|
/// Create as brush that will paint a Percent20 Hatch Pattern with the specified colors
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush Percent20(Color foreColor, Color backColor) => |
|
|
public static PatternBrush<TPixel> Percent20<TPixel>(TPixel foreColor, TPixel backColor) |
|
|
new PatternBrush(foreColor, backColor, Percent20Pattern); |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, backColor, Percent20Pattern); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Horizontal Hatch Pattern with the specified foreground color and a
|
|
|
/// Create as brush that will paint a Horizontal Hatch Pattern with the specified foreground color and a
|
|
|
/// transparent background.
|
|
|
/// transparent background.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush Horizontal(Color foreColor) => |
|
|
public static PatternBrush<TPixel> Horizontal<TPixel>(TPixel foreColor) |
|
|
new PatternBrush(foreColor, Color.Transparent, HorizontalPattern); |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, NamedColors<TPixel>.Transparent, HorizontalPattern); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Horizontal Hatch Pattern with the specified colors
|
|
|
/// Create as brush that will paint a Horizontal Hatch Pattern with the specified colors
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush Horizontal(Color foreColor, Color backColor) => |
|
|
public static PatternBrush<TPixel> Horizontal<TPixel>(TPixel foreColor, TPixel backColor) |
|
|
new PatternBrush(foreColor, backColor, HorizontalPattern); |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, backColor, HorizontalPattern); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Min Hatch Pattern with the specified foreground color and a
|
|
|
/// Create as brush that will paint a Min Hatch Pattern with the specified foreground color and a
|
|
|
/// transparent background.
|
|
|
/// transparent background.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush Min(Color foreColor) => new PatternBrush(foreColor, Color.Transparent, MinPattern); |
|
|
public static PatternBrush<TPixel> Min<TPixel>(TPixel foreColor) |
|
|
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, NamedColors<TPixel>.Transparent, MinPattern); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Min Hatch Pattern with the specified colors
|
|
|
/// Create as brush that will paint a Min Hatch Pattern with the specified colors
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush Min(Color foreColor, Color backColor) => |
|
|
public static PatternBrush<TPixel> Min<TPixel>(TPixel foreColor, TPixel backColor) |
|
|
new PatternBrush(foreColor, backColor, MinPattern); |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, backColor, MinPattern); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Vertical Hatch Pattern with the specified foreground color and a
|
|
|
/// Create as brush that will paint a Vertical Hatch Pattern with the specified foreground color and a
|
|
|
/// transparent background.
|
|
|
/// transparent background.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush Vertical(Color foreColor) => |
|
|
public static PatternBrush<TPixel> Vertical<TPixel>(TPixel foreColor) |
|
|
new PatternBrush(foreColor, Color.Transparent, VerticalPattern); |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, NamedColors<TPixel>.Transparent, VerticalPattern); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Vertical Hatch Pattern with the specified colors
|
|
|
/// Create as brush that will paint a Vertical Hatch Pattern with the specified colors
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush Vertical(Color foreColor, Color backColor) => |
|
|
public static PatternBrush<TPixel> Vertical<TPixel>(TPixel foreColor, TPixel backColor) |
|
|
new PatternBrush(foreColor, backColor, VerticalPattern); |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, backColor, VerticalPattern); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Forward Diagonal Hatch Pattern with the specified foreground color and a
|
|
|
/// Create as brush that will paint a Forward Diagonal Hatch Pattern with the specified foreground color and a
|
|
|
/// transparent background.
|
|
|
/// transparent background.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush ForwardDiagonal(Color foreColor) => |
|
|
public static PatternBrush<TPixel> ForwardDiagonal<TPixel>(TPixel foreColor) |
|
|
new PatternBrush(foreColor, Color.Transparent, ForwardDiagonalPattern); |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, NamedColors<TPixel>.Transparent, ForwardDiagonalPattern); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Forward Diagonal Hatch Pattern with the specified colors
|
|
|
/// Create as brush that will paint a Forward Diagonal Hatch Pattern with the specified colors
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush ForwardDiagonal(Color foreColor, Color backColor) => |
|
|
public static PatternBrush<TPixel> ForwardDiagonal<TPixel>(TPixel foreColor, TPixel backColor) |
|
|
new PatternBrush(foreColor, backColor, ForwardDiagonalPattern); |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, backColor, ForwardDiagonalPattern); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Backward Diagonal Hatch Pattern with the specified foreground color and a
|
|
|
/// Create as brush that will paint a Backward Diagonal Hatch Pattern with the specified foreground color and a
|
|
|
/// transparent background.
|
|
|
/// transparent background.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush BackwardDiagonal(Color foreColor) => |
|
|
public static PatternBrush<TPixel> BackwardDiagonal<TPixel>(TPixel foreColor) |
|
|
new PatternBrush(foreColor, Color.Transparent, BackwardDiagonalPattern); |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, NamedColors<TPixel>.Transparent, BackwardDiagonalPattern); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Create as brush that will paint a Backward Diagonal Hatch Pattern with the specified colors
|
|
|
/// Create as brush that will paint a Backward Diagonal Hatch Pattern with the specified colors
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="foreColor">Color of the foreground.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <param name="backColor">Color of the background.</param>
|
|
|
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|
|
/// <returns>A New <see cref="PatternBrush"/></returns>
|
|
|
/// <returns>A New <see cref="PatternBrush{TPixel}"/></returns>
|
|
|
public static PatternBrush BackwardDiagonal(Color foreColor, Color backColor) => |
|
|
public static PatternBrush<TPixel> BackwardDiagonal<TPixel>(TPixel foreColor, TPixel backColor) |
|
|
new PatternBrush(foreColor, backColor, BackwardDiagonalPattern); |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
|
|
=> new PatternBrush<TPixel>(foreColor, backColor, BackwardDiagonalPattern); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |