no more gbuild loops: break early on nonexistent objects (this commit breaks multi...
[LibreOffice.git] / slideshow / source / inc / hslcolor.hxx
blob66599232925f85098caf280bbcd34994a7781f72
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef INCLUDED_SLIDESHOW_HSLCOLOR_HXX
30 #define INCLUDED_SLIDESHOW_HSLCOLOR_HXX
32 #include <cppcanvas/color.hxx>
35 /* Definition of HSLColor class */
37 namespace slideshow
39 namespace internal
41 class RGBColor;
43 /** HSL color space class.
45 class HSLColor
47 public:
48 HSLColor();
49 HSLColor( double nHue, double nSaturation, double nLuminance );
50 explicit HSLColor( const RGBColor& rColor );
52 /** Hue of the color.
54 @return hue, is in the range [0,360]
56 double getHue() const;
58 /** Saturation of the color.
60 @return saturation, is in the range [0,1]
62 double getSaturation() const;
64 /** Luminance of the color.
66 @return luminance, is in the range [0,1]
68 double getLuminance() const;
70 struct HSLTriple
72 HSLTriple();
73 HSLTriple( double nHue, double nSaturation, double nLuminance );
75 double mnHue;
76 double mnSaturation;
77 double mnLuminance;
80 private:
81 // default copy/assignment are okay
82 // HSLColor(const HSLColor&);
83 // HSLColor& operator=( const HSLColor& );
85 HSLTriple maHSLTriple;
87 /// Pre-calculated value, needed for conversion back to RGB
88 double mnMagicValue;
91 HSLColor operator+( const HSLColor& rLHS, const HSLColor& rRHS );
92 HSLColor operator*( const HSLColor& rLHS, const HSLColor& rRHS );
93 HSLColor operator*( double nFactor, const HSLColor& rRHS );
95 /** HSL color linear interpolator.
97 @param t
98 As usual, t must be in the [0,1] range
100 @param bCCW
101 When true, hue interpolation happens counter-clockwise
103 HSLColor interpolate( const HSLColor& rFrom, const HSLColor& rTo, double t, bool bCCW=true );
107 #endif /* INCLUDED_SLIDESHOW_HSLCOLOR_HXX */
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */