| 206 | } |
| 207 | |
| 208 | void kernel(Bitmap& bmp) |
| 209 | { |
| 210 | PerlinNoise perlin; |
| 211 | |
| 212 | for (unsigned y=0; y<bmp.height; ++y) { |
| 213 | for (unsigned x=0; x<bmp.width; ++x) { |
| 214 | int offset = x + y * bmp.width; |
| 215 | |
| 216 | float u = x/(float)(bmp.width); |
| 217 | float v = y/(float)(bmp.height); |
| 218 | |
| 219 | unsigned char noiseVal = (unsigned char)(255 * perlin.noise(u, v)); |
| 220 | bmp.ptr[offset*4 + 0] = noiseVal; |
| 221 | bmp.ptr[offset*4 + 1] = noiseVal; |
| 222 | bmp.ptr[offset*4 + 2] = noiseVal; |
| 223 | bmp.ptr[offset*4 + 3] = 255; |
| 224 | } |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | void populateBins(Bitmap& bmp, int *hist_array, const unsigned nbins, float *hist_cols) |
| 229 | { |