GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - SixLabors/ImageSharp.Drawing: :pen: Extensions to ImageSharp containing a cross-platform 2D polygon manipulation API and drawing operations.

BranchesTags
Open more actions menu

Latest commit

 

History

3,038 Commits
3,038 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
samples
samples
 
 
shared-infrastructure @ 32a45b2
shared-infrastructure @ 32a45b2
 
 
src
src
 
 
tests
tests
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
AGENTS.md
AGENTS.md
 
 
CLAUDE.md
CLAUDE.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
Directory.Build.props
Directory.Build.props
 
 
Directory.Build.targets
Directory.Build.targets
 
 
GEMINI.md
GEMINI.md
 
 
ImageSharp.Drawing.All.slnx
ImageSharp.Drawing.All.slnx
 
 
ImageSharp.Drawing.slnx
ImageSharp.Drawing.slnx
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
THIRD-PARTY-NOTICES
THIRD-PARTY-NOTICES
 
 
WinFormsSamples.slnx
WinFormsSamples.slnx
 
 
ci-build.ps1
ci-build.ps1
 
 
ci-local.ps1
ci-local.ps1
 
 
ci-pack.ps1
ci-pack.ps1
 
 
ci-test.ps1
ci-test.ps1
 
 
codecov.yml
codecov.yml
 
 
global.json
global.json
 
 
run-drawing-throughput-benchmarks.ps1
run-drawing-throughput-benchmarks.ps1
 
 

Repository files navigation

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 10 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

  • ImageSharp.Drawing is licensed under the Six Labors Split License, Version 1.0

Support Six Labors

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

  • Purchase a Commercial License ❤️
  • Become a sponsor via GitHub Sponsors ❤️
  • Become a sponsor via Open Collective ❤️

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?

  • Do you have questions? We are happy to help! Please join our Discussions Forum, or ask them on stackoverflow using the ImageSharp tag. Do not open issues for questions!
  • Please read our Contribution Guide before opening issues or pull requests!

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!)

  • Using Visual Studio 2022
    • Make sure you have the latest version installed
    • Make sure you have the .NET 10 SDK installed

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

  • Visual Studio Code with C# Extension
  • the .NET 10 SDK

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

  • Scott Williams
  • James Jackson-South
  • Dirk Lemstra
  • Anton Firsov
  • Brian Popow

JetBrains

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

About

🖊️ Extensions to ImageSharp containing a cross-platform 2D polygon manipulation API and drawing operations.

sixlabors.com/products/imagesharp-drawing/

Topics

2d-graphicscsharpdotnetdrawing

Resources

Readme
License

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

323 stars

Watchers

12 watching

Forks

48 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.