double random;
int color;
int[][] noiseImage = data;
for (int y=0;y
for(int x=0;x
random = generator.nextDouble() - 0.5; //256*(percent/100)
random *= 256*(percent/100);
color = noiseImage[x][y];
if (color + (int)random > 256){
color -= (int) random;
noiseImage[x][y] = color;
inputSourceImage.setRGB(x,y,color);
}
else if (color + (int)random < 0){
color -= (int)random;
noiseImage[x][y] = color;
inputSourceImage.setRGB(x,y,color);
}
else{
color += (int)random;
noiseImage[x][y] = color;
inputSourceImage.setRGB(x, y, color);
}
}
}
return noiseImage;
}
Part 4 <-- Back to Part 4
No comments:
Post a Comment