[GME-commit] GMESRC/GME/MgaDecorators BitmapUtil.cpp,1.4,1.5 BitmapUtil.h,1.3,1.4

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Mon Sep 12 19:26:26 CDT 2005


Update of /project/gme-repository/GMESRC/GME/MgaDecorators
In directory escher:/tmp/cvs-serv22425

Modified Files:
	BitmapUtil.cpp BitmapUtil.h 
Log Message:
Printing bug fixed:
BitmapGEN case: wrong mapping mode used by default.

BitmapRES case: SelectObject with CBitmap succeeds only for Memory DC, failed in case of printing device. Replaced to use GDI+ based Graphics and Bitmap classes.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: BitmapUtil.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaDecorators/BitmapUtil.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** BitmapUtil.cpp	26 Jan 2005 17:30:50 -0000	1.4
--- BitmapUtil.cpp	12 Sep 2005 18:26:24 -0000	1.5
***************
*** 404,407 ****
--- 404,408 ----
  	ASSERT( m_pImage);
  	Graphics graphics(pDC->m_hDC);
+ 	graphics.SetPageUnit( UnitPixel);
  	graphics.DrawImage(m_pImage, dstRect.left, dstRect.top, dstRect.Width(), dstRect.Height());
  }
***************
*** 473,494 ****
  void BitmapRES::draw( CDC* pDC, const CRect& srcRect, const CRect& dstRect, DWORD dwOpCode ) const
  {
! 	CDC dc;
! 	dc.CreateCompatibleDC( pDC );
! 	dc.SelectObject( *m_pBitmap);
! 	pDC->StretchBlt( dstRect.left, dstRect.top, dstRect.Width(), dstRect.Height(),	&dc, srcRect.left, srcRect.top, srcRect.Width(), srcRect.Height(), dwOpCode );
  }
  
  void BitmapRES::load( UINT uiID )
  {
! 	m_pBitmap = new CBitmap();
! 	if ( ! m_pBitmap->LoadBitmap( uiID ) ) {
! 		delete m_pBitmap;
! 		m_pBitmap= NULL;
  		return;
  	}
! 	BITMAP hInfo;
! 	m_pBitmap->GetBitmap( &hInfo );
! 	CSize size( hInfo.bmWidth, hInfo.bmHeight );
! 	setSize( size.cx, size.cy );
  }
  
--- 474,497 ----
  void BitmapRES::draw( CDC* pDC, const CRect& srcRect, const CRect& dstRect, DWORD dwOpCode ) const
  {
! 	Graphics graphics(pDC->m_hDC);
! 	graphics.SetPageUnit( UnitPixel);
! 	graphics.DrawImage( m_pBitmap, dstRect.left, dstRect.top, dstRect.Width(), dstRect.Height());
  }
  
  void BitmapRES::load( UINT uiID )
  {
! 	// load a GDI CBitmap from the resources
! 	CBitmap gdiBitmap;
! 	if ( ! gdiBitmap.LoadBitmap( uiID ) ) {
  		return;
  	}
! 
! 	// create a GDI+ Bitmap from the CBitmap
! 	m_pBitmap = new Bitmap( (HBITMAP) gdiBitmap, (HPALETTE) CPalette());
! 	if( !m_pBitmap) {
! 		return;
! 	}
! 
! 	setSize( m_pBitmap->GetWidth(), m_pBitmap->GetHeight());
  }
  

Index: BitmapUtil.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaDecorators/BitmapUtil.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** BitmapUtil.h	26 Jan 2005 17:30:50 -0000	1.3
--- BitmapUtil.h	12 Sep 2005 18:26:24 -0000	1.4
***************
*** 232,236 ****
  {
  	private :
! 		CBitmap* m_pBitmap;
  
  	public :
--- 232,236 ----
  {
  	private :
! 		Bitmap*  m_pBitmap;
  
  	public :



More information about the GME-commit mailing list