MCPcopy Create free account
hub / github.com/arrayfire/forge / kernel

Function kernel

examples/cpu/histogram.cpp:208–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208void 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
228void populateBins(Bitmap& bmp, int *hist_array, const unsigned nbins, float *hist_cols)
229{

Callers 1

mainFunction · 0.70

Calls 1

noiseMethod · 0.80

Tested by

no test coverage detected