/// <summary> /// Draws a collection of paths with the given colors onto the image. /// </summary> private void DrawColoredPaths(Image <Rgba32> image, IPathCollection paths) { IEnumerator <IPath> pathEnumerator = paths.GetEnumerator(); int i = 0; while (pathEnumerator.MoveNext()) { IPath path = pathEnumerator.Current; image.Mutate(x => x.Fill(DrawingOptions, Color.White, path)); i++; } }
/// <summary> /// Draws a collection of paths with the given colors onto the image. /// </summary> private void DrawColoredPaths(Image <Rgba32> image, IPathCollection paths, Color?[] pathColors) { IEnumerator <IPath> pathEnumerator = paths.GetEnumerator(); int i = 0; while (pathEnumerator.MoveNext()) { IPath path = pathEnumerator.Current; Color color = (pathColors != null && i < pathColors.Length && pathColors[i].HasValue) ? pathColors[i].Value : DefaultGlyphColor; image.Mutate(x => x.Fill(ShapeGraphicsOptions, color, path)); i++; } }