Branch: Tag:

1997-04-09

1997-04-09 01:09:33 by Per Hedbor <ph@opera.com>

Ny modul och buggfixar i resten

Rev: server/base_server/fonts.pike:1.4
Rev: server/modules/filters/auto_gzip.pike:1.1
Rev: server/modules/graphics/graphic_text.pike:1.41

1: - string cvs_version="$Id: graphic_text.pike,v 1.40 1997/04/05 01:26:10 per Exp $"; + string cvs_version="$Id: graphic_text.pike,v 1.41 1997/04/09 01:09:33 per Exp $";      #include <module.h>   inherit "module";
159:       if(!fnt->load( name ))    { -  perror("Failed to load the font "+name+", using the default font.\n"); +  report_error("Failed to load the font "+name+", using the default font.\n");    if(!fnt->load("fonts/"+QUERY(default_size) +"/"+ QUERY(default_font)))    error("Failed to load the default font\n");    }
203:      object last_image; // Cache the last image for a while.   string last_image_name; - object (image) load_image(string f,object id) + object load_image(string f,object id)   {    if(last_image_name==f) return last_image;    string data;
222:    return img->copy();   }    - object (image) blur(object (image) img, int amnt) + object (image) blur(object img, int amnt)   {    img->setcolor(0,0,0);    img = img->autocrop(amnt, 0,0,0,0, 0,0,0);
295:      object (image) make_text_image(mapping args, object font, string text,object id)   { -  object (image) text_alpha=font->write(@(text/"\n")); +  object text_alpha=font->write(@(text/"\n"));    int xoffset=0, yoffset=0;       if(!text_alpha->xsize() || !text_alpha->ysize())
510:    }       if(args->chisel) -  foreground=text_alpha->apply_matrix( ({ ({8,1,0}), +  foreground=text_alpha->apply_matrix(({ ({8,1,0}),    ({1,0,-1}), -  ({0,-1,-8}) }), 128,128,128, 15 ) +  ({0,-1,-8}) }), +  128,128,128, 15 )    ->color(@fgcolor);      
555:      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])); - //} + #ifdef QUANT_DEBUG + void print_colors(array from) + { + #if efun(color_name) +  for(int i=0; i<sizeof(from); i++) +  perror("%d: %s\n", i, color_name(from[i])); + #endif + } + #endif      int number=(time(1)/10) % 1000, _start=time(1)/10 % 1000;   
614:    }       // Fonts and such are now initialized. -  +     img = make_text_image(args,data,text,id);       // Now we have the image in 'img', or nothing. -  +     if(!img) return 0;       int q = (int)args->quant||(args->background||args->texture?250:QUERY(cols));
629:    // Quantify    if(!args->fs)    { - // print_colors(img->select_colors(q-1)+({parse_color(args->bg)})); + #ifdef QUANT_DEBUG +  print_colors(img->select_colors(q-1)+({parse_color(args->bg)})); + #endif    img = img->map_closest(img->select_colors(q-1)+({parse_color(args->bg)}));    } -  // place in cache. +  + // place in cache, as a gif image.    if(args->fs)    data=({ img->togif_fs(@(args->notrans?({}):parse_color(args->bg))),    ({img->xsize(),img->ysize()})});
841:       if(defines->fg && !arg->fg) arg->fg=defines->fg;    if(defines->bg && !arg->bg) arg->bg=defines->bg; - // if(!arg->font) arg->font=defines->font||QUERY(default_font); +    #if efun(get_font)    if(!arg->nfont) arg->nfont=defines->nfont;   #endif