File indexing completed on 2024-04-21 04:47:53

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Nikolaj Hald Nielsen <nhn@kde.org>                                *
0003  * Copyright (c) 2007 Mark Kretschmann <kretschmann@kde.org>                            *
0004  *                                                                                      *
0005  * This program is free software; you can redistribute it and/or modify it under        *
0006  * the terms of the GNU General Public License as published by the Free Software        *
0007  * Foundation; either version 2 of the License, or (at your option) any later           *
0008  * version.                                                                             *
0009  *                                                                                      *
0010  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0012  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0013  *                                                                                      *
0014  * You should have received a copy of the GNU General Public License along with         *
0015  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0016  ****************************************************************************************/
0017  
0018 #ifndef SVGTINTER_H
0019 #define SVGTINTER_H
0020 
0021 #include "amarok_export.h"
0022 
0023 #include <QColor>
0024 #include <QHash>
0025 #include <QString>
0026 #include <QPalette>
0027 
0028 class SvgTinter;
0029 
0030 namespace The {
0031     AMAROK_EXPORT SvgTinter* svgTinter();
0032 }
0033 
0034 /**
0035 This singleton class is used to tint the svg artwork to attempt to better match the users color scheme. 
0036 
0037     @author Nikolaj Hald Nielsen <nhn@kde.org>
0038 */
0039 class SvgTinter
0040 {
0041     friend SvgTinter* The::svgTinter();
0042 
0043     public:
0044         ~SvgTinter();
0045 
0046         QByteArray AMAROK_EXPORT tint( const QString &filename );
0047         void AMAROK_EXPORT init();
0048 
0049         QColor blendColors( const QColor& color1, const QColor& color2, int percent );
0050 
0051     private:
0052         SvgTinter();
0053 
0054         static SvgTinter * s_instance;
0055         QHash<QByteArray, QString> m_tintMap;
0056 
0057         QPalette m_lastPalette;
0058         bool m_firstRun;
0059 };
0060 
0061 #endif