Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@
https://www.myget.org/F/sixlabors/api/v3/index.json;
https://api.nuget.org/v3/index.json;
</RestoreSources>
<SixLaborsPublicKey>002400000c8000009400000006020000002400005253413100040000010001000147e6fe6766715eec6cfed61f1e7dcdbf69748a3e355c67e9d8dfd953acab1d5e012ba34b23308166fdc61ee1d0390d5f36d814a6091dd4b5ed9eda5a26afced924c683b4bfb4b3d64b0586a57eff9f02b1f84e3cb0ddd518bd1697f2c84dcbb97eb8bb5c7801be12112ed0ec86db934b0e9a5171e6bb1384b6d2f7d54dfa97</SixLaborsPublicKey>
<SixLaborsPublicKey>00240000048000009400000006020000002400005253413100040000010001000147e6fe6766715eec6cfed61f1e7dcdbf69748a3e355c67e9d8dfd953acab1d5e012ba34b23308166fdc61ee1d0390d5f36d814a6091dd4b5ed9eda5a26afced924c683b4bfb4b3d64b0586a57eff9f02b1f84e3cb0ddd518bd1697f2c84dcbb97eb8bb5c7801be12112ed0ec86db934b0e9a5171e6bb1384b6d2f7d54dfa97</SixLaborsPublicKey>
<UseSharedCompilation>true</UseSharedCompilation>
<SignAssembly>true</SignAssembly>
</PropertyGroup>

<!-- Package references and additional files which are consumed by all projects -->
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<PackageReference Update="StyleCop.Analyzers" PrivateAssets="All" Version="1.1.118" />

<!--Src Dependencies-->
<PackageReference Update="SixLabors.Fonts" Version="1.0.0-unstable0024" />
<PackageReference Update="SixLabors.ImageSharp" Version="1.0.0-unstable0702" />
<PackageReference Update="SixLabors.Fonts" Version="1.0.0-unstable0032" />
<PackageReference Update="SixLabors.ImageSharp" Version="1.0.0-unstable0965" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions ImageSharp.Drawing.sln
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedInfrastructure", "sha
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{2e33181e-6e28-4662-a801-e2e7dc206029}*SharedItemsImports = 5
shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{68a8cc40-6aed-4e96-b524-31b1158fdeea}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
7 changes: 4 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
<ItemGroup>
<!--TODO: Delete this once tests Stylecop issues are fixed-->
<PackageReference Include="StyleCop.Analyzers" IsImplicitlyDefined="true" />


<!-- DynamicProxyGenAssembly2 is needed so Moq can use our internals -->
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" PublicKey="0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2, PublicKeyToken=null" />
<InternalsVisibleTo Include="ImageSharp.Drawing.Benchmarks" />
<InternalsVisibleTo Include="SixLabors.ImageSharp.Tests" PublicKey="$(SixLaborsPublicKey)" />
<InternalsVisibleTo Include="ImageSharp.Drawing.Benchmarks" PublicKey="$(SixLaborsPublicKey)" />
</ItemGroup>

</Project>
4 changes: 0 additions & 4 deletions src/ImageSharp.Drawing/ImageSharp.Drawing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
<PackageReference Include="SixLabors.ImageSharp" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="SixLabors.ImageSharp.Tests" />
</ItemGroup>

<Import Project="..\..\shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems" Label="Shared" />

