Logo Search packages:      
Sourcecode: inkscape version File versions

void sp_item_adjust_paint_recursive ( SPItem item,
NR::Matrix  advertized_transform,
NR::Matrix  t_ancestors,
bool  is_pattern 

Recursively compensate pattern or gradient transform

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

References sp_item_transform_repr().

Referenced by sp_item_write_transform().

// A clone must not touch the style (it's that of its parent!) and has no children, so quit now
    if (item && SP_IS_USE(item))

// _Before_ full pattern/gradient transform: t_paint * t_item * t_ancestors
// _After_ full pattern/gradient transform: t_paint_new * t_item * t_ancestors * advertised_transform
// By equating these two expressions we get t_paint_new = t_paint * paint_delta, where:
    NR::Matrix t_item = sp_item_transform_repr (item);
    NR::Matrix paint_delta = t_item * t_ancestors * advertized_transform * t_ancestors.inverse() * t_item.inverse();

    if (is_pattern)
        sp_shape_adjust_pattern (item, paint_delta);
        sp_shape_adjust_gradient (item, paint_delta);

// Within text, we do not fork gradients, and so must not recurse to avoid double compensation
    if (item && SP_IS_TEXT(item))

    for (SPObject *o = SP_OBJECT(item)->children; o != NULL; o = o->next) {
        if (SP_IS_ITEM(o)) {
// At the level of the transformed item, t_ancestors is identity;
// below it, it is the accmmulated chain of transforms from this level to the top level
            sp_item_adjust_paint_recursive (SP_ITEM(o), advertized_transform, t_item * t_ancestors, is_pattern);

Generated by  Doxygen 1.6.0   Back to index