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