summaryrefslogtreecommitdiffstats
path: root/kjsembed/docs/examples/imageviewer
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
commit90825e2392b2d70e43c7a25b8a3752299a933894 (patch)
treee33aa27f02b74604afbfd0ea4f1cfca8833d882a /kjsembed/docs/examples/imageviewer
downloadtdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz
tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.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/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kjsembed/docs/examples/imageviewer')
-rw-r--r--kjsembed/docs/examples/imageviewer/imageviewer.js61
1 files changed, 61 insertions, 0 deletions
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);
+
+
+*/