Skip to content

Commit a6967be

Browse files
Add WebGPU docs; update gitattributes & deps
1 parent 193a4cc commit a6967be

4 files changed

Lines changed: 73 additions & 21 deletions

File tree

.gitattributes

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,12 @@
8585
###############################################################################
8686
*.basis binary
8787
*.dll binary
88-
*.eot binary
8988
*.exe binary
90-
*.otf binary
9189
*.pdf binary
9290
*.ppt binary
9391
*.pptx binary
9492
*.pvr binary
9593
*.snk binary
96-
*.ttc binary
97-
*.ttf binary
98-
*.woff binary
99-
*.woff2 binary
10094
*.xls binary
10195
*.xlsx binary
10296
###############################################################################
@@ -126,6 +120,7 @@
126120
*.dds filter=lfs diff=lfs merge=lfs -text
127121
*.ktx filter=lfs diff=lfs merge=lfs -text
128122
*.ktx2 filter=lfs diff=lfs merge=lfs -text
123+
*.astc filter=lfs diff=lfs merge=lfs -text
129124
*.pam filter=lfs diff=lfs merge=lfs -text
130125
*.pbm filter=lfs diff=lfs merge=lfs -text
131126
*.pgm filter=lfs diff=lfs merge=lfs -text
@@ -143,3 +138,12 @@
143138
# Handle ICC files by git lfs
144139
###############################################################################
145140
*.icc filter=lfs diff=lfs merge=lfs -text
141+
###############################################################################
142+
# Handle font files by git lfs
143+
###############################################################################
144+
*.eot filter=lfs diff=lfs merge=lfs -text
145+
*.otf filter=lfs diff=lfs merge=lfs -text
146+
*.ttc filter=lfs diff=lfs merge=lfs -text
147+
*.ttf filter=lfs diff=lfs merge=lfs -text
148+
*.woff filter=lfs diff=lfs merge=lfs -text
149+
*.woff2 filter=lfs diff=lfs merge=lfs -text

README.md

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,74 @@ SixLabors.ImageSharp.Drawing
1414

1515
</div>
1616

