Roxen.git / server / modules / graphics / graphic_text.pike

version» Context lines:

Roxen.git/server/modules/graphics/graphic_text.pike:1: - constant cvs_version="$Id: graphic_text.pike,v 1.161 1999/05/19 01:33:35 peter Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.162 1999/05/19 02:57:18 peter Exp $";   constant thread_safe=1;      #include <config.h>   #include <module.h>   #include <stat.h>   inherit "module";   inherit "roxenlib";      #ifndef VAR_MORE   #define VAR_MORE 0   #endif /* VAR_MORE */      array register_module()   { -  return ({ MODULE_PARSER, +  return ({ MODULE_PARSER|MODULE_LOCATION,    "Graphics text",    "Generates graphical texts.<p>"    "See <tt>&lt;gtext help&gt;&lt;/gtext&gt;</tt> for "    "more information.",    0, 1    });   }         void create()
Roxen.git/server/modules/graphics/graphic_text.pike:45:    " dramatically. You can try this out with the &lt;gauge&gt; tag.",    0, lambda(){return !query("colorparse");});       defvar("deflen", 300, "Default maximum text-length", TYPE_INT|VAR_MORE,    "The module will, per default, not try to render texts "    "longer than this. This is a safeguard for things like "    "&lt;gh1&gt;&lt;/gh&gt;, which would otherwise parse the"    " whole document. This can be overrided with maxlen=... in the "    "tag.");    -  defvar("gif", 0, "Append .fmt (gif, jpeg etc) to all images", TYPE_FLAG|VAR_MORE, +  defvar("location", "/gtext/", "Mountpoint", TYPE_LOCATION|VAR_MORE, +  "The URL-prefix for the graphic characters."); +  +  defvar("gif", 0, "Append .fmt (gif, jpeg etc) to all images", +  TYPE_FLAG|VAR_MORE,    "Append .gif, .png, .gif etc to all images made by gtext. "    "Normally this will only waste bandwidth");   }      static private mapping cached_args = ([ ]);      #define MAX(a,b) ((a)<(b)?(b):(a))      static private mapping (int:array(array(int))) matrixes = ([]);   array (array(int)) make_matrix(int size)
Roxen.git/server/modules/graphics/graphic_text.pike:628:       // Now we have the image in 'img', or nothing.       if( !args->scroll && !args->fadein )    {    if(!args->notrans)    {    array (int) bgcolor = parse_color(args->bg);    object alpha;    alpha = img->distancesq( @bgcolor ); -  alpha->gamma( 8 ); +  alpha->gamma( 20 );    return ([ "img":img, "alpha":alpha ]);    }    return img;    }       if(args->fadein)    {    int amount=2, steps=10, delay=10, initialdelay=0, ox;    string res = img->gif_begin();    sscanf(args->fadein,"%d,%d,%d,%d", amount, steps, delay, initialdelay);
Roxen.git/server/modules/graphics/graphic_text.pike:684:    "metadata":    ([    "xsize":data[1][0],    "ysize":data[1][1],    "type":"image/gif",    ])    ]);   }       - mapping find_internal(string f, object rid) + array stat_file() { return 0; } + array find_dir() { return 0; } +  + mapping find_file(string f, object rid)   {    if( query("gif") && f[-4]=='.') // Remove .ext    f = f[..strlen(f)-5];    return image_cache->http_file_answer( f, rid );   }      string magic_javascript_header(object id)   {    if(!id->supports->netscape_javascript || !id->supports->images) return "";    return
Roxen.git/server/modules/graphics/graphic_text.pike:782:    if(arg->magic_background)    arg->magic_background=fix_relative(arg->magic_background,id);    if(arg->magicbg)    arg->magicbg = fix_relative(arg->magicbg,id);    if(arg->alpha)    arg->alpha = fix_relative(arg->alpha,id);       arg->text = ctn;       if(!short) -  return query_internal_location()+image_cache->store( arg, id ); +  return QUERY(location)+image_cache->store( arg, id );    else    return image_cache->store( arg, id );   }      string tag_graphicstext(string t, mapping arg, string contents,    object id, object foo, mapping defines)   {    if((contents-" ")=="")    return "";   //Allow <accessed> and others inside <gtext>.
Roxen.git/server/modules/graphics/graphic_text.pike:925:       foreach(gt/split-({""}), word)    {    arg->text = word;    string fn = image_cache->store( arg );    mapping size = image_cache->metadata( fn, id, 1 );       mapping tag =    ([    "alt":(arg->alt||word), -  "src":query_internal_location()+fn+gif, +  "src":QUERY(location)+fn+gif,    ]);    if( size )    {    tag->width = size->xsize;    tag->height = size->ysize;    }    res += ({ make_tag( "img", tag )+" " });    }    if(lp) res += ({ "</a>"+post });    return res*"";
Roxen.git/server/modules/graphics/graphic_text.pike:971:       string num2 = image_cache->store( arg );    size = image_cache->metadata( arg, id );       if(!defines->magic_java)    res = magic_javascript_header(id);    defines->magic_java="yes";       return replace(res +    magic_image(url||"", size->xsize, size->ysize, "i"+(defines->mi++), -  query_internal_location()+num+"/"+gif, -  query_internal_location()+num2+"/"+gif, +  QUERY(location)+num+"/"+gif, +  QUERY(location)+num2+"/"+gif,    (arg->alt?arg->alt:replace(gt, "\"","'")),    (magic=="magic"?0:magic),    id,input?na||"submit":0,ea,lp),    "</script>\n<script>","");    }    if(input)    return (pre+"<input type=image name=\""+na+"\" border=0 alt=\""+    (arg->alt?arg->alt:replace(gt,"\"","'"))+ -  "\" src="+query_internal_location()+num+gif +  "\" src="+QUERY(location)+num+gif    +" align="+(al || defalign)+ea+    (size?(" width="+size->xsize+" height="+size->ysize):"")+">"+    rest+post);       return (pre+(lp?lp:"")    + "<img border=0 alt=\""    + (arg->alt?arg->alt:replace(gt,"\"","'"))    + "\" src=\"" -  + query_internal_location()+num+gif+"\" "+ea +  + QUERY(location)+num+gif+"\" "+ea    + " align="+(al || defalign)    + (size?(" width="+size->xsize+" height="+size->ysize):"")+">"+    rest+(lp?"</a>":"")+post);   }      inline string ns_color(array (int) col)   {    if(!arrayp(col)||sizeof(col)!=3)    return "#000000";    return sprintf("#%02x%02x%02x", col[0],col[1],col[2]);