summaryrefslogtreecommitdiffstats
path: root/src/effectwidget.h
blob: 57df6bf34c277cb71ead26095c59a6f91b1a5f39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/***************************************************************************
 *   Copyright Sean Meiners 2004 <Sean.Meiners@LinspireInc.com>            *
 *   Copyright (C) by                                                      *
 *     - 2005: Christian Leh <moodwrod@web.de>                             *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License (version 2) as   *
 *   published by the Free Software Foundation. (The original KSplash/ML   *
 *   codebase (upto version 0.95.3) is BSD-licensed.)                      *
 *                                                                         *
 ***************************************************************************/

#ifndef FADEWIDGET_H
#define FADEWIDGET_H

#include <qwidget.h>
#include <qptrlist.h>
#include <qpixmap.h>
#include <qimage.h>

#include <kimageeffect.h>

class QTimer;

class EffectWidget : public QWidget
{
  Q_OBJECT

 public:
  EffectWidget(QWidget *parent = 0,const char *name = 0);

  static void setBackgroundImage(QImage *image) { bgImage = image; }

  void setImage(QImage *i);
  void setDelay(int delayInMS);
  void setLoop(bool loop);
  void setSteps(int steps);
  void setStart(float begin, float end = 1.0, bool reverse = false);

  void start();
  void stop();
  void rewind();

  void paintEvent(QPaintEvent *);
  void resizeEvent(QResizeEvent *);
  void moveEvent(QMoveEvent *);

  void updateCache();

 public slots:
  void timerTick();

 private:
  static QImage *bgImage;

  QTimer *timer;
  QImage *image;
  QImage background;
  unsigned int delayMS;
  unsigned int currentStep;
  unsigned int totalSteps;
  bool playing;
  bool loop;
  float
    beginOpacity,
    endOpacity;
};

#endif