Logo Search packages:      
Sourcecode: inkscape version File versions

void sp_gradient_render_vector_line_rgba ( SPGradient *  gr,
guchar *  px,
gint  len,
gint  pos,
gint  span 
)

Renders gradient vector to buffer

len, width, height, rowstride - buffer parameters (1 or 2 dimensional) span - full integer width of requested gradient pos - buffer starting position in span

RGB buffer background should be set up before

Definition at line 838 of file sp-gradient.cpp.

References sp_gradient_ensure_colors(), and sp_gradient_render_vector_line_rgba().

Referenced by sp_gradient_render_vector_line_rgba().

{
      g_return_if_fail (gradient != NULL);
      g_return_if_fail (SP_IS_GRADIENT (gradient));
      g_return_if_fail (buf != NULL);
      g_return_if_fail (len > 0);
      g_return_if_fail (pos >= 0);
      g_return_if_fail (pos + len <= span);
      g_return_if_fail (span > 0);

      if (!gradient->color) {
            sp_gradient_ensure_colors (gradient);
      }

      gint idx = (pos * 1024 << 8) / span;
      gint didx = (1024 << 8) / span;

      for (gint x = 0; x < len; x++) {
            // Can this be done with 4 byte copies?
            *buf++ = gradient->color[4 * (idx >> 8)];
            *buf++ = gradient->color[4 * (idx >> 8) + 1];
            *buf++ = gradient->color[4 * (idx >> 8) + 2];
            *buf++ = gradient->color[4 * (idx >> 8) + 3];
            idx += didx;
      }
}


Generated by  Doxygen 1.6.0   Back to index