How do I add a mask to images in an array?
in
Programming Questions
•
2 years ago
I would like to add a mask to the images in this array, but I've run into an error that I can't resolve. Does anyone know how to do this? The array works, just not the masking part.
What I would like to do is to assign the same mask to cover each image in the array.
Here is my code:
int multiplyNum;
int row;
int count;
PImage[] page;
PImage maskArray;
void setup() {
size(4000, 1000);
background(0);
page = new PImage[12];
multiplyNum = 150;
row = 17;
count = 0;
maskArray = loadImage("mask1.jpg");
//Load Images in Memory
for (int i=0; i<page.length; i++) {
page[i] = loadImage(i +".jpg");
}
noLoop();
}
void draw() {
for (int k=0; k<row; k++) {
page.mask(maskArray);
image(page[count], (k*multiplyNum), 1);
count++;
if(count%page.length ==0)count=0;
}
}
What I would like to do is to assign the same mask to cover each image in the array.
Here is my code:
int multiplyNum;
int row;
int count;
PImage[] page;
PImage maskArray;
void setup() {
size(4000, 1000);
background(0);
page = new PImage[12];
multiplyNum = 150;
row = 17;
count = 0;
maskArray = loadImage("mask1.jpg");
//Load Images in Memory
for (int i=0; i<page.length; i++) {
page[i] = loadImage(i +".jpg");
}
noLoop();
}
void draw() {
for (int k=0; k<row; k++) {
page.mask(maskArray);
image(page[count], (k*multiplyNum), 1);
count++;
if(count%page.length ==0)count=0;
}
}
1