summaryrefslogtreecommitdiffstats
path: root/src/komposeimage.h
blob: 50012b50f96e82696c70ee54d55918a2bc3734d0 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//
// C++ Interface: komposeimage
//
// Description:
//
//
// Author: Hans Oischinger <oisch@sourceforge.net>, (C) 2004
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef KOMPOSEIMAGE_H
#define KOMPOSEIMAGE_H

#include <tqobject.h>
#include <tqstring.h>
#include <tqpixmap.h>

// #include those AFTER TQt-includes!
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <Imlib2.h>

enum ImageEffect { IEFFECT_NONE, IEFFECT_TITLE, IEFFECT_MINIMIZED, IEFFECT_MINIMIZED_AND_TITLE, IEFFECT_HIGHLIGHT };

/**
@author Hans Oischinger
*/
class KomposeImage : public TQObject
{
  TQ_OBJECT

public:
  KomposeImage( Imlib_Image &im );
  KomposeImage();
  ~KomposeImage();

  int width() 	const { return myWidth; }
  int height()	const { return myHeight; }
  int originalWidth() const { return myOrigWidth; }
  int originalHeight() const { return myOrigHeight; }

  void resize( int width, int height );
  
  TQPixmap* qpixmap( int effect );
  void renderPixmap();
  
  void setDirty( bool d ) { myIsDirty = d; }
  bool isDirty() const { return myIsDirty; }
  bool isValid() { return bhasImage || bhasSourcePixmap; }
  bool hasImage() { return bhasImage; }
  void setImage( Imlib_Image &im );
  void setImage( TQPixmap &pm );
  
public slots:
  void clearCached();

protected:
  void createImageFromPixmap();
  void applyEffect();
  void init();
  
private:
  int myWidth;
  int myHeight;
  
  Imlib_Image myIm;
  TQPixmap myTQPixmap;
  TQPixmap mySourceTQPixmap;
  
  Imlib_Color_Modifier cmHighlight, cmMinimized;
  
  bool myIsDirty;
  bool bhasImage;
  bool bhasSourcePixmap;

  int myOrigWidth;
  int myOrigHeight;

  int lasteffect;
  
signals:
  void startRendering();
  void stoppedRendering();
};

#endif