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
RotateCursorSet.h File Reference
#include <array>
#include <cstdint>
#include <memory>
#include <optional>
#include <vector>
#include "donner/editor/SelectionTransformHandles.h"
Include dependency graph for RotateCursorSet.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::editor::RotateCursorImage
 RGBA pixels for one custom editor cursor image. More...
struct  donner::editor::CursorHotspot
 Pointer hotspot for a cursor, in 32x32 cursor-image pixels. More...
class  donner::editor::RotateCursorSet
 RAII owner for the editor's custom cursors. More...

Namespaces

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

Enumerations

enum class  donner::editor::PanCursorKind {
  OpenHand ,
  ClosedHand
}
 Visual state for the pan-mode cursor. More...
enum class  donner::editor::PenCursorHint {
  Base ,
  Add ,
  Remove ,
  Close
}
 Contextual pen-tool cursor variant, matching the pen tool's hover states. More...
enum class  donner::editor::EditorCursor : std::uint8_t {
  Select ,
  Pen ,
  PenAdd ,
  PenRemove ,
  PenClose ,
  Rotate ,
  Scale ,
  PathModify ,
  PanOpen ,
  PanClosed
}
 Every custom editor cursor, so the cursor set and its completeness / snapshot tests share one enumeration. Rotate and Scale are oriented per selection corner (see CursorUsesCorner); the rest ignore the corner.

Functions

CursorHotspot donner::editor::HotspotForCursor (EditorCursor cursor)
 Hotspot (pointer origin) for cursor, in cursor-image pixels. See donner/editor/art/STYLE.md for the conventions.
bool donner::editor::CursorUsesCorner (EditorCursor cursor)
 Whether cursor's art is oriented per selection corner (rotate, scale).
std::optional< RotateCursorImagedonner::editor::RenderEditorCursorImage (EditorCursor cursor, SelectionTransformCorner corner, std::shared_ptr< geode::GeodeDevice > geodeDevice)
 Render any editor cursor to straight-alpha RGBA pixels. corner is only consulted for corner-oriented cursors (CursorUsesCorner); pass any value otherwise. This is the one render path the completeness / snapshot tests exercise, matching the pipeline the live cursors use.
std::optional< RotateCursorImagedonner::editor::RenderRotateCursorImage (SelectionTransformCorner corner, std::shared_ptr< geode::GeodeDevice > geodeDevice)
 Render one oriented rotate-cursor SVG to straight-alpha RGBA pixels.
std::optional< RotateCursorImagedonner::editor::RenderScaleCursorImage (SelectionTransformCorner corner, std::shared_ptr< geode::GeodeDevice > geodeDevice)
 Render one oriented scale-cursor SVG to straight-alpha RGBA pixels.
std::optional< RotateCursorImagedonner::editor::RenderSelectCursorImage (std::shared_ptr< geode::GeodeDevice > geodeDevice)
 Render the select (arrow) cursor SVG to straight-alpha RGBA pixels.
std::optional< RotateCursorImagedonner::editor::RenderPathModifyCursorImage (std::shared_ptr< geode::GeodeDevice > geodeDevice)
 Render the path-modify (anchor-point) cursor SVG to straight-alpha RGBA pixels.
std::optional< RotateCursorImagedonner::editor::RenderPanCursorImage (PanCursorKind kind, std::shared_ptr< geode::GeodeDevice > geodeDevice)
 Render the pan-mode cursor SVG for kind to straight-alpha RGBA pixels.
std::optional< RotateCursorImagedonner::editor::RenderPenCursorImage (std::shared_ptr< geode::GeodeDevice > geodeDevice)
 Render the base pen-tool cursor SVG to straight-alpha RGBA pixels.
std::optional< RotateCursorImagedonner::editor::RenderPenCursorImage (PenCursorHint hint, std::shared_ptr< geode::GeodeDevice > geodeDevice)
 Render a contextual pen-tool cursor SVG for hint to straight-alpha RGBA pixels.

Variables

constexpr std::array< EditorCursor, 10 > donner::editor::kEditorCursors
 Every editor cursor, in a stable order. Single source of truth for the cursor-set completeness test.

Enumeration Type Documentation

◆ PanCursorKind

enum class donner::editor::PanCursorKind
strong

Visual state for the pan-mode cursor.

Enumerator
OpenHand 

Open hand while pan mode is armed.

ClosedHand 

Closed hand while actively panning.

◆ PenCursorHint

enum class donner::editor::PenCursorHint
strong

Contextual pen-tool cursor variant, matching the pen tool's hover states.

Enumerator
Base 

Plain nib: placing/continuing anchors.

Add 

Nib with a + badge: a click would insert an anchor on the hovered segment.

Remove 

Nib with a - badge: a click would delete the hovered anchor.

Close 

Nib with an o badge: a click would close the active contour.

Function Documentation

◆ RenderPanCursorImage()

std::optional< RotateCursorImage > donner::editor::RenderPanCursorImage ( PanCursorKind kind,
std::shared_ptr< geode::GeodeDevice > geodeDevice )
nodiscard

Render the pan-mode cursor SVG for kind to straight-alpha RGBA pixels.

Parameters
kindPan cursor visual state to render.
geodeDeviceShared Geode device for Geode editor builds.

◆ RenderPenCursorImage()

std::optional< RotateCursorImage > donner::editor::RenderPenCursorImage ( std::shared_ptr< geode::GeodeDevice > geodeDevice)
nodiscard

Render the base pen-tool cursor SVG to straight-alpha RGBA pixels.

Parameters
geodeDeviceShared Geode device for Geode editor builds.

Variable Documentation

◆ kEditorCursors

std::array<EditorCursor, 10> donner::editor::kEditorCursors
inlineconstexpr
Initial value:
= {
EditorCursor::Select, EditorCursor::Pen, EditorCursor::PenAdd,
EditorCursor::PenRemove, EditorCursor::PenClose, EditorCursor::Rotate,
EditorCursor::Scale, EditorCursor::PathModify, EditorCursor::PanOpen,
EditorCursor::PanClosed,
}

Every editor cursor, in a stable order. Single source of truth for the cursor-set completeness test.