Пример #1
0
        //--------------------------------------------------------------------
        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);
        }