|
| 1 | +// Copyright (c) Six Labors. |
| 2 | +// Licensed under the Apache License, Version 2.0. |
| 3 | + |
| 4 | +using SixLabors.ImageSharp.Drawing.Processing; |
| 5 | +using SixLabors.ImageSharp.PixelFormats; |
| 6 | +using SixLabors.ImageSharp.Processing; |
| 7 | +using Xunit; |
| 8 | + |
| 9 | +namespace SixLabors.ImageSharp.Drawing.Tests.Issues |
| 10 | +{ |
| 11 | + // https://github.com/SixLabors/ImageSharp.Drawing/issues/55 |
| 12 | + // https://github.com/SixLabors/ImageSharp.Drawing/issues/59 |
| 13 | + public class Issues_55_59 |
| 14 | + { |
| 15 | + [Fact] |
| 16 | + public void SimplifyOutOfRangeExceptionDrawLines() |
| 17 | + { |
| 18 | + PointF[] line = new[] |
| 19 | + { |
| 20 | + new PointF(1, 48), |
| 21 | + new PointF(5, 77), |
| 22 | + new PointF(35, 0), |
| 23 | + new PointF(33, 8), |
| 24 | + new PointF(11, 23) |
| 25 | + }; |
| 26 | + |
| 27 | + using var image = new Image<Rgba32>(100, 100); |
| 28 | + image.Mutate(imageContext => imageContext.DrawLines(new Rgba32(255, 0, 0), 1, line)); |
| 29 | + } |
| 30 | + |
| 31 | + [Fact] |
| 32 | + public void SimplifyOutOfRangeExceptionDraw() |
| 33 | + { |
| 34 | + var path = new Path( |
| 35 | + new LinearLineSegment(new PointF(592.0153f, 1156.238f), new PointF(592.4992f, 1157.138f)), |
| 36 | + new LinearLineSegment(new PointF(592.4992f, 1157.138f), new PointF(593.3998f, 1156.654f)), |
| 37 | + new LinearLineSegment(new PointF(593.3998f, 1156.654f), new PointF(592.916f, 1155.754f)), |
| 38 | + new LinearLineSegment(new PointF(592.916f, 1155.754f), new PointF(592.0153f, 1156.238f)) |
| 39 | + ); |
| 40 | + |
| 41 | + using var image = new Image<Rgba32>(2000, 2000); |
| 42 | + image.Mutate(imageContext => imageContext.Draw(new Rgba32(255, 0, 0), 1, path)); |
| 43 | + } |
| 44 | + } |
| 45 | +} |
0 commit comments