Skip to main content

Module drawing

Module drawing 

Source
Expand description

Drawing tools.

A drawing is a DrawingTool: anchors in data space (Anchor: time and price), a style, and code that turns them into frame primitives through a FrameBuilder. The DrawingManager (Chart::drawings) owns the drawings of a chart: it creates them from DrawingData through registered factories, keeps their z order, selection, visibility and lock state, and records changes as commands for undo/redo.

Anchors are timestamps, not logical indices, so they survive prepend and axis rebuilds. Times outside the data are extrapolated with the spacing of the last (or first) two bars; times between two slots are interpolated.

Structs§

Anchor
A point of a drawing in data space.
DrawingCtx
Coordinate conversions and measurements for DrawingTools of one pane.
DrawingData
Format-independent saved form of a drawing: what DrawingTool::save returns and what factories build drawings from.
DrawingManager
The drawings of a chart (Chart::drawings).
DrawingStyle
Colors and line settings of a drawing.
FrameBuilder
Writes the primitives of a drawing into the frame (main layer, clipped to the pane by the caller).
Label
How FrameBuilder::text draws a text.

Enums§

AnchorCount
How a drawing is created.
HitPart
What part of a drawing a point hits.
Param
A tool-specific parameter of a drawing.

Constants§

BUILTIN_KINDS
Kinds of the built-in tools: the first batch, then the second. Long and short positions, the three pitchforks and the two Elliott waves are one tool each with several kinds.
MAX_ANCHORS
Most anchors of an Open or Freehand drawing.

Traits§

DrawingTool
A drawing tool. Built-in tools are listed in BUILTIN_KINDS; custom tools are registered with DrawingManager::register.

Functions§

clip_line
The part of the line through a and b inside rect: from a (or from the edge if back) to b (or to the edge if forward). None if it misses the rectangle.
distance_to_segment
Distance from p to the segment a–b.
point_in_polygon
Whether p is inside the polygon pts (even-odd rule).

Type Aliases§

DrawingFactory
Builds a drawing from its saved form.