home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / graphtal / color.h < prev    next >
C/C++ Source or Header  |  1992-10-22  |  1KB  |  59 lines

  1. /*
  2.  * Color.h  - class definition for color handling.
  3.  *
  4.  * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
  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.  */
  17.  
  18. #ifndef Color_H
  19. # define Color_H
  20.  
  21. #include "rcString.h"
  22.  
  23. /*___________________________________________________________ Color
  24.  *
  25.  * Colordefinitions are stored in a color file with the following
  26.  * format:
  27.  *
  28.  *  R G B  colorName
  29.  *   ...
  30.  *
  31.  * These color definitions are read once.
  32.  */ 
  33.  
  34. class ColorTable;
  35.  
  36. class Color {
  37. public:
  38.   static void setupColors();
  39.  
  40.   Color();
  41.   Color(const rcString&);
  42.  
  43.   const rcString& colorName() const { return name; }
  44.   float r() const { return red; }
  45.   float g() const { return green; }
  46.   float b() const { return blue; }
  47.  
  48. private:
  49.   rcString name;
  50.   float red, green, blue;
  51.  
  52. private:
  53.   static void readColors();
  54.   static ColorTable* colors;
  55.   static rcString ColorFile;
  56. };
  57.  
  58. #endif // Color_H
  59.