![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /********************************************************************* 00002 ** Copyright (c) 1999 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: gdbColor.h,v $ $Revision: 1.9 $ $State: Exp $ 00007 *********************************************************************/ 00008 #ifndef gdbColor_H_ 00009 #define gdbColor_H_ 00010 00011 // \file gdbColor.h 00012 // \brief Contains the DtColor class declaration. 00013 00014 #include "geometry/geometryDefines.h" 00015 #include <stdio.h> 00016 #include <iostream> 00017 #include <vlutil/vlString.h> 00018 #include <vlutil/vlMachineTypes.h> 00019 #include <vlutil/vlUtil.h> 00020 00021 00022 // 00023 // DtColor represents a color assigned to a polygon, or 00024 // pixel element. 00025 class DT_DLL_geometry DtColor 00026 { 00027 public: 00028 // default constructor 00029 DtColor(); 00030 00031 // additional constructor 00032 DtColor(DtU8 red, DtU8 green, DtU8 blue, DtU8 alpha); 00033 00034 // destructor 00035 virtual ~DtColor(); 00036 00037 // copy constructor 00038 DtColor(const DtColor& orig); 00039 00040 // assignment operator 00041 DtColor& operator=(const DtColor& orig); 00042 00043 // set specified colors -- mutator function 00044 virtual void setColors(DtU8 red, DtU8 green, DtU8 blue, DtU8 alpha); 00045 00046 // accessor functions 00047 virtual DtU8 red() const; 00048 virtual DtU8 green() const; 00049 virtual DtU8 blue() const; 00050 virtual DtU8 alpha() const; 00051 00052 // comparison function 00053 virtual int operator==(const DtColor& other)const; 00054 00055 // help function for debugging 00056 virtual void dump() const; 00057 00058 // input/output functions 00059 virtual bool readFrom(FILE* fp); 00060 virtual bool writeTo(FILE* fp); 00061 00062 #ifndef NO_VRLINK 00063 virtual DtString string() const; 00064 #endif 00065 00066 protected: 00067 00068 DtU8 myRed; 00069 DtU8 myGreen; 00070 DtU8 myBlue; 00071 DtU8 myAlpha; 00072 00073 }; 00074 00075 inline DtU8 DtColor::red() const 00076 { 00077 return myRed; 00078 } 00079 00080 inline DtU8 DtColor::green() const 00081 { 00082 return myGreen; 00083 } 00084 00085 inline DtU8 DtColor::blue() const 00086 { 00087 return myBlue; 00088 } 00089 00090 inline DtU8 DtColor::alpha() const 00091 { 00092 return myAlpha; 00093 } 00094 00095 DT_DLL_geometry std::ostream& operator<<(std::ostream& os, const DtColor& color); 00096 DT_DLL_geometry std::istream& operator>>(std::istream& is, DtColor& color); 00097 00098 #endif