//-------------------------------------------------------------------- public unsafe void Generate(RGBA_Bytes *span, int x, int y, uint 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++ = 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); }