00110 {
00111
00112 srand(
unsigned(time(NULL)) );
00113
00114
00115 QImage* originalImage =
blackWhiteEffect( filename, NULL );
00116
00117
00118 QImage*
editedImage =
new QImage( originalImage->width(),
00119 originalImage->height(),
00120 originalImage->depth() );
00121
00122
00123
editedImage->fill( qRgb(255,255,255) );
00124
00125
00126
00127
00128
00129
00130
const int BLOCK_SIZE = 8;
00131
00132
00133
int blocksWide =
editedImage->width() / BLOCK_SIZE;
00134
if(blocksWide*BLOCK_SIZE <
editedImage->width())
00135 { blocksWide++; }
00136
00137
int blocksTall =
editedImage->height() / BLOCK_SIZE;
00138
if(blocksTall*BLOCK_SIZE <
editedImage->height())
00139 { blocksTall++; }
00140
00141
00142
int bx,by,x,y;
00143
for(
int i=0; i<10; i++)
00144 {
00145
00146
for(bx=0; bx<blocksWide; bx++)
00147 {
00148
for(by=0; by<blocksTall; by++)
00149 {
00150
00151
pickRandomPixelWithinBlock(
editedImage->width(),
00152
editedImage->height(),
00153 bx, by,
00154 BLOCK_SIZE,
00155 x, y );
00156
00157
double curGrayVal =
computeLocalGrayVal( editedImage, x, y );
00158
double goalGrayVal =
computeLocalGrayVal( originalImage, x, y );
00159
00160
00161
if( curGrayVal > goalGrayVal )
00162 {
drawDotAt( editedImage, x, y, 5 ); }
00163 }
00164 }
00165 }
00166
00167
00168
delete originalImage;
00169 originalImage = NULL;
00170
00171
00172
return editedImage;
00173 }