By drawing Bitmap, utilizing "StretchBlt" (VC++ 6), I get upside down image. Please suggest ways to get the correct Bitmap picture. Any help would be greatly appreciated. German Ls2333@mail.biu.ac.il
User 477100
Posts
-
upside down Bitmap image -
How to improve bitmap drawing quality?I need to graphically represent dynamically changing physical grid (300x300) on maximal logical display coordinates, which is usually much larger (~600x600 and more). To avoid blinking, I, first, create Bitmap (according to the grid size) in the memory and thus, using BitBlt, extend it graphically to maximal display size. My problem is that such extension makes Bitmap quality unacceptable. However, using physical grid with the same size (or more) as the display projected, doesn’t reduce the quality. Enclosed below please find the code. void CRecDrawView::OnDraw(CDC* pDC) { CRect rect ; int X, X1, Y, Y1, MatrixPart, DrawPart; COLORREF color = RGB( 128, 128, 0 ); GetClientRect(rect ); int oldBkMode = pDC->SetBkMode(TRANSPARENT); DrawPart = (rect.Width( ) < rect.Height( ) ) ? rect.Width( ) : rect.Height( ) ; if(DrawPart > MaxCoordinate) DrawPart = MaxCoordinate; MatrixPart = MaxCoordinate/DrawPart ; // part of matrix, which must be displayed X = 0 ; X1 = X + DrawPart; Y = 0 ; Y1 = Y + DrawPart; CDC memdc, * myDC; pDC->SetMapMode(MM_ISOTROPIC); SetWindowExtEx(*pDC,DrawPart,DrawPart,NULL); SetViewportExtEx(*pDC,rect.right, -rect.bottom,NULL); SetViewportOrgEx(*pDC,0,rect.bottom,NULL); CBitmap bmp, *poldbmp; memdc.CreateCompatibleDC( pDC); bmp.CreateCompatibleBitmap (pDC, DrawPart, DrawPart); poldbmp = memdc.SelectObject( &bmp ); memdc.BitBlt( 0,0,DrawPart, DrawPart,&memdc, 0, 0, WHITENESS ); myDC = &memdc; ... } I’ll be much appreciated for any kind of help. German