public LineInterpolatorAABase(OutlineRenderer ren, LineParameters lp) { m_lp = lp; m_li = new LineInterpolatorDDA2(lp.vertical ? LineAA.DblHr(lp.x2 - lp.x1) : LineAA.DblHr(lp.y2 - lp.y1), lp.vertical ? Math.Abs(lp.y2 - lp.y1) : Math.Abs(lp.x2 - lp.x1) + 1); m_ren = ren; m_len = ((lp.vertical == (lp.inc > 0)) ? -lp.len : lp.len); m_x = (lp.x1 >> LineAA.SUBPIXEL_SHIFT); m_y = (lp.y1 >> LineAA.SUBPIXEL_SHIFT); m_old_x = (m_x); m_old_y = (m_y); m_count = ((lp.vertical ? Math.Abs((lp.y2 >> LineAA.SUBPIXEL_SHIFT) - m_y) : Math.Abs((lp.x2 >> LineAA.SUBPIXEL_SHIFT) - m_x))); m_width = (ren.SubPixelWidth); //m_max_extent(m_width >> (line_subpixel_shift - 2)); m_max_extent = ((m_width + LineAA.SUBPIXEL_MARK) >> LineAA.SUBPIXEL_SHIFT); m_step = 0; LineInterpolatorDDA2 li = new LineInterpolatorDDA2(0, lp.vertical ? (lp.dy << LineAA.SUBPIXEL_SHIFT) : (lp.dx << LineAA.SUBPIXEL_SHIFT), lp.len); int i; int stop = m_width + LineAA.SUBPIXEL_SCALE * 2; for (i = 0; i < MAX_HALF_WIDTH; ++i) { m_dist[i] = li.Y; if (m_dist[i] >= stop) { break; } li.Next(); } m_dist[i++] = 0x7FFF0000; }
public int BaseStepH(ref DistanceInterpolator1 di) { _li.Next(); m_x += _lp.inc; m_y = (_lp.y1 + _li.Y) >> LineAA.SUBPIXEL_SHIFT; // if (_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 / _len); } public int BaseStepH(ref DistanceInterpolator2 di) { _li.Next(); m_x += _lp.inc; m_y = (_lp.y1 + _li.Y) >> LineAA.SUBPIXEL_SHIFT; // if (_lp.inc > 0) { di.IncX(m_y - m_old_y); } else /**/ di {
public int BaseStepH(ref DistanceInterpolator1 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 void Next() { m_li_x.Next(); m_li_y.Next(); }
////---------------------------------------------------------------- //public void ReSync(double xe, double ye, int len) //{ // m_trans.Transform(ref xe, ref ye); // m_li_x = new LineInterpolatorDDA2(m_li_x.Y, AggMath.iround(xe * SUB_PIXEL_SCALE), len); // m_li_y = new LineInterpolatorDDA2(m_li_y.Y, AggMath.iround(ye * SUB_PIXEL_SCALE), len); //} public void Next() { _li_x.Next(); _li_y.Next(); }