Force white squares (not same as bgcolour) in Ultracode

This commit is contained in:
Robin Stuart 2020-08-12 12:19:26 +01:00
parent 2153ed416c
commit 20f767c4b6
6 changed files with 22 additions and 19 deletions

View File

@ -46,7 +46,7 @@ int colour_to_red(int colour) {
int return_val = 0; int return_val = 0;
switch(colour) { switch(colour) {
case 0: // White case 8: // White
case 3: // Magenta case 3: // Magenta
case 4: // Red case 4: // Red
case 5: // Yellow case 5: // Yellow
@ -61,7 +61,7 @@ int colour_to_green(int colour) {
int return_val = 0; int return_val = 0;
switch(colour) { switch(colour) {
case 0: // White case 8: // White
case 1: // Cyan case 1: // Cyan
case 5: // Yellow case 5: // Yellow
case 6: // Green case 6: // Green
@ -76,7 +76,7 @@ int colour_to_blue(int colour) {
int return_val = 0; int return_val = 0;
switch(colour) { switch(colour) {
case 0: // White case 8: // White
case 1: // Cyan case 1: // Cyan
case 2: // Blue case 2: // Blue
case 3: // Magenta case 3: // Magenta
@ -617,15 +617,18 @@ INTERNAL int emf_plot(struct zint_symbol *symbol) {
} }
if (symbol->symbology == BARCODE_ULTRA) { if (symbol->symbology == BARCODE_ULTRA) {
printf("Using Ultra draw\n");
for(i = 0; i < 8; i++) { for(i = 0; i < 8; i++) {
if (rectangle_count_bycolour[i]) { if (rectangle_count_bycolour[i]) {
fwrite(&emr_selectobject_colour[i], sizeof (emr_selectobject_t), 1, emf_file); fwrite(&emr_selectobject_colour[i], sizeof (emr_selectobject_t), 1, emf_file);
printf("colour %d\n", i);
rect = symbol->vector->rectangles; rect = symbol->vector->rectangles;
this_rectangle = 0; this_rectangle = 0;
while (rect) { while (rect) {
if (rect->colour == i) { if (rect->colour == i) {
fwrite(&rectangle[this_rectangle], sizeof (emr_rectangle_t), 1, emf_file); fwrite(&rectangle[this_rectangle], sizeof (emr_rectangle_t), 1, emf_file);
printf("rect\n");
} }
this_rectangle++; this_rectangle++;
rect = rect->next; rect = rect->next;

View File

@ -43,9 +43,6 @@ void colour_to_pscolor(int option, int colour, char* output) {
if ((option & CMYK_COLOUR) == 0) { if ((option & CMYK_COLOUR) == 0) {
// Use RGB colour space // Use RGB colour space
switch(colour) { switch(colour) {
case 0: // White
strcat(output, "1.00 1.00 1.00");
break;
case 1: // Cyan case 1: // Cyan
strcat(output, "0.00 1.00 1.00"); strcat(output, "0.00 1.00 1.00");
break; break;
@ -64,6 +61,9 @@ void colour_to_pscolor(int option, int colour, char* output) {
case 6: // Green case 6: // Green
strcat(output, "0.00 1.00 0.00"); strcat(output, "0.00 1.00 0.00");
break; break;
case 8: // White
strcat(output, "1.00 1.00 1.00");
break;
default: // Black default: // Black
strcat(output, "0.00 0.00 0.00"); strcat(output, "0.00 0.00 0.00");
break; break;
@ -72,9 +72,6 @@ void colour_to_pscolor(int option, int colour, char* output) {
} else { } else {
// Use CMYK colour space // Use CMYK colour space
switch(colour) { switch(colour) {
case 0: // White
strcat(output, "0.00 0.00 0.00 0.00");
break;
case 1: // Cyan case 1: // Cyan
strcat(output, "1.00 0.00 0.00 0.00"); strcat(output, "1.00 0.00 0.00 0.00");
break; break;
@ -93,6 +90,9 @@ void colour_to_pscolor(int option, int colour, char* output) {
case 6: // Green case 6: // Green
strcat(output, "1.00 0.00 1.00 0.00"); strcat(output, "1.00 0.00 1.00 0.00");
break; break;
case 8: // White
strcat(output, "0.00 0.00 0.00 0.00");
break;
default: // Black default: // Black
strcat(output, "0.00 0.00 0.00 1.00"); strcat(output, "0.00 0.00 0.00 1.00");
break; break;
@ -239,7 +239,7 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) {
// Rectangles // Rectangles
if (symbol->symbology == BARCODE_ULTRA) { if (symbol->symbology == BARCODE_ULTRA) {
for (colour_index = 0; colour_index <= 7; colour_index++) { for (colour_index = 0; colour_index <= 8; colour_index++) {
colour_rect_counter = 0; colour_rect_counter = 0;
rect = symbol->vector->rectangles; rect = symbol->vector->rectangles;
while (rect) { while (rect) {

View File

@ -57,7 +57,7 @@ INTERNAL int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf); INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf); INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
static const char ultra_colour[] = "WCBMRYGK"; static const char ultra_colour[] = "0CBMRYGKW";
static int buffer_plot(struct zint_symbol *symbol, char *pixelbuf) { static int buffer_plot(struct zint_symbol *symbol, char *pixelbuf) {
/* Place pixelbuffer into symbol */ /* Place pixelbuffer into symbol */

View File

@ -43,9 +43,6 @@
void pick_colour(int colour, char colour_code[]) { void pick_colour(int colour, char colour_code[]) {
switch(colour) { switch(colour) {
case 0: // White
strcpy(colour_code, "ffffff");
break;
case 1: // Cyan case 1: // Cyan
strcpy(colour_code, "00ffff"); strcpy(colour_code, "00ffff");
break; break;
@ -64,6 +61,9 @@ void pick_colour(int colour, char colour_code[]) {
case 6: // Green case 6: // Green
strcpy(colour_code, "00ff00"); strcpy(colour_code, "00ff00");
break; break;
case 8: // White
strcpy(colour_code, "ffffff");
break;
default: // Black default: // Black
strcpy(colour_code, "000000"); strcpy(colour_code, "000000");
break; break;

View File

@ -55,7 +55,7 @@ static const char ultra_c43_set1[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 .,%";
static const char ultra_c43_set2[] = "abcdefghijklmnopqrstuvwxyz:/?#[]@=_~!.,-"; static const char ultra_c43_set2[] = "abcdefghijklmnopqrstuvwxyz:/?#[]@=_~!.,-";
static const char ultra_c43_set3[] = "{}`()\"+'<>|$;&\\^*"; static const char ultra_c43_set3[] = "{}`()\"+'<>|$;&\\^*";
static const char ultra_digit[] = "0123456789,/"; static const char ultra_digit[] = "0123456789,/";
static const char ultra_colour[] = "WCBMRYGK"; static const char ultra_colour[] = "0CBMRYGKW";
//static const int ultra_maxsize[] = {34, 78, 158, 282}; // According to Table 1 //static const int ultra_maxsize[] = {34, 78, 158, 282}; // According to Table 1
static const int ultra_maxsize[] = {34, 81, 158, 282}; // Adjusted to allow 79-81 codeword range in 3-row symbols (only 1 secondary vertical clock track, not 2, so 3 extra) static const int ultra_maxsize[] = {34, 81, 158, 282}; // Adjusted to allow 79-81 codeword range in 3-row symbols (only 1 secondary vertical clock track, not 2, so 3 extra)

View File

@ -345,9 +345,6 @@ namespace Zint {
painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(m_fgColor)); painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(m_fgColor));
} else { } else {
switch(rect->colour) { switch(rect->colour) {
case 0: // White
painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::white));
break;
case 1: // Cyan case 1: // Cyan
painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::cyan)); painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::cyan));
break; break;
@ -366,6 +363,9 @@ namespace Zint {
case 6: // Green case 6: // Green
painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::green)); painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::green));
break; break;
case 8: // White
painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::white));
break;
default: default:
painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::black)); painter.fillRect(rect->x, rect->y, rect->width, rect->height, QBrush(Qt::black));
break; break;