本文整理汇总了C++中Transformable::TranslateBy方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformable::TranslateBy方法的具体用法?C++ Transformable::TranslateBy怎么用?C++ Transformable::TranslateBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transformable
的用法示例。
在下文中一共展示了Transformable::TranslateBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// BoundingBox
BRect
Painter::BoundingBox(const char* utf8String, uint32 length,
const BPoint& baseLine) const
{
Transformable transform;
transform.TranslateBy(baseLine);
BRect dummy;
return fTextRenderer->RenderString(utf8String,
length,
fFontRendererSolid,
fFontRendererBin,
transform, dummy, true);
}
示例2: bounds
// DrawString
BRect
Painter::DrawString(const char* utf8String, uint32 length,
BPoint baseLine, const escapement_delta* delta)
{
BRect bounds(0.0, 0.0, -1.0, -1.0);
fPatternHandler->SetPattern(B_SOLID_HIGH);
if (fBuffer) {
Transformable transform;
transform.ShearBy(B_ORIGIN, (90.0 - fFont.Shear()) * PI / 180.0, 0.0);
transform.RotateBy(B_ORIGIN, -fFont.Rotation() * PI / 180.0);
transform.TranslateBy(baseLine);
transform.ScaleBy(B_ORIGIN, fScale, fScale);
transform.TranslateBy(fOrigin);
BRect clippingFrame;
if (fClippingRegion)
clippingFrame = _Transform(fClippingRegion->Frame());
bounds = fTextRenderer->RenderString(utf8String,
length,
fFontRendererSolid,
fFontRendererBin,
transform,
clippingFrame,
false,
&fPenLocation);
// pen location is not transformed in quite the same way,
// or transformations would add up
transform.Reset();
transform.RotateBy(B_ORIGIN, -fFont.Rotation());
transform.TranslateBy(baseLine);
transform.Transform(&fPenLocation);
}
return _Clipped(bounds);
}