summaryrefslogtreecommitdiffstats
path: root/pics/ksvgtopng.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 /pics/ksvgtopng.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 'pics/ksvgtopng.cpp')
-rw-r--r--pics/ksvgtopng.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/pics/ksvgtopng.cpp b/pics/ksvgtopng.cpp
new file mode 100644
index 000000000..27f2545da
--- /dev/null
+++ b/pics/ksvgtopng.cpp
@@ -0,0 +1,59 @@
+#include <qimage.h>
+#include <qstring.h>
+
+#include <kimageeffect.h>
+
+#include <ksvgiconengine.h>
+#include <ksvgiconpainter.h>
+
+#include <iostream>
+
+using std::cout;
+using std::endl;
+
+int main(int argc, char **argv)
+{
+ if(argc < 5)
+ {
+ cout << "Usage : ksvgtopng width height svgfilename outputfilename" << endl;
+ cout << "Please use full path name for svgfilename" << endl;
+ return -1;
+ }
+
+ int width = atoi(argv[1]);
+ int height = atoi(argv[2]);
+
+ QImage *img = 0;
+
+ KSVGIconEngine *svgEngine = new KSVGIconEngine();
+
+ if(svgEngine->load(width, height, argv[3]))
+ {
+ img = svgEngine->painter()->image();
+/*
+ // Apply icon sharpening
+ double factor = 0;
+
+ if(width == 16)
+ factor = 30;
+ else if(width == 32)
+ factor = 20;
+ else if(width == 48)
+ factor = 10;
+ else if(width == 64)
+ factor = 5;
+
+ *img = KImageEffect::sharpen(*img, factor);
+*/
+ }
+ else
+ img = new QImage();
+
+ delete svgEngine;
+
+ img->save(argv[4], "PNG");
+
+ delete img;
+
+ return 0;
+}