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 / klcrt.c.h < prev    next >
Text File  |  1991-10-03  |  3KB  |  78 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 *rk, *rl, *rc, *rr, *rt ;
  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][1]],
  41.                      row0[wrap_left[h][0]],
  42.                           row0[c], row0[c + 1], row0[c + 2])] ;
  43. output[c] = palette[row1[c]] ;
  44. row1[c+1] = jrule[COMPUTATION (row0[wrap_left[h][0]],
  45.                  row0[c], row0[c + 1], row0[c + 2], row0[c + 3])];
  46. output[c+1] = palette[row1[c+1]] ;
  47.  
  48.  
  49. rk = &row0[c    ] ;
  50. rl = &row0[c + 1] ;
  51. rc = &row0[c + 2] ;
  52. rr = &row0[c + 3] ;
  53. rt = &row0[c + 4] ;
  54.  
  55. for (col=c+2;  col < cc-2;  col++)
  56.     {
  57.     row1[col] = jrule [COMPUTATION (*rk, *rl, *rc, *rr, *rt)] ;
  58.     output[col] = palette[row1[col]] ;
  59.  
  60.     rk ++ ;
  61.     rl ++ ;
  62.     rc ++ ;
  63.     rr ++ ;
  64.     rt ++ ;
  65.     }
  66.  
  67. row1[cc-2]=jrule[COMPUTATION(row0[cc-4], row0[cc-3], row0[cc-2],
  68.                   row0[cc-1], row0[wrap_right[h][0]])] ;
  69. output[cc-2] = palette[row1[cc-2]] ;
  70. row1[cc-1]=jrule[COMPUTATION(row0[cc-3], row0[cc-2], row0[cc-1],
  71.                  row0[wrap_right[h][0]], row0[wrap_right[h][1]])];
  72. output[cc-1] = palette[row1[cc-1]] ;
  73.  
  74. return ;
  75. }
  76.  
  77.  
  78.