Skip to content

Commit c343942

Browse files
Normalize stroke docs.
1 parent 1310439 commit c343942

7 files changed

Lines changed: 24 additions & 90 deletions

File tree

src/ImageSharp.Drawing/BooleanOperation.cs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,18 @@
33

44
namespace SixLabors.ImageSharp.Drawing;
55

6-
/// <summary>
7-
/// Specifies the type of boolean operation to perform on polygons.
8-
/// </summary>
6+
/// <inheritdoc cref="PolygonClipper.BooleanOperation" />
97
public enum BooleanOperation
108
{
11-
/// <summary>
12-
/// The intersection operation, which results in the area common to both polygons.
13-
/// </summary>
9+
/// <inheritdoc cref="PolygonClipper.BooleanOperation.Intersection" />
1410
Intersection = 0,
1511

16-
/// <summary>
17-
/// The union operation, which results in the combined area of both polygons.
18-
/// </summary>
12+
/// <inheritdoc cref="PolygonClipper.BooleanOperation.Union" />
1913
Union = 1,
2014

21-
/// <summary>
22-
/// The difference operation, which subtracts the clipping polygon from the subject polygon.
23-
/// </summary>
15+
/// <inheritdoc cref="PolygonClipper.BooleanOperation.Difference" />
2416
Difference = 2,
2517

26-
/// <summary>
27-
/// The exclusive OR (XOR) operation, which results in the area covered by exactly one polygon,
28-
/// excluding the overlapping areas.
29-
/// </summary>
18+
/// <inheritdoc cref="PolygonClipper.BooleanOperation.Xor" />
3019
Xor = 3
3120
}

src/ImageSharp.Drawing/LineCap.cs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,15 @@
33

44
namespace SixLabors.ImageSharp.Drawing;
55

6-
/// <summary>
7-
/// Specifies the shape to be used at the ends of open lines or paths when stroking.
8-
/// </summary>
6+
/// <inheritdoc cref="PolygonClipper.LineCap" />
97
public enum LineCap
108
{
11-
/// <summary>
12-
/// The stroke ends exactly at the endpoint.
13-
/// No extension is added beyond the path's end coordinates.
14-
/// </summary>
9+
/// <inheritdoc cref="PolygonClipper.LineCap.Butt" />
1510
Butt,
1611

17-
/// <summary>
18-
/// The stroke extends beyond the endpoint by half the line width,
19-
/// producing a square edge.
20-
/// </summary>
12+
/// <inheritdoc cref="PolygonClipper.LineCap.Square" />
2113
Square,
2214

23-
/// <summary>
24-
/// The stroke ends with a semicircular cap,
25-
/// extending beyond the endpoint by half the line width.
26-
/// </summary>
15+
/// <inheritdoc cref="PolygonClipper.LineCap.Round" />
2716
Round
2817
}

src/ImageSharp.Drawing/LineJoin.cs

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,21 @@
33

44
namespace SixLabors.ImageSharp.Drawing;
55

6-
/// <summary>
7-
/// Specifies how the connection between two consecutive line segments (a join)
8-
/// is rendered when stroking paths or polygons.
9-
/// </summary>
6+
/// <inheritdoc cref="PolygonClipper.LineJoin" />
107
public enum LineJoin
118
{
12-
/// <summary>
13-
/// Joins lines by extending their outer edges until they meet at a sharp corner.
14-
/// The miter length is limited by the miter limit; if exceeded, the join may fall back to a bevel.
15-
/// </summary>
9+
/// <inheritdoc cref="PolygonClipper.LineJoin.Miter" />
1610
Miter = 0,
1711

18-
/// <summary>
19-
/// Joins lines by extending their outer edges to form a miter,
20-
/// but if the miter length exceeds the miter limit, the join is truncated
21-
/// at the limit distance rather than falling back to a bevel.
22-
/// </summary>
12+
/// <inheritdoc cref="PolygonClipper.LineJoin.MiterRevert" />
2313
MiterRevert = 1,
2414

25-
/// <summary>
26-
/// Joins lines by connecting them with a circular arc centered at the join point,
27-
/// producing a smooth, rounded corner.
28-
/// </summary>
15+
/// <inheritdoc cref="PolygonClipper.LineJoin.Round" />
2916
Round = 2,
3017

31-
/// <summary>
32-
/// Joins lines by connecting the outer corners directly with a straight line,
33-
/// forming a flat edge at the join point.
34-
/// </summary>
18+
/// <inheritdoc cref="PolygonClipper.LineJoin.Bevel" />
3519
Bevel = 3,
3620

37-
/// <summary>
38-
/// Joins lines by forming a miter, but if the miter limit is exceeded,
39-
/// the join falls back to a round join instead of a bevel.
40-
/// </summary>
21+
/// <inheritdoc cref="PolygonClipper.LineJoin.MiterRound" />
4122
MiterRound = 4
4223
}

