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.163 1999/05/19 09:11:46 peter Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.164 1999/05/25 11:38:27 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
Roxen.git/server/modules/graphics/graphic_text.pike:369:       // upper left -- lower left    background->line(b,b, b, ysize-b-1);    // upper right -- lower right    background->line(xsize-b-1,b, xsize-b-1, ysize-b-1);    }    }       background->setcolor(@bgcolor);    -  if(args->size || args->xsize || args->ysize) -  { +     int xs=background->xsize(), ys=background->ysize(); -  +  +  if( args->rescale ) +  { +  xs = txsize; +  ys = tysize; +  } +     if(args->size) { xs=(int)args->size; ys=(int)(args->size/",")[-1]; }    if(args->xsize) xs=(int)args->xsize;    if(args->ysize) ys=(int)args->ysize; -  +  +  +  if( xs != background->xsize() && +  ys != background->ysize() ) +  {    if(!args->rescale)    background = background->copy(0,0,xs-1,ys-1);    else    background = background->scale(xs, ys);    }       if(args->turbulence)    {    array (float|array(int)) arg=({});    foreach((args->turbulence/";"), string s)
Roxen.git/server/modules/graphics/graphic_text.pike:401:    }          if(args->bevel)    background = bevel(background,(int)args->bevel,!!args->pressed);       if(args->textbox) // Draw a text-box on the background.    {    int alpha,border;    string bg; -  sscanf(args->textbox, "%d,%s", alpha, bg); +  alpha = (int)args->textbox; +  sscanf(args->textbox, "%*[^,],%s", bg);    sscanf(bg,"%s,%d", bg,border);    background->paste_alpha(Image.image(txsize+border*2,tysize+border*2,    @parse_color(bg)),    255-(alpha*255/100),xoffset-border,yoffset-border);    }       if(args->ghost)    { // Francesco..    array(string) a = (args->ghost/",");    if (sizeof(a) < 2) {
Roxen.git/server/modules/graphics/graphic_text.pike:551:      mixed draw_callback(mapping args, object id)   {    array err;    mixed data;    int elapsed;    string text = args->text;    string orig_text = text;    object img;    -  m_delete( args, "text" ); -  -  if(!sizeof(args)) -  { -  args=(["fg":"black","bg":"white","notrans":"1"]); -  text="Please reload this page"; -  } -  //werror("Not cached: %O -> %O\n", key, text); -  //werror("In cache: %O\n", sort(indices(cache->cache))); -  +     if(!args->verbatim) // typographically correct...    {    text = replace(text, nbsp, " ");    text = simplify_text( text );    string res="",nspace="",cspace="";    foreach(text/"\n", string line)    {    cspace="";nspace="";    foreach(line/" ", string word)    {
Roxen.git/server/modules/graphics/graphic_text.pike:674:    res += img->copy(xp, 0, xp+len, img->ysize(),    @parse_color(args->bg))->gif_add(0,0,delay);    }    res += img->gif_end();    data = ({ res, ({ len, img->ysize() }) });    }       return    ([    "data":data[0], -  "metadata": +  "meta":    ([    "xsize":data[1][0],    "ysize":data[1][1],    "type":"image/gif",    ])    ]);   }         mapping find_internal(string f, object rid)
Roxen.git/server/modules/graphics/graphic_text.pike:830:    contents = parse_rxml(contents, id, foo, defines);   #else    contents = parse_rxml(contents, id, foo);   #endif       string lp, url, ea;    string pre, post, defalign, gt, rest, magic;    int i;    string split;    -  contents = contents[..((int)arg->maxlen||QUERY(deflen))]; +  contents = contents[..(((int)arg->maxlen||QUERY(deflen))-1)];    m_delete(arg, "maxlen");       if(arg->magic)    {    magic=replace(arg->magic,"'","`");    m_delete(arg,"magic");    }       int input;    if(arg->submit)
Roxen.git/server/modules/graphics/graphic_text.pike:870:    if(defines->nfont && !arg->nfont) arg->nfont=defines->nfont;    if(defines->afont && !arg->afont) arg->afont=defines->afont;    if(defines->font && !arg->font) arg->font=defines->font;    if(defines->bold && !arg->bold) arg->bold=defines->bold;    if(defines->italic && !arg->italic) arg->italic=defines->italic;    if(defines->black && !arg->black) arg->black=defines->black;    if(defines->narrow && !arg->narrow) arg->narrow=defines->narrow;       if(arg->split)    { -  if (sizeof(split=arg->split) != 1) +  if ((split=arg->split) == "split")    split = " ";    m_delete(arg,"split");    }       // Support for <gh 2> like things.    for(i=2; i<10; i++)    if(arg[(string)i])    {    arg->scale = (string)(1.0 / ((float)i*0.6));    m_delete(arg, (string)i);
Roxen.git/server/modules/graphics/graphic_text.pike:922:    array res = ({ pre });    if(lp) res+=({ lp });       gt=replace(gt, "\n", " ");       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,    ]);    if( size )    { -  tag->width = size->xsize; -  tag->height = size->ysize; +  tag->width = (string)size->xsize; +  tag->height = (string)size->ysize;    }    res += ({ make_tag( "img", tag )+" " });    }    if(lp) res += ({ "</a>"+post });    return res*"";    }       arg->text = gt;    string num = image_cache->store( arg );    mapping size = image_cache->metadata( arg, id, 1 );