alpha with color() in an image
in
Programming Questions
•
1 year ago
HI!
I want to copy one pixel-array in an other one. (one image in a second)
After that i want to check in the 2. image wheater there are pixels
with the color (128,0,128). After that, I want set this pixels to (0,0,0,0) with an alpha value.
But it dont work.
Here the code:
- i1.loadPixels();
- item1.loadPixels();
- //Pixel kopieren
- for (int i = 0; i < i1.pixels.length; i++)
- {
- item1.pixels[i] = i1.pixels[i];
- }
- //Nun die Transparenz zuweisen
- for (int i = 0; i < item1.pixels.length; i++)
- {
- if (item1.pixels[i] == color(128, 0, 128))
- {
- item1.pixels[i] = color(0, 0, 0,0);
- }
- }
- i1.updatePixels();
- item1.updatePixels();
Thanks
1