88 QImage originalImage( filename );
91 if( originalImage.depth() < 32 ) { originalImage = originalImage.convertDepth( 32, Qt::AutoColor ); }
100 editedImage =
new QImage( tmp->convertDepth( 32, Qt::AutoColor ) );
101 delete tmp; tmp=NULL;
105 bool useBusyIndicators =
false;
107 if( options != NULL && options->
getStatus() != NULL )
109 useBusyIndicators =
true;
114 if(useBusyIndicators)
116 QString statusMessage = qApp->translate(
"embossEffect",
"Applying Emboss Effect:" );
118 qApp->processEvents();
122 const int updateIncrement = (int) ( 0.01 * originalImage.width() * originalImage.height() );
130 int yPrev, yNext, xPrev, xNext;
134 const int embossRadius = (int)
MAX( 1, (sqrt(minDimen)/8) );
138 scanLine = originalImage.scanLine(y);
141 yPrev =
MAX( y-embossRadius, 0 );
148 xPrev =
MAX( x-embossRadius, 0 );
155 scanLine = originalImage.scanLine( yPrev );
156 sum-= qGray( *((QRgb*)scanLine + xPrev ) );
157 sum-= qGray( *((QRgb*)scanLine + x ) );
159 scanLine = originalImage.scanLine( y );
160 sum-= qGray( *((QRgb*)scanLine + xPrev ) );
161 sum+= qGray( *((QRgb*)scanLine + xNext ) );
163 scanLine = originalImage.scanLine( yNext );
164 sum+= qGray( *((QRgb*)scanLine + x ) );
165 sum+= qGray( *((QRgb*)scanLine + xNext ) );
168 sum =
MAX(
MIN( sum, 255), 0 );
172 rgb = ((QRgb*)scanLine+x);
173 double r = ((double)qRed(*rgb) )/255.0;
174 double g = ((double)qGreen(*rgb) )/255.0;
175 double b = ((double)qBlue(*rgb) )/255.0;
182 v = ((double)sum)/255;
186 int rp = (int)
MIN(
MAX((r*255), 0), 255 );
187 int gp = (int)
MIN(
MAX((g*255), 0), 255 );
188 int bp = (int)
MIN(
MAX((
b*255), 0), 255 );
191 *rgb = qRgb(rp,gp,bp);
194 if(useBusyIndicators)
201 qApp->processEvents();