1 #ifndef INCLUDE_WRITE_JPG 2 #define INCLUDE_WRITE_JPG 4 #include "image_parser.hpp" 8 #include "input_file.hpp" 29 STD_TR1::shared_ptr<palette> my_palette;
32 std::string filename_extension;
34 const char* name()
const {
return "jpg_image";};
37 void process_image_( MPI_Comm comm,
39 const std::string& filen );
62 typedef STD_TR1::shared_ptr<palette> ref;
64 void write_ppm_info(
const Bild& bild,
66 { use_palette_( bild, file);};
69 template <
class effective_palette>
70 void write_ppm(
const Bild& bild,
72 const effective_palette& t)
const;
75 virtual void use_palette_(
const Bild&,
89 void precalc(
const complex& c)
const {
91 white = (tmp <= white_thrshld);
104 if (tmp < 0.) tmp = 0.;
106 tmp = atan(tmp * scale) * M_2_PI;
109 char red(
const complex& c)
const {
if (white)
return 255;
return tmp * 255.;};
110 char green(
const complex& c)
const {
if (white)
return 255;
return tmp*tmp*(1.-tmp)*27./4.*255.;};
111 char blue(
const complex& c)
const {
if (white)
return 255;
return tmp * (1. - tmp) * (1. - tmp) * 27./4. * 255.;};
115 void use_palette_(
const Bild&, FILE*);
117 virtual const char* name()
const {
return "default_palette";};
118 double white_thrshld;
138 void precalc(
const complex& c)
const {
142 tmp = (log(tmp) + y0) * scale;
143 if (tmp < 0) tmp = 0;
144 if (tmp > 1) tmp = 1;
148 char red(
const complex& c)
const {
if (white)
return 255;
return tmp * 255.;};
149 char green(
const complex& c)
const {
if (white)
return 255;
return tmp*tmp*(1.-tmp)*27./4.*255.;};
150 char blue(
const complex& c)
const {
if (white)
return 255;
return tmp * (1. - tmp) * (1. - tmp) * 27./4. * 255.;};
154 void use_palette_(
const Bild&, FILE*);
156 virtual const char* name()
const {
return "log_palette";};
181 void precalc(
const complex& c)
const {
183 double f(max*(std::max(abs(c)*abs(c) - min,0.)));
185 f = atan(f / 6553) * M_2_PI * 65535;
187 tmp = (f > 65535) ? 65530 : static_cast<int>(f);};
189 char red(
const complex& c)
const {
return tmp / 256.;};
190 char green(
const complex& c)
const {
return tmp % 256;};
191 char blue(
const complex& c)
const {
return 0;};
195 void use_palette_(
const Bild&, FILE*);
197 virtual const char* name()
const {
return "height_palette";};
210 void precalc(
const complex& c)
const {
214 if (tmp < 0.) tmp = 0.;
215 tmp = atan(tmp * scale) * M_2_PI;};
217 char red(
const complex& c)
const {
if (white)
return 255;
return tmp * 255.;};
218 char green(
const complex& c)
const {
if (white)
return 255;
return tmp*tmp*(1.-tmp)*27./4.*255.;};
219 char blue(
const complex& c)
const {
if (white)
return 255;
return tmp * (1. - tmp) * (1. - tmp) * 27./4. * 255.;};
223 void use_palette_(
const Bild&, FILE*);
225 virtual const char* name()
const {
return "multilayer_default_palette";};
250 void precalc(
const complex& c)
const {
253 }
else if (part == 1) {
255 }
else if (part == 2) {
257 }
else if (part == 3) {
258 tmp = atan2(c.imag(),c.real());
260 tmp = atan(tmp * scale) * M_1_PI + 0.5;
265 char red(
const complex& c)
const {
266 return (0.70448+1.52424*(1.-tmp)-2.18358*(1.-tmp)*(1.-tmp)) * 255.;
268 char green(
const complex& c)
const {
269 return (0.0754843+3.05864*(1.-tmp)-2.77681*(1.-tmp)*(1.-tmp)) * 255;
271 char blue(
const complex& c)
const {
272 return (0.0892454+2.55404*(1.-tmp)-1.9815*(1.-tmp)*(1.-tmp))* 255.;
277 void use_palette_(
const Bild&, FILE*);
279 virtual const char* name()
const {
return "complex_palette";};
299 void precalc(
const complex& c)
const {
302 white = (tmp <= white_thrshld);
315 if (tmp < 0.) tmp = 0.;
317 tmp = atan(tmp * scale) * M_2_PI;
320 char red(
const complex& c)
const {
321 if (white)
return 255;
322 return (0.205465 -4.48508 *tmp+40.8598 *tmp*tmp-169.805 *tmp*tmp*tmp+343.401 *tmp*tmp*tmp*tmp-315.711 *tmp*tmp*tmp*tmp*tmp+106.514 *tmp*tmp*tmp*tmp*tmp*tmp) * 255.;
324 char green(
const complex& c)
const {
325 if (white)
return 255;
326 return (0.164678 +2.97057 *tmp-15.2531 *tmp*tmp+59.0754 *tmp*tmp*tmp-113.712 *tmp*tmp*tmp*tmp+99.8169 *tmp*tmp*tmp*tmp*tmp-32.0779 *tmp*tmp*tmp*tmp*tmp*tmp) * 255.;
328 char blue(
const complex& c)
const {
329 if (white)
return 255;
330 return (0.53106 +5.66654 *tmp-32.4304 *tmp*tmp+85.9473 *tmp*tmp*tmp-126.792 *tmp*tmp*tmp*tmp+95.8767 *tmp*tmp*tmp*tmp*tmp-28.7464 *tmp*tmp*tmp*tmp*tmp*tmp) * 255.;
335 void use_palette_(
const Bild&, FILE*);
337 virtual const char* name()
const {
return "parula_palette";};
338 double white_thrshld;
358 void precalc(
const complex& c)
const {
362 tmp = (log(tmp) + y0) * scale;
363 if (tmp < 0) tmp = 0;
365 if (tmp > 0.89) tmp = 0.89;
369 char red(
const complex& c)
const {
370 if (white)
return 255;
371 return (0.205465 -4.48508 *tmp+40.8598 *tmp*tmp-169.805 *tmp*tmp*tmp+343.401 *tmp*tmp*tmp*tmp-315.711 *tmp*tmp*tmp*tmp*tmp+106.514 *tmp*tmp*tmp*tmp*tmp*tmp) * 255.;
373 char green(
const complex& c)
const {
374 if (white)
return 255;
375 return (0.164678 +2.97057 *tmp-15.2531 *tmp*tmp+59.0754 *tmp*tmp*tmp-113.712 *tmp*tmp*tmp*tmp+99.8169 *tmp*tmp*tmp*tmp*tmp-32.0779 *tmp*tmp*tmp*tmp*tmp*tmp) * 255.;
377 char blue(
const complex& c)
const {
378 if (white)
return 255;
379 return (0.53106 +5.66654 *tmp-32.4304 *tmp*tmp+85.9473 *tmp*tmp*tmp-126.792 *tmp*tmp*tmp*tmp+95.8767 *tmp*tmp*tmp*tmp*tmp-28.7464 *tmp*tmp*tmp*tmp*tmp*tmp) * 255.;
384 void use_palette_(
const Bild&, FILE*);
386 virtual const char* name()
const {
return "parula_log_palette";};
use logarithmic black-blue-green-yellow-orange-red palette,
Definition: write_jpg.hpp:136
class to turn a complex value into a color
Definition: write_jpg.hpp:60
Class to contain wave-function image data.
Definition: generate_wavefunction.hpp:25
Make a jpg image out of a wavefunction jpg_image_processor:
Definition: write_jpg.hpp:23
Abstract base class to process calculated wavefunctions.
Definition: image_parser.hpp:21
creates a povray height ppm This palette will use red and green values to create a height field that ...
Definition: write_jpg.hpp:177
An abstract base class supporting xml_file_reading of input parameters.
Definition: input_file.hpp:79
Definition: write_jpg.hpp:208
a blue-white-red palette to visualize negative/positive values (in the real/imaginary part) ...
Definition: write_jpg.hpp:248
the default black-blue-green-yellow-orange-red palette
Definition: write_jpg.hpp:87
a yellow-green-blue palette similar to MATLAB's parula colormap
Definition: write_jpg.hpp:297
use a logarithmic yellow-green-blue palette similar to MATLAB's parula colormap
Definition: write_jpg.hpp:356