You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#include <tqimage.h>
|
|
|
|
#include <tqstring.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]);
|
|
|
|
|
|
|
|
TQImage *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 TQImage();
|
|
|
|
|
|
|
|
delete svgEngine;
|
|
|
|
|
|
|
|
img->save(argv[4], "PNG");
|
|
|
|
|
|
|
|
delete img;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|