//-------------------------------------------------------------------- public void generate(Color[] span, int spanIndex, int x, int y, int len) { int dd = m_d2 - m_d1; if (dd < 1) { dd = 1; } m_interpolator.begin(x + 0.5, y + 0.5, len); do { m_interpolator.coordinates(out x, out y); int d = m_gradient_function.calculate(x >> downscale_shift, y >> downscale_shift, m_d2); d = ((d - m_d1) * (int)m_color_function.size()) / dd; if (d < 0) { d = 0; } if (d >= (int)m_color_function.size()) { d = m_color_function.size() - 1; } span[spanIndex++] = m_color_function[d]; m_interpolator.Next(); }while (--len != 0); }
public int calculate(int x, int y, int d) { int ret = m_gradient.calculate(x, y, d) % d; if (ret < 0) { ret += d; } return(ret); }
public int calculate(int x, int y, int d) { int d2 = d << 1; int ret = m_gradient.calculate(x, y, d) % d2; if (ret < 0) { ret += d2; } if (ret >= d) { ret = d2 - ret; } return(ret); }