protected override void CalculatePaths( FractalPath initialPath, IList <FractalPath> paths, IFractalSettings settings, CancellationToken cancellationToken) { this.AddBranches( paths, initialPath.GetFirstPoint(), initialPath.GetSecondPoint(), (int)initialPath.Value, settings.MaxIterations, cancellationToken); }
private static void DrawPath(FractalPath path, Color color, FastBitmap fastBitmap, PenCache pens, LazyGraphics lazyGraphics) { if (path.IsPixel) { var point = path.GetFirstPoint(); fastBitmap.SetPixel((int)point.X, (int)point.Y, color); return; } var pen = pens.GetOrCreatePen(color); if (path.IsLine) { lazyGraphics.Value.DrawLine(pen, path.GetFirstPoint().ToDrawingPoint(), path.GetSecondPoint().ToDrawingPoint()); return; } for (var i = 0; i < path.Points.Length - 1; i++) { lazyGraphics.Value.DrawLine(pen, path.Points[i].ToDrawingPoint(), path.Points[i + 1].ToDrawingPoint()); } }