KIconThemes

kiconeffect.h
1 /* vi: ts=8 sts=4 sw=4
2  *
3  * This file is part of the KDE project, module kdecore.
4  * Copyright (C) 2000 Geert Jansen <[email protected]>
5  * Copyright (C) 2007 Daniel M. Duley <[email protected]>
6  * with minor additions and based on ideas from
7  * Torsten Rahn <[email protected]>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License version 2 as published by the Free Software Foundation.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public License
19  * along with this library; see the file COPYING.LIB. If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef KICONEFFECT_H
25 #define KICONEFFECT_H
26 
27 #include <kiconthemes_export.h>
28 
29 #include <QImage>
30 #include <QPixmap>
31 #include <QColor>
32 
33 class KIconEffectPrivate;
34 
48 class KICONTHEMES_EXPORT KIconEffect
49 {
50 public:
58  KIconEffect();
59  ~KIconEffect();
60 
61  KIconEffect(const KIconEffect &) = delete;
62  KIconEffect &operator=(const KIconEffect &) = delete;
63 
76  enum Effects { NoEffect, ToGray, Colorize, ToGamma, DeSaturate,
77  ToMonochrome,
78  LastEffect
79  };
80 
84  void init();
85 
95  bool hasEffect(int group, int state) const;
96 
105  QString fingerprint(int group, int state) const;
106 
115  QImage apply(const QImage &src, int group, int state) const;
116 
126  QImage apply(const QImage &src, int effect, float value, const QColor &rgb, bool trans) const;
127  QImage apply(const QImage &src, int effect, float value, const QColor &rgb, const QColor &rgb2, bool trans) const;
128 
136  QPixmap apply(const QPixmap &src, int group, int state) const;
137 
147  QPixmap apply(const QPixmap &src, int effect, float value, const QColor &rgb, bool trans) const;
148  QPixmap apply(const QPixmap &src, int effect, float value, const QColor &rgb, const QColor &rgb2, bool trans) const;
149 
155  QImage doublePixels(const QImage &src) const;
156 
163  static void toGray(QImage &image, float value);
164 
172  static void colorize(QImage &image, const QColor &col, float value);
173 
182  static void toMonochrome(QImage &image, const QColor &black, const QColor &white, float value);
183 
190  static void deSaturate(QImage &image, float value);
191 
198  static void toGamma(QImage &image, float value);
199 
205  static void semiTransparent(QImage &image);
206 
212  static void semiTransparent(QPixmap &pixmap);
213 
220  static void overlay(QImage &src, QImage &overlay);
221 
222 private:
223  KIconEffectPrivate *const d;
224 };
225 
226 #endif
QCA_EXPORT void init()
Applies effects to icons.
Definition: kiconeffect.h:48
Effects
This is the enumeration of all possible icon effects.
Definition: kiconeffect.h:76
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 4 2020 22:40:45 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.