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

  1. /*
  2.  *  SetPixel - sets R,G,B value to a specific location of an image
  3.  *
  4.  *  RCS:
  5.  *      $Revision: 2.3 $
  6.  *      $Date: 1996/05/03 02:21:34 $
  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   30-Aug-95   fist cut
  36.  */
  37.  
  38. #include "combine.h"
  39. #include "defines.h"
  40.  
  41. void SetPixel(image,x,y,font_info,do_what)
  42. Image
  43.     *image;
  44. int
  45.     x,
  46.     y;
  47. SFontInfo
  48.     *font_info;
  49. unsigned int
  50.     do_what;
  51. {
  52.     register Runlength
  53.         *p;
  54.  
  55.     p=image->pixels+(y*image->columns+x);
  56.     /*
  57.     ** promote image to DirectClass
  58.     */
  59.     if (image->class == PseudoClass)
  60.         image->class=DirectClass;
  61.  
  62.     switch (image->class)
  63.     {
  64.         case DirectClass:
  65.         {
  66.             if (do_what == 1) /* bg+fg*/
  67.             {
  68.                 p->red=font_info->bgr;
  69.                 p->green=font_info->bgg;
  70.                 p->blue=font_info->bgb;
  71.             }
  72.             else
  73.             {
  74.                 p->red=font_info->fgr;
  75.                 p->green=font_info->fgg;
  76.                 p->blue=font_info->fgb;
  77.             }
  78.  
  79.         break;
  80.         }
  81.  
  82.         case PseudoClass:
  83.         {
  84.             register unsigned short
  85.                 index;
  86.  
  87.             index=p->index;
  88.  
  89.             if (do_what == 1) /* bg+fg*/
  90.             {
  91.                 image->colormap[index].red=font_info->bgr;
  92.                 image->colormap[index].green=font_info->bgg;
  93.                 image->colormap[index].blue=font_info->bgb;
  94.             }
  95.             else
  96.             {
  97.                 image->colormap[index].red=font_info->fgr;
  98.                 image->colormap[index].green=font_info->fgg;
  99.                 image->colormap[index].blue=font_info->fgb;
  100.             }
  101.             SyncImage(image);
  102.             break;
  103.         }
  104.     }
  105. }
  106.