13 double cell_width,
unsigned int row,
unsigned int column,
bool border);
15 unsigned int tag_id,
unsigned int tag_size,
bool border);
18 if (arguments_size <= 1) {
22 unsigned int tag_size = 160;
26 tag_size = (
unsigned int)(160.0 * 11.0 / 8.5);
53 unsigned int first_row,
unsigned int last_column,
unsigned int last_row,
bool border) {
56 unsigned int delta = 0;
63 first_row = 11 - first_row;
64 last_row = 11 - last_row;
67 if (first_column > last_column) {
68 unsigned int temporary_column = first_column;
69 first_column = last_column;
70 last_column = temporary_column;
74 if (first_row > last_row) {
75 unsigned int temporary_row = first_row;
77 last_row = temporary_row;
83 (
double)(first_column - delta) * cell_width,
84 (
double)(first_row - delta) * cell_width,
85 (
double)(last_column - first_column + 1) * cell_width,
86 (
double)(last_row - first_row + 1) * cell_width,
102 double cell_width,
unsigned int row,
unsigned int column,
bool border) {
103 SVG__tag_bits(svg, cell_width, row, column, row, column, border);
111 unsigned int tag_id,
unsigned int tag_size,
bool border) {
113 double cell_width = (double)(tag_size) / 10.0;
116 double length = 10.0 * cell_width;
117 double length_plus = length + 5.0 * cell_width;
121 SVG * svg =
new SVG(base_name, length + 3.0 * cell_width, length_plus,
123 assert (svg != NULL);
127 unsigned int tag_bytes[8];
129 tag_bytes[
index] = 0;
133 unsigned int id = tag_id;
134 tag_bytes[1] = (
id >> 8) & 0xff;
135 tag_bytes[0] =
id & 0xff;
139 tag_bytes[3] = (crc >> 8) & 0xff;
140 tag_bytes[2] = crc & 0xff;
148 double x_or_y = length + 2.0 * cell_width;
156 double y = -cell_width;
157 svg->
line(x1, y, x1 + d, y, color);
158 svg->
line(x2, y, x2 - d, y, color);
163 svg->
line(x1, y, x1 + d, y, color);
164 svg->
line(x1, y, x1, y + d, color);
165 svg->
line(x2, y, x2 - d, y, color);
166 svg->
line(x2, y, x2, y + d, color);
171 svg->
line(x1, y, x1 + d, y, color);
172 svg->
line(x1, y, x1, y - d, color);
173 svg->
line(x2, y, x2 - d, y, color);
174 svg->
line(x2, y, x2, y - d, color);
177 y = x_or_y + cell_width;
178 svg->
line(x1, y, x1 + d, y, color);
179 svg->
line(x2, y, x2 - d, y, color);
194 unsigned int row = (
index >> 3) & 7;
195 unsigned int column =
index & 7;
196 unsigned int tag_byte = tag_bytes[row];
197 if ((tag_byte & (1 << column)) != 0) {
198 SVG__tag_bit(svg, cell_width, column + 2, row + 2, border);
206 6.0 * cell_width, 12.25 * cell_width,
207 "ariel", (
unsigned int)(cell_width) / 2);
210 5.0 * cell_width, 12.25 * cell_width,
211 "ariel", (
unsigned int)(cell_width) / 2);
SVG_Struct is the data structure for representing Scalable Vector Graphics.
void String__free(String_Const string)
will free memory assciated with string.
void line(double x1, double y1, double x2, double y2, String_Const stroke)
Draw a line from (x1, y1) to (x2, y2) using stroke.
void File__format(File file, String_Const format,...)
will write format out to file with all patterns that start with "%" replaced by formatted versions of...
char * String
Copyright (c) 2013-2014 by Wayne C. Gramlich. All rights reserved.
void text(String_Const message, double x, double y, String_Const font_family, unsigned int font_size)
draw message at (x, y).
void setOffsets(double x_offset, double y_offset)
FEC FEC__create(unsigned int symbol_size, unsigned int data_size, unsigned int parity_size)
unsigned int CRC__compute(unsigned int *buffer, unsigned int size)
Returns a 16-bit CRC of the size bytes in buffer.
void FEC__parity(FEC fec, unsigned int *data, unsigned int size)
unsigned int String__to_unsigned(String_Const string)
Converts from decimal string into a number and return it.
const char * String_Const
bool String__equal(String_Const string1, String_Const string2)
Returns true if string1 equals string2.
void rectangle(double x, double y, double width, double height, String_Const stroke_color, String_Const fill_color)
Draw a width by height rectangle at (x, y).
String String__format(String_Const format,...)
Return a formatted version of format.