本文整理汇总了C++中OSGraphics::drawBitmap方法的典型用法代码示例。如果您正苦于以下问题:C++ OSGraphics::drawBitmap方法的具体用法?C++ OSGraphics::drawBitmap怎么用?C++ OSGraphics::drawBitmap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSGraphics
的用法示例。
在下文中一共展示了OSGraphics::drawBitmap方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void CtrlSliderBg::draw( OSGraphics &rImage, int xDest, int yDest )
{
if( m_pImgSeq )
{
if( m_bgWidth > 0 && m_bgHeight > 0 )
{
// Compute the resize factors
float factorX, factorY;
getResizeFactors( factorX, factorY );
// Rescale the image with the actual size of the control
ScaledBitmap bmp( getIntf(), *m_pImgSeq,
m_bgWidth * m_nbHoriz - (int)(m_padHoriz * factorX),
m_bgHeight * m_nbVert - (int)(m_padVert * factorY) );
// Locate the right image in the background bitmap
int x = m_bgWidth * ( m_position % m_nbHoriz );
int y = m_bgHeight * ( m_position / m_nbHoriz );
// Draw the background image
rImage.drawBitmap( bmp, x, y, xDest, yDest,
m_bgWidth - (int)(m_padHoriz * factorX),
m_bgHeight - (int)(m_padVert * factorY) );
}
}
}
示例2: draw
void AnimBitmap::draw( OSGraphics &rImage, int xDest, int yDest )
{
// Draw the current frame
int height = m_pImage->getHeight() / m_nbFrames;
int ySrc = height * m_curFrame;
// The old way .... transparency was not taken care of
// rImage.drawGraphics( *m_pImage, 0, ySrc, xDest, yDest,
// m_pImage->getWidth(), height );
// A new way .... needs to be tested thoroughly
rImage.drawBitmap( m_rBitmap, 0, ySrc, xDest, yDest,
m_pImage->getWidth(), height, true );
}
示例3: draw
void AnimBitmap::draw( OSGraphics &rImage, int xDest, int yDest, int w, int h,
int xOffset, int yOffset )
{
// Draw the current frame
int height = m_pImage->getHeight() / m_nbFrames;
int ySrc = height * m_curFrame;
// The old way .... transparency was not taken care of
// rImage.drawGraphics( *m_pImage, 0, ySrc, xDest, yDest,
// m_pImage->getWidth(), height );
rImage.drawBitmap( m_rBitmap,
xOffset, ySrc + yOffset,
xDest, yDest, w, h, true );
}
示例4: draw
void CtrlText::draw( OSGraphics &rImage, int xDest, int yDest, int w, int h )
{
rect clip( xDest, yDest, w, h );
const Position *pPos = getPosition();
if( m_pCurrImg )
{
// Compute the dimensions to draw
int width = min( m_pCurrImg->getWidth() + m_xPos,
getPosition()->getWidth() );
int height = min( m_pCurrImg->getHeight(), getPosition()->getHeight() );
// Draw the current image
if( width > 0 && height > 0 )
{
int offset = 0;
if( m_alignment == kLeft )
{
// We align to the left
offset = 0;
}
else if( m_alignment == kRight &&
width < getPosition()->getWidth() )
{
// The text is shorter than the width of the control, so we
// can align it to the right
offset = getPosition()->getWidth() - width;
}
else if( m_alignment == kCenter &&
width < getPosition()->getWidth() )
{
// The text is shorter than the width of the control, so we
// can center it
offset = (getPosition()->getWidth() - width) / 2;
}
rect region( pPos->getLeft() + offset,
pPos->getTop(), width, height );
rect inter;
if( rect::intersect( region, clip, &inter ) )
rImage.drawBitmap( *m_pCurrImg, -m_xPos + inter.x - region.x,
inter.y - region.y,
inter.x, inter.y,
inter.width, inter.height, true );
}
}
}
示例5: draw
void CtrlText::draw( OSGraphics &rImage, int xDest, int yDest )
{
if( m_pCurrImg )
{
// Compute the dimensions to draw
int width = min( m_pCurrImg->getWidth() + m_xPos,
getPosition()->getWidth() );
int height = min( m_pCurrImg->getHeight(), getPosition()->getHeight() );
// Draw the current image
if( width > 0 && height > 0 )
{
int offset = 0;
if( m_alignment == kLeft )
{
// We align to the left
offset = 0;
}
else if( m_alignment == kRight &&
width < getPosition()->getWidth() )
{
// The text is shorter than the width of the control, so we
// can align it to the right
offset = getPosition()->getWidth() - width;
}
else if( m_alignment == kCenter &&
width < getPosition()->getWidth() )
{
// The text is shorter than the width of the control, so we
// can center it
offset = (getPosition()->getWidth() - width) / 2;
}
rImage.drawBitmap( *m_pCurrImg, -m_xPos, 0, xDest + offset,
yDest, width, height, true );
}
}
}