本文整理汇总了C++中OSGraphics类的典型用法代码示例。如果您正苦于以下问题:C++ OSGraphics类的具体用法?C++ OSGraphics怎么用?C++ OSGraphics使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OSGraphics类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateRectRgn
void Win32Graphics::drawGraphics( const OSGraphics &rGraphics, int xSrc,
int ySrc, int xDest, int yDest, int width,
int height )
{
if( width == -1 )
{
width = rGraphics.getWidth();
}
if( height == -1 )
{
height = rGraphics.getHeight();
}
// Create the mask for transparency
HRGN mask = CreateRectRgn( xSrc, ySrc, xSrc + width, ySrc + height );
CombineRgn( mask, ((Win32Graphics&)rGraphics).getMask(), mask, RGN_AND );
OffsetRgn( mask, xDest - xSrc, yDest - ySrc );
// Copy the image
HDC srcDC = ((Win32Graphics&)rGraphics).getDC();
SelectClipRgn( m_hDC, mask );
BitBlt( m_hDC, xDest, yDest, width, height, srcDC, xSrc, ySrc, SRCCOPY );
// Add the source mask to the mask of the graphics
CombineRgn( m_mask, mask, m_mask, RGN_OR );
DeleteObject( mask );
}
示例2: getIntf
void Win32Graphics::drawGraphics( const OSGraphics &rGraphics, int xSrc,
int ySrc, int xDest, int yDest, int width,
int height )
{
// check and adapt to source if needed
if( !checkBoundaries( 0, 0, rGraphics.getWidth(), rGraphics.getHeight(),
xSrc, ySrc, width, height ) )
{
msg_Err( getIntf(), "nothing to draw from graphics source" );
return;
}
// check destination
if( !checkBoundaries( 0, 0, m_width, m_height,
xDest, yDest, width, height ) )
{
msg_Err( getIntf(), "out of reach destination! pls, debug your skin" );
return;
}
// Create the mask for transparency
HRGN mask = CreateRectRgn( xSrc, ySrc, xSrc + width, ySrc + height );
CombineRgn( mask, ((Win32Graphics&)rGraphics).getMask(), mask, RGN_AND );
OffsetRgn( mask, xDest - xSrc, yDest - ySrc );
// Copy the image
HDC srcDC = ((Win32Graphics&)rGraphics).getDC();
SelectClipRgn( m_hDC, mask );
BitBlt( m_hDC, xDest, yDest, width, height, srcDC, xSrc, ySrc, SRCCOPY );
// Add the source mask to the mask of the graphics
CombineRgn( m_mask, mask, m_mask, RGN_OR );
DeleteObject( mask );
}
示例3: updateShape
void TopWindow::updateShape()
{
// Set the shape of the window
if( m_pActiveLayout )
{
OSGraphics *pImage = m_pActiveLayout->getImage();
if( pImage )
{
pImage->applyMaskToWindow( *getOSWindow() );
}
}
}
示例4: SetWindowPos
void Win32Tooltip::show( int left, int top, OSGraphics &rText )
{
// Source drawable
HDC srcDC = ((Win32Graphics&)rText).getDC();
int width = rText.getWidth();
int height = rText.getHeight();
// Set the window on top, resize it and show it
SetWindowPos( m_hWnd, HWND_TOPMOST, left, top, width, height, 0 );
ShowWindow( m_hWnd, SW_SHOW );
HDC wndDC = GetDC( m_hWnd );
BitBlt( wndDC, 0, 0, width, height, srcDC, 0, 0, SRCCOPY );
ReleaseDC( m_hWnd, wndDC );
}
示例5: getPosition
void CtrlImage::draw( OSGraphics &rImage, int xDest, int yDest )
{
const Position *pPos = getPosition();
if( pPos )
{
int width = pPos->getWidth();
int height = pPos->getHeight();
if( m_resizeMethod == kScale )
{
// Use scaling method
if( width > 0 && height > 0 )
{
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_rBitmap, width, height );
SKINS_DELETE( m_pImage );
m_pImage = pOsFactory->createOSGraphics( width, height );
m_pImage->drawBitmap( bmp, 0, 0 );
}
rImage.drawGraphics( *m_pImage, 0, 0, xDest, yDest );
}
}
else
{
// Use mosaic method
while( width > 0 )
{
int curWidth = __MIN( width, m_pImage->getWidth() );
height = pPos->getHeight();
int curYDest = yDest;
while( height > 0 )
{
int curHeight = __MIN( height, m_pImage->getHeight() );
rImage.drawGraphics( *m_pImage, 0, 0, xDest, curYDest,
curWidth, curHeight );
curYDest += curHeight;
height -= m_pImage->getHeight();
}
xDest += curWidth;
width -= m_pImage->getWidth();
}
}
}
}
示例6: draw
void CtrlTree::draw( OSGraphics &rImage, int xDest, int yDest )
{
if( m_pImage )
{
rImage.drawGraphics( *m_pImage, 0, 0, xDest, yDest );
}
}
示例7: 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) );
}
}
}
示例8: draw
void CtrlButton::draw( OSGraphics &rImage, int xDest, int yDest )
{
if( m_pImg )
{
// Draw the current image
rImage.drawGraphics( *m_pImg, 0, 0, xDest, yDest );
}
}
示例9: draw
void CtrlVideo::draw( OSGraphics &rImage, int xDest, int yDest )
{
const Position *pPos = getPosition();
if( pPos )
{
// Draw a black rectangle under the video to avoid transparency
rImage.fillRect( pPos->getLeft(), pPos->getTop(), pPos->getWidth(),
pPos->getHeight(), 0 );
}
}
示例10: 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 );
}
示例11: 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 );
}
示例12: 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 );
}
示例13: 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 );
}
示例14: 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 );
}
}
}
示例15: draw
void CtrlVideo::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 ) )
{
// Draw a black rectangle under the video to avoid transparency
rImage.fillRect( inter.x, inter.y, inter.width, inter.height, 0 );
}
if( m_pVoutWindow )
{
m_pVoutWindow->show();
}
}