//----------------------------------------------------------------
        public void begin(double x, double y, int len)
        {
            double tx;
            double ty;

            tx = x;
            ty = y;
            m_trans.Transform(ref tx, ref ty);
            int x1 = agg_basics.iround(tx * (double)subpixel_scale_e.subpixel_scale);
            int y1 = agg_basics.iround(ty * (double)subpixel_scale_e.subpixel_scale);

            tx = x + len;
            ty = y;
            m_trans.Transform(ref tx, ref ty);
            int x2 = agg_basics.iround(tx * (double)subpixel_scale_e.subpixel_scale);
            int y2 = agg_basics.iround(ty * (double)subpixel_scale_e.subpixel_scale);

            m_li_x = new dda2_line_interpolator(x1, x2, (int)len);
            m_li_y = new dda2_line_interpolator(y1, y2, (int)len);
        }
Exemplo n.º 2
0
        //--------------------------------------------------------------------
        public line_bresenham_interpolator(int x1, int y1, int x2, int y2)
        {
            m_x1_lr = (line_lr(x1));
            m_y1_lr = (line_lr(y1));
            m_x2_lr = (line_lr(x2));
            m_y2_lr = (line_lr(y2));
            m_ver = (Math.Abs(m_x2_lr - m_x1_lr) < Math.Abs(m_y2_lr - m_y1_lr));
            if (m_ver)
            {
                m_len = (int)Math.Abs(m_y2_lr - m_y1_lr);
            }
            else
            {
                m_len = (int)Math.Abs(m_x2_lr - m_x1_lr);
            }

            m_inc = (m_ver ? ((y2 > y1) ? 1 : -1) : ((x2 > x1) ? 1 : -1));
            m_interpolator = new dda2_line_interpolator(m_ver ? x1 : y1,
                           m_ver ? x2 : y2,
                           (int)m_len);
        }
 //----------------------------------------------------------------
 public void resynchronize(double xe, double ye, int len)
 {
     m_trans.Transform(ref xe, ref ye);
     m_li_x = new dda2_line_interpolator(m_li_x.y(), agg_basics.iround(xe * (double)subpixel_scale_e.subpixel_scale), (int)len);
     m_li_y = new dda2_line_interpolator(m_li_y.y(), agg_basics.iround(ye * (double)subpixel_scale_e.subpixel_scale), (int)len);
 }