コード例 #1
0
ファイル: Graphicsos.cs プロジェクト: zyouhua/nvwa
 public static void _drawBroken(Line2I nLine, Graphics nGraphics, RGB nRGB, bool nStart = true)
 {
     Color color_ = nRGB._getColor();
     Pen pen_ = new Pen(color_);
     float length_ = nLine._length();
     if (length_ < 6)
     {
         nGraphics.DrawLine(pen_, nLine._begX(), nLine._begY(), nLine._endX(), nLine._endY());
         return;
     }
     Point2I point_ = nLine._vector();
     PointF f = new PointF();
     f.X = point_._getX() / length_;
     f.Y = point_._getY() / length_;
     if (nStart)
     {
         for (int i = 0; i < (length_ - 1); i += 8)
         {
             Point beg_ = new Point();
             beg_.X = (int)(i * f.X + nLine._begX());
             beg_.Y = (int)(i * f.Y + nLine._begY());
             int k = i + 3;
             Point end_ = new Point();
             end_.X = (int)(k * f.X + nLine._begX());
             end_.Y = (int)(k * f.Y + nLine._begY());
             nGraphics.DrawLine(pen_, beg_, end_);
         }
     }
     else
     {
         for (int i = 0; i < (length_ - 1); i += 8)
         {
             Point beg_ = new Point();
             int l = i + 5;
             beg_.X = (int)(l * f.X + nLine._begX());
             beg_.Y = (int)(l * f.Y + nLine._begY());
             Point end_ = new Point();
             int k = i;
             end_.X = (int)(k * f.X + nLine._begX());
             end_.Y = (int)(k * f.Y + nLine._begY());
             nGraphics.DrawLine(pen_, beg_, end_);
         }
     }
 }