Logo Search packages:      
Sourcecode: inkscape version File versions

void sp_item_adjust_gradient ( SPItem item,
NR::Matrix const &  postmul,
bool  set = false 
)

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 1085 of file sp-item.cpp.

References SPStyle::fill, SPIPaint::isPaintserver(), and SPStyle::stroke.

Referenced by sp_item_adjust_paint_recursive().

{
    SPStyle *style = SP_OBJECT_STYLE (item);

    if (style && (style->fill.isPaintserver())) {
        SPObject *server = SP_OBJECT_STYLE_FILL_SERVER(item);
        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())) {
        SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER(item);
        if (SP_IS_GRADIENT (server)) {
            SPGradient *gradient = sp_gradient_convert_to_userspace (SP_GRADIENT (server), item, "stroke");
            sp_gradient_transform_multiply (gradient, postmul, set);
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index