本文整理汇总了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;
}
示例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;
}
示例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;
}