本文整理汇总了C++中OSGraphics::drawGraphics方法的典型用法代码示例。如果您正苦于以下问题:C++ OSGraphics::drawGraphics方法的具体用法?C++ OSGraphics::drawGraphics怎么用?C++ OSGraphics::drawGraphics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSGraphics
的用法示例。
在下文中一共展示了OSGraphics::drawGraphics方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void CtrlRadialSlider::draw( OSGraphics &rImage, int xDest, int yDest, int w, int h )
{
const Position *pPos = getPosition();
rect region( pPos->getLeft(), pPos->getTop(), m_width, m_height );
rect clip( xDest, yDest, w ,h );
rect inter;
if( rect::intersect( region, clip, &inter ) )
rImage.drawGraphics( *m_pImgSeq,
inter.x - region.x,
inter.y - region.y + m_position * m_height,
inter.x, inter.y,
inter.width, inter.height );
}
示例2: draw
void CtrlTree::draw( OSGraphics &rImage, int xDest, int yDest, int w, int h)
{
const Position *pPos = getPosition();
rect region( pPos->getLeft(), pPos->getTop(),
pPos->getWidth(), pPos->getHeight() );
rect clip( xDest, yDest, w, h );
rect inter;
if( rect::intersect( region, clip, &inter ) && m_pImage )
rImage.drawGraphics( *m_pImage,
inter.x - pPos->getLeft(),
inter.y - pPos->getTop(),
inter.x, inter.y, inter.width, inter.height );
}
示例3: draw
void CtrlSliderCursor::draw( OSGraphics &rImage, int xDest, int yDest )
{
if( m_pImg )
{
// Compute the position of the cursor
int xPos, yPos;
m_rCurve.getPoint( m_rVariable.get(), xPos, yPos );
// Compute the resize factors
float factorX, factorY;
getResizeFactors( factorX, factorY );
xPos = (int)(xPos * factorX);
yPos = (int)(yPos * factorY);
// Draw the current image
rImage.drawGraphics( *m_pImg, 0, 0,
xDest + xPos - m_pImg->getWidth() / 2,
yDest + yPos - m_pImg->getHeight() / 2 );
}
}
示例4: draw
void CtrlImage::draw( OSGraphics &rImage, int xDest, int yDest, int w, int h )
{
const Position *pPos = getPosition();
if( !pPos )
return;
int width = pPos->getWidth();
int height = pPos->getHeight();
if( width <= 0 || height <= 0 )
return;
rect region( pPos->getLeft(), pPos->getTop(),
pPos->getWidth(), pPos->getHeight() );
rect clip( xDest, yDest, w, h );
rect inter;
if( !rect::intersect( region, clip, &inter ) )
return;
if( m_resizeMethod == kScale )
{
// Use scaling method
if( width != m_pImage->getWidth() ||
height != m_pImage->getHeight() )
{
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
// Rescale the image with the actual size of the control
ScaledBitmap bmp( getIntf(), *m_pBitmap, width, height );
delete m_pImage;
m_pImage = pOsFactory->createOSGraphics( width, height );
m_pImage->drawBitmap( bmp, 0, 0 );
}
rImage.drawGraphics( *m_pImage,
inter.x - pPos->getLeft(),
inter.y - pPos->getTop(),
inter.x, inter.y,
inter.width, inter.height );
}
else if( m_resizeMethod == kMosaic )
{
int xDest0 = pPos->getLeft();
int yDest0 = pPos->getTop();
// Use mosaic method
while( width > 0 )
{
int curWidth = __MIN( width, m_pImage->getWidth() );
height = pPos->getHeight();
int curYDest = yDest0;
while( height > 0 )
{
int curHeight = __MIN( height, m_pImage->getHeight() );
rect region1( xDest0, curYDest, curWidth, curHeight );
rect inter1;
if( rect::intersect( region1, clip, &inter1 ) )
{
rImage.drawGraphics( *m_pImage,
inter1.x - region1.x,
inter1.y - region1.y,
inter1.x, inter1.y,
inter1.width, inter1.height );
}
curYDest += curHeight;
height -= m_pImage->getHeight();
}
xDest0 += curWidth;
width -= m_pImage->getWidth();
}
}
else if( m_resizeMethod == kScaleAndRatioPreserved )
{
int w0 = m_pBitmap->getWidth();
int h0 = m_pBitmap->getHeight();
int scaled_height = width * h0 / w0;
int scaled_width = height * w0 / h0;
// new image scaled with aspect ratio preserved
// and centered inside the control boundaries
int w, h;
if( scaled_height > height )
{
w = scaled_width;
h = height;
m_x = ( width - w ) / 2;
m_y = 0;
}
else
{
w = width;
h = scaled_height;
m_x = 0;
m_y = ( height - h ) / 2;
}
// rescale the image if size changed
if( w != m_pImage->getWidth() ||
h != m_pImage->getHeight() )
{
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
ScaledBitmap bmp( getIntf(), *m_pBitmap, w, h );
//.........这里部分代码省略.........
示例5: draw
void CtrlRadialSlider::draw( OSGraphics &rImage, int xDest, int yDest )
{
rImage.drawGraphics( *m_pImgSeq, 0, m_position * m_height, xDest, yDest,
m_width, m_height );
}