17-
**ImageSharp.Drawing** is a cross-platform 2D drawing library built on top of [ImageSharp](https://github.com/SixLabors/ImageSharp). It provides path construction, polygon manipulation, fills, strokes, gradient brushes, pattern brushes, and text rendering. Built against [.NET 8](https://docs.microsoft.com/en-us/dotnet/standard/net-standard).
17+
**ImageSharp.Drawing** is a cross-platform 2D drawing library built on top of [ImageSharp](https://github.com/SixLabors/ImageSharp). It adds a rich vector drawing model for composing raster images, rendering text, shaping paths, masking image-processing operations, and targeting CPU or WebGPU-backed drawing surfaces from the same `DrawingCanvas` API.
18+
19+
The core package targets .NET 8 and provides the default CPU backend. The optional `SixLabors.ImageSharp.Drawing.WebGPU` package adds GPU-backed rendering for native windows, external surfaces, and offscreen render targets.
20+
21+
## Capabilities
22+
23+
- Draw and fill paths, lines, arcs, ellipses, pies, rectangles, rounded rectangles, regular polygons, stars, and arbitrary `PathBuilder` geometry.
24+
- Use solid, pattern, image, recolor, linear gradient, radial gradient, elliptic gradient, sweep gradient, and path gradient brushes.
25+
- Stroke paths and polylines with configurable width, caps, joins, dash patterns, and stroke options.
26+
- Render text with `SixLabors.Fonts`, including rich text runs, fallback fonts, bidirectional text, vertical layout, glyph paths, text measurement, wrapped text, and text-on-path scenarios.
27+
- Compose with transforms, clipping, save/restore state, isolated layers, blend options, opacity, and region canvases.
28+
- Use paths as masks for ImageSharp processors with `canvas.Apply(...)`, or fill paths with images via `ImageBrush`.
29+
- Create retained drawing scenes and render them repeatedly to compatible targets.
30+
- Render into `Image<TPixel>` memory with the CPU backend, or into WebGPU windows, external host surfaces, and offscreen render targets with the WebGPU backend.
1831

1932
## Quick Start
2033

34+
Draw into an `Image<TPixel>` with the CPU backend:
35+
2136
```csharp
2237
image.Mutate(ctx => ctx.Paint(canvas =>
2338
{
39+
// A fill without geometry paints the entire canvas.
2440
canvas.Fill(Brushes.Solid(Color.White));
25-
canvas.Fill(Brushes.Solid(Color.Red), new EllipsePolygon(200, 200, 100));
26-
canvas.Draw(Pens.Solid(Color.Blue, 3F), new RectanglePolygon(50, 50, 200, 100));
41+
42+
// Brushes can be reused across paths or used directly for full-canvas fills.
43+
canvas.Fill(new LinearGradientBrush(
44+
new PointF(0, 0),
45+
new PointF(400, 300),
46+
GradientRepetitionMode.None,
47+
new ColorStop(0F, Color.CornflowerBlue),
48+
new ColorStop(1F, Color.MediumSeaGreen)));
49+
50+
// Built-in polygon types are regular IPath instances accepted by Fill and Draw.
51+
canvas.Fill(Brushes.Solid(Color.HotPink), new EllipsePolygon(200, 200, 100));
52+
canvas.Draw(Pens.Solid(Color.Navy, 3F), new RoundedRectanglePolygon(50, 50, 200, 100, 16));
2753
}));
2854
```
29-
55+
56+
Draw into a native WebGPU window with the same canvas-facing API:
57+
58+
```csharp
59+
using WebGPUWindow window = new(new WebGPUWindowOptions
60+
{
61+
Title = "ImageSharp.Drawing",
62+
Size = new Size(800, 600),
63+
Format = WebGPUTextureFormat.Bgra8Unorm,
64+
PresentMode = WebGPUPresentMode.Fifo,
65+
});
66+
67+
window.Run(frame =>
68+
{
69+
DrawingCanvas canvas = frame.Canvas;
70+
71+
// WebGPU frames expose the same DrawingCanvas API as CPU image processing.
72+
canvas.Fill(Brushes.Solid(Color.Black));
73+
canvas.Fill(Brushes.Solid(Color.CornflowerBlue), new EllipsePolygon(400, 300, 120));
74+
});
75+
```
76+
3077
## License
31-
32-
- ImageSharp.Drawing is licensed under the [Six Labors Split License, Version 1.0](https://github.com/SixLabors/ImageSharp.Drawing/blob/main/LICENSE)
78+
79+
- ImageSharp.Drawing is licensed under the [Six Labors Split License, Version 1.0](https://github.com/SixLabors/ImageSharp.Drawing/blob/main/LICENSE)
3380

3481

3582
## Support Six Labors
3683

37-
Support the efforts of the development of the Six Labors projects.
84+
Support the efforts of the development of the Six Labors projects.
3885
- [Purchase a Commercial License :heart:](https://sixlabors.com/pricing/)
3986
- [Become a sponsor via GitHub Sponsors :heart:]( https://github.com/sponsors/SixLabors)
4087
- [Become a sponsor via Open Collective :heart:](https://opencollective.com/sixlabors)
@@ -49,17 +96,18 @@ Support the efforts of the development of the Six Labors projects.
4996
- Do you have questions? We are happy to help! Please [join our Discussions Forum](https://github.com/SixLabors/ImageSharp.Drawing/discussions/category_choices), or ask them on [stackoverflow](https://stackoverflow.com) using the `ImageSharp` tag. **Do not** open issues for questions!
5097
- Please read our [Contribution Guide](https://github.com/SixLabors/ImageSharp.Drawing/blob/main/.github/CONTRIBUTING.md) before opening issues or pull requests!
5198

52-
## Code of Conduct
99+
## Code of Conduct
53100
This project has adopted the code of conduct defined by the [Contributor Covenant](https://contributor-covenant.org/) to clarify expected behavior in our community.
54101
For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).
55102

56103
## Installation
57104

58105
Install stable releases via NuGet; development releases are available via MyGet.
59106

60-
| Package Name | Release (NuGet) | Nightly (MyGet) |
61-
|--------------------------------|-----------------|-----------------|
62-
| `SixLabors.ImageSharp.Drawing` | [![NuGet](https://img.shields.io/nuget/v/SixLabors.ImageSharp.Drawing.svg)](https://www.nuget.org/packages/SixLabors.ImageSharp.Drawing/) | [![feedz.io](https://img.shields.io/badge/endpoint.svg?url=https%3A%2F%2Ff.feedz.io%2Fsixlabors%2Fsixlabors%2Fshield%2FSixLabors.ImageSharp.Drawing%2Flatest)](https://f.feedz.io/sixlabors/sixlabors/nuget/index.json) |
107+
| Package Name | Release (NuGet) | Nightly (MyGet) |
108+
|---------------------------------------|-----------------|-----------------|
109+
| `SixLabors.ImageSharp.Drawing` | [![NuGet](https://img.shields.io/nuget/v/SixLabors.ImageSharp.Drawing.svg)](https://www.nuget.org/packages/SixLabors.ImageSharp.Drawing/) | [![feedz.io](https://img.shields.io/badge/endpoint.svg?url=https%3A%2F%2Ff.feedz.io%2Fsixlabors%2Fsixlabors%2Fshield%2FSixLabors.ImageSharp.Drawing%2Flatest)](https://f.feedz.io/sixlabors/sixlabors/nuget/index.json) |
110+
| `SixLabors.ImageSharp.Drawing.WebGPU` | [![NuGet](https://img.shields.io/nuget/v/SixLabors.ImageSharp.Drawing.WebGPU.svg)](https://www.nuget.org/packages/SixLabors.ImageSharp.Drawing.WebGPU/) | [![feedz.io](https://img.shields.io/badge/endpoint.svg?url=https%3A%2F%2Ff.feedz.io%2Fsixlabors%2Fsixlabors%2Fshield%2FSixLabors.ImageSharp.Drawing.WebGPU%2Flatest)](https://f.feedz.io/sixlabors/sixlabors/nuget/index.json) |
63111

64112
## Manual build
65113

src/ImageSharp.Drawing/ImageSharp.Drawing.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
<None Include="..\..\shared-infrastructure\branding\icons\imagesharp.drawing\sixlabors.imagesharp.drawing.128.png" Pack="true" PackagePath="" />
4141
</ItemGroup>
4242
<ItemGroup>
43-
<PackageReference Include="SixLabors.Fonts" Version="3.0.0-alpha.0.45" />
44-
<PackageReference Include="SixLabors.ImageSharp" Version="4.0.0-alpha.0.103" />
45-
<PackageReference Include="SixLabors.PolygonClipper" Version="1.0.0-alpha.0.55" />
43+
<PackageReference Include="SixLabors.Fonts" Version="3.0.0-alpha.0.48" />
44+
<PackageReference Include="SixLabors.ImageSharp" Version="4.0.0-alpha.0.106" />
45+
<PackageReference Include="SixLabors.PolygonClipper" Version="1.0.0-alpha.0.58" />
4646
</ItemGroup>
4747

4848
<Import Project="..\..\shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems" Label="Shared" />

0 commit comments

Comments
 (0)