kpresenter

KPrGradient.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef kpgradient_h
21#define kpgradient_h
22
23#include <tqcolor.h>
24#include <KoBrush.h>
25#include <kpixmap.h>
26#include "global.h"
27
28class TQPainter;
29class KoTextZoomHandler;
30
39class KPrGradient
40{
41public:
42 KPrGradient( const TQColor &_color1, const TQColor &_color2, BCType _bcType,
43 bool _unbalanced, int _xfactor, int _yfactor );
44 ~KPrGradient() {}
45
46 TQColor getColor1() const { return color1; }
47 TQColor getColor2() const { return color2; }
48 BCType getBackColorType() const { return bcType; }
49 bool getUnbalanced() const { return unbalanced; }
50 int getXFactor() const { return xFactor; }
51 int getYFactor() const { return yFactor; }
52
53 void setColor1( const TQColor &_color ) { color1 = _color; m_bDirty = true; }
54 void setColor2( const TQColor &_color ) { color2 = _color; m_bDirty = true; }
55 void setBackColorType( BCType _type ) { bcType = _type; m_bDirty = true; }
56 void setUnbalanced( bool b ) { unbalanced = b; m_bDirty = true; }
57 void setXFactor( int i ) { xFactor = i; m_bDirty = true; }
58 void setYFactor( int i ) { yFactor = i; m_bDirty = true; }
59 void setSize( const TQSize& _size )
60 {
61 if ( size() != _size ) {
62 m_pixmap.resize( _size );
63 m_bDirty = true;
64 }
65 }
66
67 // Sets all of the above at once. Used when loading.
68 void setParameters(const TQColor &c1, const TQColor &c2, BCType _type,
69 bool _unbalanced, int xf, int yf);
70
74 const TQPixmap& pixmap() const;
75 TQSize size() const { return m_pixmap.size(); }
76
77 void addRef();
78 bool removeRef();
79
80protected:
82 void paint();
83
84 KPrGradient() {}
85
86 TQColor color1, color2;
87 BCType bcType;
88
89 KPixmap m_pixmap;
90 int refCount;
91 int xFactor, yFactor;
92 bool unbalanced;
93 bool m_bDirty;
94};
95
96#endif
void paint()
Create the pixmap containing the gradient.
const TQPixmap & pixmap() const
Return the pixmap containing the gradient.