本文整理汇总了C++中kigfx::GAL::BitmapText方法的典型用法代码示例。如果您正苦于以下问题:C++ GAL::BitmapText方法的具体用法?C++ GAL::BitmapText怎么用?C++ GAL::BitmapText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kigfx::GAL
的用法示例。
在下文中一共展示了GAL::BitmapText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawTicksAlongLine
/**
* Draw labelled ticks on a line. Ticks are spaced according to a
* maximum density. Miror ticks are not labelled.
*
* @param aGal the GAL to draw on
* @param aOrigin start of line to draw ticks on
* @param aLine line vector
* @param aMinorTickLen length of minor ticks in IU
*/
void drawTicksAlongLine( KIGFX::GAL& aGal, const VECTOR2D& aOrigin,
const VECTOR2D& aLine, double aMinorTickLen )
{
VECTOR2D tickLine = aLine.Rotate( -M_PI_2 );
double tickSpace;
TICK_FORMAT tickF = getTickFormatForScale( aGal.GetWorldScale(), tickSpace );
// number of ticks in whole ruler
int numTicks = (int) std::ceil( aLine.EuclideanNorm() / tickSpace );
// work out which way up the tick labels go
double labelAngle = -tickLine.Angle();
if( aLine.Angle() > 0 )
{
aGal.SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
}
else
{
aGal.SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
labelAngle += M_PI;
}
// text and ticks are dimmed
aGal.SetStrokeColor( PreviewOverlayDefaultColor().WithAlpha( PreviewOverlayDeemphAlpha( true ) ) );
const auto labelOffset = tickLine.Resize( aMinorTickLen * ( majorTickLengthFactor + 1 ) );
for( int i = 0; i < numTicks; ++i )
{
const auto tickPos = aOrigin + aLine.Resize( tickSpace * i );
double length = aMinorTickLen;
bool drawLabel = false;
if( i % tickF.majorStep == 0)
{
drawLabel = true;
length *= majorTickLengthFactor;
}
else if( tickF.midStep && i % tickF.midStep == 0 )
{
drawLabel = true;
length *= midTickLengthFactor;
}
aGal.DrawLine( tickPos, tickPos + tickLine.Resize( length ) );
if( drawLabel )
{
wxString label = DimensionLabel( "", tickSpace * i, g_UserUnit );
// FIXME: spaces choke OpenGL lp:1668455
label.erase( std::remove( label.begin(), label.end(), ' ' ), label.end() );
aGal.BitmapText( label, tickPos + labelOffset, labelAngle );
}
}
}