From 54a641ba2e6ca62a2bee00d5499575edba9c5ee9 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Tue, 30 May 2017 22:15:06 +0100 Subject: [PATCH] remove redundent code --- src/ImageSharp.Drawing/Pens/IPen.cs | 4 +- src/ImageSharp.Drawing/Pens/Pen{TPixel}.cs | 21 +++------- .../Pens/Processors/ColoredPointInfo.cs | 27 ------------- .../Pens/Processors/PenApplicator.cs | 40 ------------------- 4 files changed, 8 insertions(+), 84 deletions(-) delete mode 100644 src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs delete mode 100644 src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs diff --git a/src/ImageSharp.Drawing/Pens/IPen.cs b/src/ImageSharp.Drawing/Pens/IPen.cs index affcb9d1f..20ac53daf 100644 --- a/src/ImageSharp.Drawing/Pens/IPen.cs +++ b/src/ImageSharp.Drawing/Pens/IPen.cs @@ -16,9 +16,9 @@ namespace ImageSharp.Drawing.Pens where TPixel : struct, IPixel { /// - /// Gets the stoke fill. + /// Gets the stroke fill. /// - IBrush StokeFill { get; } + IBrush StrokeFill { get; } } /// diff --git a/src/ImageSharp.Drawing/Pens/Pen{TPixel}.cs b/src/ImageSharp.Drawing/Pens/Pen{TPixel}.cs index 0a0c81f9c..65ec9eabf 100644 --- a/src/ImageSharp.Drawing/Pens/Pen{TPixel}.cs +++ b/src/ImageSharp.Drawing/Pens/Pen{TPixel}.cs @@ -27,8 +27,8 @@ namespace ImageSharp.Drawing.Pens public class Pen : IPen where TPixel : struct, IPixel { - private static readonly float[] EmptyPattern = new float[0]; - private readonly float[] pattern; + private static readonly ReadOnlySpan EmptyPattern = new float[0]; + private readonly ReadOnlySpan pattern; /// /// Initializes a new instance of the class. @@ -36,7 +36,7 @@ namespace ImageSharp.Drawing.Pens /// The color. /// The width. /// The pattern. - public Pen(TPixel color, float width, float[] pattern) + public Pen(TPixel color, float width, ReadOnlySpan pattern) : this(new SolidBrush(color), width, pattern) { } @@ -47,9 +47,9 @@ namespace ImageSharp.Drawing.Pens /// The brush. /// The width. /// The pattern. - public Pen(IBrush brush, float width, float[] pattern) + public Pen(IBrush brush, float width, ReadOnlySpan pattern) { - this.StokeFill = brush; + this.StrokeFill = brush; this.StrokeWidth = width; this.pattern = pattern; } @@ -74,17 +74,8 @@ namespace ImageSharp.Drawing.Pens { } - /// - /// Initializes a new instance of the class. - /// - /// The pen. - internal Pen(Pen pen) - : this(pen.StokeFill, pen.StrokeWidth, pen.pattern) - { - } - /// - public IBrush StokeFill { get; } + public IBrush StrokeFill { get; } /// public float StrokeWidth { get; } diff --git a/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs b/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs deleted file mode 100644 index 65a8a6131..000000000 --- a/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright (c) James Jackson-South and contributors. -// Licensed under the Apache License, Version 2.0. -// - -namespace ImageSharp.Drawing.Processors -{ - using ImageSharp.PixelFormats; - - /// - /// Returns details about how far away from the inside of a shape and the color the pixel could be. - /// - /// The type of the color. - public struct ColoredPointInfo - where TPixel : struct, IPixel - { - /// - /// The color - /// - public TPixel Color; - - /// - /// The distance from element - /// - public float DistanceFromElement; - } -} diff --git a/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs b/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs deleted file mode 100644 index ac1889068..000000000 --- a/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright (c) James Jackson-South and contributors. -// Licensed under the Apache License, Version 2.0. -// - -namespace ImageSharp.Drawing.Processors -{ - using System; - using ImageSharp.PixelFormats; - - /// - /// primitive that converts a into a color and a distance away from the drawable part of the path. - /// - /// The type of the color. - public abstract class PenApplicator : IDisposable - where TPixel : struct, IPixel - { - /// - /// Gets the required region. - /// - /// - /// The required region. - /// - public abstract RectangleF RequiredRegion { get; } - - /// - public abstract void Dispose(); - - /// - /// Gets a from a point represented by a . - /// - /// The x. - /// The y. - /// The information to extract color details about. - /// - /// Returns the color details and distance from a solid bit of the line. - /// - public abstract ColoredPointInfo GetColor(int x, int y, PointInfo info); - } -}