while loop with errors
in
Programming Questions
•
1 year ago
Hello,
I al trying to divide an image into sectors in order to gather color info per sector and recalculate the pixels per sector afterwards. For that i created a function createSectors that has a bug somewhere, since when I added it nothing happens anymore at runtime. Even the image is not displayed anymore.
Here is my code:
PImage b;
int sectorSize = 12;
void setup() {
size(976, 1560);
smooth();
b = loadImage("img.png");
noStroke();
}
void draw() {
image(b,0,0);
createSectors();
}
void createSectors() {
int sectorX = 1;
int x = 0;
while (x < width); {
int y = 0;
int sectorY = 1;
while (y < height); {
println("Sectorname =" + sectorX + "_" + sectorY);
sectorY = sectorY + 1;
y = y + sectorSize;
}
println("Sectorname =" + sectorX + "_" + sectorY);
sectorX = sectorX + 1;
x = x + sectorSize;
}
}
Can anyone help me?
Thanks in advance!!
1