DemaConsulting.CanvasNet.Charts 0.1.0-beta.11

Prefix Reserved
This is a prerelease version of DemaConsulting.CanvasNet.Charts.
dotnet add package DemaConsulting.CanvasNet.Charts --version 0.1.0-beta.11
                    
NuGet\Install-Package DemaConsulting.CanvasNet.Charts -Version 0.1.0-beta.11
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DemaConsulting.CanvasNet.Charts" Version="0.1.0-beta.11" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DemaConsulting.CanvasNet.Charts" Version="0.1.0-beta.11" />
                    
Directory.Packages.props
<PackageReference Include="DemaConsulting.CanvasNet.Charts" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DemaConsulting.CanvasNet.Charts --version 0.1.0-beta.11
                    
#r "nuget: DemaConsulting.CanvasNet.Charts, 0.1.0-beta.11"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DemaConsulting.CanvasNet.Charts@0.1.0-beta.11
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DemaConsulting.CanvasNet.Charts&version=0.1.0-beta.11&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DemaConsulting.CanvasNet.Charts&version=0.1.0-beta.11&prerelease
                    
Install as a Cake Tool

CanvasNet

GitHub forks GitHub stars GitHub contributors License Build Quality Gate Security NuGet

.NET canvas library for loading, saving, and cropping images

Overview

CanvasNet is a .NET library providing a mutable, span-based 32-bit RGBA pixel buffer along with codecs for loading and saving images in common file formats. It's designed for fast, allocation-conscious image operations using Span<T>, and supports independent-copy cropping for load/crop/save workflows.

Features

  • 🖼️ Pixel Buffer - Mutable 32-bit RGBA surface with span access
  • ✂️ Cropping - Independent-copy crop for load/crop/save workflows
  • 🌈 Compositing - Alpha premultiply and Porter-Duff "over" compositing
  • 📀 BMP Codec - Load/save 24-bit/32-bit uncompressed BMP files
  • 🎨 PNG Codec - Load non-interlaced PNGs; save 8-bit RGB/RGBA
  • 🖨️ TIFF Codec - Load/save 8-bit RGB/RGBA/Grayscale TIFF files
  • 🗜️ JPEG Codec - Load baseline/progressive; save baseline JPEG
  • 🎞️ GIF Codec - Decode-only load of first GIF frame; GetInfo reports the true frame count
  • 📐 SVG Codec - Rasterize a common SVG subset to a surface (DemaConsulting.CanvasNet.Svg)
  • 📄 PDF Document - Open, inspect, and rasterize PDF pages with font substitution (DemaConsulting.CanvasNet.Pdf)
  • 📊 Chart Rendering - Build and paint Bar/Column/Line/Area/Pie/Doughnut charts (DemaConsulting.CanvasNet.Charts)
  • 📈 OOXML Chart Parsing - Parse ECMA-376 DrawingML charts, including from .pptx slides (DemaConsulting.CanvasNet.Charts)
  • 📊 Visio (.vsdx) Diagram Rendering - Open and rasterize Visio diagrams, including styles and connectors (DemaConsulting.CanvasNet.Vsdx)
  • 🔍 Header-Only Probing - GetInfo reads headers without decoding pixels (GIF excepted)
  • 🖌️ Path Filling - Antialiased nonzero/even-odd fill of vector paths
  • 🖊️ Stroke-to-Fill - Convert stroked paths into fillable outlines
  • 🌅 Gradient Paint - Linear or radial gradient fills with spread
  • 🧱 Tile Paint - Fill a path by repeating a pre-rendered tile bitmap at a configurable pitch
  • 🔤 TrueType/CFF Fonts - Load TrueType/CFF/OpenType fonts and collections, extract glyph outlines, and query name/style metadata
  • 🗂️ System Font Discovery - Match a requested family/style against fonts installed on the host OS, with a bundled fallback font
  • 🎬 Rendering - Transform-aware canvas with text and shape drawing
  • ⚡ Span-Based - Fast, allocation-conscious pixel and row access
  • 🔄 Multi-Target - Supports .NET 8, 9, and 10
  • 📦 NuGet Ready - Easy integration via NuGet package

Installation

Install the core package with the .NET CLI (or the equivalent Install-Package command in the Package Manager Console):

dotnet add package DemaConsulting.CanvasNet

Each optional file-format/rendering feature ships as its own additional package - install only the ones you need, the same way as above:

Package Adds
DemaConsulting.CanvasNet.Svg SVG rasterization
DemaConsulting.CanvasNet.Pdf PDF document rendering
DemaConsulting.CanvasNet.Charts Chart building/rendering and OOXML chart parsing
DemaConsulting.CanvasNet.Pptx PowerPoint (.pptx) document rendering
DemaConsulting.CanvasNet.Vsdx Visio (.vsdx) diagram rendering

