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

Geometry, hit-testing, and drawing for the toolbar Fill/Stroke widget. More...

Include dependency graph for FillStrokeWidget.h:

Classes

struct  donner::editor::internal::FillStrokeWidgetLayout
 Screen-space rectangles for every drawable/interactive part of the widget. More...
struct  donner::editor::internal::FillStrokeWidgetInteractionState
 Stable interaction policy for one fill/stroke toolbar frame. 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::internal::FillStrokeWidgetRegion {
  None ,
  FillSwatch ,
  StrokeSwatch ,
  Swap ,
  SetNone ,
  FillChip ,
  StrokeChip
}
 Interactive regions of the Fill/Stroke widget, in hit-test priority order. More...

Functions

FillStrokeWidgetInteractionState donner::editor::internal::ResolveFillStrokeWidgetInteractionState (bool hasDocument, bool rendererBusy, bool authoringSuspended, bool paintSnapshotMatchesSelection)
 Resolve safe paint mutation and snapshot refresh.
FillStrokeWidgetLayout donner::editor::internal::ComputeFillStrokeWidgetLayout (const ImVec2 &widgetMin, const ImVec2 &widgetMax)
 Compute widget sub-rectangles from the widget's outer bounds.
FillStrokeWidgetRegion donner::editor::internal::HitTestFillStrokeWidget (const FillStrokeWidgetLayout &layout, const ImVec2 &point, bool fillIsCustom, bool strokeIsCustom, bool fillIsActive)
 Classify point against layout. The active swatch wins overlap. Chip regions only match when the corresponding slot carries custom paint.
std::string donner::editor::internal::SvgPaintStringForSlot (const ToolbarPaintSlotState &slot)
 Reconstruct an SVG paint attribute string ("none", "#rrggbb", "url(#id)", "context-fill", ...) from a resolved paint slot. Used by the swap action.
void donner::editor::internal::SwapActivePaint (ActivePaintStyle &style)
 Swap the fill and stroke of an active paint style in place.
void donner::editor::internal::DrawFillStrokeSwatch (ImDrawList *drawList, const ImVec2 &min, const ImVec2 &max, const ToolbarPaintSlotState &state, bool fillRole, bool active)
 Draw a paint swatch. fillRole determines the solid Fill versus hollow Stroke motif, independently of active foreground status. Handles the none (red slash) and custom (diagonal hatch) presentations.
void donner::editor::internal::DrawSwapAffordance (ImDrawList *drawList, const ImVec2 &min, const ImVec2 &max, bool enabled)
 Draw the swap double-arrow affordance.
void donner::editor::internal::DrawNoneAffordance (ImDrawList *drawList, const ImVec2 &min, const ImVec2 &max, bool alreadyNone)
 Draw the single "set none" affordance; alreadyNone brightens it when the active role is already none.
void donner::editor::internal::DrawFillStrokeWidget (ImDrawList *drawList, const FillStrokeWidgetLayout &layout, const ToolbarPaintState &paintState, bool fillIsActive, bool canEdit)
 Draw both fixed paint roles in foreground order with their shared controls and optional custom-paint chips.

Detailed Description

Geometry, hit-testing, and drawing for the toolbar Fill/Stroke widget.

The widget presents the classic design-tool paired-swatch control: a solid Fill swatch at upper left and a hollow Stroke swatch at lower right. The active role comes to the foreground; one None control clears it. The pure layout/hit-test/paint-string helpers here are unit tested; EditorShell owns the imgui interaction wiring and the color-picker popups.

Enumeration Type Documentation

◆ FillStrokeWidgetRegion

Interactive regions of the Fill/Stroke widget, in hit-test priority order.

Enumerator
None 

No interactive region under the point.

FillSwatch 

Fill swatch: activate Fill or open its color picker.

StrokeSwatch 

Stroke swatch: activate Stroke or open its color picker.

Swap 

Double-arrow affordance: swaps fill and stroke paints.

SetNone 

Clear the active paint role to none.

FillChip 

Fill custom-paint chip: reveals the paint-server source.

StrokeChip 

Stroke custom-paint chip: reveals the paint-server source.

Function Documentation

◆ ResolveFillStrokeWidgetInteractionState()

FillStrokeWidgetInteractionState donner::editor::internal::ResolveFillStrokeWidgetInteractionState ( bool hasDocument,
bool rendererBusy,
bool authoringSuspended,
bool paintSnapshotMatchesSelection )
nodiscard

Resolve safe paint mutation and snapshot refresh.

Renderer availability must not drive chrome tint.

The caller reports whether its snapshot belongs to the current document and first selected element, not merely whether any snapshot exists.

Parameters
hasDocumentWhether the editor currently owns a document.
rendererBusyWhether the async renderer currently owns document access.
authoringSuspendedWhether a canvas gesture or Preview suspends authoring.
paintSnapshotMatchesSelectionWhether the cached paint belongs to the current selection.
Returns
Editability and snapshot-refresh policy for the current toolbar frame.