104 for (i = 0; i < int(
sizeof(aligns) /
sizeof(aligns[0])); i++) {
105 if (strcasecmp(aligns[i].zName, z) == 0) {
106 result = aligns[i].iValue;
127 if (pImage->
fW != newWidth || pImage->
fH != newHeight) {
130 for (pElem = pImage->
fPList; pElem; pElem = pElem->
fINext) {
131 pElem->
fW = newWidth;
132 pElem->
fH = newHeight;
135 pImage->
fW = newWidth;
136 pImage->
fH = newHeight;
140 for (pElem = pImage->
fPList; pElem; pElem = pElem->
fINext) {
146 for (pElem = pImage->
fPList; pElem; pElem = pElem->
fINext) {
148 DrawRegion(pElem->
fX, pElem->
fY - pElem->
fAscent, pElem->
fW, pElem->
fH);
168 if (zSrc == 0)
return 0;
170 zSrc = ResolveUri(zSrc);
171 if (zSrc == 0)
return 0;
179 for (pImage = fImageList; pImage; pImage = pImage->
fPNext) {
180 if (strcmp(pImage->
fZUrl, zSrc) == 0
181 && strcmp(pImage->
fZWidth, zWidth) == 0
182 && strcmp(pImage->
fZHeight, zHeight) == 0) {
188 TImage *img = LoadImage(zSrc, atoi(zWidth), atoi(zHeight));
191 pImage =
new TGHtmlImage(
this, zSrc, zWidth, zHeight);
197 pImage->
fPNext = fImageList;
234 if (s.SendRaw(msg.
Data(), msg.
Length()) == -1)
236 Int_t size = 1024*1024;
237 buf = (
char *)
calloc(size,
sizeof(
char));
239 if (s.RecvRaw(buf, size) == -1) {
245 tmp = fopen(pathtmp.
Data(),
"wb");
250 fwrite(buf,
sizeof(
char), size, tmp);
254 if (image && !image->
IsValid()) {
283 if ((w > 0 && h > 0) && ((w != (int)image->
GetWidth()) ||
303 if (!strchr(z,
'%'))
return z;
305 if (!sscanf(z,
"%d", &n))
return z;
306 if (n < 0 || n > 100)
return z;
308 val = fCanvas->GetHeight() * 100;
310 val = fCanvas->GetWidth() * 100;
316 if (!pElem)
return z;
319 if (tz && !strchr(tz,
'%') && sscanf(tz,
"%d", &m)) {
320 snprintf(ret, 15,
"%d", m * 100 / n);
324 if (!pElem)
return z;
327 if (tz && !strchr(tz,
'%') && sscanf(tz,
"%d", &m)) {
328 snprintf(ret, 15,
"%d", m * 100 / n);
347 for (pBlock = fFirstBlock; pBlock; pBlock = pBlock->
fBNext) {
352 for (pElem = pBlock->
fPNext; pElem; pElem = pElem->
fPNext) {
355 return TokenNumber(pElem);
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
#define IMAGE_ALIGN_TextTop
virtual UInt_t GetHeight() const
TGHtmlImageMarkup * fINext
virtual UInt_t GetWidth() const
virtual Bool_t IsValid() const
This class represents a WWW compatible URL.
const char * GetProtocol() const
An abstract interface to image processing library.
const char * GetPctWidth(TGHtmlElement *p, char *opt, char *ret)
Return the height and width, converting to percent if required ret must be at least 16 characters lon...
virtual void Scale(UInt_t, UInt_t)
const char * GetFile() const
const char * GetHost() const
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
virtual const char * MarkupArg(const char *, const char *)
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
void ImageChanged(TGHtmlImage *image, int newWidth, int newHeight)
This routine is called when an image changes.
#define IMAGE_ALIGN_AbsBottom
R__EXTERN TSystem * gSystem
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
int GetImageAt(int x, int y)
This routine searchs for an image beneath the coordinates x,y and returns the token number of the the...
char * StrDup(const char *str)
Duplicate the string str.
virtual ~TGHtmlImage()
dtor.
static TImage * ReadRemoteImage(const char *url)
Temporary function to read remote pictures.
TGHtmlImage * GetImage(TGHtmlImageMarkup *p)
Given an.
TGHtmlImage(const TGHtmlImage &)
#define IMAGE_ALIGN_Middle
#define IMAGE_ALIGN_AbsMiddle
you should not use this method at all Int_t Int_t z
#define IMAGE_ALIGN_Bottom
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
int GetImageAlignment(TGHtmlElement *p)
Find the alignment for an image.
#define IMAGE_ALIGN_Right
virtual TImage * LoadImage(const char *uri, int w=0, int h=0)
This is the default LoadImage() procedure.
virtual const char * MarkupArg(const char *tag, const char *zDefault)
Lookup an argument in the given markup with the name given.
TGHtmlImageMarkup * fPList
const char * Data() const