110{
111
112 srand( unsigned(time(NULL)) );
113
114
116
117
118 QImage*
editedImage =
new QImage( originalImage->width(),
119 originalImage->height(),
120 originalImage->depth() );
121
122
124
125
126
127
128
129
130 const int BLOCK_SIZE = 8;
131
132
133 int blocksWide =
editedImage->width() / BLOCK_SIZE;
134 if(blocksWide*BLOCK_SIZE < editedImage->
width())
135 { blocksWide++; }
136
137 int blocksTall =
editedImage->height() / BLOCK_SIZE;
138 if(blocksTall*BLOCK_SIZE < editedImage->
height())
139 { blocksTall++; }
140
141
142 int bx,by,x,y;
143 for(int i=0; i<10; i++)
144 {
145
146 for(bx=0; bx<blocksWide; bx++)
147 {
148 for(by=0; by<blocksTall; by++)
149 {
150
153 bx, by,
154 BLOCK_SIZE,
155 x, y );
156
159
160
161 if( curGrayVal > goalGrayVal )
163 }
164 }
165 }
166
167
168 delete originalImage;
169 originalImage = NULL;
170
171
173}
QImage * blackWhiteEffect(QString filename, ManipulationOptions *options)
double computeLocalGrayVal(QImage *image, int x, int y)
void pickRandomPixelWithinBlock(int width, int height, int blockX, int blockY, int BLOCK_SIZE, int &x, int &y)
void drawDotAt(QImage *image, int x, int y, int)