mirror of https://github.com/SixLabors/ImageSharp
6 changed files with 96 additions and 69 deletions
@ -1,34 +1,23 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Numerics; |
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
namespace SixLabors.ImageSharp.Processing.Processors |
|||
{ |
|||
/// <summary>
|
|||
/// Converts the colors of the image to their black and white equivalent.
|
|||
/// Applies a black and white filter matrix to the image
|
|||
/// </summary>
|
|||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|||
internal class BlackWhiteProcessor<TPixel> : ColorMatrixProcessor<TPixel> |
|||
where TPixel : struct, IPixel<TPixel> |
|||
internal class BlackWhiteProcessor<TPixel> : FilterProcessor<TPixel> |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override Matrix4x4 Matrix => new Matrix4x4() |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="BlackWhiteProcessor{TPixel}"/> class.
|
|||
/// </summary>
|
|||
public BlackWhiteProcessor() |
|||
: base(Matrix4x4Extensions.BlackWhiteFilter) |
|||
{ |
|||
M11 = 1.5F, |
|||
M12 = 1.5F, |
|||
M13 = 1.5F, |
|||
M21 = 1.5F, |
|||
M22 = 1.5F, |
|||
M23 = 1.5F, |
|||
M31 = 1.5F, |
|||
M32 = 1.5F, |
|||
M33 = 1.5F, |
|||
M41 = -1F, |
|||
M42 = -1F, |
|||
M43 = -1F, |
|||
M44 = 1 |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,28 +1,23 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Numerics; |
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
namespace SixLabors.ImageSharp.Processing.Processors |
|||
{ |
|||
/// <summary>
|
|||
/// Converts the colors of the image recreating an old Kodachrome camera effect.
|
|||
/// Applies a filter matrix recreating an old Kodachrome camera effect matrix to the image
|
|||
/// </summary>
|
|||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|||
internal class KodachromeProcessor<TPixel> : ColorMatrixProcessor<TPixel> |
|||
where TPixel : struct, IPixel<TPixel> |
|||
internal class KodachromeProcessor<TPixel> : FilterProcessor<TPixel> |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override Matrix4x4 Matrix => new Matrix4x4 |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="KodachromeProcessor{TPixel}"/> class.
|
|||
/// </summary>
|
|||
public KodachromeProcessor() |
|||
: base(Matrix4x4Extensions.KodachromeFilter) |
|||
{ |
|||
M11 = 0.6997023F, |
|||
M22 = 0.4609577F, |
|||
M33 = 0.397218F, |
|||
M41 = 0.005F, |
|||
M42 = -0.005F, |
|||
M43 = 0.005F, |
|||
M44 = 1 |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue