mirror of https://github.com/SixLabors/ImageSharp
Browse Source
Former-commit-id: e999c5105a11df9168b1c2be0023aae2c98509d4 Former-commit-id: 5b95d6d0e7cf572f40d4c27580e3a6f0cecd238b Former-commit-id: ec29dd84ec9f1b8d4d1a70a33c06f77d4b5b65d4af/merge-core
9 changed files with 104 additions and 110 deletions
@ -1,35 +0,0 @@ |
|||||
// <copyright file="Invert.cs" company="James South">
|
|
||||
// Copyright © James South and contributors.
|
|
||||
// Licensed under the Apache License, Version 2.0.
|
|
||||
// </copyright>
|
|
||||
|
|
||||
namespace ImageProcessor.Filters |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Inverts the colors of the image.
|
|
||||
/// </summary>
|
|
||||
public class Invert : ColorMatrixFilter |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// The inversion matrix.
|
|
||||
/// TODO: With gamma adjustment enabled this leaves the image too bright.
|
|
||||
/// </summary>
|
|
||||
private static readonly ColorMatrix Matrix = new ColorMatrix( |
|
||||
new[] |
|
||||
{ |
|
||||
new float[] { -1, 0, 0, 0, 0 }, |
|
||||
new float[] { 0, -1, 0, 0, 0 }, |
|
||||
new float[] { 0, 0, -1, 0, 0 }, |
|
||||
new float[] { 0, 0, 0, 1, 0 }, |
|
||||
new float[] { 1, 1, 1, 0, 1 } |
|
||||
}); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Initializes a new instance of the <see cref="Invert"/> class.
|
|
||||
/// </summary>
|
|
||||
public Invert() |
|
||||
: base(Matrix, false) |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue