| Top |
| lglBarcode * | lgl_barcode_new () |
| void | lgl_barcode_free () |
| void | lgl_barcode_add_line () |
| void | lgl_barcode_add_box () |
| void | lgl_barcode_add_char () |
| void | lgl_barcode_add_string () |
| void | lgl_barcode_add_ring () |
| void | lgl_barcode_add_hexagon () |
This section describes the lglBarcode structure and the lglBarcodeShape family of simple drawing primitives. These structures form the basic intermediate barcode representation used by libglbarcode. The section also defines a set of functions for constructing an lglBarcode structure and populating it with drawing primitives.
lglBarcode *
lgl_barcode_new (void);
Allocate a new lglBarcode structure.
This function allocates a new lglBarcode structure.
This function is intended to be used internally by barcode implementations.
Typically an end-user would use lgl_barcode_create() instead.
void
lgl_barcode_free (lglBarcode *bc);
Free a previously allocated lglBarcode structure.
void lgl_barcode_add_line (lglBarcode *bc,gdouble x,gdouble y,gdouble length,gdouble width);
Add a vertical line to barcode. Coordinates are relative to top left corner of barcode. All units are in points ( 1 point = 1/72 inch ).
This function is intended to be used internally by barcode implementations.
bc |
An lglBarcode structure |
|
x |
x coordinate of top of line |
|
y |
y coordinate of top of line |
|
length |
Length of line |
|
width |
Width of line |
void lgl_barcode_add_box (lglBarcode *bc,gdouble x,gdouble y,gdouble width,gdouble height);
Add a box to barcode. Coordinates are relative to top left corner of barcode. All units are in points ( 1 point = 1/72 inch ).
This function is intended to be used internally by barcode implementations.
bc |
An lglBarcode structure |
|
x |
x coordinate of top left corner of box |
|
y |
y coordinate of top left corner of box |
|
width |
Width of box |
|
height |
Height of box |
void lgl_barcode_add_char (lglBarcode *bc,gdouble x,gdouble y,gdouble fsize,gchar c);
Add an ASCII character to barcode. Coordinates are relative to top left corner of barcode. All units are in points ( 1 point = 1/72 inch ).
This function is intended to be used internally by barcode implementations.
bc |
An lglBarcode structure |
|
x |
x coordinate of left baseline of character |
|
y |
y coordinate of left baseline of character |
|
fsize |
Font size |
|
c |
Character to add |
void lgl_barcode_add_string (lglBarcode *bc,gdouble x,gdouble y,gdouble fsize,gchar *string,gsize length);
Add a character string to barcode. Coordinates are relative to top left corner of barcode. All units are in points ( 1 point = 1/72 inch ).
This function is intended to be used internally by barcode implementations.
bc |
An lglBarcode structure |
|
x |
x coordinate of horizontal center of baseline of string |
|
y |
y coordinate of horizontal center of baseline of string |
|
fsize |
Font size |
|
string |
String to add |
|
length |
Number of bytes in string |
void lgl_barcode_add_ring (lglBarcode *bc,gdouble x,gdouble y,gdouble radius,gdouble line_width);
Add a ring to barcode. Coordinates are relative to top left corner of barcode. All units are in points ( 1 point = 1/72 inch ).
This function is intended to be used internally by barcode implementations.
bc |
An lglBarcode structure |
|
x |
x coordinate of center of circle |
|
y |
y coordinate of center of circle |
|
radius |
Radius of ring (center of line) |
|
line_width |
Width of line |
void lgl_barcode_add_hexagon (lglBarcode *bc,gdouble x,gdouble y,gdouble height);
Add a regular hexagon (oriented with vertexes at top and bottom) to barcode. Coordinates are relative to top left corner of barcode. All units are in points ( 1 point = 1/72 inch ).
This function is intended to be used internally by barcode implementations.
bc |
An lglBarcode structure |
|
x |
x coordinate of top point of hexagon |
|
y |
y coordinate of top point of hexagon |
|
height |
Height of hexagon |
typedef struct {
gdouble width;
gdouble height;
GList *shapes; /* List of lglBarcodeShape drawing primitives */
} lglBarcode;
This structure contains the libglbarcode intermediate barcode format. This structure contains a simple vectorized representation of the barcode. This vectorized representation is easy to interpret by a rendering backend for either vector or raster formats. A simple API is provided for constructing barcodes in this format.
Width of barcode bounding box (points) |
||
Height of barcode bounding box (points) |
||
List of lglBarcodeShape drawing primitives |
typedef struct {
/* Begin Common Fields */
lglBarcodeShapeType type;
gdouble x;
gdouble y;
/* End Common Fields */
} lglBarcodeShapeAny;
typedef struct {
/* Begin Common Fields */
lglBarcodeShapeType type; /* Always LGL_BARCODE_SHAPE_LINE. */
gdouble x;
gdouble y;
/* End Common Fields */
gdouble length;
gdouble width;
} lglBarcodeShapeLine;
A vertical line drawing primitive.
@ = origin (x,y) from top left corner of barcode
+--@--+
| |
| |
| |
| | length
| |
| |
| |
+-----+
width
All units are in points ( 1 point = 1/72 inch ).
lglBarcodeShapeType |
Always |
|
x coordinate of top of line |
||
y coordinate of top of line |
||
Length of line |
||
Width of line |
typedef struct {
/* Begin Common Fields */
lglBarcodeShapeType type; /* Always LGL_BARCODE_SHAPE_BOX. */
gdouble x;
gdouble y;
/* End Common Fields */
gdouble width;
gdouble height;
} lglBarcodeShapeBox;
A solid box drawing primitive.
@ = origin (x,y) from top left corner of barcode
@---------+
| |
| |
| |
| | height
| |
| |
| |
+---------+
width
All units are in points ( 1 point = 1/72 inch ).
lglBarcodeShapeType |
Always |
|
x coordinate of top left corner of box |
||
y coordinate of top left corner of box |
||
Width of box |
||
Height of box |
typedef struct {
/* Begin Common Fields */
lglBarcodeShapeType type; /* Always LGL_BARCODE_SHAPE_CHAR. */
gdouble x;
gdouble y;
/* End Common Fields */
gdouble fsize;
gchar c;
} lglBarcodeShapeChar;
An single byte character drawing primitive.
@ = origin (x,y) from top left corner of barcode
____ ------------
/ \ ^
/ /\ \ |
/ /__\ \ |
/ ______ \ | ~fsize
/ / \ \ |
/__/ \__\ |
v
@ ----------------------
All units are in points ( 1 point = 1/72 inch ).
lglBarcodeShapeType |
Always |
|
x coordinate of left baseline of character |
||
y coordinate of left baseline of character |
||
Font size |
||
Character to add |
typedef struct {
/* Begin Common Fields */
lglBarcodeShapeType type; /* Always LGL_BARCODE_SHAPE_STRING. */
gdouble x;
gdouble y;
/* End Common Fields */
gdouble fsize;
gchar *string;
} lglBarcodeShapeString;
A character string drawing primitive.
@ = origin (x,y) from top left corner of barcode
____ _ ------------------
/ \ | | ^
/ /\ \ | | |
/ /__\ \ | |___ ____ |
/ ______ \ | ._ \ / __| | ~fsize
/ / \ \ | |_) | | (__ |
/__/ \__\ |_.___/ \____| |
v
@ ------------------
x = horizontal center
All units are in points ( 1 point = 1/72 inch ).
lglBarcodeShapeType |
Always |
|
x coordinate of horizontal center of baseline of string |
||
y coordinate of horizontal center of baseline of string |
||
Font size |
||
String to add |
typedef struct {
/* Begin Common Fields */
lglBarcodeShapeType type; /* Always LGL_BARCODE_SHAPE_RING. */
gdouble x;
gdouble y;
/* End Common Fields */
gdouble radius;
gdouble line_width;
} lglBarcodeShapeRing;
A ring (an open circle) drawing primitive.
@ = origin (x,y) is centre of circle
v line_width
_.-""""-._
.' ____ `.
/ .' ^ `. \
| / \ |
| | @---|---|------
| \ / | ^
\ `.____.' / | radius
`._ ...._.'.......|
`-....-'
All units are in points ( 1 point = 1/72 inch ).
lglBarcodeShapeType |
Always |
|
x coordinate of center of circle |
||
y coordinate of center of circle |
||
Radius of ring (center of line) |
||
Width of line |
typedef struct {
/* Begin Common Fields */
lglBarcodeShapeType type; /* Always LGL_BARCODE_SHAPE_HEXAGON. */
gdouble x;
gdouble y;
/* End Common Fields */
gdouble height;
} lglBarcodeShapeHexagon;
A solid regular hexagon (oriented with vertexes at top and bottom) drawing primitive.
@ = origin (x,y) is top of hexagon
@ ------------------
_-" "-_ ^
_-" "-_ |
+" "+ |
| | |
| | |
| | | height
| | |
| | |
+_ _+ |
"-_ _-" |
"-_ _-" |
"-_ _-" v
" ------------------
All units are in points ( 1 point = 1/72 inch ).
lglBarcodeShapeType |
Always |
|
x coordinate of top point of hexagon |
||
y coordinate of top point of hexagon |
||
Height of hexagon |