home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Graphics / graphics-16000.iso / msdos / raytrace / rayshade / src / color.h < prev    next >
C/C++ Source or Header  |  1992-02-09  |  1KB  |  51 lines

  1. /*
  2.  * color.h
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * $Id: color.h,v 4.0.1.1 91/09/29 15:32:09 cek Exp Locker: cek $
  17.  *
  18.  * $Log:    color.h,v $
  19.  * Revision 4.0.1.1  91/09/29  15:32:09  cek
  20.  * patch1: Fixed #endif typo.
  21.  * 
  22.  * Revision 4.0  91/07/17  14:30:08  kolb
  23.  * Initial version.
  24.  * 
  25.  */
  26. #ifndef COLOR_H
  27. #define COLOR_H
  28. /*
  29.  * Color
  30.  */
  31. typedef struct Color {
  32.     Float r, g, b;            /* Red, green, blue. */
  33. } Color;
  34.  
  35. #define ColorScale(s,c,a)        (a)->r = (s)*(c).r, \
  36.                     (a)->g = (s)*(c).g, \
  37.                     (a)->b = (s)*(c).b
  38.  
  39. #define ColorAddScaled(x, s, y, c)    (c)->r = (x).r + (s)*(y).r, \
  40.                     (c)->g = (x).g + (s)*(y).g, \
  41.                     (c)->b = (x).b + (s)*(y).b
  42.  
  43. #define ColorMultiply(x,y,a)        (a)->r = (x).r*(y).r, \
  44.                     (a)->g = (x).g*(y).g, \
  45.                     (a)->b = (x).b*(y).b
  46.  
  47. #define ColorAdd(x,y,a)            (a)->r = (x).r+(y).r, \
  48.                     (a)->g = (x).g+(y).g, \
  49.                     (a)->b = (x).b+(y).b
  50. #endif /* COLOR_H */
  51.