ArrayList.toArray(); object vs int
in
Programming Questions
•
3 years ago
Hi,
I'm new to Processing, so I hope this goes to the right board.
I'm adding pixels from an image array to an arrayList called pixel. My purpose is to sort all the pixels in a special way. After I've ensured where to place them in the img.pixels array I'm storring them in a arrayList called pixel (just because Processing doesn't seem to perform basic array operations like pop, push, slice, etc.).
pixel.add(where, img.pixels[x]);
First Question: Is it a problem if I leave some positions in the arrayList void? i.e.: [0] = 1, [1]= nothing in here, [2]=3 ... and so on... because the values don't come in a correct order from 0 to n. Processing isn't complaining about it, but I'm not sure.
I'm trying to apply the arrayList pixel to the pixels array of my image. But neither the arraylist.toarray method nor img.pixels[x] = pixel.get(x); works. It tells me that I cant assign an object to an integer, which sounds logical to me.
Second Question: How do I convert a Object delivered by the get() Method into an integer?
Thanks!
leerraum
I'm new to Processing, so I hope this goes to the right board.
I'm adding pixels from an image array to an arrayList called pixel. My purpose is to sort all the pixels in a special way. After I've ensured where to place them in the img.pixels array I'm storring them in a arrayList called pixel (just because Processing doesn't seem to perform basic array operations like pop, push, slice, etc.).
pixel.add(where, img.pixels[x]);
First Question: Is it a problem if I leave some positions in the arrayList void? i.e.: [0] = 1, [1]= nothing in here, [2]=3 ... and so on... because the values don't come in a correct order from 0 to n. Processing isn't complaining about it, but I'm not sure.
I'm trying to apply the arrayList pixel to the pixels array of my image. But neither the arraylist.toarray method nor img.pixels[x] = pixel.get(x); works. It tells me that I cant assign an object to an integer, which sounds logical to me.
Second Question: How do I convert a Object delivered by the get() Method into an integer?
Thanks!
leerraum
1