src/ImageSharp.Drawing/PolygonGeometry/StrokedShapeGenerator.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ private static PolygonClipper.StrokeOptions CreateStrokeOptions(StrokeOptions op
9898
LineCap.Round => PolygonClipper.LineCap.Round,
9999
LineCap.Square => PolygonClipper.LineCap.Square,
100100
_ => PolygonClipper.LineCap.Butt,
101-
},
102-
NormalizeOutput = options.NormalizeOutput
101+
}
103102
};
104103

105104
return o;

src/ImageSharp.Drawing/Processing/StrokeOptions.cs

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,21 @@
33

44
namespace SixLabors.ImageSharp.Drawing.Processing;
55

6-
/// <summary>
7-
/// Provides configuration options for geometric stroke generation.
8-
/// </summary>
6+
/// <inheritdoc cref="PolygonClipper.StrokeOptions" />
97
public sealed class StrokeOptions : IEquatable<StrokeOptions?>
108
{
11-
/// <summary>
12-
/// Gets or sets the miter limit used to clamp outer miter joins.
13-
/// </summary>
9+
/// <inheritdoc cref="PolygonClipper.StrokeOptions.MiterLimit" />
1410
public double MiterLimit { get; set; } = 4D;
1511

16-
/// <summary>
17-
/// Gets or sets the tessellation detail scale for round joins and round caps.
18-
/// Higher values produce more vertices (smoother curves, more work).
19-
/// Lower values produce fewer vertices.
20-
/// </summary>
12+
/// <inheritdoc cref="PolygonClipper.StrokeOptions.ArcDetailScale" />
2113
public double ArcDetailScale { get; set; } = 1D;
2214

23-
/// <summary>
24-
/// Gets or sets the outer line join style used for stroking corners.
25-
/// </summary>
15+
/// <inheritdoc cref="PolygonClipper.StrokeOptions.LineJoin" />
2616
public LineJoin LineJoin { get; set; } = LineJoin.Bevel;
2717

28-
/// <summary>
29-
/// Gets or sets the line cap style used for open path ends.
30-
/// </summary>
18+
/// <inheritdoc cref="PolygonClipper.StrokeOptions.LineCap" />
3119
public LineCap LineCap { get; set; } = LineCap.Butt;
3220

33-
/// <summary>
34-
/// Gets or sets a value indicating whether stroked contours should be normalized
35-
/// by resolving self-intersections and overlaps before returning.
36-
/// </summary>
37-
/// <remarks>
38-
/// Defaults to false for maximum throughput. When disabled, callers should rasterize
39-
/// with a non-zero winding fill rule.
40-
/// </remarks>
41-
public bool NormalizeOutput { get; set; }
42-
4321
/// <inheritdoc/>
4422
public override bool Equals(object? obj) => this.Equals(obj as StrokeOptions);
4523

@@ -49,15 +27,13 @@ public bool Equals(StrokeOptions? other)
4927
this.MiterLimit == other.MiterLimit &&
5028
this.ArcDetailScale == other.ArcDetailScale &&
5129
this.LineJoin == other.LineJoin &&
52-
this.LineCap == other.LineCap &&
53-
this.NormalizeOutput == other.NormalizeOutput;
30+
this.LineCap == other.LineCap;
5431

5532
/// <inheritdoc/>
5633
public override int GetHashCode()
5734
=> HashCode.Combine(
5835
this.MiterLimit,
5936
this.ArcDetailScale,
6037
this.LineJoin,
61-
this.LineCap,
62-
this.NormalizeOutput);
38+
this.LineCap);
6339
}

tests/ImageSharp.Drawing.Tests/Processing/DrawingCanvasTests.StrokeOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public partial class DrawingCanvasTests
1111
{
1212
[Theory]
1313
[WithBlankImage(360, 220, PixelTypes.Rgba32)]
14-
public void Draw_NormalizeOutputFalse_MatchesReference<TPixel>(TestImageProvider<TPixel> provider)
14+
public void Draw_SelfIntersectingStroke_MatchesReference<TPixel>(TestImageProvider<TPixel> provider)
1515
where TPixel : unmanaged, IPixel<TPixel>
1616
{
1717
using Image<TPixel> target = provider.GetImage();

tests/Images/ReferenceOutput/Drawing/DrawingCanvasTests/Draw_NormalizeOutputFalse_MatchesReference_Rgba32.png renamed to tests/Images/ReferenceOutput/Drawing/DrawingCanvasTests/Draw_SelfIntersectingStroke_MatchesReference_Rgba32.png

File renamed without changes.

0 commit comments

Comments
 (0)