Exemple #1
0
bool LoadResource( CImage32* dest, HINSTANCE hInstance, WORD resnum )
{
  #ifdef __NEET_API_WIN32__
  HBITMAP tmpImage = (HBITMAP)::LoadImage( hInstance, MAKEINTRESOURCE(resnum),IMAGE_BITMAP, dest->Width(),dest->Height(), LR_CREATEDIBSECTION );
  #else
  HBITMAP tmpImage = (HBITMAP)::LoadImage( hInstance, MAKEINTRESOURCE(resnum),IMAGE_BITMAP, 0,0, 0 );
  #endif

  if (tmpImage == NULL) return false;

  CImageView* tmp = new CImageView( dest->Width(), dest->Height() );
  HDC hMemDC = CreateCompatibleDC( tmp->hDC() );
  SelectObject( hMemDC, tmpImage);
  BitBlt( tmp->hDC(), 0,0, dest->Width(),dest->Height(), hMemDC, 0,0, SRCCOPY ); // 転送
  dest->Blt( 0,0, tmp );
  delete tmp;

  DeleteDC(hMemDC);
  DeleteObject(tmpImage); // BMP解放

  return true;
}
Exemple #2
0
bool GetDCImage( CImage32* dest, HDC dc, int width, int height )
{
  dest->Resize( width, height );

  CImageView* tmp = new CImageView( dest->Width(), dest->Height() );

  BitBlt( tmp->hDC(), 0,0, width,height, dc, 0,0, SRCCOPY );
  dest->Blt( 0,0, tmp );
  dest->Filter( FLT_OR, Bpp32(0xFF000000) );

  delete tmp;

  return TRUE;
}