kiconeffect.h

00001 /* vi: ts=8 sts=4 sw=4
00002  *
00003  * This file is part of the KDE project, module kdecore.
00004  * Copyright (C) 2000 Geert Jansen <jansen@kde.org>
00005  * with minor additions and based on ideas from
00006  * Torsten Rahn <torsten@kde.org>
00007  *
00008  * This is free software; it comes under the GNU Library General
00009  * Public License, version 2. See the file "COPYING.LIB" for the
00010  * exact licensing terms.
00011  */
00012 
00013 #ifndef __KIconEffect_h_Included__
00014 #define __KIconEffect_h_Included__
00015 
00016 #include <qimage.h>
00017 #include <qpixmap.h>
00018 #include <qcolor.h>
00019 #include <qrect.h>
00020 #include "kdelibs_export.h"
00021 
00022 class QWidget;
00023 
00024 class KIconEffectPrivate;
00025 
00034 class KDECORE_EXPORT KIconEffect
00035 {
00036 public:
00040     KIconEffect();
00041     ~KIconEffect();
00042 
00055     enum Effects { NoEffect, ToGray, Colorize, ToGamma, DeSaturate,
00056                    ToMonochrome,   
00057            LastEffect };
00058 
00062     void init();
00063 
00073     bool hasEffect(int group, int state) const;
00074 
00083      QString fingerprint(int group, int state) const;
00084 
00093     QImage apply(QImage src, int group, int state) const;
00094 
00104     // KDE4: make them references
00105     QImage apply(QImage src, int effect, float value, const QColor rgb, bool trans) const;
00109     QImage apply(QImage src, int effect, float value, const QColor rgb, const QColor rgb2, bool trans) const;
00110 
00118     QPixmap apply(QPixmap src, int group, int state) const;
00119 
00129     QPixmap apply(QPixmap src, int effect, float value, const QColor rgb, bool trans) const;
00133     QPixmap apply(QPixmap src, int effect, float value, const QColor rgb, const QColor rgb2, bool trans) const;
00134 
00140     QImage doublePixels(QImage src) const;
00141 
00154     static void visualActivate(QWidget *widget, QRect rect);
00155 
00162     static void toGray(QImage &image, float value);
00163 
00171     static void colorize(QImage &image, const QColor &col, float value);
00172 
00182     static void toMonochrome(QImage &image, const QColor &black, const QColor &white, float value);
00183 
00190     static void deSaturate(QImage &image, float value);
00191 
00198     static void toGamma(QImage &image, float value);
00199 
00205     static void semiTransparent(QImage &image);
00206 
00212     static void semiTransparent(QPixmap &pixmap);
00213 
00220     static void overlay(QImage &src, QImage &overlay);
00221 
00222 private:
00223     int mEffect[6][3];
00224     float mValue[6][3];
00225     QColor mColor[6][3];
00226     bool mTrans[6][3];
00227     KIconEffectPrivate *d;
00228 };
00229 
00230 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys