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.61 1997/09/01 14:20:48 per Exp $"; + constant cvs_version="$Id: graphic_text.pike,v 1.62 1997/09/03 00:31:42 per Exp $";   constant thread_safe=1;      #include <module.h>   inherit "module";   inherit "roxenlib";      #if efun(_static_modules)   # define map_array Array.map   import Image;   # define Image image
Roxen.git/server/modules/graphics/graphic_text.pike:219:   object last_image; // Cache the last image for a while.   string last_image_name;   object load_image(string f,object id)   {    if(last_image_name == f && last_image) return last_image->copy();    string data;    object file;    object img = Image();       if(!(data=roxen->try_get_file(fix_relative(f, id),id))) -  if(!(file=open(f,"r")) || (!(data=file->read(0x7fffffff)))) +  if(!(file=open(f,"r")) || (!(data=file->read())))    return 0; -  -  if(!img->frompnm(data)/* && !img->fromgif(data)*/) return 0; +  werror("Read "+strlen(data)+" bytes.\n"); +  if(!img->frompnm(data)) return 0;    last_image = img; last_image_name = f;    return img->copy();   }      object (Image) blur(object img, int amnt)   {    img->setcolor(0,0,0);    img = img->autocrop(amnt, 0,0,0,0, 0,0,0);       for(int i=0; i<amnt; i++)
Roxen.git/server/modules/graphics/graphic_text.pike:394:    array (int) bgcolor = parse_color(args->bg);    array (int) fgcolor = parse_color(args->fg);       object background,foreground;          if(args->texture) foreground = load_image(args->texture,id);       if((args->background) && (background = load_image(args->background, id))) {    background = background; +  if((float)args->scale >= 0.1) +  background = background->scale(1.0/(float)args->scale); +  +     xsize = background->xsize();    ysize = background->ysize();    switch(lower_case(args->talign||"left")) {    case "center":    xoffset = (xsize/2 - txsize/2);    yoffset = (ysize/2 - tysize/2);    break;    case "right":    xoffset = (xsize - txsize);    break;
Roxen.git/server/modules/graphics/graphic_text.pike:544:    foreground->tuned_box(0,0, txsize,tysize,    ({parse_color(c1),parse_color(c2),parse_color(c3),    parse_color(c4)}));    }    if(args->outline)    outline(background, text_alpha, parse_color((args->outline/",")[0]),    ((int)(args->outline/",")[-1])+1, xoffset, yoffset);       background->paste_mask(foreground, text_alpha, xoffset, yoffset);    -  foreground = text_alpha = 0; -  -  +     if(args->scale)    if((float)args->scale <= 2.0)    background = background->scale((float)args->scale);    -  +  +  foreground = text_alpha = 0; +  +     if(args->rotate)    {    string c;    if(sscanf(args->rotate, "%*d,%s", c)==2)    background->setcolor(@parse_color(c));    else    background->setcolor(@bgcolor);    background = background->rotate((float)args->rotate);    }   
Roxen.git/server/modules/graphics/graphic_text.pike:744:    string data = o->read();    catch {    object q;    if(sizeof(indices(q=Gz)))    data=q->inflate()->inflate(data);    };    catch {    cached_args |= decode_value(data);    };    } +  number = sort(indices(cached_args))[-1]+1;   }      void save_cached_args()   {    restore_cached_args();    object o = open(".gtext_args_"+hash(mc->name), "wct");    string data=encode_value(cached_args);    catch {    object q;    if(sizeof(indices(q=Gz)))
Roxen.git/server/modules/graphics/graphic_text.pike:782:   int find_or_insert(mapping find)   {    if(!args_restored) restore_cached_args();    array a = indices(cached_args);    array b = values(cached_args);    int i;    for(i=0; i<sizeof(a); i++)    if(equal(find, b[i])) {    return a[i];    } -  +     cached_args[number]=find;    remove_call_out(save_cached_args);    call_out(save_cached_args, 10);    return number++;   }         string magic_javascript_header(object id)   {    if(!id->supports->javascript || !id->supports->images) return "";