update dev300-m58
[ooovba.git] / slideshow / source / inc / hslcolor.hxx
blobb299bef7df3c6e508739f9b9de944ca7f8ef17f7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hslcolor.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_SLIDESHOW_HSLCOLOR_HXX
32 #define INCLUDED_SLIDESHOW_HSLCOLOR_HXX
34 #include <cppcanvas/color.hxx>
37 /* Definition of HSLColor class */
39 namespace slideshow
41 namespace internal
43 class RGBColor;
45 /** HSL color space class.
47 class HSLColor
49 public:
50 HSLColor();
51 explicit HSLColor( ::cppcanvas::Color::IntSRGBA nRGBColor );
52 HSLColor( double nHue, double nSaturation, double nLuminance );
53 explicit HSLColor( const RGBColor& rColor );
55 /** Hue of the color.
57 @return hue, is in the range [0,360]
59 double getHue() const;
61 /** Saturation of the color.
63 @return saturation, is in the range [0,1]
65 double getSaturation() const;
67 /** Luminance of the color.
69 @return luminance, is in the range [0,1]
71 double getLuminance() const;
73 /** Get the RGB red value.
75 double getRed() const;
77 /** Get the RGB green value.
79 double getGreen() const;
81 /** Get the RGB blue value.
83 double getBlue() const;
85 /** Create an RGB color object.
87 RGBColor getRGBColor() const;
89 struct HSLTriple
91 HSLTriple();
92 HSLTriple( double nHue, double nSaturation, double nLuminance );
94 double mnHue;
95 double mnSaturation;
96 double mnLuminance;
99 private:
100 // default copy/assignment are okay
101 // HSLColor(const HSLColor&);
102 // HSLColor& operator=( const HSLColor& );
104 HSLTriple maHSLTriple;
106 /// Pre-calculated value, needed for conversion back to RGB
107 double mnMagicValue;
110 HSLColor operator+( const HSLColor& rLHS, const HSLColor& rRHS );
111 HSLColor operator*( const HSLColor& rLHS, const HSLColor& rRHS );
112 HSLColor operator*( double nFactor, const HSLColor& rRHS );
114 /** HSL color linear interpolator.
116 @param t
117 As usual, t must be in the [0,1] range
119 @param bCCW
120 When true, hue interpolation happens counter-clockwise
122 HSLColor interpolate( const HSLColor& rFrom, const HSLColor& rTo, double t, bool bCCW=true );
126 #endif /* INCLUDED_SLIDESHOW_HSLCOLOR_HXX */