Stretch d'image, j'y arrive pas ...

Stretch d'image, j'y arrive pas ... - C++ - Programmation

Marsh Posté le 29-11-2002 à 11:23:06    

Je veux afficher un bitmap redimensionnée ds un CStatic ; mon bitmap est correct, mais le stretch ne change rien, mon image affichée à tjs sa taille d'origine ; aucun message d'erreur ...
 
 

Code :
  1. CStatic*  l_pCStatic ;
  2. HBITMAP  l_HBITMAP ;
  3. HDC         l_HDC ;
  4. l_HDC = ::GetDC ( this->m_hWnd ) ;
  5. // Création d'un bitmap
  6. if ( ( l_HBITMAP = CreateDIBitmap ( l_HDC, ( BITMAPINFOHEADER* ) l_pV_VideoFrameBuffer, CBM_INIT, ( BYTE* ) l_pV_VideoFrameBuffer + ( ( BITMAPINFOHEADER* ) l_pV_VideoFrameBuffer )->biSize + ( ( BITMAPINFOHEADER* ) l_pV_VideoFrameBuffer )->biClrUsed * sizeof ( RGBQUAD ), ( BITMAPINFO* ) l_pV_VideoFrameBuffer, DIB_RGB_COLORS ) )== NULL )
  7.       return ;
  8. if ( StretchDIBits ( ( HDC ) l_HBITMAP, 0, 0, l_BITMAPINFOHEADER.biWidth / 2, l_BITMAPINFOHEADER.biHeight / 2, 0, 0, l_BITMAPINFOHEADER.biWidth, l_BITMAPINFOHEADER.biHeight, ( BYTE* ) l_pV_VideoFrameBuffer + ( ( BITMAPINFOHEADER* ) l_pV_VideoFrameBuffer )->biSize + ( ( BITMAPINFOHEADER* ) l_pV_VideoFrameBuffer )->biClrUsed * sizeof ( RGBQUAD ), ( BITMAPINFO* ) l_pV_VideoFrameBuffer, DIB_RGB_COLORS, SRCCOPY ) == GDI_ERROR )
  9. {
  10.  int i = GetLastError() ;
  11. }
  12. l_pCStatic = new ( CStatic ) ;
  13. l_pCStatic->Create ( "", WS_CHILD + WS_VISIBLE + SS_BITMAP, CRect ( 0, 200, 0 + l_BITMAPINFOHEADER.biWidth / 2, 200 + l_BITMAPINFOHEADER.biHeight / 2 ), this ) ;
  14. l_pCStatic->SetBitmap ( l_HBITMAP ) ;


 
Pour faire + clair :
 
 

Code :
  1. CStatic*  l_pCStatic ;
  2. HBITMAP  l_HBITMAP ;
  3. HDC         l_HDC ;
  4. l_HDC = ::GetDC ( this->m_hWnd ) ;
  5. // Création d'un bitmap
  6. if ( ( l_HBITMAP = CreateDIBitmap ( l_HDC, ... ) )== NULL )
  7.       return ;
  8. if ( StretchDIBits ( ( HDC ) l_HBITMAP, 0, 0, X / 2, Y / 2, 0, 0, X, Y, ... ) == GDI_ERROR )
  9. GetLastError() ;
  10. l_pCStatic = new ( CStatic ) ;
  11. l_pCStatic->Create ( "", WS_CHILD + WS_VISIBLE + SS_BITMAP, CRect ( 0, 200, 0 + X / 2, 200 + Y / 2 ), this ) ;
  12. l_pCStatic->SetBitmap ( l_HBITMAP ) ;


Message édité par WhyMe le 29-11-2002 à 14:02:18

---------------
FeedBack HFR
Reply

Marsh Posté le 29-11-2002 à 11:23:06   

Reply

Marsh Posté le 29-11-2002 à 13:13:23    

pour faire plus clair t'as les balises cpp [:spamafote]

Reply

Marsh Posté le 29-11-2002 à 14:03:38    

chrisbk a écrit a écrit :

pour faire plus clair t'as les balises cpp [:spamafote]




 
Message édité, pour faire plaisir à Monsieur ...
J'aurais préféré une ID qu'une critique, mais bon ...


---------------
FeedBack HFR
Reply

Marsh Posté le 29-11-2002 à 14:39:48    

WhyMe a écrit a écrit :

 
 
Message édité, pour faire plaisir à Monsieur ...
J'aurais préféré une ID qu'une critique, mais bon ...




 
stait pas une critique mais une suggestion
 
Sinon pour la critique, et bien, tu codes comme un porc, je capte rien a ton code :D
 
j'ai deja fait ca, je peux te poster mon code ce soir, si tu veux


Message édité par chrisbk le 29-11-2002 à 14:40:25
Reply

Marsh Posté le 29-11-2002 à 14:58:34    

chrisbk a écrit a écrit :

 
 
stait pas une critique mais une suggestion
 
Sinon pour la critique, et bien, tu codes comme un porc, je capte rien a ton code :D
 
j'ai deja fait ca, je peux te poster mon code ce soir, si tu veux  




 
Vu comme çà, d'accord, c'était une suggestion :)  
C'est du code de test, donc je ne fignole pas ...
J'avoue ... C'est assez bourrin  :lol:  
 
Tjs preneur pour un morceau de code !  :)


---------------
FeedBack HFR
Reply

Marsh Posté le 30-11-2002 à 17:42:34    

chrisbk a écrit a écrit :

 
 
stait pas une critique mais une suggestion
 
Sinon pour la critique, et bien, tu codes comme un porc, je capte rien a ton code :D
 
j'ai deja fait ca, je peux te poster mon code ce soir, si tu veux  




 
Tjs pas u le code ...  :(


---------------
FeedBack HFR
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed