175 float multiplier = 1.0f / 255.0f;
181 for( y=0; y<image.height(); y++)
184 scanLine = image.scanLine(y);
185 for( x=0; x<image.width(); x++)
188 rgb = ((QRgb*)scanLine+x);
191 int index = x + y*image.width();
195 buffer[index] = multiplier * qRed( *rgb );
196 else if( channel == 1 )
197 buffer[index] = multiplier * qGreen( *rgb );
199 buffer[index] = multiplier * qBlue( *rgb );
254 int index1, index2, index3, index4;
261 float v1, v2, v3, v4;
262 uchar* scanline =
edgeImage->scanLine( y1 );
263 QRgb* rgb = ((QRgb*)scanline+x1);
264 v1 = ((float) qRed( *rgb )) / 255.0f;
265 rgb = ((QRgb*)scanline+x2);
266 v2 = ((float) qRed( *rgb )) / 255.0f;
269 rgb = ((QRgb*)scanline+x1);
270 v3 = ((float) qRed( *rgb )) / 255.0f;
271 rgb = ((QRgb*)scanline+x2);
272 v4 = ((float) qRed( *rgb )) / 255.0f;
275 v1 = (edgeX-x1)*v2 + (1 - edgeX + x1)*v1;
276 v3 = (edgeX-x1)*v4 + (1 - edgeX + x1)*v3;
279 v1 = (edgeY-y1)*v3 + (1 - edgeY + y1)*v1;
317 int yTimesWidth = y*
width;
318 int regionTimesWidth;
324 regionTimesWidth = region*
width;
326 for(x=0; x<
width; x++)
343 int xMid = lastX + ((x-1) - lastX)/2;
345 for(x2=lastX+1; x2<=xMid; x2++)
348 for(x2=xMid+1; x2<x; x2++)
361 for(x2=lastX+1; x2<
width; x2++)
372 regionTimesWidth = region*
width;
376 for(x=1; x<
width; x++)
385 for(x=
width-1; x>=0; x--)
397 for(x=0; x<
width; x++)
402 buffer[x + yTimesWidth] = bufferVal;
441 int regionTimesHeight;
447 regionTimesHeight = region*
height;
466 int yMid = lastY + ((y-1) - lastY)/2;
468 for(y2=lastY+1; y2<=yMid; y2++)
471 for(y2=yMid+1; y2<y; y2++)
484 for(y2=lastY+1; y2<
height; y2++)
495 regionTimesHeight = region*
height;
508 for(y=
height-1; y>=0; y--)
532 uchar* imageScanline = NULL;
533 for( y=0; y<image.height(); y++)
535 imageScanline = image.scanLine(y);
536 for( x=0; x<image.width(); x++)
539 rgb = ((QRgb*)imageScanline+x);
542 int index = x + y*image.width();
545 int blurredColor = QMAX( QMIN( ((
int) (255*
buffer[index])), 255 ), 0 );
555 alpha = 1.0f - alpha;
560 *rgb = qRgb( (
int) (alpha*blurredColor + (1-alpha)*qRed(*rgb)),
561 qGreen(*rgb), qBlue(*rgb) );
562 else if( channel == 1 )
563 *rgb = qRgb( qRed(*rgb),
564 (
int) (alpha*blurredColor + (1-alpha)*qGreen(*rgb)),
567 *rgb = qRgb( qRed(*rgb), qGreen(*rgb),
568 (
int) (alpha*blurredColor + (1-alpha)*qBlue(*rgb)) );