mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-12 22:25:59 -04:00
Merge branch Ultra
This commit is contained in:
commit
0d26948baa
16 changed files with 1671 additions and 192 deletions
191
backend/raster.c
191
backend/raster.c
|
@ -47,6 +47,9 @@
|
|||
|
||||
#define SSET "0123456789ABCDEF"
|
||||
|
||||
#define DEFAULT_INK '1'
|
||||
#define DEFAULT_PAPER '0'
|
||||
|
||||
#ifndef NO_PNG
|
||||
INTERNAL int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||
#endif /* NO_PNG */
|
||||
|
@ -55,6 +58,8 @@ INTERNAL int pcx_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);
|
||||
|
||||
static const char ultra_colour[] = "WCBMRYGK";
|
||||
|
||||
static void buffer_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
/* Place pixelbuffer into symbol */
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
|
@ -73,12 +78,52 @@ static void buffer_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||
for (column = 0; column < symbol->bitmap_width; column++) {
|
||||
i = ((row * symbol->bitmap_width) + column) * 3;
|
||||
switch (*(pixelbuf + (symbol->bitmap_width * row) + column)) {
|
||||
case '1':
|
||||
case 'W': // White
|
||||
symbol->bitmap[i] = 255;
|
||||
symbol->bitmap[i + 1] = 255;
|
||||
symbol->bitmap[i + 2] = 255;
|
||||
break;
|
||||
case 'C': // Cyan
|
||||
symbol->bitmap[i] = 0;
|
||||
symbol->bitmap[i + 1] = 255;
|
||||
symbol->bitmap[i + 2] = 255;
|
||||
break;
|
||||
case 'B': // Blue
|
||||
symbol->bitmap[i] = 0;
|
||||
symbol->bitmap[i + 1] = 0;
|
||||
symbol->bitmap[i + 2] = 255;
|
||||
break;
|
||||
case 'M': // Magenta
|
||||
symbol->bitmap[i] = 255;
|
||||
symbol->bitmap[i + 1] = 0;
|
||||
symbol->bitmap[i + 2] = 255;
|
||||
break;
|
||||
case 'R': // Red
|
||||
symbol->bitmap[i] = 255;
|
||||
symbol->bitmap[i + 1] = 0;
|
||||
symbol->bitmap[i + 2] = 0;
|
||||
break;
|
||||
case 'Y': // Yellow
|
||||
symbol->bitmap[i] = 255;
|
||||
symbol->bitmap[i + 1] = 255;
|
||||
symbol->bitmap[i + 2] = 0;
|
||||
break;
|
||||
case 'G': // Green
|
||||
symbol->bitmap[i] = 0;
|
||||
symbol->bitmap[i + 1] = 255;
|
||||
symbol->bitmap[i + 2] = 0;
|
||||
break;
|
||||
case 'K': // Black
|
||||
symbol->bitmap[i] = 0;
|
||||
symbol->bitmap[i + 1] = 0;
|
||||
symbol->bitmap[i + 2] = 0;
|
||||
break;
|
||||
case DEFAULT_INK:
|
||||
symbol->bitmap[i] = fgred;
|
||||
symbol->bitmap[i + 1] = fggrn;
|
||||
symbol->bitmap[i + 2] = fgblu;
|
||||
break;
|
||||
default:
|
||||
default: // DEFAULT_PAPER
|
||||
symbol->bitmap[i] = bgred;
|
||||
symbol->bitmap[i + 1] = bggrn;
|
||||
symbol->bitmap[i + 2] = bgblu;
|
||||
|
@ -207,7 +252,7 @@ static int save_raster_image_to_file(struct zint_symbol *symbol, int image_heigh
|
|||
return error_number;
|
||||
}
|
||||
|
||||
static void draw_bar(char *pixelbuf, int xpos, int xlen, int ypos, int ylen, int image_width, int image_height) {
|
||||
static void draw_bar(char *pixelbuf, int xpos, int xlen, int ypos, int ylen, int image_width, int image_height, char fill) {
|
||||
/* Draw a rectangle */
|
||||
int i, j, png_ypos;
|
||||
|
||||
|
@ -217,7 +262,7 @@ static void draw_bar(char *pixelbuf, int xpos, int xlen, int ypos, int ylen, int
|
|||
|
||||
for (i = (xpos); i < (xpos + xlen); i++) {
|
||||
for (j = (png_ypos); j < (png_ypos + ylen); j++) {
|
||||
*(pixelbuf + (image_width * j) + i) = '1';
|
||||
*(pixelbuf + (image_width * j) + i) = fill;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -246,13 +291,13 @@ static void draw_bullseye(char *pixelbuf, int image_width, int image_height, int
|
|||
x = 16.0 * scaler;
|
||||
y = 16.5 * scaler;
|
||||
}
|
||||
|
||||
draw_circle(pixelbuf, image_width, image_height, x + xoffset, y + yoffset, (4.571 * scaler) + 1, '1');
|
||||
draw_circle(pixelbuf, image_width, image_height, x + xoffset, y + yoffset, (3.779 * scaler) + 1, '0');
|
||||
draw_circle(pixelbuf, image_width, image_height, x + xoffset, y + yoffset, (2.988 * scaler) + 1, '1');
|
||||
draw_circle(pixelbuf, image_width, image_height, x + xoffset, y + yoffset, (2.196 * scaler) + 1, '0');
|
||||
draw_circle(pixelbuf, image_width, image_height, x + xoffset, y + yoffset, (1.394 * scaler) + 1, '1');
|
||||
draw_circle(pixelbuf, image_width, image_height, x + xoffset, y + yoffset, (0.602 * scaler) + 1, '0');
|
||||
|
||||
draw_circle(pixelbuf, image_width, image_height, x + xoffset, y + yoffset, (4.571 * scaler) + 1, DEFAULT_INK);
|
||||
draw_circle(pixelbuf, image_width, image_height, x + xoffset, y + yoffset, (3.779 * scaler) + 1, DEFAULT_PAPER);
|
||||
draw_circle(pixelbuf, image_width, image_height, x + xoffset, y + yoffset, (2.988 * scaler) + 1, DEFAULT_INK);
|
||||
draw_circle(pixelbuf, image_width, image_height, x + xoffset, y + yoffset, (2.196 * scaler) + 1, DEFAULT_PAPER);
|
||||
draw_circle(pixelbuf, image_width, image_height, x + xoffset, y + yoffset, (1.394 * scaler) + 1, DEFAULT_INK);
|
||||
draw_circle(pixelbuf, image_width, image_height, x + xoffset, y + yoffset, (0.602 * scaler) + 1, DEFAULT_PAPER);
|
||||
}
|
||||
|
||||
static void draw_hexagon(char *pixelbuf, int image_width, char *scaled_hexagon, int hexagon_size, int xposn, int yposn) {
|
||||
|
@ -261,8 +306,8 @@ static void draw_hexagon(char *pixelbuf, int image_width, char *scaled_hexagon,
|
|||
|
||||
for (i = 0; i < hexagon_size; i++) {
|
||||
for (j = 0; j < hexagon_size; j++) {
|
||||
if (scaled_hexagon[(i * hexagon_size) + j] == '1') {
|
||||
*(pixelbuf + (image_width * i) + (image_width * yposn) + xposn + j) = '1';
|
||||
if (scaled_hexagon[(i * hexagon_size) + j] == DEFAULT_INK) {
|
||||
*(pixelbuf + (image_width * i) + (image_width * yposn) + xposn + j) = DEFAULT_INK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -313,7 +358,7 @@ static void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int ypo
|
|||
for (y = 0; y < max_y; y++) {
|
||||
for (x = 0; x < max_x; x++) {
|
||||
if (small_font[(glyph_no * 9) + y] & (0x10 >> x)) {
|
||||
*(pixelbuf + (y * image_width) + (yposn * image_width) + xposn + x) = '1';
|
||||
*(pixelbuf + (y * image_width) + (yposn * image_width) + xposn + x) = DEFAULT_INK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -339,11 +384,11 @@ static void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int ypo
|
|||
int extra_dot = 0;
|
||||
for (x = 0; x < 7; x++) {
|
||||
if (ascii_font[(glyph_no * 14) + y] & (0x40 >> x)) {
|
||||
*pixelPtr = '1';
|
||||
*pixelPtr = DEFAULT_INK;
|
||||
extra_dot = 1;
|
||||
} else {
|
||||
if (extra_dot) {
|
||||
*pixelPtr = '1';
|
||||
*pixelPtr = DEFAULT_INK;
|
||||
}
|
||||
|
||||
extra_dot = 0;
|
||||
|
@ -353,7 +398,7 @@ static void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int ypo
|
|||
}
|
||||
|
||||
if (extra_dot) {
|
||||
*pixelPtr = '1';
|
||||
*pixelPtr = DEFAULT_INK;
|
||||
}
|
||||
|
||||
linePtr += image_width;
|
||||
|
@ -376,7 +421,7 @@ static void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int ypo
|
|||
for (y = 0; y < max_y; y++) {
|
||||
for (x = 0; x < 7; x++) {
|
||||
if (ascii_font[(glyph_no * 14) + y] & (0x40 >> x)) {
|
||||
*(pixelbuf + (y * image_width) + (yposn * image_width) + xposn + x) = '1';
|
||||
*(pixelbuf + (y * image_width) + (yposn * image_width) + xposn + x) = DEFAULT_INK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -424,7 +469,7 @@ static void plot_hexline(char *scaled_hexagon, int hexagon_size, float start_x,
|
|||
float this_x = start_x + ((float)i * inc_x);
|
||||
float this_y = start_y + ((float)i * inc_y);
|
||||
if (((this_x >= 0) && (this_x < hexagon_size)) && ((this_y >= 0) && (this_y < hexagon_size))) {
|
||||
scaled_hexagon[(hexagon_size * (int)this_y) + (int)this_x] = '1';
|
||||
scaled_hexagon[(hexagon_size * (int)this_y) + (int)this_x] = DEFAULT_INK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -468,17 +513,17 @@ static void plot_hexagon(char *scaled_hexagon, int hexagon_size) {
|
|||
|
||||
/* Fill hexagon */
|
||||
for (line = 0; line < hexagon_size; line++) {
|
||||
char ink = '0';
|
||||
char ink = DEFAULT_PAPER;
|
||||
for (i = 0; i < hexagon_size; i++) {
|
||||
if (scaled_hexagon[(hexagon_size * line) + i] == '1') {
|
||||
if (scaled_hexagon[(hexagon_size * line) + i] == DEFAULT_INK) {
|
||||
if (i < (hexagon_size / 2)) {
|
||||
ink = '1';
|
||||
ink = DEFAULT_INK;
|
||||
} else {
|
||||
ink = '0';
|
||||
ink = DEFAULT_PAPER;
|
||||
}
|
||||
}
|
||||
|
||||
if (ink == '1') {
|
||||
if (ink == DEFAULT_INK) {
|
||||
scaled_hexagon[(hexagon_size * line) + i] = ink;
|
||||
}
|
||||
}
|
||||
|
@ -506,7 +551,7 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, in
|
|||
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||
} else {
|
||||
for (i = 0; i < (image_width * image_height); i++) {
|
||||
*(pixelbuf + i) = '0';
|
||||
*(pixelbuf + i) = DEFAULT_PAPER;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -518,7 +563,7 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, in
|
|||
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||
} else {
|
||||
for (i = 0; i < (hexagon_size * hexagon_size); i++) {
|
||||
*(scaled_hexagon + i) = '0';
|
||||
*(scaled_hexagon + i) = DEFAULT_PAPER;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -548,14 +593,14 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, in
|
|||
|
||||
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
|
||||
/* boundary bars */
|
||||
draw_bar(pixelbuf, 0, image_width, 0, symbol->border_width * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, 0, image_width, 300 + (symbol->border_width * 2), symbol->border_width * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, 0, image_width, 0, symbol->border_width * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, 0, image_width, 300 + (symbol->border_width * 2), symbol->border_width * 2, image_width, image_height, DEFAULT_INK);
|
||||
}
|
||||
|
||||
if (symbol->output_options & BARCODE_BOX) {
|
||||
/* side bars */
|
||||
draw_bar(pixelbuf, 0, symbol->border_width * 2, 0, image_height, image_width, image_height);
|
||||
draw_bar(pixelbuf, 300 + ((symbol->border_width + symbol->whitespace_width + symbol->whitespace_width) * 2), symbol->border_width * 2, 0, image_height, image_width, image_height);
|
||||
draw_bar(pixelbuf, 0, symbol->border_width * 2, 0, image_height, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, 300 + ((symbol->border_width + symbol->whitespace_width + symbol->whitespace_width) * 2), symbol->border_width * 2, 0, image_height, image_width, image_height, DEFAULT_INK);
|
||||
}
|
||||
|
||||
error_number = save_raster_image_to_file(symbol, image_height, image_width, pixelbuf, rotate_angle, data_type);
|
||||
|
@ -630,7 +675,7 @@ static int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int d
|
|||
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||
} else {
|
||||
for (i = 0; i < (scale_width * scale_height); i++) {
|
||||
*(scaled_pixelbuf + i) = '0';
|
||||
*(scaled_pixelbuf + i) = DEFAULT_PAPER;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -642,7 +687,7 @@ static int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int d
|
|||
(int) ((i + xoffset) * scaler) + (scaler / 2.0),
|
||||
(int) ((r + yoffset) * scaler) + (scaler / 2.0),
|
||||
(symbol->dot_size / 2.0) * scaler,
|
||||
'1');
|
||||
DEFAULT_INK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -796,7 +841,7 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
|||
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||
} else {
|
||||
for (i = 0; i < (image_width * image_height); i++) {
|
||||
*(pixelbuf + i) = '0';
|
||||
*(pixelbuf + i) = DEFAULT_PAPER;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -815,6 +860,7 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
|||
int plot_yposn;
|
||||
int plot_height;
|
||||
int this_row = symbol->rows - r - 1; /* invert r otherwise plots upside down */
|
||||
int module_fill;
|
||||
row_posn += row_height;
|
||||
plot_yposn = next_yposn;
|
||||
if (symbol->row_height[this_row] == 0) {
|
||||
|
@ -826,30 +872,27 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
|||
plot_height = next_yposn - plot_yposn;
|
||||
|
||||
i = 0;
|
||||
if (module_is_set(symbol, this_row, 0)) {
|
||||
latch = 1;
|
||||
} else {
|
||||
latch = 0;
|
||||
}
|
||||
|
||||
do {
|
||||
module_fill = module_is_set(symbol, this_row, i);
|
||||
block_width = 0;
|
||||
do {
|
||||
block_width++;
|
||||
} while ((i + block_width < symbol->width) && module_is_set(symbol, this_row, i + block_width) == module_is_set(symbol, this_row, i));
|
||||
|
||||
if ((addon_latch == 0) && (r == 0) && (i > main_width)) {
|
||||
plot_height = (int) (row_height - 5.0);
|
||||
plot_yposn = (int) (row_posn - 5.0);
|
||||
addon_text_posn = row_posn + row_height - 8.0;
|
||||
addon_latch = 1;
|
||||
}
|
||||
if (latch == 1) {
|
||||
if (module_fill) {
|
||||
/* a bar */
|
||||
draw_bar(pixelbuf, (i + xoffset) * 2, block_width * 2, plot_yposn * 2, plot_height * 2, image_width, image_height);
|
||||
latch = 0;
|
||||
} else {
|
||||
/* a space */
|
||||
latch = 1;
|
||||
if (symbol->symbology == BARCODE_ULTRA) {
|
||||
draw_bar(pixelbuf, (i + xoffset) * 2, block_width * 2, plot_yposn * 2, plot_height * 2, image_width, image_height, ultra_colour[module_fill]);
|
||||
} else {
|
||||
draw_bar(pixelbuf, (i + xoffset) * 2, block_width * 2, plot_yposn * 2, plot_height * 2, image_width, image_height, DEFAULT_INK);
|
||||
}
|
||||
}
|
||||
i += block_width;
|
||||
|
||||
|
@ -865,12 +908,12 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
|||
case 8: /* EAN-8 */
|
||||
case 11:
|
||||
case 14:
|
||||
draw_bar(pixelbuf, (0 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (2 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (32 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (34 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (64 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (66 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (0 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (2 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (32 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (34 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (64 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (66 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
for (i = 0; i < 4; i++) {
|
||||
textpart[i] = local_text[i];
|
||||
}
|
||||
|
@ -900,12 +943,12 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
|||
case 13: /* EAN 13 */
|
||||
case 16:
|
||||
case 19:
|
||||
draw_bar(pixelbuf, (0 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (2 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (46 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (92 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (94 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (0 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (2 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (46 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (92 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (94 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
|
||||
textpart[0] = local_text[0];
|
||||
textpart[1] = '\0';
|
||||
|
@ -951,7 +994,7 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
|||
} while ((i + block_width < symbol->width) && module_is_set(symbol, symbol->rows - 1, i + block_width) == module_is_set(symbol, symbol->rows - 1, i));
|
||||
if (latch == 1) {
|
||||
/* a bar */
|
||||
draw_bar(pixelbuf, (i + xoffset - comp_offset) * 2, block_width * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (i + xoffset - comp_offset) * 2, block_width * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
latch = 0;
|
||||
} else {
|
||||
/* a space */
|
||||
|
@ -959,8 +1002,8 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
|||
}
|
||||
i += block_width;
|
||||
} while (i < 11 + comp_offset);
|
||||
draw_bar(pixelbuf, (46 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (46 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
latch = 1;
|
||||
i = 85 + comp_offset;
|
||||
do {
|
||||
|
@ -970,7 +1013,7 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
|||
} while ((i + block_width < symbol->width) && module_is_set(symbol, symbol->rows - 1, i + block_width) == module_is_set(symbol, symbol->rows - 1, i));
|
||||
if (latch == 1) {
|
||||
/* a bar */
|
||||
draw_bar(pixelbuf, (i + xoffset - comp_offset) * 2, block_width * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (i + xoffset - comp_offset) * 2, block_width * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
latch = 0;
|
||||
} else {
|
||||
/* a space */
|
||||
|
@ -1013,11 +1056,11 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
|||
} else if ((symbol->symbology == BARCODE_UPCE) || (symbol->symbology == BARCODE_UPCE_CHK)
|
||||
|| (symbol->symbology == BARCODE_UPCE_CC)) {
|
||||
/* guard bar extensions and text formatting for UPCE */
|
||||
draw_bar(pixelbuf, (0 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (2 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (46 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (50 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (0 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (2 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (46 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (50 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||
|
||||
textpart[0] = local_text[0];
|
||||
textpart[1] = '\0';
|
||||
|
@ -1053,23 +1096,23 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
|||
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
|
||||
/* boundary bars */
|
||||
if (symbol->symbology != BARCODE_CODABLOCKF) {
|
||||
draw_bar(pixelbuf, 0, (symbol->width + xoffset + xoffset) * 2, textoffset * 2, symbol->border_width * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, 0, (symbol->width + xoffset + xoffset) * 2, (textoffset + symbol->height + symbol->border_width) * 2, symbol->border_width * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, 0, (symbol->width + xoffset + xoffset) * 2, textoffset * 2, symbol->border_width * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, 0, (symbol->width + xoffset + xoffset) * 2, (textoffset + symbol->height + symbol->border_width) * 2, symbol->border_width * 2, image_width, image_height, DEFAULT_INK);
|
||||
} else {
|
||||
draw_bar(pixelbuf, xoffset * 2, symbol->width * 2, textoffset * 2, symbol->border_width * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, xoffset * 2, symbol->width * 2, (textoffset + symbol->height + symbol->border_width) * 2, symbol->border_width * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, xoffset * 2, symbol->width * 2, textoffset * 2, symbol->border_width * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, xoffset * 2, symbol->width * 2, (textoffset + symbol->height + symbol->border_width) * 2, symbol->border_width * 2, image_width, image_height, DEFAULT_INK);
|
||||
}
|
||||
if ((symbol->output_options & BARCODE_BIND) != 0) {
|
||||
if ((symbol->rows > 1) && (is_stackable(symbol->symbology) == 1)) {
|
||||
/* row binding */
|
||||
if (symbol->symbology != BARCODE_CODABLOCKF) {
|
||||
for (r = 1; r < symbol->rows; r++) {
|
||||
draw_bar(pixelbuf, xoffset * 2, symbol->width * 2, ((r * row_height) + textoffset + yoffset - 1) * 2, 2 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, xoffset * 2, symbol->width * 2, ((r * row_height) + textoffset + yoffset - 1) * 2, 2 * 2, image_width, image_height, DEFAULT_INK);
|
||||
}
|
||||
} else {
|
||||
for (r = 1; r < symbol->rows; r++) {
|
||||
/* Avoid 11-module start and stop chars */
|
||||
draw_bar(pixelbuf, (xoffset + 11) * 2 , (symbol->width - 22) * 2, ((r * row_height) + textoffset + yoffset - 1) * 2, 2 * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (xoffset + 11) * 2 , (symbol->width - 22) * 2, ((r * row_height) + textoffset + yoffset - 1) * 2, 2 * 2, image_width, image_height, DEFAULT_INK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1078,8 +1121,8 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
|||
|
||||
if (symbol->output_options & BARCODE_BOX) {
|
||||
/* side bars */
|
||||
draw_bar(pixelbuf, 0, symbol->border_width * 2, textoffset * 2, (symbol->height + (2 * symbol->border_width)) * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, (symbol->width + xoffset + xoffset - symbol->border_width) * 2, symbol->border_width * 2, textoffset * 2, (symbol->height + (2 * symbol->border_width)) * 2, image_width, image_height);
|
||||
draw_bar(pixelbuf, 0, symbol->border_width * 2, textoffset * 2, (symbol->height + (2 * symbol->border_width)) * 2, image_width, image_height, DEFAULT_INK);
|
||||
draw_bar(pixelbuf, (symbol->width + xoffset + xoffset - symbol->border_width) * 2, symbol->border_width * 2, textoffset * 2, (symbol->height + (2 * symbol->border_width)) * 2, image_width, image_height, DEFAULT_INK);
|
||||
}
|
||||
|
||||
/* Put the human readable text at the bottom */
|
||||
|
@ -1102,7 +1145,7 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
|||
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||
} else {
|
||||
for (i = 0; i < (scale_width * scale_height); i++) {
|
||||
*(scaled_pixelbuf + i) = '0';
|
||||
*(scaled_pixelbuf + i) = DEFAULT_PAPER;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue