IRenderContext2D

StockSharp.Xaml.Charting.Rendering.Common

定义接口为 2D RenderContext, 允许在 RenderSurfaceBase 上绘制、 涂抹和创建笔和刷

实现: IDisposable

属性

Layers
public RenderOperationLayers Layers { get; }
value = iRenderContext2D.Layers

获得RenderOperationLayers的集合,可以将渲染操作放入分层的队列,以便后期执行顺序(并正确Z-顺序).

ViewportSize
public Size ViewportSize { get; }
value = iRenderContext2D.ViewportSize

获得当前视图的大小。

方法

BeginLine
public IPathDrawingContext BeginLine(IPen2D pen, double startX, double startY)
result = iRenderContext2D.BeginLine(pen, startX, startY)

开始一个多线段, 返回 IPathDrawingContext 。 这是绘制线条的最快方式, 并且只是 Point 的代理 。

pen
线段的笔
startX
起始 X 坐标( 像素coord)
startY
起始 Y 坐标( 像素coord)

返回值: IPathDrawingContext号继续行驶

BeginPolygon
public IPathDrawingContext BeginPolygon(IBrush2D brush, double startX, double startY, double gradientRotationAngle)
result = iRenderContext2D.BeginPolygon(brush, startX, startY, gradientRotationAngle)

开始一个已填充的多边形段, 返回 IPathDrawingContext 。 这是绘制多边形的最快方式, 并且只是向 Double 方法的代理 。

brush
多边形填充的刷子
startX
起始 X 坐标( 像素coord)
startY
起始 Y 坐标( 像素coord)
gradientRotationAngle
刷子旋转的角度

返回值: IPathDrawingContext 继续多边形

Clear
public void Clear()
iRenderContext2D.Clear()

Clears the IRenderSurface2D

CreateBrush
public IBrush2D CreateBrush(Color color, double opacity, bool? alphaBlend)
result = iRenderContext2D.CreateBrush(color, opacity, alphaBlend)

创建当前渲染通过有效的 IBrush2D。 使用它绘制矩形、 多边形和阴影区域

color
刷子的颜色, 支持透明
opacity
刷子的不透明
alphaBlend
如果为真, 在阴影时使用字母缩写。 如果无效, 自动检测

返回值: IBrush2D 实例

CreateBrush
public IBrush2D CreateBrush(Brush brush, double opacity, TextureMappingMode textureMappingMode)
result = iRenderContext2D.CreateBrush(brush, opacity, textureMappingMode)

创建一个 WPF 刷子的 IBrush2D , 用于当前渲染传出。 使用此选项绘制矩形、 多边形和阴影区域

brush
将 WPF 刷用作源的 e.g 。 它可以是一个,也可以是一个。 请注意, 固态颜色支持透明性, 并且比梯度刷快 。
opacity
刷子的不透明
textureMappingMode
定义 TextureMappingMode 、 e.g. 刷子每个视图口共享纹理或每个原始绘图的新纹理

返回值: IBrush2D 实例

CreatePen
public IPen2D CreatePen(Color color, bool antiAliasing, float strokeThickness, double opacity, double[] strokeDashArray, PenLineCap strokeEndLineCap)
result = iRenderContext2D.CreatePen(color, antiAliasing, strokeThickness, opacity, strokeDashArray, strokeEndLineCap)

创建当前渲染通过有效的 IPen2D。 使用此选项绘制大纲、 四和行

color
笔的颜色, 支持透明
antiAliasing
如果真有,请使用反异名
strokeThickness
中风, 默认为1.0
opacity
笔的活性
strokeDashArray
strokeEndLineCap

返回值: IPen2D 实例

CreateSprite
public ISprite2D CreateSprite(FrameworkElement fe)
result = iRenderContext2D.CreateSprite(fe)

通过渲染到位图来创建 Sprite。 可以在点中使用, 来反复向屏幕绘制 。

fe
DigitMaxSize
public Size DigitMaxSize(float fontSize, string fontFamily, FontWeight fontWeight)
result = iRenderContext2D.DigitMaxSize(fontSize, fontFamily, fontWeight)

最大数字大小, 像素

DisposeResourceAfterDraw
public void DisposeResourceAfterDraw(IDisposable disposable)
iRenderContext2D.DisposeResourceAfterDraw(disposable)

调用这种方法, 在可处理实例中通过, 以在完成渲染后处理 。 由 Ultrachart 内部调用, 以懒惰的方式处理 Direct2D 和 Direct3D 刷和纹理

disposable
DrawEllipse
public void DrawEllipse(IPen2D strokePen, IBrush2D fillBrush, Point center, double width, double height)
iRenderContext2D.DrawEllipse(strokePen, fillBrush, center, width, height)

使用指定的 IPen2D 大纲绘制 IRenderSurface2D 上的椭圆并填入 IBrush2D

strokePen
中风笔
fillBrush
刷子上画的
center
椭圆中心以像素表示
width
椭圆以像素表示的宽度
height
椭圆高度, 像素
DrawEllipses
public void DrawEllipses(IPen2D strokePen, IBrush2D fillBrush, IEnumerable<Point> centres, double width, double height)
iRenderContext2D.DrawEllipses(strokePen, fillBrush, centres, width, height)

在宽度、高度、笔和刷子相同的点上绘制 0.N 椭圆

strokePen
fillBrush
centres
绘制椭圆的点数
width
所有椭圆的通宽度
height
所有椭圆的通用高度
DrawLine
public void DrawLine(IPen2D pen, Point pt1, Point pt2)
iRenderContext2D.DrawLine(pen, pt1, pt2)

