• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

superkaramba

  • sources
  • kde-4.12
  • kdeutils
  • superkaramba
  • src
  • meters
meters/imagelabel.h
Go to the documentation of this file.
1 /****************************************************************************
2 * imagelabel.h - ImageLabel meter
3 *
4 * Copyright (C) 2003 Hans Karlsson <karlsson.h@home.se>
5 * Copyright (c) 2004 Petri Damst� <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 <QPainter>
28 #include <QGraphicsSceneMouseEvent>
29 #include <QSvgRenderer>
30 
31 #include <kio/netaccess.h>
32 #include <kio/copyjob.h>
33 
34 #include "karamba.h"
35 #include "meter.h"
36 
37 class ImageLabel;
38 
39 // Abstract Effects Baseclass
40 class Effect : public QObject
41 {
42 
43  Q_OBJECT
44 
45 public:
46  Effect(ImageLabel*, int millisec);
47 
48  virtual ~Effect();
49 
50  virtual QPixmap apply(QPixmap pixmap) = 0;
51 
52  void startTimer();
53 
54 protected:
55  ImageLabel* myImage;
56 
57  int millisec;
58 };
59 
60 // Intensity
61 class Intensity : public Effect
62 {
63 public:
64  Intensity(ImageLabel*, float r, int millisec);
65 
66  QPixmap apply(QPixmap pixmap);
67 
68 private:
69  float ratio;
70 };
71 
72 
73 // ChannelIntensity
74 class ChannelIntensity : public Effect
75 {
76 public:
77  ChannelIntensity(ImageLabel*, float r, const QString &c, int millisec);
78 
79  QPixmap apply(QPixmap pixmap);
80 
81 private:
82  float ratio;
83  int channel;
84 };
85 
86 // ToGray
87 class ToGray : public Effect
88 {
89 public:
90  ToGray(ImageLabel*, int millisec);
91 
92  QPixmap apply(QPixmap pixmap);
93 };
94 
95 // ToAlpha
96 class ToAlpha : public Effect
97 {
98 public:
99  ToAlpha(ImageLabel*, const QColor &alphaColor, int alpha, int millisec);
100 
101  QPixmap apply(QPixmap pixmap);
102 
103 private:
104  QColor m_alphaColor;
105  int m_alpha;
106 };
107 
108 class ImageLabel : public Meter
109 {
110 
111  Q_OBJECT
112 
113 public:
114  ImageLabel(Karamba* k, int ix, int iy, int iw, int ih);
115  ImageLabel(Karamba* k);
116  ~ImageLabel();
117  void setValue(const QString &imagePath);
118 
119  void setValue(int);
120  void setValue(QPixmap&);
121  QString getStringValue() const
122  {
123  return imagePath;
124  }
125  void scale(int, int);
126  void smoothScale(int, int);
127 
128  void rotate(int);
129  void removeImageTransformations();
130  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
131  QWidget *widget);
132 
133  void rolloverImage(QGraphicsSceneHoverEvent *e);
134  void parseImages(const QString &fn, const QString &fn_roll, int, int, int, int);
135  virtual void show();
136  virtual void hide();
137 
138  void setTooltip(QString txt);
139  int background;
140  // Pixmap Effects
141  void removeEffects();
142  void intensity(float ratio, int millisec);
143  void channelIntensity(float ratio, QString channel, int millisec);
144  void toGray(int millisec);
145  void toAlpha(const QColor &alphaColor, int alpha, int millisec);
146  void setBackground(int b);
147 
148  void attachClickArea(QString leftMouseButton, QString middleMouseButton,
149  QString rightMouseButton);
150 
151  bool mouseEvent(QEvent *e);
152 
153  void allowClick(bool);
154  bool clickable();
155  void setPixel(const QPoint &point, const QColor &pixel);
156 
157  bool enableAnimation(bool enable);
158  bool animationEnabled() const;
159 
160  bool drawElement(const QString &element);
161  QString elementDrawn() const;
162 
163 private slots:
164 
165  // gets called if a timed effects needs to bee removed
166  void slotEffectExpired();
167  void slotCopyResult(KJob* job);
168  void repaintSvg();
169 
170 signals:
171  void pixmapLoaded();
172 
173 private:
174  void applyTransformations(bool useSmoothScale = false);
175  int pixmapWidth;
176  int pixmapHeight;
177  int pixmapOffWidth;
178  int pixmapOffHeight;
179  int pixmapOnWidth;
180  int pixmapOnHeight;
181 
182  bool m_allowClick;
183 
184  // true if Image has been scaled
185  bool doScale;
186  // true if Image has been rotated
187  bool doRotate;
188 
189  // Contains the current Effect or is 0 if no Effect is applied
190  Effect* imageEffect;
191 
192  // Scale Matrix
193  //QMatrix scaleMat;
194  int scale_w;
195  int scale_h;
196  // Rotation Matrix
197  //QMatrix rotMat;
198  int rot_angle;
199 
200  QPixmap pixmap;
201  QPixmap realpixmap;
202 
203  QRect rect_off, rect_on;
204  QRect old_tip_rect;
205 
206  bool zoomed;
207  //QString fn, fn_roll;
208  bool rollover;
209  QPixmap pixmap_off;
210  QPixmap pixmap_on;
211  int xoff, xon;
212  int yoff, yon;
213  QString imagePath;
214 
215  QString m_leftMouseButtonAction;
216  QString m_middleMouseButtonAction;
217  QString m_rightMouseButtonAction;
218 
219  QSvgRenderer *m_renderer;
220  bool m_connected;
221 
222  QString m_element;
223 };
224 
225 #endif // IMAGELABEL_H
ToAlpha::ToAlpha
ToAlpha(ImageLabel *, const QColor &alphaColor, int alpha, int millisec)
Definition: meters/imagelabel.cpp:119
ImageLabel::attachClickArea
void attachClickArea(QString leftMouseButton, QString middleMouseButton, QString rightMouseButton)
Definition: meters/imagelabel.cpp:618
ImageLabel::animationEnabled
bool animationEnabled() const
Definition: meters/imagelabel.cpp:666
ImageLabel::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: meters/imagelabel.cpp:375
ToAlpha
Definition: meters/imagelabel.h:96
ImageLabel::mouseEvent
bool mouseEvent(QEvent *e)
Definition: meters/imagelabel.cpp:396
ImageLabel::ImageLabel
ImageLabel(Karamba *k, int ix, int iy, int iw, int ih)
Definition: meters/imagelabel.cpp:139
ToGray::apply
QPixmap apply(QPixmap pixmap)
Definition: meters/imagelabel.cpp:111
ChannelIntensity
Definition: meters/imagelabel.h:74
ImageLabel::toAlpha
void toAlpha(const QColor &alphaColor, int alpha, int millisec)
Definition: meters/imagelabel.cpp:601
meter.h
ToAlpha::apply
QPixmap apply(QPixmap pixmap)
Definition: meters/imagelabel.cpp:122
Effect::myImage
ImageLabel * myImage
Definition: meters/imagelabel.h:55
ImageLabel::channelIntensity
void channelIntensity(float ratio, QString channel, int millisec)
Definition: meters/imagelabel.cpp:579
QWidget
ImageLabel::~ImageLabel
~ImageLabel()
Definition: meters/imagelabel.cpp:165
ImageLabel::elementDrawn
QString elementDrawn() const
Definition: meters/imagelabel.cpp:692
ImageLabel::scale
void scale(int, int)
Definition: meters/imagelabel.cpp:202
ImageLabel::intensity
void intensity(float ratio, int millisec)
Definition: meters/imagelabel.cpp:568
ImageLabel::parseImages
void parseImages(const QString &fn, const QString &fn_roll, int, int, int, int)
Definition: meters/imagelabel.cpp:434
ChannelIntensity::ChannelIntensity
ChannelIntensity(ImageLabel *, float r, const QString &c, int millisec)
Definition: meters/imagelabel.cpp:82
QObject
ChannelIntensity::apply
QPixmap apply(QPixmap pixmap)
Definition: meters/imagelabel.cpp:100
Karamba
Definition: karamba.h:52
ImageLabel::hide
virtual void hide()
Definition: meters/imagelabel.cpp:187
ImageLabel::enableAnimation
bool enableAnimation(bool enable)
Definition: meters/imagelabel.cpp:651
Intensity
Definition: meters/imagelabel.h:61
ImageLabel::getStringValue
QString getStringValue() const
Definition: meters/imagelabel.h:121
Effect::millisec
int millisec
Definition: meters/imagelabel.h:57
ImageLabel::allowClick
void allowClick(bool)
Definition: meters/imagelabel.cpp:424
ImageLabel::setPixel
void setPixel(const QPoint &point, const QColor &pixel)
Definition: meters/imagelabel.cpp:630
ImageLabel::background
int background
Definition: meters/imagelabel.h:139
ImageLabel::rolloverImage
void rolloverImage(QGraphicsSceneHoverEvent *e)
Definition: meters/imagelabel.cpp:519
ImageLabel::pixmapLoaded
void pixmapLoaded()
Effect::apply
virtual QPixmap apply(QPixmap pixmap)=0
ImageLabel::rotate
void rotate(int)
Definition: meters/imagelabel.cpp:193
ImageLabel::setTooltip
void setTooltip(QString txt)
Definition: meters/imagelabel.cpp:553
ImageLabel::drawElement
bool drawElement(const QString &element)
Definition: meters/imagelabel.cpp:671
ImageLabel::show
virtual void show()
Definition: meters/imagelabel.cpp:181
Intensity::Intensity
Intensity(ImageLabel *, float r, int millisec)
Definition: meters/imagelabel.cpp:67
Effect::startTimer
void startTimer()
Definition: meters/imagelabel.cpp:58
ToGray
Definition: meters/imagelabel.h:87
ImageLabel::setValue
void setValue(const QString &imagePath)
Definition: meters/imagelabel.cpp:299
Effect::Effect
Effect(ImageLabel *, int millisec)
Definition: meters/imagelabel.cpp:42
ImageLabel::setBackground
void setBackground(int b)
Definition: meters/imagelabel.cpp:514
ImageLabel::toGray
void toGray(int millisec)
Definition: meters/imagelabel.cpp:590
ToGray::ToGray
ToGray(ImageLabel *, int millisec)
Definition: meters/imagelabel.cpp:108
ImageLabel::removeEffects
void removeEffects()
Definition: meters/imagelabel.cpp:559
Meter
Definition: meters/meter.h:23
ImageLabel::smoothScale
void smoothScale(int, int)
Definition: meters/imagelabel.cpp:212
Intensity::apply
QPixmap apply(QPixmap pixmap)
Definition: meters/imagelabel.cpp:75
Effect::~Effect
virtual ~Effect()
Definition: meters/imagelabel.cpp:55
ImageLabel::clickable
bool clickable()
Definition: meters/imagelabel.cpp:429
ImageLabel::removeImageTransformations
void removeImageTransformations()
Definition: meters/imagelabel.cpp:231
Effect
Definition: meters/imagelabel.h:40
ImageLabel
Definition: meters/imagelabel.h:108
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

superkaramba

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

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • kremotecontrol
  • ktimer
  • kwallet
  • superkaramba
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal