public void LineTo(PDFPoint end) { PathLineData line = new PathLineData(); line.LineTo = end; CurrentPath.Add(line); IncludeInBounds(end); Cursor = end; }
public void HorizontalLineFor(PDFUnit dx) { PathLineData line = new PathLineData(); PDFPoint end = ConvertDeltaToActual(dx, 0); line.LineTo = end; CurrentPath.Add(line); IncludeInBounds(end); Cursor = end; }
public void HorizontalLineTo(PDFUnit x) { PathLineData line = new PathLineData(); PDFPoint end = new PDFPoint(x, this.Cursor.Y); line.LineTo = end; CurrentPath.Add(line); IncludeInBounds(end); Cursor = end; }
public void VerticalLineTo(PDFUnit y) { PathLineData line = new PathLineData(); PDFPoint end = new PDFPoint(this.Cursor.X, y); line.LineTo = end; CurrentPath.Add(line); IncludeInBounds(end); Cursor = end; }
public void LineFor(PDFPoint delta) { PathLineData line = new PathLineData(); PDFPoint end = ConvertDeltaToActual(delta); line.LineTo = end; CurrentPath.Add(line); IncludeInBounds(end); Cursor = end; }
private void RenderPathOp(PathData data, PDFPoint location, ref PDFPoint cursor) { switch (data.Type) { case PathDataType.Move: PathMoveData move = (PathMoveData)data; cursor = move.MoveTo; this.RenderMoveTo(move.MoveTo.X + location.X, move.MoveTo.Y + location.Y); break; case PathDataType.Line: PathLineData line = (PathLineData)data; cursor = line.LineTo; this.RenderLineTo(line.LineTo.X + location.X, line.LineTo.Y + location.Y); break; case PathDataType.Rect: PathRectData rect = (PathRectData)data; cursor = rect.Rect.Location; this.RenderRectangle(rect.Rect.X + location.X, rect.Rect.Y + location.Y, rect.Rect.Width, rect.Rect.Height); break; case PathDataType.SubPath: PathSubPathData sub = (PathSubPathData)data; this.RenderPathData(location, sub.InnerPath, ref cursor); break; case PathDataType.Bezier: PathBezierCurveData bez = (PathBezierCurveData)data; cursor = bez.EndPoint; if (bez.HasStartHandle && bez.HasEndHandle) { this.RenderBezierCurveTo(bez.EndPoint.X + location.X, bez.EndPoint.Y + location.Y, bez.StartHandle.X + location.X, bez.StartHandle.Y + location.Y, bez.EndHandle.X + location.X, bez.EndHandle.Y + location.Y); } else if (bez.HasStartHandle) { this.RenderBezierCurveToWithStartHandleOnly(bez.EndPoint.X + location.X, bez.EndPoint.Y + location.Y, bez.StartHandle.X + location.X, bez.StartHandle.Y + location.Y); } else if (bez.HasEndHandle) { this.RenderBezierCurveToWithEndHandleOnly(bez.EndPoint.X + location.X, bez.EndPoint.Y + location.Y, bez.EndHandle.X + location.X, bez.EndHandle.Y + location.Y); } else { this.RenderLineTo(bez.Points[2].X, bez.Points[2].Y); } break; case PathDataType.Arc: IEnumerable <PathBezierCurveData> segments; PathArcData arc = (PathArcData)data; segments = PathDataHelper.GetBezierCurvesForArc(cursor, arc); foreach (PathBezierCurveData segment in segments) { this.RenderBezierCurveTo(segment.EndPoint.X + location.X, segment.EndPoint.Y + location.Y, segment.StartHandle.X + location.X, segment.StartHandle.Y + location.Y, segment.EndHandle.X + location.X, segment.EndHandle.Y + location.Y); } cursor = arc.EndPoint; break; case PathDataType.Quadratic: IEnumerable <PathBezierCurveData> quadSegments; PathQuadraticCurve quad = (PathQuadraticCurve)data; quadSegments = PathDataHelper.GetBezierCurvesForQuadratic(cursor, quad); foreach (PathBezierCurveData quadSeg in quadSegments) { this.RenderBezierCurveTo(quadSeg.EndPoint.X + location.X, quadSeg.EndPoint.Y + location.Y, quadSeg.StartHandle.X + location.X, quadSeg.StartHandle.Y + location.Y, quadSeg.EndHandle.X + location.X, quadSeg.EndHandle.Y + location.Y); } cursor = quad.EndPoint; break; case PathDataType.Close: this.RenderClosePathOp(); cursor = PDFPoint.Empty; break; default: throw new ArgumentOutOfRangeException("data.Type"); } }