svp
j'ai une boite dailog comme celui �i:
http://www.9q9q.org/index.php?image=P8faa3b96RRp
je choisis une image de l liste, je clock sur afficher pour l'affichage
mnt je fait entrer la largeur ,hauteur ,et initialiser le g�n�rateur et quand je click sur modif je vx modifier l'image affich�e (ou bien juste une portion)( qui est tte noir)
j'ecris la fonction randomspatia ui g�n�re des nombres pseudo al�atoire,( que je l'appel� ds fonction modif pour modifier l'image affich�e)
Code :
et la fonction modif :
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 void CImage::randomspatial( int nWidth, //[in] Largeur du bitmap en pixels int nHeight, //[in] Hauteur du bitmap en pixels int nscan, int seed, float matrand[] ) { // srand( (unsigned ) seed ); // srand( (unsigned)time( NULL ) ); for (int i=0; i<nWidth; i++) { for (int j=0;j<nHeight;j++) { matrand[j*nscan +i]=rand()/(float)RAND_MAX ; // matrand[i][j]=rand()/(1+(double)RAND_MAX); } } for ( i=0; i<nWidth; i++) { for (int j=0;j<nHeight;j++) { if ( matrand[j*nscan +i]<0.5) matrand[j*nscan +i]=0; // ou bien materand[i][j]=-1; else matrand[j*nscan +i]=255; // ou bien materand[i][j]=+1; } } }
Code :
le pb c que lors de l'ex�cution,qd je click sur le button modifier rien ne change
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11 void CContrasteDlg::OnModif() { // TODO: Add your control notification handler code here float matrand[56985]; int Larg = GetDlgItemInt(IDC_LARG); int Haut= GetDlgItemInt(IDC_HAUT); int Initial = GetDlgItemInt(IDC_INITGEN); m_image.randomspatial(Larg,Haut,Larg,Initial,matrand); GetDlgItem(IDC_IMAGE)->InvalidateRect(NULL); }![]()
est ce que j'ai fait une erreur!!!!!!!!!
Partager