• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support

DRIT.Drawing examples

Each guide groups runnable examples by the job you are trying to do. Every example shows the real image it produces next to the code that produces it, so you can see the result before running anything.

Guides

Guide Use it to
Getting started Create, save, load and dispose images; migrate from System.Drawing; limit decoding of untrusted input.
Drawing Draw lines, shapes, arcs, curves and paths; combine regions; hit-test a path.
Brushes and pens Control strokes (width, dashes, joins, arrow caps) and fills (solid, hatch, gradient, texture).
Rendering Antialiasing, alpha blending, clipping, transforms, saved state and page units.
Text Measure, lay out and style text; fonts and fallback; text on a path.
Images Encode formats, crop and scale, read and write pixels, control JPEG quality, bound decoding.
Animation Inspect, preserve and extract the frames of animated GIFs.
Vector Record SVG, load and rasterize SVG, write and compare EMF.
Recipes Combine the pieces: captions, frames, callouts, charts, badges, thumbnails.

Run the examples

From the repository root:

dotnet run --project DRIT.Drawing.Examples

Pass example names and an output directory to run a subset; --list prints every name:

dotnet run --project DRIT.Drawing.Examples -- CreateImage RecordSvg --output .\examples-output

The project targets .NET 8 and references the library project. Each example writes its files into the output directory and uses only generated input, so nothing else is needed.

How the pictures are made

The images in these guides are files produced by the examples. Run all examples with --verify to check for blank or single-colour images before updating the guides. Two conventions apply throughout:

  • Inside a code excerpt, context or c is the output directory object and ExampleSupport holds shared helpers that generate input (a landscape picture, a gradient, an animated GIF), so every example is self-contained.
  • A few small diagrams explain a mechanism that a picture of the output cannot, such as the row stride in raw pixel access or the control points of a Bézier curve. They are drawn, not generated, and say so in their captions.

Fonts

Text output depends on the fonts installed on the machine. FontFamily.GenericSansSerif, GenericSerif and GenericMonospace resolve to an installed family: Arial, Times New Roman and Courier New on Windows; DejaVu or Liberation on Linux; Helvetica Neue, Times and Menlo on macOS. The letterforms in your own run can therefore differ slightly from the pictures here. If a generic family has no installed stand-in, outline-based features (DrawStringOnPath, DrawRichText) draw nothing; ship a font file and load it with PrivateFontCollection when you need identical typography everywhere.

  • API reference
  • Improve this Doc
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX