i have working prototype-code creates .ppm
image file set of simple parameters.
the purpose create large picture (something 100000 * 100000 pixels) , print high-resolution wallpaper large format laser printer.
the problem have program crashes when height/width superior 22000 pixels.
in program, data stored in deque
while computing, @ end deque
exported file.
the program creates data line-by-line, i.e., after each line deque
filled dataset 1 line of picture.
is possible write deque
in file each time line has been processed , clear deque
before starting next one??
here's code:
#include <iostream> #include <fstream> #include <vector> #include <deque> #include <iterator> #include <cstdlib> #include <string> #include <sstream> using namespace std; // constant values double da=1; //densities double db=0.5; double dc=0.5; double dd=0; double l = 22000; //width & height double h = 22000; //double u = 1; // unit double d = 0; // gamma double e = 0; // erreur locale vector <double> f; // erreur dynamique int main () { // vector deque <int> dequea; f.push_back (0); float = 0; float b = 0; // local variables double io = 0; // variable i/o while (a<l+1, b<h+1){ //values given & b double dl = da-da*(b/h)+dc*(b/h); double dr = db-db*(b/h)+dd*(b/h); double d = dl-dl*(a/l)+dr*(a/l); //gamma if (e+0-d<=-0.5) { dequea.push_back(1); io = 1; } else { dequea.push_back(0); io = 0; } e = e+io-d; f.push_back(e); // next pixel & next line a++; if (a>l) { = 0; b = b++; e = 0; f.clear(); } } //export values .txt file ofstream output_file("./test.ppm"); // write file header output_file << "p1\n" << (l+1) << " " << (h+1) << "\n"; //write image data ostream_iterator<int> output_iterator(output_file, "\n"); copy(dequea.begin(), dequea.end(), output_iterator); }
Comments
Post a Comment