home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Graphics / graphics-16000.iso / msdos / raytrace / rayshade / etc / rsconver / color.h next >
Text File  |  1992-04-28  |  1KB  |  48 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 91/07/17 14:30:08 kolb Exp Locker: kolb $
  17.  *
  18.  * $Log:    color.h,v $
  19.  * Revision 4.0  91/07/17  14:30:08  kolb
  20.  * Initial version.
  21.  * 
  22.  */
  23. #ifndef COLOR_H
  24. #define COLOR_H
  25. /*
  26.  * Color
  27.  */
  28. typedef struct Color {
  29.     Float r, g, b;            /* Red, green, blue. */
  30. } Color;
  31.  
  32. #define ColorScale(s,c,a)        (a)->r = (s)*(c).r, \
  33.                     (a)->g = (s)*(c).g, \
  34.                     (a)->b = (s)*(c).b
  35.  
  36. #define ColorAddScaled(x, s, y, c)    (c)->r = (x).r + (s)*(y).r, \
  37.                     (c)->g = (x).g + (s)*(y).g, \
  38.                     (c)->b = (x).b + (s)*(y).b
  39.  
  40. #define ColorMultiply(x,y,a)        (a)->r = (x).r*(y).r, \
  41.                     (a)->g = (x).g*(y).g, \
  42.                     (a)->b = (x).b*(y).b
  43.  
  44. #define ColorAdd(x,y,a)            (a)->r = (x).r+(y).r, \
  45.                     (a)->g = (x).g+(y).g, \
  46.                     (a)->b = (x).b+(y).b
  47. #endif 
  48.