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

version» Context lines:

Roxen.git/server/modules/graphics/graphic_text.pike:1: - string cvs_version="$Id: graphic_text.pike,v 1.32 1997/02/25 22:38:05 per Exp $"; + string cvs_version="$Id: graphic_text.pike,v 1.33 1997/02/27 04:06:58 per Exp $";   #include <module.h>   inherit "module";   inherit "roxenlib";      import Image;      array register_module()   {    return ({ MODULE_LOCATION | MODULE_PARSER,    "Graphics text",
Roxen.git/server/modules/graphics/graphic_text.pike:50:    " xsize=int Use this (absolute) size\n"    " ysize=int Use this (absolute) size\n"    " bevel=int Draw a bevel box (width is the argument)\n"    " pressed Invert the \"direction\" of the bevel box\n"    " talign=dir Justify the text to the left, right, or center\n"    " textbox=al,col. Use 'al' as opaque value to draw a box below\n"    " the text with the specified color.\n"    " xpad=X% Increase padding between characters with X%\n"    " xpad=Y% Increase padding between lines with Y%\n"    " shadow=int,dist Draw a drop-shadow (variable distance/intensity)\n" +  " bshadow=dist Draw a blured drop-shadow (variable distance)\n"    " glow=color Draw a 'glow' outline around the text.\n"    " opaque=0-100% Draw with more or less opaque text (100%\n"    " is default)\n"    " rotate=ang(deg.)Rotate the finished image\n"    " background=file Use the specifed file as a background\n"    " texture=file Use the specified file as text texture\n"    " turbulence=args args is: frequency,color;freq,col;freq,col\n"    " Apply a turbulence filter, and use this as the\n"    " background.\n"    " maxlen=arg The maximum length of the rendered text will be\n"
Roxen.git/server/modules/graphics/graphic_text.pike:306:    yoffset += (int)args->yspacing;    ysize += ((int)args->yspacing)*2;    }       if(args->shadow)    {    xsize+=((int)(args->shadow/",")[-1])+2;    ysize+=((int)(args->shadow/",")[-1])+2;    }    +  if(args->bshadow) +  { +  xsize+=(int)args->bshadow+4; +  ysize+=(int)args->bshadow+4; +  } +     if(args->move)    {    int dx,dy;    sscanf(args->move, "%d,%d", dx, dy);    xoffset += dx;    yoffset += dy;    }       if(args->xspacing)    {
Roxen.git/server/modules/graphics/graphic_text.pike:424:       if(args->shadow)    {    int sd = ((int)args->shadow+10)*2;    int sdist = ((int)(args->shadow/",")[-1])+2;    object ta = text_alpha->copy();    ta = ta->color(256-sd,256-sd,256-sd);    background->paste_mask(image(txsize,tysize),ta,xoffset+sdist, yoffset+sdist);    }    + #define MIN(x,y) ((x)<(y)?(x):(y)) +  +  if(args->bshadow) +  { +  int sdist = (int)(args->bshadow)+1; +  object ta = image(text_alpha->xsize()+sdist*2, +  text_alpha->ysize()+sdist*2); +  ta->paste(text_alpha,sdist,sdist); +  ta = blur(ta, MIN((sdist/2),1))->color(256,256,256); +  background->paste_mask(image(txsize,tysize),ta,xoffset, yoffset); +  } +     if(args->glow)    {    int amnt = (int)(args->glow/",")[-1]+2;    array (int) blurc = parse_color((args->glow/",")[0]);    background->paste_mask(image(txsize+amnt*2,tysize*2, @blurc),    blur(text_alpha, amnt),    xoffset-amnt, yoffset-amnt);    }       if(args->chisel)
Roxen.git/server/modules/graphics/graphic_text.pike:485:   }      string base_key = "gtext:"+roxen->current_configuration->name;      //void print_colors(array from)   //{   // for(int i=0; i<sizeof(from); i++)   // perror("%d: %s\n", i, color_name(from[i]));   //}    - int number=(time(1)/100) % 1000, _start=time(1)/100 % 1000; + int number=(time(1)/10) % 1000, _start=time(1)/10 % 1000;      array(int)|string write_text(int _args, string text, int size,    object id)   {    object img;    mapping args = cached_args[_args];    if(!args) {    args=(["fg":"black","bg":"white"]);    text="Please reload this page";    }
Roxen.git/server/modules/graphics/graphic_text.pike:905:    if(changed) return ("<body "+make_args(args)+">");   }         string tag_fix_color(string tagname, mapping args, object id, object file,    mapping defines)   {    int changed;       if(!id->misc->colors) -  id->misc->colors = ({ ({ defines->fg, defines->bg }) }); +  id->misc->colors = ({ ({ defines->fg, defines->bg, tagname }) });    else -  id->misc->colors += ({ ({ defines->fg, defines->bg }) }); -  +  id->misc->colors += ({ ({ defines->fg, defines->bg, tagname }) }); + // perror("Push color "+tagname+"\n");   #define FIX(X,Y) if(args->X){defines->Y=args->X;if(args->X[0]!='#'){args->X=ns_color(parse_color(args->X));changed = 1;}}       FIX(bgcolor,bg);    FIX(text,fg);    FIX(color,fg);    if(changed)return ("<"+tagname+" "+make_args(args)+">");    return 0;   }      string pop_color(string tagname,mapping args,object id,object file,    mapping defines)   {    array c = id->misc->colors; -  if(c && sizeof(c)) +  sscanf(tagname, "/%s", tagname); +  while(c && sizeof(c))    { -  +  if(c[-1][2]==tagname) +  {    defines->fg = c[-1][0];    defines->bg = c[-1][1]; -  id->misc->colors = c[..sizeof(c)-2]; + // perror("Pop color "+tagname+" ("+ + // (sizeof(id->misc->colors)-sizeof(c)+1)+")\n"); +  break;    } -  +  c = c[..sizeof(c)-2];    } -  +  id->misc->colors = c; + }      mapping query_tag_callers()   {    return ([    "body":tag_body,    "gtext-id":tag_gtext_id,    "font":tag_fix_color,    "table":tag_fix_color,    "tr":tag_fix_color,    "td":tag_fix_color, -  +  "layer":tag_fix_color, +  "ilayer":tag_fix_color, +     "/td":pop_color,    "/tr":pop_color,    "/font":pop_color,    "/body":pop_color,    "/table":pop_color, -  +  "/layer":pop_color, +  "/ilayer":pop_color,    ]);   }         mapping query_container_callers()   {    return ([ "anfang":tag_graphicstext,    "gh":tag_graphicstext,    "gh1":tag_graphicstext, "gh2":tag_graphicstext,    "gh3":tag_graphicstext, "gh4":tag_graphicstext,    "gh5":tag_graphicstext, "gh6":tag_graphicstext,    "gh7":tag_graphicstext, "gh8":tag_graphicstext,    "gh9":tag_graphicstext, "gh10":tag_graphicstext,    "gh11":tag_graphicstext,"gh12":tag_graphicstext,    "gtext":tag_graphicstext, ]);   }