Hi! I go back to the forum for help.
I’m with a project wanting to simulate with each click a different brush stroke, with a different color.
Before helped me to generate the video array but now I want to mask each video so that the black background is transparent and the white line is colored.
So far I have this code, without the mask part it works with the videos with a black background and white stroke.
What am I doing wrong?
What I want is:
- take that video as image
- apply the mask
- color it
Before the videos were seen, with the part of the mask nothing is seen but the code runs without errors.
Thanks
class Pincelada {
//1. Atributos
int maxVideos;
//Array para guardar toos los videos:
Movie[] misVideos;
//random var:
int rand;
//Duración del video:
float duracion;
//estado
String estado;
color tinta;
// PImage imagen;
//2. Constructor
Pincelada(PApplet myApplet) {
maxVideos = 5;
misVideos = new Movie[maxVideos];
//No hace nada:
estado = "espera";
tinta = color(155, 155, 200);
for (int i = 0; i < misVideos.length; i++ ) {
println( "trazo"+nf(i, 2) + ".mov");
misVideos[i] = new Movie (myApplet, "trazo"+nf(i, 2) + ".mov");
}
}
//3. Métodos
void dibujar() {
if (videoPlay.size() > 0) {
for (int i = 0; i < videoPlay.size(); i++ ) {
videoPlay.get(i).play();
//Mask from the first frame to apply:
PImage imagen = videoPlay.get(i).get(0, 0, videoPlay.get(i).width, videoPlay.get(i).height);
imagen.mask(imagen);
pushStyle();
image(imagen, videoPos.get(i).x, videoPos.get(i).y);
imageMode(CENTER);
tint(tinta);
println(videoPlay);
popStyle();
}
}
}