private static void DrawRectangle(List <HpglItem> result, HPoint pt, int w, int h) { var p1 = pt.Add(new HPoint() { X = w, Y = h }); var p2 = pt.Add(new HPoint() { X = -w, Y = h }); var p3 = pt.Add(new HPoint() { X = -w, Y = -h }); var p4 = pt.Add(new HPoint() { X = w, Y = -h }); result.Add(new PenUp() { Points = { p1 } }); result.Add(new PenDown() { Points = { p2, p3, p4, p1 } }); result.Add(new PenUp() { }); }
protected override void MoveTo(HPoint p) { if (isPenDown) { if (Numbering && HPoint.LengthAbs(p, lastText) > 20) { var tp = ToPoint(p); g.DrawString(counter + "", SystemFonts.IconTitleFont, Brushes.Black, tp.X, tp.Y); counter++; lastText = p; } if (current == p) { g.DrawLine(currentGPen, ToPoint(p), ToPoint(p.Add(new HPoint(1, 1)))); } else { g.DrawLine(currentGPen, ToPoint(current), ToPoint(p)); } } else { if (DebugPenUp) { g.DrawLine(debugPen, ToPoint(current), ToPoint(p)); } } base.MoveTo(p); }
protected override void VisitPenRelative(PenRelative item) { if (isPenDown) { foreach (var rp in item.Points) { var p = current.Add(rp); segments.Add(new Line(current, p, currentAttribs)); current = p; } } else { if (item.Points.Count > 0) { current = current.Add(item.Points.Last()); } } }
private static void DrawCircle(List <HpglItem> result, HPoint pt, int w) { var q = (int)(w / 1.44); var p1 = pt.Add(new HPoint() { X = w, Y = w }); var p2 = pt.Add(new HPoint() { X = -w, Y = w }); var p3 = pt.Add(new HPoint() { X = -w, Y = -w }); var p4 = pt.Add(new HPoint() { X = w, Y = -w }); /* .4. * 5 3 * . . * 6 2 * . . * 7 1 * .0. */ result.Add(new PenUp() { Points = { pt.Add(0, w) } }); result.Add(new PenDown() { Points = { //pt.Add(0,w), pt.Add(q, q), pt.Add(w, 0), pt.Add(q, -q), pt.Add(0, -w), pt.Add(-q, -q), pt.Add(-w, 0), pt.Add(-q, q), pt.Add(0, w), } }); result.Add(new PenUp() { }); }