Shapes

Geometric primitives. Every shape except DocraftLoomLine derives from DocraftLoomShape, which composes one DocraftLoomShapeStyle member — style is composition, not a shared style base class across the node hierarchy (see About Docraft).

DocraftLoomShapeStyle

Background color, border color, and border width shared by every shape.

struct DocraftLoomShapeStyle

Shared background/border styling for shape nodes (Rectangle, Circle, Triangle, Polygon).

Composition over inheritance: each shape node holds one of these as a plain member, following the same idiom as DocraftLoomNode::layout_box().

Public Members

DocraftColor background_color = DocraftColor::fromRGB(0.0F, 0.0F, 0.0F, 0.0F)
DocraftColor border_color = DocraftColor::fromRGB(0.0F, 0.0F, 0.0F, 0.0F)
float border_width = 1.0F

DocraftLoomShape

Base class for Circle/Triangle/Polygon/Rectangle (via DocraftLoomLayoutContainer, see Containers); composes DocraftLoomShapeStyle.

class DocraftLoomShape : public docraft::loom::nodes::DocraftLoomNode

Common base for shape nodes (Rectangle, Circle, Triangle, Polygon), holding the shared background/border styling.

Concrete shapes still implement accept() themselves (DocraftLoomShape is never instantiated directly).

Subclassed by docraft::loom::nodes::DocraftLoomCircle, docraft::loom::nodes::DocraftLoomLayoutContainer, docraft::loom::nodes::DocraftLoomPolygon, docraft::loom::nodes::DocraftLoomTriangle

Public Functions

DocraftLoomShape() = default
~DocraftLoomShape() override = default
const DocraftLoomShapeStyle &style() const
DocraftLoomShapeStyle &edit_style()

DocraftLoomCircle

<Circle> — a shape with a radius.

class DocraftLoomCircle : public docraft::loom::nodes::DocraftLoomShape

Circle node.

Public Functions

DocraftLoomCircle() = default
~DocraftLoomCircle() override = default
virtual void accept(loom::interfaces::DocraftLoomIVisitor &visitor) override
float radius() const
void set_radius(float radius)

DocraftLoomTriangle

<Triangle> — exactly 3 points (Y-down offsets from the node’s own origin); throws InvalidInputException otherwise.

class DocraftLoomTriangle : public docraft::loom::nodes::DocraftLoomShape

Triangle node defined by exactly 3 points.

Points are stored as Y-down offsets from the node’s own origin (frame.position), consistent with loom’s coordinate convention &#8212; unlike legacy, which stores them Y-up and flips at render time.

Public Functions

DocraftLoomTriangle() = default
~DocraftLoomTriangle() override = default
virtual void accept(loom::interfaces::DocraftLoomIVisitor &visitor) override
const std::vector<Position> &points() const
void set_points(const std::vector<Position> &points)

Sets the triangle’s 3 points.

Throws:

exception::InvalidInputException – if points.size() != 3.

DocraftLoomPolygon

<Polygon> — an arbitrary-point-count shape (needs ≥3 points to render).

class DocraftLoomPolygon : public docraft::loom::nodes::DocraftLoomShape

Polygon node defined by an arbitrary number of points.

Points are stored as Y-down offsets from the node’s own origin (frame.position), consistent with loom’s coordinate convention.

By default (smooth() == false) this is a closed, fillable shape needing at least 3 points to render. Setting smooth(true) instead renders it as an open curve passing smoothly through every point (at least 2), via IDocraftLineRenderingBackend::draw_curve() &#8212; stroked only, never filled or closed. This is how a spline chart draws its per-series curve: composed from this same node/visitor rather than a dedicated node type, exactly like every other chart style composes from existing primitives.

Public Functions

DocraftLoomPolygon() = default
~DocraftLoomPolygon() override = default
virtual void accept(loom::interfaces::DocraftLoomIVisitor &visitor) override
const std::vector<Position> &points() const
void set_points(const std::vector<Position> &points)
bool smooth() const
void set_smooth(bool smooth)

DocraftLoomLine

<Line> — a stroke-only primitive with start/end points, border_color, and border_width. Not a DocraftLoomShape (no background color).

class DocraftLoomLine : public docraft::loom::nodes::DocraftLoomNode

Public Functions

DocraftLoomLine()
~DocraftLoomLine() override = default
virtual void accept(loom::interfaces::DocraftLoomIVisitor &visitor) override
const Position &start() const
void set_start(const Position &start)
const Position &end() const
void set_end(const Position &end)
const DocraftColor &border_color() const
void set_border_color(const DocraftColor &color)
float border_width() const
void set_border_width(float width)