Skip to main content

xpict_core/
lib.rs

1//! Shared depiction core for **xpict**.
2//!
3//! Product path: [`doc::render`] (`DepictSpec` → `Rendered[]`). Language
4//! wrappers call this crate; they do not reimplement layout, paint, or SVG.
5
6#![forbid(unsafe_code)]
7
8pub mod align_cost;
9pub mod arrows;
10pub mod bonds;
11pub mod catmull;
12pub mod colormap;
13pub mod cxsmiles;
14pub mod debug_align;
15pub mod debug_box;
16pub mod depict;
17pub mod doc;
18pub mod edge;
19pub mod elements;
20pub mod elk;
21pub mod font;
22pub mod geom;
23#[cfg(feature = "font")]
24pub mod labels;
25#[cfg(feature = "font")]
26pub mod markup;
27pub mod metrics;
28pub mod plotdot;
29pub mod rings;
30pub mod scene;
31pub mod spokes;
32pub mod svg;
33
34pub mod align_layout;
35pub mod layout_coordgen;
36pub mod layout_spoke;
37
38pub use align_cost::{
39    cost_mapping, cost_mapping_with_generators_limited, mapping_cost, signed_side,
40    substituents_same_side, AtomChirality, AtomFeat, BondFeat, EzStereo, MappingResult, MolGraph,
41    SearchLimits, SearchStats, ALIGN_HOUSE_MAX_STATES, ALIGN_HOUSE_TIMEOUT_MS, COST_BOND_ORDER,
42    COST_CHARGE_RADICAL, COST_ELEMENT, COST_UNMATCHED,
43};
44pub use align_layout::{
45    align_molecule_constrained, hexagon_fit_max_dev, mol_graph_from_layout, ConstrainedAlignResult,
46};
47pub use arrows::{
48    axis_aligned, clip_box_edge, edge_anchors, edge_primitives as arrow_edge_primitives,
49    filleted_path_d, head_px, min_shaft_px, shaft_path_d, should_fillet, simplify_route,
50    EdgePaintIn, EdgePrim, ANCHOR_GAP, KINK_PX, TURN_RADIUS,
51};
52pub use bonds::{
53    bond_paths, bond_strokes, centered_displacements, depict_order, is_aromatic_order,
54    join_centered_multibonds, line_intersect, multi_bond_offset, BondStrokes, DrawnBond,
55    StrokePath,
56};
57pub use catmull::{
58    centripetal_catmull_rom_closed_path, centripetal_catmull_rom_open_path, open_catmull_end_frame,
59    open_catmull_with_arrow, sample_open_catmull,
60};
61pub use colormap::{colormap_rgb, sample_colormap, XENOSITE};
62pub use cxsmiles::{
63    apply_cx_by_index, cx_atom_labels, cx_multicenters, cx_source, smiles_base, Multicenter,
64};
65pub use debug_align::{
66    align_debug_query, align_debug_template, paint_align_debug, DEBUG_ALIGN_BADGE,
67    DEBUG_ALIGN_OPACITY, DEBUG_ALIGN_PALETTE, DEBUG_ALIGN_UNMATCHED,
68};
69pub use debug_box::{
70    debug_rect, label_debug_rect, mol_debug_rect, scene_debug_rect, DEBUG_BOX_DASH,
71    DEBUG_BOX_STROKE, DEBUG_BOX_STROKE_PX,
72};
73pub use depict::{depict_molecule, frame_offset};
74pub use doc::{
75    annotations_from_overlay, apply_star_labels, assign_mol_ids, canonicalize_overlay,
76    compose_scheme, overlay_from_annotations, plan_edge, render_doc, resolve_mol_opts,
77    validate_edges, validate_shade_colormap, AlignTo, AlignToSpec, Annotation, AtomLabelDetailed,
78    AtomLabelSpec, AtomNumberBy, AtomNumberPolicy, AtomNumberSpec, CalloutField, CalloutSpec,
79    CircleField, CircleSpec, CommonOpts, DepictSpec, DocPaint, EdgeArrow, EdgeNode, EdgeNodeKind,
80    EdgeRouting, FillSpec, ForTypesPatch, Label, LabelItem, LabelLanes, LabelPlacement, LabelPos,
81    LabelRole, LayoutAlgorithm, LayoutDirection, LayoutOpts, MolIds, MolNode, MolNodeKind, MolOpts,
82    MolOverlayFields, MolText, MolTextSpec, Node, NodeType, Opts, OptsPatch, RegionField,
83    RegionSpec, RegionStyle, RegionTextPlace, ShadeSpec, ShadeStyle, StrokeSpec, TextNode,
84    TextNodeKind, TypedOptsPatch, Z_ATOMS, Z_ATOM_LABEL, Z_BACKGROUND, Z_BONDS, Z_CALLOUT,
85    Z_CIRCLE, Z_HALO, Z_NAME, Z_REGION, Z_SHADE,
86};
87// Document ``render`` / ``depict`` live at ``doc::`` (crate-root ``depict`` is paint).
88pub use doc::{
89    process_edge_plan, process_edge_plan_with_frames, render, DepictRendered,
90    SvgAtom as DepictSvgAtom, SvgBond as DepictSvgBond,
91};
92pub use edge::{
93    AlignMode, AlignOpts, CoordGenMoleculeResult, CoordMethod, EdgePlan, EdgeResult, EdgeTask,
94    EdgeTaskResult, MolTemplate, MIN_MCS_ATOMS as EDGE_MIN_MCS_ATOMS,
95};
96pub use elements::{atomic_number, element_symbol, SYMBOLS};
97pub use elk::{
98    layout_json as elk_layout_json, scheme_layout_options, DiagramKind as ElkDiagramKind,
99};
100pub use geom::{capsule_halo_path_d, disk_halo_path_d, polygon_to_svg_d};
101#[cfg(feature = "font")]
102pub use labels::{
103    atom_display_label, compose_label, label_side, place_backbone, place_label, shorten_bond,
104    split_label, AtomIn, BondIn, BondOut, LabelParts, LabelSide, PlacedLabel,
105};
106#[cfg(feature = "font")]
107pub use markup::parse_label_markup;
108pub use metrics::{BOND_PX, OFFSET_FRAC, OFFSET_PX, SCALE, SHADE_FRAC, STROKE_PX};
109pub use plotdot::{PlotDot, ShadeDisk};
110pub use rings::{
111    apply_ring_interiors, aromatic_ring_circles, bond_interior_normals,
112    find_relevant_rings_from_adj, find_sssr, find_sssr_from_adj, kekule_paint_orders, Ring,
113    AROMATIC_CIRCLE_FRAC,
114};
115pub use scene::{
116    AlignDebug, AlignDebugRole, AromaticStyle, Attach, Layer, LayerName, MoleculeIn, Primitive,
117    Scene, SpokeIn, TextAnchor, Viewport,
118};
119pub use svg::{scene_to_svg, scene_to_svg_json};
120// MoleculeIn atoms/bonds are scene::AtomIn / scene::BondIn (JSON ABI).
121// labels::AtomIn / BondIn remain the place_backbone wire types.