summaryrefslogtreecommitdiffstats
path: root/src/live_effects/lpegroupbbox.cpp
blob: e9cf050994ebec03c81d29d923adc241ac72acfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#define INKSCAPE_LPEGROUPBBOX_CPP

/*
 * Copyright (C) Steren Giannini 2008 <steren.giannini@gmail.com>
 *
 * Released under GNU GPL, read the file 'COPYING' for more information
 */

#include "live_effects/lpegroupbbox.h"

#include "sp-item.h"
#include "libnr/nr-matrix-fns.h"
#include "libnr/n-art-bpath-2geom.h"

namespace Inkscape {
namespace LivePathEffect {

void
GroupBBoxEffect::original_bbox(SPLPEItem *lpeitem, bool absolute)
{
    // Get item bounding box
    SPItem* item = SP_ITEM(lpeitem);
    
    NR::Matrix transform;
    if (absolute) {
        transform = from_2geom(sp_item_i2doc_affine(item));
    }
    else {
        transform = NR::identity();
    }
    
    NR::Maybe<NR::Rect> itemBBox = item->getBounds(transform, SPItem::GEOMETRIC_BBOX);

    // NR to Geom glue
    Geom::Rect geomBBox = Geom::Rect(itemBBox->min(), itemBBox->max());
    boundingbox_X = geomBBox[Geom::X];
    boundingbox_Y = geomBBox[Geom::Y];
}

} // namespace LivePathEffect
} /* namespace Inkscape */

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :