Bitblt

Bitblt - C++ - Programmation

Marsh Posté le 31-07-2002 à 18:50:35    

Voila mon petit probleme, je veux afficher quelques pixels à l'écran...
Ca marche trés bien avec :

Code :
  1. void CAffPCXView::OnDraw(CDC* pDC)
  2. {
  3. CAffPCXDoc* pDoc = GetDocument();
  4. ASSERT_VALID(pDoc);
  5. // TODO: add draw code for native data here
  6. long int compteur1=0;
  7. while (compteur1<pDoc->ImageSize)
  8. {
  9.  pDC->SetPixelV(compteur1%(pDoc->XSize),compteur1/(pDoc->XSize),(pDoc->imagexy2[compteur1++]));
  10. }
  11. }


 
 
Mais je fait ça :

Code :
  1. void CAffPCXView::OnDraw(CDC* pDC)
  2. {
  3. CAffPCXDoc* pDoc = GetDocument();
  4. ASSERT_VALID(pDoc);
  5. // TODO: add draw code for native data here
  6. CDC aDC;
  7. aDC.CreateCompatibleDC ( pDC );
  8. long int compteur1=0;
  9. while (compteur1<pDoc->ImageSize)
  10. {
  11.  aDC.SetPixelV(compteur1%(pDoc->XSize),compteur1/(pDoc->XSize),(pDoc->imagexy2[compteur1++]));
  12. }
  13. pDC->BitBlt(0,0,pDoc->XSize,pDoc->YSize,&aDC,0,0,SRCCOPY);
  14. aDC.DeleteDC();
  15. }


 
Ca ne marche plus...
Pourquoi?

Reply

Marsh Posté le 31-07-2002 à 18:50:35   

Reply

Marsh Posté le 31-07-2002 à 19:40:58    

il faut que tu ai une image compatible bmp, tu peux utilisé CreateCompatibleBitmap et utiliser setpixel pour creer une palette pour cette bitmap. Ensuite, bitblt devrait fonctionner

Reply

Marsh Posté le 31-07-2002 à 22:17:14    


Merci pour ta réponse KarlKoX,
Je vais essayer de faire ça, je vais mettre du temps car je débute...

Reply

Sujets relatifs:

Leave a Replay

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