sixlabors - SixLabors.ImageSharp.Drawing 1.0.0-beta15.10

An extension to ImageSharp that allows the drawing of images, paths, and text.

PM> Install-Package SixLabors.ImageSharp.Drawing -Version 1.0.0-beta15.10 -Source https://www.myget.org/F/sixlabors/api/v3/index.json

Copy to clipboard

> nuget.exe install SixLabors.ImageSharp.Drawing -Version 1.0.0-beta15.10 -Source https://www.myget.org/F/sixlabors/api/v3/index.json

Copy to clipboard

> dotnet add package SixLabors.ImageSharp.Drawing --version 1.0.0-beta15.10 --source https://www.myget.org/F/sixlabors/api/v3/index.json

Copy to clipboard
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta15.10" />
Copy to clipboard
source https://www.myget.org/F/sixlabors/api/v3/index.json

nuget SixLabors.ImageSharp.Drawing  ~> 1.0.0-beta15.10
Copy to clipboard

> choco install SixLabors.ImageSharp.Drawing --version 1.0.0-beta15.10 --source https://www.myget.org/F/sixlabors/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "sixlabors" -SourceLocation "https://www.myget.org/F/sixlabors/api/v2"
Install-Module -Name "SixLabors.ImageSharp.Drawing" -RequiredVersion "1.0.0-beta15.10" -Repository "sixlabors" -AllowPreRelease
Copy to clipboard

Browse the sources in this package using Visual Studio or WinDbg by configuring the following symbol server URL: https://www.myget.org/F/sixlabors/api/v2/symbolpackage/


SixLabors.ImageSharp.Drawing
SixLabors.ImageSharp.Drawing

Build Status Code coverage License: Six Labors Split

ImageSharp.Drawing is a cross-platform 2D drawing library built on top of 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.

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.

Capabilities

  • Draw and fill paths, lines, arcs, ellipses, pies, rectangles, rounded rectangles, regular polygons, stars, and arbitrary PathBuilder geometry.
  • Use solid, pattern, image, recolor, linear gradient, radial gradient, elliptic gradient, sweep gradient, and path gradient brushes.
  • Stroke paths and polylines with configurable width, caps, joins, dash patterns, and stroke options.
  • 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.
  • Compose with transforms, clipping, save/restore state, isolated layers, blend options, opacity, and region canvases.
  • Use paths as masks for ImageSharp processors with canvas.Apply(...), or fill paths with images via ImageBrush.
  • Create retained drawing scenes and render them repeatedly to compatible targets.
  • Render into Image<TPixel> memory with the CPU backend, or into WebGPU windows, external host surfaces, and offscreen render targets with the WebGPU backend.

Quick Start

Draw into an Image<TPixel> with the CPU backend:

image.Mutate(ctx => ctx.Paint(canvas =>
{
    // A fill without geometry paints the entire canvas.
    canvas.Fill(Brushes.Solid(Color.White));

    // Brushes can be reused across paths or used directly for full-canvas fills.
    canvas.Fill(new LinearGradientBrush(
        new PointF(0, 0),
        new PointF(400, 300),
        GradientRepetitionMode.None,
        new ColorStop(0F, Color.CornflowerBlue),
        new ColorStop(1F, Color.MediumSeaGreen)));

    // Built-in polygon types are regular IPath instances accepted by Fill and Draw.
    canvas.Fill(Brushes.Solid(Color.HotPink), new EllipsePolygon(200, 200, 100));
    canvas.Draw(Pens.Solid(Color.Navy, 3F), new RoundedRectanglePolygon(50, 50, 200, 100, 16));
}));

Draw into a native WebGPU window with the same canvas-facing API:

using WebGPUWindow window = new(new WebGPUWindowOptions
{
    Title = "ImageSharp.Drawing",
    Size = new Size(800, 600),
    Format = WebGPUTextureFormat.Bgra8Unorm,
    PresentMode = WebGPUPresentMode.Fifo,
});

window.Run(frame =>
{
    DrawingCanvas canvas = frame.Canvas;

    // WebGPU frames expose the same DrawingCanvas API as CPU image processing.
    canvas.Fill(Brushes.Solid(Color.Black));
    canvas.Fill(Brushes.Solid(Color.CornflowerBlue), new EllipsePolygon(400, 300, 120));
});

