Logo Search packages:      
Sourcecode: inkscape version File versions

NR::Matrix sp_item_i2doc_affine ( SPItem const *  item  ) 

Returns the accumulated transformation of the item and all its ancestors, including root's viewport.

(item != NULL) and SP_IS_ITEM(item).

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

References NR::identity(), and SPItem::transform.

Referenced by SPSelection::boundsInDocument().

    g_assert(item != NULL);

    NR::Matrix ret(NR::identity());
#ifdef NDEBUG

    /* Note that this routine may be called for items that are not members of
    ** the root.  For example, markers are members of a <def> object.  Hence
    ** we terminate either when reaching the top of the tree, or when a
    ** non-item object is reached.
    while ( NULL != SP_OBJECT_PARENT(item) && SP_IS_ITEM(SP_OBJECT_PARENT(item)) ) {
        ret *= item->transform;
        item = SP_ITEM(SP_OBJECT_PARENT(item));

    /* Then we only do root-related stuff if we found a root item */
    if (SP_IS_ROOT(item)) {
        SPRoot const *root = SP_ROOT(item);

        // Viewbox is relative to root's transform:
        // http://www.w3.org/TR/SVG11/coords.html#ViewBoxAttributeEffectOnSiblingAttributes
        ret *= root->c2p;
        ret *= item->transform;

    return ret;

Generated by  Doxygen 1.6.0   Back to index