// -*- C++ -*- #ifndef RICOLORRGB_H #define RICOLORRGB_H /* Copyright 1998 * Tue Jul 28 20:15:58 1998 Brian Edward Smits (bes@phoenix.cs.utah.edu) * * RiColorRGB.H * * * * $Id: RiColorRGB.H,v 1.1 1998/08/12 20:23:07 bes Exp $ * */ #ifndef RICOMMON_H #include #endif #ifndef RISPECTRUM_H #include #endif #ifndef RICOLORXYZV_H #include #endif /*************************************************************** CLASS RiColorRGB Screen space RGB DESCRIPTION Basically this just holds data and provides some type checking. The conversion operators are abstracted in the RiRGBConverter class. ****************************************************************/ class RiColorRGB { public: // GROUP: Constructors and assignment //// Default Constructor RiColorRGB(); //// Construct from RiReal's RiColorRGB(RiReal r, RiReal g, RiReal b); // GROUP: Accessors //// RiReal R() const; //// RiReal G() const; //// RiReal B() const; //// operator RiReal *(); //// operator const RiReal *() const; private: //// RiReal d[3]; }; /*************************************************************** CLASS RiRGBConverter Abstract class for conversion to and from RiColorRGB DESCRIPTION Currently does not convert to or from RiSpectrum ****************************************************************/ class RiRGBConverter { public: // GROUP: Constructors and assignment //// Destructor virtual ~RiRGBConverter(); // GROUP: Members //// virtual RiColorRGB FromXYZV(const RiColorXYZV &c) const = 0; //// virtual RiColorXYZV ToXYZV(const RiColorRGB &c) const = 0; }; /*************************************************************** CLASS RiRGBConvertLinear Linear (matrix) conversion plus gamma DESCRIPTION Based on monitor chromaticities and gamma. ****************************************************************/ class RiRGBConvertLinear { public: // GROUP: Constructors and assignment //// Default Constructor RiRGBConvertLinear(); // GROUP: Members //// set gamma (default is 2.5) void SetGamma(RiReal gamma); //// set the monitor chromaticites for conversions. void SetChromaticities(RiReal _rx, RiReal _ry, RiReal _gx, RiReal _gy, RiReal _bx, RiReal _by, RiReal _wx, RiReal _wy, RiReal _wY); //// turn on clipping void SetClipping(bool on = true); //// void ClipRGB(RiReal *rgb) const; //// Converts to screen range [0.0, 1.0] virtual RiColorRGB FromXYZV(const RiColorXYZV &c) const; //// virtual RiColorXYZV ToXYZV(const RiColorRGB &c) const; private: RiReal gamma, iGamma; RiReal rx, ry, gx, gy, bx, by, wx, wy, wY; bool clippingOn; RiReal toXYZ[3][3], fromXYZ[3][3]; }; #endif /* RICOLORRGB_H */