Class RenderTargetAdapter
Implementation of IRenderTarget that provides mode-aware temporary visual rendering for interaction states.
This adapter automatically selects the correct container and coordinate space:
- Visual Tree mode: MainCanvas with canvas coordinates (MatrixTransform handles viewport)
- Direct Rendering mode: RootPanel with viewport coordinates (self-transformed)
public sealed class RenderTargetAdapter : IRenderTarget
- Inheritance
-
RenderTargetAdapter
- Implements
- Inherited Members
Constructors
RenderTargetAdapter(ViewportState, Panel?, Canvas?, DirectCanvasRenderer?)
Creates a new RenderTargetAdapter.
public RenderTargetAdapter(ViewportState viewport, Panel? rootPanel, Canvas? mainCanvas, DirectCanvasRenderer? directRenderer)
Parameters
viewportViewportStaterootPanelPanelmainCanvasCanvasdirectRendererDirectCanvasRenderer
Properties
IsDirectRenderingMode
Whether we're currently in Direct Rendering mode.
public bool IsDirectRenderingMode { get; }
Property Value
Methods
CreateConnectionPreview(CanvasPoint, CanvasPoint, IBrush, double, double[]?)
Creates a temporary bezier connection line for previewing connections.
The line is styled with dashed strokes and reduced opacity to indicate it's a preview rather than a committed connection.
public IConnectionPreviewHandle CreateConnectionPreview(CanvasPoint start, CanvasPoint end, IBrush stroke, double strokeThickness, double[]? dashArray = null)
Parameters
startCanvasPointStart point in canvas coordinates (port position).
endCanvasPointEnd point in canvas coordinates (cursor or snap target).
strokeIBrushStroke brush for the line.
strokeThicknessdoubleStroke thickness (in screen pixels, not canvas units).
dashArraydouble[]Optional dash pattern. Defaults to [5, 3] for preview style.
Returns
- IConnectionPreviewHandle
A handle that can be used to update or dispose the preview line.
CreateSelectionBox(CanvasRect, IBrush?, IBrush, double)
Creates a temporary selection rectangle.
Used during box selection to show the selection area.
public ISelectionBoxHandle CreateSelectionBox(CanvasRect bounds, IBrush? fill, IBrush stroke, double strokeThickness)
Parameters
boundsCanvasRectRectangle bounds in canvas coordinates.
fillIBrushOptional fill brush (typically semi-transparent).
strokeIBrushStroke brush for the border.
strokeThicknessdoubleBorder thickness (in screen pixels).
Returns
- ISelectionBoxHandle
A handle that can be used to update or dispose the selection box.
Invalidate()
Invalidates the render target, triggering a redraw.
In Visual Tree mode, this may do nothing (elements update automatically). In Direct Rendering mode, this calls InvalidateVisual() on the renderer.
public void Invalidate()