使用指定的 IPen2D 在 IRenderSurface2D 上绘制一行。 在一些光栅喷发器中, 需要更快的操作, 请使用 DrawLines 以可假设方式通过 。

pen
pt1
线条的起始像素
pt2
线的结束, 以像素为单位
DrawLines
public void DrawLines(IPen2D pen, IEnumerable<Point> points)
iRenderContext2D.DrawLines(pen, points)

使用指定的 IPen2D 在 IRenderSurface2D 上绘制多点线

pen
points
要点

返回值: 绘制多线的最后一点

DrawPixelsVertically
public void DrawPixelsVertically(int x, int yStartBottom, int yEndTop, IList<int> pixelColorsArgb, double opacity, bool yAxisIsFlipped)
iRenderContext2D.DrawPixelsVertically(x, yStartBottom, yEndTop, pixelColorsArgb, opacity, yAxisIsFlipped)

从下到上绘制取暖图的垂直扫描线,从% yStart+++到% yEnd++++

x
屏幕 X 坐标到何处绘制像素
yStartBottom
垂直扫描行底部的屏幕 Y 坐标。 可以定位可见区域外, 在此情况下, 列表中并非所有像素都得到 。
yEndTop
屏幕 Y 垂直扫描线上方坐标。 可以定位可见区域外, 此处不提供列表中的所有像素
pixelColorsArgb
要绘制的像素颜色列表
opacity
由 0.0 到 1.0 的线条不透明
yAxisIsFlipped
如果设置为真,则将 Y 轴翻转。
DrawQuad
public void DrawQuad(IPen2D pen, Point pt1, Point pt2)
iRenderContext2D.DrawQuad(pen, pt1, pt2)

使用指定的 IPen2D 在 IRenderSurface2D 上绘制一个 Quad

pen
笔会
pt1
四进制中的左上角点
pt2
四方右下点
DrawSprite
public void DrawSprite(ISprite2D srcSprite, Rect srcRect, Point destPoint)
iRenderContext2D.DrawSprite(srcSprite, srcRect, destPoint)

将源图像打碎到 IRenderSurface2D 上

srcSprite
要渲染的源图示
srcRect
源矩形
destPoint
目的地, 这将是闪烁后图示左上角坐标
DrawSprites
public void DrawSprites(ISprite2D sprite2D, IEnumerable<Rect> dstRects)
iRenderContext2D.DrawSprites(sprite2D, dstRects)

将源图示的批量绘图到 IRenderSurface2D

sprite2D
拟制成的图案
dstRects
目的地矩形以图示绘制于
DrawSprites
public void DrawSprites(ISprite2D sprite2D, Rect srcRect, IEnumerable<Point> points)
iRenderContext2D.DrawSprites(sprite2D, srcRect, points)

将源图示的批量绘图到 IRenderSurface2D

sprite2D
拟制成的图案
srcRect
源矩形
points
要绘制的点数
DrawText
public void DrawText(string text, Rect dstBoundingRect, AlignmentX alignX, AlignmentY alignY, Color foreColor, float fontSize, string fontFamily, FontWeight fontWeight)
iRenderContext2D.DrawText(text, dstBoundingRect, alignX, alignY, foreColor, fontSize, fontFamily, fontWeight)

如果文字不外出, 则绘制文字

DrawText
public void DrawText(string text, Point basePoint, AlignmentX alignX, AlignmentY alignY, Color foreColor, float fontSize, string fontFamily, FontWeight fontWeight)
iRenderContext2D.DrawText(text, basePoint, alignX, alignY, foreColor, fontSize, fontFamily, fontWeight)

绘制相对于基准点的文字

FillArea
public void FillArea(IBrush2D brush, IEnumerable<Tuple<Point, Point>> lines, bool isVerticalChart, double gradientRotationAngle)
iRenderContext2D.FillArea(brush, lines, isVerticalChart, gradientRotationAngle)

填入一个定义了点和高地的区域, e.g. 如山地图, 使用 Specifie IBrush2D

brush
刷子 刷子 刷子
lines
isVerticalChart
值,表示图表是否为垂直
gradientRotationAngle
刷子旋转的角度
FillPolygon
public void FillPolygon(IBrush2D brush, IEnumerable<Point> points)
iRenderContext2D.FillPolygon(brush, points)

使用 Specifie IBrush2D 填入 IRenderSurface2D 上的多边形

brush
刷子 刷子 刷子
points
定义闭合多边形的点列表, X, Y 以顺时针方向坐标
FillRectangle
public void FillRectangle(IBrush2D brush, Point pt1, Point pt2, double gradientRotationAngle)
iRenderContext2D.FillRectangle(brush, pt1, pt2, gradientRotationAngle)

使用指定的 IBrush2D 填入 IRenderSurface2D 上的矩形

brush
刷子 刷子 刷子
pt2
矩形左上角点
pt1
矩形的右下角点
gradientRotationAngle
刷子旋转的角度, 默认为 0
SetPrimitvesCachingEnabled
public void SetPrimitvesCachingEnabled(bool bEnabled)
iRenderContext2D.SetPrimitvesCachingEnabled(bEnabled)

允许/ 允许 primites 硬盘优化( 仅直接3D 渲染器)

TextDrawDimensions
public void TextDrawDimensions(string text, float fontSize, Color foreColor, float width, float height, string fontFamily, FontWeight fontWeight)
iRenderContext2D.TextDrawDimensions(text, fontSize, foreColor, width, height, fontFamily, fontWeight)

计算绘制文本所需的空间