Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
StrokeMarkerPrefabs.h File Reference

Reusable stroke markers inserted into the current SVG only when chosen. More...

#include <array>
#include <optional>
#include <string_view>
Include dependency graph for StrokeMarkerPrefabs.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::editor::StrokeMarkerPrefabOption
 Human-readable picker entry for one reusable marker shape. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.
namespace  donner::svg
 Donner SVG library, which can load, manipulate and render SVG files.

Enumerations

enum class  donner::editor::StrokeMarkerPrefab {
  FilledArrow ,
  OpenArrow ,
  Dot ,
  Diamond
}
 Marker shapes offered by the inspector before the document defines them.

Functions

bool donner::editor::ApplyStrokeMarkerPrefab (EditorApp &app, std::string_view property, StrokeMarkerPrefab prefab)
 Attach a reusable marker to the selected shapes, creating its SVG definition on first use.
std::optional< StrokeMarkerPrefab > donner::editor::StrokeMarkerPrefabForReference (svg::SVGDocument &document, std::string_view reference)
 Identify a tagged prefab marker referenced by url(#id) in the current SVG.
std::optional< StrokeMarkerPrefab > donner::editor::StrokeMarkerPrefabForElement (const svg::SVGElement &marker)
 Identify a marker whose ID, resolved target, and SVG geometry match a built-in prefab.

Variables

constexpr std::array< StrokeMarkerPrefabOption, 4 > donner::editor::kStrokeMarkerPrefabOptions
 Marker choices shown for both the start and end of a stroke.

Detailed Description

Reusable stroke markers inserted into the current SVG only when chosen.

Function Documentation

◆ ApplyStrokeMarkerPrefab()

bool donner::editor::ApplyStrokeMarkerPrefab ( EditorApp & app,
std::string_view property,
StrokeMarkerPrefab prefab )

Attach a reusable marker to the selected shapes, creating its SVG definition on first use.

The marker uses context-stroke so its color follows the shape. A later use of the same preset reuses the existing tagged definition; an unrelated element with the preferred ID is preserved. Definition insertion and the style change form one source-backed undo entry.

Parameters
appEditor containing the selected shapes and SVG document.
propertyEither marker-start or marker-end.
prefabPreset to use.
Returns
True when a document mutation was queued.

Variable Documentation

◆ kStrokeMarkerPrefabOptions

std::array<StrokeMarkerPrefabOption, 4> donner::editor::kStrokeMarkerPrefabOptions
inlineconstexpr
Initial value:
= {{
{StrokeMarkerPrefab::FilledArrow, "Filled arrow"},
{StrokeMarkerPrefab::OpenArrow, "Open arrow"},
{StrokeMarkerPrefab::Dot, "Dot"},
{StrokeMarkerPrefab::Diamond, "Diamond"},
}}

Marker choices shown for both the start and end of a stroke.