/** *
This class is to store information about segments of an image so * they can be processed in some sort of order easy going, relaxed, order. */ /** *
The segments class is a collection of segments, each which represents a rectangular area of an image.
* Each segment has four basic integer properties, x,y coordinates, width and height. A segment may also contain
* the portion of the image that it represents stored as a PImage. The segments class has methods for returning
* the next segment of an image, useful if using an image processing loop and you want to keep track of which
* segment of the image last dealt with. Built specifically for rendering a large image in small sections.
* NB: The second constructor takes in a PImage and breaks it down into segments by the specified cols and rows.
* The first constructor is a general purpose one that simply requires a maximum number of segments.
*/
class segments {
private segment[] segs;
private int count;
int last;
segments(int size) {
segs = new segment[size];
count = 0;
last = -1;
}
segments(PImage image, int cols, int rows) {
segs = new segment[cols*rows];
int segWidth = image.width/cols;
int segHeight = image.height/rows;
int count = 0;
for(int r=0; r