void DrawC(PixelFarm.Agg.AggPainter aggPainter) { aggPainter.Clear(PixelFarm.Drawing.Color.White); //-------------------------- aggPainter.StrokeColor = PixelFarm.Drawing.Color.Black; aggPainter.StrokeWidth = 2.0f; if (lineDashGen == null) { //create line dash gen lineDashGen = new LineDashGenerator(); lineDashGen.SetDashPattern(4, 2, 2, 2); } aggPainter.LineDashGen = lineDashGen; // VertexStore vxs = new VertexStore(); PathWriter writer = new PathWriter(vxs); writer.MoveTo(20, 10); writer.LineTo(60, 10); writer.LineTo(20, 200); writer.LineTo(20, 0); //writer.MoveTo(20, 100); //writer.LineTo(20, 15); //writer.CloseFigure(); aggPainter.Draw(vxs); aggPainter.LineDashGen = null; }
void Draw(PixelFarm.Agg.AggPainter aggPainter) { aggPainter.Clear(PixelFarm.Drawing.Color.White); //-------------------------- aggPainter.StrokeColor = PixelFarm.Drawing.Color.Black; aggPainter.StrokeWidth = 30.0f; // VertexStore vxs = new VertexStore(); PathWriter writer = new PathWriter(vxs); writer.MoveTo(20, 0); writer.LineTo(100, 100); writer.LineTo(20, 200); aggPainter.LineJoin = this.LineJoin; aggPainter.LineCap = this.LineCap; // aggPainter.Draw(vxs); }
void DrawB(PixelFarm.Agg.AggPainter aggPainter) { aggPainter.Clear(PixelFarm.Drawing.Color.White); //-------------------------- aggPainter.StrokeColor = PixelFarm.Drawing.Color.Black; aggPainter.StrokeWidth = 2.0f; // VertexStore vxs = new VertexStore(); PathWriter writer = new PathWriter(vxs); writer.MoveTo(20, 10); writer.LineTo(60, 10); writer.LineTo(20, 200); writer.CloseFigure(); //writer.MoveTo(100, 100); //writer.LineTo(20, 200); //aggPainter.LineJoin = this.LineJoin; //aggPainter.LineCap = this.LineCap; // //---------------------------------------------------- //create a dash line VertexStore newvxs = new VertexStore(); LineWalker dashGenLineWalker = new LineWalker(); //*** //you can customize what happend with the line segment dashGenLineWalker.AddMark(10, (outputVxs, cmd, x, y) => { //solid switch (cmd) { case VertexCmd.MoveTo: outputVxs.AddMoveTo(x, y); break; case VertexCmd.LineTo: outputVxs.AddLineTo(x, y); break; } }); dashGenLineWalker.AddMark(10, (outputVxs, cmd, x, y) => { //whitespace, do nothing }); dashGenLineWalker.Walk(vxs, newvxs); //aggPainter.Draw(vxs); //test drawline int n = newvxs.Count; double px = 0, py = 0; for (int i = 0; i < n; ++i) { double x, y; VertexCmd cmd = newvxs.GetVertex(i, out x, out y); switch (cmd) { case VertexCmd.MoveTo: px = x; py = y; break; case VertexCmd.LineTo: aggPainter.DrawLine(px, py, x, y); break; } px = x; py = y; } //aggPainter.Draw(newvxs); }
void DrawA(PixelFarm.Agg.AggPainter aggPainter) { aggPainter.Clear(PixelFarm.Drawing.Color.White); //-------------------------- aggPainter.StrokeColor = PixelFarm.Drawing.Color.Black; aggPainter.StrokeWidth = 2.0f; aggPainter.FillColor = PixelFarm.Drawing.Color.Black; // VertexStore vxs = new VertexStore(); PathWriter writer = new PathWriter(vxs); writer.MoveTo(30, 10); writer.LineTo(60, 10); writer.MoveTo(10, 100); writer.LineTo(10, 50); aggPainter.Draw(vxs); //writer.MoveTo(100, 100); //writer.LineTo(20, 200); //aggPainter.LineJoin = this.LineJoin; //aggPainter.LineCap = this.LineCap; // //---------------------------------------------------- ////create a dash line //VertexStore dashOutputVxs = new VertexStore(); //LineWalker dashGenLineWalker = new LineWalker(); ////*** ////you can customize what happend with the line segment //dashGenLineWalker.AddMark(10, LineWalkDashStyle.Solid); //dashGenLineWalker.AddMark(10, LineWalkDashStyle.Blank); ////dashGenLineWalker.AddMark(2, LineWalkDashStyle.Solid); ////dashGenLineWalker.AddMark(2, LineWalkDashStyle.Blank); //dashGenLineWalker.Walk(vxs, dashOutputVxs); ////---------------------------------------------------- //aggPainter.Draw(dashOutputVxs); ////test drawline //int n = newvxs.Count; //double px = 0, py = 0; //for (int i = 0; i < n; ++i) //{ // double x, y; // VertexCmd cmd = newvxs.GetVertex(i, out x, out y); // switch (cmd) // { // case VertexCmd.MoveTo: // px = x; // py = y; // break; // case VertexCmd.LineTo: // aggPainter.Line(px, py, x, y); // break; // } // px = x; // py = y; //} }