-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #324 from SixLabors/issue323
Mitigate issue where outline thicknesses less than 0.5 fail out generate solid shapes not outlines
- Loading branch information
Showing
12 changed files
with
119 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Six Labors Split License. | ||
|
||
using SixLabors.ImageSharp.Drawing.Processing; | ||
using SixLabors.ImageSharp.PixelFormats; | ||
|
||
namespace SixLabors.ImageSharp.Drawing.Tests.Issues; | ||
|
||
public class Issue_323 | ||
{ | ||
[Theory] | ||
[WithSolidFilledImages(300, 300, "White", PixelTypes.Rgba32, 3f)] | ||
[WithSolidFilledImages(300, 300, "White", PixelTypes.Rgba32, 1f)] | ||
[WithSolidFilledImages(300, 300, "White", PixelTypes.Rgba32, 0.3f)] | ||
[WithSolidFilledImages(300, 300, "White", PixelTypes.Rgba32, 0.7f)] | ||
[WithSolidFilledImages(300, 300, "White", PixelTypes.Rgba32, 0.003f)] | ||
public void DrawPolygonMustDrawoutlineOnly<TPixel>(TestImageProvider<TPixel> provider, float scale) | ||
where TPixel : unmanaged, IPixel<TPixel> | ||
{ | ||
Color color = Color.RebeccaPurple; | ||
provider.RunValidatingProcessorTest( | ||
x => x.DrawPolygon( | ||
color, | ||
scale, | ||
new PointF[] { | ||
new(5, 5), | ||
new(5, 150), | ||
new(190, 150), | ||
}), | ||
new { scale }); | ||
} | ||
|
||
[Theory] | ||
[WithSolidFilledImages(300, 300, "White", PixelTypes.Rgba32, 3f)] | ||
[WithSolidFilledImages(300, 300, "White", PixelTypes.Rgba32, 1f)] | ||
[WithSolidFilledImages(300, 300, "White", PixelTypes.Rgba32, 0.3f)] | ||
[WithSolidFilledImages(300, 300, "White", PixelTypes.Rgba32, 0.7f)] | ||
[WithSolidFilledImages(300, 300, "White", PixelTypes.Rgba32, 0.003f)] | ||
public void DrawPolygonMustDrawoutlineOnly_Pattern<TPixel>(TestImageProvider<TPixel> provider, float scale) | ||
where TPixel : unmanaged, IPixel<TPixel> | ||
{ | ||
Color color = Color.RebeccaPurple; | ||
var pen = Pens.DashDot(color, scale); | ||
provider.RunValidatingProcessorTest( | ||
x => x.DrawPolygon( | ||
pen, | ||
new PointF[] { | ||
new(5, 5), | ||
new(5, 150), | ||
new(190, 150), | ||
}), | ||
new { scale }); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...stDrawoutlineOnly_Pattern_Rgba32_Solid300x300_(255,255,255,255)_scale-0.003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...MustDrawoutlineOnly_Pattern_Rgba32_Solid300x300_(255,255,255,255)_scale-0.3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...MustDrawoutlineOnly_Pattern_Rgba32_Solid300x300_(255,255,255,255)_scale-0.7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...onMustDrawoutlineOnly_Pattern_Rgba32_Solid300x300_(255,255,255,255)_scale-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...onMustDrawoutlineOnly_Pattern_Rgba32_Solid300x300_(255,255,255,255)_scale-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...olygonMustDrawoutlineOnly_Rgba32_Solid300x300_(255,255,255,255)_scale-0.003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...wPolygonMustDrawoutlineOnly_Rgba32_Solid300x300_(255,255,255,255)_scale-0.3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...wPolygonMustDrawoutlineOnly_Rgba32_Solid300x300_(255,255,255,255)_scale-0.7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...rawPolygonMustDrawoutlineOnly_Rgba32_Solid300x300_(255,255,255,255)_scale-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...rawPolygonMustDrawoutlineOnly_Rgba32_Solid300x300_(255,255,255,255)_scale-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.