home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 May / PCO_5_97.ISO / FilesBBS / OS2 / WWWCNT15.ARJ / WWWCNT15 / WWWCNT15.ZIP / strimage.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-10  |  1.6 KB  |  91 lines

  1. /*
  2.  *  StringImage - creates an Image from string
  3.  *
  4.  *  RCS:
  5.  *      $Revision$
  6.  *      $Date$
  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. #include "images.h"
  43.  
  44. void StringImage(str)
  45. char
  46.     *str;
  47. {
  48.     Image
  49.         *fimage,
  50.         *image;
  51.  
  52.     int
  53.         str_length;
  54.  
  55.     FrameInfo
  56.         frame_info;
  57.     SFontInfo
  58.         font_info;
  59.  
  60.     str_length=(int) strlen(str);
  61.     image=CreateBaseImage(gdFontSmall->w*str_length+10,
  62.         gdFontSmall->h+10,0,0,0,DirectClass);
  63.  
  64.     if (image == (Image *) NULL)
  65.     {
  66.         (void) fprintf (stderr," Unable to create base image for string!\n");
  67.         SendErrorImage(failed_bits,failed_length);
  68.         return;
  69.     }
  70.     
  71.     font_info.do_bg=True;
  72.     font_info.bgr=0;
  73.     font_info.bgg=0;
  74.     font_info.bgb=0;
  75.  
  76.     font_info.fgr=255;
  77.     font_info.fgg=255;
  78.     font_info.fgb=0;
  79.  
  80.     ImageString(image,gdFontSmall,5,5,str,&font_info);
  81.     GetFrameInfo(image->columns,image->rows,&frame_info);
  82.     fimage=FrameImage(image,&frame_info);
  83.     if (fimage != (Image *) NULL)
  84.     {
  85.         DestroyAnyImageStruct(&image);
  86.         image=fimage;
  87.     }
  88.     WriteGIFImage(image,(char *) NULL);
  89.     
  90. }
  91.