1 /* 2 Copyright (c) 2008-2009 NetAllied Systems GmbH 3 4 This file is part of COLLADAStreamWriter. 5 6 Licensed under the MIT Open Source License, 7 for details please see LICENSE file or the website 8 http://www.opensource.org/licenses/mit-license.php 9 */ 10 11 #ifndef __COLLADASTREAMWRITER_COLOR_H__ 12 #define __COLLADASTREAMWRITER_COLOR_H__ 13 14 #include "COLLADASWPrerequisites.h" 15 16 17 namespace COLLADASW 18 { 19 20 class Color 21 { 22 23 private: 24 25 double mR; 26 double mG; 27 double mB; 28 double mA; 29 String mSid; 30 31 public: 32 33 Color ( double r, double g, double b, double a, String sid="" ) mR(r)34 : mR ( r ), mG ( g ), mB ( b ), mA ( a ), mSid ( sid ) {} 35 36 /** Creates a color with opacity 1.*/ 37 Color ( double r, double g, double b, String sid="" ) mR(r)38 : mR ( r ), mG ( g ), mB ( b ), mA ( 1 ), mSid ( sid ) {} 39 40 /** Creates an invalid color*/ Color()41 Color( ) 42 : mR ( -1 ), mG ( -1 ), mB ( -1 ), mA ( -1 ), mSid ( "" ) {} 43 44 /** Sets the values of color*/ 45 void set ( double r, double g, double b, double a, String sid="" ); 46 47 /** Return true if the color is valid, false otherwise*/ 48 bool isValid() const; 49 50 /** Returns the red component*/ getRed()51 double getRed() const 52 { 53 return mR; 54 } 55 56 /** Returns the green component*/ getGreen()57 double getGreen() const 58 { 59 return mG; 60 } 61 62 /** Returns the blue component*/ getBlue()63 double getBlue() const 64 { 65 return mB; 66 } 67 68 /** Returns the alpha component*/ getAlpha()69 double getAlpha() const 70 { 71 return mA; 72 } 73 74 /** A white color object*/ 75 static const Color WHITE; 76 77 /** A black color object*/ 78 static const Color BLACK; 79 80 }; 81 82 } //namespace COLLADASW 83 84 85 #endif //__COLLADASTREAMWRITER_COLOR_H__ 86