mirror of https://github.com/SixLabors/ImageSharp
7 changed files with 75 additions and 58 deletions
@ -1,34 +0,0 @@ |
|||||
// Copyright (c) Six Labors and contributors.
|
|
||||
// Licensed under the Apache License, Version 2.0.
|
|
||||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|
||||
using SixLabors.Primitives; |
|
||||
|
|
||||
namespace SixLabors.ImageSharp.Processing |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Defines extensions that allow to change image lightness.
|
|
||||
/// </summary>
|
|
||||
public static class LightnessExtension |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Alters the lightness parameter of the image.
|
|
||||
/// </summary>
|
|
||||
/// <param name="source">The image this method extends.</param>
|
|
||||
/// <param name="lightness">Lightness parameter of image.</param>
|
|
||||
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
|
|
||||
public static IImageProcessingContext Lightness(this IImageProcessingContext source, float lightness) |
|
||||
=> source.ApplyProcessor(new LightnessProcessor(lightness)); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Alters the lightness parameter of the image.
|
|
||||
/// </summary>
|
|
||||
/// <param name="source">The image this method extends.</param>
|
|
||||
/// <param name="lightness">Lightness parameter of image.</param>
|
|
||||
/// <param name="rectangle">
|
|
||||
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
|
|
||||
/// </param>
|
|
||||
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
|
|
||||
public static IImageProcessingContext Lightness(this IImageProcessingContext source, float lightness, Rectangle rectangle) |
|
||||
=> source.ApplyProcessor(new LightnessProcessor(lightness), rectangle); |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,44 @@ |
|||||
|
// Copyright (c) Six Labors and contributors.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
|
||||
|
using SixLabors.ImageSharp.Processing.Processors.Filters; |
||||
|
using SixLabors.Primitives; |
||||
|
|
||||
|
namespace SixLabors.ImageSharp.Processing |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Defines extensions that allow the alteration of the lightness component of an <see cref="Image"/>
|
||||
|
/// using Mutate/Clone.
|
||||
|
/// </summary>
|
||||
|
public static class LightnessExtensions |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Alters the lightness component of the image.
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// A value of 0 will create an image that is completely black. A value of 1 leaves the input unchanged.
|
||||
|
/// Other values are linear multipliers on the effect. Values of an amount over 1 are allowed, providing lighter results.
|
||||
|
/// </remarks>
|
||||
|
/// <param name="source">The image this method extends.</param>
|
||||
|
/// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param>
|
||||
|
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
|
||||
|
public static IImageProcessingContext Lightness(this IImageProcessingContext source, float amount) |
||||
|
=> source.ApplyProcessor(new LightnessProcessor(amount)); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Alters the lightness component of the image.
|
||||
|
/// </summary>
|
||||
|
/// <remarks>
|
||||
|
/// A value of 0 will create an image that is completely black. A value of 1 leaves the input unchanged.
|
||||
|
/// Other values are linear multipliers on the effect. Values of an amount over 1 are allowed, providing lighter results.
|
||||
|
/// </remarks>
|
||||
|
/// <param name="source">The image this method extends.</param>
|
||||
|
/// <param name="amount">The proportion of the conversion. Must be greater than or equal to 0.</param>
|
||||
|
/// <param name="rectangle">
|
||||
|
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
|
||||
|
/// </param>
|
||||
|
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
|
||||
|
public static IImageProcessingContext Lightness(this IImageProcessingContext source, float amount, Rectangle rectangle) |
||||
|
=> source.ApplyProcessor(new LightnessProcessor(amount), rectangle); |
||||
|
} |
||||
|
} |
||||
@ -1 +1 @@ |
|||||
Subproject commit 99a2bc523cd4eb00e37af20d1b2088fa11564c57 |
Subproject commit 58b2c01f9b66dd42d2b5b040b85e6846083b5e5f |
||||
Loading…
Reference in new issue