CBitmap bmpSrc;
bmpSrc.Attach( hBitmap );
item.pPopupBitmap->Attach( CXTPImageManager::Create32BPPDIBSection( 0, m_nPopupWidth, m_nPopupHeight + m_nCaptionHeight ) );
CXTPCompatibleDC dcSrc( 0, &bmpSrc );
CXTPCompatibleDC *pdcDest = new CXTPCompatibleDC( 0, item.pPopupBitmap );
BITMAP bmpInfo;
ZeroMemory( &bmpInfo, sizeof( BITMAP ) );
bmpSrc.GetBitmap( &bmpInfo );
int nWidth = bmpInfo.bmWidth;
int nHeight = bmpInfo.bmHeight;
if ( nWidth > m_nPopupWidth )
{
float fAspectRatio = (float)nWidth / (float)m_nPopupWidth;
nWidth = m_nPopupWidth;
nHeight = (int)( ( (float)nHeight / fAspectRatio ) + 0.5f );
}
if ( nHeight > m_nPopupHeight )
{
float fAspectRatio = (float)nHeight / (float)m_nPopupHeight;
nHeight = m_nPopupHeight;
nWidth = (int)( ( (float)nWidth / fAspectRatio ) + 0.5f );
}
int nX = ( m_nPopupWidth - nWidth ) / 2;
int nY = ( m_nPopupHeight - nHeight ) / 2;
// clear thumbnail
pdcDest->FillSolidRect( 0, 0, m_nPopupWidth, m_nPopupHeight, RGB( 252, 252, 252 ) );
// draw thumbnail
// delete pdcDest;
// pdcDest = new CXTPCompatibleDC( NULL, item.pPopupBitmap );
pdcDest->SetStretchBltMode( HALFTONE );
pdcDest->StretchBlt( nX + 1, nY + 1, nWidth - 2, nHeight - 2, &dcSrc, 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, SRCCOPY );
// draw pre-cut paper icon
ImagePreCutPaper.DrawImage( pdcDest, nWidth - 64, nHeight - 38, 64, 38 );
ImagePreCutPaper.DrawImage has following body:
ASSERT( pDC != NULL );
ASSERT( m_hBitmap != NULL );
// draw bitmap
CXTPImageManagerIcon::DrawAlphaBitmap( pDC, m_hBitmap, CPoint( nX, nY ), CSize( nWidth, nHeight ), CPoint( 0, 0 ), GetImageSize() );
Unfortunettly when i call this line my oryginal image disappears i see only new image but in fact i want to draw this new image over old image.
Everything works fine until I call this line.
Thanks for any help