1 /* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar)
3 * This program is free software. It comes without any warranty, to
4 * the extent permitted by applicable law. You can redistribute it
5 * and/or modify it under the terms of the Do What The Fuck You Want
6 * To Public License, Version 2, as published by Sam Hocevar. See
7 * http://sam.zoy.org/wtfpl/COPYING for more details.
14 #include <QApplication>
15 #include <QStringList>
17 #include <QTextStream>
26 ///////////////////////////////////////////////////////////////////////////////
27 int main (int argc
, char *argv
[]) {
28 QTextCodec::setCodecForCStrings(QTextCodec::codecForName("koi8-r"));
29 QTextCodec::setCodecForLocale(QTextCodec::codecForName("koi8-r"));
31 QApplication
app(argc
, argv
);
33 QStringList
args(QCoreApplication::arguments());
34 if (args
.size() < 2) {
35 fprintf(stderr
, "usage: %s infile [outdir]\n", argv
[0]);
39 XCursorImages
*il
= new XCursorImagesXCur(args
.at(1));
40 qDebug() << il
->count() << "cursors found";
43 if (args
.size() > 2) dirS
= args
.at(2);
44 if (!dirS
.isEmpty() && !dirS
.endsWith('/')) dirS
+= '/';
51 for (int f
= 0; f
< il
->count(); ++f
) {
52 const XCursorImage
*img
= il
->at(f
);
53 qDebug() << img
->name();
54 img
->image().save(dirS
+img
->name()+".png");
56 // now dump the script
58 QFile
fl(dirS
+il
->name()+".xcg");
59 if (fl
.open(QIODevice::WriteOnly
)) {
61 stream
.setDevice(&fl
);
62 stream
.setCodec("UTF-8");
63 stream
<< "; nothing xhot yhot pic delay\n";
64 for (int f
= 0; f
< il
->count(); ++f
) {
65 const XCursorImage
*img
= il
->at(f
);
66 stream
<< "1 " << img
->xhot() << " " << img
->yhot() << " "+img
->name()+".png" << " " << img
->delay() << "\n";
70 //1 1 1 center_ptr_0.png 50