|
@ -44,7 +44,9 @@ void PNG::plot(const double* position) { |
|
|
I/O functions |
|
|
I/O functions |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
void PNG::output_file(const char* filename) const { |
|
|
void PNG::output_file(const char* filename_in) const { |
|
|
|
|
|
std::string filename = filename_in; |
|
|
|
|
|
filename += ".png"; |
|
|
unsigned int* max_int = new unsigned int[num_colors]; |
|
|
unsigned int* max_int = new unsigned int[num_colors]; |
|
|
double* power = new double[num_colors]; |
|
|
double* power = new double[num_colors]; |
|
|
|
|
|
|
|
@ -88,7 +90,7 @@ void PNG::output_file(const char* filename) const { |
|
|
power[i] = vibrancy*power[i] + (1.0 - vibrancy)*averagePower; |
|
|
power[i] = vibrancy*power[i] + (1.0 - vibrancy)*averagePower; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
pngwriter* pngFile = new pngwriter(width, height, 0.0, filename); |
|
|
pngwriter* pngFile = new pngwriter(width, height, 0.0, filename.c_str()); |
|
|
pngFile->setcompressionlevel(9); |
|
|
pngFile->setcompressionlevel(9); |
|
|
pngFile->settext("Attractor", "Joshua Moerman", "A awesome attractor", "AwesomeAttractor"); |
|
|
pngFile->settext("Attractor", "Joshua Moerman", "A awesome attractor", "AwesomeAttractor"); |
|
|
|
|
|
|
|
@ -125,14 +127,8 @@ void PNG::output_file(const char* filename) const { |
|
|
delete[] max_int; |
|
|
delete[] max_int; |
|
|
delete[] power; |
|
|
delete[] power; |
|
|
|
|
|
|
|
|
LogInfo("Writing %s\n", filename); |
|
|
LogInfo("Writing %s\n", filename.c_str()); |
|
|
|
|
|
|
|
|
std::ofstream file(filename); |
|
|
|
|
|
if(!file) { |
|
|
|
|
|
LogError("Couldn't write to file"); |
|
|
|
|
|
} |
|
|
|
|
|
pngFile->close(); |
|
|
pngFile->close(); |
|
|
|
|
|
|
|
|
LogMoreInfo("File written"); |
|
|
LogMoreInfo("File written"); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|