License

Support Six Labors

Support the efforts of the development of the Six Labors projects.

Documentation

  • Detailed documentation for the ImageSharp.Drawing API is available. This includes additional conceptual documentation to help you get started.
  • Our Samples Repository is also available containing buildable code samples demonstrating common activities.

Questions?

Code of Conduct

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information, see the .NET Foundation Code of Conduct.

Installation

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

Package Name Release (NuGet) Nightly (MyGet)
SixLabors.ImageSharp.Drawing NuGet feedz.io
SixLabors.ImageSharp.Drawing.WebGPU NuGet feedz.io

Manual build

If you prefer, you can compile ImageSharp.Drawing yourself (please do and help!)

Alternatively, you can work from command line and/or with a lightweight editor on both Linux/Unix and Windows:

To clone ImageSharp.Drawing locally, click the "Clone in [YOUR_OS]" button above or run the following git commands:

git clone https://github.com/SixLabors/ImageSharp.Drawing

If working with Windows please ensure that you have enabled log file paths in git (run as Administrator).

git config --system core.longpaths true

Submodules

This repository contains git submodules. To add the submodules to the project, navigate to the repository root and type:

git submodule update --init --recursive

How can you help?

Please... Spread the word, contribute algorithms, submit performance improvements, unit tests, no input is too little. Make sure to read our Contribution Guide before opening a PR.

The ImageSharp.Drawing Team


JetBrains

Special thanks to JetBrains for supporting us with open-source licenses for their IDEs.

  • .NETFramework 4.7.2
    • SixLabors.Fonts (>= 1.0.0-beta19.10)
    • SixLabors.ImageSharp (>= 2.1.3)
  • .NETCoreApp 2.1
    • SixLabors.Fonts (>= 1.0.0-beta19.10)
    • SixLabors.ImageSharp (>= 2.1.3)
  • .NETCoreApp 3.1
    • SixLabors.Fonts (>= 1.0.0-beta19.10)
    • SixLabors.ImageSharp (>= 2.1.3)
  • .NETStandard 2.0
    • SixLabors.Fonts (>= 1.0.0-beta19.10)
    • SixLabors.ImageSharp (>= 2.1.3)
  • .NETStandard 2.1
    • SixLabors.Fonts (>= 1.0.0-beta19.10)
    • SixLabors.ImageSharp (>= 2.1.3)
  • .NETCoreApp 2.1: 2.1.0.0
  • .NETCoreApp 3.1: 3.1.0.0
  • .NETFramework 4.7.2: 4.7.2.0
  • .NETStandard 2.0: 2.0.0.0
  • .NETStandard 2.1: 2.1.0.0

Owners

Six Labors James Jackson-South

Authors

Six Labors and contributors

Project URL

https://github.com/SixLabors/ImageSharp.Drawing

License

Apache-2.0

Tags

Image Draw Shape Path Font

Info

