![]() |
Drawing problem |
Post Reply
|
| Author | |
BastianPL
Groupie
Joined: 15 April 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Topic: Drawing problemPosted: 07 May 2007 at 4:06pm |
|
Hi again. I have a new problem with XTP Controls. I am drawing some images in gallery control on fly. My code is:
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 |
|
|
Bastian
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |