home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xcu16.zip / clients / xcell / lcr.c.h < prev    next >
Text File  |  1991-10-03  |  2KB  |  65 lines

  1. /*
  2.  * Copyright 1991 Cornell University
  3.  *
  4.  * Permission to use, copy, modify, and distribute this software and its
  5.  * documentation for any purpose and without fee is hereby granted, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Cornell U. not be used in advertising
  9.  * or publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Cornell U. makes no representations about the
  11.  * suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * CORNELL UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  16.  * EVENT SHALL CORNELL UNIVERSITY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  18.  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  20.  * PERFORMANCE OF THIS SOFTWARE.
  21.  *
  22.  * Author:  Gene W. Dykes, Program of Computer Graphics
  23.  *          580 Theory Center, Cornell University, Ithaca, NY 14853
  24.  *          (607) 255-6713   gwd@graphics.cornell.edu
  25.  */
  26.  
  27.  
  28. (h, hmany_count, masks, row0, 
  29. row1, rule, nrule, wrap_left,
  30. wrap_right, irule, palette, output)
  31. int h ; int hmany_count ; int masks ; Comp *row0 ; 
  32. Comp *row1 ; int **rule ; int nrule ; Comp **wrap_left ;
  33. Comp **wrap_right ; int *irule ; int *palette ; unsigned char *output ;
  34. {
  35. Comp *rl, *rc, *rr ;
  36. int col ;
  37. int c = h * hmany_count ;
  38. int cc = c + hmany_count ;
  39. int *jrule = masks ? rule[nrule+h] : rule[irule[h]] ;
  40. row1[c] = jrule[COMPUTATION (row0[wrap_left[h][0]], row0[c], row0[c + 1])] ;
  41. output[c] = palette[row1[c]] ;
  42.  
  43.  
  44. rl = &row0[c] ;
  45. rc = &row0[c + 1] ;
  46. rr = &row0[c + 2] ;
  47.  
  48. for (col=c+1;  col < cc-1;  col++)
  49.     {
  50.     row1[col] = jrule [COMPUTATION (*rl, *rc, *rr)] ;
  51.     output[col] = palette[row1[col]] ;
  52.  
  53.     rl ++ ;
  54.     rc ++ ;
  55.     rr ++ ;
  56.     }
  57.  
  58. row1[cc-1]=jrule[COMPUTATION(row0[cc-2], row0[cc-1], row0[wrap_right[h][0]])] ;
  59. output[cc-1]=palette[row1[cc-1]] ;
  60.  
  61. return ;
  62. }
  63.  
  64.  
  65.