public void AddPathSegment(StreamGeometryContext canvasPathBuilder, ref bool closed) { canvasPathBuilder.CubicBezierTo( new Point(_control1.X, _control1.Y), new Point(_control2.X, _control2.Y), new Point(_vertex.X, _vertex.Y) ); closed = false; }
protected internal override void ApplyTo(StreamGeometryContext ctx) { ctx.CubicBezierTo(Point1, Point2, Point3); }
private void DrawEllipsesByStreamGeometry( IList <OxyRect> rects, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray, LineJoin lineJoin) { const double ratio = 0.55228475; // (Math.Sqrt(2) - 1.0) * 4.0 / 3.0; Path path = null; StreamGeometry streamGeometry = null; StreamGeometryContext sgc = null; var count = 0; bool isSolid = !fill.IsUndefined(); IBrush cachedBrush = null; if (isSolid) { cachedBrush = GetCachedBrush(fill); } foreach (var rect in rects) { if (path == null) { path = CreateAndAdd <Path>(); SetStroke(path, stroke, thickness, edgeRenderingMode, lineJoin, dashArray, 0); if (isSolid) { path.Fill = cachedBrush; } streamGeometry = new StreamGeometry(); sgc = streamGeometry.Open(); sgc.SetFillRule(FillRule.NonZero); } var a = rect.Width / 2.0; var b = rect.Height / 2.0; var x0 = rect.Center.X - a; var x1 = rect.Center.X - a * ratio; var x2 = rect.Center.X; var x3 = rect.Center.X + a * ratio; var x4 = rect.Center.X + a; var y0 = rect.Center.Y - b; var y1 = rect.Center.Y - b * ratio; var y2 = rect.Center.Y; var y3 = rect.Center.Y + b * ratio; var y4 = rect.Center.Y + b; sgc.BeginFigure(new Point(x2, y0), isSolid); sgc.CubicBezierTo(new Point(x3, y0), new Point(x4, y1), new Point(x4, y2)); sgc.CubicBezierTo(new Point(x4, y3), new Point(x3, y4), new Point(x2, y4)); sgc.CubicBezierTo(new Point(x1, y4), new Point(x0, y3), new Point(x0, y2)); sgc.CubicBezierTo(new Point(x0, y1), new Point(x1, y0), new Point(x2, y0)); sgc.EndFigure(true); count++; // Must limit the number of figures, otherwise drawing errors... if (count > MaxFiguresPerGeometry) { sgc.Dispose(); path.Data = streamGeometry; path = null; count = 0; } } if (path != null) { sgc.Dispose(); path.Data = streamGeometry; } }
public override void Curve4(float x1, float y1, float x2, float y2, float x3, float y3) => _context.CubicBezierTo(new Point(x1, y1), new Point(x2, y2), new Point(x3, y3));