1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hslcolor.hxx,v $
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 */
45 /** HSL color space class.
51 explicit HSLColor( ::cppcanvas::Color::IntSRGBA nRGBColor
);
52 HSLColor( double nHue
, double nSaturation
, double nLuminance
);
53 explicit HSLColor( const RGBColor
& rColor
);
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;
92 HSLTriple( double nHue
, double nSaturation
, double nLuminance
);
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
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.
117 As usual, t must be in the [0,1] range
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 */