public int BaseStepH(DistanceInterpolator2 di)
 {
     m_li.Next();
     m_x += m_lp.inc;
     m_y = (m_lp.y1 + m_li.Y) >> LineAA.SUBPIXEL_SHIFT;
     if (m_lp.inc > 0) di.IncX(m_y - m_old_y);
     else di.DecX(m_y - m_old_y);
     m_old_y = m_y;
     return di.Distance / m_len;
 }
 //---------------------------------------------------------------------
 public LineInterpolatorAA2(OutlineRenderer ren, LineParameters lp,
                            int ex, int ey)
     : base(ren, lp)
 {
     m_di = new DistanceInterpolator2(lp.x1, lp.y1, lp.x2, lp.y2, ex, ey,
                                      lp.x1 & ~LineAA.SUBPIXEL_MARK, lp.y1 & ~LineAA.SUBPIXEL_MARK,
                                      0);
     base.m_li.adjust_forward();
     base.m_step -= base.m_max_extent;
 }
 public LineInterpolatorAA2(
     OutlineRenderer ren, LineParameters lp,
     int ex, int ey)
 {
     this._ren = ren;
     _aa_data  = new Lines.LineInterpolatorAAData(ren, lp);
     _m_di     = new DistanceInterpolator2(lp.x1, lp.y1, lp.x2, lp.y2, ex, ey,
                                           lp.x1 & ~LineAA.SUBPIXEL_MARK, lp.y1 & ~LineAA.SUBPIXEL_MARK,
                                           0);
     _aa_data.m_li.adjust_forward();
     _aa_data.m_step -= _aa_data.m_max_extent;
 }
 public int BaseStepH(DistanceInterpolator2 di)
 {
     m_li.Next();
     m_x += m_lp.inc;
     m_y  = (m_lp.y1 + m_li.Y) >> LineAA.SUBPIXEL_SHIFT;
     if (m_lp.inc > 0)
     {
         di.IncX(m_y - m_old_y);
     }
     else
     {
         di.DecX(m_y - m_old_y);
     }
     m_old_y = m_y;
     return(di.Distance / m_len);
 }
 public int BaseStepV(DistanceInterpolator2 di)
 {
     m_li.Next();
     m_y += m_lp.inc;
     m_x  = (m_lp.x1 + m_li.Y) >> LineAA.SUBPIXEL_SHIFT;
     if (m_lp.inc > 0)
     {
         di.IncY(m_x - m_old_x);
     }
     else
     {
         di.DecY(m_x - m_old_x);
     }
     m_old_x = m_x;
     return(di.Distance / m_len);
 }
        public LineInterpolatorAA1(OutlineRenderer ren, LineParameters lp, int sx, int sy)
            : base(ren, lp)
        {
            m_di = new DistanceInterpolator2(lp.x1, lp.y1, lp.x2, lp.y2, sx, sy,
                                             lp.x1 & ~LineAA.SUBPIXEL_MARK, lp.y1 & ~LineAA.SUBPIXEL_MARK);
            int dist1_start;
            int dist2_start;
            int npix = 1;

            if (lp.vertical)
            {
                do
                {
                    base.m_li.Prev();
                    base.m_y -= lp.inc;
                    base.m_x  = (base.m_lp.x1 + base.m_li.Y) >> LineAA.SUBPIXEL_SHIFT;
                    if (lp.inc > 0)
                    {
                        m_di.DecY(base.m_x - base.m_old_x);
                    }
                    else
                    {
                        m_di.IncY(base.m_x - base.m_old_x);
                    }
                    base.m_old_x = base.m_x;
                    dist1_start  = dist2_start = m_di.DistanceStart;
                    int dx = 0;
                    if (dist1_start < 0)
                    {
                        ++npix;
                    }
                    do
                    {
                        dist1_start += m_di.DyStart;
                        dist2_start -= m_di.DyStart;
                        if (dist1_start < 0)
                        {
                            ++npix;
                        }
                        if (dist2_start < 0)
                        {
                            ++npix;
                        }
                        ++dx;
                    }while (base.m_dist[dx] <= base.m_width);
                    --base.m_step;
                    if (npix == 0)
                    {
                        break;
                    }
                    npix = 0;
                }while (base.m_step >= -base.m_max_extent);
            }
            else
            {
                do
                {
                    base.m_li.Prev();
                    base.m_x -= lp.inc;
                    base.m_y  = (base.m_lp.y1 + base.m_li.Y) >> LineAA.SUBPIXEL_SHIFT;
                    if (lp.inc > 0)
                    {
                        m_di.DecX(base.m_y - base.m_old_y);
                    }
                    else
                    {
                        m_di.IncX(base.m_y - base.m_old_y);
                    }
                    base.m_old_y = base.m_y;
                    dist1_start  = dist2_start = m_di.DistanceStart;
                    int dy = 0;
                    if (dist1_start < 0)
                    {
                        ++npix;
                    }
                    do
                    {
                        dist1_start -= m_di.DxStart;
                        dist2_start += m_di.DxStart;
                        if (dist1_start < 0)
                        {
                            ++npix;
                        }
                        if (dist2_start < 0)
                        {
                            ++npix;
                        }
                        ++dy;
                    }while (base.m_dist[dy] <= base.m_width);
                    --base.m_step;
                    if (npix == 0)
                    {
                        break;
                    }
                    npix = 0;
                }while (base.m_step >= -base.m_max_extent);
            }
            base.m_li.adjust_forward();
        }
        public LineInterpolatorAA1(OutlineRenderer ren, LineParameters lp, int sx, int sy)
        {
            this._ren = ren;
            _aa_data  = new Lines.LineInterpolatorAAData(ren, lp);
            _m_di     = new DistanceInterpolator2(lp.x1, lp.y1, lp.x2, lp.y2, sx, sy,
                                                  lp.x1 & ~LineAA.SUBPIXEL_MARK, lp.y1 & ~LineAA.SUBPIXEL_MARK);


            int dist1_start;
            int dist2_start;
            int npix = 1;

            if (lp.vertical)
            {
                do
                {
                    _aa_data.m_li.Prev();
                    _aa_data.m_y -= lp.inc;
                    _aa_data.m_x  = (_aa_data.m_lp.x1 + _aa_data.m_li.Y) >> LineAA.SUBPIXEL_SHIFT;
                    if (lp.inc > 0)
                    {
                        _m_di.DecY(_aa_data.m_x - _aa_data.m_old_x);
                    }
                    else
                    {
                        _m_di.IncY(_aa_data.m_x - _aa_data.m_old_x);
                    }
                    _aa_data.m_old_x = _aa_data.m_x;
                    dist1_start      = dist2_start = _m_di.DistanceStart;
                    int dx = 0;
                    if (dist1_start < 0)
                    {
                        ++npix;
                    }
                    do
                    {
                        dist1_start += _m_di.DyStart;
                        dist2_start -= _m_di.DyStart;
                        if (dist1_start < 0)
                        {
                            ++npix;
                        }
                        if (dist2_start < 0)
                        {
                            ++npix;
                        }
                        ++dx;
                    }while (_aa_data.m_dist[dx] <= _aa_data.m_width);
                    --_aa_data.m_step;
                    if (npix == 0)
                    {
                        break;
                    }
                    npix = 0;
                }while (_aa_data.m_step >= -_aa_data.m_max_extent);
            }
            else
            {
                do
                {
                    _aa_data.m_li.Prev();
                    _aa_data.m_x -= lp.inc;
                    _aa_data.m_y  = (_aa_data.m_lp.y1 + _aa_data.m_li.Y) >> LineAA.SUBPIXEL_SHIFT;
                    if (lp.inc > 0)
                    {
                        _m_di.DecX(_aa_data.m_y - _aa_data.m_old_y);
                    }
                    else
                    {
                        _m_di.IncX(_aa_data.m_y - _aa_data.m_old_y);
                    }
                    _aa_data.m_old_y = _aa_data.m_y;
                    dist1_start      = dist2_start = _m_di.DistanceStart;
                    int dy = 0;
                    if (dist1_start < 0)
                    {
                        ++npix;
                    }
                    do
                    {
                        dist1_start -= _m_di.DxStart;
                        dist2_start += _m_di.DxStart;
                        if (dist1_start < 0)
                        {
                            ++npix;
                        }
                        if (dist2_start < 0)
                        {
                            ++npix;
                        }
                        ++dy;
                    }while (_aa_data.m_dist[dy] <= _aa_data.m_width);
                    --_aa_data.m_step;
                    if (npix == 0)
                    {
                        break;
                    }
                    npix = 0;
                }while (_aa_data.m_step >= -_aa_data.m_max_extent);
            }
            _aa_data.m_li.adjust_forward();
        }
 //---------------------------------------------------------------------
 public LineInterpolatorAA2(OutlineRenderer ren, LineParameters lp,
                       int ex, int ey)
     : base(ren, lp)
 {
     m_di = new DistanceInterpolator2(lp.x1, lp.y1, lp.x2, lp.y2, ex, ey,
          lp.x1 & ~LineAA.SUBPIXEL_MARK, lp.y1 & ~LineAA.SUBPIXEL_MARK,
          0);
     base.m_li.adjust_forward();
     base.m_step -= base.m_max_extent;
 }
 public LineInterpolatorAA1(OutlineRenderer ren, LineParameters lp, int sx, int sy)
     : base(ren, lp)
 {
     m_di = new DistanceInterpolator2(lp.x1, lp.y1, lp.x2, lp.y2, sx, sy,
          lp.x1 & ~LineAA.SUBPIXEL_MARK, lp.y1 & ~LineAA.SUBPIXEL_MARK);
     int dist1_start;
     int dist2_start;
     int npix = 1;
     if (lp.vertical)
     {
         do
         {
             base.m_li.Prev();
             base.m_y -= lp.inc;
             base.m_x = (base.m_lp.x1 + base.m_li.Y) >> LineAA.SUBPIXEL_SHIFT;
             if (lp.inc > 0) m_di.DecY(base.m_x - base.m_old_x);
             else m_di.IncY(base.m_x - base.m_old_x);
             base.m_old_x = base.m_x;
             dist1_start = dist2_start = m_di.DistanceStart;
             int dx = 0;
             if (dist1_start < 0) ++npix;
             do
             {
                 dist1_start += m_di.DyStart;
                 dist2_start -= m_di.DyStart;
                 if (dist1_start < 0) ++npix;
                 if (dist2_start < 0) ++npix;
                 ++dx;
             }
             while (base.m_dist[dx] <= base.m_width);
             --base.m_step;
             if (npix == 0) break;
             npix = 0;
         }
         while (base.m_step >= -base.m_max_extent);
     }
     else
     {
         do
         {
             base.m_li.Prev();
             base.m_x -= lp.inc;
             base.m_y = (base.m_lp.y1 + base.m_li.Y) >> LineAA.SUBPIXEL_SHIFT;
             if (lp.inc > 0) m_di.DecX(base.m_y - base.m_old_y);
             else m_di.IncX(base.m_y - base.m_old_y);
             base.m_old_y = base.m_y;
             dist1_start = dist2_start = m_di.DistanceStart;
             int dy = 0;
             if (dist1_start < 0) ++npix;
             do
             {
                 dist1_start -= m_di.DxStart;
                 dist2_start += m_di.DxStart;
                 if (dist1_start < 0) ++npix;
                 if (dist2_start < 0) ++npix;
                 ++dy;
             }
             while (base.m_dist[dy] <= base.m_width);
             --base.m_step;
             if (npix == 0) break;
             npix = 0;
         }
         while (base.m_step >= -base.m_max_extent);
     }
     base.m_li.adjust_forward();
 }
Exemplo n.º 10
0
 public int BaseStepV(DistanceInterpolator2 di)
 {
     m_li.Next();
     m_y += m_lp.inc;
     m_x = (m_lp.x1 + m_li.Y) >> LineAA.SUBPIXEL_SHIFT;
     if (m_lp.inc > 0) di.IncY(m_x - m_old_x);
     else di.DecY(m_x - m_old_x);
     m_old_x = m_x;
     return di.Distance / m_len;
 }