esvg/tools/converter.cpp

48 lines
1.2 KiB
C++
Raw Normal View History

/** @file
2015-12-30 21:15:06 +01:00
* @author Edouard DUPIN
*
* @copyright 2014, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#include <test-debug/debug.h>
#include <vector>
#include <etk/etk.h>
#include <esvg/esvg.h>
static void usage() {
TEST_PRINT(etk::getApplicationName() << " - help : ");
TEST_PRINT(" " << etk::getApplicationName() << " [options]");
TEST_PRINT(" --file=xxx convert file in the same file.bmp");
2016-01-19 21:47:12 +01:00
TEST_PRINT(" --visual Enable visual display for debugging the lib");
2015-12-30 21:15:06 +01:00
exit(-1);
}
int main(int _argc, const char *_argv[]) {
etk::init(_argc, _argv);
std::string inputFile;
2016-01-19 21:47:12 +01:00
bool visualTest = false;
2015-12-30 21:15:06 +01:00
for (int32_t iii=0; iii<_argc ; ++iii) {
std::string data = _argv[iii];
if (etk::start_with(data, "--file=") == true) {
inputFile = std::string(&data[7]);
TEST_PRINT("file='" << inputFile << "'");
2016-01-19 21:47:12 +01:00
} else if (data == "--visual") {
visualTest = true;
TEST_PRINT("Set visual debug");
2015-12-30 21:15:06 +01:00
} else if ( data == "-h"
|| data == "--help") {
usage();
}
}
if (inputFile == "") {
TEST_ERROR("Missing '--file' option");
usage();
}
esvg::Document doc;
doc.load(inputFile);
2016-01-19 21:47:12 +01:00
doc.generateAnImage(ivec2(512, 512), inputFile + ".bmp", visualTest);
2015-12-30 21:15:06 +01:00
}