RenderSurfaceBase
An abstract base class for the RenderSurface, which is a viewport used within the to render BaseRenderableSeries types in a fast manner. The renderer architecture is plugin based, meaning we have build multiple implementations of RenderSurfaceBase.
Inherits: ContentControl
Implements: IRenderSurface2D, IRenderSurface, IDisposable, IHitTestable, IInvalidatableElement
Constructors
protected RenderSurfaceBase()
renderSurfaceBase = RenderSurfaceBase()
Initializes a new instance of the RenderSurfaceBase class.
Properties
public ReadOnlyCollection<IRenderableSeries> ChildSeries { get; }
value = renderSurfaceBase.ChildSeries
Gets the child RenderableSeries in this IRenderSurface2D instance
public Grid Grid { get; }
value = renderSurfaceBase.Grid
Gets the root element Grid which hosts components in the RenderSurfaceBase
public virtual bool IsSizeValidForDrawing { get; }
value = renderSurfaceBase.IsSizeValidForDrawing
Returns true if the RenderSurfaceBase size is valid for drawing
public double? MaxFrameRate { get; set; }
value = renderSurfaceBase.MaxFrameRate
renderSurfaceBase.MaxFrameRate = value
Gets or sets the Maximum Framerate of this RenderSurface. By default this is bound to the parent UltrachartSurface.MaxFrameRate
public virtual bool NeedsResizing { get; }
value = renderSurfaceBase.NeedsResizing
Returns True if the RenderSurfaceBase size has changed and the viewport needs resizing
public int ResizeThrottleMs { get; set; }
value = renderSurfaceBase.ResizeThrottleMs
renderSurfaceBase.ResizeThrottleMs = value
Gets or sets a timeout for resizing, e.g. 100ms means that the RenderSurface will batch up all Resize events received within a 100ms window. This reduces the CPU usage on resize. Also see UseResizeThrottle dependency property, which must be true
public IServiceContainer Services { get; set; }
value = renderSurfaceBase.Services
renderSurfaceBase.Services = value
Gets or sets the IServiceContainer instance
public bool UseResizeThrottle { get; set; }
value = renderSurfaceBase.UseResizeThrottle
renderSurfaceBase.UseResizeThrottle = value
If true, uses the ResizeThrottleMs value to batch up Resize Events received within a certain time window, reducing the CPU load on resize
Methods
public void AddSeries(IRenderableSeries renderableSeries)
renderSurfaceBase.AddSeries(renderableSeries)
Adds the IRenderableSeries instance to the RenderSurfaceBase
- renderableSeries
- The renderable series.
public void AddSeries(IEnumerable<IRenderableSeries> renderableSeries)
renderSurfaceBase.AddSeries(renderableSeries)
Adds the IRenderableSeries instance to the IRenderSurface2D
- renderableSeries
public virtual void ClearSeries()
renderSurfaceBase.ClearSeries()
Clears all IRenderableSeries on the RenderSurfaceBase
public bool ContainsSeries(IRenderableSeries renderableSeries)
result = renderSurfaceBase.ContainsSeries(renderableSeries)
Returns True if the RenderSurfaceBase contains the IRenderableSeries instance
- renderableSeries
- the IRenderableSeries instance
Returns: true if the specified renderable series contains series; otherwise, false.
public void Dispose(bool disposing)
renderSurfaceBase.Dispose(disposing)
Releases unmanaged and - optionally - managed resources.
- disposing
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
public void Dispose()
renderSurfaceBase.Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
protected virtual void DisposeUnmanagedResources()
renderSurfaceBase.DisposeUnmanagedResources()
Derived classes may override this method to be notified when to dispose of unmanaged resources. Called when the RenderSurfaceBase is disposed
protected override void Finalize()
renderSurfaceBase.Finalize()
Finalizes an instance of the RenderSurfaceBase class.
public Rect GetBoundsRelativeTo(IHitTestable relativeTo)
result = renderSurfaceBase.GetBoundsRelativeTo(relativeTo)
Gets the bounds of the current IHitTestable element relative to another IHitTestable element
- relativeTo
public abstract IRenderContext2D GetRenderContext()
result = renderSurfaceBase.GetRenderContext()
When overridden in a derived class, returns a RenderContext valid for the current render pass
public static string GetRenderSurfaceType(UIElement element)
result = RenderSurfaceBase.GetRenderSurfaceType(element)
Gets the RenderSurfaceType attached property
- element
- The element.
public void InvalidateElement()
renderSurfaceBase.InvalidateElement()
Invalidates the RenderSurface, causing a repaint to occur
public bool IsPointWithinBounds(Point point)
result = renderSurfaceBase.IsPointWithinBounds(point)
Returns true if the Point is within the bounds of the current IHitTestable element
- point
- The point to test
Returns: true if the Point is within the bounds
protected virtual void OnDraw()
renderSurfaceBase.OnDraw()
Raises the DrawDraw event which preceeds the render operation
protected virtual void OnRendered(double duration)
renderSurfaceBase.OnRendered(duration)
Raises the Rendered event with the specified duration
- duration
- The duration.
protected virtual void OnRenderSurfaceBaseLoaded(object sender, RoutedEventArgs e)
renderSurfaceBase.OnRenderSurfaceBaseLoaded(sender, e)
Called when the RenderSurfaceBase is loaded into the visual tree
- sender
- The sender.
- e
- The RoutedEventArgs instance containing the event data.
protected virtual void OnRenderSurfaceBaseUnloaded(object sender, RoutedEventArgs e)
renderSurfaceBase.OnRenderSurfaceBaseUnloaded(sender, e)
Called when the RenderSurfaceBase is Unloaded from the visual tree
- sender
- The sender.
- e
- The RoutedEventArgs instance containing the event data.
protected virtual void OnRenderTimeElapsed()
renderSurfaceBase.OnRenderTimeElapsed()
Called when the Rendering event is raised
protected void PublishResizedMessage(int width, int height)
renderSurfaceBase.PublishResizedMessage(width, height)
Publishes RenderSurfaceResizedMessage with actual viewport size
- width
- height
public virtual void RecreateSurface()
renderSurfaceBase.RecreateSurface()
Recreates the elements required by the Viewport, called once at startup and when the surface is resized
public void RemoveSeries(IRenderableSeries renderableSeries)
renderSurfaceBase.RemoveSeries(renderableSeries)
Removes the IRenderableSeries from the RenderSurfaceBase
- renderableSeries
- The renderable series.
public static void SetRenderSurfaceType(UIElement element, string value)
RenderSurfaceBase.SetRenderSurfaceType(element, value)
Sets the RenderSurfaceType attached property
- element
- The element.
- value
- The value.
public Point TranslatePoint(Point point, IHitTestable relativeTo)
result = renderSurfaceBase.TranslatePoint(point, relativeTo)
Translates the point relative to the other IHitTestable element
- point
- The input point relative to this IHitTestable
- relativeTo
- The other IHitTestable to use when transforming the point
Returns: The transformed Point
Events
public event EventHandler<DrawEventArgs> Draw
renderSurfaceBase.Draw += handler
Raised each time the render surface is to be drawn. Handle this event to paint to the surface
public event EventHandler<RenderedEventArgs> Rendered
renderSurfaceBase.Rendered += handler
Raised immediately after a render operation has completed
Fields
public static readonly DependencyProperty MaxFrameRateProperty
value = RenderSurfaceBase.MaxFrameRateProperty
Defines the MaxFrameRate DependencyProperty
public static readonly DependencyProperty RenderSurfaceTypeProperty
value = RenderSurfaceBase.RenderSurfaceTypeProperty
Defines the RenderSurfaceType attached property
public static readonly DependencyProperty ResizeThrottleMsProperty
value = RenderSurfaceBase.ResizeThrottleMsProperty
Defines the ResizeThrottleMs DependencyProperty
public static readonly DependencyProperty UseResizeThrottleProperty
value = RenderSurfaceBase.UseResizeThrottleProperty
Defines the UseResizeThrottle DependencyProperty