I have an Image, or Pixelart for lack of better word, of very small size. It is actually just an array of numbers of around this size: new int[150][10]
. I draw lines and curves on this array, mostly one colour on a black background. It is meant to control an LED-Strip later on. So now I am searching for a method to antialias the lines, curves and shapes I draw. I just want to input my array, kind of like this:
int[][] antiAlias(int[][] image) {
int[][] result = new int[image.length][image[0].length];
// do magic here
return result;
}
I have stumbled across Wu's antialiasing, but as far as I can tell it's only for drawing lines. I would really appreciate if someone could give me a hint as to what kind of algorithm I should look for.
I also read that the antialias-effect can be achieved with downsampling. As it would be no problem for me to create the lines and curves in an array with higher resolution, this could also be an option. But I don't have any idea how to perform downsampling, and everything I can find on the internet about it always works with Image
- Objects and uses libraries, which is of course no option since I am not using an actual image.
I would like a downsampling function like this:
// scale should be power of 2 (I guess??)
int[][] downsample(int[][] image, int scale) {
int[][] result = new int[image.length / 2][image[0].length / 2];
// do magic here
if (scale > 2) return downsample(result, scale / 2);
return result;
}
Again, if anyone has a good idea for me what kind of algorithms I could look into, I would very much appreciate it.