private void DrawGerber(GerberVBO G, ParsedGerber file, Color C, bool dotted = false) { Pen P = new Pen(C, 1.0f); if (dotted) { P.DashPattern = new float[2] { 2, 2 } } ; SolidBrush B = new SolidBrush(C); //GraphicsPath GP = new GraphicsPath(); var Out = file.IsOutline(); G.Dotted = dotted; int Vbefore = G.VertexCount(); foreach (var a in file.DisplayShapes) { if (a.Vertices.Count > 1) { PointF[] Points = new PointF[a.Vertices.Count]; for (int i = 0; i < a.Vertices.Count; i++) { Points[i] = a.Vertices[i].ToF(); } // GP.AddPolygon(Points); if (Out == false) { G.FillPath(C, Points); // GP = new GraphicsPath(); } else { G.DrawPath(C, Points, 1.0f, true); //G.DrawPath(C, Points, 1.0f); // GP = new GraphicsPath(); } } } if (Out) { } int Vafter = G.VertexCount(); Console.WriteLine("Drawing file: {0} - {1} shapes, {2} vertices", file.Name, file.DisplayShapes.Count, Vafter - Vbefore); }
private void DrawGerbersToGraphicsInterface(PolyLineSet.Bounds Bounds, GerberVBO GGI) { if (Document.Gerbers.Count > 0) { float S = GetScaleAndBuildTransform(GGI, Bounds); if (DispGerb == null) { if (DisplaySide == BoardSide.Bottom) { foreach (var a in Document.Gerbers.OrderByDescending(x => x.sortindex)) { if (a.File.Layer != BoardLayer.Drill) { var C = Color.FromArgb(100, a.Color); if (a.File.Side == BoardSide.Top) { C = MathHelpers.Interpolate(C, Document.Colors.BackgroundColor, 0.4f); } DrawGerber(GGI, a.File, C); } } } else { foreach (var a in Document.Gerbers.OrderBy(x => x.sortindex)) { if (a.File.Layer != BoardLayer.Drill) { var C = a.Color; if (a.File.Side == BoardSide.Bottom) { C = MathHelpers.Interpolate(C, Document.Colors.BackgroundColor, 0.4f); } DrawGerber(GGI, a.File, C); } } } foreach (var a in Document.Gerbers.OrderBy(x => x.sortindex)) { if (a.File.Layer == BoardLayer.Drill) { DrawGerber(GGI, a.File, a.Color); } } } else { foreach (var a in Document.Gerbers.OrderBy(x => x.sortindex)) { if (a.File.Layer == BoardLayer.Outline || a.File.Layer == BoardLayer.Mill) { DrawGerber(GGI, a.File, Color.FromArgb(20, 255, 255, 255), true); } } DrawGerber(GGI, DispGerb.File, Color.White); } } }