Skip to content

Commit 5c89bf0

Browse files
authored
Merge pull request #39 from SixLabors/sw/emoji-support
Update Dependencies and add support for emoji font rendering
2 parents bbb764e + 655d629 commit 5c89bf0

719 files changed

Lines changed: 2469 additions & 935 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ artifacts/
220220

221221
# Tests
222222
**/Images/ActualOutput
223-
**/Images/ReferenceOutput
224223

225224
# sample output
226225
/samples/DrawShapesWithImageSharp/Output/**

.gitmodules

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
[submodule "shared-infrastructure"]
22
path = shared-infrastructure
3-
url = https://github.com/SixLabors/SharedInfrastructure
4-
[submodule "tests/Images/External"]
5-
path = tests/Images/External
6-
url = https://github.com/SixLabors/Imagesharp.Tests.Images.git
7-
branch = master
3+
url = https://github.com/SixLabors/SharedInfrastructure

Directory.Build.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
<PackageReference Update="StyleCop.Analyzers" PrivateAssets="All" Version="1.1.118" />
2424

2525
<!--Src Dependencies-->
26-
<PackageReference Update="SixLabors.Fonts" Version="1.0.0-unstable0032" />
27-
<PackageReference Update="SixLabors.ImageSharp" Version="1.0.0-unstable0965" />
26+
<PackageReference Update="SixLabors.Fonts" Version="1.0.0-unstable0056" />
27+
<PackageReference Update="SixLabors.ImageSharp" Version="1.0.0-rc0001" />
2828
</ItemGroup>
2929

3030
</Project>

src/ImageSharp.Drawing/Common/Extensions/GraphicsOptionsExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the Apache License, Version 2.0.
33

44
using System.Numerics;
5+
using SixLabors.ImageSharp.Drawing.Processing;
56
using SixLabors.ImageSharp.PixelFormats;
67

78
namespace SixLabors.ImageSharp.Drawing

src/ImageSharp.Drawing/Primitives/ShapeRegion.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ internal class ShapeRegion : Region
1717
/// <param name="shape">The shape.</param>
1818
public ShapeRegion(IPath shape)
1919
{
20-
this.Shape = shape.AsClosedPath();
20+
IPath closedPath = shape.AsClosedPath();
21+
this.MaxIntersections = closedPath.MaxIntersections;
22+
this.Shape = closedPath;
2123
int left = (int)MathF.Floor(shape.Bounds.Left);
2224
int top = (int)MathF.Floor(shape.Bounds.Top);
2325

@@ -32,7 +34,7 @@ public ShapeRegion(IPath shape)
3234
public IPath Shape { get; }
3335

3436
/// <inheritdoc/>
35-
public override int MaxIntersections => this.Shape.MaxIntersections;
37+
public override int MaxIntersections { get; }
3638

3739
/// <inheritdoc/>
3840
public override Rectangle Bounds { get; }

src/ImageSharp.Drawing/Processing/BrushApplicator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected virtual void Dispose(bool disposing)
8181
/// <param name="x">The x-position in the target pixel space that the start of the scanline data corresponds to.</param>
8282
/// <param name="y">The y-position in the target pixel space that whole scanline corresponds to.</param>
8383
/// <remarks>scanlineBuffer will be > scanlineWidth but provide and offset in case we want to share a larger buffer across runs.</remarks>
84-
internal virtual void Apply(Span<float> scanline, int x, int y)
84+
public virtual void Apply(Span<float> scanline, int x, int y)
8585
{
8686
MemoryAllocator memoryAllocator = this.Configuration.MemoryAllocator;
8787

src/ImageSharp.Drawing/Processing/Extensions/DrawBezierExtensions.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,34 @@ namespace SixLabors.ImageSharp.Drawing.Processing
1010
/// </summary>
1111
public static class DrawBezierExtensions
1212
{
13+
/// <summary>
14+
/// Draws the provided points as an open Bezier path with the supplied pen
15+
/// </summary>
16+
/// <param name="source">The image this method extends.</param>
17+
/// <param name="options">The options.</param>
18+
/// <param name="pen">The pen.</param>
19+
/// <param name="points">The points.</param>
20+
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
21+
public static IImageProcessingContext DrawBeziers(
22+
this IImageProcessingContext source,
23+
ShapeGraphicsOptions options,
24+
IPen pen,
25+
params PointF[] points) =>
26+
source.Draw(options, pen, new Path(new CubicBezierLineSegment(points)));
27+
28+
/// <summary>
29+
/// Draws the provided points as an open Bezier path with the supplied pen
30+
/// </summary>
31+
/// <param name="source">The image this method extends.</param>
32+
/// <param name="pen">The pen.</param>
33+
/// <param name="points">The points.</param>
34+
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
35+
public static IImageProcessingContext DrawBeziers(
36+
this IImageProcessingContext source,
37+
IPen pen,
38+
params PointF[] points) =>
39+
source.Draw(pen, new Path(new CubicBezierLineSegment(points)));
40+
1341
/// <summary>
1442
/// Draws the provided points as an open Bezier path at the provided thickness with the supplied brush
1543
/// </summary>
@@ -73,33 +101,5 @@ public static IImageProcessingContext DrawBeziers(
73101
float thickness,
74102
params PointF[] points) =>
75103
source.DrawBeziers(options, new SolidBrush(color), thickness, points);
76-
77-
/// <summary>
78-
/// Draws the provided points as an open Bezier path with the supplied pen
79-
/// </summary>
80-
/// <param name="source">The image this method extends.</param>
81-
/// <param name="options">The options.</param>
82-
/// <param name="pen">The pen.</param>
83-
/// <param name="points">The points.</param>
84-
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
85-
public static IImageProcessingContext DrawBeziers(
86-
this IImageProcessingContext source,
87-
ShapeGraphicsOptions options,
88-
IPen pen,
89-
params PointF[] points) =>
90-
source.Draw(options, pen, new Path(new CubicBezierLineSegment(points)));
91-
92-
/// <summary>
93-
/// Draws the provided points as an open Bezier path with the supplied pen
94-
/// </summary>
95-
/// <param name="source">The image this method extends.</param>
96-
/// <param name="pen">The pen.</param>
97-
/// <param name="points">The points.</param>
98-
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
99-
public static IImageProcessingContext DrawBeziers(
100-
this IImageProcessingContext source,
101-
IPen pen,
102-
params PointF[] points) =>
103-
source.Draw(pen, new Path(new CubicBezierLineSegment(points)));
104104
}
105105
}

src/ImageSharp.Drawing/Processing/Extensions/DrawPathCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static IImageProcessingContext Draw(
4141
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
4242
public static IImageProcessingContext
4343
Draw(this IImageProcessingContext source, IPen pen, IPathCollection paths) =>
44-
source.Draw(new ShapeGraphicsOptions(), pen, paths);
44+
source.Draw(source.GetShapeGraphicsOptions(), pen, paths);
4545

4646
/// <summary>
4747
/// Draws the outline of the polygon with the provided brush at the provided thickness.

src/ImageSharp.Drawing/Processing/Extensions/DrawPathExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Six Labors and contributors.
22
// Licensed under the Apache License, Version 2.0.
33

4+
using SixLabors.ImageSharp.Drawing.Processing.Processors.Drawing;
45
using SixLabors.ImageSharp.Processing;
56

67
namespace SixLabors.ImageSharp.Drawing.Processing
@@ -23,7 +24,7 @@ public static IImageProcessingContext Draw(
2324
ShapeGraphicsOptions options,
2425
IPen pen,
2526
IPath path) =>
26-
source.Fill(options, pen.StrokeFill, new ShapePath(path, pen));
27+
source.ApplyProcessor(new DrawPathProcessor(options, pen, path));
2728

2829
/// <summary>
2930
/// Draws the outline of the polygon with the provided pen.
@@ -33,7 +34,7 @@ public static IImageProcessingContext Draw(
3334
/// <param name="path">The path.</param>
3435
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
3536
public static IImageProcessingContext Draw(this IImageProcessingContext source, IPen pen, IPath path) =>
36-
source.Draw(new ShapeGraphicsOptions(), pen, path);
37+
source.Draw(source.GetShapeGraphicsOptions(), pen, path);
3738

3839
/// <summary>
3940
/// Draws the outline of the polygon with the provided brush at the provided thickness.

src/ImageSharp.Drawing/Processing/Extensions/DrawPolygonExtensions.cs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,95 +11,95 @@ namespace SixLabors.ImageSharp.Drawing.Processing
1111
public static class DrawPolygonExtensions
1212
{
1313
/// <summary>
14-
/// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
14+
/// Draws the provided Points as a closed Linear Polygon with the provided Pen.
1515
/// </summary>
1616
/// <param name="source">The image this method extends.</param>
17-
/// <param name="options">The options.</param>
18-
/// <param name="brush">The brush.</param>
19-
/// <param name="thickness">The thickness.</param>
17+
/// <param name="pen">The pen.</param>
2018
/// <param name="points">The points.</param>
2119
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
2220
public static IImageProcessingContext DrawPolygon(
2321
this IImageProcessingContext source,
24-
ShapeGraphicsOptions options,
25-
IBrush brush,
26-
float thickness,
22+
IPen pen,
2723
params PointF[] points) =>
28-
source.Draw(options, new Pen(brush, thickness), new Polygon(new LinearLineSegment(points)));
24+
source.Draw(source.GetShapeGraphicsOptions(), pen, new Polygon(new LinearLineSegment(points)));
2925

3026
/// <summary>
31-
/// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
27+
/// Draws the provided Points as a closed Linear Polygon with the provided Pen.
3228
/// </summary>
3329
/// <param name="source">The image this method extends.</param>
34-
/// <param name="brush">The brush.</param>
35-
/// <param name="thickness">The thickness.</param>
30+
/// <param name="options">The options.</param>
31+
/// <param name="pen">The pen.</param>
3632
/// <param name="points">The points.</param>
3733
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
3834
public static IImageProcessingContext DrawPolygon(
3935
this IImageProcessingContext source,
40-
IBrush brush,
41-
float thickness,
36+
ShapeGraphicsOptions options,
37+
IPen pen,
4238
params PointF[] points) =>
43-
source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points)));
39+
source.Draw(options, pen, new Polygon(new LinearLineSegment(points)));
4440

4541
/// <summary>
4642
/// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
4743
/// </summary>
4844
/// <param name="source">The image this method extends.</param>
49-
/// <param name="color">The color.</param>
45+
/// <param name="options">The options.</param>
46+
/// <param name="brush">The brush.</param>
5047
/// <param name="thickness">The thickness.</param>
5148
/// <param name="points">The points.</param>
5249
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
5350
public static IImageProcessingContext DrawPolygon(
5451
this IImageProcessingContext source,
55-
Color color,
52+
ShapeGraphicsOptions options,
53+
IBrush brush,
5654
float thickness,
5755
params PointF[] points) =>
58-
source.DrawPolygon(new SolidBrush(color), thickness, points);
56+
source.DrawPolygon(options, new Pen(brush, thickness), points);
5957

6058
/// <summary>
6159
/// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
6260
/// </summary>
6361
/// <param name="source">The image this method extends.</param>
64-
/// <param name="options">The options.</param>
65-
/// <param name="color">The color.</param>
62+
/// <param name="brush">The brush.</param>
6663
/// <param name="thickness">The thickness.</param>
6764
/// <param name="points">The points.</param>
6865
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
6966
public static IImageProcessingContext DrawPolygon(
7067
this IImageProcessingContext source,
71-
ShapeGraphicsOptions options,
72-
Color color,
68+
IBrush brush,
7369
float thickness,
7470
params PointF[] points) =>
75-
source.DrawPolygon(options, new SolidBrush(color), thickness, points);
71+
source.DrawPolygon(new Pen(brush, thickness), points);
7672

7773
/// <summary>
78-
/// Draws the provided Points as a closed Linear Polygon with the provided Pen.
74+
/// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
7975
/// </summary>
8076
/// <param name="source">The image this method extends.</param>
81-
/// <param name="pen">The pen.</param>
77+
/// <param name="color">The color.</param>
78+
/// <param name="thickness">The thickness.</param>
8279
/// <param name="points">The points.</param>
8380
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
8481
public static IImageProcessingContext DrawPolygon(
8582
this IImageProcessingContext source,
86-
IPen pen,
83+
Color color,
84+
float thickness,
8785
params PointF[] points) =>
88-
source.Draw(new ShapeGraphicsOptions(), pen, new Polygon(new LinearLineSegment(points)));
86+
source.DrawPolygon(new SolidBrush(color), thickness, points);
8987

9088
/// <summary>
91-
/// Draws the provided Points as a closed Linear Polygon with the provided Pen.
89+
/// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness.
9290
/// </summary>
9391
/// <param name="source">The image this method extends.</param>
9492
/// <param name="options">The options.</param>
95-
/// <param name="pen">The pen.</param>
93+
/// <param name="color">The color.</param>
94+
/// <param name="thickness">The thickness.</param>
9695
/// <param name="points">The points.</param>
9796
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
9897
public static IImageProcessingContext DrawPolygon(
9998
this IImageProcessingContext source,
10099
ShapeGraphicsOptions options,
101-
IPen pen,
100+
Color color,
101+
float thickness,
102102
params PointF[] points) =>
103-
source.Draw(options, pen, new Polygon(new LinearLineSegment(points)));
103+
source.DrawPolygon(options, new SolidBrush(color), thickness, points);
104104
}
105105
}

0 commit comments

Comments
 (0)