mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-28 05:54:19 -04:00
Ultra: Correct clock pattern generation, add work around to avoid negative UCC and output to colour SVG
This commit is contained in:
parent
e6ab17086c
commit
d370f3c0c7
4 changed files with 156 additions and 103 deletions
|
@ -42,6 +42,35 @@
|
|||
|
||||
#include "common.h"
|
||||
|
||||
void pick_colour(int colour, char colour_code[]) {
|
||||
switch(colour) {
|
||||
case 0: // White
|
||||
strcpy(colour_code, "ffffff");
|
||||
break;
|
||||
case 1: // Cyan
|
||||
strcpy(colour_code, "00ffff");
|
||||
break;
|
||||
case 2: // Blue
|
||||
strcpy(colour_code, "0000ff");
|
||||
break;
|
||||
case 3: // Magenta
|
||||
strcpy(colour_code, "ff00ff");
|
||||
break;
|
||||
case 4: // Red
|
||||
strcpy(colour_code, "ff0000");
|
||||
break;
|
||||
case 5: // Yellow
|
||||
strcpy(colour_code, "ffff00");
|
||||
break;
|
||||
case 6: // Green
|
||||
strcpy(colour_code, "00ff00");
|
||||
break;
|
||||
default: // Black
|
||||
strcpy(colour_code, "000000");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void make_html_friendly(unsigned char * string, char * html_version) {
|
||||
/* Converts text to use HTML entity codes */
|
||||
|
||||
|
@ -99,6 +128,8 @@ int svg_plot(struct zint_symbol *symbol) {
|
|||
struct zint_vector_circle *circle;
|
||||
struct zint_vector_string *string;
|
||||
|
||||
char colour_code[7];
|
||||
|
||||
#ifdef _MSC_VER
|
||||
char* html_string;
|
||||
#endif
|
||||
|
@ -154,7 +185,12 @@ int svg_plot(struct zint_symbol *symbol) {
|
|||
|
||||
rect = symbol->vector->rectangles;
|
||||
while (rect) {
|
||||
fprintf(fsvg, " <rect x=\"%.2f\" y=\"%.2f\" width=\"%.2f\" height=\"%.2f\" />\n", rect->x, rect->y, rect->width, rect->height);
|
||||
if (rect->colour == -1) {
|
||||
fprintf(fsvg, " <rect x=\"%.2f\" y=\"%.2f\" width=\"%.2f\" height=\"%.2f\" />\n", rect->x, rect->y, rect->width, rect->height);
|
||||
} else {
|
||||
pick_colour(rect->colour, colour_code);
|
||||
fprintf(fsvg, " <rect x=\"%.2f\" y=\"%.2f\" width=\"%.2f\" height=\"%.2f\" fill=\"#%s\" />\n", rect->x, rect->y, rect->width, rect->height, colour_code);
|
||||
}
|
||||
rect = rect->next;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue