本文整理汇总了C++中geom::Affine::descrim方法的典型用法代码示例。如果您正苦于以下问题:C++ Affine::descrim方法的具体用法?C++ Affine::descrim怎么用?C++ Affine::descrim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geom::Affine
的用法示例。
在下文中一共展示了Affine::descrim方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: set_transform
Geom::Affine SPLine::set_transform(Geom::Affine const &transform) {
Geom::Point points[2];
points[0] = Geom::Point(this->x1.computed, this->y1.computed);
points[1] = Geom::Point(this->x2.computed, this->y2.computed);
points[0] *= transform;
points[1] *= transform;
this->x1.computed = points[0][Geom::X];
this->y1.computed = points[0][Geom::Y];
this->x2.computed = points[1][Geom::X];
this->y2.computed = points[1][Geom::Y];
this->adjust_stroke(transform.descrim());
this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
return Geom::identity();
}
示例4: identity
/**
* Writes the given transform into the repr for the given item.
*/
static Geom::Affine
sp_path_set_transform(SPItem *item, Geom::Affine const &xform)
{
if (!SP_IS_PATH(item)) {
return Geom::identity();
}
SPPath *path = SP_PATH(item);
if (!path->_curve) { // 0 nodes, nothing to transform
return Geom::identity();
}
// Transform the original-d path if this is a valid LPE item, other else the (ordinary) path
if (path->_curve_before_lpe && sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(item))) {
if (sp_lpe_item_has_path_effect_of_type(SP_LPE_ITEM(item), Inkscape::LivePathEffect::CLONE_ORIGINAL)) {
// if path has the CLONE_ORIGINAL LPE applied, don't write the transform to the pathdata, but write it 'unoptimized'
return xform;
} else {
path->_curve_before_lpe->transform(xform);
}
} else {
path->_curve->transform(xform);
}
// Adjust stroke
item->adjust_stroke(xform.descrim());
// Adjust pattern fill
item->adjust_pattern(xform);
// Adjust gradient fill
item->adjust_gradient(xform);
// Adjust LPE
item->adjust_livepatheffect(xform);
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
// nothing remains - we've written all of the transform, so return identity
return Geom::identity();
}
示例5: setTransform
Geom::Affine SPLine::setTransform(SPItem *item, Geom::Affine const &xform)
{
SPLine *line = SP_LINE(item);
Geom::Point points[2];
points[0] = Geom::Point(line->x1.computed, line->y1.computed);
points[1] = Geom::Point(line->x2.computed, line->y2.computed);
points[0] *= xform;
points[1] *= xform;
line->x1.computed = points[0][Geom::X];
line->y1.computed = points[0][Geom::Y];
line->x2.computed = points[1][Geom::X];
line->y2.computed = points[1][Geom::Y];
item->adjust_stroke(xform.descrim());
SP_OBJECT(item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
return Geom::identity();
}
示例6: set_transform
Geom::Affine SPFlowtext::set_transform (Geom::Affine const &xform)
{
if ((this->_optimizeScaledText && !xform.withoutTranslation().isNonzeroUniformScale())
|| (!this->_optimizeScaledText && !xform.isNonzeroUniformScale())) {
this->_optimizeScaledText = false;
return xform;
}
this->_optimizeScaledText = false;
SPText *text = reinterpret_cast<SPText *>(this);
double const ex = xform.descrim();
if (ex == 0) {
return xform;
}
Geom::Affine ret(xform);
ret[0] /= ex;
ret[1] /= ex;
ret[2] /= ex;
ret[3] /= ex;
// Adjust font size
text->_adjustFontsizeRecursive (this, ex);
// Adjust stroke width
this->adjust_stroke_width_recursive (ex);
// Adjust pattern fill
this->adjust_pattern(xform * ret.inverse());
// Adjust gradient fill
this->adjust_gradient(xform * ret.inverse());
this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG);
return ret;
}