20 #include "RConfigure.h"
23 # define X_DISPLAY_MISSING 1
24 # define popen_flags "r"
26 # include "Windows4root.h"
27 # define popen_flags "rb"
29 # include <X11/Xlib.h>
30 # define popen_flags "r"
35 # include <afterbase.h>
37 # include <win32/config.h>
38 # include <win32/afterbase.h>
39 # define X_DISPLAY_MISSING 1
58 delete [] fInterpreter;
59 fInterpreter =
StrDup(
"gswin32c.exe");
79 Warning(
"File2ASImage",
"GhostScript is not available");
84 Warning(
"File2ASImage",
"input file %s is not accessible", filename);
88 TString ext = (strrchr(filename,
'.') + 1);
98 FILE *fd = fopen(filename,
"r");
100 Warning(
"File2ASImage",
"input file %s is not readable", filename);
112 sscanf(line.
Data(),
"%d %d %d %d", &lx, &ly, &ux, &uy);
125 cmd +=
Form(
" -g%dx%d", width, height);
127 cmd +=
" -dSAFER -dBATCH -dNOPAUSE -dQUIET -sDEVICE=png16m -dGraphicsAlphaBits=4 -sOutputFile=- ";
135 const UInt_t kBuffLength = 32768;
136 static char buf[kBuffLength];
140 Long_t r = fread(&buf, 1, kBuffLength, in);
141 raw.
Append((
const char*)&buf, r);
146 ASImageImportParams params;
148 params.width = width;
149 params.height = height;
150 params.filter = SCL_DO_ALL;
152 params.gamma_table = 0;
153 params.compression = 0;
154 params.format = ASA_ASImage;
155 params.search_path = 0;
158 ASImage *ret = PNGBuff2ASimage((CARD8 *)raw.
Data(), ¶ms);
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
static const char * filename()
void ToLower()
Change string to lower-case.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual FILE * OpenPipe(const char *command, const char *mode)
Open a pipe.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
const char * Data() const
virtual const char * Getenv(const char *env)
Get environment variable.
virtual ~TASPluginGS()
dtor
TString & Append(const char *cs)
ASImage * File2ASImage(const char *filename)
read PS/EPS/PDF file and convert it to ASImage
R__EXTERN TSystem * gSystem
char * Form(const char *fmt,...)
TSubString Strip(EStripType s=kTrailing, char c= ' ') const
Return a substring of self stripped at beginning and/or end.
virtual int ClosePipe(FILE *pipe)
Close the pipe.
char * StrDup(const char *str)
Duplicate the string str.
Allows to read PS/EPS/PDF files via GhostScript.
ClassImp(TASPluginGS) TASPluginGS
ctor
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.