Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

void sp_item_adjust_gradient ( SPItem item,
Geom::Matrix const &  postmul,
bool  set 
)

Note:
Bbox units for a gradient are generally a bad idea because with them, you cannot preserve the relative position of the object and its gradient after rotation or skew. So now we convert them to userspace units which are easy to keep in sync just by adding the object's transform to gradientTransform.
Todo:
FIXME: convert back to bbox units after transforming with the item, so as to preserve the original units.

Definition at line 1227 of file sp-item.cpp.

References SPStyle::fill, SPStyle::stroke, and SPObject::style.

Referenced by sp_item_adjust_paint_recursive().

{
    SPStyle *style = item->style;

    if ( style && style->fill.isPaintserver() ) {
        SPPaintServer *server = item->style->getFillPaintServer();
        if ( SP_IS_GRADIENT(server) ) {

            /**
             * \note Bbox units for a gradient are generally a bad idea because
             * with them, you cannot preserve the relative position of the
             * object and its gradient after rotation or skew. So now we
             * convert them to userspace units which are easy to keep in sync
             * just by adding the object's transform to gradientTransform.
             * \todo FIXME: convert back to bbox units after transforming with
             * the item, so as to preserve the original units.
             */
            SPGradient *gradient = sp_gradient_convert_to_userspace( SP_GRADIENT(server), item, "fill" );

            sp_gradient_transform_multiply( gradient, postmul, set );
        }
    }

    if ( style && style->stroke.isPaintserver() ) {
        SPPaintServer *server = item->style->getStrokePaintServer();
        if ( SP_IS_GRADIENT(server) ) {
            SPGradient *gradient = sp_gradient_convert_to_userspace( SP_GRADIENT(server), item, "stroke" );
            sp_gradient_transform_multiply( gradient, postmul, set );
        }
    }
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index