CodeBrix.Imaging.Drawing.ApacheLicenseForever
1.0.323.291
dotnet add package CodeBrix.Imaging.Drawing.ApacheLicenseForever --version 1.0.323.291
NuGet\Install-Package CodeBrix.Imaging.Drawing.ApacheLicenseForever -Version 1.0.323.291
<PackageReference Include="CodeBrix.Imaging.Drawing.ApacheLicenseForever" Version="1.0.323.291" />
<PackageVersion Include="CodeBrix.Imaging.Drawing.ApacheLicenseForever" Version="1.0.323.291" />
<PackageReference Include="CodeBrix.Imaging.Drawing.ApacheLicenseForever" />
paket add CodeBrix.Imaging.Drawing.ApacheLicenseForever --version 1.0.323.291
#r "nuget: CodeBrix.Imaging.Drawing.ApacheLicenseForever, 1.0.323.291"
#:package CodeBrix.Imaging.Drawing.ApacheLicenseForever@1.0.323.291
#addin nuget:?package=CodeBrix.Imaging.Drawing.ApacheLicenseForever&version=1.0.323.291
#tool nuget:?package=CodeBrix.Imaging.Drawing.ApacheLicenseForever&version=1.0.323.291
CodeBrix.Imaging.Drawing
A stroke-based drawing, painting and highlighting library for .NET applications, built on SkiaSharp. CodeBrix.Imaging.Drawing captures pointer (mouse, pen, or touch) input as resolution-independent calibrated strokes on named, colored layers, renders them with translucent "highlighter" compositing over a background image — or over a transparent canvas above live content such as a webcam video feed — and exports finished drawings as PNG/JPEG images or CodeBrix.Imaging images. It works with any UI framework that can host a Skia drawing surface, including CodeBrix.Platform (all Skia heads), native WinUI 3, WPF, and .NET MAUI. CodeBrix.Imaging.Drawing is provided as a .NET 10 library and associated CodeBrix.Imaging.Drawing.ApacheLicenseForever NuGet package.
A companion package, CodeBrix.Imaging.Drawing.NoSkia.ApacheLicenseForever, offers the identical drawing-session API with no native libraries at all, adding a fully managed 2D drawing engine (DrawingCanvas, DrawingBitmap, DrawingPaint, DrawingPath, gradients, pattern fills, blend modes, clipping, save-layers) in the CodeBrix.Imaging.Drawing.NoSkia namespace and a fully managed SVG renderer (DrawingSvg, in CodeBrix.Imaging.Drawing.NoSkia.Svg) that rasterizes an SVG document at any scale with explicit font registration, so output never depends on system fonts, and can place it in a drawing session as an element whose parts are animated by element id (DrawingSvgShape). The two packages are either/or alternatives — they compile the same drawing-session sources into the same namespaces — so an application references one or the other, never both.
CodeBrix.Imaging.Drawing supports applications and assemblies that target Microsoft .NET version 10.0 and later. Microsoft .NET version 10.0 is a Long-Term Supported (LTS) version of .NET, and was released on Nov 11, 2025; and will be actively supported by Microsoft until Nov 14, 2028. Please update your C#/.NET code and projects to the latest LTS version of Microsoft .NET.
Installation
dotnet add package CodeBrix.Imaging.Drawing.ApacheLicenseForever
Note that the NuGet package ID and the namespaces are different - there is no package named plain CodeBrix.Imaging.Drawing:
- NuGet package ID:
CodeBrix.Imaging.Drawing.ApacheLicenseForever - Assembly and primary namespace:
CodeBrix.Imaging.Drawing- i.e.using CodeBrix.Imaging.Drawing;- which holdsDrawingSession, the entry point - Additional namespaces:
CodeBrix.Imaging.Drawing.Models(DrawingLayer,Strokeand the other model types),CodeBrix.Imaging.Drawing.Shapes(the geometric primitives),CodeBrix.Imaging.Drawing.Rendering(DrawingRenderer,CanvasCalibration),CodeBrix.Imaging.Drawing.Extensions(the color, geometry and image bridge extensions), and the animation-frame namespacesCodeBrix.Imaging.Drawing.Animation,CodeBrix.Imaging.Drawing.Fills,CodeBrix.Imaging.Drawing.Text,CodeBrix.Imaging.Drawing.Captions,CodeBrix.Imaging.Drawing.SafeAreas,CodeBrix.Imaging.Drawing.Planes,CodeBrix.Imaging.Drawing.Layout,CodeBrix.Imaging.Drawing.Paths,CodeBrix.Imaging.Drawing.Images,CodeBrix.Imaging.Drawing.Effects,CodeBrix.Imaging.Drawing.PaintingandCodeBrix.Imaging.Drawing.Formations
XML documentation (IntelliSense) ships alongside the assembly.
The package pulls in the following automatically; no version pinning is needed in the consuming project:
SkiaSharp- the rendering engineCodeBrix.Imaging.ApacheLicenseForever- colors, sizes, image decoding and encoding, and theImage<Rgba32>export typeCodeBrix.PolygonTools.MitLicenseForever- the managed polygon clipping engine behind path combining, stroke outlines and inflating
CodeBrix.Imaging.Drawing supports:
- Interactive stroke drawing driven by simple pointer events (
PointerPressed/PointerMoved/PointerReleased) forwarded from any UI framework's canvas control - Resolution-independent stroke storage in a calibrated logical space, so drawings survive window resizing, DPI changes, and orientation flips
- Named, colored drawing layers (for example Pain / Numbness / Tingling) with translucent highlighter compositing — overlapping strokes within a layer never double-darken
- Annotating photos and images of any aspect ratio:
DrawingSession.CreateForImage(...)takes an explicit calibration size — or an explicitCalibrationSizing.DeriveFromBackgroundImagechoice that computes it from the image — and the parameterless export methods produce the annotated image at its original resolution with no distortion - Drawing over a background image (such as a black-and-white line diagram), over a solid fill, or over a fully transparent canvas above externally rendered content such as a live video frame
- Incremental rendering with per-layer bitmap caches, so live drawing stays fast at large stroke counts
- Programmatic drawing primitives — lines, arrows, circles, ellipses, rectangles, and polylines/polygons (outline or filled) — using plain coordinates and CodeBrix.Imaging colors, with no low-level graphics knowledge required; ideal for computer-vision-driven annotation of a live video feed
- Clear, per-layer clear, and undo-last-stroke operations (shapes and strokes share one undo history)
- Export to PNG or JPEG bytes, to an
SKImage, to a CodeBrix.ImagingImage<Rgba32>for further processing, or as plain straight-alpha RGBA bytes (ExportPixels) ready for a video encoder - Animation-frame building blocks: easing curves (
Easing,CubicBezierEasing), multi-stop color ramps (ColorRamp), linear and radial gradient fills, text drawn from a font file you register (never a system font), shape bounds, and whole-frame and per-layer fades - Pixel planes for generating frames in float colour: per-pixel procedural fills, blur, bloom, vignette and tone curves, compositing, frame transitions (dissolve, wipe, slide, push, fade through a colour), seeded random numbers, coherent noise, particles and motion-blur averaging - plain managed arithmetic that gives bit-identical results in both packages - plus session exports into float images and masks (coverage, or the visible alpha)
- An animation model, all opt-in: a timeline with named cues, keyframe tracks (float, point, color; eased per segment, hold keys, loop and ping-pong) bound to properties, element, group and layer transforms and opacity, elements that exist only within a time window, shapes rebuilt from the time, a camera with per-layer parallax, layout anchors against the frame or a safe area, a frame-sequence renderer that can use several threads, a UI-free playback controller, and an opt-in debug overlay (timecode, frame number, cues) - a drawing that uses none of it renders exactly as before
- General paths built from lines, curves and arcs (or SVG path data), stroked with caps, joins and dashes and filled with a colour or gradient; draw-on by trimming, motion along a path with tangent rotation, and morphing between paths; paths combined as areas (union, intersection, difference, exclusive-or), strokes turned into fillable outlines and shapes inflated or deflated, in exact integer arithmetic - every measurement and every combined outline computed in shared managed code, identical in both packages
- Pictures and sprites as elements (from encoded bytes, raw RGBA/BGRA pixels, CodeBrix.Imaging images or float planes; nearest or bilinear sampling, tint, source rectangle, frames by index or by time), clipping and masks per layer and per group (inside or outside a path, a matte from another layer, an alpha mask from a pixel plane), and drop shadow, glow and blur per element, group or layer computed from the drawn pixels with the shared planes blur - sized with the element's scale and the camera's zoom, the shadow's light fixed in the scene or turning with the element
- Text for animation: kerned text (tracked text included); laid-out blocks wrapped to a width, aligned (left, centre, right, justified), spaced and trimmed with an ellipsis, with every line's metrics and every character's box and glyph outline (
TextLayoutEngine,TextBlockShape); typewriter and soft reveals by character, word or line; characters, words and lines as separate elements with staggered entrances (BindStagger); outlined, gradient, drawn-on text and text along a path; and burned-in captions from SRT or WebVTT placed on a safe area (CaptionTrack,DrawCaptions) - layout computed in shared managed code, identical in both packages - Painterly tools, computed in shared managed code and identical in both packages: hard-edged masks under one written-down pixel rule (a pixel belongs to a shape when its centre is inside it), ownership maps (which element owns each pixel, gaps filled from the nearest owner), colour pickup (each element takes the mean colour of a picture beneath it), brush textures measured along and across each element, a tapered, bowed brushstroke shape, and keyframe playback that paints every few seconds in the background and dissolves between
- Motion and formations: point queries on paths (inside, distance to the edge, nearest point, distance between shapes); elements that roll along a path (facing and rolling add, overshoot past the end and settle), trains of elements - or the letters of a word - travelling one path and settling in place; additive and multiplicative bindings that combine whatever their order; layers switched on and off over time at no cost while hidden; formations of many objects arriving along natural-looking paths (a swaying fall, straight, curved, spiralling) to fill a shape in a chosen order (random, centre out, a sweep, or bottom up like a growing heap) on a schedule that completes exactly on time - all computed in shared managed code, identical in both packages; and a frame cache that renders ahead of a moving play head on background threads for live playback
- Social-media and broadcast safe-area guides (advisory presets for Instagram, Facebook, YouTube Shorts, TikTok, broadcast title/action safe and YouTube end screens): an opt-in check of the elements you mark, and an opt-in preview overlay (a light tint with an edge line, adjustable) that never appears in an export unless asked for
Native assets: one package your application must add
The SkiaSharp native binaries do not arrive transitively. An application built on CodeBrix.Platform gets them from its platform head package; a plain .NET application adds the SkiaSharp native-asset package for each platform it runs on - for example, a Linux console or service app adds:
dotnet add package SkiaSharp.NativeAssets.Linux
Use the SkiaSharp.NativeAssets.macOS or SkiaSharp.NativeAssets.Win32 variant per platform. Without the matching package the project still compiles, and then fails at run time on the first drawing call with a native-library load error.
Sample Code
Drawing on a canvas with highlighter layers
using CodeBrix.Imaging; // Color, Size
using CodeBrix.Imaging.Drawing; // DrawingSession
using CodeBrix.Imaging.Drawing.Models; // DrawingLayer
var session = new DrawingSession();
session.SetBackgroundImage(File.ReadAllBytes("body_map.png"));
session.BackgroundFillColor = Color.White;
DrawingLayer pain = session.AddLayer("Pain", Color.FromRgb(255, 30, 230));
DrawingLayer numbness = session.AddLayer("Numbness", Color.FromRgb(30, 128, 204));
session.ActiveLayer = pain;
// Hook the session to your UI framework's canvas control:
session.RedrawRequested += (s, e) => canvasControl.Invalidate();
// In the control's PaintSurface handler:
// session.Render(e.Surface, e.Info);
// In the control's pointer handlers (left button):
// session.PointerPressed(point, viewSize); session.PointerMoved(point, viewSize); session.PointerReleased();
// Save the finished drawing:
byte[] png = session.ExportPng(new Size(1000, 1000));
File.WriteAllBytes("highlighted_body_map.png", png);
Annotating a photo (any aspect ratio)
using CodeBrix.Imaging; // Color, Size
using CodeBrix.Imaging.Drawing; // DrawingSession, CalibrationSizing
// You explicitly choose the calibrated drawing space: pass a size, or ask for it
// to be derived from the photo's aspect ratio
var session = DrawingSession.CreateForImage(
File.ReadAllBytes("car_photo.jpg"),
CalibrationSizing.DeriveFromBackgroundImage);
session.AddLayer("Damage", Color.Red);
// ...wire pointer events and PaintSurface as above, draw on the photo...
// Exports at the photo's original resolution, never distorted
File.WriteAllBytes("car_photo_annotated.png", session.ExportPng());
The samples/PainDiagram folder of this repository contains a complete reference application that runs on every CodeBrix.Platform Skia head (Windows Win32 and WPF-hosted, Linux X11 / Wayland / framebuffer, macOS) plus native WinUI 3 and WPF heads, all sharing one view model.
Documentation
The NuGet package includes AGENT-README.txt, a complete API reference and usage guide written for AI coding agents - point your agent at that file when it is writing code against this library.
Additional sample code and usage examples are available in the CodeBrix.Imaging.Drawing.Tests project:
https://github.com/ellisnet/CodeBrix.Imaging.Drawing/tree/main/tests/CodeBrix.Imaging.Drawing.Tests
License
CodeBrix.Imaging.Drawing is licensed under the Apache License 2.0 - see the LICENSE file.
For licensing and provenance information about the open source code included in this package, see THIRD-PARTY-NOTICES.txt.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- CodeBrix.Imaging.ApacheLicenseForever (>= 1.0.320.279)
- CodeBrix.PolygonTools.MitLicenseForever (>= 1.0.290.843)
- SkiaSharp (>= 4.153.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.323.291 | 72 | 11/19/2026 |
| 1.0.295.430 | 133 | 10/22/2026 |
| 1.0.285.659 | 103 | 10/12/2026 |
| 1.0.278.1180 | 107 | 10/5/2026 |
| 1.0.252.351 | 162 | 9/9/2026 |
| 1.0.248.1197 | 137 | 9/5/2026 |
| 1.0.238.425 | 127 | 8/26/2026 |
| 1.0.238.170 | 124 | 8/26/2026 |
| 1.0.214.1305 | 160 | 8/2/2026 |
| 1.0.213.59 | 144 | 8/1/2026 |
| 1.0.196.349 | 161 | 7/15/2026 |
| 1.0.195.341 | 141 | 7/14/2026 |
| 1.0.193.406 | 152 | 7/12/2026 |
| 1.0.185.1134 | 154 | 7/4/2026 |