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

superkaramba

  • superkaramba
  • src
imagelabel.h
1 /****************************************************************************
2 * imagelabel.h - ImageLabel meter
3 *
4 * Copyright (C) 2003 Hans Karlsson <karlsson.h@home.se>
5 * Copyright (c) 2004 Petri Damstén <damu@iki.fi>
6 *
7 * This file is part of SuperKaramba.
8 *
9 * SuperKaramba is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * SuperKaramba is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with SuperKaramba; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 ****************************************************************************/
23 
24 #ifndef IMAGELABEL_H
25 #define IMAGELABEL_H
26 
27 #include "meter.h"
28 #include <kpixmap.h>
29 #include <tqimage.h>
30 #include <tqpixmap.h>
31 #include <tqpainter.h>
32 #include <tqstring.h>
33 #include <tqstringlist.h>
34 #include <kurl.h>
35 #include <kio/netaccess.h>
36 #include <tqregexp.h>
37 #include <tqtimer.h>
38 #include "karamba.h"
39 
40 class ImageLabel;
41 class KIO::CopyJob;
42 
43 // Abstract Effects Baseclass
44 class Effect : public TQObject
45 {
46 
47 Q_OBJECT
48  TQ_OBJECT
49 
50 public:
51  Effect(ImageLabel*, int millisec);
52 
53  virtual ~Effect();
54 
55  virtual KPixmap apply(KPixmap pixmap) = 0;
56 
57  void startTimer();
58 
59 protected:
60  ImageLabel* myImage;
61 
62  int millisec;
63 };
64 
65 // Intensity
66 class Intensity : public Effect
67 {
68 public:
69  Intensity(ImageLabel*, float r, int millisec);
70 
71  KPixmap apply(KPixmap pixmap);
72 
73 private:
74  float ratio;
75 };
76 
77 
78 // ChannelIntensity
79 class ChannelIntensity : public Effect
80 {
81 public:
82  ChannelIntensity(ImageLabel*, float r, TQString c, int millisec);
83 
84  KPixmap apply(KPixmap pixmap);
85 
86 private:
87  float ratio;
88  int channel;
89 };
90 
91 // ToGray
92 class ToGray : public Effect
93 {
94 public:
95  ToGray(ImageLabel*, int millisec);
96 
97  KPixmap apply(KPixmap pixmap);
98 };
99 
100 class ImageLabel : public Meter
101 {
102 
103 Q_OBJECT
104  TQ_OBJECT
105 
106 public:
107  ImageLabel(karamba* k, int ix,int iy,int iw,int ih );
108  ImageLabel(karamba* k);
109  ~ImageLabel();
110  void setValue( TQString imagePath );
111 
112  void setValue( long );
113  void setValue( TQPixmap& );
114  TQString getStringValue() { return imagePath; };
115  void scale( int, int );
116  void smoothScale( int, int );
117 
118  void rotate(int);
119  void removeImageTransformations();
120  void mUpdate( TQPainter * );
121  void mUpdate( TQPainter *, int );
122 
123  void rolloverImage(TQMouseEvent *e);
124  void parseImages( TQString fn, TQString fn_roll, int, int, int, int );
125  virtual void show();
126  virtual void hide();
127 
128  void setTooltip(TQString txt);
129  int cblend;
130  int background;
131  // Pixmap Effects
132  void removeEffects();
133  void intensity(float ratio, int millisec);
134  void channelIntensity(float ratio, TQString channel, int millisec);
135  void toGray(int millisec);
136  void setBackground(int b);
137 
138  void attachClickArea(TQString leftMouseButton, TQString middleMouseButton,
139  TQString rightMouseButton);
140 
141  virtual bool click(TQMouseEvent*);
142 
143 private slots:
144 
145  // gets called if a timed effects needs to bee removed
146  void slotEffectExpired();
147  void slotCopyResult(KIO::Job* job);
148 
149 signals:
150  void pixmapLoaded();
151 
152 private:
153  void applyTransformations(bool useSmoothScale = false);
154  int pixmapWidth;
155  int pixmapHeight;
156  int pixmapOffWidth;
157  int pixmapOffHeight;
158  int pixmapOnWidth;
159  int pixmapOnHeight;
160 
161  // true if Image has been scaled
162  bool doScale;
163  // true if Image has been rotated
164  bool doRotate;
165 
166  // Contains the current Effect or is 0 if no Effect is applied
167  Effect* imageEffect;
168 
169  // Scale Matrix
170  //TQWMatrix scaleMat;
171  int scale_w;
172  int scale_h;
173  // Rotation Matrix
174  //TQWMatrix rotMat;
175  int rot_angle;
176 
177  KPixmap pixmap;
178  KPixmap realpixmap;
179 
180  TQRect rect_off, rect_on;
181  TQRect old_tip_rect;
182 
183  bool zoomed;
184  //TQString fn, fn_roll;
185  bool rollover;
186  KPixmap pixmap_off;
187  KPixmap pixmap_on;
188  int xoff,xon;
189  int yoff,yon;
190  TQString imagePath;
191 };
192 
193 #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.8.1.2
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |