Browse Source

*ProcessorImplementation<T> ===> *Processor<T>,

add suppression of SA1413 to AssemblyInfo.cs
pull/904/head
Anton Firszov 7 years ago
parent
commit
b758eaf16b
  1. 2
      src/ImageSharp/Processing/Processors/Filters/FilterProcessor.cs
  2. 4
      src/ImageSharp/Processing/Processors/Filters/FilterProcessor{TPixel}.cs
  3. 2
      src/ImageSharp/Processing/Processors/Filters/GrayscaleBt709Processor.cs
  4. 2
      src/ImageSharp/Processing/Processors/Filters/LomographProcessor.cs
  5. 4
      src/ImageSharp/Processing/Processors/Filters/LomographProcessor{TPixel}.cs
  6. 2
      src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor.cs
  7. 4
      src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor{TPixel}.cs
  8. 2
      src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor.cs
  9. 4
      src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs
  10. 10
      src/ImageSharp/Properties/AssemblyInfo.cs
  11. 2
      tests/ImageSharp.Tests/Processing/Transforms/PadTest.cs

2
src/ImageSharp/Processing/Processors/Filters/FilterProcessor.cs

@ -26,7 +26,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Filters
public virtual IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>() public virtual IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>()
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
return new FilterProcessorImplementation<TPixel>(this); return new FilterProcessor<TPixel>(this);
} }
} }
} }

4
src/ImageSharp/Processing/Processors/Filters/FilterProcessorImplementation.cs → src/ImageSharp/Processing/Processors/Filters/FilterProcessor{TPixel}.cs

@ -15,12 +15,12 @@ namespace SixLabors.ImageSharp.Processing.Processors.Filters
/// Provides methods that accept a <see cref="ColorMatrix"/> matrix to apply free-form filters to images. /// Provides methods that accept a <see cref="ColorMatrix"/> matrix to apply free-form filters to images.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
internal class FilterProcessorImplementation<TPixel> : ImageProcessor<TPixel> internal class FilterProcessor<TPixel> : ImageProcessor<TPixel>
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
private readonly FilterProcessor definition; private readonly FilterProcessor definition;
public FilterProcessorImplementation(FilterProcessor definition) public FilterProcessor(FilterProcessor definition)
{ {
this.definition = definition; this.definition = definition;
} }

2
src/ImageSharp/Processing/Processors/Filters/GrayscaleBt709Processor.cs

@ -30,7 +30,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Filters
internal void ApplyToFrame<TPixel>(ImageFrame<TPixel> frame, Rectangle sourceRectangle, Configuration configuration) internal void ApplyToFrame<TPixel>(ImageFrame<TPixel> frame, Rectangle sourceRectangle, Configuration configuration)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
var processorImpl = new FilterProcessorImplementation<TPixel>(new GrayscaleBt709Processor(1F)); var processorImpl = new FilterProcessor<TPixel>(new GrayscaleBt709Processor(1F));
processorImpl.Apply(frame, sourceRectangle, configuration); processorImpl.Apply(frame, sourceRectangle, configuration);
} }
} }

2
src/ImageSharp/Processing/Processors/Filters/LomographProcessor.cs

@ -17,6 +17,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Filters
} }
public override IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>() => public override IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>() =>
new LomographProcessorImplementation<TPixel>(this); new LomographProcessor<TPixel>(this);
} }
} }

4
src/ImageSharp/Processing/Processors/Filters/LomographProcessorImplementation.cs → src/ImageSharp/Processing/Processors/Filters/LomographProcessor{TPixel}.cs

@ -10,12 +10,12 @@ namespace SixLabors.ImageSharp.Processing.Processors.Filters
/// <summary> /// <summary>
/// Converts the colors of the image recreating an old Lomograph effect. /// Converts the colors of the image recreating an old Lomograph effect.
/// </summary> /// </summary>
internal class LomographProcessorImplementation<TPixel> : FilterProcessorImplementation<TPixel> internal class LomographProcessor<TPixel> : FilterProcessor<TPixel>
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
private static readonly TPixel VeryDarkGreen = ColorBuilder<TPixel>.FromRGBA(0, 10, 0, 255); private static readonly TPixel VeryDarkGreen = ColorBuilder<TPixel>.FromRGBA(0, 10, 0, 255);
public LomographProcessorImplementation(LomographProcessor definition) public LomographProcessor(LomographProcessor definition)
: base(definition) : base(definition)
{ {
} }

