|
12 | 12 | using SixLabors.Primitives; |
13 | 13 | using Xunit; |
14 | 14 | using SixLabors.ImageSharp.Processing.Processors.Drawing; |
| 15 | +using SixLabors.Shapes; |
15 | 16 |
|
16 | 17 | namespace SixLabors.ImageSharp.Tests.Drawing |
17 | 18 | { |
@@ -68,6 +69,50 @@ public void DrawOffCanvas() |
68 | 69 | } |
69 | 70 | } |
70 | 71 |
|
| 72 | + [Fact] |
| 73 | + public void DoesNotThrowForIssue928() |
| 74 | + { |
| 75 | + var rectText = new RectangleF(0, 0, 2000, 2000); |
| 76 | + using (Image<Rgba32> img = new Image<Rgba32>((int)rectText.Width, (int)rectText.Height)) |
| 77 | + { |
| 78 | + img.Mutate(x => x.Fill(Rgba32.Transparent)); |
| 79 | + |
| 80 | + img.Mutate(ctx => { |
| 81 | + ctx.DrawLines( |
| 82 | + Rgba32.Red, |
| 83 | + 0.984252f, |
| 84 | + new PointF(104.762581f, 1074.99365f), |
| 85 | + new PointF(104.758667f, 1075.01721f), |
| 86 | + new PointF(104.757675f, 1075.04114f), |
| 87 | + new PointF(104.759628f, 1075.065f), |
| 88 | + new PointF(104.764488f, 1075.08838f), |
| 89 | + new PointF(104.772186f, 1075.111f), |
| 90 | + new PointF(104.782608f, 1075.13245f), |
| 91 | + new PointF(104.782608f, 1075.13245f) |
| 92 | + ); |
| 93 | + } |
| 94 | + ); |
| 95 | + } |
| 96 | + } |
| 97 | + |
| 98 | + [Fact] |
| 99 | + public void DoesNotThrowFillingTriangle() |
| 100 | + { |
| 101 | + using(var image = new Image<Rgba32>(28, 28)) |
| 102 | + { |
| 103 | + var path = new Polygon( |
| 104 | + new LinearLineSegment(new PointF(17.11f, 13.99659f), new PointF(14.01433f, 27.06201f)), |
| 105 | + new LinearLineSegment(new PointF(14.01433f, 27.06201f), new PointF(13.79267f, 14.00023f)), |
| 106 | + new LinearLineSegment(new PointF(13.79267f, 14.00023f), new PointF(17.11f, 13.99659f)) |
| 107 | + ); |
| 108 | + |
| 109 | + image.Mutate(ctx => |
| 110 | + { |
| 111 | + ctx.Fill(Rgba32.White, path); |
| 112 | + }); |
| 113 | + } |
| 114 | + } |
| 115 | + |
71 | 116 | // Mocking the region throws an error in netcore2.0 |
72 | 117 | private class MockRegion1 : Region |
73 | 118 | { |
|
0 commit comments