0

Im using processing with java. I have a transparent background png drawing I made, it sort of looks like an abstract leaf, sort of like matisse. I know how to create shapes with random colors chosen from an array, so i can display that shape with different background colors for each frame in a loop, saving each. what I want to do next is create another layer over the drawing that is populated with a random color from my array, but to have that layer display only on the pixels from the underlying png that is loaded.

the end result is the ability to put out an endless number of randomly colored versions of that leaf design, with a random background color. I just havent figured out how to create this kind of clipping mask effect.

mVZ
  • 1

1 Answers1

0

You can use the leaf image as a mask for the dynamically colored object. This will apply the alpha channel (transparency) to the masked image. mask operates on images, so you’ll need to draw your color fill to a PGraphics or PImage and apply the mask to that image.

Depending on the specifics of the effect you’re trying to achieve, you might also be able to simply apply a color tint to the leaf image to change to the desired color.

Cadin
  • 4,275
  • 1
  • 14
  • 22