Example #1
0
		//typedef Renderer renderer_type;
		//typedef line_interpolator_aa_base<Renderer> base_type;

		//---------------------------------------------------------------------
		public line_interpolator_aa1(OutlineRenderer ren, line_parameters lp,
							  int sx, int sy)
			:
			base(ren, lp)
		{
			m_di = new distance_interpolator2(lp.x1, lp.y1, lp.x2, lp.y2, sx, sy,
				 lp.x1 & ~LineAABasics.line_subpixel_mask, lp.y1 & ~LineAABasics.line_subpixel_mask);

			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()) >> LineAABasics.line_subpixel_shift;

					if (lp.inc > 0) m_di.dec_y(base.m_x - base.m_old_x);
					else m_di.inc_y(base.m_x - base.m_old_x);

					base.m_old_x = base.m_x;

					dist1_start = dist2_start = m_di.dist_start();

					int dx = 0;
					if (dist1_start < 0) ++npix;
					do
					{
						dist1_start += m_di.dy_start();
						dist2_start -= m_di.dy_start();
						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()) >> LineAABasics.line_subpixel_shift;

					if (lp.inc > 0) m_di.dec_x(base.m_y - base.m_old_y);
					else m_di.inc_x(base.m_y - base.m_old_y);

					base.m_old_y = base.m_y;

					dist1_start = dist2_start = m_di.dist_start();

					int dy = 0;
					if (dist1_start < 0) ++npix;
					do
					{
						dist1_start -= m_di.dx_start();
						dist2_start += m_di.dx_start();
						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();
		}
Example #2
0
		public int step_hor_base(distance_interpolator2 di)
		{
			m_li.Next();
			m_x += m_lp.inc;
			m_y = (m_lp.y1 + m_li.y()) >> LineAABasics.line_subpixel_shift;

			if (m_lp.inc > 0) di.inc_x(m_y - m_old_y);
			else di.dec_x(m_y - m_old_y);

			m_old_y = m_y;

			return di.dist() / m_len;
		}