MolDraw.Depiction 0.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MolDraw.Depiction --version 0.3.0
                    
NuGet\Install-Package MolDraw.Depiction -Version 0.3.0
                    
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="MolDraw.Depiction" Version="0.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MolDraw.Depiction" Version="0.3.0" />
                    
Directory.Packages.props
<PackageReference Include="MolDraw.Depiction" />
                    
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 MolDraw.Depiction --version 0.3.0
                    
#r "nuget: MolDraw.Depiction, 0.3.0"
                    
#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 MolDraw.Depiction@0.3.0
                    
#: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=MolDraw.Depiction&version=0.3.0
                    
Install as a Cake Addin
#tool nuget:?package=MolDraw.Depiction&version=0.3.0
                    
Install as a Cake Tool

MolDraw.Depiction

NuGet Downloads License: Apache-2.0

The boundary between chemistry and rendering. An immutable, toolkit-neutral 2D depiction model (MoleculeDepiction: atoms, bonds, rings, coordinates) plus the IChemistryEngine seam that lets any chemistry toolkit — NCDK, RDKit, Indigo, OpenChemLib or your own code — drive the MolDraw.Skia renderer. No dependencies, no chemistry toolkit, no UI framework.

Install

dotnet add package MolDraw.Depiction

Targets net10.0. Dependency-free, so it is safe to reference from any layer of your app.

What you get

Type Purpose
MoleculeDepiction Immutable depiction: Atoms, Bonds, Rings, Empty, GetBounds(), GetMedianBondLength()
DepictionAtom Index, element symbol, 2D coordinates, implicit hydrogens, charge, mass number, label/aromatic/radical flags
DepictionBond Begin/end atom, BondOrder, BondStereoDisplay (wedge/hash/wavy), DoubleBondPlacement, KekuleOrder, ring flag
DepictionRing Atom indices of a ring and whether it is aromatic
IChemistryEngine The seam: Name + Depict(smiles, options) → MoleculeDepiction
DepictionBuildOptions Requested layout/label behaviour: ForceLayout, PerceiveAromaticity, AssignMissingWedges, CarbonLabels
MoleculeParseException, DepictionException Toolkit-neutral failures — MolDraw.Maui turns them into MoleculeView.ErrorMessage
BondOrder, BondStereoDisplay, DoubleBondPlacement, HydrogenPosition, CarbonLabelMode Shared enums

Quick start: build a depiction by hand

using MolDraw.Depiction;

var depiction = new MoleculeDepiction(
    [
        new DepictionAtom(0, "C", 0.0, 0.0, 3, 0, null, false, HydrogenPosition.Right),
        new DepictionAtom(1, "O", 1.5, 0.0, 1, 0, null, true,  HydrogenPosition.Right),
    ],
    [
        new DepictionBond(0, 1, BondOrder.Single, BondStereoDisplay.None, DoubleBondPlacement.Center),
    ]);

Coordinates follow the MOL/RDKit convention (y points up, arbitrary bond length); the renderer scales by the median bond length. Two hard rules are validated in the constructor: atoms[i].Index == i, bonds[j].Index == j, and every bond must reference two distinct existing atoms. Everything else is optional and degrades gracefully (no rings → plain bonds, no ShowLabel → skeletal formula, no Stereo → plain bonds).

Quick start: implement your own engine

using MolDraw.Depiction;

public sealed class IndigoEngine : IChemistryEngine
{
    public string Name => "Indigo";

    public MoleculeDepiction Depict(string smiles, DepictionBuildOptions? options = null)
    {
        // 1. parse `smiles`  2. lay it out  3. map the result onto DepictionAtom/DepictionBond
        // throw MoleculeParseException for bad input, DepictionException when layout fails
    }
}

// .NET MAUI / generic host:
builder.Services.AddSingleton<IChemistryEngine, IndigoEngine>();

That is all a UI or renderer needs — MolDraw.Maui's MoleculeView.Smiles and its depiction cache work with any engine, and MolDraw.Skia renders the resulting MoleculeDepiction without knowing where it came from.

Package Purpose
MolDraw.Depiction this package — model + engine seam
MolDraw.Core NCDK engine (AddMolDrawCore())
MolDraw.Skia SkiaSharp renderer, highlights, PNG/SVG export
MolDraw.Maui .NET MAUI MoleculeView control

Documentation

License

Apache-2.0 © Agredo Application. No third-party code is redistributed in this package.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on MolDraw.Depiction:

Package Downloads
MolDraw.Skia

SkiaSharp renderer for 2D chemical structures: crisp element labels, wedges, aromatic styles, light/dark presets, per-atom heat-map highlighting (Viridis, Plasma, Inferno, Magma, Turbo), colour bars, hit testing and PNG/SVG export. Works in MAUI, Avalonia, WPF or server-side .NET — no chemistry toolkit and no UI framework required.

MolDraw.Core

The NCDK chemistry engine for MolDraw.Net: turns SMILES, MOL and SDF input into clean 2D depictions — layout, aromaticity, ring-aware double bonds, wedge/hash stereo and implicit hydrogens. Atom indices follow the input (RDKit-compatible heavy-atom order), so per-atom model output lines up. Registers IChemistryEngine via AddMolDrawCore(); depends on NCDK (LGPL-2.1).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.0 101 11/18/2026
0.3.0 104 11/17/2026