aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Noldor2007-02-08 16:34:59 +0000
committerGravatar Noldor2007-02-08 16:34:59 +0000
commit48f192bfcb5f2e6b60139fd6e625305a22706c2a (patch)
treed3b8c6338cbb0a630b0156186828fc92c67bb08b /src
parentfixed window undocking under win32 (diff)
downloadKVIrc-48f192bfcb5f2e6b60139fd6e625305a22706c2a.tar.gz
KVIrc-48f192bfcb5f2e6b60139fd6e625305a22706c2a.tar.bz2
KVIrc-48f192bfcb5f2e6b60139fd6e625305a22706c2a.zip
wip on pixmap class
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@331 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
-rw-r--r--src/modules/objects/class_pixmap.cpp54
1 files changed, 50 insertions, 4 deletions
diff --git a/src/modules/objects/class_pixmap.cpp b/src/modules/objects/class_pixmap.cpp
index 6da8425dd..547f2c9e8 100644
--- a/src/modules/objects/class_pixmap.cpp
+++ b/src/modules/objects/class_pixmap.cpp
@@ -65,7 +65,7 @@ KVSO_BEGIN_REGISTERCLASS(KviKvsObject_pixmap,"pixmap","object")
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_REGISTER_HANDLER(KviKvsObject_pixmap,"setOpacity",functionsetOpacity)
KVSO_END_REGISTERCLASS(KviKvsObject_pixmap)
@@ -157,12 +157,20 @@ bool KviKvsObject_pixmap::functionsetOpacity(KviKvsObjectFunctionCall *c)
{
if(!m_pPixmap)return true;
kvs_real_t dOpacity;
+ kvs_uint_t uXoffset,uYoffset;
+ kvs_uint_t uWidth,uHeight;
+
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_PARAMETER("x_offset",KVS_PT_UNSIGNEDINTEGER,KVS_PF_OPTIONAL,uXoffset)
+ KVSO_PARAMETER("y_offset",KVS_PT_UNSIGNEDINTEGER,KVS_PF_OPTIONAL,uYoffset)
+ KVSO_PARAMETER("width",KVS_PT_UNSIGNEDINTEGER,KVS_PF_OPTIONAL,uWidth)
+ KVSO_PARAMETER("height",KVS_PT_UNSIGNEDINTEGER,KVS_PF_OPTIONAL,uHeight)
KVSO_PARAMETERS_END(c)
pObDest=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
@@ -182,13 +190,51 @@ bool KviKvsObject_pixmap::functionsetOpacity(KviKvsObjectFunctionCall *c)
if (bPixmapModified) {
*m_pImage=m_pPixmap->convertToImage();
}
+ if (uWidth>buffer->width() || uHeight>buffer->height())
+ {
+ c->warning(__tr2qs("Area dimensions are out of destination size "));
+ return true;
+ }
+ if (!uWidth){
+ if(m_pImage->width()>buffer->width())
+ {
+ c->warning(__tr2qs("Pixmap dimensions are out of destination size "));
+ return true;
+ }
+ }
+
+ if (!uHeight)
+ {
+ if(m_pImage->height()>buffer->height())
+ {
+ c->warning(__tr2qs("Pixmap dimensions are out of destination size "));
+ return true;
+ }
+ }
+
+
+if(uXoffset+uWidth>m_pImage->width())
+ {
+ c->warning(__tr2qs("Offset width area is out of pixmap size "));
+ return true;
+ }
+ if( uYoffset+uHeight>m_pImage->height())
+ {
+ c->warning(__tr2qs("Offset height area is out of pixmap size "));
+ return true;
+ }
+
buffer->setAlphaBuffer(true);
-
- for(int y = 0;y < m_pImage->height();y++)
+ int iHedge=uHeight?uHeight:m_pImage->height();
+ int iWedge=uWidth?uWidth:m_pImage->width();
+
+ for(int y = uYoffset;y<iHedge;y++)
{
QRgb * dst = (QRgb *)buffer->scanLine(y);
QRgb * src = (QRgb *)m_pImage->scanLine(y);
- QRgb * end = src + m_pImage->width();
+ src += uXoffset;
+ QRgb * end;
+ end = src + iWedge;
while(src < end)
{
*dst = qRgba(