color.cpp

Go to the documentation of this file.
00001 #ifndef COLOR_IMPLEMENTATION_FILE
00002 #define COLOR_IMPLEMENTATION_FILE
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : color                                                             *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 1991-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00018 #include "color.h"
00019 #include "wp_implementation.h"
00020 
00021 #include <basis/istring.h>
00022 
00023 color::color(int red, int green, int blue)
00024 : _red(red), _green(green), _blue(blue), _index(-1)
00025 {}
00026 
00027 color::~color() {}
00028 
00029 int color::red() const { return _red; }
00030 
00031 int color::green() const { return _green; }
00032 
00033 int color::blue() const { return _blue; }
00034 
00035 void color::red(int to_set) { _red = to_set; _index = -1; }
00036 
00037 void color::green(int to_set) { _green = to_set; _index = -1; }
00038 
00039 void color::blue(int to_set) { _blue = to_set; _index = -1; }
00040 
00041 int color::index() const { return _index; }
00042 
00043 void color::index(int new_index) { _index = new_index; }
00044 
00045 bool color::operator != (const color &to_compare) const
00046 { return ! (*this == to_compare); }
00047 
00048 bool color::operator == (const color &to_compare) const
00049 {
00050   return (_green == to_compare._green) && (_red == to_compare._red)
00051     && (_blue == to_compare._blue);
00052 }
00053 
00054 istring color::text_form() const
00055 { return isprintf("( R=%d G=%d B=%d )", red(), green(), blue()); }
00056 
00057 
00058 #endif //COLOR_IMPLEMENTATION_FILE
00059 

Generated on Fri Nov 28 04:29:04 2008 for HOOPLE Libraries by  doxygen 1.5.1