2
src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor.cs

@ -18,6 +18,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Filters
/// <inheritdoc /> /// <inheritdoc />
public override IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>() => public override IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>() =>
new PolaroidProcessorImplementation<TPixel>(this); new PolaroidProcessor<TPixel>(this);
} }
} }

4
src/ImageSharp/Processing/Processors/Filters/PolaroidProcessorImplementation.cs → src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor{TPixel}.cs

@ -10,13 +10,13 @@ namespace SixLabors.ImageSharp.Processing.Processors.Filters
/// <summary> /// <summary>
/// Converts the colors of the image recreating an old Polaroid effect. /// Converts the colors of the image recreating an old Polaroid effect.
/// </summary> /// </summary>
internal class PolaroidProcessorImplementation<TPixel> : FilterProcessorImplementation<TPixel> internal class PolaroidProcessor<TPixel> : FilterProcessor<TPixel>
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
private static readonly TPixel VeryDarkOrange = ColorBuilder<TPixel>.FromRGB(102, 34, 0); private static readonly TPixel VeryDarkOrange = ColorBuilder<TPixel>.FromRGB(102, 34, 0);
private static readonly TPixel LightOrange = ColorBuilder<TPixel>.FromRGBA(255, 153, 102, 128); private static readonly TPixel LightOrange = ColorBuilder<TPixel>.FromRGBA(255, 153, 102, 128);
public PolaroidProcessorImplementation(FilterProcessor definition) public PolaroidProcessor(FilterProcessor definition)
: base(definition) : base(definition)
{ {
} }

2
src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor.cs

@ -133,7 +133,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
public IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>() public IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>()
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
return new ResizeProcessorImplementation<TPixel>(this); return new ResizeProcessor<TPixel>(this);
} }
} }
} }

4
src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessorImplementation.cs → src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs

@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
/// The original code has been adapted from <see href="http://www.realtimerendering.com/resources/GraphicsGems/gemsiii/filter_rcg.c"/>. /// The original code has been adapted from <see href="http://www.realtimerendering.com/resources/GraphicsGems/gemsiii/filter_rcg.c"/>.
/// </remarks> /// </remarks>
/// <typeparam name="TPixel">The pixel format.</typeparam> /// <typeparam name="TPixel">The pixel format.</typeparam>
internal class ResizeProcessorImplementation<TPixel> : TransformProcessorBase<TPixel> internal class ResizeProcessor<TPixel> : TransformProcessorBase<TPixel>
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
// The following fields are not immutable but are optionally created on demand. // The following fields are not immutable but are optionally created on demand.
@ -34,7 +34,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
private readonly ResizeProcessor parameterSource; private readonly ResizeProcessor parameterSource;
public ResizeProcessorImplementation(ResizeProcessor parameterSource) public ResizeProcessor(ResizeProcessor parameterSource)
{ {
this.parameterSource = parameterSource; this.parameterSource = parameterSource;
} }

10
src/ImageSharp/Properties/AssemblyInfo.cs

@ -1,6 +1,14 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
// Ensure the other projects can see the internal helpers // Ensure the other projects can see the internal helpers
[assembly: InternalsVisibleTo("SixLabors.ImageSharp.Drawing")] [assembly: InternalsVisibleTo("SixLabors.ImageSharp.Drawing")]
// Redundant suppressing of SA1413 for Rider.
[assembly:
System.Diagnostics.CodeAnalysis.SuppressMessage(
"StyleCop.CSharp.MaintainabilityRules",
"SA1413:UseTrailingCommasInMultiLineInitializers",
Justification = "Follows SixLabors.ruleset")]

2
tests/ImageSharp.Tests/Processing/Transforms/PadTest.cs

@ -20,7 +20,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
IResampler sampler = KnownResamplers.NearestNeighbor; IResampler sampler = KnownResamplers.NearestNeighbor;
this.operations.Pad(width, height); this.operations.Pad(width, height);
ResizeProcessorImplementation<Rgba32> resizeProcessor = this.Verify<ResizeProcessorImplementation<Rgba32>>(); ResizeProcessor<Rgba32> resizeProcessor = this.Verify<ResizeProcessor<Rgba32>>();
Assert.Equal(width, resizeProcessor.Width); Assert.Equal(width, resizeProcessor.Width);
Assert.Equal(height, resizeProcessor.Height); Assert.Equal(height, resizeProcessor.Height);

Loading…
Cancel
Save