kiconeffect.h
00001 /* vi: ts=8 sts=4 sw=4 00002 * 00003 * This file is part of the KDE project, module tdecore. 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 __TDEIconEffect_h_Included__ 00014 #define __TDEIconEffect_h_Included__ 00015 00016 #include <tqimage.h> 00017 #include <tqpixmap.h> 00018 #include <tqcolor.h> 00019 #include <tqrect.h> 00020 #include "tdelibs_export.h" 00021 00022 class TQWidget; 00023 00024 class TDEIconEffectPrivate; 00025 00034 class TDECORE_EXPORT TDEIconEffect 00035 { 00036 public: 00040 TDEIconEffect(); 00041 ~TDEIconEffect(); 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 TQString fingerprint(int group, int state) const; 00084 00093 TQImage apply(TQImage src, int group, int state) const; 00094 00104 // KDE4: make them references 00105 TQImage apply(TQImage src, int effect, float value, const TQColor rgb, bool trans) const; 00109 TQImage apply(TQImage src, int effect, float value, const TQColor rgb, const TQColor rgb2, bool trans) const; 00110 00118 TQPixmap apply(TQPixmap src, int group, int state) const; 00119 00129 TQPixmap apply(TQPixmap src, int effect, float value, const TQColor rgb, bool trans) const; 00133 TQPixmap apply(TQPixmap src, int effect, float value, const TQColor rgb, const TQColor rgb2, bool trans) const; 00134 00140 TQImage doublePixels(TQImage src) const; 00141 00154 static void visualActivate(TQWidget *widget, TQRect rect); 00155 static void visualActivate(TQWidget *widget, TQRect rect, TQPixmap *pixmap); 00156 00163 static void toGray(TQImage &image, float value); 00164 00172 static void colorize(TQImage &image, const TQColor &col, float value); 00173 00183 static void toMonochrome(TQImage &image, const TQColor &black, const TQColor &white, float value); 00184 00191 static void deSaturate(TQImage &image, float value); 00192 00199 static void toGamma(TQImage &image, float value); 00200 00206 static void semiTransparent(TQImage &image); 00207 00213 static void semiTransparent(TQPixmap &pixmap); 00214 00221 static void overlay(TQImage &src, TQImage &overlay); 00222 00223 private: 00224 int mEffect[6][3]; 00225 float mValue[6][3]; 00226 TQColor mColor[6][3]; 00227 bool mTrans[6][3]; 00228 TDEIconEffectPrivate *d; 00229 }; 00230 00231 #endif