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
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...

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 ,
  FillNone ,
  StrokeNone ,
  FillChip ,
  StrokeChip
}
 Interactive regions of the Fill/Stroke widget, in hit-test priority order. More...

Functions

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)
 Classify point against layout. Chip regions only match when the corresponding slot carries custom paint (only then is a chip drawn).
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 front)
 Draw a paint swatch. front draws a solid filled swatch (fill role); a non-front swatch draws a hollow ring (stroke role). 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 fillVariant, bool active)
 Draw a "set none" affordance. fillVariant selects the solid (fill) motif versus the hollow (stroke) motif; active brightens it when the slot is already none.

Detailed Description

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

The widget presents the classic design-tool paired-swatch control: a filled "fill" swatch in front and a hollow "stroke" swatch behind, with per-slot affordances to clear a slot to none and to swap fill and stroke. 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 

Front (fill) swatch: opens the fill color picker.

StrokeSwatch 

Back (stroke) swatch: opens the stroke color picker.

Swap 

Double-arrow affordance: swaps fill and stroke paints.

FillNone 

Fill "set none" affordance.

StrokeNone 

Stroke "set none" affordance.

FillChip 

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

StrokeChip 

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