• 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 <tdeio/netaccess.h>
36 #include <tqregexp.h>
37 #include <tqtimer.h>
38 #include "karamba.h"
39 
40 class ImageLabel;
41 namespace TDEIO {
42  class CopyJob;
43 }
44 
45 // Abstract Effects Baseclass
46 class Effect : public TQObject
47 {
48 
49 TQ_OBJECT
50 
51 
52 public:
53  Effect(ImageLabel*, int millisec);
54 
55  virtual ~Effect();
56 
57  virtual KPixmap apply(KPixmap pixmap) = 0;
58 
59  void startTimer();
60 
61 protected:
62  ImageLabel* myImage;
63 
64  int millisec;
65 };
66 
67 // Intensity
68 class Intensity : public Effect
69 {
70 public:
71  Intensity(ImageLabel*, float r, int millisec);
72 
73  KPixmap apply(KPixmap pixmap);
74 
75 private:
76  float ratio;
77 };
78 
79 
80 // ChannelIntensity
81 class ChannelIntensity : public Effect
82 {
83 public:
84  ChannelIntensity(ImageLabel*, float r, TQString c, int millisec);
85 
86  KPixmap apply(KPixmap pixmap);
87 
88 private:
89  float ratio;
90  int channel;
91 };
92 
93 // ToGray
94 class ToGray : public Effect
95 {
96 public:
97  ToGray(ImageLabel*, int millisec);
98 
99  KPixmap apply(KPixmap pixmap);
100 };
101 
102 class ImageLabel : public Meter
103 {
104 
105 TQ_OBJECT
106 
107 
108 public:
109  ImageLabel(karamba* k, int ix,int iy,int iw,int ih );
110  ImageLabel(karamba* k);
111  ~ImageLabel();
112  void setValue( TQString imagePath );
113 
114  void setValue( long );
115  void setValue( TQPixmap& );
116  TQString getStringValue() { return imagePath; };
117  void scale( int, int );
118  void smoothScale( int, int );
119 
120  void rotate(int);
121  void removeImageTransformations();
122  void mUpdate( TQPainter * );
123  void mUpdate( TQPainter *, int );
124 
125  void rolloverImage(TQMouseEvent *e);
126  void parseImages( TQString fn, TQString fn_roll, int, int, int, int );
127  virtual void show();
128  virtual void hide();
129 
130  void setTooltip(TQString txt);
131  int cblend;
132  int background;
133  // Pixmap Effects
134  void removeEffects();
135  void intensity(float ratio, int millisec);
136  void channelIntensity(float ratio, TQString channel, int millisec);
137  void toGray(int millisec);
138  void setBackground(int b);
139 
140  void attachClickArea(TQString leftMouseButton, TQString middleMouseButton,
141  TQString rightMouseButton);
142 
143  virtual bool click(TQMouseEvent*);
144 
145 private slots:
146 
147  // gets called if a timed effects needs to bee removed
148  void slotEffectExpired();
149  void slotCopyResult(TDEIO::Job* job);
150 
151 signals:
152  void pixmapLoaded();
153 
154 private:
155  void applyTransformations(bool useSmoothScale = false);
156  int pixmapWidth;
157  int pixmapHeight;
158  int pixmapOffWidth;
159  int pixmapOffHeight;
160  int pixmapOnWidth;
161  int pixmapOnHeight;
162 
163  // true if Image has been scaled
164  bool doScale;
165  // true if Image has been rotated
166  bool doRotate;
167 
168  // Contains the current Effect or is 0 if no Effect is applied
169  Effect* imageEffect;
170 
171  // Scale Matrix
172  //TQWMatrix scaleMat;
173  int scale_w;
174  int scale_h;
175  // Rotation Matrix
176  //TQWMatrix rotMat;
177  int rot_angle;
178 
179  KPixmap pixmap;
180  KPixmap realpixmap;
181 
182  TQRect rect_off, rect_on;
183  TQRect old_tip_rect;
184 
185  bool zoomed;
186  //TQString fn, fn_roll;
187  bool rollover;
188  KPixmap pixmap_off;
189  KPixmap pixmap_on;
190  int xoff,xon;
191  int yoff,yon;
192  TQString imagePath;
193 };
194 
195 #endif // IMAGELABEL_H
TDEIO
Definition: imagelabel.h:41

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.13
This website is maintained by Timothy Pearson.