color.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
00027 **    Harry Storbacka
00028 **    Mark Page
00029 */
00030 
00033 
00034 #pragma once
00035 
00036 #include "../api_display.h"
00037 #include "../../Core/Text/string_types.h"
00038 #include <vector>
00039 
00040 class CL_PixelFormat;
00041 class CL_Colord;
00042 class CL_Colorf;
00043 
00047 class CL_API_DISPLAY CL_Color
00048 {
00051 
00052 public:
00055         CL_Color() : color(0) { return; }
00056 
00057         explicit CL_Color(const CL_Colord&);
00058         explicit CL_Color(const CL_Colorf&);
00059 
00069         CL_Color(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha = 255)
00070                 : color((alpha<<24) | (red<<16) | (green<<8) | blue) { return; }
00071 
00078         CL_Color(const CL_StringRef &hexstr);
00079 
00083 
00084 public:
00086         unsigned int get_alpha() const { return (color >> 24) & 0xff; }
00087 
00089         unsigned int get_red() const { return (color >> 16) & 0xff; }
00090 
00092         unsigned int get_green() const { return (color >> 8) & 0xff; }
00093 
00095         unsigned int get_blue() const { return color & 0xff; }
00096 
00098         double get_alpha_d() const { return float(get_alpha()) / 255.0; }
00099 
00101         double get_red_d() const { return float(get_red()) / 255.0; }
00102 
00104         double get_green_d() const { return float(get_green()) / 255.0; }
00105 
00107         double get_blue_d() const { return float(get_blue()) / 255.0; }
00108 
00110         float get_alpha_f() const { return float(get_alpha()) / 255.0f; }
00111 
00113         float get_red_f() const { return float(get_red()) / 255.0f; }
00114 
00116         float get_green_f() const { return float(get_green()) / 255.0f; }
00117 
00119         float get_blue_f() const { return float(get_blue()) / 255.0f; }
00120 
00122         unsigned int color;
00123 
00124 // Operations:
00125 public:
00127         bool operator==(const CL_Color &c) const
00128         { return (color == c.color); }
00129 
00131         bool operator!=(const CL_Color &c) const
00132         { return (color != c.color); }
00133 
00137 
00138 public:
00140         static CL_Color aliceblue;
00141 
00143         static CL_Color antiquewhite;
00144 
00146         static CL_Color aqua;
00147 
00149         static CL_Color aquamarine;
00150 
00152         static CL_Color azure;
00153 
00155         static CL_Color beige;
00156 
00158         static CL_Color bisque;
00159 
00161         static CL_Color black;
00162 
00164         static CL_Color blanchedalmond;
00165 
00167         static CL_Color blue;
00168 
00170         static CL_Color blueviolet;
00171 
00173         static CL_Color brown;
00174 
00176         static CL_Color burlywood;
00177 
00179         static CL_Color cadetblue;
00180 
00182         static CL_Color chartreuse;
00183 
00185         static CL_Color chocolate;
00186 
00188         static CL_Color coral;
00189 
00191         static CL_Color cornflowerblue;
00192 
00194         static CL_Color cornsilk;
00195 
00197         static CL_Color crimson;
00198 
00200         static CL_Color cyan;
00201 
00203         static CL_Color darkblue;
00204 
00206         static CL_Color darkcyan;
00207 
00209         static CL_Color darkgoldenrod;
00210 
00212         static CL_Color darkgray;
00213 
00215         static CL_Color darkgreen;
00216 
00218         static CL_Color darkgrey;
00219 
00221         static CL_Color darkkhaki;
00222 
00224         static CL_Color darkmagenta;
00225 
00227         static CL_Color darkolivegreen;
00228 
00230         static CL_Color darkorange;
00231 
00233         static CL_Color darkorchid;
00234 
00236         static CL_Color darkred;
00237 
00239         static CL_Color darksalmon;
00240 
00242         static CL_Color darkseagreen;
00243 
00245         static CL_Color darkslateblue;
00246 
00248         static CL_Color darkslategray;
00249 
00251         static CL_Color darkslategrey;
00252 
00254         static CL_Color darkturquoise;
00255 
00257         static CL_Color darkviolet;
00258 
00260         static CL_Color deeppink;
00261 
00263         static CL_Color deepskyblue;
00264 
00266         static CL_Color dimgray;
00267 
00269         static CL_Color dimgrey;
00270 
00272         static CL_Color dodgerblue;
00273 
00275         static CL_Color firebrick;
00276 
00278         static CL_Color floralwhite;
00279 
00281         static CL_Color forestgreen;
00282 
00284         static CL_Color fuchsia;
00285 
00287         static CL_Color gainsboro;
00288 
00290         static CL_Color ghostwhite;
00291 
00293         static CL_Color gold;
00294 
00296         static CL_Color goldenrod;
00297 
00299         static CL_Color gray;
00300 
00302         static CL_Color grey;
00303 
00305         static CL_Color green;
00306 
00308         static CL_Color greenyellow;
00309 
00311         static CL_Color honeydew;
00312 
00314         static CL_Color hotpink;
00315 
00317         static CL_Color indianred;
00318 
00320         static CL_Color indigo;
00321 
00323         static CL_Color ivory;
00324 
00326         static CL_Color khaki;
00327 
00329         static CL_Color lavender;
00330 
00332         static CL_Color lavenderblush;
00333 
00335         static CL_Color lawngreen;
00336 
00338         static CL_Color lemonchiffon;
00339 
00341         static CL_Color lightblue;
00342 
00344         static CL_Color lightcoral;
00345 
00347         static CL_Color lightcyan;
00348 
00350         static CL_Color lightgoldenrodyellow;
00351 
00353         static CL_Color lightgray;
00354 
00356         static CL_Color lightgreen;
00357 
00359         static CL_Color lightgrey;
00360 
00362         static CL_Color lightpink;
00363 
00365         static CL_Color lightsalmon;
00366 
00368         static CL_Color lightseagreen;
00369 
00371         static CL_Color lightskyblue;
00372 
00374         static CL_Color lightslategray;
00375 
00377         static CL_Color lightslategrey;
00378 
00380         static CL_Color lightsteelblue;
00381 
00383         static CL_Color lightyellow;
00384 
00386         static CL_Color lime;
00387 
00389         static CL_Color limegreen;
00390 
00392         static CL_Color linen;
00393 
00395         static CL_Color magenta;
00396 
00398         static CL_Color maroon;
00399 
00401         static CL_Color mediumaquamarine;
00402 
00404         static CL_Color mediumblue;
00405 
00407         static CL_Color mediumorchid;
00408 
00410         static CL_Color mediumpurple;
00411 
00413         static CL_Color mediumseagreen;
00414 
00416         static CL_Color mediumslateblue;
00417 
00419         static CL_Color mediumspringgreen;
00420 
00422         static CL_Color mediumturquoise;
00423 
00425         static CL_Color mediumvioletred;
00426 
00428         static CL_Color midnightblue;
00429 
00431         static CL_Color mintcream;
00432 
00434         static CL_Color mistyrose;
00435 
00437         static CL_Color moccasin;
00438 
00440         static CL_Color navajowhite;
00441 
00443         static CL_Color navy;
00444 
00446         static CL_Color oldlace;
00447 
00449         static CL_Color olive;
00450 
00452         static CL_Color olivedrab;
00453 
00455         static CL_Color orange;
00456 
00458         static CL_Color orangered;
00459 
00461         static CL_Color orchid;
00462 
00464         static CL_Color palegoldenrod;
00465 
00467         static CL_Color palegreen;
00468 
00470         static CL_Color paleturquoise;
00471 
00473         static CL_Color palevioletred;
00474 
00476         static CL_Color papayawhip;
00477 
00479         static CL_Color peachpuff;
00480 
00482         static CL_Color peru;
00483 
00485         static CL_Color pink;
00486 
00488         static CL_Color plum;
00489 
00491         static CL_Color powderblue;
00492 
00494         static CL_Color purple;
00495 
00497         static CL_Color red;
00498 
00500         static CL_Color rosybrown;
00501 
00503         static CL_Color royalblue;
00504 
00506         static CL_Color saddlebrown;
00507 
00509         static CL_Color salmon;
00510 
00512         static CL_Color sandybrown;
00513 
00515         static CL_Color seagreen;
00516 
00518         static CL_Color seashell;
00519 
00521         static CL_Color sienna;
00522 
00524         static CL_Color silver;
00525 
00527         static CL_Color skyblue;
00528 
00530         static CL_Color slateblue;
00531 
00533         static CL_Color slategray;
00534 
00536         static CL_Color slategrey;
00537 
00539         static CL_Color snow;
00540 
00542         static CL_Color springgreen;
00543 
00545         static CL_Color steelblue;
00546 
00548         static CL_Color tan;
00549 
00551         static CL_Color teal;
00552 
00554         static CL_Color thistle;
00555 
00557         static CL_Color tomato;
00558 
00560         static CL_Color turquoise;
00561 
00563         static CL_Color violet;
00564 
00566         static CL_Color wheat;
00567 
00569         static CL_Color white;
00570 
00572         static CL_Color whitesmoke;
00573 
00575         static CL_Color yellow;
00576 
00578         static CL_Color yellowgreen;
00579 
00581         static CL_Color transparent;
00582 
00583         static CL_Color gray10;
00584         static CL_Color gray20;
00585         static CL_Color gray30;
00586         static CL_Color gray40;
00587         static CL_Color gray50;
00588         static CL_Color gray60;
00589         static CL_Color gray70;
00590         static CL_Color gray80;
00591         static CL_Color gray90;
00592 
00598         static CL_Color find_color(const CL_StringRef &name);
00599 
00601         static std::vector<CL_String8> &get_names();
00602 
00606 
00607 public:
00609         void set_alpha(unsigned int value) { color = (color & 0x00ffffff) | (value << 24); }
00610 
00612         void set_red(unsigned int value) { color = (color & 0xff00ffff) | (value << 16); }
00613 
00615         void set_green(unsigned int value) { color = (color & 0xffff00ff) | (value << 8); }
00616 
00618         void set_blue(unsigned int value) { color = (color & 0xffffff00) | value; }
00619 
00621         void set_alpha_d(float value) { set_alpha((unsigned int) (value*255)); }
00622 
00624         void set_red_d(float value) { set_red((unsigned int) (value*255)); }
00625 
00627         void set_green_d(float value) { set_green((unsigned int) (value*255)); }
00628 
00630         void set_blue_d(float value) { set_blue((unsigned int) (value*255)); }
00631 
00633         void set_color(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha = 255)
00634         { color = (alpha<<24) | (red<<16) | (green<<8) | blue; }
00635 
00637         void set_color_d(float red, float green, float blue, float alpha = 1.0)
00638         {
00639                 color =
00640                         (((unsigned int) (alpha*255))<<24) |
00641                         (((unsigned int) (red*255))<<16) |
00642                         (((unsigned int) (green*255))<<8) |
00643                         ((unsigned int) (blue*255));
00644         }
00645 
00647         //unsigned int to_pixelformat(const CL_PixelFormat &pf) const;
00648 
00650         //static CL_Color from_pixelformat(unsigned int raw_color, const CL_PixelFormat &pf);
00652 };
00653 
00657 class CL_Colord
00658 {
00661 
00662 public:
00663 
00665         CL_Colord() : r(0.0), g(0.0), b(0.0), a(0.0)
00666         {
00667         }
00668 
00678         CL_Colord(double r, double g, double b, double a = 1.0)
00679                 : r(r), g(g), b(b), a(a)
00680         {
00681         }
00682 
00689         CL_Colord(const double *array_rgba)
00690                 : r(array_rgba[0]), g(array_rgba[1]), b(array_rgba[2]), a(array_rgba[3])
00691         {
00692         }
00693 
00703         CL_Colord(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
00704                 : r(r/255.0),
00705                   g(g/255.0),
00706                   b(b/255.0),
00707                   a(a/255.0)
00708         {
00709         }
00710 
00711         explicit CL_Colord(const CL_Color& color)
00712                 : r(color.get_red()/255.0),
00713                   g(color.get_green()/255.0),
00714                   b(color.get_blue()/255.0),
00715                   a(color.get_alpha()/255.0)
00716         {
00717         }
00718 
00725         CL_Colord(const CL_StringRef &hexstr)
00726         {
00727                 *this = (CL_Colord)CL_Color::find_color(hexstr);
00728         }
00729 
00733 
00734 public:
00735         double r, g, b, a;
00736 
00740         double get_red() const { return r; }
00741 
00745         double get_green() const { return g; }
00746 
00750         double get_blue() const { return b; }
00751 
00755         double get_alpha() const { return a; }
00756 
00760 
00761 public:
00763         void normalize()
00764         {
00765                 r = (r < 0.0) ? 0.0 : ((r > 1.0) ? 1.0 : r);
00766                 g = (g < 0.0) ? 0.0 : ((g > 1.0) ? 1.0 : g);
00767                 b = (b < 0.0) ? 0.0 : ((b > 1.0) ? 1.0 : b);
00768                 a = (a < 0.0) ? 0.0 : ((a > 1.0) ? 1.0 : a);
00769         }
00770 
00772         void set_alpha(double value) { a = value; }
00773 
00775         void set_red(double value) {  r = value; }
00776 
00778         void set_green(double value) { g= value; }
00779 
00781         void set_blue(double value) { b = value; }
00782 
00784         bool operator==(const CL_Colord &c) const
00785         {
00786                 return (r == c.r) && (g == c.g) && (b == c.b) && (a == c.a);
00787         }
00788 
00790         bool operator!=(const CL_Colord &c) const
00791         {
00792                 return (r != c.r) || (g != c.g) || (b != c.b) || (a != c.a);
00793         }
00794 
00796         operator CL_Color() const
00797         {
00798                 return CL_Color(*this);
00799         }
00800 
00804 
00805 public:
00807         static CL_Colord aliceblue;
00808 
00810         static CL_Colord antiquewhite;
00811 
00813         static CL_Colord aqua;
00814 
00816         static CL_Colord aquamarine;
00817 
00819         static CL_Colord azure;
00820 
00822         static CL_Colord beige;
00823 
00825         static CL_Colord bisque;
00826 
00828         static CL_Colord black;
00829 
00831         static CL_Colord blanchedalmond;
00832 
00834         static CL_Colord blue;
00835 
00837         static CL_Colord blueviolet;
00838 
00840         static CL_Colord brown;
00841 
00843         static CL_Colord burlywood;
00844 
00846         static CL_Colord cadetblue;
00847 
00849         static CL_Colord chartreuse;
00850 
00852         static CL_Colord chocolate;
00853 
00855         static CL_Colord coral;
00856 
00858         static CL_Colord cornflowerblue;
00859 
00861         static CL_Colord cornsilk;
00862 
00864         static CL_Colord crimson;
00865 
00867         static CL_Colord cyan;
00868 
00870         static CL_Colord darkblue;
00871 
00873         static CL_Colord darkcyan;
00874 
00876         static CL_Colord darkgoldenrod;
00877 
00879         static CL_Colord darkgray;
00880 
00882         static CL_Colord darkgreen;
00883 
00885         static CL_Colord darkgrey;
00886 
00888         static CL_Colord darkkhaki;
00889 
00891         static CL_Colord darkmagenta;
00892 
00894         static CL_Colord darkolivegreen;
00895 
00897         static CL_Colord darkorange;
00898 
00900         static CL_Colord darkorchid;
00901 
00903         static CL_Colord darkred;
00904 
00906         static CL_Colord darksalmon;
00907 
00909         static CL_Colord darkseagreen;
00910 
00912         static CL_Colord darkslateblue;
00913 
00915         static CL_Colord darkslategray;
00916 
00918         static CL_Colord darkslategrey;
00919 
00921         static CL_Colord darkturquoise;
00922 
00924         static CL_Colord darkviolet;
00925 
00927         static CL_Colord deeppink;
00928 
00930         static CL_Colord deepskyblue;
00931 
00933         static CL_Colord dimgray;
00934 
00936         static CL_Colord dimgrey;
00937 
00939         static CL_Colord dodgerblue;
00940 
00942         static CL_Colord firebrick;
00943 
00945         static CL_Colord floralwhite;
00946 
00948         static CL_Colord forestgreen;
00949 
00951         static CL_Colord fuchsia;
00952 
00954         static CL_Colord gainsboro;
00955 
00957         static CL_Colord ghostwhite;
00958 
00960         static CL_Colord gold;
00961 
00963         static CL_Colord goldenrod;
00964 
00966         static CL_Colord gray;
00967 
00969         static CL_Colord grey;
00970 
00972         static CL_Colord green;
00973 
00975         static CL_Colord greenyellow;
00976 
00978         static CL_Colord honeydew;
00979 
00981         static CL_Colord hotpink;
00982 
00984         static CL_Colord indianred;
00985 
00987         static CL_Colord indigo;
00988 
00990         static CL_Colord ivory;
00991 
00993         static CL_Colord khaki;
00994 
00996         static CL_Colord lavender;
00997 
00999         static CL_Colord lavenderblush;
01000 
01002         static CL_Colord lawngreen;
01003 
01005         static CL_Colord lemonchiffon;
01006 
01008         static CL_Colord lightblue;
01009 
01011         static CL_Colord lightcoral;
01012 
01014         static CL_Colord lightcyan;
01015 
01017         static CL_Colord lightgoldenrodyellow;
01018 
01020         static CL_Colord lightgray;
01021 
01023         static CL_Colord lightgreen;
01024 
01026         static CL_Colord lightgrey;
01027 
01029         static CL_Colord lightpink;
01030 
01032         static CL_Colord lightsalmon;
01033 
01035         static CL_Colord lightseagreen;
01036 
01038         static CL_Colord lightskyblue;
01039 
01041         static CL_Colord lightslategray;
01042 
01044         static CL_Colord lightslategrey;
01045 
01047         static CL_Colord lightsteelblue;
01048 
01050         static CL_Colord lightyellow;
01051 
01053         static CL_Colord lime;
01054 
01056         static CL_Colord limegreen;
01057 
01059         static CL_Colord linen;
01060 
01062         static CL_Colord magenta;
01063 
01065         static CL_Colord maroon;
01066 
01068         static CL_Colord mediumaquamarine;
01069 
01071         static CL_Colord mediumblue;
01072 
01074         static CL_Colord mediumorchid;
01075 
01077         static CL_Colord mediumpurple;
01078 
01080         static CL_Colord mediumseagreen;
01081 
01083         static CL_Colord mediumslateblue;
01084 
01086         static CL_Colord mediumspringgreen;
01087 
01089         static CL_Colord mediumturquoise;
01090 
01092         static CL_Colord mediumvioletred;
01093 
01095         static CL_Colord midnightblue;
01096 
01098         static CL_Colord mintcream;
01099 
01101         static CL_Colord mistyrose;
01102 
01104         static CL_Colord moccasin;
01105 
01107         static CL_Colord navajowhite;
01108 
01110         static CL_Colord navy;
01111 
01113         static CL_Colord oldlace;
01114 
01116         static CL_Colord olive;
01117 
01119         static CL_Colord olivedrab;
01120 
01122         static CL_Colord orange;
01123 
01125         static CL_Colord orangered;
01126 
01128         static CL_Colord orchid;
01129 
01131         static CL_Colord palegoldenrod;
01132 
01134         static CL_Colord palegreen;
01135 
01137         static CL_Colord paleturquoise;
01138 
01140         static CL_Colord palevioletred;
01141 
01143         static CL_Colord papayawhip;
01144 
01146         static CL_Colord peachpuff;
01147 
01149         static CL_Colord peru;
01150 
01152         static CL_Colord pink;
01153 
01155         static CL_Colord plum;
01156 
01158         static CL_Colord powderblue;
01159 
01161         static CL_Colord purple;
01162 
01164         static CL_Colord red;
01165 
01167         static CL_Colord rosybrown;
01168 
01170         static CL_Colord royalblue;
01171 
01173         static CL_Colord saddlebrown;
01174 
01176         static CL_Colord salmon;
01177 
01179         static CL_Colord sandybrown;
01180 
01182         static CL_Colord seagreen;
01183 
01185         static CL_Colord seashell;
01186 
01188         static CL_Colord sienna;
01189 
01191         static CL_Colord silver;
01192 
01194         static CL_Colord skyblue;
01195 
01197         static CL_Colord slateblue;
01198 
01200         static CL_Colord slategray;
01201 
01203         static CL_Colord slategrey;
01204 
01206         static CL_Colord snow;
01207 
01209         static CL_Colord springgreen;
01210 
01212         static CL_Colord steelblue;
01213 
01215         static CL_Colord tan;
01216 
01218         static CL_Colord teal;
01219 
01221         static CL_Colord thistle;
01222 
01224         static CL_Colord tomato;
01225 
01227         static CL_Colord turquoise;
01228 
01230         static CL_Colord violet;
01231 
01233         static CL_Colord wheat;
01234 
01236         static CL_Colord white;
01237 
01239         static CL_Colord whitesmoke;
01240 
01242         static CL_Colord yellow;
01243 
01245         static CL_Colord yellowgreen;
01246 
01248         static CL_Colord transparent;
01249 
01250         static CL_Colord gray10;
01251         static CL_Colord gray20;
01252         static CL_Colord gray30;
01253         static CL_Colord gray40;
01254         static CL_Colord gray50;
01255         static CL_Colord gray60;
01256         static CL_Colord gray70;
01257         static CL_Colord gray80;
01258         static CL_Colord gray90;
01260 };
01261 
01265 class CL_Colorf
01266 {
01269 
01270 public:
01272         CL_Colorf() : r(0.0f), g(0.0f), b(0.0f), a(0.0f)
01273         {
01274         }
01275 
01285         CL_Colorf(float r, float g, float b, float a = 1.0f)
01286                 : r(r), g(g), b(b), a(a)
01287         {
01288         }
01289 
01296         CL_Colorf(const float *array_rgba)
01297                 : r(array_rgba[0]), g(array_rgba[1]), b(array_rgba[2]), a(array_rgba[3])
01298         {
01299         }
01300 
01310         CL_Colorf(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
01311                 : r(r/255.0f),
01312                   g(g/255.0f),
01313                   b(b/255.0f),
01314                   a(a/255.0f)
01315         {
01316         }
01317 
01327         CL_Colorf(int r, int g, int b, int a=255)
01328                 : r(r/255.0f),
01329                   g(g/255.0f),
01330                   b(b/255.0f),
01331                   a(a/255.0f)
01332         {
01333         }
01334 
01335         explicit CL_Colorf(const CL_Color& color)
01336                 : r(color.get_red()/255.0f),
01337                   g(color.get_green()/255.0f),
01338                   b(color.get_blue()/255.0f),
01339                   a(color.get_alpha()/255.0f)
01340         {
01341         }
01342 
01349         CL_Colorf(const CL_StringRef &hexstr)
01350         {
01351                 *this = (CL_Colorf)CL_Color::find_color(hexstr);
01352         }
01353 
01357 
01358 public:
01359         float r, g, b, a;
01360 
01364         float get_red() const { return r; }
01365 
01369         float get_green() const { return g; }
01370 
01374         float get_blue() const { return b; }
01375 
01379         float get_alpha() const { return a; }
01380 
01384 
01385 public:
01387         void normalize()
01388         {
01389                 r = (r < 0.0f) ? 0.0f : ((r > 1.0f) ? 1.0f : r);
01390                 g = (g < 0.0f) ? 0.0f : ((g > 1.0f) ? 1.0f : g);
01391                 b = (b < 0.0f) ? 0.0f : ((b > 1.0f) ? 1.0f : b);
01392                 a = (a < 0.0f) ? 0.0f : ((a > 1.0f) ? 1.0f : a);
01393         }
01394 
01396         void set_alpha(float value) { a = value; }
01397 
01399         void set_red(float value) {  r = value; }
01400 
01402         void set_green(float value) { g= value; }
01403 
01405         void set_blue(float value) { b = value; }
01406 
01408         bool operator==(const CL_Colorf &c) const
01409         {
01410                 return (r == c.r) && (g == c.g) && (b == c.b) && (a == c.a);
01411         }
01412 
01414         bool operator!=(const CL_Colorf &c) const
01415         {
01416                 return (r != c.r) || (g != c.g) || (b != c.b) || (a != c.a);
01417         }
01418 
01420         operator CL_Color() const
01421         {
01422                 return CL_Color(*this);
01423         }
01424 
01428 
01429 public:
01431         static CL_Colorf aliceblue;
01432 
01434         static CL_Colorf antiquewhite;
01435 
01437         static CL_Colorf aqua;
01438 
01440         static CL_Colorf aquamarine;
01441 
01443         static CL_Colorf azure;
01444 
01446         static CL_Colorf beige;
01447 
01449         static CL_Colorf bisque;
01450 
01452         static CL_Colorf black;
01453 
01455         static CL_Colorf blanchedalmond;
01456 
01458         static CL_Colorf blue;
01459 
01461         static CL_Colorf blueviolet;
01462 
01464         static CL_Colorf brown;
01465 
01467         static CL_Colorf burlywood;
01468 
01470         static CL_Colorf cadetblue;
01471 
01473         static CL_Colorf chartreuse;
01474 
01476         static CL_Colorf chocolate;
01477 
01479         static CL_Colorf coral;
01480 
01482         static CL_Colorf cornflowerblue;
01483 
01485         static CL_Colorf cornsilk;
01486 
01488         static CL_Colorf crimson;
01489 
01491         static CL_Colorf cyan;
01492 
01494         static CL_Colorf darkblue;
01495 
01497         static CL_Colorf darkcyan;
01498 
01500         static CL_Colorf darkgoldenrod;
01501 
01503         static CL_Colorf darkgray;
01504 
01506         static CL_Colorf darkgreen;
01507 
01509         static CL_Colorf darkgrey;
01510 
01512         static CL_Colorf darkkhaki;
01513 
01515         static CL_Colorf darkmagenta;
01516 
01518         static CL_Colorf darkolivegreen;
01519 
01521         static CL_Colorf darkorange;
01522 
01524         static CL_Colorf darkorchid;
01525 
01527         static CL_Colorf darkred;
01528 
01530         static CL_Colorf darksalmon;
01531 
01533         static CL_Colorf darkseagreen;
01534 
01536         static CL_Colorf darkslateblue;
01537 
01539         static CL_Colorf darkslategray;
01540 
01542         static CL_Colorf darkslategrey;
01543 
01545         static CL_Colorf darkturquoise;
01546 
01548         static CL_Colorf darkviolet;
01549 
01551         static CL_Colorf deeppink;
01552 
01554         static CL_Colorf deepskyblue;
01555 
01557         static CL_Colorf dimgray;
01558 
01560         static CL_Colorf dimgrey;
01561 
01563         static CL_Colorf dodgerblue;
01564 
01566         static CL_Colorf firebrick;
01567 
01569         static CL_Colorf floralwhite;
01570 
01572         static CL_Colorf forestgreen;
01573 
01575         static CL_Colorf fuchsia;
01576 
01578         static CL_Colorf gainsboro;
01579 
01581         static CL_Colorf ghostwhite;
01582 
01584         static CL_Colorf gold;
01585 
01587         static CL_Colorf goldenrod;
01588 
01590         static CL_Colorf gray;
01591 
01593         static CL_Colorf grey;
01594 
01596         static CL_Colorf green;
01597 
01599         static CL_Colorf greenyellow;
01600 
01602         static CL_Colorf honeydew;
01603 
01605         static CL_Colorf hotpink;
01606 
01608         static CL_Colorf indianred;
01609 
01611         static CL_Colorf indigo;
01612 
01614         static CL_Colorf ivory;
01615 
01617         static CL_Colorf khaki;
01618 
01620         static CL_Colorf lavender;
01621 
01623         static CL_Colorf lavenderblush;
01624 
01626         static CL_Colorf lawngreen;
01627 
01629         static CL_Colorf lemonchiffon;
01630 
01632         static CL_Colorf lightblue;
01633 
01635         static CL_Colorf lightcoral;
01636 
01638         static CL_Colorf lightcyan;
01639 
01641         static CL_Colorf lightgoldenrodyellow;
01642 
01644         static CL_Colorf lightgray;
01645 
01647         static CL_Colorf lightgreen;
01648 
01650         static CL_Colorf lightgrey;
01651 
01653         static CL_Colorf lightpink;
01654 
01656         static CL_Colorf lightsalmon;
01657 
01659         static CL_Colorf lightseagreen;
01660 
01662         static CL_Colorf lightskyblue;
01663 
01665         static CL_Colorf lightslategray;
01666 
01668         static CL_Colorf lightslategrey;
01669 
01671         static CL_Colorf lightsteelblue;
01672 
01674         static CL_Colorf lightyellow;
01675 
01677         static CL_Colorf lime;
01678 
01680         static CL_Colorf limegreen;
01681 
01683         static CL_Colorf linen;
01684 
01686         static CL_Colorf magenta;
01687 
01689         static CL_Colorf maroon;
01690 
01692         static CL_Colorf mediumaquamarine;
01693 
01695         static CL_Colorf mediumblue;
01696 
01698         static CL_Colorf mediumorchid;
01699 
01701         static CL_Colorf mediumpurple;
01702 
01704         static CL_Colorf mediumseagreen;
01705 
01707         static CL_Colorf mediumslateblue;
01708 
01710         static CL_Colorf mediumspringgreen;
01711 
01713         static CL_Colorf mediumturquoise;
01714 
01716         static CL_Colorf mediumvioletred;
01717 
01719         static CL_Colorf midnightblue;
01720 
01722         static CL_Colorf mintcream;
01723 
01725         static CL_Colorf mistyrose;
01726 
01728         static CL_Colorf moccasin;
01729 
01731         static CL_Colorf navajowhite;
01732 
01734         static CL_Colorf navy;
01735 
01737         static CL_Colorf oldlace;
01738 
01740         static CL_Colorf olive;
01741 
01743         static CL_Colorf olivedrab;
01744 
01746         static CL_Colorf orange;
01747 
01749         static CL_Colorf orangered;
01750 
01752         static CL_Colorf orchid;
01753 
01755         static CL_Colorf palegoldenrod;
01756 
01758         static CL_Colorf palegreen;
01759 
01761         static CL_Colorf paleturquoise;
01762 
01764         static CL_Colorf palevioletred;
01765 
01767         static CL_Colorf papayawhip;
01768 
01770         static CL_Colorf peachpuff;
01771 
01773         static CL_Colorf peru;
01774 
01776         static CL_Colorf pink;
01777 
01779         static CL_Colorf plum;
01780 
01782         static CL_Colorf powderblue;
01783 
01785         static CL_Colorf purple;
01786 
01788         static CL_Colorf red;
01789 
01791         static CL_Colorf rosybrown;
01792 
01794         static CL_Colorf royalblue;
01795 
01797         static CL_Colorf saddlebrown;
01798 
01800         static CL_Colorf salmon;
01801 
01803         static CL_Colorf sandybrown;
01804 
01806         static CL_Colorf seagreen;
01807 
01809         static CL_Colorf seashell;
01810 
01812         static CL_Colorf sienna;
01813 
01815         static CL_Colorf silver;
01816 
01818         static CL_Colorf skyblue;
01819 
01821         static CL_Colorf slateblue;
01822 
01824         static CL_Colorf slategray;
01825 
01827         static CL_Colorf slategrey;
01828 
01830         static CL_Colorf snow;
01831 
01833         static CL_Colorf springgreen;
01834 
01836         static CL_Colorf steelblue;
01837 
01839         static CL_Colorf tan;
01840 
01842         static CL_Colorf teal;
01843 
01845         static CL_Colorf thistle;
01846 
01848         static CL_Colorf tomato;
01849 
01851         static CL_Colorf turquoise;
01852 
01854         static CL_Colorf violet;
01855 
01857         static CL_Colorf wheat;
01858 
01860         static CL_Colorf white;
01861 
01863         static CL_Colorf whitesmoke;
01864 
01866         static CL_Colorf yellow;
01867 
01869         static CL_Colorf yellowgreen;
01870 
01872         static CL_Colorf transparent;
01873 
01874         static CL_Colorf gray10;
01875         static CL_Colorf gray20;
01876         static CL_Colorf gray30;
01877         static CL_Colorf gray40;
01878         static CL_Colorf gray50;
01879         static CL_Colorf gray60;
01880         static CL_Colorf gray70;
01881         static CL_Colorf gray80;
01882         static CL_Colorf gray90;
01884 };
01885