当前位置: 首页>>代码示例>>C++>>正文


C++ OptRect::expandBy方法代码示例

本文整理汇总了C++中geom::OptRect::expandBy方法的典型用法代码示例。如果您正苦于以下问题:C++ OptRect::expandBy方法的具体用法?C++ OptRect::expandBy怎么用?C++ OptRect::expandBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在geom::OptRect的用法示例。


在下文中一共展示了OptRect::expandBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: bbox

Geom::OptRect SPTRef::bbox(Geom::Affine const &transform, SPItem::BBoxType type) const {
    Geom::OptRect bbox;
    // find out the ancestor text which holds our layout
    SPObject const *parent_text = this;

    while ( parent_text && !SP_IS_TEXT(parent_text) ) {
        parent_text = parent_text->parent;
    }

    if (parent_text == NULL) {
        return bbox;
    }

    // get the bbox of our portion of the layout
    bbox = SP_TEXT(parent_text)->layout.bounds(transform,
        sp_text_get_length_upto(parent_text, this), sp_text_get_length_upto(this, NULL) - 1);

    // Add stroke width
    // FIXME this code is incorrect
    if (bbox && type == SPItem::VISUAL_BBOX && !this->style->stroke.isNone()) {
        double scale = transform.descrim();
        bbox->expandBy(0.5 * this->style->stroke_width.computed * scale);
    }

    return bbox;
}
开发者ID:Grandrogue,项目名称:inkscape_metal,代码行数:26,代码来源:sp-tref.cpp

示例2: _updateItem

unsigned DrawingGlyphs::_updateItem(Geom::IntRect const &/*area*/, UpdateContext const &ctx, unsigned /*flags*/, unsigned /*reset*/)
{
    DrawingText *ggroup = dynamic_cast<DrawingText *>(_parent);
    if (!ggroup) {
        throw InvalidItemException();
    }

    if (!_font || !ggroup->_style) {
        return STATE_ALL;
    }

    _pick_bbox = Geom::IntRect();
    _bbox = Geom::IntRect();

    Geom::OptRect b = bounds_exact_transformed(*_font->PathVector(_glyph), ctx.ctm);
    if (b && (ggroup->_nrstyle.stroke.type != NRStyle::PAINT_NONE)) {
        float width, scale;
        scale = ctx.ctm.descrim();
        if (_transform) {
            scale /= _transform->descrim(); // FIXME temporary hack
        }
        width = MAX(0.125, ggroup->_nrstyle.stroke_width * scale);
        if ( fabs(ggroup->_nrstyle.stroke_width * scale) > 0.01 ) { // FIXME: this is always true
            b->expandBy(0.5 * width);
        }
        // save bbox without miters for picking
        _pick_bbox = b->roundOutwards();

        float miterMax = width * ggroup->_nrstyle.miter_limit;
        if ( miterMax > 0.01 ) {
            // grunt mode. we should compute the various miters instead
            // (one for each point on the curve)
            b->expandBy(miterMax);
        }
        _bbox = b->roundOutwards();
    } else if (b) {
        _bbox = b->roundOutwards();
        _pick_bbox = *_bbox;
    }

    return STATE_ALL;
}
开发者ID:Spin0za,项目名称:inkscape,代码行数:42,代码来源:drawing-text.cpp

示例3: bbox

Geom::OptRect SPFlowtext::bbox(Geom::Affine const &transform, SPItem::BBoxType type) const {
    Geom::OptRect bbox = this->layout.bounds(transform);

    // Add stroke width
    // FIXME this code is incorrect
    if (bbox && type == SPItem::VISUAL_BBOX && !this->style->stroke.isNone()) {
        double scale = transform.descrim();
        bbox->expandBy(0.5 * this->style->stroke_width.computed * scale);
    }

    return bbox;
}
开发者ID:Grandrogue,项目名称:inkscape_metal,代码行数:12,代码来源:sp-flowtext.cpp


注:本文中的geom::OptRect::expandBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。