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