KVIrc 5.2.0
Developer APIs
KvsObject_pixmap.h
Go to the documentation of this file.
1#ifndef _CLASS_PIXMAP_H_
2#define _CLASS_PIXMAP_H_
3//=============================================================================
4//
5// File : KvsObject_pixmap.h
6// Creation date : Fri Mar 18 14:30:48 CEST 2005
7// by Tonino Imbesi(Grifisx) and Alessandro Carbone(Noldor)
8//
9// This file is part of the KVIrc IRC client distribution
10// Copyright (C) 2005-2008 Alessandro Carbone (elfonol at gmail dot com)
11//
12// This program is FREE software. You can redistribute it and/or
13// modify it under the terms of the GNU General Public License
14// as published by the Free Software Foundation; either version 2
15// of the License, or (at your option) any later version.
16//
17// This program is distributed in the HOPE that it will be USEFUL,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20// See the GNU General Public License for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program. If not, write to the Free Software Foundation,
24// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25//
26//=============================================================================
27
28#include <qpixmap.h>
29#include <qimage.h>
30#include <KviAnimatedPixmap.h>
31#include "KviCString.h"
32
33#include "object_macros.h"
34
36{
37 Q_OBJECT
38 // Q_PROPERTY(QPixmap pixmap READ getPixmap)
39public:
48 void setInternalPixmap(QPixmap * pPixmap);
49 void setInternalImage(QImage * pImage);
50
51 QImage * getImage()
52 {
53 if(!m_pImage)
54 m_pImage = new QImage();
56 {
57 if(m_pPixmap)
58 {
59 *m_pImage = m_pPixmap->toImage();
60 delete m_pPixmap;
61 m_pPixmap = nullptr;
62 }
63 }
65 return m_pImage;
66 }
67
68 QPixmap * getPixmap()
69 {
70 if(!m_pPixmap)
71 m_pPixmap = new QPixmap();
72 if(m_currentType == Image)
73 {
74 if(m_pImage)
75 {
76 *m_pPixmap = m_pPixmap->fromImage(*m_pImage);
77 delete m_pImage;
78 m_pImage = nullptr;
79 }
80 }
82 return m_pPixmap;
83 }
84
85protected:
87 QPixmap * m_pPixmap;
88 QImage * m_pImage;
89signals:
90 void aboutToDie();
91
92protected:
96 //bool rotate(KviKvsObjectFunctionCall *c);
112protected slots:
113 void frameChanged();
114};
115
116#endif // !_CLASS_PIXMAP_H_
Definition KviAnimatedPixmap.h:70
Definition KviKvsObjectFunctionCall.h:34
Definition KviKvsObject.h:51
Definition KvsObject_pixmap.h:36
bool loadFromMemoryBuffer(KviKvsObjectFunctionCall *c)
void setInternalPixmap(QPixmap *pPixmap)
Definition KvsObject_pixmap.cpp:605
bool scale(KviKvsObjectFunctionCall *c)
bool toGrayScale(KviKvsObjectFunctionCall *c)
bool frameChangedEvent(KviKvsObjectFunctionCall *c)
bool mirrored(KviKvsObjectFunctionCall *c)
bool height(KviKvsObjectFunctionCall *c)
Type m_currentType
Definition KvsObject_pixmap.h:47
bool resize(KviKvsObjectFunctionCall *c)
bool width(KviKvsObjectFunctionCall *c)
bool startAnimation(KviKvsObjectFunctionCall *c)
bool load(KviKvsObjectFunctionCall *c)
Type
Definition KvsObject_pixmap.h:42
@ AnimatedPixmap
Definition KvsObject_pixmap.h:44
@ Pixmap
Definition KvsObject_pixmap.h:43
@ Image
Definition KvsObject_pixmap.h:45
KviAnimatedPixmap * m_pAnimatedPixmap
Definition KvsObject_pixmap.h:86
bool pixel(KviKvsObjectFunctionCall *c)
void frameChanged()
Definition KvsObject_pixmap.cpp:705
void setInternalImage(QImage *pImage)
Definition KvsObject_pixmap.cpp:614
QPixmap * m_pPixmap
Definition KvsObject_pixmap.h:87
QImage * m_pImage
Definition KvsObject_pixmap.h:88
bool save(KviKvsObjectFunctionCall *c)
bool setPixel(KviKvsObjectFunctionCall *c)
bool rotate(KviKvsObjectFunctionCall *c)
bool grabWidget(KviKvsObjectFunctionCall *c)
bool fill(KviKvsObjectFunctionCall *c)
bool loadAnimation(KviKvsObjectFunctionCall *c)
QImage * getImage()
Definition KvsObject_pixmap.h:51
QPixmap * getPixmap()
Definition KvsObject_pixmap.h:68
bool stopAnimation(KviKvsObjectFunctionCall *c)
#define KVSO_DECLARE_OBJECT(__className)
Definition object_macros.h:33