diff --git a/src/ptouch-print.c b/src/ptouch-print.c index f07d3f7..d0f1940 100644 --- a/src/ptouch-print.c +++ b/src/ptouch-print.c @@ -339,6 +339,21 @@ gdImage *img_cutmark(int tape_width) return out; } +gdImage *img_padding(int tape_width, int length) +{ + gdImage *out=NULL; + + if ((length < 1) || (length > 256)) { + length=1; + } + out=gdImageCreatePalette(length, tape_width); + if (out == NULL) { + return NULL; + } + gdImageColorAllocate(out, 255, 255, 255); + return out; +} + void usage(char *progname) { printf("usage: %s [options] \n", progname); @@ -353,6 +368,7 @@ void usage(char *progname) printf("\t\t\t\tIf the text contains spaces, use quotation marks\n\t\t\t\taround it.\n"); printf("\t--cutmark\t\tPrint a mark where the tape should be cut\n"); printf("\t--fontsize\t\tManually set fontsize\n"); + printf("\t--pad \t\tAdd n pixels padding (blank tape)\n"); exit(1); } @@ -395,6 +411,12 @@ int parse_args(int argc, char **argv) } else { usage(argv[0]); } + } else if (strcmp(&argv[i][1], "-pad") == 0) { + if (i+1= argc) || (argv[i+1][0] == '-')) { @@ -495,6 +517,12 @@ int main(int argc, char *argv[]) out=img_append(out, im); gdImageDestroy(im); im = NULL; + } else if (strcmp(&argv[i][1], "-pad") == 0) { + int length=strtol(argv[++i], NULL, 10); + im=img_padding(tape_width, length); + out=img_append(out, im); + gdImageDestroy(im); + im = NULL; } else if (strcmp(&argv[i][1], "-debug") == 0) { debug = true; } else {