00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
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
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 static void visualActivate(QWidget *widget, QRect rect, QPixmap *pixmap);
00156
00163 static void toGray(QImage &image, float value);
00164
00172 static void colorize(QImage &image, const QColor &col, float value);
00173
00183 static void toMonochrome(QImage &image, const QColor &black, const QColor &white, float value);
00184
00191 static void deSaturate(QImage &image, float value);
00192
00199 static void toGamma(QImage &image, float value);
00200
00206 static void semiTransparent(QImage &image);
00207
00213 static void semiTransparent(QPixmap &pixmap);
00214
00221 static void overlay(QImage &src, QImage &overlay);
00222
00223 private:
00224 int mEffect[6][3];
00225 float mValue[6][3];
00226 QColor mColor[6][3];
00227 bool mTrans[6][3];
00228 KIconEffectPrivate *d;
00229 };
00230
00231 #endif