Add dot mode (experimental)

First step towards solution for ticket #29
This commit is contained in:
Robin Stuart 2016-07-12 15:00:25 +01:00
parent 9011a96134
commit e39d2ff915
3 changed files with 44 additions and 29 deletions

View File

@ -307,6 +307,15 @@ int svg_plot(struct zint_symbol *symbol) {
} }
row_posn += yoffset; row_posn += yoffset;
if ((symbol->output_options & BARCODE_DOTTY_MODE) != 0) {
/* Use (currently undocumented) dot mode - see SF ticket #29 */
for (i = 0; i < symbol->width; i++) {
if (module_is_set(symbol, this_row, i)) {
fprintf(fsvg, " <circle cx=\"%.2f\" cy=\"%.2f\" r=\"%.2f\" fill=\"#%s\" />\n", ((i + xoffset) * scaler) + (scaler / 2.0), (row_posn * scaler) + (scaler / 2.0), (2.0 / 5.0) * scaler, symbol->fgcolour);
}
}
} else {
/* Normal mode, with rectangles */
i = 0; i = 0;
if (module_is_set(symbol, this_row, 0)) { if (module_is_set(symbol, this_row, 0)) {
latch = 1; latch = 1;
@ -340,6 +349,7 @@ int svg_plot(struct zint_symbol *symbol) {
} while (i < symbol->width); } while (i < symbol->width);
} }
} }
}
/* That's done the actual data area, everything else is human-friendly */ /* That's done the actual data area, everything else is human-friendly */
xoffset += comp_offset; xoffset += comp_offset;

View File

@ -200,6 +200,7 @@ extern "C" {
#define SMALL_TEXT 32 #define SMALL_TEXT 32
#define BOLD_TEXT 64 #define BOLD_TEXT 64
#define CMYK_COLOUR 128 #define CMYK_COLOUR 128
#define BARCODE_DOTTY_MODE 256
#define DATA_MODE 0 #define DATA_MODE 0
#define UNICODE_MODE 1 #define UNICODE_MODE 1

View File

@ -476,6 +476,7 @@ int main(int argc, char **argv) {
{"mirror", 0, 0, 0}, {"mirror", 0, 0, 0},
{"mirroreps", 0, 0, 0}, {"mirroreps", 0, 0, 0},
{"mirrorsvg", 0, 0, 0}, {"mirrorsvg", 0, 0, 0},
{"dotty", 0, 0, 0},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
c = getopt_long(argc, argv, "htb:w:d:o:i:rcmp", long_options, &option_index); c = getopt_long(argc, argv, "htb:w:d:o:i:rcmp", long_options, &option_index);
@ -501,6 +502,9 @@ int main(int argc, char **argv) {
if (!strcmp(long_options[option_index].name, "cmyk")) { if (!strcmp(long_options[option_index].name, "cmyk")) {
my_symbol->output_options += CMYK_COLOUR; my_symbol->output_options += CMYK_COLOUR;
} }
if (!strcmp(long_options[option_index].name, "dotty")) {
my_symbol->output_options += BARCODE_DOTTY_MODE;
}
if (!strcmp(long_options[option_index].name, "directeps")) { if (!strcmp(long_options[option_index].name, "directeps")) {
my_symbol->output_options += BARCODE_STDOUT; my_symbol->output_options += BARCODE_STDOUT;
strncpy(my_symbol->outfile, "dummy.eps", 10); strncpy(my_symbol->outfile, "dummy.eps", 10);