git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10892 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -28,16 +28,12 @@
|
||||
#include "error.h"
|
||||
#include "memory.h"
|
||||
|
||||
#ifdef LAMMPS_JPEG
|
||||
#include "jpeglib.h"
|
||||
#endif
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
#define BIG 1.0e20
|
||||
|
||||
enum{PPM,JPG};
|
||||
enum{PPM,JPG,PNG};
|
||||
enum{NUMERIC,ATOM,TYPE,ELEMENT,ATTRIBUTE};
|
||||
enum{STATIC,DYNAMIC};
|
||||
enum{NO,YES};
|
||||
@ -58,12 +54,25 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
|
||||
int n = strlen(filename);
|
||||
if (strlen(filename) > 4 && strcmp(&filename[n-4],".jpg") == 0)
|
||||
filetype = JPG;
|
||||
else if (strlen(filename) > 4 && strcmp(&filename[n-4],".JPG") == 0)
|
||||
filetype = JPG;
|
||||
else if (strlen(filename) > 5 && strcmp(&filename[n-5],".jpeg") == 0)
|
||||
filetype = JPG;
|
||||
else if (strlen(filename) > 5 && strcmp(&filename[n-5],".JPEG") == 0)
|
||||
filetype = JPG;
|
||||
else if (strlen(filename) > 4 && strcmp(&filename[n-4],".png") == 0)
|
||||
filetype = PNG;
|
||||
else if (strlen(filename) > 4 && strcmp(&filename[n-4],".PNG") == 0)
|
||||
filetype = PNG;
|
||||
else filetype = PPM;
|
||||
|
||||
#ifndef LAMMPS_JPEG
|
||||
if (filetype == JPG) error->all(FLERR,"Cannot dump JPG file");
|
||||
if (filetype == JPG)
|
||||
error->all(FLERR,"Support for writing images in JPEG format not included");
|
||||
#endif
|
||||
#ifndef LAMMPS_PNG
|
||||
if (filetype == PNG)
|
||||
error->all(FLERR,"Support for writing images in PNG format not included");
|
||||
#endif
|
||||
|
||||
// atom color,diameter settings
|
||||
@ -536,6 +545,7 @@ void DumpImage::write()
|
||||
|
||||
if (me == 0) {
|
||||
if (filetype == JPG) image->write_JPG(fp);
|
||||
else if (filetype == PNG) image->write_PNG(fp);
|
||||
else image->write_PPM(fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user