RenderContextBase
Defines the base class for IRenderContext2D implementors, allowing drawing, blitting and creation of pens and brushes on the RenderSurfaceBase
Implements: IRenderContext2D, IDisposable
Properties
public abstract RenderOperationLayers Layers { get; }
value = renderContextBase.Layers
Gets a collection of RenderOperationLayer layers, which allow rendering operations to be posted to a layered queue for later execution in order (and correct Z-ordering).
public abstract Size ViewportSize { get; }
value = renderContextBase.ViewportSize
Gets the size of the current viewport for this render operation
Methods
public abstract IPathDrawingContext BeginLine(IPen2D pen, double startX, double startY)
result = renderContextBase.BeginLine(pen, startX, startY)
Begins a Polyline segment, returning the IPathDrawingContext. This is the fastest way to draw lines and simply a proxy to Point}) method.
- pen
- The pen for the line segment
- startX
- The start X coordinate (pixel coord)
- startY
- The start Y coordinate (pixel coord)
Returns: The IPathDrawingContext to continue the line
public abstract IPathDrawingContext BeginPolygon(IBrush2D brush, double startX, double startY, double gradientRotationAngle)
result = renderContextBase.BeginPolygon(brush, startX, startY, gradientRotationAngle)
Begins a filled Polygon segment, returning the IPathDrawingContext. This is the fastest way to draw polygon and simply a proxy to Double) method.
- brush
- The brush for the polygon fill
- startX
- The start X coordinate (pixel coord)
- startY
- The start Y coordinate (pixel coord)
- gradientRotationAngle
- The angle which the brush is rotated by
Returns: The IPathDrawingContext to continue the polygon
protected IEnumerable<Point> ClipArea(IEnumerable<Tuple<Point, Point>> lines)
result = renderContextBase.ClipArea(lines)
Used internally to clip the area of a StackedMountainSeries to the viewport
- lines
- Collection of lines, which represent bounds of a polygon segment
protected IEnumerable<Point> ClipArea(IEnumerable<Point> points, int xExtension, int yExtension)
result = renderContextBase.ClipArea(points, xExtension, yExtension)
Used internally to clip a polygon or line-segment to the viewport
internal static bool ClipLine(Point pt1, Point pt2, Size viewportSize)
result = RenderContextBase.ClipLine(pt1, pt2, viewportSize)
Returns: false if line is outside of visible area
protected double ClipZeroLineForArea(double zeroLine, bool isVerticalChart)
result = renderContextBase.ClipZeroLineForArea(zeroLine, isVerticalChart)
Used internally: Clips the zero line (e.g. in mountain fills) to the viewport
public abstract IBrush2D CreateBrush(Color color, double opacity, bool? alphaBlend)
result = renderContextBase.CreateBrush(color, opacity, alphaBlend)
Creates a IBrush2D valid for the current render pass. Use this to draw rectangles, polygons and shaded areas
- color
- The color of the brush, supports transparency
- opacity
- The opacity of the brush
- alphaBlend
- If true, use alphablending when shading. If null, auto-detect from the Color
Returns: The IBrush2D instance
public abstract IBrush2D CreateBrush(Brush brush, double opacity, TextureMappingMode textureMappingMode)
result = renderContextBase.CreateBrush(brush, opacity, textureMappingMode)
Creates a IBrush2D from WPF Brush valid for the current render pass. Use this to draw rectangles, polygons and shaded areas
- brush
- The WPF Brush to use as a source, e.g. this can be a , or it can be a . Note that solid colors support transparency and are faster than gradient brushes
- opacity
- The opacity of the brush
- textureMappingMode
Returns: The IBrush2D instance
public abstract IPen2D CreatePen(Color color, bool antiAliasing, float strokeThickness, double opacity, double[] strokeDashArray, PenLineCap strokeEndLineCap)
result = renderContextBase.CreatePen(color, antiAliasing, strokeThickness, opacity, strokeDashArray, strokeEndLineCap)
Creates a IPen2D valid for the current render pass. Use this to draw outlines, quads and lines
- color
- The color of the pen, supports transparency
- antiAliasing
- If true, use antialiasing
- strokeThickness
- The strokethickness, default=1.0
- opacity
- The opecity of the pen
- strokeDashArray
- strokeEndLineCap
Returns: The IPen2D instance
public abstract ISprite2D CreateSprite(FrameworkElement fe)
result = renderContextBase.CreateSprite(fe)
Creates a Sprite from FrameworkElement by rendering to bitmap. This may be used in the Point) method to draw to the screen repeatedly
- fe
public abstract void Dispose()
renderContextBase.Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public abstract void DisposeResourceAfterDraw(IDisposable disposable)
renderContextBase.DisposeResourceAfterDraw(disposable)
Call this method, passing in IDisposable instance to dispose after the render pass completes. Called internally by Ultrachart to lazy-dispose of Direct2D and Direct3D brushes and textures
- disposable
public abstract void DrawEllipse(IPen2D strokePen, IBrush2D fillBrush, Point center, double width, double height)
renderContextBase.DrawEllipse(strokePen, fillBrush, center, width, height)
Draws an Ellipse on the IRenderSurface2D using the specified outline IPen2DPen and fill IBrush2DBrush
- strokePen
- The stroke pen
- fillBrush
- The fill brush
- center
- The center of the ellipse in pixels
- width
- The width of the ellipse in pixels
- height
- The height of the ellipse in pixels
public abstract void DrawEllipses(IPen2D strokePen, IBrush2D fillBrush, IEnumerable<Point> centres, double width, double height)
renderContextBase.DrawEllipses(strokePen, fillBrush, centres, width, height)
Draws 0..N Ellipses at the points passed in with the same width, height, pen and brush
- strokePen
- fillBrush
- centres
- The points to draw ellipses at
- width
- The common width for all ellipses
- height
- The common height for all ellipses
public virtual void DrawLine(IPen2D pen, Point pt1, Point pt2)
renderContextBase.DrawLine(pen, pt1, pt2)
Draws a single line on the IRenderSurface2D using the specified IPen2D. Note for a faster implementation in some rasterizers, use DrawLines
- pen
- The pen
- pt1
- The start of the line in pixels
- pt2
- The end of the line in pixels
public virtual void DrawLines(IPen2D pen, IEnumerable<Point> points)
renderContextBase.DrawLines(pen, points)
Draws a multi-point line on the IRenderSurface2D using the specified IPen2D
- pen
- The pen
- points
- The points.
public abstract void DrawPixelsVertically(int x, int yStartBottom, int yEndTop, IList<int> pixelColorsArgb, double opacity, bool yAxisIsFlipped)
renderContextBase.DrawPixelsVertically(x, yStartBottom, yEndTop, pixelColorsArgb, opacity, yAxisIsFlipped)
Draws vertical scan line for heatmap from bottom to top, from yStart to yEnd
- x
- Screen X coordinate where to draw pixels
- yStartBottom
- Screen Y coordinate of vertical scan line's bottom. Can be located outdide of visible area, in this case not all pixels in list are rendered
- yEndTop
- Screen Y coordinate of vertical scan line's top. Can be located outdide of visible area, in this case not all pixels in list are rendered
- pixelColorsArgb
- The colors to apply to the vertical scanline
- opacity
- The opacity of the vertical scaline, from 0.0 to 1.0
- yAxisIsFlipped
- if set to true then y axis is flipped.
public virtual void DrawQuad(IPen2D pen, Point pt1, Point pt2)
renderContextBase.DrawQuad(pen, pt1, pt2)
Draws a Quad on the IRenderSurface2D using the specified IPen2D
- pen
- The Pen
- pt1
- pt2
public abstract void DrawSprite(ISprite2D srcSprite, Rect srcRect, Point destPoint)
renderContextBase.DrawSprite(srcSprite, srcRect, destPoint)
Blits the source image onto the IRenderSurface2D
- srcSprite
- The source sprite to render
- srcRect
- The source rectangle
- destPoint
- The destination point, which will be the top-left coordinate of the sprite after blitting
public abstract void DrawSprites(ISprite2D sprite2D, Rect srcRect, IEnumerable<Point> points)
renderContextBase.DrawSprites(sprite2D, srcRect, points)
Batch draw of the source sprite onto the IRenderSurface2D
- sprite2D
- The sprite to render
- srcRect
- The source rectangle
- points
- The points to draw sprites at
public abstract void DrawSprites(ISprite2D sprite2D, IEnumerable<Rect> dstRects)
renderContextBase.DrawSprites(sprite2D, dstRects)
Batch draw of the source sprite onto the IRenderSurface2D
- sprite2D
- The sprite to render
- dstRects
- The destination rectangles to draw sprites at
public void DrawText(string text, Rect dstBoundingRect, AlignmentX alignX, AlignmentY alignY, Color foreColor, float fontSize, string fontFamily, FontWeight fontWeight)
renderContextBase.DrawText(text, dstBoundingRect, alignX, alignY, foreColor, fontSize, fontFamily, fontWeight)
Draws text if it does not go outside
- dstBoundingRect
- alignY
- foreColor
- fontSize
- text
- fontFamily
- fontWeight
- alignX
public void DrawText(string text, Point basePoint, AlignmentX alignX, AlignmentY alignY, Color foreColor, float fontSize, string fontFamily, FontWeight fontWeight)
renderContextBase.DrawText(text, basePoint, alignX, alignY, foreColor, fontSize, fontFamily, fontWeight)
Draws text relative to base point
public abstract void FillArea(IBrush2D brush, IEnumerable<Tuple<Point, Point>> lines, bool isVerticalChart, double gradientRotationAngle)
renderContextBase.FillArea(brush, lines, isVerticalChart, gradientRotationAngle)
Fills an area, limited by two line segments, e.g. as in a stacked mountain chart, using the specified IBrush2D
- brush
- The brush
- lines
- The list of lines representing polygon segments
- isVerticalChart
- Value, indicates whether chart is vertical
- gradientRotationAngle
- The angle which the brush is rotated by
public virtual void FillPolygon(IBrush2D brush, IEnumerable<Point> points)
renderContextBase.FillPolygon(brush, points)
Fills a polygon on the IRenderSurface2D using the specifie IBrush2D
- brush
- The brush
- points
- The list of points defining the closed polygon, where X,Y coordinates in clockwise direction
public abstract void FillRectangle(IBrush2D brush, Point pt1, Point pt2, double gradientRotationAngle)
renderContextBase.FillRectangle(brush, pt1, pt2, gradientRotationAngle)
Fills a rectangle on the IRenderSurface2D using the specified IBrush2D
- brush
- The brush
- pt1
- pt2
- gradientRotationAngle
- The angle which the brush is rotated by
protected bool IsInBounds(Point pt)
result = renderContextBase.IsInBounds(pt)
Returns true if the point is inside the viewport
public virtual void SetPrimitvesCachingEnabled(bool bEnabled)
renderContextBase.SetPrimitvesCachingEnabled(bEnabled)
enables/disables primitves chaching optimization ( Direct3D renderer only )