diff options
| author | 2009-09-02 15:56:45 +0000 | |
|---|---|---|
| committer | 2009-09-02 15:56:45 +0000 | |
| commit | 6d86b51b1030208d99649829cea96de0b64b5ed7 (patch) | |
| tree | c226a1dc617171c0a8f74fcce7d492486fcf24d8 /src/modules/objects/libkviobjects.cpp | |
| parent | - trailing whitespace cleanups all over the place (diff) | |
| download | KVIrc-6d86b51b1030208d99649829cea96de0b64b5ed7.tar.gz KVIrc-6d86b51b1030208d99649829cea96de0b64b5ed7.tar.bz2 KVIrc-6d86b51b1030208d99649829cea96de0b64b5ed7.zip | |
Some fix in code and doc + removed obsolete code
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3466 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/objects/libkviobjects.cpp')
| -rw-r--r-- | src/modules/objects/libkviobjects.cpp | 212 |
1 files changed, 1 insertions, 211 deletions
diff --git a/src/modules/objects/libkviobjects.cpp b/src/modules/objects/libkviobjects.cpp index 12d3cec22..ff3cfeb3d 100644 --- a/src/modules/objects/libkviobjects.cpp +++ b/src/modules/objects/libkviobjects.cpp @@ -4,7 +4,7 @@ // Creation date : Wed Sep 09 2000 20:59:01 by Szymon Stefanek // // This file is part of the KVirc irc client distribution -// Copyright (C) 2000-2008 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2000-2009 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 @@ -612,215 +612,7 @@ static bool objects_kvs_cmd_disconnect(KviKvsModuleCommandCall * c) } -static bool objects_kvs_cmd_bitBlt(KviKvsModuleCommandCall * c) -{ - /* - @doc: objects.bitblt - @type: - command - @title: - objects.bitblt - @keyterms: - widget pixmap painter - @short: - Copies a block of pixels from a source to a destination. - @syntax: - objects.bitblt <source> <x> <y> <destination> - @description: - Copies a block of pixels from <source> to <destination> at the coordinates <x>,<y> .[br] - Source and destination must be a widget or pixmap.[br] - - */ - - KviKvsObject *obSrc; - KviKvsObject *obDst; - kvs_int_t iXdst,iYdst,iXsrc,iYsrc,uW,uH; - kvs_hobject_t hDst,hSrc; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("destination",KVS_PT_HOBJECT,0,hDst) - KVSO_PARAMETER("x offset dest",KVS_PT_INT,0,iXdst) - KVSO_PARAMETER("y offset dest",KVS_PT_INT,0,iYdst) - KVSO_PARAMETER("source",KVS_PT_HOBJECT,0,hSrc) - KVSO_PARAMETER("x offset source",KVS_PT_INT,0,iXsrc) - KVSO_PARAMETER("y offset source",KVS_PT_INT,0,iYsrc) - KVSO_PARAMETER("width",KVS_PT_UNSIGNEDINTEGER,0,uW) - KVSO_PARAMETER("height",KVS_PT_UNSIGNEDINTEGER,0,uH) - KVSO_PARAMETERS_END(c) - obSrc=KviKvsKernel::instance()->objectController()->lookupObject(hSrc); - if (!obSrc) - { - c->warning(__tr2qs_ctx("Source is not an object","objects")); - return true; - } - obDst=KviKvsKernel::instance()->objectController()->lookupObject(hDst); - if (!obDst) - { - c->warning(__tr2qs_ctx("Destination is not an object","objects")); - return true; - } - - QPaintDevice * pdSource = 0; - - if(obSrc->inheritsClass("pixmap")) pdSource =((KviKvsObject_pixmap *)obSrc)->getPixmap(); - else if (obSrc->inheritsClass("widget")) pdSource=((KviKvsObject_widget *)obSrc)->widget(); - if (!pdSource) - { - c->warning(__tr2qs_ctx("Widget, Image or Pixmap required ","objects")); - return true; - } - QPaintDevice * pdDest = 0; - if(obDst->inheritsClass("pixmap")){ - pdDest= ((KviKvsObject_pixmap *)obDst)->getPixmap(); - } - else if (obDst->inheritsClass("widget")) pdDest=((KviKvsObject_widget *)obDst)->widget(); - if (!pdDest) - { - c->warning(__tr2qs_ctx("Widget or Pixmap required","objects")); - return true; - } - if(obDst->inheritsClass("pixmap")){ - //((KviKvsObject_pixmap *)obDst)->pixmapChanged(); - } - - /*FIXME - QPainter p(pdDest); - QRect rectdest(iXdst,iYdst,uW,uH); - QRect rectsrc(iXsrc,iYsrc,uW,uH); - - p.drawPixmap(rectdest,pdSource,rectsrc); - */ - return true; -} - /* - @doc: objects.blend - @type: - command - @title: - objects.blend - @keyterms: - widget pixmap image - @short: - Blends two images to a destination. - @syntax: - objects.blend <background: image hobject> <x_offset_bkg:unsigned integer> <y_offset_bkg:unsigned integer> - <foreground: image hobject> <x_offset_fgr:unsigned integer> <y_offset_fgr:unsigned integer> - <destination: image, pixmap. widget hobject> <x_offset_dest:unsigned integer> <y_offset_dest:unsigned integer> <width:unsigned integer> <height:unsigned integer> <blend_factor> - @description: - Blends two images <background> and <foreground> and copy the result to <destination> at the coordinates <x_offset>,<y_offset> with a <blend_factor> value .[br] - Destination must be a widget or pixmap.[br] - */ - -static bool objects_kvs_cmd_blend(KviKvsModuleCommandCall * c) -{ -/* KviKvsObject *obFor; - KviKvsObject *obBck; - KviKvsObject *obDest; - - kvs_int_t iBkX,iBkY; - kvs_int_t iFoX,iFoY; - kvs_int_t iDesX,iDesY,uW,uH; - 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("width",KVS_PT_UNSIGNEDINTEGER,0,uW) - KVSO_PARAMETER("height",KVS_PT_UNSIGNEDINTEGER,0,uH) - - KVSO_PARAMETER("blend_value",KVS_PT_REAL,0,dBlend) - - - - KVSO_PARAMETERS_END(c) - - obFor=KviKvsKernel::instance()->objectController()->lookupObject(hFo); - - - obBck=KviKvsKernel::instance()->objectController()->lookupObject(hBk); - obDest=KviKvsKernel::instance()->objectController()->lookupObject(hDest); - if (!obFor || !obBck || !obDest) - { - c->warning(__tr2qs_ctx("One or more of background, foreground or destination aren't objects","objects")); - return true; - } - - if (!obBck->inheritsClass("pixmap") || !obFor->inherits("KviKvsObject_pixmap")) - { - c->warning(__tr2qs_ctx("Pixmap objects required","objects")); - return true; - } - - QPaintDevice * pdDest = 0; - if(obDest->inheritsClass("pixmap")) pdDest = ((KviKvsObject_pixmap *)obDest)->getPixmap(); - else if (obDest->inheritsClass("widget")) pdDest=((KviKvsObject_widget *)obDest)->widget(); - - if (!pdDest) - { - c->warning(__tr2qs_ctx("Widget or Pixmap required ","objects")); - return true; - } - -// if(obDest->inheritsClass("pixmap")) ((KviKvsObject_pixmap *)obDest)->pixmapChanged(); - - - //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())) - { - c->warning(__tr2qs_ctx("Values for background are out of image size ","objects")); - return true; - } - if ((iFoX+uW>img_fore->width())||(iFoY+uH>img_fore->height())) - { - c->warning(__tr2qs_ctx("Values for foreground are out of image size ","objects")); - return true; - } - QImage buffer; - buffer = QImage(uW,uH,QImage::Format_ARGB32); - for(int y = 0;y < buffer.height();y++) - { - QRgb * dst = (QRgb *)buffer.scanLine(y); - QRgb * end = dst + buffer.width(); - QRgb * bkg = (QRgb *)img_back->scanLine(y+iBkY); - bkg += iBkX; - QRgb * fgn = (QRgb *)img_fore->scanLine(y+iFoY); - fgn += iFoX; - double dRemaining = 1.0 - dBlend; - - while(dst < end) - { - *dst = qRgba( - (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++; - bkg++; - fgn++; - } - } - QPainter p(pdDest); - QRect rect(iDesX,iDesY,buffer.width(),buffer.height()); - p.drawImage(rect,buffer); - */ - return true; - -} // ASSASSINS! YOU MUST INDENT IT WELL :D @@ -950,8 +742,6 @@ static bool objects_module_init(KviModule * m) KVSM_REGISTER_FUNCTION(m,"variables",objects_kvs_fnc_variables); // commands - KVSM_REGISTER_SIMPLE_COMMAND(m,"bitblt",objects_kvs_cmd_bitBlt); - KVSM_REGISTER_SIMPLE_COMMAND(m,"blend",objects_kvs_cmd_blend); KVSM_REGISTER_SIMPLE_COMMAND(m,"clearObjects",objects_kvs_cmd_clearObjects); KVSM_REGISTER_SIMPLE_COMMAND(m,"connect",objects_kvs_cmd_connect); KVSM_REGISTER_SIMPLE_COMMAND(m,"disconnect",objects_kvs_cmd_disconnect); |
