Allow rendering (or omitting) scales at every image edge

This commit is contained in:
sfan5
2016-11-18 22:01:15 +01:00
parent 89ed5494cc
commit 77fdcd15fb
5 changed files with 101 additions and 32 deletions

View File

@ -1,4 +1,5 @@
#include <cstdlib>
#include <cstring>
#include <getopt.h>
#include <fstream>
#include <iostream>
@ -29,6 +30,7 @@ void usage()
" --geometry x:y+w+h\n"
" --zoom <zoomlevel>\n"
" --colors <colors.txt>\n"
" --scales [t][b][l][r]\n"
"Color format: '#000000'\n";
std::cout << usage_text;
}
@ -82,6 +84,7 @@ int main(int argc, char *argv[])
{"max-y", required_argument, 0, 'c'},
{"zoom", required_argument, 0, 'z'},
{"colors", required_argument, 0, 'C'},
{"scales", required_argument, 0, 'f'},
{0, 0, 0, 0}
};
@ -171,6 +174,19 @@ int main(int argc, char *argv[])
generator.setGeometry(x, y, w, h);
}
break;
case 'f': {
uint flags = 0;
if(strchr(optarg, 't') != NULL)
flags |= SCALE_TOP;
if(strchr(optarg, 'b') != NULL)
flags |= SCALE_BOTTOM;
if(strchr(optarg, 'l') != NULL)
flags |= SCALE_LEFT;
if(strchr(optarg, 'r') != NULL)
flags |= SCALE_RIGHT;
generator.setScales(flags);
}
break;
case 'z': {
std::istringstream iss;
iss.str(optarg);