From 90825e2392b2d70e43c7a25b8a3752299a933894 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kjsembed/docs/examples/imageviewer/imageviewer.js | 61 +++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 kjsembed/docs/examples/imageviewer/imageviewer.js (limited to 'kjsembed/docs/examples/imageviewer') diff --git a/kjsembed/docs/examples/imageviewer/imageviewer.js b/kjsembed/docs/examples/imageviewer/imageviewer.js new file mode 100644 index 00000000..f69d63c3 --- /dev/null +++ b/kjsembed/docs/examples/imageviewer/imageviewer.js @@ -0,0 +1,61 @@ +#!/usr/bin/env kjscmd + +// Applies a water color effect filter to the image +function apply_watercolor( img ) +{ + var imgfx = new ImageFX(); + img = imgfx.contrast(img, 200); + img = imgfx.despeckle(img); + img = imgfx.despeckle(img); + img = imgfx.despeckle(img); + img = imgfx.sharpen(img); + return img; +} + +if ( application.args.length == 0 ) { + throw 'Usage:\n\timageviewer imgfile ...'; +} +else { + var loc = application.args[0]; + var lbl = new QLabel(); + + var img = new Image(); + img.load( loc ); + if ( !img.isOk() ) { + throw 'Failed to load image ' + loc; + } + + println(img.isOk()); + img = apply_watercolor( img ); + + lbl.pixmap = img.pixmap(); + lbl.resize(img.width(), img.height()); + lbl.show(); + application.exec(); +} + +/* +int watercolor(imgdes *srcimg, imgdes *resimg) +{ + imgdes tmpsrc; + int cols, rows, rcode; + double gamma = 0.7; + + cols = CALC_WIDTH(srcimg); + rows = CALC_HEIGHT(srcimg); + + allocimage(&tmpsrc, cols, rows, srcimg->bmh->biBitCount); + copyimage(srcimg, &tmpsrc); + + gammabrighten(gamma, &tmpsrc, &tmpsrc); + removenoise(&tmpsrc, &tmpsrc); + removenoise(&tmpsrc, &tmpsrc); + removenoise(&tmpsrc, &tmpsrc); + sharpen(&tmpsrc, &tmpsrc); + + rcode = copyimage(&tmpsrc, resimg); + + freeimage(&tmpsrc); + + +*/ -- cgit v1.2.1