mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Removed Ultracode formatting and added Codablock-F formatting.
This commit is contained in:
parent
8224d45c97
commit
c11a560730
92
backend/ps.c
92
backend/ps.c
@ -235,79 +235,7 @@ int ps_plot(struct zint_symbol *symbol)
|
||||
}
|
||||
}
|
||||
|
||||
if(symbol->symbology == BARCODE_ULTRA) {
|
||||
/* Ultracode uses a colour scheme all of its own! */
|
||||
int addon_latch = 0;
|
||||
|
||||
for(r = 0; r < symbol->rows; r++) {
|
||||
this_row = symbol->rows - r - 1; /* invert r otherwise plots upside down */
|
||||
if(symbol->row_height[this_row] == 0) {
|
||||
row_height = large_bar_height;
|
||||
} else {
|
||||
row_height = symbol->row_height[this_row];
|
||||
}
|
||||
row_posn = 0;
|
||||
for(i = 0; i < r; i++) {
|
||||
if(symbol->row_height[symbol->rows - i - 1] == 0) {
|
||||
row_posn += large_bar_height;
|
||||
} else {
|
||||
row_posn += symbol->row_height[symbol->rows - i - 1];
|
||||
}
|
||||
}
|
||||
row_posn += (textoffset + yoffset);
|
||||
|
||||
for(i = 0; i < symbol->width; i++) {
|
||||
switch(symbol->encoded_data[this_row][i]) {
|
||||
case '1':
|
||||
fprintf(feps, "TE\n");
|
||||
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
|
||||
fprintf(feps, "%.2f %.2f ", row_height, row_posn);
|
||||
fprintf(feps, "TB %d.00 %d.00 TR\n", i + xoffset, 1);
|
||||
break;
|
||||
case 'R':
|
||||
fprintf(feps, "TE\n");
|
||||
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", 1.00, 0.00, 0.00);
|
||||
fprintf(feps, "%.2f %.2f ", row_height, row_posn);
|
||||
fprintf(feps, "TB %d.00 %d.00 TR\n", i + xoffset, 1);
|
||||
break;
|
||||
case 'G':
|
||||
fprintf(feps, "TE\n");
|
||||
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", 0.00, 1.00, 0.00);
|
||||
fprintf(feps, "%.2f %.2f ", row_height, row_posn);
|
||||
fprintf(feps, "TB %d.00 %d.00 TR\n", i + xoffset, 1);
|
||||
break;
|
||||
case 'B':
|
||||
fprintf(feps, "TE\n");
|
||||
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", 0.00, 0.00, 1.00);
|
||||
fprintf(feps, "%.2f %.2f ", row_height, row_posn);
|
||||
fprintf(feps, "TB %d.00 %d.00 TR\n", i + xoffset, 1);
|
||||
break;
|
||||
case 'C':
|
||||
fprintf(feps, "TE\n");
|
||||
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", 0.00, 1.00, 1.00);
|
||||
fprintf(feps, "%.2f %.2f ", row_height, row_posn);
|
||||
fprintf(feps, "TB %d.00 %d.00 TR\n", i + xoffset, 1);
|
||||
break;
|
||||
case 'M':
|
||||
fprintf(feps, "TE\n");
|
||||
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", 1.00, 0.00, 1.00);
|
||||
fprintf(feps, "%.2f %.2f ", row_height, row_posn);
|
||||
fprintf(feps, "TB %d.00 %d.00 TR\n", i + xoffset, 1);
|
||||
break;
|
||||
case 'Y':
|
||||
fprintf(feps, "TE\n");
|
||||
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", 1.00, 1.00, 0.00);
|
||||
fprintf(feps, "%.2f %.2f ", row_height, row_posn);
|
||||
fprintf(feps, "TB %d.00 %d.00 TR\n", i + xoffset, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if((symbol->symbology != BARCODE_MAXICODE) && (symbol->symbology != BARCODE_ULTRA)) {
|
||||
if(symbol->symbology != BARCODE_MAXICODE) {
|
||||
/* everything else uses rectangles (or squares) */
|
||||
/* Works from the bottom of the symbol up */
|
||||
int addon_latch = 0;
|
||||
@ -739,6 +667,7 @@ int ps_plot(struct zint_symbol *symbol)
|
||||
|
||||
/* Put boundary bars or box around symbol */
|
||||
if ((symbol->output_options == BARCODE_BOX) || (symbol->output_options == BARCODE_BIND)) {
|
||||
if(symbol->symbology != BARCODE_CODABLOCKF) {
|
||||
/* boundary bars */
|
||||
fprintf(feps, "TE\n");
|
||||
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
|
||||
@ -754,6 +683,23 @@ int ps_plot(struct zint_symbol *symbol)
|
||||
fprintf(feps, "%d.00 %.2f TB %d.00 %d.00 TR\n", 2, ((r * row_height) + textoffset + yoffset - 1), xoffset, symbol->width);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* boundary bars */
|
||||
fprintf(feps, "TE\n");
|
||||
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
|
||||
fprintf(feps, "%d.00 %d.00 TB %d.00 %d.00 TR\n", symbol->border_width, textoffset, xoffset, symbol->width);
|
||||
fprintf(feps, "TE\n");
|
||||
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
|
||||
fprintf(feps, "%d.00 %d.00 TB %d.00 %d.00 TR\n", symbol->border_width, textoffset + symbol->height + symbol->border_width, xoffset, symbol->width);
|
||||
if(symbol->rows > 1) {
|
||||
/* row binding */
|
||||
for(r = 1; r < symbol->rows; r++) {
|
||||
fprintf(feps, "TE\n");
|
||||
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
|
||||
fprintf(feps, "%d.00 %.2f TB %d.00 %d.00 TR\n", 2, ((r * row_height) + textoffset + yoffset - 1), (xoffset + 11), (symbol->width - 24));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (symbol->output_options == BARCODE_BOX) {
|
||||
|
Loading…
Reference in New Issue
Block a user