I have an InkCanvas. I need to a Circle draw as InkStroke.
I know, i can a Circle or Ellipse draw with InkAnalyzer, but i need that Circle as InkStroke in InkCanvas, not in Canvas and i don't want to the protractor use.
I need somehow a right one Circle draw.
For a straight Line developed i this code;
private void StrokeInput_StrokeEnded(InkStrokeInput sender, PointerEventArgs args)
{
List<InkPoint> points = new List<InkPoint>();
InkStrokeBuilder builder = new InkStrokeBuilder();
InkPoint pointOne = new InkPoint(new Point(line.X1, line.Y1), 0.5f);
points.Add(pointOne);
InkPoint pointTwo = new InkPoint(new Point(line.X2, line.Y2), 0.5f);
points.Add(pointTwo);
InkStroke stroke = builder.CreateStrokeFromInkPoints(points, System.Numerics.Matrix3x2.Identity);
InkDrawingAttributes ida = inkCanvas.InkPresenter.CopyDefaultDrawingAttributes();
stroke.DrawingAttributes = ida;
inkCanvas.InkPresenter.StrokeContainer.AddStroke(stroke);
}
private void StrokeInput_StrokeContinued(InkStrokeInput sender, PointerEventArgs args)
{
line.X2 = args.CurrentPoint.RawPosition.X;
line.Y2 = args.CurrentPoint.RawPosition.Y;
}
private void StrokeInput_StrokeStarted(InkStrokeInput sender, PointerEventArgs args)
{
line = new Line();
line.X1 = args.CurrentPoint.RawPosition.X;
line.Y1 = args.CurrentPoint.RawPosition.Y;
line.X2 = args.CurrentPoint.RawPosition.X;
line.Y2 = args.CurrentPoint.RawPosition.Y;
line.Stroke = new SolidColorBrush(Colors.Purple);
line.StrokeThickness = 4;
}
How can i this Code to adjust for a Circle? Or how can i draw a Circle?
Thank you,