14 #include <qapplication.h> 19 #include "../../gui/statusWidget.h" 66 if( editedImage->depth() < 32 )
69 editedImage =
new QImage( tmp->convertDepth( 32, Qt::AutoColor ) );
74 bool useBusyIndicators =
false;
76 if( options != NULL && options->
getStatus() != NULL )
78 useBusyIndicators =
true;
85 QString statusMessage = qApp->translate(
"blackWhiteEffect",
"Applying Black + White Effect:" );
87 qApp->processEvents();
91 const int updateIncrement = (int) ( 0.01 * editedImage->width() * editedImage->height() );
98 for( y=0; y<editedImage->height(); y++)
101 scanLine = editedImage->scanLine(y);
102 for( x=0; x<editedImage->width(); x++)
105 rgb = ((QRgb*)scanLine+x);
106 grayValue = (int) (0.2125*qRed(*rgb) + 0.7154*qGreen(*rgb) + 0.0721*qBlue(*rgb));
109 grayValue = QMIN( QMAX( grayValue, 0 ), 255 );
112 *rgb = qRgb( grayValue, grayValue, grayValue );
115 if(useBusyIndicators)
118 if(newProgress >= updateIncrement)
122 qApp->processEvents();
StatusWidget * getStatus()
QImage * blackWhiteEffect(QString filename, ManipulationOptions *options)