1
0
mirror of https://git.code.sf.net/p/zint/code synced 2025-12-18 02:17:06 +00: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:
Robin Stuart
2020-01-06 20:01:48 +00:00
parent 6181885e2e
commit 5861ad3c3b
6 changed files with 310 additions and 101 deletions

View File

@@ -73,6 +73,46 @@ int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
for (column = 0; column < symbol->bitmap_width; column++) {
i = (3 * column) + (row * row_size);
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':
bitmap[i] = fgblu;
bitmap[i + 1] = fggrn;