boite dialog & appele fonction
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 :
Code:
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;
}
}
} |
et la fonction modif :
Code :
Code:
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);
} |
le pb c que lors de l'exécution,qd je click sur le button modifier rien ne change :?
est ce que j'ai fait une erreur!!!!!!!!!