KDECore
kiconeffect.h
Go to the documentation of this file.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
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