private void AddSmoothCubicBezierCurve(CommandToken commandToken) { var point2 = commandToken.IsRelative ? commandToken.ReadRelativePoint(_currentPoint) : commandToken.ReadPoint(); var end = commandToken.IsRelative ? commandToken.ReadRelativePoint(_currentPoint) : commandToken.ReadPoint(); if (_previousControlPoint != null) { _previousControlPoint = MirrorControlPoint((Point)_previousControlPoint, _currentPoint); } if (_isOpen == null) { CreateFigure(); } _geometryContext.CubicBezierTo(_previousControlPoint ?? _currentPoint, point2, end); _previousControlPoint = point2; _currentPoint = end; }
private void AddCubicBezierCurve(CommandToken commandToken) { var point1 = commandToken.IsRelative ? commandToken.ReadRelativePoint(_currentPoint) : commandToken.ReadPoint(); var point2 = commandToken.IsRelative ? commandToken.ReadRelativePoint(_currentPoint) : commandToken.ReadPoint(); _previousControlPoint = point2; var point3 = commandToken.IsRelative ? commandToken.ReadRelativePoint(_currentPoint) : commandToken.ReadPoint(); if (_isOpen == null) { CreateFigure(); } _geometryContext.CubicBezierTo(point1, point2, point3); _currentPoint = point3; }
private void AddArc(CommandToken commandToken) { var size = commandToken.ReadSize(); var rotationAngle = commandToken.ReadDouble(); var isLargeArc = commandToken.ReadBool(); var sweepDirection = commandToken.ReadBool() ? SweepDirection.Clockwise : SweepDirection.CounterClockwise; var end = commandToken.IsRelative ? commandToken.ReadRelativePoint(_currentPoint) : commandToken.ReadPoint(); if (_isOpen == null) { CreateFigure(); } _geometryContext.ArcTo(end, size, rotationAngle, isLargeArc, sweepDirection); _currentPoint = end; _previousControlPoint = null; }
private void AddMove(CommandToken commandToken) { var currentPoint = commandToken.IsRelative ? commandToken.ReadRelativePoint(_currentPoint) : commandToken.ReadPoint(); _currentPoint = currentPoint; CreateFigure(); if (!commandToken.HasImplicitCommands) { return; } while (commandToken.HasImplicitCommands) { AddLine(commandToken); if (commandToken.IsRelative) { continue; } _currentPoint = currentPoint; CreateFigure(); } }
private void AddQuadraticBezierCurve(CommandToken commandToken) { var start = commandToken.IsRelative ? commandToken.ReadRelativePoint(_currentPoint) : commandToken.ReadPoint(); _previousControlPoint = start; var end = commandToken.IsRelative ? commandToken.ReadRelativePoint(_currentPoint) : commandToken.ReadPoint(); if (_isOpen == null) { CreateFigure(); } _geometryContext.QuadraticBezierTo(start, end); _currentPoint = end; }
private void AddLine(CommandToken commandToken) { _currentPoint = commandToken.IsRelative ? commandToken.ReadRelativePoint(_currentPoint) : commandToken.ReadPoint(); if (_isOpen == null) { CreateFigure(); } _geometryContext.LineTo(_currentPoint); }