00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef IMAGELABEL_H
00025 #define IMAGELABEL_H
00026
00027 #include "meter.h"
00028 #include <kpixmap.h>
00029 #include <tqimage.h>
00030 #include <tqpixmap.h>
00031 #include <tqpainter.h>
00032 #include <tqstring.h>
00033 #include <tqstringlist.h>
00034 #include <kurl.h>
00035 #include <tdeio/netaccess.h>
00036 #include <tqregexp.h>
00037 #include <tqtimer.h>
00038 #include "karamba.h"
00039
00040 class ImageLabel;
00041 namespace TDEIO {
00042 class CopyJob;
00043 }
00044
00045
00046 class Effect : public TQObject
00047 {
00048
00049 Q_OBJECT
00050
00051
00052 public:
00053 Effect(ImageLabel*, int millisec);
00054
00055 virtual ~Effect();
00056
00057 virtual KPixmap apply(KPixmap pixmap) = 0;
00058
00059 void startTimer();
00060
00061 protected:
00062 ImageLabel* myImage;
00063
00064 int millisec;
00065 };
00066
00067
00068 class Intensity : public Effect
00069 {
00070 public:
00071 Intensity(ImageLabel*, float r, int millisec);
00072
00073 KPixmap apply(KPixmap pixmap);
00074
00075 private:
00076 float ratio;
00077 };
00078
00079
00080
00081 class ChannelIntensity : public Effect
00082 {
00083 public:
00084 ChannelIntensity(ImageLabel*, float r, TQString c, int millisec);
00085
00086 KPixmap apply(KPixmap pixmap);
00087
00088 private:
00089 float ratio;
00090 int channel;
00091 };
00092
00093
00094 class ToGray : public Effect
00095 {
00096 public:
00097 ToGray(ImageLabel*, int millisec);
00098
00099 KPixmap apply(KPixmap pixmap);
00100 };
00101
00102 class ImageLabel : public Meter
00103 {
00104
00105 Q_OBJECT
00106
00107
00108 public:
00109 ImageLabel(karamba* k, int ix,int iy,int iw,int ih );
00110 ImageLabel(karamba* k);
00111 ~ImageLabel();
00112 void setValue( TQString imagePath );
00113
00114 void setValue( long );
00115 void setValue( TQPixmap& );
00116 TQString getStringValue() { return imagePath; };
00117 void scale( int, int );
00118 void smoothScale( int, int );
00119
00120 void rotate(int);
00121 void removeImageTransformations();
00122 void mUpdate( TQPainter * );
00123 void mUpdate( TQPainter *, int );
00124
00125 void rolloverImage(TQMouseEvent *e);
00126 void parseImages( TQString fn, TQString fn_roll, int, int, int, int );
00127 virtual void show();
00128 virtual void hide();
00129
00130 void setTooltip(TQString txt);
00131 int cblend;
00132 int background;
00133
00134 void removeEffects();
00135 void intensity(float ratio, int millisec);
00136 void channelIntensity(float ratio, TQString channel, int millisec);
00137 void toGray(int millisec);
00138 void setBackground(int b);
00139
00140 void attachClickArea(TQString leftMouseButton, TQString middleMouseButton,
00141 TQString rightMouseButton);
00142
00143 virtual bool click(TQMouseEvent*);
00144
00145 private slots:
00146
00147
00148 void slotEffectExpired();
00149 void slotCopyResult(TDEIO::Job* job);
00150
00151 signals:
00152 void pixmapLoaded();
00153
00154 private:
00155 void applyTransformations(bool useSmoothScale = false);
00156 int pixmapWidth;
00157 int pixmapHeight;
00158 int pixmapOffWidth;
00159 int pixmapOffHeight;
00160 int pixmapOnWidth;
00161 int pixmapOnHeight;
00162
00163
00164 bool doScale;
00165
00166 bool doRotate;
00167
00168
00169 Effect* imageEffect;
00170
00171
00172
00173 int scale_w;
00174 int scale_h;
00175
00176
00177 int rot_angle;
00178
00179 KPixmap pixmap;
00180 KPixmap realpixmap;
00181
00182 TQRect rect_off, rect_on;
00183 TQRect old_tip_rect;
00184
00185 bool zoomed;
00186
00187 bool rollover;
00188 KPixmap pixmap_off;
00189 KPixmap pixmap_on;
00190 int xoff,xon;
00191 int yoff,yon;
00192 TQString imagePath;
00193 };
00194
00195 #endif // IMAGELABEL_H