Débutant : Quelle fonction pour les pixels ????

sebeuste Messages postés 19 Date d'inscription vendredi 16 mai 2003 Statut Membre Dernière intervention 5 avril 2005 - 26 févr. 2004 à 17:47
lastpixl Messages postés 56 Date d'inscription samedi 28 juin 2003 Statut Membre Dernière intervention 16 février 2006 - 2 mars 2004 à 09:54
Je voudrais reussir a definir chaque pixel de l'ecran de la console mais je ne sais pas quelle bibliothèque utilisée et quelle fonction non plus .... Je ne suis pas très avancé en C++ ... bien, si quelqu'un peut m'aider ?
Sbeu!!!

3 réponses

lastpixl Messages postés 56 Date d'inscription samedi 28 juin 2003 Statut Membre Dernière intervention 16 février 2006
1 mars 2004 à 20:39
Si c'est l'écran d'une fenêtre, SetPixel

+++
Lastpix'l
0
sebeuste Messages postés 19 Date d'inscription vendredi 16 mai 2003 Statut Membre Dernière intervention 5 avril 2005
1 mars 2004 à 21:05
C'est sympa mais c'est dans quel librairie ????? et comment le savoir toute ces fontions ????
Sbeu!!!
0
lastpixl Messages postés 56 Date d'inscription samedi 28 juin 2003 Statut Membre Dernière intervention 16 février 2006
2 mars 2004 à 09:54
COLORREF SetPixel(
HDC hdc, // handle to DC
int X, // x-coordinate of pixel
int Y, // y-coordinate of pixel
COLORREF crColor // pixel color
);
Header: Declared in Wingdi.h; include Windows.h.
Library: Use Gdi32.lib.

(de msdn).

Pour S'en servir, il faut un hDc, récupérable avec
HDC GetDC(
HWND hWnd // handle to window
);
Parameters
hWnd
[in] Handle to the window whose DC is to be retrieved. If this value is NULL, GetDC retrieves the DC for the entire screen.
Windows 98/Me, Windows 2000/XP: To get the DC for a specific display monitor, use the EnumDisplayMonitors and CreateDC functions.
.
#include <windows.h>

---Création de la fenêtre etc---
HDC hDc;
hDc = GetDC(hWnd);
SetPixel(hDc, 1, 1, (COLORREF) RGB(255,255,255)); //Pour afficher un pixel noir

Fait sans compilateur mais ca devrait marcher... Le cast n'est peut-être pas utile.

+++
Lastpix'l
0
Rejoignez-nous