| 1 | // Copyright (C) 2006 Erik Dahlberg |
| 2 | // |
| 3 | // This file is part of LSystem3D. |
| 4 | // |
| 5 | // LSystem3D is free software; you can redistribute it and/or |
| 6 | // modify it under the terms of the GNU General Public License |
| 7 | // as published by the Free Software Foundation; either version 2 |
| 8 | // of the License, or (at your option) any later version. |
| 9 | // |
| 10 | // LSystem3D is distributed in the hope that it will be useful, |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | // GNU General Public License for more details. |
| 14 | // |
| 15 | // You should have received a copy of the GNU General Public License |
| 16 | // along with LSystem3D; if not, write to the Free Software |
| 17 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | #include "color.h" |
| 23 | |
| 24 | |
| 25 | |
| 26 | /** |
| 27 | * Constructor |
| 28 | * @param r red component |
| 29 | * @param g green component |
| 30 | * @param b blue component |
| 31 | */ |
| 32 | Color::Color(double r, double g, double b) |
| 33 | { |
| 34 | setRGB(r, g, b); |
| 35 | } |
| 36 | |
| 37 | |
| 38 | |
| 39 | /** |
| 40 | * Destructor |
| 41 | */ |
| 42 | Color::~Color() |
| 43 | { |
| 44 | } |
| 45 | |
| 46 | |
| 47 | |
| 48 | /** |
| 49 | * Set color |
| 50 | * @param r red component |
| 51 | * @param g green component |
| 52 | * @param b blue component |
| 53 | */ |
| 54 | void Color::setRGB(double r, double g, double b) |
| 55 | { |
| 56 | _r = r; |
| 57 | _g = g; |
| 58 | _b = b; |
| 59 | } |
| 60 | |
| 61 | |
| 62 | |
| 63 | /** |
| 64 | * Get red component |
| 65 | * @return the red component |
| 66 | */ |
| 67 | double Color::getR() |
| 68 | { |
| 69 | return _r; |
| 70 | } |
| 71 | |
| 72 | |
| 73 | |
| 74 | /** |
| 75 | * Get green component |
| 76 | * @return the green component |
| 77 | */ |
| 78 | double Color::getG() |
| 79 | { |
| 80 | return _g; |
| 81 | } |
| 82 | |
| 83 | |
| 84 | |
| 85 | /** |
| 86 | * Get blue component |
| 87 | * @return the blue component |
| 88 | */ |
| 89 | double Color::getB() |
| 90 | { |
| 91 | return _b; |
| 92 | } |