2019-09-01 Codemonkey82 Draw Maxicode bullseye for scale = 0.5 Ticket #119

This commit is contained in:
Harald Oehlmann 2019-09-02 11:26:30 +02:00
parent ed00537283
commit b86a7e6560

View File

@ -238,15 +238,21 @@ void draw_circle(char *pixelbuf, int image_width, int image_height, int x0, int
} }
} }
void draw_bullseye(char *pixelbuf, int image_width, int image_height, int cx, int cy, int scaler) { void draw_bullseye(char pixelbuf, int image_width, int image_height, int xoffset, int yoffset, int scaler) {
/* Central bullseye in Maxicode symbols */ / Central bullseye in Maxicode symbols */
float x = 14.5 * scaler;
draw_circle(pixelbuf, image_width, image_height, cx, cy, (int)(4.571 * scaler) + 1, '1'); float y = 15.0 * scaler;
draw_circle(pixelbuf, image_width, image_height, cx, cy, (int)(3.779 * scaler) + 1, '0'); if(scaler < 10) {
draw_circle(pixelbuf, image_width, image_height, cx, cy, (int)(2.988 * scaler) + 1, '1'); x = 16.0 * scaler;
draw_circle(pixelbuf, image_width, image_height, cx, cy, (int)(2.196 * scaler) + 1, '0'); y = 16.5 * scaler;
draw_circle(pixelbuf, image_width, image_height, cx, cy, (int)(1.394 * scaler) + 1, '1'); }
draw_circle(pixelbuf, image_width, image_height, cx, cy, (int)(0.602 * scaler) + 1, '0');
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');
} }
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) {
@ -535,7 +541,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_
} }
} }
draw_bullseye(pixelbuf, image_width, image_height, (int)(((14.5 * 10.0) + (2.0 * xoffset)) * scaler), (int)(((16.5 * 9.0) + (2.0 * yoffset)) * scaler), scaler * 10); draw_bullseye(pixelbuf, image_width, image_height, (2.0 * xoffset), (2.0 * yoffset)) * scaler), scaler * 10);
// Virtual hexagon // Virtual hexagon
//draw_hexagon(pixelbuf, image_width, scaled_hexagon, hexagon_size, ((14 * 10) + (2 * xoffset)) * scaler, ((16 * 9) + (2 * yoffset)) * scaler); //draw_hexagon(pixelbuf, image_width, scaled_hexagon, hexagon_size, ((14 * 10) + (2 * xoffset)) * scaler, ((16 * 9) + (2 * yoffset)) * scaler);