+ total_nb_attempts++;
+
+ if(total_nb_attempts >= max_total_nb_attempts) {
+ cerr << "There was "
+ << max_total_nb_attempts
+ << " attempts at generating the sequences, aborting." << endl;
+ abort();
+ }
+
+ } while(failed);
+
+ for(int t = 0; t < nb_images; t++) {
+ unsigned char *src = canvases[t]->_data;
+ unsigned char *dst = output + t * width * height * 3;
+ for(int d = 0; d < 3; d++) {
+ for(int y = 0; y < height; y++) {
+ for(int x = 0; x < width; x++) {
+ dst[x + width * (y + height * d)] = src[d + 4 * (x + width * y)];
+ }
+ }