aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/objects
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/objects')
-rw-r--r--src/modules/objects/class_image.cpp143
-rw-r--r--src/modules/objects/class_image.h54
2 files changed, 0 insertions, 197 deletions
diff --git a/src/modules/objects/class_image.cpp b/src/modules/objects/class_image.cpp
deleted file mode 100644
index 14ae64078..000000000
--- a/src/modules/objects/class_image.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-//mdm:
-// Image : class_image.h
-// Creation date : Fri Jan 13 18:30:48 CEST 2005
-// by Alessandro Carbone(Noldor) and Tonino Imbesi(Grifisx)
-// This file is part of the KVirc irc client distribution
-// Copyright (C) 1999-2006 Szymon Stefanek (pragma at kvirc dot net)
-//
-// This program is FREE software. You can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your opinion) any later version.
-//
-// This program is distributed in the HOPE that it will be USEFUL,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, write to the Free Software Foundation,
-// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
-
-#include "class_image.h"
-#include "kvi_debug.h"
-
-#include "kvi_locale.h"
-#include <qfile.h>
-
-/*
- @doc: image
- @keyterms:
- image object class
- @title:
- image class
- @type:
- class
- @short:
- @inherits:
- [class]object[/class]
- @description:
- Image class provides functions that can modify the image itself.
- @functions:
- !fn: $load(<file_name:string>)
- Load a image from the <file>.
- !fn: <integer> $height()
- Return the height of the image.
- !fn: <integer> $width()
- Return the width of the image.
- !fn: $setOpacity(opacity_value:integer)
- Set the image opacity; valid value are:from 0 (full transparency) to 255 (full opacity).
- */
-
-
-//===========================================================================================
-
-KVSO_BEGIN_REGISTERCLASS(KviKvsObject_image,"image","object")
-
- KVSO_REGISTER_HANDLER(KviKvsObject_image,"load",functionload)
- KVSO_REGISTER_HANDLER(KviKvsObject_image,"height",functionheight)
- KVSO_REGISTER_HANDLER(KviKvsObject_image,"width",functionwidth)
- KVSO_REGISTER_HANDLER(KviKvsObject_image,"setOpacity",functionsetOpacity)
-
-KVSO_END_REGISTERCLASS(KviKvsObject_image)
-
-
-KVSO_BEGIN_CONSTRUCTOR(KviKvsObject_image,KviKvsObject)
-
- m_pImage = new QImage(341,341,32);
-
-KVSO_END_CONSTRUCTOR(KviKvsObject_image)
-
-
-KVSO_BEGIN_DESTRUCTOR(KviKvsObject_image)
-
- if (m_pImage) delete m_pImage;
-KVSO_END_CONSTRUCTOR(KviKvsObject_image)
-
-
-bool KviKvsObject_image::functionload(KviKvsObjectFunctionCall *c)
-{
- QString szFile;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("file",KVS_PT_STRING,0,szFile)
- KVSO_PARAMETERS_END(c)
-
- if(!m_pImage)return true;
- if(!QFile::exists(szFile))
- {
- c->warning(__tr2qs("I can't find the specified file %Q."),&szFile);
- return true;
- }
-
- m_pImage->load( szFile );
- return true;
-}
-
-bool KviKvsObject_image::functionsetOpacity(KviKvsObjectFunctionCall *c)
-{
- if(!m_pImage)return true;
- kvs_uint_t iOpacity;
-
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("opacity_value",KVS_PT_INT,0,iOpacity)
- KVSO_PARAMETERS_END(c)
- if (!m_pImage->hasAlphaBuffer()) m_pImage->setAlphaBuffer(true);
- for(int y = 0;y < m_pImage->height();y++)
- {
- QRgb * dst = (QRgb *)m_pImage->scanLine(y);
- QRgb * end = dst + m_pImage->width();
- while(dst < end)
- {
- if (qRgba((int)(qRed(*dst)),(int)(qGreen(*dst)),(int)(qBlue(*dst)),(int)(qAlpha(*dst))))
- {
- *dst = qRgba((int)(qRed(*dst)),
- (int)(qGreen(*dst)),
- (int)(qBlue(*dst)),
- (int)(iOpacity));
- }
- dst++;
- }
-
- }
- return true;
- }
-
-bool KviKvsObject_image::functionheight(KviKvsObjectFunctionCall *c)
-{
- if(!m_pImage)return true;
- c->returnValue()->setInteger(m_pImage->height());
- return true;
-}
-bool KviKvsObject_image::functionwidth(KviKvsObjectFunctionCall *c)
-{
- if(!m_pImage)return true;
- c->returnValue()->setInteger(m_pImage->width());
- return true;
-}
-QImage KviKvsObject_image::getImage() const
-{
- QImage ret(*m_pImage);
- return ret;
-}
-#include "m_class_image.moc"
diff --git a/src/modules/objects/class_image.h b/src/modules/objects/class_image.h
deleted file mode 100644
index a4125b70d..000000000
--- a/src/modules/objects/class_image.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef _CLASS_IMAGE_H_
-#define _CLASS_IMAGE_H_
-//vim: ts=8
-// Image : class_image.h
-// by Alessandro Carbone (Noldor) and Tonino Imbesi(Grifisx)
-// Creation date : Fri Jan 13 18:43:01 CEST 2006
-//
-// This pixmap is part of the KVirc irc client distribution
-// Copyright (C) 1999-2006 Szymon Stefanek (pragma at kvirc dot net)
-//
-// This program is FREE software. You can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your opinion) any later version.
-//
-// This program is distributed in the HOPE that it will be USEFUL,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, write to the Free Software Foundation,
-// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
-
-
-
-#include <qimage.h>
-
-
-#include "object_macros.h"
-
-
-class KviKvsObject_image : public KviKvsObject
-{
- Q_OBJECT
-public:
- KVSO_DECLARE_OBJECT(KviKvsObject_image);
-public:
- QImage getImage() const;
- QImage * image(){ return m_pImage; }
-protected:
- QImage * m_pImage;
-
-protected:
- bool functionload(KviKvsObjectFunctionCall *c);
- bool functionheight(KviKvsObjectFunctionCall *c);
- bool functionwidth(KviKvsObjectFunctionCall *c);
- bool functionsetOpacity(KviKvsObjectFunctionCall *c);
-
-
- };
-
-#endif // !_CLASS_IMAGE_H_