//implemention grayscale filter
#include"grayscale.h"
GrayScale::GrayScale()
:QObject(){
}
GrayScale::~GrayScale(){}
void GrayScale::toGrayScale(QImage* img){
int gray=0;
QRgb color;
for(int y=0; y<img->height(); y++){
for(int x=0; x<img->width(); x++){
color = img->pixel(x,y);
gray = qRed(color) + qGreen(color) + qBlue(color);
gray /= 3;
img->setPixel(x,y, qRgb(gray,gray,gray));
}
}
}