7092 total downloads
165 downloads for version 1.0.0-beta15.10
Download (510.27 KB)
Download symbols (225.93 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
1.0.0 510.81 KB Mon, 14 Aug 2023 12:30:48 GMT 150
1.0.0-beta15.19 510.89 KB Mon, 14 Aug 2023 12:16:18 GMT 149
1.0.0-beta15.18 510.93 KB Mon, 14 Aug 2023 11:21:13 GMT 152
1.0.0-beta15.17 510.51 KB Mon, 14 Aug 2023 10:54:27 GMT 135
1.0.0-beta15.16 510.56 KB Mon, 14 Aug 2023 07:51:24 GMT 131
1.0.0-beta15.15 512.35 KB Sun, 13 Aug 2023 11:11:46 GMT 159
1.0.0-beta15.14 512.88 KB Fri, 07 Jul 2023 23:23:55 GMT 175
1.0.0-beta15.13 511.72 KB Fri, 05 May 2023 13:18:11 GMT 191
1.0.0-beta15.12 510.2 KB Fri, 05 May 2023 13:06:17 GMT 141
1.0.0-beta15.11 510.27 KB Fri, 05 May 2023 11:58:41 GMT 151
1.0.0-beta15.10 510.27 KB Fri, 05 May 2023 10:19:38 GMT 165
1.0.0-beta15.9 510.28 KB Fri, 05 May 2023 10:14:55 GMT 156
1.0.0-beta15.8 565.25 KB Tue, 04 Apr 2023 23:54:27 GMT 162
1.0.0-beta15.7 566.42 KB Tue, 21 Mar 2023 14:21:05 GMT 179
1.0.0-beta15.6 519.95 KB Fri, 17 Mar 2023 03:31:25 GMT 140
1.0.0-beta15.5 500.26 KB Wed, 08 Mar 2023 12:18:20 GMT 143
1.0.0-beta15.4 498.51 KB Mon, 06 Mar 2023 09:42:11 GMT 144
1.0.0-beta15.3 498.16 KB Tue, 27 Dec 2022 11:33:55 GMT 137
1.0.0-beta15.2 498.13 KB Mon, 03 Oct 2022 05:41:33 GMT 135
1.0.0-beta15.1 498.11 KB Sat, 23 Jul 2022 05:33:46 GMT 141
1.0.0-beta15 499.78 KB Fri, 22 Jul 2022 14:47:11 GMT 127
1.0.0-beta14.16 499.83 KB Sun, 05 Jun 2022 07:30:00 GMT 143
1.0.0-beta14.15 499.82 KB Sun, 05 Jun 2022 06:27:40 GMT 133
1.0.0-beta14.14 499.83 KB Sat, 04 Jun 2022 22:32:56 GMT 139
1.0.0-beta14.13 499.83 KB Sat, 04 Jun 2022 20:23:16 GMT 127
1.0.0-beta14.12 499.83 KB Sat, 04 Jun 2022 18:17:57 GMT 137
1.0.0-beta14.11 499.83 KB Sat, 04 Jun 2022 17:01:43 GMT 146
1.0.0-beta14.10 499.83 KB Sun, 29 May 2022 12:22:25 GMT 148
1.0.0-beta14.9 497.77 KB Wed, 25 May 2022 13:57:38 GMT 117
1.0.0-beta14.8 497.74 KB Sat, 16 Apr 2022 10:31:54 GMT 140
1.0.0-beta14.7 495.55 KB Fri, 15 Apr 2022 07:46:30 GMT 130
1.0.0-beta14.6 489.07 KB Wed, 13 Apr 2022 00:37:48 GMT 147
1.0.0-beta14.5 480.11 KB Tue, 12 Apr 2022 19:57:22 GMT 135
1.0.0-beta14.4 479.84 KB Thu, 24 Feb 2022 12:21:19 GMT 144
1.0.0-beta14.3 479.87 KB Thu, 10 Feb 2022 18:35:26 GMT 146
1.0.0-beta14.2 479.82 KB Thu, 10 Feb 2022 17:07:23 GMT 145
1.0.0-beta14.1 479.82 KB Wed, 09 Feb 2022 03:07:54 GMT 123
1.0.0-beta14 479.82 KB Wed, 09 Feb 2022 02:56:21 GMT 146
1.0.0-beta13.22 479.87 KB Wed, 09 Feb 2022 02:41:14 GMT 113
1.0.0-beta13.20 479.37 KB Tue, 01 Feb 2022 12:12:04 GMT 105
1.0.0-beta13.19 479.35 KB Fri, 14 Jan 2022 07:14:23 GMT 131
1.0.0-beta13.17 479.32 KB Wed, 22 Dec 2021 01:52:41 GMT 173
1.0.0-beta13.16 575.89 KB Fri, 03 Dec 2021 11:38:36 GMT 130
1.0.0-beta13.15 575.98 KB Mon, 22 Nov 2021 02:22:22 GMT 107
1.0.0-beta13.14 587.64 KB Sat, 23 Oct 2021 13:01:57 GMT 114
1.0.0-beta13.13 587.43 KB Sun, 10 Oct 2021 03:16:56 GMT 126
1.0.0-beta13.12 587.41 KB Fri, 08 Oct 2021 14:02:09 GMT 106
1.0.0-beta13.11 587.44 KB Fri, 08 Oct 2021 13:22:22 GMT 119
1.0.0-beta13.10 587.41 KB Fri, 08 Oct 2021 13:20:03 GMT 116
1.0.0-beta13.9 587.43 KB Sat, 18 Sep 2021 10:31:39 GMT 120
1.0.0-beta13.8 586.57 KB Thu, 09 Sep 2021 14:19:38 GMT 123