本文整理汇总了C#中Microsoft.Graphics.Canvas.CanvasDrawingSession.DrawCircle方法的典型用法代码示例。如果您正苦于以下问题:C# CanvasDrawingSession.DrawCircle方法的具体用法?C# CanvasDrawingSession.DrawCircle怎么用?C# CanvasDrawingSession.DrawCircle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Graphics.Canvas.CanvasDrawingSession
的用法示例。
在下文中一共展示了CanvasDrawingSession.DrawCircle方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawNode
private void DrawNode(CanvasDrawingSession ds, Node node)
{
ds.FillCircle(node.Position, hitTestRadius, backgroundColor);
ds.DrawCircle(node.Position, hitTestRadius, foregroundColor, 4);
ds.DrawText(node.Name, node.Position, foregroundColor, textFormat);
}
示例2: DrawDryInk_LinesMethod
private void DrawDryInk_LinesMethod(CanvasDrawingSession ds, IReadOnlyList<InkStroke> strokes)
{
//
// This shows off the fact that apps can use the custom drying path
// to render dry ink using Win2D, and not necessarily
// rely on the built-in rendering in CanvasDrawingSession.DrawInk.
//
foreach (var stroke in strokes)
{
var color = stroke.DrawingAttributes.Color;
var inkPoints = stroke.GetInkPoints().Select(point => point.Position.ToVector2()).ToList();
for (int i = 1; i < inkPoints.Count; i++)
{
ds.DrawLine(inkPoints[i - 1], inkPoints[i], color);
ds.DrawCircle(inkPoints[i], 3, color);
}
}
}
示例3: DrawCircle
private void DrawCircle(CanvasControl sender, CanvasDrawingSession ds)
{
var width = (float) sender.ActualWidth;
var height = (float) sender.ActualHeight;
var stroke = this.defaultStroke;
var radius = Math.Min(width, height) / 2 - stroke;
var center = new Vector2(width / 2, height / 2);
ds.FillCircle(center, radius, ForegroundColor);
ds.DrawCircle(center, radius, GlowColor, stroke);
}
示例4: DrawCircles
private void DrawCircles(CanvasControl sender, CanvasDrawingSession ds)
{
float width = (float)sender.ActualWidth;
float height = (float)sender.ActualHeight;
float endpointMargin = Math.Min(width, height) / 8;
float controlMarginX = endpointMargin * 4;
float controlMarginY = endpointMargin * 2;
for (int i = 0; i < 25; i++)
{
Vector2[] bez = new Vector2[4];
int n = (i * 24) + 9 - (i / 2);
for (int k = 0; k < 3; k++)
{
int j = 4 - (2 * k);
bez[k].X = (0 + (((n >> (j + 1)) & 1) * (width - controlMarginX)));
bez[k].Y = (0 + (((n >> j) & 1) * (height - controlMarginY)));
}
bez[3].X = width - endpointMargin; // Collect the ends in the lower right
bez[3].Y = height - endpointMargin;
const int nSteps = 80;
const float tStep = 1.0f / nSteps;
float t = 0;
for (int step = 0; step < nSteps; step++)
{
float s = 1 - t;
float ss = s * s;
float sss = ss * s;
float tt = t * t;
float ttt = tt * t;
float x = (sss * bez[0].X) + (3 * ss * t * bez[1].X) + (3 * s * tt * bez[2].X) + (ttt * bez[3].X);
float y = (sss * bez[0].Y) + (3 * ss * t * bez[1].Y) + (3 * s * tt * bez[2].Y) + (ttt * bez[3].Y);
float radius = ttt * endpointMargin;
float strokeWidth = (0.5f - Math.Abs(ss - 0.5f)) * 10;
ds.DrawCircle(x, y, radius, GradientColor(t), strokeWidth);
t += tStep;
}
}
}
示例5: DrawContactPoints
void DrawContactPoints(CanvasDrawingSession ds)
{
foreach (var entry in currentPointsInContact)
{
ds.DrawCircle(entry.Value.ToVector2(), 20, Colors.Red);
}
}
示例6: DrawDryInk_CustomGeometryMethod
private void DrawDryInk_CustomGeometryMethod(CanvasDrawingSession ds, IReadOnlyList<InkStroke> strokes)
{
//
// This shows off the fact that apps can use the custom drying path
// to render dry ink using Win2D, and not necessarily
// rely on the built-in rendering in CanvasDrawingSession.DrawInk.
//
foreach (var stroke in strokes)
{
var color = stroke.DrawingAttributes.Color;
var inkPoints = stroke.GetInkPoints();
if (inkPoints.Count > 0)
{
CanvasPathBuilder pathBuilder = new CanvasPathBuilder(canvasControl);
pathBuilder.BeginFigure(inkPoints[0].Position.ToVector2());
for (int i = 1; i < inkPoints.Count; i++)
{
pathBuilder.AddLine(inkPoints[i].Position.ToVector2());
ds.DrawCircle(inkPoints[i].Position.ToVector2(), 3, color);
}
pathBuilder.EndFigure(CanvasFigureLoop.Open);
CanvasGeometry geometry = CanvasGeometry.CreatePath(pathBuilder);
ds.DrawGeometry(geometry, color);
}
}
}
示例7: Draw
public void Draw(CanvasDrawingSession ds, float alpha = 1)
{
// Create a drop shadow by drawing a black circle with an offset position.
const float dropShadowOffset = 4;
ds.FillCircle(Position + new Vector2(dropShadowOffset), Radius, AdjustAlpha(Colors.Black, alpha));
// Draw a white X.
const float crossWidth = 3;
float crossSize = Radius * 0.8f;
Vector2 cross1 = new Vector2(crossSize, crossSize);
Vector2 cross2 = new Vector2(crossSize, -crossSize);
ds.DrawLine(Position - cross1, Position + cross1, AdjustAlpha(Colors.White, alpha), crossWidth);
ds.DrawLine(Position - cross2, Position + cross2, AdjustAlpha(Colors.White, alpha), crossWidth);
// Fill the circle with its unique color.
ds.FillCircle(Position, Radius, AdjustAlpha(color, alpha));
// White border around it.
ds.DrawCircle(Position, Radius, AdjustAlpha(Colors.White, alpha));
// Text label.
ds.DrawText(label, Position, AdjustAlpha(Colors.White, alpha), textFormat);
}