Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
PenTool.h File Reference

Release-quality path authoring tool. PenTool creates source-backed <path> elements from document-space clicks: a plain click places a line anchor (M/L), a click-drag places a smooth Bezier anchor (C) whose outgoing handle follows the mouse while the incoming handle mirrors it through the anchor, and Alt/Option during the drag breaks that symmetry to author a corner with mismatched handles. Shift constrains the next anchor to 0/45/90 degrees from the previous one, clicking near the first anchor closes the contour with Z (dragging on close shapes the closing anchor's handles), and the whole pen session collapses into a single undoable command on finalize (close, Enter/double-click or Escape commit, or a tool switch). More...

#include <cstddef>
#include <optional>
#include <string>
#include <vector>
#include "donner/base/Path.h"
#include "donner/base/Vector2.h"
#include "donner/editor/Tool.h"
#include "donner/svg/SVGPathElement.h"
Include dependency graph for PenTool.h:
This graph shows which files directly or indirectly include this file:

Classes

class  donner::editor::PenTool
 Click-to-place path authoring tool with direct point editing. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Detailed Description

Release-quality path authoring tool. PenTool creates source-backed <path> elements from document-space clicks: a plain click places a line anchor (M/L), a click-drag places a smooth Bezier anchor (C) whose outgoing handle follows the mouse while the incoming handle mirrors it through the anchor, and Alt/Option during the drag breaks that symmetry to author a corner with mismatched handles. Shift constrains the next anchor to 0/45/90 degrees from the previous one, clicking near the first anchor closes the contour with Z (dragging on close shapes the closing anchor's handles), and the whole pen session collapses into a single undoable command on finalize (close, Enter/double-click or Escape commit, or a tool switch).