Logo Search packages:      
Sourcecode: inkscape version File versions

void sp_gradient_render_vector_block_rgba ( SPGradient *const   gradient,
guchar *  buf,
gint const   width,
gint const   height,
gint const   rowstride,
gint const   pos,
gint const   span,
bool const   horizontal 
)

Render rectangular RGBA area from gradient vector.

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

References 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(width > 0);
    g_return_if_fail(height > 0);
    g_return_if_fail(pos >= 0);
    g_return_if_fail((horizontal && (pos + width <= span)) || (!horizontal && (pos + height <= span)));
    g_return_if_fail(span > 0);

    if (horizontal) {
        sp_gradient_render_vector_line_rgba(gradient, buf, width, pos, span);
        for (gint y = 1; y < height; y++) {
            memcpy(buf + y * rowstride, buf, 4 * width);
        }
    } else {
        guchar *tmp = (guchar *)alloca(4 * height);
        sp_gradient_render_vector_line_rgba(gradient, tmp, height, pos, span);
        for (gint y = 0; y < height; y++) {
            guchar *b = buf + y * rowstride;
            for (gint x = 0; x < width; x++) {
                *b++ = tmp[0];
                *b++ = tmp[1];
                *b++ = tmp[2];
                *b++ = tmp[3];
            }
            tmp += 4;
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index