1 #define INKSCAPE_LPEGROUPBBOX_CPP
3 /*
4 * Copyright (C) Steren Giannini 2008 <steren.giannini@gmail.com>
5 *
6 * Released under GNU GPL, read the file 'COPYING' for more information
7 */
9 #include "live_effects/lpegroupbbox.h"
11 #include "sp-item.h"
12 #include "libnr/nr-matrix-fns.h"
13 #include "libnr/n-art-bpath-2geom.h"
15 namespace Inkscape {
16 namespace LivePathEffect {
18 void
19 GroupBBoxEffect::original_bbox(SPLPEItem *lpeitem, bool absolute)
20 {
21 // Get item bounding box
22 SPItem* item = SP_ITEM(lpeitem);
24 NR::Matrix transform;
25 if (absolute) {
26 transform = from_2geom(sp_item_i2doc_affine(item));
27 }
28 else {
29 transform = NR::identity();
30 }
32 NR::Maybe<NR::Rect> itemBBox = item->getBounds(transform, SPItem::GEOMETRIC_BBOX);
34 // NR to Geom glue
35 Geom::Rect geomBBox = Geom::Rect(itemBBox->min().to_2geom(), itemBBox->max().to_2geom());
36 boundingbox_X = geomBBox[Geom::X];
37 boundingbox_Y = geomBBox[Geom::Y];
38 }
40 } // namespace LivePathEffect
41 } /* namespace Inkscape */
43 /*
44 Local Variables:
45 mode:c++
46 c-file-style:"stroustrup"
47 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
48 indent-tabs-mode:nil
49 fill-column:99
50 End:
51 */
52 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :