summaryrefslogtreecommitdiffstats
path: root/kdeui/tests/kdesattest.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kdeui/tests/kdesattest.cpp
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdeui/tests/kdesattest.cpp')
-rw-r--r--kdeui/tests/kdesattest.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/kdeui/tests/kdesattest.cpp b/kdeui/tests/kdesattest.cpp
new file mode 100644
index 000000000..803e2e0ee
--- /dev/null
+++ b/kdeui/tests/kdesattest.cpp
@@ -0,0 +1,65 @@
+#include "kdesattest.h"
+#include <kapplication.h>
+#include <kimageeffect.h>
+#include <qpainter.h>
+#include <qdatetime.h>
+#include <qstring.h>
+
+int cols = 3, rows = 3; // how many
+
+KDesatWidget::KDesatWidget(QWidget *parent, const char *name)
+ :QWidget(parent, name)
+{
+
+ image = QImage("testimage.png");
+ slide = new KDoubleNumInput(700, this, "desat");
+ slide->setRange(0, 1, 0.001);
+ slide->setLabel("Desaturate: ", AlignVCenter | AlignLeft);
+ connect(slide,SIGNAL(valueChanged(double)), this, SLOT(change(double)));
+
+ resize(image.width()*2, image.height() + slide->height());
+ slide->setGeometry(0, image.height(), image.width()*2, slide->height());
+}
+
+void KDesatWidget::change(double) {
+ desat_value = slide->value();
+ repaint(false);
+}
+
+void KDesatWidget::paintEvent(QPaintEvent */*ev*/)
+{
+ QTime time;
+ int it, ft;
+ QString say;
+
+ QPainter p(this);
+ p.setPen(Qt::black);
+
+ // original image
+ time.start();
+ it = time.elapsed();
+ image = QImage("testimage.png");
+ p.drawImage(0, 0, image);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Vertical";
+ p.drawText(5 , 15, say);
+
+ // desaturated image
+ it = time.elapsed();
+ image = KImageEffect::desaturate(image, desat_value);
+ p.drawImage(image.width(), 0, image);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Horizontal";
+ p.drawText(15+image.width() , 15, say);
+}
+
+int main(int argc, char **argv)
+{
+ KApplication *app = new KApplication(argc, argv, "KDesatTest");
+ KDesatWidget w;
+ app->setMainWidget(&w);
+ w.show();
+ return(app->exec());
+}
+
+#include "kdesattest.moc"