</Project>
2 changes: 1 addition & 1 deletion src/ImageSharp.Drawing/Processing/BrushApplicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace SixLabors.ImageSharp.Processing
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <seealso cref="IDisposable" />
public abstract class BrushApplicator<TPixel> : IDisposable
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
/// <summary>
/// Initializes a new instance of the <see cref="BrushApplicator{TPixel}"/> class.
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp.Drawing/Processing/DrawingHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal static class DrawingHelpers
/// Convert a <see cref="DenseMatrix{Color}"/> to a <see cref="DenseMatrix{T}"/> of the given pixel type.
/// </summary>
public static DenseMatrix<TPixel> ToPixelMatrix<TPixel>(this DenseMatrix<Color> colorMatrix, Configuration configuration)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
var result = new DenseMatrix<TPixel>(colorMatrix.Columns, colorMatrix.Rows);
Color.ToPixel(configuration, colorMatrix.Span, result.Span);
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp.Drawing/Processing/EllipticGradientBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public override BrushApplicator<TPixel> CreateApplicator<TPixel>(

/// <inheritdoc />
private sealed class RadialGradientBrushApplicator<TPixel> : GradientBrushApplicator<TPixel>
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
private readonly PointF center;

Expand Down
4 changes: 2 additions & 2 deletions src/ImageSharp.Drawing/Processing/GradientBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ public abstract BrushApplicator<TPixel> CreateApplicator<TPixel>(
GraphicsOptions options,
ImageFrame<TPixel> source,
RectangleF region)
where TPixel : struct, IPixel<TPixel>;
where TPixel : unmanaged, IPixel<TPixel>;

/// <summary>
/// Base class for gradient brush applicators
/// </summary>
internal abstract class GradientBrushApplicator<TPixel> : BrushApplicator<TPixel>
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
private static readonly TPixel Transparent = Color.Transparent.ToPixel<TPixel>();

Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp.Drawing/Processing/IBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ BrushApplicator<TPixel> CreateApplicator<TPixel>(
GraphicsOptions options,
ImageFrame<TPixel> source,
RectangleF region)
where TPixel : struct, IPixel<TPixel>;
where TPixel : unmanaged, IPixel<TPixel>;
}
}
4 changes: 2 additions & 2 deletions src/ImageSharp.Drawing/Processing/ImageBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public BrushApplicator<TPixel> CreateApplicator<TPixel>(
GraphicsOptions options,
ImageFrame<TPixel> source,
RectangleF region)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
if (this.image is Image<TPixel> specificImage)
{
Expand All @@ -51,7 +51,7 @@ public BrushApplicator<TPixel> CreateApplicator<TPixel>(
/// The image brush applicator.
/// </summary>
private class ImageBrushApplicator<TPixel> : BrushApplicator<TPixel>
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
private ImageFrame<TPixel> sourceFrame;

Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp.Drawing/Processing/LinearGradientBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public override BrushApplicator<TPixel> CreateApplicator<TPixel>(
/// The linear gradient brush applicator.
/// </summary>
private sealed class LinearGradientBrushApplicator<TPixel> : GradientBrushApplicator<TPixel>
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
private readonly PointF start;

Expand Down
4 changes: 2 additions & 2 deletions src/ImageSharp.Drawing/Processing/PathGradientBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public BrushApplicator<TPixel> CreateApplicator<TPixel>(
GraphicsOptions options,
ImageFrame<TPixel> source,
RectangleF region)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
return new PathGradientBrushApplicator<TPixel>(configuration, options, source, this.edges, this.centerColor);
}
Expand Down Expand Up @@ -203,7 +203,7 @@ public Vector4 ColorAt(float distance)
/// The path gradient brush applicator.
/// </summary>
private class PathGradientBrushApplicator<TPixel> : BrushApplicator<TPixel>
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
private readonly PointF center;

Expand Down
4 changes: 2 additions & 2 deletions src/ImageSharp.Drawing/Processing/PatternBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public BrushApplicator<TPixel> CreateApplicator<TPixel>(
GraphicsOptions options,
ImageFrame<TPixel> source,
RectangleF region)
where TPixel : struct, IPixel<TPixel> =>
where TPixel : unmanaged, IPixel<TPixel> =>
new PatternBrushApplicator<TPixel>(
configuration,
options,
Expand All @@ -104,7 +104,7 @@ public BrushApplicator<TPixel> CreateApplicator<TPixel>(
/// The pattern brush applicator.
/// </summary>
private class PatternBrushApplicator<TPixel> : BrushApplicator<TPixel>
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
/// <summary>
/// The pattern.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public FillProcessor(GraphicsOptions options, IBrush brush)

/// <inheritdoc />
public IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>(Configuration configuration, Image<TPixel> source, Rectangle sourceRectangle)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
=> new FillProcessor<TPixel>(configuration, this, source, sourceRectangle);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Drawing
/// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
internal class FillProcessor<TPixel> : ImageProcessor<TPixel>
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
private readonly FillProcessor definition;

Expand All @@ -42,7 +42,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
TPixel colorPixel = solidBrush.Color.ToPixel<TPixel>();

var solidOperation = new SolidBrushRowIntervalOperation(interest, source, colorPixel);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
interest,
parallelSettings,
in solidOperation);
Expand All @@ -60,7 +60,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
amount.Memory.Span.Fill(1F);

var operation = new RowIntervalOperation(interest, applicator, amount.Memory);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
interest,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public FillRegionProcessor(ShapeGraphicsOptions options, IBrush brush, Region re

/// <inheritdoc />
public IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>(Configuration configuration, Image<TPixel> source, Rectangle sourceRectangle)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
=> new FillRegionProcessor<TPixel>(configuration, this, source, sourceRectangle);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Drawing
/// <typeparam name="TPixel">The type of the color.</typeparam>
/// <seealso cref="ImageProcessor{TPixel}" />
internal class FillRegionProcessor<TPixel> : ImageProcessor<TPixel>
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
private readonly FillRegionProcessor definition;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public DrawTextProcessor(TextGraphicsOptions options, string text, Font font, IB

/// <inheritdoc />
public IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>(Configuration configuration, Image<TPixel> source, Rectangle sourceRectangle)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
=> new DrawTextProcessor<TPixel>(configuration, this, source, sourceRectangle);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Text
/// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
internal class DrawTextProcessor<TPixel> : ImageProcessor<TPixel>
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
private CachingGlyphRenderer textRenderer;

Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp.Drawing/Processing/RadialGradientBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public override BrushApplicator<TPixel> CreateApplicator<TPixel>(

/// <inheritdoc />
private sealed class RadialGradientBrushApplicator<TPixel> : GradientBrushApplicator<TPixel>
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
private readonly PointF center;

Expand Down
4 changes: 2 additions & 2 deletions src/ImageSharp.Drawing/Processing/RecolorBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public BrushApplicator<TPixel> CreateApplicator<TPixel>(
GraphicsOptions options,
ImageFrame<TPixel> source,
RectangleF region)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
return new RecolorBrushApplicator<TPixel>(
configuration,
Expand All @@ -64,7 +64,7 @@ public BrushApplicator<TPixel> CreateApplicator<TPixel>(
/// The recolor brush applicator.
/// </summary>
private class RecolorBrushApplicator<TPixel> : BrushApplicator<TPixel>
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
/// <summary>
/// The source color.
Expand Down
4 changes: 2 additions & 2 deletions src/ImageSharp.Drawing/Processing/SolidBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public BrushApplicator<TPixel> CreateApplicator<TPixel>(
GraphicsOptions options,
ImageFrame<TPixel> source,
RectangleF region)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
return new SolidBrushApplicator<TPixel>(configuration, options, source, this.Color.ToPixel<TPixel>());
}
Expand All @@ -44,7 +44,7 @@ public BrushApplicator<TPixel> CreateApplicator<TPixel>(
/// The solid brush applicator.
/// </summary>
private class SolidBrushApplicator<TPixel> : BrushApplicator<TPixel>
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
private bool isDisposed;

Expand Down
1 change: 0 additions & 1 deletion tests/ImageSharp.Drawing.Tests/ConfigurationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Moq;
using SixLabors.ImageSharp.Formats.Bmp;
using SixLabors.ImageSharp.IO;

using Xunit;
// ReSharper disable InconsistentNaming

Expand Down
2 changes: 1 addition & 1 deletion tests/ImageSharp.Drawing.Tests/Drawing/DrawBezierTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static readonly TheoryData<string, byte, float> DrawPathData
[Theory]
[WithSolidFilledImages(nameof(DrawPathData), 300, 450, "Blue", PixelTypes.Rgba32)]
public void DrawBeziers<TPixel>(TestImageProvider<TPixel> provider, string colorName, byte alpha, float thickness)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
var points = new PointF[]
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors.
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.

using System.Numerics;
Expand All @@ -19,7 +19,7 @@ public class DrawComplexPolygonTests
[WithBasicTestPatternImages(250, 350, PixelTypes.Rgba32, false, true, false)]
[WithBasicTestPatternImages(250, 350, PixelTypes.Rgba32, false, false, true)]
public void DrawComplexPolygon<TPixel>(TestImageProvider<TPixel> provider, bool overlap, bool transparent, bool dashed)
where TPixel :struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
var simplePath = new Polygon(new LinearLineSegment(
new Vector2(10, 10),
Expand Down
16 changes: 8 additions & 8 deletions tests/ImageSharp.Drawing.Tests/Drawing/DrawLinesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ public class DrawLinesTests
[WithBasicTestPatternImages(250, 350, PixelTypes.Rgba32, "White", 1f, 5, false)]
[WithBasicTestPatternImages(250, 350, PixelTypes.Bgr24, "Yellow", 1f, 10, true)]
public void DrawLines_Simple<TPixel>(TestImageProvider<TPixel> provider, string colorName, float alpha, float thickness, bool antialias)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
Color color = TestUtils.GetColorByName(colorName).WithAlpha(alpha);
Pen pen = new Pen(color, thickness);
var pen = new Pen(color, thickness);

DrawLinesImpl(provider, colorName, alpha, thickness, antialias, pen);
}

[Theory]
[WithBasicTestPatternImages(250, 350, PixelTypes.Rgba32, "White", 1f, 5, false)]
public void DrawLines_Dash<TPixel>(TestImageProvider<TPixel> provider, string colorName, float alpha, float thickness, bool antialias)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
Color color = TestUtils.GetColorByName(colorName).WithAlpha(alpha);
Pen pen = Pens.Dash(color, thickness);
Expand All @@ -42,7 +42,7 @@ public void DrawLines_Dash<TPixel>(TestImageProvider<TPixel> provider, string co
[Theory]
[WithBasicTestPatternImages(250, 350, PixelTypes.Rgba32, "LightGreen", 1f, 5, false)]
public void DrawLines_Dot<TPixel>(TestImageProvider<TPixel> provider, string colorName, float alpha, float thickness, bool antialias)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
Color color = TestUtils.GetColorByName(colorName).WithAlpha(alpha);
Pen pen = Pens.Dot(color, thickness);
Expand All @@ -53,7 +53,7 @@ public void DrawLines_Dot<TPixel>(TestImageProvider<TPixel> provider, string col
[Theory]
[WithBasicTestPatternImages(250, 350, PixelTypes.Rgba32, "Yellow", 1f, 5, false)]
public void DrawLines_DashDot<TPixel>(TestImageProvider<TPixel> provider, string colorName, float alpha, float thickness, bool antialias)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
Color color = TestUtils.GetColorByName(colorName).WithAlpha(alpha);
Pen pen = Pens.DashDot(color, thickness);
Expand All @@ -64,7 +64,7 @@ public void DrawLines_DashDot<TPixel>(TestImageProvider<TPixel> provider, string
[Theory]
[WithBasicTestPatternImages(250, 350, PixelTypes.Rgba32, "Black", 1f, 5, false)]
public void DrawLines_DashDotDot<TPixel>(TestImageProvider<TPixel> provider, string colorName, float alpha, float thickness, bool antialias)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
Color color = TestUtils.GetColorByName(colorName).WithAlpha(alpha);
Pen pen = Pens.DashDotDot(color, thickness);
Expand All @@ -80,11 +80,11 @@ private static void DrawLinesImpl<TPixel>(
float thickness,
bool antialias,
Pen pen)
where TPixel : struct, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel>
{
PointF[] simplePath = { new Vector2(10, 10), new Vector2(200, 150), new Vector2(50, 300) };

GraphicsOptions options = new GraphicsOptions { Antialias = antialias };
var options = new GraphicsOptions { Antialias = antialias };

string aa = antialias ? "" : "_NoAntialias";
FormattableString outputDetails = $"{colorName}_A({alpha})_T({thickness}){aa}";
Expand Down
Loading