diff options
author | Timothy Pearson <[email protected]> | 2011-11-06 15:56:40 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2011-11-06 15:56:40 -0600 |
commit | e16866e072f94410321d70daedbcb855ea878cac (patch) | |
tree | ee3f52eabde7da1a0e6ca845fb9c2813cf1558cf /tdeui/tests/kdesattest.cpp | |
parent | a58c20c1a7593631a1b50213c805507ebc16adaf (diff) | |
download | tdelibs-e16866e072f94410321d70daedbcb855ea878cac.tar.gz tdelibs-e16866e072f94410321d70daedbcb855ea878cac.zip |
Actually move the kde files that were renamed in the last commit
Diffstat (limited to 'tdeui/tests/kdesattest.cpp')
-rw-r--r-- | tdeui/tests/kdesattest.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/tdeui/tests/kdesattest.cpp b/tdeui/tests/kdesattest.cpp new file mode 100644 index 000000000..e75b320a7 --- /dev/null +++ b/tdeui/tests/kdesattest.cpp @@ -0,0 +1,65 @@ +#include "kdesattest.h" +#include <kapplication.h> +#include <kimageeffect.h> +#include <tqpainter.h> +#include <tqdatetime.h> +#include <tqstring.h> + +int cols = 3, rows = 3; // how many + +KDesatWidget::KDesatWidget(TQWidget *parent, const char *name) + :TQWidget(parent, name) +{ + + image = TQImage("testimage.png"); + slide = new KDoubleNumInput(700, this, "desat"); + slide->setRange(0, 1, 0.001); + slide->setLabel("Desaturate: ", AlignVCenter | AlignLeft); + connect(slide,TQT_SIGNAL(valueChanged(double)), this, TQT_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(); + tqrepaint(false); +} + +void KDesatWidget::paintEvent(TQPaintEvent */*ev*/) +{ + TQTime time; + int it, ft; + TQString say; + + TQPainter p(this); + p.setPen(Qt::black); + + // original image + time.start(); + it = time.elapsed(); + image = TQImage("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" |