home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Web / Utilities / wwwcount-2.3 / strimage.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-02  |  1.6 KB  |  88 lines

  1. /*
  2.  *  StringImage - creates an Image from string
  3.  *
  4.  *  RCS:
  5.  *      $Revision: 2.3 $
  6.  *      $Date: 1996/05/03 02:20:22 $
  7.  *
  8.  *  Security:
  9.  *      Unclassified
  10.  *
  11.  *  Description:
  12.  *      text
  13.  *
  14.  *  Input Parameters:
  15.  *      type    identifier  description
  16.  *
  17.  *      text
  18.  *
  19.  *  Output Parameters:
  20.  *      type    identifier  description
  21.  *
  22.  *      text
  23.  *
  24.  *  Return Values:
  25.  *      value   description
  26.  *
  27.  *  Side Effects:
  28.  *      text
  29.  *
  30.  *  Limitations and Comments:
  31.  *      text
  32.  *
  33.  *  Development History:
  34.  *      who                 when        why
  35.  *      muquit@semcor.com   09-Sep-95   first cut
  36.  */
  37.  
  38. #include "combine.h"
  39. #include "gdfonts.h"
  40. #include "count.h"
  41.  
  42. void StringImage(str)
  43. char
  44.     *str;
  45. {
  46.     Image
  47.         *fimage,
  48.         *image;
  49.  
  50.     int
  51.         str_length;
  52.  
  53.     FrameInfo
  54.         frame_info;
  55.     SFontInfo
  56.         font_info;
  57.  
  58.     str_length=(int) strlen(str);
  59.     image=CreateBaseImage(gdFontSmall->w*str_length+10,
  60.         gdFontSmall->h+10,0,0,0,DirectClass);
  61.  
  62.     if (image == (Image *) NULL)
  63.     {
  64.         (void) fprintf (stderr," Unable to create base image for string!\n");
  65.         return;
  66.     }
  67.     
  68.     font_info.do_bg=True;
  69.     font_info.bgr=0;
  70.     font_info.bgg=0;
  71.     font_info.bgb=0;
  72.  
  73.     font_info.fgr=255;
  74.     font_info.fgg=255;
  75.     font_info.fgb=0;
  76.  
  77.     ImageString(image,gdFontSmall,5,5,str,&font_info);
  78.     GetFrameInfo(image->columns,image->rows,&frame_info);
  79.     fimage=FrameImage(image,&frame_info);
  80.     if (fimage != (Image *) NULL)
  81.     {
  82.         DestroyAnyImageStruct(&image);
  83.         image=fimage;
  84.     }
  85.     WriteGIFImage(image,(char *) NULL);
  86.     
  87. }
  88.