Usage

Create a surface, crop it, and round-trip it through a codec:

using DemaConsulting.CanvasNet.Canvas;
using DemaConsulting.CanvasNet.Codecs;

// Create a surface, set a pixel, and crop an independent copy
using var surface = new Surface(4, 4);
surface[1, 1] = new Rgba32(255, 0, 0, 255);
using var cropped = surface.Crop(0, 0, 2, 2);

// Save as PNG and load it back
PngCodec.Save(surface, "surface.png");
using var reloaded = PngCodec.Load("surface.png");

Open a PDF and render a page (BMP/TIFF/JPEG/GIF/SVG codecs, header-only probing, and feature-detection all follow the same pattern):

using DemaConsulting.CanvasNet.Pdf;

// Render paints the page's real content-stream geometry: path fills/strokes with device
// color, placed image XObjects, and text (using the page's embedded font, or an
// automatically substituted system/bundled fallback font when none is embedded).
using var pdfDoc = PdfDocument.Open("document.pdf");
var pageInfo = pdfDoc.GetPageInfo(0);
using var pdfSurface = pdfDoc.Render(0, pageInfo.Width, pageInfo.Height);

Fill a vector path onto a surface (stroking, gradients, tile paint, fonts, charts, and Visio/PowerPoint rendering follow the same Drawing/Geometry API):

using DemaConsulting.CanvasNet.Canvas;
using DemaConsulting.CanvasNet.Drawing;
using DemaConsulting.CanvasNet.Geometry;
using System.Numerics;

using var canvas = new Surface(64, 64);

// Build a triangular path
var triangle = new PathBuilder()
    .MoveTo(new Vector2(8, 56))
    .LineTo(new Vector2(56, 56))
    .LineTo(new Vector2(32, 8))
    .Close()
    .Build();

// Fill the triangle with an antialiased solid color
PathFiller.Fill(canvas, triangle, new Rgba32(0, 128, 255, 255));

See the User Guide for the full API reference and additional worked examples, including stroking, gradients, tile paint, font loading/metadata, chart building, OOXML chart parsing, and Visio diagram rendering.

Building

pwsh ./build.ps1

API Documentation

Detailed API documentation for all public types and members is distributed in the api/ folder of the NuGet package.

User Guide

The CanvasNet User Guide is available on the CanvasNet releases page.

Contributing

Contributions are welcome. See CONTRIBUTING.md for development setup, coding standards, and the pull request process.

License

Copyright (c) DEMA Consulting. Licensed under the MIT License. See LICENSE for details.

By contributing to this project, you agree that your contributions will be licensed under the MIT License.

The DemaConsulting.CanvasNet package bundles the Liberation Sans, Liberation Serif, and Liberation Mono TrueType fonts (12 files total) as embedded resources, used as a last-resort fallback font by PdfDocument's automatic font-substitution feature. These fonts are Copyright (c) 2012 Red Hat, Inc., licensed under the SIL Open Font License, Version 1.1; see src/DemaConsulting.CanvasNet/Fonts/BundledFonts/OFL.txt and src/DemaConsulting.CanvasNet/Fonts/BundledFonts/README.md for the full license text and sourcing/provenance details.

The DemaConsulting.CanvasNet package also bundles the Noto Sans, Noto Sans Math, and Noto Sans Symbols 2 TrueType fonts (NotoSans-Regular.ttf, NotoSansMath-Regular.ttf, NotoSansSymbols2-Regular.ttf) as embedded resources, used as the dedicated substitute font for Symbol/ZapfDingbats text by PdfDocument's automatic font-substitution feature. These fonts are part of the Noto Project, licensed under the SIL Open Font License, Version 1.1; see src/DemaConsulting.CanvasNet/Fonts/BundledFonts/NotoFonts-OFL.txt and the "Noto Substitute Fonts" section of src/DemaConsulting.CanvasNet/Fonts/BundledFonts/README.md for the full license text and sourcing/provenance details.

Support

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on DemaConsulting.CanvasNet.Charts:

Package Downloads
DemaConsulting.CanvasNet.Pptx

DemaConsulting.CanvasNet.Pptx provides a decode/rasterize-only PowerPoint (.pptx) presentation-rendering codec for the CanvasNet canvas-based drawing and rendering API.

DemaConsulting.DocDown.PowerPoint.Rendering

Optional PowerPoint slide rendering (rasterization) for DEMA Consulting DocDown

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-beta.11 68 10/9/2026
0.1.0-beta.10 99 10/7/2026
0.1.0-beta.9 47 10/7/2026