Extend no background option to EPS

This commit is contained in:
Robin Stuart 2020-08-03 07:37:27 +01:00
parent 47cac63e7f
commit 382a051cb5
2 changed files with 21 additions and 9 deletions

View File

@ -112,6 +112,13 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) {
float radius; float radius;
int colour_index, colour_rect_counter; int colour_index, colour_rect_counter;
char ps_color[30]; char ps_color[30];
int draw_background = 1;
if (strlen(symbol->bgcolour) > 6) {
if ((ctoi(symbol->bgcolour[6]) == 0) && (ctoi(symbol->bgcolour[7]) == 0)) {
draw_background = 0;
}
}
struct zint_vector_rect *rect; struct zint_vector_rect *rect;
struct zint_vector_hexagon *hex; struct zint_vector_hexagon *hex;
@ -210,14 +217,19 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) {
fprintf(feps, "newpath\n"); fprintf(feps, "newpath\n");
/* Now the actual representation */ /* Now the actual representation */
//Background
if (draw_background) {
if ((symbol->output_options & CMYK_COLOUR) == 0) { if ((symbol->output_options & CMYK_COLOUR) == 0) {
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_paper, green_paper, blue_paper); fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_paper, green_paper, blue_paper);
} else { } else {
fprintf(feps, "%.2f %.2f %.2f %.2f setcmykcolor\n", cyan_paper, magenta_paper, yellow_paper, black_paper); fprintf(feps, "%.2f %.2f %.2f %.2f setcmykcolor\n", cyan_paper, magenta_paper, yellow_paper, black_paper);
} }
fprintf(feps, "%.2f 0.00 TB 0.00 %.2f TR\n", symbol->vector->height, symbol->vector->width);
fprintf(feps, "%.2f 0.00 TB 0.00 %.2f TR\n", symbol->vector->height, symbol->vector->width);
fprintf(feps, "TE\n"); fprintf(feps, "TE\n");
}
if (symbol->symbology != BARCODE_ULTRA) { if (symbol->symbology != BARCODE_ULTRA) {
if ((symbol->output_options & CMYK_COLOUR) == 0) { if ((symbol->output_options & CMYK_COLOUR) == 0) {
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink); fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);

View File

@ -419,7 +419,7 @@ will give different results for PNG and SVG. Experimentation is advised!
Also note that these options don't work properly with Maxicode yet. Also note that these options don't work properly with Maxicode yet.
In addition the --nobackground option will simply remove the background from In addition the --nobackground option will simply remove the background from
PNG, SVG and EMF files. PNG, SVG, EMF and EPS files.
4.8 Rotating the Symbol 4.8 Rotating the Symbol
----------------------- -----------------------
@ -926,8 +926,8 @@ int main(int argc, char **argv)
return 0; return 0;
} }
Background removal for PNG, SVG and EMF files can be achieved by setting the Background removal for PNG, SVG, EMF and EPS files can be achieved by setting
background alpha to "00" where the values for R, G and B will be ignored: the background alpha to "00" where the values for R, G and B will be ignored:
strcpy(my_symbol->bgcolour, "55555500"); strcpy(my_symbol->bgcolour, "55555500");