papyrus logo

hsba.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the papyrus library.                             *
00006  *                                                                         *
00007  *   papyrus is free software; you can redistribute it and/or modify       *
00008  *   it under the terms of the GNU Lesser General Public License           *
00009  *   version 3.0 as published by the Free Software Foundation.             *
00010  *                                                                         *
00011  *   papyrus is distributed in the hope that it will be useful,            *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Lesser General Public License version 3.0 for more details.       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with the papyrus library. If not, see                   *
00018  *   <http://www.gnu.org/licenses/>.                                       *
00019  ***************************************************************************/
00020 #ifndef PAPYRUSHSBA_H
00021 #define PAPYRUSHSBA_H
00022 
00023 #include <cairomm/pattern.h>
00024 
00025 namespace Papyrus {
00026 
00027 class RGBA;
00028 
00033 struct HSBA {
00034   HSBA(double h=0.0, double s=0.0, double b=0.0, double a=1.0);
00035 
00036   HSBA(const RGBA& rgb);
00037 
00038   double hue, saturation, brightness, alpha;
00039 
00040   double operator[](unsigned index);
00041 
00042   HSBA& operator=(const RGBA& rgb);
00043 
00044   operator RGBA() const;
00045 
00046   operator Cairo::RefPtr<Cairo::Pattern>();
00047 
00048   };
00049 
00050   void rgb_to_hsb(double rgb_r, double rgb_g, double rgb_b,
00051                   double& hsb_h, double& hsb_s, double& hsb_b);
00052 
00053   void hsb_to_rgb(double hsb_h, double hsb_s, double hsb_b,
00054                   double& rgb_r, double& rgb_g, double& rgb_b);
00055 
00056 
00057 }
00058 
00059 #endif

Generated on Fri Apr 16 12:40:10 2010 for papyrus by doxygen 1.6.1