From fc0ecb7862102effa6ef5d152d3e894fd2e49908 Mon Sep 17 00:00:00 2001 From: Noldor Date: Wed, 7 Feb 2007 17:08:31 +0000 Subject: removed class image and enhanced pixmap class. git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@315 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/objects/Makefile.am | 5 +- src/modules/objects/class_listviewitem.cpp | 2 +- src/modules/objects/class_painter.cpp | 56 +---- src/modules/objects/class_painter.h | 3 +- src/modules/objects/class_pixmap.cpp | 392 +++++++++++++++++------------ src/modules/objects/class_pixmap.h | 14 +- src/modules/objects/libkviobjects.cpp | 62 +++-- src/modules/objects/objects_vc05.vcproj | 26 -- 8 files changed, 277 insertions(+), 283 deletions(-) (limited to 'src/modules') diff --git a/src/modules/objects/Makefile.am b/src/modules/objects/Makefile.am index aedff5261..ea66fc31c 100644 --- a/src/modules/objects/Makefile.am +++ b/src/modules/objects/Makefile.am @@ -18,8 +18,7 @@ libkviobjects_la_SOURCES = libkviobjects.cpp \ class_dockwindow.cpp \ class_file.cpp \ class_groupbox.cpp \ - class_image.cpp \ - class_label.cpp \ + class_label.cpp \ class_layout.cpp \ class_lcd.cpp \ class_lineedit.cpp \ @@ -64,7 +63,6 @@ noinst_HEADERS= class_button.h \ class_dockwindow.h \ class_file.h \ class_groupbox.h \ - class_image.h \ class_label.h \ class_layout.h \ class_lcd.h \ @@ -110,7 +108,6 @@ class_dialog.cpp: m_class_dialog.moc class_dockwindow.cpp: m_class_dockwindow.moc class_file.cpp: m_class_file.moc class_groupbox.cpp: m_class_groupbox.moc -class_image.cpp: m_class_image.moc class_label.cpp: m_class_label.moc class_layout.cpp: m_class_layout.moc class_lcd.cpp: m_class_lcd.moc diff --git a/src/modules/objects/class_listviewitem.cpp b/src/modules/objects/class_listviewitem.cpp index f50ab4910..7d193b98f 100644 --- a/src/modules/objects/class_listviewitem.cpp +++ b/src/modules/objects/class_listviewitem.cpp @@ -403,7 +403,7 @@ bool KviKvsObject_listviewitem::function_setPixmap(KviKvsObjectFunctionCall *c) c->warning(__tr2qs("Pixmap object or image Id required")); return true; } - pix=((KviKvsObject_pixmap *)obPixmap)->pixmap(); + pix=((KviKvsObject_pixmap *)obPixmap)->getPixmap(); } else { QString szPix; vPixmap->asString(szPix); diff --git a/src/modules/objects/class_painter.cpp b/src/modules/objects/class_painter.cpp index 5b8bc437a..d40d3a920 100644 --- a/src/modules/objects/class_painter.cpp +++ b/src/modules/objects/class_painter.cpp @@ -118,8 +118,6 @@ [/pre] !fn: $drawPixmap(,,,,,,) Draws a pixmap at x,y coordinates[br] - !fn: $drawImage(,,,,,,) - Draws a image at x,y coordinates[br] !fn: $setFont(,,)[br] Set the font's size, family and stile, valid flag for style are:[br] [pre] @@ -148,8 +146,6 @@ Shears the coordinate system by , . !fn: $scale(,) Scales the coordinate system by , . - !fn: $setNewWorld() - Update the world transformation. !fn: $setBackgroundMode() Sets the background mode of the painter to : valid values are:[br] - Transparent (that is the default value);[br] @@ -355,7 +351,6 @@ KVSO_BEGIN_REGISTERCLASS(KviKvsObject_painter,"painter","object") // Text & Pixmap KVSO_REGISTER_HANDLER(KviKvsObject_painter,"drawText",functiondrawText) KVSO_REGISTER_HANDLER(KviKvsObject_painter,"drawPixmap",functiondrawPixmap) - KVSO_REGISTER_HANDLER(KviKvsObject_painter,"drawImage",functiondrawImage) // MAtrix Operation @@ -773,14 +768,16 @@ bool KviKvsObject_painter::functionbegin(KviKvsObjectFunctionCall *c) c->warning(__tr2qs("Pixmap or Widget parameter is not an object")); return true; } + QPaintDevice * pd = 0; - if(pObject->inherits("KviKvsObject_pixmap"))pd = ((KviKvsObject_pixmap *)pObject)->pixmap(); + if(pObject->inherits("KviKvsObject_pixmap"))pd =((KviKvsObject_pixmap *)pObject)->getPixmap(); else if (pObject->inherits("KviKvsObject_widget")) pd=((KviKvsObject_widget *)pObject)->widget(); if (!pd) c->warning(__tr2qs("Widget or Pixmap required ")); else { attachDevice(pObject,pd); + if (pObject->inherits("KviKvsObject_pixmap")) ((KviKvsObject_pixmap *)pObject)->pixmapChanged(); } return true; } @@ -852,57 +849,16 @@ bool KviKvsObject_painter::functiondrawPixmap(KviKvsObjectFunctionCall *c) c->warning(__tr2qs("Pixmap parameter is not an object")); return true; } -/* - if (!pObject->object()) - { - c->warning(__tr2qs("Widget parameter is not a valid object")); - return true; - } -*/ if (!obj->inherits("KviKvsObject_pixmap")) { c->warning(__tr2qs("Pixmap object required")); return true; } - m_pPainter->drawPixmap(iX,iY,*((KviKvsObject_pixmap *)obj)->pixmap(),iStartx,iStarty,iEndx,iEndy); - return true; -} -bool KviKvsObject_painter::functiondrawImage(KviKvsObjectFunctionCall *c) -{ - kvs_int_t iX,iY,iStartx,iStarty,iEndx,iEndy; - KviKvsObject *obj; - kvs_hobject_t hObject; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("x",KVS_PT_INT,0,iX) - KVSO_PARAMETER("y",KVS_PT_INT,0,iY) - KVSO_PARAMETER("image",KVS_PT_HOBJECT,0,hObject) - KVSO_PARAMETER("start_x",KVS_PT_INT,0,iStartx) - KVSO_PARAMETER("start_y",KVS_PT_INT,0,iStarty) - KVSO_PARAMETER("end_x",KVS_PT_INT,0,iEndx) - KVSO_PARAMETER("end_y",KVS_PT_INT,0,iEndy) - KVSO_PARAMETERS_END(c) - obj=KviKvsKernel::instance()->objectController()->lookupObject(hObject); - if(!m_pPainter)return true; - if (!obj) - { - c->warning(__tr2qs("Image parameter is not an object")); - return true; - } -/* - if (!pObject->object()) - { - c->warning(__tr2qs("Widget parameter is not a valid object")); - return true; - } -*/ - if (!obj->inherits("KviKvsObject_image")) - { - c->warning(__tr2qs("Image object required")); - return true; - } - m_pPainter->drawImage(iX,iY,*((KviKvsObject_image *)obj)->image(),iStartx,iStarty,iEndx,iEndy); + QPixmap * pm=((KviKvsObject_pixmap *)obj)->getPixmap(); + m_pPainter->drawPixmap(iX,iY,*((KviKvsObject_pixmap *)obj)->getPixmap(),iStartx,iStarty,iEndx,iEndy); return true; } + bool KviKvsObject_painter::functionrotateMatrix(KviKvsObjectFunctionCall *c) { kvs_real_t dAngle; diff --git a/src/modules/objects/class_painter.h b/src/modules/objects/class_painter.h index 2dd7b6185..782160387 100644 --- a/src/modules/objects/class_painter.h +++ b/src/modules/objects/class_painter.h @@ -63,8 +63,7 @@ public: bool functiondrawText(KviKvsObjectFunctionCall *c); bool functiondrawPixmap(KviKvsObjectFunctionCall *c); - bool functiondrawImage(KviKvsObjectFunctionCall *c); - + bool functionbegin(KviKvsObjectFunctionCall *c); bool functionend(KviKvsObjectFunctionCall *c); diff --git a/src/modules/objects/class_pixmap.cpp b/src/modules/objects/class_pixmap.cpp index 4c9604ea2..6da8425dd 100644 --- a/src/modules/objects/class_pixmap.cpp +++ b/src/modules/objects/class_pixmap.cpp @@ -1,164 +1,228 @@ -//mdm: -// Painter : class_pixmap.h -// Creation date : Fri Mar 18 14:30:48 CEST 2005 -// by Tonino Imbesi(Grifisx) and Alessandro Carbone(Noldor) -// Lucia Papini (^ashura^) English Translation. -// This file is part of the KVirc irc client distribution -// Copyright (C) 1999-2000 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_pixmap.h" -#include "kvi_debug.h" - -#include "kvi_locale.h" -#include - -/* - @doc: pixmap - @keyterms: - pixmap object class - @title: - pixmap class - @type: - class - @short: - This class provide a pixmap. - @inherits: - [class]object[/class] - [class]widget[/class] - @description: - The pixmap class is an off-screen, pixel-based paint device. - @functions: - !fn: $fill(,,) - Fills the pixmap with the widget's background color or pixmap.[br] - Note that x_offset, y_offest are offsets in the widget. - !fn: $resize(,) - Resizes the pixmap to w width and h height. Set wh or hg to 0, to have a null pixmap. - !fn: $load() - Load a pixmap from the . - !fn: $height() - Return the height of the pixmap. - !fn: $width() - Return the width of the pixmap. - -*/ - - -KVSO_BEGIN_REGISTERCLASS(KviKvsObject_pixmap,"pixmap","object") - - KVSO_REGISTER_HANDLER(KviKvsObject_pixmap,"fill",functionfill) - KVSO_REGISTER_HANDLER(KviKvsObject_pixmap,"resize",functionresize) - KVSO_REGISTER_HANDLER(KviKvsObject_pixmap,"load",functionload) - KVSO_REGISTER_HANDLER(KviKvsObject_pixmap,"height",functionheight) - KVSO_REGISTER_HANDLER(KviKvsObject_pixmap,"width",functionwidth) - -KVSO_END_REGISTERCLASS(KviKvsObject_pixmap) - - -KVSO_BEGIN_CONSTRUCTOR(KviKvsObject_pixmap,KviKvsObject) - - m_pPixmap = new QPixmap(); - -KVSO_END_CONSTRUCTOR(KviKvsObject_pixmap) - - -KVSO_BEGIN_DESTRUCTOR(KviKvsObject_pixmap) - - emit aboutToDie(); - delete m_pPixmap; - -KVSO_END_CONSTRUCTOR(KviKvsObject_pixmap) - - -bool KviKvsObject_pixmap::functionfill(KviKvsObjectFunctionCall *c) -{ - KviKvsObject *ob; - kvs_int_t iXoffset,iYoffset; - kvs_hobject_t hObject; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject) - KVSO_PARAMETER("x_offset",KVS_PT_INT,0,iXoffset) - KVSO_PARAMETER("y_offset",KVS_PT_INT,0,iYoffset) - KVSO_PARAMETERS_END(c) - - ob=KviKvsKernel::instance()->objectController()->lookupObject(hObject); - if(!m_pPixmap)return true; - if (!ob) - { - c->warning(__tr2qs("Widget parameter is not an object")); - return true; - } - if(!ob->object()->isWidgetType()) - { - c->warning(__tr2qs("Can't fill non-widget object")); - return true; - } - m_pPixmap->fill(((QWidget *)(ob->object())),iXoffset,iYoffset); - return true; -} - -bool KviKvsObject_pixmap::functionresize(KviKvsObjectFunctionCall *c) -{ - kvs_int_t uWidth,uHeight; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("width",KVS_PT_UNSIGNEDINTEGER,0,uWidth) - KVSO_PARAMETER("height",KVS_PT_UNSIGNEDINTEGER,0,uHeight) - KVSO_PARAMETERS_END(c) - if(!m_pPixmap)return true; - m_pPixmap->resize(uWidth,uHeight); - return true; -} - - -bool KviKvsObject_pixmap::functionload(KviKvsObjectFunctionCall *c) -{ - QString szFile; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("file",KVS_PT_STRING,0,szFile) - KVSO_PARAMETERS_END(c) - - if(!m_pPixmap)return true; - if(!QFile::exists(szFile)) - { - c->warning(__tr2qs("I can't find the specified file %Q."),&szFile); - return true; - } - - m_pPixmap->load( szFile ); - - return true; -} -bool KviKvsObject_pixmap::functionheight(KviKvsObjectFunctionCall *c) -{ - if(!m_pPixmap)return true; - c->returnValue()->setInteger(m_pPixmap->height()); - return true; -} -bool KviKvsObject_pixmap::functionwidth(KviKvsObjectFunctionCall *c) -{ - if(!m_pPixmap)return true; - c->returnValue()->setInteger(m_pPixmap->width()); - return true; -} - -QPixmap KviKvsObject_pixmap::getPixmap() const -{ - QPixmap ret(*m_pPixmap); - return ret; -} - -#include "m_class_pixmap.moc" +//mdm: +// Painter : class_pixmap.h +// Creation date : Fri Mar 18 14:30:48 CEST 2005 +// by Tonino Imbesi(Grifisx) and Alessandro Carbone(Noldor) +// Lucia Papini (^ashura^) English Translation. +// This file is part of the KVirc irc client distribution +// Copyright (C) 1999-2000 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_pixmap.h" +#include "kvi_debug.h" + +#include "kvi_locale.h" +#include + +/* + @doc: pixmap + @keyterms: + pixmap object class + @title: + pixmap class + @type: + class + @short: + This class provide a pixmap. + @inherits: + [class]object[/class] + [class]widget[/class] + @description: + The pixmap class is an off-screen, pixel-based paint device. + @functions: + !fn: $fill(,,) + Fills the pixmap with the widget's background color or pixmap.[br] + Note that x_offset, y_offest are offsets in the widget. + !fn: $resize(,) + Resizes the pixmap to w width and h height. Set wh or hg to 0, to have a null pixmap. + !fn: $load() + Load a pixmap from the . + !fn: $height() + Return the height of the pixmap. + !fn: $width() + Return the width of the pixmap. + +*/ + + +KVSO_BEGIN_REGISTERCLASS(KviKvsObject_pixmap,"pixmap","object") + + KVSO_REGISTER_HANDLER(KviKvsObject_pixmap,"fill",functionfill) + KVSO_REGISTER_HANDLER(KviKvsObject_pixmap,"resize",functionresize) + KVSO_REGISTER_HANDLER(KviKvsObject_pixmap,"load",functionload) + KVSO_REGISTER_HANDLER(KviKvsObject_pixmap,"height",functionheight) + KVSO_REGISTER_HANDLER(KviKvsObject_pixmap,"width",functionwidth) + //KVSO_REGISTER_HANDLER(KviKvsObject_pixmap,"setOpacity",functionsetOpacity) + +KVSO_END_REGISTERCLASS(KviKvsObject_pixmap) + + +KVSO_BEGIN_CONSTRUCTOR(KviKvsObject_pixmap,KviKvsObject) + m_pPixmap=new QPixmap(); + m_pImage=new QImage(); + bPixmapModified=false; + bImageModified=false; +KVSO_END_CONSTRUCTOR(KviKvsObject_pixmap) + + +KVSO_BEGIN_DESTRUCTOR(KviKvsObject_pixmap) + + emit aboutToDie(); + delete m_pPixmap; + if (m_pImage) delete m_pImage; + +KVSO_END_CONSTRUCTOR(KviKvsObject_pixmap) + + +bool KviKvsObject_pixmap::functionfill(KviKvsObjectFunctionCall *c) +{ + KviKvsObject *ob; + kvs_int_t iXoffset,iYoffset; + kvs_hobject_t hObject; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject) + KVSO_PARAMETER("x_offset",KVS_PT_INT,0,iXoffset) + KVSO_PARAMETER("y_offset",KVS_PT_INT,0,iYoffset) + KVSO_PARAMETERS_END(c) + + ob=KviKvsKernel::instance()->objectController()->lookupObject(hObject); + if (!ob) + { + c->warning(__tr2qs("Widget parameter is not an object")); + return true; + } + if(!ob->object()->isWidgetType()) + { + c->warning(__tr2qs("Widget object required")); + return true; + } + bPixmapModified=true; + m_pPixmap->fill(((QWidget *)(ob->object())),iXoffset,iYoffset); + return true; +} + +bool KviKvsObject_pixmap::functionresize(KviKvsObjectFunctionCall *c) +{ + kvs_int_t uWidth,uHeight; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("width",KVS_PT_UNSIGNEDINTEGER,0,uWidth) + KVSO_PARAMETER("height",KVS_PT_UNSIGNEDINTEGER,0,uHeight) + KVSO_PARAMETERS_END(c) + m_pPixmap->resize(uWidth,uHeight); + bPixmapModified=true; + return true; +} + + +bool KviKvsObject_pixmap::functionload(KviKvsObjectFunctionCall *c) +{ + QString szFile; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("file",KVS_PT_STRING,0,szFile) + KVSO_PARAMETERS_END(c) + + if(!QFile::exists(szFile)) + { + c->warning(__tr2qs("I can't find the specified file %Q."),&szFile); + return true; + } + m_pPixmap->load(szFile); + bPixmapModified=true; + return true; +} +bool KviKvsObject_pixmap::functionheight(KviKvsObjectFunctionCall *c) +{ + c->returnValue()->setInteger(m_pPixmap->height()); + return true; +} +bool KviKvsObject_pixmap::functionwidth(KviKvsObjectFunctionCall *c) +{ + c->returnValue()->setInteger(m_pPixmap->width()); + return true; +} +bool KviKvsObject_pixmap::functionsetOpacity(KviKvsObjectFunctionCall *c) +{ + if(!m_pPixmap)return true; + kvs_real_t dOpacity; + KviKvsObject * pObDest; + kvs_hobject_t hObject; + + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("opacity_factor",KVS_PT_DOUBLE,0,dOpacity) + KVSO_PARAMETER("destination",KVS_PT_HOBJECT,0,hObject) + KVSO_PARAMETERS_END(c) + pObDest=KviKvsKernel::instance()->objectController()->lookupObject(hObject); + + if (!pObDest) + { + c->warning(__tr2qs("Destination parameter is not an object")); + return true; + } + + if(!pObDest->inherits("KviKvsObject_pixmap")) + { + c->warning(__tr2qs("Destination must be a pixmap object")); + return true; + } + QImage *buffer=((KviKvsObject_pixmap *)pObDest)->getImage(); + ((KviKvsObject_pixmap *)pObDest)->imageChanged(); + if (bPixmapModified) { + *m_pImage=m_pPixmap->convertToImage(); + } + buffer->setAlphaBuffer(true); + + for(int y = 0;y < m_pImage->height();y++) + { + QRgb * dst = (QRgb *)buffer->scanLine(y); + QRgb * src = (QRgb *)m_pImage->scanLine(y); + QRgb * end = src + m_pImage->width(); + while(src < end) + { + *dst = qRgba( + (int)(qRed(*src)), + (int)(qGreen(*src)), + (int)(qBlue(*src)), + (int)(qAlpha(*src)*dOpacity) + ); + src++; + dst++; + } + } + return true; +} + + +QPixmap * KviKvsObject_pixmap::getPixmap() +{ + if (bImageModified) { + m_pPixmap->convertFromImage(*m_pImage); + bImageModified=false; + } + return m_pPixmap; +} +QImage * KviKvsObject_pixmap::getImage() +{ + if (bPixmapModified) { + *m_pImage=m_pPixmap->convertToImage(); + //debug ("image info2 %d and %d",test.width(),test.height()); + + bPixmapModified=false; + } + + return m_pImage; +} + +#include "m_class_pixmap.moc" diff --git a/src/modules/objects/class_pixmap.h b/src/modules/objects/class_pixmap.h index 9d050a830..fbd091014 100644 --- a/src/modules/objects/class_pixmap.h +++ b/src/modules/objects/class_pixmap.h @@ -25,6 +25,7 @@ #include +#include #include "kvi_string.h" @@ -34,14 +35,20 @@ class KviKvsObject_pixmap : public KviKvsObject { Q_OBJECT - Q_PROPERTY(QPixmap pixmap READ getPixmap) +// Q_PROPERTY(QPixmap pixmap READ getPixmap) public: KVSO_DECLARE_OBJECT(KviKvsObject_pixmap); - ; - QPixmap getPixmap() const; + QPixmap * getPixmap(); + QImage * getImage(); + void pixmapChanged(){bPixmapModified=true;} + void imageChanged(){bImageModified=true;} + QPixmap * pixmap(){ return m_pPixmap; } protected: QPixmap * m_pPixmap; + QImage * m_pImage; + bool bImageModified; + bool bPixmapModified; signals: void aboutToDie(); @@ -51,6 +58,7 @@ protected: bool functionload(KviKvsObjectFunctionCall *c); bool functionheight(KviKvsObjectFunctionCall *c); bool functionwidth(KviKvsObjectFunctionCall *c); + bool functionsetOpacity(KviKvsObjectFunctionCall *c); }; diff --git a/src/modules/objects/libkviobjects.cpp b/src/modules/objects/libkviobjects.cpp index 2875b603f..8ca8fcbcb 100644 --- a/src/modules/objects/libkviobjects.cpp +++ b/src/modules/objects/libkviobjects.cpp @@ -79,7 +79,6 @@ #include "class_wrapper.h" #include "class_dialog.h" #include "class_xmlreader.h" -#include "class_image.h" #include "class_dockwindow.h" #include "class_vbox.h" #include "class_hbox.h" @@ -89,7 +88,6 @@ static bool objects_module_cleanup(KviModule *m) { KviKvsObject_process::unregisterSelf(); KviKvsObject_socket::unregisterSelf(); - KviKvsObject_image::unregisterSelf(); KviKvsObject_xmlreader::unregisterSelf(); KviKvsObject_wrapper::unregisterSelf(); KviKvsObject_file::unregisterSelf(); @@ -613,32 +611,30 @@ static bool objects_kvs_cmd_bitBlt(KviKvsModuleCommandCall * c) return true; } - QImage * imgSource=0; - QPaintDevice * pdSource = 0; - if (obSrc->inherits("KviKvsObject_image")) - imgSource=((KviKvsObject_image *)obSrc)->image(); - else{ - - if(obSrc->inherits("KviKvsObject_pixmap")) pdSource = ((KviKvsObject_pixmap *)obSrc)->pixmap(); + QImage * imgSource=0; + QPaintDevice * pdSource = 0; + + if(obSrc->inherits("KviKvsObject_pixmap")) pdSource =((KviKvsObject_pixmap *)obSrc)->getPixmap(); else if (obSrc->inherits("KviKvsObject_widget")) pdSource=((KviKvsObject_widget *)obSrc)->widget(); if (!pdSource) { c->warning(__tr2qs("Widget, Image or Pixmap required ")); return true; } + QPaintDevice * pdDest = 0; + if(obDst->inherits("KviKvsObject_pixmap")){ + pdDest= ((KviKvsObject_pixmap *)obDst)->getPixmap(); } - QPaintDevice * pdDest = 0; - if(obDst->inherits("KviKvsObject_pixmap")) pdDest= ((KviKvsObject_pixmap *)obDst)->pixmap(); else if (obDst->inherits("KviKvsObject_widget")) pdDest=((KviKvsObject_widget *)obDst)->widget(); if (!pdDest) { c->warning(__tr2qs("Widget or Pixmap required")); return true; } - if (obSrc->inherits("KviKvsObject_image")) - bitBlt(pdDest,iXdst,iYdst,imgSource,iXsrc,iYsrc,uW,uH); - else - bitBlt(pdDest,iXdst,iYdst,pdSource,iXsrc,iYsrc,uW,uH); + if(obDst->inherits("KviKvsObject_pixmap")){ + ((KviKvsObject_pixmap *)obDst)->pixmapChanged(); + } + bitBlt(pdDest,iXdst,iYdst,pdSource,iXsrc,iYsrc,uW,uH); return true; } /* @@ -671,25 +667,25 @@ static bool objects_kvs_cmd_blend(KviKvsModuleCommandCall * c) kvs_int_t iBkX,iBkY; kvs_int_t iFoX,iFoY; kvs_int_t iDesX,iDesY,uW,uH; - kvs_real_t iBlend; + kvs_real_t dBlend; kvs_hobject_t hBk,hFo,hDest; KVSO_PARAMETERS_BEGIN(c) - + KVSO_PARAMETER("destination",KVS_PT_HOBJECT,0,hDest) + KVSO_PARAMETER("x_offset_dest",KVS_PT_INT,0,iDesX) + KVSO_PARAMETER("y_offset_dest",KVS_PT_INT,0,iDesY) + KVSO_PARAMETER("image_background",KVS_PT_HOBJECT,0,hBk) KVSO_PARAMETER("x_offset_background",KVS_PT_UNSIGNEDINTEGER,0,iBkX) KVSO_PARAMETER("y_offset_background",KVS_PT_UNSIGNEDINTEGER,0,iBkY) KVSO_PARAMETER("image_foreground",KVS_PT_HOBJECT,0,hFo) KVSO_PARAMETER("x_offset_foreground",KVS_PT_UNSIGNEDINTEGER,0,iFoX) KVSO_PARAMETER("y_offset_foreground",KVS_PT_UNSIGNEDINTEGER,0,iFoY) - KVSO_PARAMETER("destination",KVS_PT_HOBJECT,0,hDest) - KVSO_PARAMETER("x_offset_dest",KVS_PT_INT,0,iDesX) - KVSO_PARAMETER("y_offset_dest",KVS_PT_INT,0,iDesY) KVSO_PARAMETER("width",KVS_PT_UNSIGNEDINTEGER,0,uW) KVSO_PARAMETER("height",KVS_PT_UNSIGNEDINTEGER,0,uH) - KVSO_PARAMETER("blend_value",KVS_PT_REAL,0,iBlend) + KVSO_PARAMETER("blend_value",KVS_PT_REAL,0,dBlend) @@ -706,14 +702,14 @@ static bool objects_kvs_cmd_blend(KviKvsModuleCommandCall * c) return true; } - if (!obBck->inherits("KviKvsObject_image") || !obFor->inherits("KviKvsObject_image")) + if (!obBck->inherits("KviKvsObject_pixmap") || !obFor->inherits("KviKvsObject_pixmap")) { - c->warning(__tr2qs("Image objects required")); + c->warning(__tr2qs("Pixmap objects required")); return true; } - QPaintDevice * pdDest = 0; - if(obDest->inherits("KviKvsObject_pixmap")) pdDest = ((KviKvsObject_pixmap *)obDest)->pixmap(); + QPaintDevice * pdDest = 0; + if(obDest->inherits("KviKvsObject_pixmap")) pdDest = ((KviKvsObject_pixmap *)obDest)->getPixmap(); else if (obDest->inherits("KviKvsObject_widget")) pdDest=((KviKvsObject_widget *)obDest)->widget(); if (!pdDest) @@ -722,10 +718,11 @@ static bool objects_kvs_cmd_blend(KviKvsModuleCommandCall * c) return true; } + if(obDest->inherits("KviKvsObject_pixmap")) ((KviKvsObject_pixmap *)obDest)->pixmapChanged(); - QImage *img_back=((KviKvsObject_image *)obBck)->image(); - QImage *img_fore=((KviKvsObject_image *)obFor)->image(); + QImage *img_back=((KviKvsObject_pixmap *)obBck)->getImage(); + QImage *img_fore=((KviKvsObject_pixmap *)obFor)->getImage(); // check size if ((iBkX+uW>img_back->width())||(iBkY+uH>img_back->height())) @@ -749,17 +746,17 @@ static bool objects_kvs_cmd_blend(KviKvsModuleCommandCall * c) bkg += iBkX; QRgb * fgn = (QRgb *)img_fore->scanLine(y+iFoY); fgn += iFoX; - double dRemaining = 1.0 - iBlend; + double dRemaining = 1.0 - dBlend; int a=0; while(dst < end) { *dst = qRgba( - (int)((qRed(*bkg) * dRemaining) + (qRed(*fgn) * iBlend)), - (int)((qGreen(*bkg) * dRemaining) + (qGreen(*fgn) * iBlend)), - (int)((qBlue(*bkg) * dRemaining) + (qBlue(*fgn) * iBlend)), - (int)((qAlpha(*bkg) * dRemaining) + (qAlpha(*fgn) * iBlend)) + (int)((qRed(*bkg) * dRemaining) + (qRed(*fgn) * dBlend)), + (int)((qGreen(*bkg) * dRemaining) + (qGreen(*fgn) * dBlend)), + (int)((qBlue(*bkg) * dRemaining) + (qBlue(*fgn) * dBlend)), + (int)((qAlpha(*bkg) * dRemaining) + (qAlpha(*fgn) * dBlend)) ); dst++; @@ -960,7 +957,6 @@ static bool objects_module_can_unload(KviModule *m) KviKvsObject_file::registerSelf(); KviKvsObject_wrapper::registerSelf(); KviKvsObject_xmlreader::registerSelf(); - KviKvsObject_image::registerSelf(); KviKvsObject_socket::registerSelf(); KviKvsObject_process::registerSelf(); diff --git a/src/modules/objects/objects_vc05.vcproj b/src/modules/objects/objects_vc05.vcproj index 202c3895a..f4dc9aae8 100644 --- a/src/modules/objects/objects_vc05.vcproj +++ b/src/modules/objects/objects_vc05.vcproj @@ -245,10 +245,6 @@ RelativePath=".\class_hbox.cpp" > - - @@ -558,28 +554,6 @@ RelativePath=".\class_hbox.h" > - - - - - - - - -- cgit v1.3.1-10-gc9f91