• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • superkaramba
 

superkaramba

imagelabel.h
00001 /****************************************************************************
00002 *  imagelabel.h  -  ImageLabel meter
00003 *
00004 *  Copyright (C) 2003 Hans Karlsson <karlsson.h@home.se>
00005 *  Copyright (c) 2004 Petri Damstén <damu@iki.fi>
00006 *
00007 *  This file is part of SuperKaramba.
00008 *
00009 *  SuperKaramba is free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  SuperKaramba is distributed in the hope that it will be useful,
00015 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 *  GNU General Public License for more details.
00018 *
00019 *  You should have received a copy of the GNU General Public License
00020 *  along with SuperKaramba; if not, write to the Free Software
00021 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
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 // Abstract Effects Baseclass
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 // Intensity
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 // ChannelIntensity
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 // ToGray
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   // Pixmap Effects
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   // gets called if a timed effects needs to bee removed
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   // true if Image has been scaled
00162   bool doScale;
00163   // true if Image has been rotated
00164   bool doRotate;
00165 
00166   // Contains the current Effect or is 0 if no Effect is applied
00167   Effect* imageEffect;
00168 
00169   // Scale Matrix
00170   //TQWMatrix scaleMat;
00171   int scale_w;
00172   int scale_h;
00173   // Rotation Matrix
00174   //TQWMatrix rotMat;
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   //TQString fn, fn_roll;
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

superkaramba

Skip menu "superkaramba"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

superkaramba

Skip menu "superkaramba"
  • kcalc
  •   knumber
  • superkaramba
Generated for superkaramba by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |