diff --git a/.editorconfig b/.editorconfig
index c3fb970c3..fa43757a9 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -6,7 +6,7 @@ indent_style = space
indent_size = 4
csharp_style_var_for_built_in_types = false:warning
csharp_style_var_elsewhere = false:warning
-csharp_style_var_when_type_is_apparent = false:warning
+csharp_style_var_when_type_is_apparent = true:warning
end_of_line = crlf
dotnet_sort_system_directives_first = true
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
diff --git a/ImageSharp.ruleset b/ImageSharp.ruleset
index 3f10206fc..0bd9cd11a 100644
--- a/ImageSharp.ruleset
+++ b/ImageSharp.ruleset
@@ -4,7 +4,7 @@
-
+
diff --git a/ImageSharp.sln b/ImageSharp.sln
index 8ec2cf53b..2e0cbd52e 100644
--- a/ImageSharp.sln
+++ b/ImageSharp.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-VisualStudioVersion = 15.0.26403.3
+VisualStudioVersion = 15.0.26403.7
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{C317F1B1-D75E-4C6D-83EB-80367343E0D7}"
ProjectSection(SolutionItems) = preProject
@@ -16,8 +16,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
ImageSharp.sln.DotSettings = ImageSharp.sln.DotSettings
NuGet.config = NuGet.config
README.md = README.md
- Rebracer.xml = Rebracer.xml
- Settings.StyleCop = Settings.StyleCop
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{815C0625-CD3D-440F-9F80-2D83856AB7AE}"
diff --git a/README.md b/README.md
index 4d079de39..ca2427546 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-#
ImageSharp
+#
ImageSharp
**ImageSharp** is a new, fully featured, fully managed, cross-platform, 2D graphics API designed to allow the processing of images without the use of `System.Drawing`.
@@ -39,8 +39,8 @@ The **ImageSharp** library is made up of multiple packages.
Packages include:
- **ImageSharp**
- - Contains the Image classes, PixelFormats, Primitives, Configuration, and other core functionality.
- - The IImageFormat interface, Jpeg, Png, Bmp, and Gif formats.
+ - Contains the generic `Image` class, PixelFormats, Primitives, Configuration, and other core functionality.
+ - The `IImageFormat` interface, Jpeg, Png, Bmp, and Gif formats.
- Transform methods like Resize, Crop, Skew, Rotate - Anything that alters the dimensions of the image.
- Non-transform methods like Gaussian Blur, Pixelate, Edge Detection - Anything that maintains the original image dimensions.
@@ -77,13 +77,16 @@ Without the constraints of `System.Drawing` We have been able to develop somethi
Gone are system-wide process-locks; ImageSharp images are thread-safe and fully supported in web environments.
-Many `Image` methods are also fluent.
+Many `Image` methods are also fluent.
Here's an example of the code required to resize an image using the default Bicubic resampler then turn the colors into their grayscale equivalent using the BT709 standard matrix.
+`Rgba32` is our default PixelFormat, equivalent to `System.Drawing Color`.
+
On platforms supporting netstandard 1.3+
```csharp
-using (Image image = Image.Load("foo.jpg"))
+// Image.Load(string path) is a shortcut for our default type. Other pixel formats use Image.Load(string path))
+using (Image image = Image.Load("foo.jpg"))
{
image.Resize(image.Width / 2, image.Height / 2)
.Grayscale()
@@ -92,9 +95,10 @@ using (Image image = Image.Load("foo.jpg"))
```
on netstandard 1.1 - 1.2
```csharp
+// Image.Load(Stream stream) is a shortcut for our default type. Other pixel formats use Image.Load(Stream stream))
using (FileStream stream = File.OpenRead("foo.jpg"))
using (FileStream output = File.OpenWrite("bar.jpg"))
-using (Image image = Image.Load(stream))
+using (Image image = Image.Load(stream))
{
image.Resize(image.Width / 2, image.Height / 2)
.Grayscale()
@@ -105,15 +109,14 @@ using (Image image = Image.Load(stream))
Setting individual pixel values is perfomed as follows:
```csharp
-using (image = new Image(400, 400)
-using (var pixels = image.Lock())
+using (Image image = new Image(400, 400)
+using (PixelAccessor pixels = image.Lock())
{
- // Rgba32 is our default PixelFormat, equivalent to System.Drawing Color
pixels[200, 200] = Rgba32.White;
}
```
-For advanced usage the `Image` and `PixelAccessor` classes are available allowing developers to implement their own color models in the same manner as Microsoft XNA Game Studio and MonoGame.
+For advanced usage there are multiple [PixelFormat implementations](https://github.com/JimBobSquarePants/ImageSharp/tree/master/src/ImageSharp/PixelFormats) available allowing developers to implement their own color models in the same manner as Microsoft XNA Game Studio and MonoGame.
All in all this should allow image processing to be much more accessible to developers which has always been my goal from the start.
@@ -121,7 +124,7 @@ All in all this should allow image processing to be much more accessible to deve
Please... Spread the word, contribute algorithms, submit performance improvements, unit tests.
-Performance is a biggie, if you know anything about the new vector types and can apply some fancy new stuff with that it would be awesome.
+Performance is a biggie, if you know anything about the `System.Numerics.Vectors` types and can apply some fancy new stuff with that it would be awesome.
There's a lot of developers out there who could write this stuff a lot better and faster than I and I would love to see what we collectively can come up with so please, if you can help in any way it would be most welcome and benificial for all.
diff --git a/Rebracer.xml b/Rebracer.xml
deleted file mode 100644
index 9b0a654d2..000000000
--- a/Rebracer.xml
+++ /dev/null
@@ -1,249 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- HACK:2
- TODO:2
- UNDONE:2
- UnresolvedMergeConflict:3
-
- false
- false
- false
-
-
-
-
- 0
- 0
- 1
- 1
- -1
- -1
- 0
- 1
- 0
- 1
- 1
- 1
- 1
- 1
- 0
- 1
- 1
- 0
- 2
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 0
- 1
- 0
- 1
- 0
- 0
- 0
- 1
- 1
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 1
- 1
- 0
- 1
- 0
- 0
- 0
- 1
- 1
-
-
- false
- true
- true
- true
- true
- Implicit (Windows)|$(VSInstallDir)\JavaScript\References\libhelp.js|$(VSInstallDir)\JavaScript\References\domWindows.js|$(VSInstallDir)\JavaScript\References\underscorefilter.js|$(VSInstallDir)\JavaScript\References\showPlainComments.js;Implicit (Windows 8.1)|$(VSInstallDir)\JavaScript\References\libhelp.js|$(VSInstallDir)\JavaScript\References\sitetypesWindows.js|$(VSInstallDir)\JavaScript\References\domWindows_8.1.js|$(VSInstallDir)\JavaScript\References\underscorefilter.js|$(VSInstallDir)\JavaScript\References\showPlainComments.js;Implicit (Windows Phone 8.1)|$(VSInstallDir)\JavaScript\References\libhelp.js|$(VSInstallDir)\JavaScript\References\sitetypesWindows.js|$(VSInstallDir)\JavaScript\References\domWindowsPhone_8.1.js|$(VSInstallDir)\JavaScript\References\underscorefilter.js|$(VSInstallDir)\JavaScript\References\showPlainComments.js;Implicit (Web)|$(VSInstallDir)\JavaScript\References\libhelp.js|$(VSInstallDir)\JavaScript\References\sitetypesWeb.js|$(VSInstallDir)\JavaScript\References\domWeb.js|$(VSInstallDir)\JavaScript\References\underscorefilter.js|$(VSInstallDir)\JavaScript\References\showPlainComments.js|C:\Users\james.south\AppData\Local\Web Essentials 2015\Modern.Intellisense.js;Dedicated Worker|$(VSInstallDir)\JavaScript\References\libhelp.js|$(VSInstallDir)\JavaScript\References\dedicatedworker.js|$(VSInstallDir)\JavaScript\References\underscorefilter.js|$(VSInstallDir)\JavaScript\References\showPlainComments.js;Generic|$(VSInstallDir)\JavaScript\References\libhelp.js|$(VSInstallDir)\JavaScript\References\underscorefilter.js|$(VSInstallDir)\JavaScript\References\showPlainComments.js;
- true
- true
- true
- false
- true
- true
- false
- false
- true
- true
-
-
- true
- false
- false
- true
- true
- true
- 1
- true
- false
- true
- true
- false
- false
- false
- false
- false
- false
- false
- true
- true
- false
- true
- true
- true
- true
- false
- true
- false
- false
- true
- false
- 1
- true
- 2
- 2
- false
- false
- 0
- true
- true
- 0
- 0
- true
- true
- false
- 0
- 0
- false
- 0
- 1
- false
- true
- false
- 2
- true
- false
- false
- false
- false
- true
- true
- false
- false
- false
- false
- true
- true
- 2
- 2
- 2
- true
- false
- false
- true
- true
- false
- false
- 1
- true
- false
- false
- false
- false
- false
- false
- false
- false
- false
- false
- false
- true
- false
- false
- true
- true
-
-
- false
- false
- true
- false
- true
- true
- true
- true
- true
- true
- true
- false
- true
- true
- false
- false
- true
- true
- false
- false
- false
- false
- false
- false
- false
- false
-
-
- false
- true
- true
- true
- false
- true
- true
- true
-
-
-
-
\ No newline at end of file
diff --git a/Settings.StyleCop b/Settings.StyleCop
deleted file mode 100644
index 2716e8d0a..000000000
--- a/Settings.StyleCop
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
- enum
- exif
- uint
- lossy
- octree
- png
- quantizer
- unzig
- cb
- cr
- Laplacian
- Sobel
- Scharr
- rgb
- rgba
- rrggbb
- rrggbbaa
- scanline
- scanlines
- png's
- codeword
- unscaled
- zig-zag
- crc
- zlib
- xff
- xda
- ss
- Vol
- pp
- cmyk
- Paeth
- th
- bool
- bools
- desensitivity
- premultiplied
- endianness
- thresholding
-
-
-
-
-
- James Jackson-South
-
- Copyright © James Jackson-South and contributors.
- Licensed under the Apache License, Version 2.0.
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Brushes/Brushes.cs b/src/ImageSharp.Drawing/Brushes/Brushes.cs
index 8998c60f6..e39f3dd49 100644
--- a/src/ImageSharp.Drawing/Brushes/Brushes.cs
+++ b/src/ImageSharp.Drawing/Brushes/Brushes.cs
@@ -8,149 +8,251 @@ namespace ImageSharp.Drawing.Brushes
using ImageSharp.PixelFormats;
///
- /// A collection of methods for creating brushes. Brushes use for painting.
+ /// A collection of methods for creating generic brushes.
///
- public class Brushes
+ /// A New
+ public static class Brushes
{
+ ///
+ /// Percent10 Hatch Pattern
+ ///
+ /// ---> x axis
+ /// ^
+ /// | y - axis
+ /// |
+ /// see PatternBrush for details about how to make new patterns work
+ private static readonly bool[,] Percent10Pattern =
+ {
+ { true, false, false, false },
+ { false, false, false, false },
+ { false, false, true, false },
+ { false, false, false, false }
+ };
+
+ ///
+ /// Percent20 pattern.
+ ///
+ private static readonly bool[,] Percent20Pattern =
+ {
+ { true, false, false, false },
+ { false, false, true, false },
+ { true, false, false, false },
+ { false, false, true, false }
+ };
+
+ ///
+ /// Horizontal Hatch Pattern
+ ///
+ private static readonly bool[,] HorizontalPattern =
+ {
+ { false },
+ { true },
+ { false },
+ { false }
+ };
+
+ ///
+ /// Min Pattern
+ ///
+ private static readonly bool[,] MinPattern =
+ {
+ { false },
+ { false },
+ { false },
+ { true }
+ };
+
+ ///
+ /// Vertical Pattern
+ ///
+ private static readonly bool[,] VerticalPattern =
+ {
+ { false, true, false, false },
+ };
+
+ ///
+ /// Forward Diagonal Pattern
+ ///
+ private static readonly bool[,] ForwardDiagonalPattern =
+ {
+ { false, false, false, true },
+ { false, false, true, false },
+ { false, true, false, false },
+ { true, false, false, false }
+ };
+
+ ///
+ /// Backward Diagonal Pattern
+ ///
+ private static readonly bool[,] BackwardDiagonalPattern =
+ {
+ { true, false, false, false },
+ { false, true, false, false },
+ { false, false, true, false },
+ { false, false, false, true }
+ };
+
///
/// Create as brush that will paint a solid color
///
/// The color.
- /// A Brush
- public static SolidBrush Solid(Rgba32 color)
- => new SolidBrush(color);
+ /// The pixel format.
+ /// A New
+ public static SolidBrush Solid(TPixel color)
+ where TPixel : struct, IPixel
+ => new SolidBrush(color);
///
- /// Create as brush that will paint a Percent10 Hatch Pattern with
- /// in the specified foreground color and a transparent background
+ /// Create as brush that will paint a Percent10 Hatch Pattern with the specified colors
///
/// Color of the foreground.
- /// A Brush
- public static PatternBrush Percent10(Rgba32 foreColor)
- => new PatternBrush(Brushes.Percent10(foreColor, Rgba32.Transparent));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush Percent10(TPixel foreColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, NamedColors.Transparent, Percent10Pattern);
///
- /// Create as brush that will paint a Percent10 Hatch Pattern with
- /// in the specified foreground and background colors
+ /// Create as brush that will paint a Percent10 Hatch Pattern with the specified colors
///
/// Color of the foreground.
/// Color of the background.
- /// A Brush
- public static PatternBrush Percent10(Rgba32 foreColor, Rgba32 backColor)
- => new PatternBrush(Brushes.Percent10(foreColor, backColor));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush Percent10(TPixel foreColor, TPixel backColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, backColor, Percent10Pattern);
///
- /// Create as brush that will paint a Percent20 Hatch Pattern with
- /// in the specified foreground color and a transparent background
+ /// Create as brush that will paint a Percent20 Hatch Pattern with the specified foreground color and a
+ /// transparent background.
///
/// Color of the foreground.
- /// A Brush
- public static PatternBrush Percent20(Rgba32 foreColor)
- => new PatternBrush(Brushes.Percent20(foreColor, Rgba32.Transparent));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush Percent20(TPixel foreColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, NamedColors.Transparent, Percent20Pattern);
///
- /// Create as brush that will paint a Percent20 Hatch Pattern with
- /// in the specified foreground and background colors
+ /// Create as brush that will paint a Percent20 Hatch Pattern with the specified colors
///
/// Color of the foreground.
/// Color of the background.
- /// A Brush
- public static PatternBrush Percent20(Rgba32 foreColor, Rgba32 backColor)
- => new PatternBrush(Brushes.Percent20(foreColor, backColor));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush Percent20(TPixel foreColor, TPixel backColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, backColor, Percent20Pattern);
///
- /// Create as brush that will paint a Horizontal Hatch Pattern with
- /// in the specified foreground color and a transparent background
+ /// Create as brush that will paint a Horizontal Hatch Pattern with the specified foreground color and a
+ /// transparent background.
///
/// Color of the foreground.
- /// A Brush
- public static PatternBrush Horizontal(Rgba32 foreColor)
- => new PatternBrush(Brushes.Horizontal(foreColor, Rgba32.Transparent));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush Horizontal(TPixel foreColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, NamedColors.Transparent, HorizontalPattern);
///
- /// Create as brush that will paint a Horizontal Hatch Pattern with
- /// in the specified foreground and background colors
+ /// Create as brush that will paint a Horizontal Hatch Pattern with the specified colors
///
/// Color of the foreground.
/// Color of the background.
- /// A Brush
- public static PatternBrush Horizontal(Rgba32 foreColor, Rgba32 backColor)
- => new PatternBrush(Brushes.Horizontal(foreColor, backColor));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush Horizontal(TPixel foreColor, TPixel backColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, backColor, HorizontalPattern);
///
- /// Create as brush that will paint a Min Hatch Pattern with
- /// in the specified foreground color and a transparent background
+ /// Create as brush that will paint a Min Hatch Pattern with the specified foreground color and a
+ /// transparent background.
///
/// Color of the foreground.
- /// A Brush
- public static PatternBrush Min(Rgba32 foreColor)
- => new PatternBrush(Brushes.Min(foreColor, Rgba32.Transparent));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush Min(TPixel foreColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, NamedColors.Transparent, MinPattern);
///
- /// Create as brush that will paint a Min Hatch Pattern with
- /// in the specified foreground and background colors
+ /// Create as brush that will paint a Min Hatch Pattern with the specified colors
///
/// Color of the foreground.
/// Color of the background.
- /// A Brush
- public static PatternBrush Min(Rgba32 foreColor, Rgba32 backColor)
- => new PatternBrush(Brushes.Min(foreColor, backColor));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush Min(TPixel foreColor, TPixel backColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, backColor, MinPattern);
///
- /// Create as brush that will paint a Vertical Hatch Pattern with
- /// in the specified foreground color and a transparent background
+ /// Create as brush that will paint a Vertical Hatch Pattern with the specified foreground color and a
+ /// transparent background.
///
/// Color of the foreground.
- /// A Brush
- public static PatternBrush Vertical(Rgba32 foreColor)
- => new PatternBrush(Brushes.Vertical(foreColor, Rgba32.Transparent));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush Vertical(TPixel foreColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, NamedColors.Transparent, VerticalPattern);
///
- /// Create as brush that will paint a Vertical Hatch Pattern with
- /// in the specified foreground and background colors
+ /// Create as brush that will paint a Vertical Hatch Pattern with the specified colors
///
/// Color of the foreground.
/// Color of the background.
- /// A Brush
- public static PatternBrush Vertical(Rgba32 foreColor, Rgba32 backColor)
- => new PatternBrush(Brushes.Vertical(foreColor, backColor));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush Vertical(TPixel foreColor, TPixel backColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, backColor, VerticalPattern);
///
- /// Create as brush that will paint a Forward Diagonal Hatch Pattern with
- /// in the specified foreground color and a transparent background
+ /// Create as brush that will paint a Forward Diagonal Hatch Pattern with the specified foreground color and a
+ /// transparent background.
///
/// Color of the foreground.
- /// A Brush
- public static PatternBrush ForwardDiagonal(Rgba32 foreColor)
- => new PatternBrush(Brushes.ForwardDiagonal(foreColor, Rgba32.Transparent));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush ForwardDiagonal(TPixel foreColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, NamedColors.Transparent, ForwardDiagonalPattern);
///
- /// Create as brush that will paint a Forward Diagonal Hatch Pattern with
- /// in the specified foreground and background colors
+ /// Create as brush that will paint a Forward Diagonal Hatch Pattern with the specified colors
///
/// Color of the foreground.
/// Color of the background.
- /// A Brush
- public static PatternBrush ForwardDiagonal(Rgba32 foreColor, Rgba32 backColor)
- => new PatternBrush(Brushes.ForwardDiagonal(foreColor, backColor));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush ForwardDiagonal(TPixel foreColor, TPixel backColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, backColor, ForwardDiagonalPattern);
///
- /// Create as brush that will paint a Backward Diagonal Hatch Pattern with
- /// in the specified foreground color and a transparent background
+ /// Create as brush that will paint a Backward Diagonal Hatch Pattern with the specified foreground color and a
+ /// transparent background.
///
/// Color of the foreground.
- /// A Brush
- public static PatternBrush BackwardDiagonal(Rgba32 foreColor)
- => new PatternBrush(Brushes.BackwardDiagonal(foreColor, Rgba32.Transparent));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush BackwardDiagonal(TPixel foreColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, NamedColors.Transparent, BackwardDiagonalPattern);
///
- /// Create as brush that will paint a Backward Diagonal Hatch Pattern with
- /// in the specified foreground and background colors
+ /// Create as brush that will paint a Backward Diagonal Hatch Pattern with the specified colors
///
/// Color of the foreground.
/// Color of the background.
- /// A Brush
- public static PatternBrush BackwardDiagonal(Rgba32 foreColor, Rgba32 backColor)
- => new PatternBrush(Brushes.BackwardDiagonal(foreColor, backColor));
+ /// The pixel format.
+ /// A New
+ public static PatternBrush BackwardDiagonal(TPixel foreColor, TPixel backColor)
+ where TPixel : struct, IPixel
+ => new PatternBrush(foreColor, backColor, BackwardDiagonalPattern);
}
}
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Brushes/Brushes{TPixel}.cs b/src/ImageSharp.Drawing/Brushes/Brushes{TPixel}.cs
deleted file mode 100644
index 4b2f6c026..000000000
--- a/src/ImageSharp.Drawing/Brushes/Brushes{TPixel}.cs
+++ /dev/null
@@ -1,168 +0,0 @@
-//
-// Copyright (c) James Jackson-South and contributors.
-// Licensed under the Apache License, Version 2.0.
-//
-
-namespace ImageSharp.Drawing.Brushes
-{
- using ImageSharp.PixelFormats;
-
- ///
- /// A collection of methods for creating generic brushes.
- ///
- /// The pixel format.
- /// A Brush
- public class Brushes
- where TPixel : struct, IPixel
- {
- ///
- /// Percent10 Hatch Pattern
- ///
- /// ---> x axis
- /// ^
- /// | y - axis
- /// |
- /// see PatternBrush for details about how to make new patterns work
- private static readonly bool[,] Percent10Pattern =
- {
- { true, false, false, false },
- { false, false, false, false },
- { false, false, true, false },
- { false, false, false, false }
- };
-
- ///
- /// Percent20 pattern.
- ///
- private static readonly bool[,] Percent20Pattern =
- {
- { true, false, false, false },
- { false, false, true, false },
- { true, false, false, false },
- { false, false, true, false }
- };
-
- ///
- /// Horizontal Hatch Pattern
- ///
- private static readonly bool[,] HorizontalPattern =
- {
- { false },
- { true },
- { false },
- { false }
- };
-
- ///
- /// Min Pattern
- ///
- private static readonly bool[,] MinPattern =
- {
- { false },
- { false },
- { false },
- { true }
- };
-
- ///
- /// Vertical Pattern
- ///
- private static readonly bool[,] VerticalPattern =
- {
- { false, true, false, false },
- };
-
- ///
- /// Forward Diagonal Pattern
- ///
- private static readonly bool[,] ForwardDiagonalPattern =
- {
- { false, false, false, true },
- { false, false, true, false },
- { false, true, false, false },
- { true, false, false, false }
- };
-
- ///
- /// Backward Diagonal Pattern
- ///
- private static readonly bool[,] BackwardDiagonalPattern =
- {
- { true, false, false, false },
- { false, true, false, false },
- { false, false, true, false },
- { false, false, false, true }
- };
-
- ///
- /// Create as brush that will paint a solid color
- ///
- /// The color.
- /// A Brush
- public static SolidBrush Solid(TPixel color)
- => new SolidBrush(color);
-
- ///
- /// Create as brush that will paint a Percent10 Hatch Pattern within the specified colors
- ///
- /// Color of the foreground.
- /// Color of the background.
- /// A Brush
- public static PatternBrush Percent10(TPixel foreColor, TPixel backColor)
- => new PatternBrush(foreColor, backColor, Percent10Pattern);
-
- ///
- /// Create as brush that will paint a Percent20 Hatch Pattern within the specified colors
- ///
- /// Color of the foreground.
- /// Color of the background.
- /// A Brush
- public static PatternBrush Percent20(TPixel foreColor, TPixel backColor)
- => new PatternBrush(foreColor, backColor, Percent20Pattern);
-
- ///
- /// Create as brush that will paint a Horizontal Hatch Pattern within the specified colors
- ///
- /// Color of the foreground.
- /// Color of the background.
- /// A Brush
- public static PatternBrush Horizontal(TPixel foreColor, TPixel backColor)
- => new PatternBrush(foreColor, backColor, HorizontalPattern);
-
- ///
- /// Create as brush that will paint a Min Hatch Pattern within the specified colors
- ///
- /// Color of the foreground.
- /// Color of the background.
- /// A Brush
- public static PatternBrush Min(TPixel foreColor, TPixel backColor)
- => new PatternBrush(foreColor, backColor, MinPattern);
-
- ///
- /// Create as brush that will paint a Vertical Hatch Pattern within the specified colors
- ///
- /// Color of the foreground.
- /// Color of the background.
- /// A Brush
- public static PatternBrush Vertical(TPixel foreColor, TPixel backColor)
- => new PatternBrush(foreColor, backColor, VerticalPattern);
-
- ///
- /// Create as brush that will paint a Forward Diagonal Hatch Pattern within the specified colors
- ///
- /// Color of the foreground.
- /// Color of the background.
- /// A Brush
- public static PatternBrush ForwardDiagonal(TPixel foreColor, TPixel backColor)
- => new PatternBrush(foreColor, backColor, ForwardDiagonalPattern);
-
- ///
- /// Create as brush that will paint a Backward Diagonal Hatch Pattern within the specified colors
- ///
- /// Color of the foreground.
- /// Color of the background.
- /// A Brush
- public static PatternBrush BackwardDiagonal(TPixel foreColor, TPixel backColor)
- => new PatternBrush(foreColor, backColor, BackwardDiagonalPattern);
- }
-}
diff --git a/src/ImageSharp.Drawing/Brushes/ImageBrush.cs b/src/ImageSharp.Drawing/Brushes/ImageBrush.cs
deleted file mode 100644
index 6a3ff1d9d..000000000
--- a/src/ImageSharp.Drawing/Brushes/ImageBrush.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Copyright (c) James Jackson-South and contributors.
-// Licensed under the Apache License, Version 2.0.
-//
-
-namespace ImageSharp.Drawing.Brushes
-{
- using ImageSharp.PixelFormats;
-
- ///
- /// Provides an implementation of a solid brush for painting with repeating images. The brush uses for painting.
- ///
- public class ImageBrush : ImageBrush
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The image to paint.
- public ImageBrush(IImageBase image)
- : base(image)
- {
- }
- }
-}
diff --git a/src/ImageSharp.Drawing/Brushes/ImageBrush{TPixel}.cs b/src/ImageSharp.Drawing/Brushes/ImageBrush{TPixel}.cs
index 5038ea01b..6f851e5c3 100644
--- a/src/ImageSharp.Drawing/Brushes/ImageBrush{TPixel}.cs
+++ b/src/ImageSharp.Drawing/Brushes/ImageBrush{TPixel}.cs
@@ -5,7 +5,10 @@
namespace ImageSharp.Drawing.Brushes
{
+ using System;
using System.Numerics;
+
+ using ImageSharp.Memory;
using ImageSharp.PixelFormats;
using Processors;
@@ -114,7 +117,7 @@ namespace ImageSharp.Drawing.Brushes
}
///
- internal override void Apply(BufferSpan scanline, int x, int y)
+ internal override void Apply(Span scanline, int x, int y)
{
// create a span for colors
using (Buffer amountBuffer = new Buffer(scanline.Length))
@@ -122,7 +125,7 @@ namespace ImageSharp.Drawing.Brushes
{
int sourceY = (y - this.offsetY) % this.yLength;
int offsetX = x - this.offsetX;
- BufferSpan sourceRow = this.source.GetRowSpan(sourceY);
+ Span sourceRow = this.source.GetRowSpan(sourceY);
for (int i = 0; i < scanline.Length; i++)
{
@@ -133,7 +136,7 @@ namespace ImageSharp.Drawing.Brushes
overlay[i] = pixel;
}
- BufferSpan destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
+ Span destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
this.Blender.Blend(destinationRow, destinationRow, overlay, amountBuffer);
}
}
diff --git a/src/ImageSharp.Drawing/Brushes/PatternBrush.cs b/src/ImageSharp.Drawing/Brushes/PatternBrush.cs
deleted file mode 100644
index f00862fe7..000000000
--- a/src/ImageSharp.Drawing/Brushes/PatternBrush.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// Copyright (c) James Jackson-South and contributors.
-// Licensed under the Apache License, Version 2.0.
-//
-
-namespace ImageSharp.Drawing.Brushes
-{
- using ImageSharp.PixelFormats;
-
- ///
- /// Provides an implementation of a pattern brush for painting patterns. The brush use for painting.
- ///
- public class PatternBrush : PatternBrush
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// Color of the fore.
- /// Color of the back.
- /// The pattern.
- public PatternBrush(Rgba32 foreColor, Rgba32 backColor, bool[,] pattern)
- : base(foreColor, backColor, pattern)
- {
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The brush.
- internal PatternBrush(PatternBrush brush)
- : base(brush)
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Brushes/PatternBrush{TPixel}.cs b/src/ImageSharp.Drawing/Brushes/PatternBrush{TPixel}.cs
index dc8a4bc90..90990e54a 100644
--- a/src/ImageSharp.Drawing/Brushes/PatternBrush{TPixel}.cs
+++ b/src/ImageSharp.Drawing/Brushes/PatternBrush{TPixel}.cs
@@ -7,6 +7,8 @@ namespace ImageSharp.Drawing.Brushes
{
using System;
using System.Numerics;
+
+ using ImageSharp.Memory;
using ImageSharp.PixelFormats;
using Processors;
@@ -147,7 +149,7 @@ namespace ImageSharp.Drawing.Brushes
}
///
- internal override void Apply(BufferSpan scanline, int x, int y)
+ internal override void Apply(Span scanline, int x, int y)
{
int patternY = y % this.pattern.Height;
using (Buffer amountBuffer = new Buffer(scanline.Length))
@@ -161,7 +163,7 @@ namespace ImageSharp.Drawing.Brushes
overlay[i] = this.pattern[patternY, patternX];
}
- BufferSpan destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
+ Span destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
this.Blender.Blend(destinationRow, destinationRow, overlay, amountBuffer);
}
}
diff --git a/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs b/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs
index d7c70220c..29629324a 100644
--- a/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs
+++ b/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs
@@ -7,6 +7,8 @@ namespace ImageSharp.Drawing.Processors
{
using System;
using System.Numerics;
+
+ using ImageSharp.Memory;
using ImageSharp.PixelFormats;
///
@@ -64,7 +66,7 @@ namespace ImageSharp.Drawing.Processors
/// The x position in the target pixel space that the start of the scanline data corresponds to.
/// The y position in the target pixel space that whole scanline corresponds to.
/// scanlineBuffer will be > scanlineWidth but provide and offset in case we want to share a larger buffer across runs.
- internal virtual void Apply(BufferSpan scanline, int x, int y)
+ internal virtual void Apply(Span scanline, int x, int y)
{
using (Buffer amountBuffer = new Buffer(scanline.Length))
using (Buffer overlay = new Buffer(scanline.Length))
@@ -79,7 +81,7 @@ namespace ImageSharp.Drawing.Processors
overlay[i] = this[x + i, y];
}
- BufferSpan destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
+ Span destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
this.Blender.Blend(destinationRow, destinationRow, overlay, amountBuffer);
}
}
diff --git a/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs b/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs
deleted file mode 100644
index bfe5c01e6..000000000
--- a/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// Copyright (c) James Jackson-South and contributors.
-// Licensed under the Apache License, Version 2.0.
-//
-
-namespace ImageSharp.Drawing.Brushes
-{
- using ImageSharp.PixelFormats;
-
- ///
- /// Provides an implementation of a recolor brush for painting color changes.
- ///
- public class RecolorBrush : RecolorBrush
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// Color of the source.
- /// Color of the target.
- /// The threshold.
- public RecolorBrush(Rgba32 sourceColor, Rgba32 targeTPixel, float threshold)
- : base(sourceColor, targeTPixel, threshold)
- {
- }
- }
-}
diff --git a/src/ImageSharp.Drawing/Brushes/RecolorBrush{TPixel}.cs b/src/ImageSharp.Drawing/Brushes/RecolorBrush{TPixel}.cs
index a96202b7b..64b91e384 100644
--- a/src/ImageSharp.Drawing/Brushes/RecolorBrush{TPixel}.cs
+++ b/src/ImageSharp.Drawing/Brushes/RecolorBrush{TPixel}.cs
@@ -5,7 +5,10 @@
namespace ImageSharp.Drawing.Brushes
{
+ using System;
using System.Numerics;
+
+ using ImageSharp.Memory;
using ImageSharp.PixelFormats;
using Processors;
@@ -139,7 +142,7 @@ namespace ImageSharp.Drawing.Brushes
}
///
- internal override void Apply(BufferSpan scanline, int x, int y)
+ internal override void Apply(Span scanline, int x, int y)
{
using (Buffer amountBuffer = new Buffer(scanline.Length))
using (Buffer overlay = new Buffer(scanline.Length))
@@ -155,7 +158,7 @@ namespace ImageSharp.Drawing.Brushes
overlay[i] = this[offsetX, y];
}
- BufferSpan destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
+ Span destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
this.Blender.Blend(destinationRow, destinationRow, overlay, amountBuffer);
}
}
diff --git a/src/ImageSharp.Drawing/Brushes/SolidBrush.cs b/src/ImageSharp.Drawing/Brushes/SolidBrush.cs
deleted file mode 100644
index 8a3ad50e7..000000000
--- a/src/ImageSharp.Drawing/Brushes/SolidBrush.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Copyright (c) James Jackson-South and contributors.
-// Licensed under the Apache License, Version 2.0.
-//
-
-namespace ImageSharp.Drawing.Brushes
-{
- using ImageSharp.PixelFormats;
-
- ///
- /// Provides an implementation of a solid brush for painting solid color areas. The brush uses for painting.
- ///
- public class SolidBrush : SolidBrush
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The color.
- public SolidBrush(Rgba32 color)
- : base(color)
- {
- }
- }
-}
diff --git a/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs b/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs
index 71b802136..28f7b0e45 100644
--- a/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs
+++ b/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs
@@ -5,7 +5,10 @@
namespace ImageSharp.Drawing.Brushes
{
+ using System;
using System.Numerics;
+
+ using ImageSharp.Memory;
using ImageSharp.PixelFormats;
using Processors;
@@ -87,9 +90,9 @@ namespace ImageSharp.Drawing.Brushes
}
///
- internal override void Apply(BufferSpan scanline, int x, int y)
+ internal override void Apply(Span scanline, int x, int y)
{
- BufferSpan destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
+ Span destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length);
using (Buffer amountBuffer = new Buffer(scanline.Length))
{
diff --git a/src/ImageSharp.Drawing/DrawImage.cs b/src/ImageSharp.Drawing/DrawImage.cs
index 920ad31cc..db40132c8 100644
--- a/src/ImageSharp.Drawing/DrawImage.cs
+++ b/src/ImageSharp.Drawing/DrawImage.cs
@@ -1,17 +1,15 @@
-//
+//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp
{
- using System;
using Drawing.Processors;
- using ImageSharp.Drawing;
using ImageSharp.PixelFormats;
///
- /// Extension methods for the type.
+ /// Extension methods for the type.
///
public static partial class ImageExtensions
{
diff --git a/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj b/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj
index 15b7df2a2..a3552a09c 100644
--- a/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj
+++ b/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj
@@ -2,7 +2,7 @@
An extension to ImageSharp that allows the drawing of images, paths, and text.
ImageSharp.Drawing
- 1.0.0-alpha8
+ 1.0.0-alpha9
James Jackson-South and contributors
netstandard1.1
true
diff --git a/src/ImageSharp.Drawing/Pens/Pen.cs b/src/ImageSharp.Drawing/Pens/Pen.cs
deleted file mode 100644
index a3cc3cbdf..000000000
--- a/src/ImageSharp.Drawing/Pens/Pen.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// Copyright (c) James Jackson-South and contributors.
-// Licensed under the Apache License, Version 2.0.
-//
-
-namespace ImageSharp.Drawing.Pens
-{
- using ImageSharp.PixelFormats;
-
- ///
- /// Represents a in the color space.
- ///
- public class Pen : Pen
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The color.
- /// The width.
- public Pen(Rgba32 color, float width)
- : base(color, width)
- {
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The brush.
- /// The width.
- public Pen(IBrush brush, float width)
- : base(brush, width)
- {
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The brush.
- /// The width.
- /// The pattern.
- public Pen(IBrush brush, float width, float[] pattern)
- : base(brush, width, pattern)
- {
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The pen.
- internal Pen(Pen pen)
- : base(pen)
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Pens/Pens.cs b/src/ImageSharp.Drawing/Pens/Pens.cs
index 5c91df226..364115cb7 100644
--- a/src/ImageSharp.Drawing/Pens/Pens.cs
+++ b/src/ImageSharp.Drawing/Pens/Pens.cs
@@ -10,86 +10,121 @@ namespace ImageSharp.Drawing.Pens
///
/// Common Pen styles
///
- public class Pens
+ public static class Pens
{
+ private static readonly float[] DashDotPattern = new[] { 3f, 1f, 1f, 1f };
+ private static readonly float[] DashDotDotPattern = new[] { 3f, 1f, 1f, 1f, 1f, 1f };
+ private static readonly float[] DottedPattern = new[] { 1f, 1f };
+ private static readonly float[] DashedPattern = new[] { 3f, 1f };
+
///
/// Create a solid pen with out any drawing patterns
///
/// The color.
/// The width.
+ /// The type of the color.
/// The Pen
- public static Pen Solid(Rgba32 color, float width) => new Pen(color, width);
+ public static Pen Solid(TPixel color, float width)
+ where TPixel : struct, IPixel
+ => new Pen(color, width);
///
/// Create a solid pen with out any drawing patterns
///
/// The brush.
/// The width.
+ /// The type of the color.
/// The Pen
- public static Pen Solid(IBrush brush, float width) => new Pen(brush, width);
+ public static Pen Solid(IBrush brush, float width)
+ where TPixel : struct, IPixel
+ => new Pen(brush, width);
///
/// Create a pen with a 'Dash' drawing patterns
///
/// The color.
/// The width.
+ /// The type of the color.
/// The Pen
- public static Pen Dash(Rgba32 color, float width) => new Pen(Pens.Dash(color, width));
+ public static Pen Dash(TPixel color, float width)
+ where TPixel : struct, IPixel
+ => new Pen(color, width, DashedPattern);
///
/// Create a pen with a 'Dash' drawing patterns
///
/// The brush.
/// The width.
+ /// The type of the color.
/// The Pen
- public static Pen Dash(IBrush brush, float width) => new Pen(Pens.Dash(brush, width));
+ public static Pen Dash(IBrush brush, float width)
+ where TPixel : struct, IPixel
+ => new Pen(brush, width, DashedPattern);
///
/// Create a pen with a 'Dot' drawing patterns
///
/// The color.
/// The width.
+ /// The type of the color.
/// The Pen
- public static Pen Dot(Rgba32 color, float width) => new Pen(Pens.Dot(color, width));
+ public static Pen Dot(TPixel color, float width)
+ where TPixel : struct, IPixel
+ => new Pen(color, width, DottedPattern);
///
/// Create a pen with a 'Dot' drawing patterns
///
/// The brush.
/// The width.
+ /// The type of the color.
/// The Pen
- public static Pen Dot(IBrush brush, float width) => new Pen(Pens.Dot(brush, width));
+ public static Pen Dot(IBrush brush, float width)
+ where TPixel : struct, IPixel
+ => new Pen(brush, width, DottedPattern);
///
/// Create a pen with a 'Dash Dot' drawing patterns
///
/// The color.
/// The width.
+ /// The type of the color.
/// The Pen
- public static Pen DashDot(Rgba32 color, float width) => new Pen(Pens.DashDot(color, width));
+ public static Pen DashDot(TPixel color, float width)
+ where TPixel : struct, IPixel
+ => new Pen(color, width, DashDotPattern);
///
/// Create a pen with a 'Dash Dot' drawing patterns
///
/// The brush.
/// The width.
+ /// The type of the color.
/// The Pen
- public static Pen DashDot(IBrush brush, float width) => new Pen(Pens.DashDot(brush, width));
+ public static Pen DashDot(IBrush brush, float width)
+ where TPixel : struct, IPixel
+ => new Pen(brush, width, DashDotPattern);
///
/// Create a pen with a 'Dash Dot Dot' drawing patterns
///
/// The color.
/// The width.
+ /// The type of the color.
/// The Pen
- public static Pen DashDotDot(Rgba32 color, float width) => new Pen(Pens.DashDotDot(color, width));
+ public static Pen DashDotDot(TPixel color, float width)
+ where TPixel : struct, IPixel
+ => new Pen(color, width, DashDotDotPattern);
///
/// Create a pen with a 'Dash Dot Dot' drawing patterns
///
/// The brush.
/// The width.
+ /// The type of the color.
/// The Pen
- public static Pen DashDotDot(IBrush brush, float width) => new Pen(Pens.DashDotDot(brush, width));
+ public static Pen DashDotDot(IBrush brush, float width)
+ where TPixel : struct, IPixel
+ => new Pen(brush, width, DashDotDotPattern);
}
}
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs b/src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs
deleted file mode 100644
index 5eb78dc44..000000000
--- a/src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-//
-// Copyright (c) James Jackson-South and contributors.
-// Licensed under the Apache License, Version 2.0.
-//
-
-namespace ImageSharp.Drawing.Pens
-{
- using ImageSharp.PixelFormats;
-
- ///
- /// Common Pen styles
- ///
- /// The type of the color.
- public class Pens
- where TPixel : struct, IPixel
- {
- private static readonly float[] DashDotPattern = new[] { 3f, 1f, 1f, 1f };
- private static readonly float[] DashDotDotPattern = new[] { 3f, 1f, 1f, 1f, 1f, 1f };
- private static readonly float[] DottedPattern = new[] { 1f, 1f };
- private static readonly float[] DashedPattern = new[] { 3f, 1f };
-
- ///
- /// Create a solid pen with out any drawing patterns
- ///
- /// The color.
- /// The width.
- /// The Pen
- public static Pen Solid(TPixel color, float width)
- => new Pen(color, width);
-
- ///
- /// Create a solid pen with out any drawing patterns
- ///
- /// The brush.
- /// The width.
- /// The Pen
- public static Pen Solid(IBrush brush, float width)
- => new Pen(brush, width);
-
- ///
- /// Create a pen with a 'Dash' drawing patterns
- ///
- /// The color.
- /// The width.
- /// The Pen
- public static Pen Dash(TPixel color, float width)
- => new Pen(color, width, DashedPattern);
-
- ///
- /// Create a pen with a 'Dash' drawing patterns
- ///
- /// The brush.
- /// The width.
- /// The Pen
- public static Pen Dash(IBrush brush, float width)
- => new Pen(brush, width, DashedPattern);
-
- ///
- /// Create a pen with a 'Dot' drawing patterns
- ///
- /// The color.
- /// The width.
- /// The Pen
- public static Pen Dot(TPixel color, float width)
- => new Pen(color, width, DottedPattern);
-
- ///
- /// Create a pen with a 'Dot' drawing patterns
- ///
- /// The brush.
- /// The width.
- /// The Pen
- public static Pen Dot(IBrush brush, float width)
- => new Pen(brush, width, DottedPattern);
-
- ///
- /// Create a pen with a 'Dash Dot' drawing patterns
- ///
- /// The color.
- /// The width.
- /// The Pen
- public static Pen DashDot(TPixel color, float width)
- => new Pen(color, width, DashDotPattern);
-
- ///
- /// Create a pen with a 'Dash Dot' drawing patterns
- ///
- /// The brush.
- /// The width.
- /// The Pen
- public static Pen DashDot(IBrush brush, float width)
- => new Pen(brush, width, DashDotPattern);
-
- ///
- /// Create a pen with a 'Dash Dot Dot' drawing patterns
- ///
- /// The color.
- /// The width.
- /// The Pen
- public static Pen DashDotDot(TPixel color, float width)
- => new Pen(color, width, DashDotDotPattern);
-
- ///
- /// Create a pen with a 'Dash Dot Dot' drawing patterns
- ///
- /// The brush.
- /// The width.
- /// The Pen
- public static Pen DashDotDot(IBrush brush, float width)
- => new Pen(brush, width, DashDotDotPattern);
- }
-}
\ No newline at end of file
diff --git a/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs b/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs
index c49631de8..ed45417fc 100644
--- a/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs
+++ b/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs
@@ -8,6 +8,8 @@ namespace ImageSharp.Drawing.Processors
using System;
using System.Numerics;
using System.Threading.Tasks;
+
+ using ImageSharp.Memory;
using ImageSharp.PixelFormats;
using ImageSharp.Processing;
@@ -97,8 +99,8 @@ namespace ImageSharp.Drawing.Processors
this.ParallelOptions,
y =>
{
- BufferSpan background = sourcePixels.GetRowSpan(y).Slice(minX, width);
- BufferSpan foreground = toBlendPixels.GetRowSpan(y - this.Location.Y).Slice(0, width);
+ Span background = sourcePixels.GetRowSpan(y).Slice(minX, width);
+ Span foreground = toBlendPixels.GetRowSpan(y - this.Location.Y).Slice(0, width);
this.blender.Blend(background, background, foreground, amount);
});
}
diff --git a/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs b/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs
index 3fd829549..d1332c435 100644
--- a/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs
+++ b/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs
@@ -8,6 +8,8 @@ namespace ImageSharp.Drawing.Processors
using System;
using System.Numerics;
using System.Threading.Tasks;
+
+ using ImageSharp.Memory;
using ImageSharp.PixelFormats;
using ImageSharp.Processing;
using Pens;
@@ -110,7 +112,7 @@ namespace ImageSharp.Drawing.Processors
colors[i] = color.Color;
}
- BufferSpan destination = sourcePixels.GetRowSpan(offsetY).Slice(minX - startX, width);
+ Span destination = sourcePixels.GetRowSpan(offsetY).Slice(minX - startX, width);
blender.Blend(destination, destination, colors, amount);
}
});
diff --git a/src/ImageSharp.Drawing/Processors/FillProcessor.cs b/src/ImageSharp.Drawing/Processors/FillProcessor.cs
index 25eccd245..fa6f48156 100644
--- a/src/ImageSharp.Drawing/Processors/FillProcessor.cs
+++ b/src/ImageSharp.Drawing/Processors/FillProcessor.cs
@@ -10,6 +10,8 @@ namespace ImageSharp.Drawing.Processors
using System.Threading.Tasks;
using Drawing;
+
+ using ImageSharp.Memory;
using ImageSharp.PixelFormats;
using ImageSharp.Processing;
diff --git a/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs b/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs
index 323214fb8..a57be3a5a 100644
--- a/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs
+++ b/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs
@@ -8,6 +8,8 @@ namespace ImageSharp.Drawing.Processors
using System;
using System.Buffers;
using Drawing;
+
+ using ImageSharp.Memory;
using ImageSharp.PixelFormats;
using ImageSharp.Processing;
diff --git a/src/ImageSharp.Drawing/Text/DrawText.cs b/src/ImageSharp.Drawing/Text/DrawText.cs
index 1e87fd008..bd33289fa 100644
--- a/src/ImageSharp.Drawing/Text/DrawText.cs
+++ b/src/ImageSharp.Drawing/Text/DrawText.cs
@@ -54,7 +54,7 @@ namespace ImageSharp
public static Image DrawText(this Image source, string text, Font font, TPixel color, Vector2 location, TextGraphicsOptions options)
where TPixel : struct, IPixel