mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Ultra: Extend colour support to PNG PCX BMP and TIF
Implementation needs improvement, but colour output is now achieved in most formats
This commit is contained in:
parent
6181885e2e
commit
5861ad3c3b
@ -73,6 +73,46 @@ int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
for (column = 0; column < symbol->bitmap_width; column++) {
|
for (column = 0; column < symbol->bitmap_width; column++) {
|
||||||
i = (3 * column) + (row * row_size);
|
i = (3 * column) + (row * row_size);
|
||||||
switch (*(pixelbuf + (symbol->bitmap_width * (symbol->bitmap_height - row - 1)) + column)) {
|
switch (*(pixelbuf + (symbol->bitmap_width * (symbol->bitmap_height - row - 1)) + column)) {
|
||||||
|
case 'W': // White
|
||||||
|
bitmap[i] = 255;
|
||||||
|
bitmap[i + 1] = 255;
|
||||||
|
bitmap[i + 2] = 255;
|
||||||
|
break;
|
||||||
|
case 'C': // Cyan
|
||||||
|
bitmap[i] = 255;
|
||||||
|
bitmap[i + 1] = 255;
|
||||||
|
bitmap[i + 2] = 0;
|
||||||
|
break;
|
||||||
|
case 'B': // Blue
|
||||||
|
bitmap[i] = 255;
|
||||||
|
bitmap[i + 1] = 0;
|
||||||
|
bitmap[i + 2] = 0;
|
||||||
|
break;
|
||||||
|
case 'M': // Magenta
|
||||||
|
bitmap[i] = 255;
|
||||||
|
bitmap[i + 1] = 0;
|
||||||
|
bitmap[i + 2] = 255;
|
||||||
|
break;
|
||||||
|
case 'R': // Red
|
||||||
|
bitmap[i] = 0;
|
||||||
|
bitmap[i + 1] = 0;
|
||||||
|
bitmap[i + 2] = 255;
|
||||||
|
break;
|
||||||
|
case 'Y': // Yellow
|
||||||
|
bitmap[i] = 0;
|
||||||
|
bitmap[i + 1] = 255;
|
||||||
|
bitmap[i + 2] = 255;
|
||||||
|
break;
|
||||||
|
case 'G': // Green
|
||||||
|
bitmap[i] = 0;
|
||||||
|
bitmap[i + 1] = 255;
|
||||||
|
bitmap[i + 2] = 0;
|
||||||
|
break;
|
||||||
|
case 'K': // Black
|
||||||
|
bitmap[i] = 0;
|
||||||
|
bitmap[i + 1] = 0;
|
||||||
|
bitmap[i + 2] = 0;
|
||||||
|
break;
|
||||||
case '1':
|
case '1':
|
||||||
bitmap[i] = fgblu;
|
bitmap[i] = fgblu;
|
||||||
bitmap[i + 1] = fggrn;
|
bitmap[i + 1] = fggrn;
|
||||||
|
@ -123,24 +123,69 @@ int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
for (column = 0; column < symbol->bitmap_width; column++) {
|
for (column = 0; column < symbol->bitmap_width; column++) {
|
||||||
switch (colour) {
|
switch (colour) {
|
||||||
case 0:
|
case 0:
|
||||||
if (pixelbuf[(row * symbol->bitmap_width) + column] == '1') {
|
switch(pixelbuf[(row * symbol->bitmap_width) + column]) {
|
||||||
rle_row[column] = fgred;
|
case 'W': // White
|
||||||
} else {
|
case 'M': // Magenta
|
||||||
rle_row[column] = bgred;
|
case 'R': // Red
|
||||||
|
case 'Y': // Yellow
|
||||||
|
rle_row[column] = 255;
|
||||||
|
break;
|
||||||
|
case 'C': // Cyan
|
||||||
|
case 'B': // Blue
|
||||||
|
case 'G': // Green
|
||||||
|
case 'K': // Black
|
||||||
|
rle_row[column] = 0;
|
||||||
|
break;
|
||||||
|
case '1':
|
||||||
|
rle_row[column] = fgred;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rle_row[column] = bgred;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (pixelbuf[(row * symbol->bitmap_width) + column] == '1') {
|
switch(pixelbuf[(row * symbol->bitmap_width) + column]) {
|
||||||
rle_row[column] = fggrn;
|
case 'W': // White
|
||||||
} else {
|
case 'C': // Cyan
|
||||||
rle_row[column] = bggrn;
|
case 'Y': // Yellow
|
||||||
|
case 'G': // Green
|
||||||
|
rle_row[column] = 255;
|
||||||
|
break;
|
||||||
|
case 'B': // Blue
|
||||||
|
case 'M': // Magenta
|
||||||
|
case 'R': // Red
|
||||||
|
case 'K': // Black
|
||||||
|
rle_row[column] = 0;
|
||||||
|
break;
|
||||||
|
case '1':
|
||||||
|
rle_row[column] = fggrn;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rle_row[column] = bggrn;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (pixelbuf[(row * symbol->bitmap_width) + column] == '1') {
|
switch(pixelbuf[(row * symbol->bitmap_width) + column]) {
|
||||||
rle_row[column] = fgblu;
|
case 'W': // White
|
||||||
} else {
|
case 'C': // Cyan
|
||||||
rle_row[column] = bgblu;
|
case 'B': // Blue
|
||||||
|
case 'M': // Magenta
|
||||||
|
rle_row[column] = 255;
|
||||||
|
break;
|
||||||
|
case 'R': // Red
|
||||||
|
case 'Y': // Yellow
|
||||||
|
case 'G': // Green
|
||||||
|
case 'K': // Black
|
||||||
|
rle_row[column] = 0;
|
||||||
|
break;
|
||||||
|
case '1':
|
||||||
|
rle_row[column] = fgblu;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rle_row[column] = bgblu;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -158,6 +158,46 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
for (column = 0; column < symbol->bitmap_width; column++) {
|
for (column = 0; column < symbol->bitmap_width; column++) {
|
||||||
i = column * 3;
|
i = column * 3;
|
||||||
switch (*(pixelbuf + (symbol->bitmap_width * row) + column)) {
|
switch (*(pixelbuf + (symbol->bitmap_width * row) + column)) {
|
||||||
|
case 'W': // White
|
||||||
|
outdata[i] = 255;
|
||||||
|
outdata[i + 1] = 255;
|
||||||
|
outdata[i + 2] = 255;
|
||||||
|
break;
|
||||||
|
case 'C': // Cyan
|
||||||
|
outdata[i] = 0;
|
||||||
|
outdata[i + 1] = 255;
|
||||||
|
outdata[i + 2] = 255;
|
||||||
|
break;
|
||||||
|
case 'B': // Blue
|
||||||
|
outdata[i] = 0;
|
||||||
|
outdata[i + 1] = 0;
|
||||||
|
outdata[i + 2] = 255;
|
||||||
|
break;
|
||||||
|
case 'M': // Magenta
|
||||||
|
outdata[i] = 255;
|
||||||
|
outdata[i + 1] = 0;
|
||||||
|
outdata[i + 2] = 255;
|
||||||
|
break;
|
||||||
|
case 'R': // Red
|
||||||
|
outdata[i] = 255;
|
||||||
|
outdata[i + 1] = 0;
|
||||||
|
outdata[i + 2] = 0;
|
||||||
|
break;
|
||||||
|
case 'Y': // Yellow
|
||||||
|
outdata[i] = 255;
|
||||||
|
outdata[i + 1] = 255;
|
||||||
|
outdata[i + 2] = 0;
|
||||||
|
break;
|
||||||
|
case 'G': // Green
|
||||||
|
outdata[i] = 0;
|
||||||
|
outdata[i + 1] = 255;
|
||||||
|
outdata[i + 2] = 0;
|
||||||
|
break;
|
||||||
|
case 'K': // Black
|
||||||
|
outdata[i] = 0;
|
||||||
|
outdata[i + 1] = 0;
|
||||||
|
outdata[i + 2] = 0;
|
||||||
|
break;
|
||||||
case '1':
|
case '1':
|
||||||
outdata[i] = fgred;
|
outdata[i] = fgred;
|
||||||
outdata[i + 1] = fggrn;
|
outdata[i + 1] = fggrn;
|
||||||
|
192
backend/raster.c
192
backend/raster.c
@ -48,6 +48,9 @@
|
|||||||
|
|
||||||
#define SSET "0123456789ABCDEF"
|
#define SSET "0123456789ABCDEF"
|
||||||
|
|
||||||
|
#define DEFAULT_INK '1'
|
||||||
|
#define DEFAULT_PAPER '0'
|
||||||
|
|
||||||
#ifndef NO_PNG
|
#ifndef NO_PNG
|
||||||
extern int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
extern int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||||
#endif /* NO_PNG */
|
#endif /* NO_PNG */
|
||||||
@ -56,6 +59,8 @@ extern int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
|||||||
extern int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
extern int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||||
extern int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
extern int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf);
|
||||||
|
|
||||||
|
static const char ultra_colour[] = "WCBMRYGK";
|
||||||
|
|
||||||
void buffer_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
void buffer_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||||
/* Place pixelbuffer into symbol */
|
/* Place pixelbuffer into symbol */
|
||||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||||
@ -74,12 +79,52 @@ void buffer_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
for (column = 0; column < symbol->bitmap_width; column++) {
|
for (column = 0; column < symbol->bitmap_width; column++) {
|
||||||
i = ((row * symbol->bitmap_width) + column) * 3;
|
i = ((row * symbol->bitmap_width) + column) * 3;
|
||||||
switch (*(pixelbuf + (symbol->bitmap_width * row) + column)) {
|
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] = fgred;
|
||||||
symbol->bitmap[i + 1] = fggrn;
|
symbol->bitmap[i + 1] = fggrn;
|
||||||
symbol->bitmap[i + 2] = fgblu;
|
symbol->bitmap[i + 2] = fgblu;
|
||||||
break;
|
break;
|
||||||
default:
|
default: // DEFAULT_PAPER
|
||||||
symbol->bitmap[i] = bgred;
|
symbol->bitmap[i] = bgred;
|
||||||
symbol->bitmap[i + 1] = bggrn;
|
symbol->bitmap[i + 1] = bggrn;
|
||||||
symbol->bitmap[i + 2] = bgblu;
|
symbol->bitmap[i + 2] = bgblu;
|
||||||
@ -208,7 +253,7 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int
|
|||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_bar(char *pixelbuf, int xpos, int xlen, int ypos, int ylen, int image_width, int image_height) {
|
void draw_bar(char *pixelbuf, int xpos, int xlen, int ypos, int ylen, int image_width, int image_height, char fill) {
|
||||||
/* Draw a rectangle */
|
/* Draw a rectangle */
|
||||||
int i, j, png_ypos;
|
int i, j, png_ypos;
|
||||||
|
|
||||||
@ -218,7 +263,7 @@ void draw_bar(char *pixelbuf, int xpos, int xlen, int ypos, int ylen, int image_
|
|||||||
|
|
||||||
for (i = (xpos); i < (xpos + xlen); i++) {
|
for (i = (xpos); i < (xpos + xlen); i++) {
|
||||||
for (j = (png_ypos); j < (png_ypos + ylen); j++) {
|
for (j = (png_ypos); j < (png_ypos + ylen); j++) {
|
||||||
*(pixelbuf + (image_width * j) + i) = '1';
|
*(pixelbuf + (image_width * j) + i) = fill;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,13 +292,13 @@ void draw_bullseye(char *pixelbuf, int image_width, int image_height, int xoffse
|
|||||||
x = 16.0 * scaler;
|
x = 16.0 * scaler;
|
||||||
y = 16.5 * 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, (4.571 * scaler) + 1, DEFAULT_INK);
|
||||||
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, (3.779 * scaler) + 1, DEFAULT_PAPER);
|
||||||
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.988 * scaler) + 1, DEFAULT_INK);
|
||||||
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, (2.196 * scaler) + 1, DEFAULT_PAPER);
|
||||||
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, (1.394 * scaler) + 1, DEFAULT_INK);
|
||||||
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, (0.602 * scaler) + 1, DEFAULT_PAPER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_hexagon(char *pixelbuf, int image_width, char *scaled_hexagon, int hexagon_size, int xposn, int yposn) {
|
void draw_hexagon(char *pixelbuf, int image_width, char *scaled_hexagon, int hexagon_size, int xposn, int yposn) {
|
||||||
@ -262,8 +307,8 @@ void draw_hexagon(char *pixelbuf, int image_width, char *scaled_hexagon, int hex
|
|||||||
|
|
||||||
for (i = 0; i < hexagon_size; i++) {
|
for (i = 0; i < hexagon_size; i++) {
|
||||||
for (j = 0; j < hexagon_size; j++) {
|
for (j = 0; j < hexagon_size; j++) {
|
||||||
if (scaled_hexagon[(i * hexagon_size) + j] == '1') {
|
if (scaled_hexagon[(i * hexagon_size) + j] == DEFAULT_INK) {
|
||||||
*(pixelbuf + (image_width * i) + (image_width * yposn) + xposn + j) = '1';
|
*(pixelbuf + (image_width * i) + (image_width * yposn) + xposn + j) = DEFAULT_INK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -314,7 +359,7 @@ void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int
|
|||||||
for (y = 0; y < max_y; y++) {
|
for (y = 0; y < max_y; y++) {
|
||||||
for (x = 0; x < max_x; x++) {
|
for (x = 0; x < max_x; x++) {
|
||||||
if (small_font[(glyph_no * 9) + y] & (0x10 >> 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -340,11 +385,11 @@ void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int
|
|||||||
int extra_dot = 0;
|
int extra_dot = 0;
|
||||||
for (x = 0; x < 7; x++) {
|
for (x = 0; x < 7; x++) {
|
||||||
if (ascii_font[(glyph_no * 14) + y] & (0x40 >> x)) {
|
if (ascii_font[(glyph_no * 14) + y] & (0x40 >> x)) {
|
||||||
*pixelPtr = '1';
|
*pixelPtr = DEFAULT_INK;
|
||||||
extra_dot = 1;
|
extra_dot = 1;
|
||||||
} else {
|
} else {
|
||||||
if (extra_dot) {
|
if (extra_dot) {
|
||||||
*pixelPtr = '1';
|
*pixelPtr = DEFAULT_INK;
|
||||||
}
|
}
|
||||||
|
|
||||||
extra_dot = 0;
|
extra_dot = 0;
|
||||||
@ -354,7 +399,7 @@ void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (extra_dot) {
|
if (extra_dot) {
|
||||||
*pixelPtr = '1';
|
*pixelPtr = DEFAULT_INK;
|
||||||
}
|
}
|
||||||
|
|
||||||
linePtr += image_width;
|
linePtr += image_width;
|
||||||
@ -377,7 +422,7 @@ void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int
|
|||||||
for (y = 0; y < max_y; y++) {
|
for (y = 0; y < max_y; y++) {
|
||||||
for (x = 0; x < 7; x++) {
|
for (x = 0; x < 7; x++) {
|
||||||
if (ascii_font[(glyph_no * 14) + y] & (0x40 >> 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -425,7 +470,7 @@ void plot_hexline(char *scaled_hexagon, int hexagon_size, float start_x, float s
|
|||||||
float this_x = start_x + ((float)i * inc_x);
|
float this_x = start_x + ((float)i * inc_x);
|
||||||
float this_y = start_y + ((float)i * inc_y);
|
float this_y = start_y + ((float)i * inc_y);
|
||||||
if (((this_x >= 0) && (this_x < hexagon_size)) && ((this_y >= 0) && (this_y < hexagon_size))) {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -469,17 +514,17 @@ void plot_hexagon(char *scaled_hexagon, int hexagon_size) {
|
|||||||
|
|
||||||
/* Fill hexagon */
|
/* Fill hexagon */
|
||||||
for (line = 0; line < hexagon_size; line++) {
|
for (line = 0; line < hexagon_size; line++) {
|
||||||
char ink = '0';
|
char ink = DEFAULT_PAPER;
|
||||||
for (i = 0; i < hexagon_size; i++) {
|
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)) {
|
if (i < (hexagon_size / 2)) {
|
||||||
ink = '1';
|
ink = DEFAULT_INK;
|
||||||
} else {
|
} else {
|
||||||
ink = '0';
|
ink = DEFAULT_PAPER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ink == '1') {
|
if (ink == DEFAULT_INK) {
|
||||||
scaled_hexagon[(hexagon_size * line) + i] = ink;
|
scaled_hexagon[(hexagon_size * line) + i] = ink;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -507,7 +552,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_
|
|||||||
return ZINT_ERROR_ENCODING_PROBLEM;
|
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < (image_width * image_height); i++) {
|
for (i = 0; i < (image_width * image_height); i++) {
|
||||||
*(pixelbuf + i) = '0';
|
*(pixelbuf + i) = DEFAULT_PAPER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,7 +564,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_
|
|||||||
return ZINT_ERROR_ENCODING_PROBLEM;
|
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < (hexagon_size * hexagon_size); i++) {
|
for (i = 0; i < (hexagon_size * hexagon_size); i++) {
|
||||||
*(scaled_hexagon + i) = '0';
|
*(scaled_hexagon + i) = DEFAULT_PAPER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,14 +594,14 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_
|
|||||||
|
|
||||||
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
|
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
|
||||||
/* boundary bars */
|
/* boundary bars */
|
||||||
draw_bar(pixelbuf, 0, image_width, 0, 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);
|
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) {
|
if (symbol->output_options & BARCODE_BOX) {
|
||||||
/* side bars */
|
/* side bars */
|
||||||
draw_bar(pixelbuf, 0, 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);
|
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);
|
error_number = save_raster_image_to_file(symbol, image_height, image_width, pixelbuf, rotate_angle, data_type);
|
||||||
@ -631,7 +676,7 @@ int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int data_typ
|
|||||||
return ZINT_ERROR_ENCODING_PROBLEM;
|
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < (scale_width * scale_height); i++) {
|
for (i = 0; i < (scale_width * scale_height); i++) {
|
||||||
*(scaled_pixelbuf + i) = '0';
|
*(scaled_pixelbuf + i) = DEFAULT_PAPER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,7 +688,7 @@ int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int data_typ
|
|||||||
(int) ((i + xoffset) * scaler) + (scaler / 2.0),
|
(int) ((i + xoffset) * scaler) + (scaler / 2.0),
|
||||||
(int) ((r + yoffset) * scaler) + (scaler / 2.0),
|
(int) ((r + yoffset) * scaler) + (scaler / 2.0),
|
||||||
(symbol->dot_size / 2.0) * scaler,
|
(symbol->dot_size / 2.0) * scaler,
|
||||||
'1');
|
DEFAULT_INK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -797,7 +842,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
return ZINT_ERROR_ENCODING_PROBLEM;
|
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < (image_width * image_height); i++) {
|
for (i = 0; i < (image_width * image_height); i++) {
|
||||||
*(pixelbuf + i) = '0';
|
*(pixelbuf + i) = DEFAULT_PAPER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -816,6 +861,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
int plot_yposn;
|
int plot_yposn;
|
||||||
int plot_height;
|
int plot_height;
|
||||||
int this_row = symbol->rows - r - 1; /* invert r otherwise plots upside down */
|
int this_row = symbol->rows - r - 1; /* invert r otherwise plots upside down */
|
||||||
|
int module_fill;
|
||||||
row_posn += row_height;
|
row_posn += row_height;
|
||||||
plot_yposn = next_yposn;
|
plot_yposn = next_yposn;
|
||||||
if (symbol->row_height[this_row] == 0) {
|
if (symbol->row_height[this_row] == 0) {
|
||||||
@ -827,30 +873,26 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
plot_height = next_yposn - plot_yposn;
|
plot_height = next_yposn - plot_yposn;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
if (module_is_set(symbol, this_row, 0)) {
|
|
||||||
latch = 1;
|
|
||||||
} else {
|
|
||||||
latch = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
module_fill = module_is_set(symbol, this_row, i);
|
||||||
block_width = 0;
|
block_width = 0;
|
||||||
do {
|
do {
|
||||||
block_width++;
|
block_width++;
|
||||||
} while ((i + block_width < symbol->width )&& module_is_set(symbol, this_row, i + block_width) == module_is_set(symbol, this_row, i));
|
} while ((i + block_width < symbol->width )&& module_is_set(symbol, this_row, i + block_width) == module_fill);
|
||||||
if ((addon_latch == 0) && (r == 0) && (i > main_width)) {
|
if ((addon_latch == 0) && (r == 0) && (i > main_width)) {
|
||||||
plot_height = (int) (row_height - 5.0);
|
plot_height = (int) (row_height - 5.0);
|
||||||
plot_yposn = (int) (row_posn - 5.0);
|
plot_yposn = (int) (row_posn - 5.0);
|
||||||
addon_text_posn = row_posn + row_height - 8.0;
|
addon_text_posn = row_posn + row_height - 8.0;
|
||||||
addon_latch = 1;
|
addon_latch = 1;
|
||||||
}
|
}
|
||||||
if (latch == 1) {
|
if (module_fill) {
|
||||||
/* a bar */
|
/* a bar */
|
||||||
draw_bar(pixelbuf, (i + xoffset) * 2, block_width * 2, plot_yposn * 2, plot_height * 2, image_width, image_height);
|
if (symbol->symbology == BARCODE_ULTRA) {
|
||||||
latch = 0;
|
draw_bar(pixelbuf, (i + xoffset) * 2, block_width * 2, plot_yposn * 2, plot_height * 2, image_width, image_height, ultra_colour[module_fill]);
|
||||||
} else {
|
} else {
|
||||||
/* a space */
|
draw_bar(pixelbuf, (i + xoffset) * 2, block_width * 2, plot_yposn * 2, plot_height * 2, image_width, image_height, DEFAULT_INK);
|
||||||
latch = 1;
|
}
|
||||||
}
|
}
|
||||||
i += block_width;
|
i += block_width;
|
||||||
|
|
||||||
@ -866,12 +908,12 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
case 8: /* EAN-8 */
|
case 8: /* EAN-8 */
|
||||||
case 11:
|
case 11:
|
||||||
case 14:
|
case 14:
|
||||||
draw_bar(pixelbuf, (0 + 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);
|
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);
|
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);
|
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);
|
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);
|
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++) {
|
for (i = 0; i < 4; i++) {
|
||||||
textpart[i] = local_text[i];
|
textpart[i] = local_text[i];
|
||||||
}
|
}
|
||||||
@ -901,12 +943,12 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
case 13: /* EAN 13 */
|
case 13: /* EAN 13 */
|
||||||
case 16:
|
case 16:
|
||||||
case 19:
|
case 19:
|
||||||
draw_bar(pixelbuf, (0 + 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);
|
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);
|
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);
|
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);
|
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);
|
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[0] = local_text[0];
|
||||||
textpart[1] = '\0';
|
textpart[1] = '\0';
|
||||||
@ -952,7 +994,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
} while (module_is_set(symbol, symbol->rows - 1, i + block_width) == module_is_set(symbol, symbol->rows - 1, i));
|
} while (module_is_set(symbol, symbol->rows - 1, i + block_width) == module_is_set(symbol, symbol->rows - 1, i));
|
||||||
if (latch == 1) {
|
if (latch == 1) {
|
||||||
/* a bar */
|
/* 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;
|
latch = 0;
|
||||||
} else {
|
} else {
|
||||||
/* a space */
|
/* a space */
|
||||||
@ -960,8 +1002,8 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
}
|
}
|
||||||
i += block_width;
|
i += block_width;
|
||||||
} while (i < 11 + comp_offset);
|
} 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, (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);
|
draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
|
||||||
latch = 1;
|
latch = 1;
|
||||||
i = 85 + comp_offset;
|
i = 85 + comp_offset;
|
||||||
do {
|
do {
|
||||||
@ -971,7 +1013,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
} while (module_is_set(symbol, symbol->rows - 1, i + block_width) == module_is_set(symbol, symbol->rows - 1, i));
|
} while (module_is_set(symbol, symbol->rows - 1, i + block_width) == module_is_set(symbol, symbol->rows - 1, i));
|
||||||
if (latch == 1) {
|
if (latch == 1) {
|
||||||
/* a bar */
|
/* 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;
|
latch = 0;
|
||||||
} else {
|
} else {
|
||||||
/* a space */
|
/* a space */
|
||||||
@ -1014,11 +1056,11 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
} else if ((symbol->symbology == BARCODE_UPCE) || (symbol->symbology == BARCODE_UPCE_CHK)
|
} else if ((symbol->symbology == BARCODE_UPCE) || (symbol->symbology == BARCODE_UPCE_CHK)
|
||||||
|| (symbol->symbology == BARCODE_UPCE_CC)) {
|
|| (symbol->symbology == BARCODE_UPCE_CC)) {
|
||||||
/* guard bar extensions and text formatting for UPCE */
|
/* 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, (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);
|
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);
|
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);
|
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);
|
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[0] = local_text[0];
|
||||||
textpart[1] = '\0';
|
textpart[1] = '\0';
|
||||||
@ -1054,22 +1096,22 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
|
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
|
||||||
/* boundary bars */
|
/* boundary bars */
|
||||||
if (symbol->symbology != BARCODE_CODABLOCKF) {
|
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 * 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);
|
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 {
|
} 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 * 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);
|
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->output_options & BARCODE_BIND) != 0) {
|
||||||
if ((symbol->rows > 1) && (is_stackable(symbol->symbology) == 1)) {
|
if ((symbol->rows > 1) && (is_stackable(symbol->symbology) == 1)) {
|
||||||
/* row binding */
|
/* row binding */
|
||||||
if (symbol->symbology != BARCODE_CODABLOCKF) {
|
if (symbol->symbology != BARCODE_CODABLOCKF) {
|
||||||
for (r = 1; r < symbol->rows; r++) {
|
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 {
|
} else {
|
||||||
for (r = 1; r < symbol->rows; r++) {
|
for (r = 1; r < symbol->rows; r++) {
|
||||||
draw_bar(pixelbuf, (xoffset + 11) * 2 , (symbol->width - 25) * 2, ((r * row_height) + textoffset + yoffset - 1) * 2, 2 * 2, image_width, image_height);
|
draw_bar(pixelbuf, (xoffset + 11) * 2 , (symbol->width - 25) * 2, ((r * row_height) + textoffset + yoffset - 1) * 2, 2 * 2, image_width, image_height, DEFAULT_INK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1078,8 +1120,8 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
|
|
||||||
if (symbol->output_options & BARCODE_BOX) {
|
if (symbol->output_options & BARCODE_BOX) {
|
||||||
/* side bars */
|
/* 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, 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);
|
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 */
|
/* Put the human readable text at the bottom */
|
||||||
@ -1102,7 +1144,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
return ZINT_ERROR_ENCODING_PROBLEM;
|
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < (scale_width * scale_height); i++) {
|
for (i = 0; i < (scale_width * scale_height); i++) {
|
||||||
*(scaled_pixelbuf + i) = '0';
|
*(scaled_pixelbuf + i) = DEFAULT_PAPER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,16 +83,16 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
if ((symbol->bitmap_height % rows_per_strip) != 0) {
|
if ((symbol->bitmap_height % rows_per_strip) != 0) {
|
||||||
strip_count++;
|
strip_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rows_per_strip > symbol->bitmap_height) {
|
if (rows_per_strip > symbol->bitmap_height) {
|
||||||
rows_per_strip = symbol->bitmap_height;
|
rows_per_strip = symbol->bitmap_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strip_count == 1) {
|
if (strip_count == 1) {
|
||||||
rows_per_strip = (rows_per_strip / 2) + 1;
|
rows_per_strip = (rows_per_strip / 2) + 1;
|
||||||
strip_count++;
|
strip_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
uint32_t strip_offset[strip_count];
|
uint32_t strip_offset[strip_count];
|
||||||
uint32_t strip_bytes[strip_count];
|
uint32_t strip_bytes[strip_count];
|
||||||
@ -151,24 +151,67 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
|
|
||||||
fwrite(&header, sizeof(tiff_header_t), 1, tif_file);
|
fwrite(&header, sizeof(tiff_header_t), 1, tif_file);
|
||||||
free_memory += sizeof(tiff_ifd_t);
|
free_memory += sizeof(tiff_ifd_t);
|
||||||
|
|
||||||
/* Pixel data */
|
/* Pixel data */
|
||||||
strip = 0;
|
strip = 0;
|
||||||
bytes_put = 0;
|
bytes_put = 0;
|
||||||
for (row = 0; row < symbol->bitmap_height; row++) {
|
for (row = 0; row < symbol->bitmap_height; row++) {
|
||||||
for (column = 0; column < symbol->bitmap_width; column++) {
|
for (column = 0; column < symbol->bitmap_width; column++) {
|
||||||
if (pixelbuf[(row * symbol->bitmap_width) + column] == '1') {
|
switch(pixelbuf[(row * symbol->bitmap_width) + column]) {
|
||||||
putc(fgred, tif_file);
|
case 'W': // White
|
||||||
putc(fggrn, tif_file);
|
putc(255, tif_file);
|
||||||
putc(fgblu, tif_file);
|
putc(255, tif_file);
|
||||||
} else {
|
putc(255, tif_file);
|
||||||
putc(bgred, tif_file);
|
break;
|
||||||
putc(bggrn, tif_file);
|
case 'C': // Cyan
|
||||||
putc(bgblu, tif_file);
|
putc(0, tif_file);
|
||||||
|
putc(255, tif_file);
|
||||||
|
putc(255, tif_file);
|
||||||
|
break;
|
||||||
|
case 'B': // Blue
|
||||||
|
putc(0, tif_file);
|
||||||
|
putc(0, tif_file);
|
||||||
|
putc(255, tif_file);
|
||||||
|
break;
|
||||||
|
case 'M': // Magenta
|
||||||
|
putc(255, tif_file);
|
||||||
|
putc(0, tif_file);
|
||||||
|
putc(255, tif_file);
|
||||||
|
break;
|
||||||
|
case 'R': // Red
|
||||||
|
putc(255, tif_file);
|
||||||
|
putc(0, tif_file);
|
||||||
|
putc(0, tif_file);
|
||||||
|
break;
|
||||||
|
case 'Y': // Yellow
|
||||||
|
putc(255, tif_file);
|
||||||
|
putc(255, tif_file);
|
||||||
|
putc(0, tif_file);
|
||||||
|
break;
|
||||||
|
case 'G': // Green
|
||||||
|
putc(0, tif_file);
|
||||||
|
putc(255, tif_file);
|
||||||
|
putc(0, tif_file);
|
||||||
|
break;
|
||||||
|
case 'K': // Black
|
||||||
|
putc(0, tif_file);
|
||||||
|
putc(0, tif_file);
|
||||||
|
putc(0, tif_file);
|
||||||
|
break;
|
||||||
|
case '1':
|
||||||
|
putc(fgred, tif_file);
|
||||||
|
putc(fggrn, tif_file);
|
||||||
|
putc(fgblu, tif_file);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
putc(bgred, tif_file);
|
||||||
|
putc(bggrn, tif_file);
|
||||||
|
putc(bgblu, tif_file);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
bytes_put += 3;
|
bytes_put += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bytes_put + 3) >= strip_bytes[strip]) {
|
if ((bytes_put + 3) >= strip_bytes[strip]) {
|
||||||
// End of strip, pad if strip length is odd
|
// End of strip, pad if strip length is odd
|
||||||
if (strip_bytes[strip] % 2 == 1) {
|
if (strip_bytes[strip] % 2 == 1) {
|
||||||
|
@ -441,7 +441,6 @@ int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type) {
|
|||||||
|
|
||||||
// Plot rectangles - most symbols created here
|
// Plot rectangles - most symbols created here
|
||||||
if ((symbol->symbology != BARCODE_MAXICODE) && ((symbol->output_options & BARCODE_DOTTY_MODE) == 0)) {
|
if ((symbol->symbology != BARCODE_MAXICODE) && ((symbol->output_options & BARCODE_DOTTY_MODE) == 0)) {
|
||||||
printf("Got symbol %d\n", symbol->symbology);
|
|
||||||
for (r = 0; r < symbol->rows; r++) {
|
for (r = 0; r < symbol->rows; r++) {
|
||||||
this_row = r;
|
this_row = r;
|
||||||
last_row_start = rect_count;
|
last_row_start = rect_count;
|
||||||
|
Loading…
Reference in New Issue
Block a user