mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Change bitmap signedness to allow conversion to other data types
Buffered bitmap array should have been type unsigned char not type char Includes change to manual In response to (and hopefully fixing) #182 reported by Marcelo Antunes
This commit is contained in:
parent
e8b56faa11
commit
52214c5a1c
@ -61,7 +61,7 @@ static void buffer_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
int row, column, i;
|
||||
|
||||
symbol->bitmap = (char *) malloc(symbol->bitmap_width * symbol->bitmap_height * 3);
|
||||
symbol->bitmap = (unsigned char *) malloc(symbol->bitmap_width * symbol->bitmap_height * 3);
|
||||
|
||||
fgred = (16 * ctoi(symbol->fgcolour[0])) + ctoi(symbol->fgcolour[1]);
|
||||
fggrn = (16 * ctoi(symbol->fgcolour[2])) + ctoi(symbol->fgcolour[3]);
|
||||
|
@ -125,7 +125,7 @@ extern "C" {
|
||||
unsigned char encoded_data[200][143];
|
||||
int row_height[200]; /* Largest symbol is 189 x 189 Han Xin */
|
||||
char errtxt[100];
|
||||
char *bitmap;
|
||||
unsigned char *bitmap;
|
||||
int bitmap_width;
|
||||
int bitmap_height;
|
||||
unsigned int bitmap_byte_length;
|
||||
|
@ -749,13 +749,13 @@ the example below where render_pixel() is assumed to be a function for drawing
|
||||
a pixel on the screen implemented by the external application:
|
||||
|
||||
int row, col, i = 0;
|
||||
unsigned int red, blue, green;
|
||||
int red, blue, green;
|
||||
|
||||
for (row = 0; row < my_symbol->bitmap_height; row++) {
|
||||
for (column = 0; col < my_symbol->bitmap_width; column++) {
|
||||
red = my_symbol->bitmap[i];
|
||||
green = my_symbol->bitmap[i + 1];
|
||||
blue = my_symbol->bitmap[i + 2];
|
||||
red = (int) my_symbol->bitmap[i];
|
||||
green = (int) my_symbol->bitmap[i + 1];
|
||||
blue = (int) my_symbol->bitmap[i + 2];
|
||||
render_pixel(row, column, red, green, blue);
|
||||
i += 3;
|
||||
}
|
||||
@ -826,7 +826,8 @@ row_height | array of | Representation of the | (output only)
|
||||
errtxt | character | Error message in the event | (output only)
|
||||
| string | that an error ocurred. |
|
||||
bitmap | pointer to | Pointer to stored bitmap | (output only)
|
||||
| character | image. |
|
||||
| unsigned | image. |
|
||||
| character | |
|
||||
| array | |
|
||||
bitmap_width | integer | Width of stored bitmap | (output only)
|
||||
| | image (in pixels). |
|
||||
|
Loading…
Reference in New Issue
Block a user