00001 /*************************************************************************** 00002 * Copyright (C) 2006 by Rick L. Vinyard, Jr. * 00003 * rvinyard@cs.nmsu.edu * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU Lesser General Public License as * 00007 * published by the Free Software Foundation version 2.1. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU Lesser General Public * 00015 * License along with this library; if not, write to the * 00016 * Free Software Foundation, Inc., * 00017 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 00018 ***************************************************************************/ 00019 #ifndef PAPYRUSHSLA_H 00020 #define PAPYRUSHSLA_H 00021 00022 namespace Papyrus 00023 { 00024 00025 struct RGBA; 00026 00030 struct HSLA 00031 { 00032 HSLA(double h=0.0, double s=0.0, double l=0.0, double a=0.0); 00033 00034 HSLA(const RGBA& rgb); 00035 00036 double hue, saturation, lightness, alpha; 00037 00038 double operator[](unsigned index); 00039 00040 HSLA& operator=(const RGBA& rgb); 00041 00042 operator RGBA(); 00043 00044 }; 00045 00050 void rgb_to_hsl(double rgb_r, double rgb_g, double rgb_b, 00051 double& h, double& s, double& l); 00052 00057 void hsl_to_rgb(double hsl_h, double hsl_s, double hsl_l, 00058 double& rgb_r, double& rgb_g, double& rgb_b); 00059 00060 } 00061 00062 #endif