20#include "RConfigure.h"
23# define X_DISPLAY_MISSING 1
24# define popen_flags "r"
26# include "Windows4root.h"
27# define popen_flags "rb"
30# define popen_flags "r"
34# include <afterbase.h>
36# define X_DISPLAY_MISSING 1
37# include <afterbase.h>
74 Warning(
"File2ASImage",
"GhostScript is not available");
78 if (
gSystem->AccessPathName(filename)) {
79 Warning(
"File2ASImage",
"input file %s is not accessible", filename);
83 const char *ppos = strrchr(filename,
'.');
92 UInt_t width = 0, height = 0;
96 FILE *fd = fopen(filename,
"r");
98 Warning(
"File2ASImage",
"input file %s is not readable", filename);
105 if (
line.IsNull() || !
line.BeginsWith(
"%"))
108 if (
line.BeginsWith(
"%%BoundingBox:")) {
111 sscanf(
line.Data(),
"%d %d %d %d", &lx, &ly, &ux, &uy);
112 width = std::abs(ux - lx);
113 height = std::abs(uy - ly);
125 cmd +=
" -dSAFER -dBATCH -dNOPAUSE -dQUIET -sDEVICE=png16m -dGraphicsAlphaBits=4 -sOutputFile=- ";
132 const UInt_t kBuffLength = 32768;
133 char buf[kBuffLength];
137 Long_t r = fread(&buf, 1, kBuffLength, in);
138 raw.
Append((
const char*)&buf,
r);
143 ASImageImportParams params;
145 params.width = width;
146 params.height = height;
147 params.filter = SCL_DO_ALL;
149 params.gamma_table =
nullptr;
150 params.compression = 0;
151 params.format = ASA_ASImage;
152 params.search_path =
nullptr;
155 ASImage *
ret = PNGBuff2ASimage((CARD8 *)raw.
Data(), ¶ms);
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
TASImagePlugin(const char *ext)
TString fGsExe
path to GhostScript interpreter
~TASPluginGS() override
dtor
TASPluginGS(const char *ext)
ctor
ASImage * File2ASImage(const char *filename) override
read PS/EPS/PDF file and convert it to ASImage
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void ToLower()
Change string to lower-case.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
const char * Data() const
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void CallRecursiveRemoveIfNeeded(TObject &obj)
call RecursiveRemove for obj if gROOT is valid and obj.TestBit(kMustCleanup) is true.