I have solved this problem, I will give the sample codes as follows:
/************************************************/
int CMainWindow :: changePicPixel(){
//
QPixmap Src;
QImage Img = NULL;
QColor Color;
QRgb Rgb;
int w, h;
int H, S, V;
int i, j;
Src.load("/root/Desktop/background.jpg");
// pImg = QImage :: fromMimeSource ( QString :: fromAscii ( "/root/Desktop/background.jpg" ) );
Img = Src.convertToImage();
if ( Img == NULL ){ // report error
return FALSE;
}
w = Img.width();
h = Img.height();
for ( i = 0; i < w; i ++ ){
for ( j = 0; j < h; j ++ ){
//
// pRgb = pImg->scanLine(index);
Rgb = Img.pixel( i, j);
Color.setRgb(Rgb);
Color.getHsv(&H, &S, &V);
// fprintf(stderr, "h:%d, s:%d, v:%d", H, S, V);
//H += 30; // hue
S += 30; // 0-255 saturation
//V += 30; // 0-255 brightness
if ( S >= 0 && S <= 255 ){
Color.setHsv(H, S, V);
}
Rgb = Color.rgb();
Img.setPixel(i, j, Rgb);
}
}
// fprintf(stderr, "h:%d, s:%d, v:%d\n", H, S, V);
Src.convertFromImage(Img);
// perror("error?");
pBackBuffer->fill(black);
bitBlt( pBackBuffer, 0, 0, &Src);
update();
return TRUE;
}
/*******************************************/
this is the function to change the bright and saturation of the picture, but I haven't realize the contrast changing of the picture, anyone can help me?