| LibGlbarcode 3.0 Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include <libglbarcode/lgl-barcode.h>
lglBarcode;
lglBarcode * lgl_barcode_new (void);
void lgl_barcode_free (lglBarcode *bc);
enum lglBarcodeShapeType;
lglBarcodeShape;
lglBarcodeShapeAny;
lglBarcodeShapeLine;
lglBarcodeShapeBox;
lglBarcodeShapeChar;
lglBarcodeShapeString;
lglBarcodeShapeRing;
lglBarcodeShapeHexagon;
void lgl_barcode_add_line (lglBarcode *bc,
gdouble x,
gdouble y,
gdouble length,
gdouble width);
void lgl_barcode_add_box (lglBarcode *bc,
gdouble x,
gdouble y,
gdouble width,
gdouble height);
void lgl_barcode_add_char (lglBarcode *bc,
gdouble x,
gdouble y,
gdouble fsize,
gchar c);
void lgl_barcode_add_string (lglBarcode *bc,
gdouble x,
gdouble y,
gdouble fsize,
gchar *string,
gsize length);
void lgl_barcode_add_ring (lglBarcode *bc,
gdouble x,
gdouble y,
gdouble radius,
gdouble line_width);
void lgl_barcode_add_hexagon (lglBarcode *bc,
gdouble x,
gdouble y,
gdouble height);
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.
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.
gdouble |
Width of barcode bounding box (points) |
gdouble |
Height of barcode bounding box (points) |
GList * |
List of lglBarcodeShape 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.
Returns : |
A newly allocated lglBarcode structure. Use lgl_barcode_free() to
free it. |
void lgl_barcode_free (lglBarcode *bc);
Free a previously allocated lglBarcode structure.
|
The lglBarcode structure to free |
typedef enum {
LGL_BARCODE_SHAPE_LINE,
LGL_BARCODE_SHAPE_BOX,
LGL_BARCODE_SHAPE_CHAR,
LGL_BARCODE_SHAPE_STRING,
LGL_BARCODE_SHAPE_RING,
LGL_BARCODE_SHAPE_HEXAGON
} lglBarcodeShapeType;
typedef union {
lglBarcodeShapeType type;
lglBarcodeShapeAny any;
lglBarcodeShapeLine line;
lglBarcodeShapeBox box;
lglBarcodeShapeChar bchar;
lglBarcodeShapeString string;
lglBarcodeShapeRing ring;
lglBarcodeShapeHexagon hexagon;
} lglBarcodeShape;
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 LGL_BARCODE_SHAPE_LINE
|
gdouble |
x coordinate of top of line |
gdouble |
y coordinate of top of line |
gdouble |
Length of line |
gdouble |
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 LGL_BARCODE_SHAPE_BOX
|
gdouble |
x coordinate of top left corner of box |
gdouble |
y coordinate of top left corner of box |
gdouble |
Width of box |
gdouble |
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 LGL_BARCODE_SHAPE_CHAR
|
gdouble |
x coordinate of left baseline of character |
gdouble |
y coordinate of left baseline of character |
gdouble |
Font size |
gchar |
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 LGL_BARCODE_SHAPE_STRING
|
gdouble |
x coordinate of horizontal center of baseline of string |
gdouble |
y coordinate of horizontal center of baseline of string |
gdouble |
Font size |
gchar * |
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 LGL_BARCODE_SHAPE_RING
|
gdouble |
x coordinate of center of circle |
gdouble |
y coordinate of center of circle |
gdouble |
Radius of ring (center of line) |
gdouble |
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 LGL_BARCODE_SHAPE_HEXAGON
|
gdouble |
x coordinate of top point of hexagon |
gdouble |
y coordinate of top point of hexagon |
gdouble |
Height of hexagon |
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.
|
An lglBarcode structure |
|
x coordinate of top of line |
|
y coordinate of top of line |
|
Length of line |
|
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.
|
An lglBarcode structure |
|
x coordinate of top left corner of box |
|
y coordinate of top left corner of box |
|
Width of box |
|
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.
|
An lglBarcode structure |
|
x coordinate of left baseline of character |
|
y coordinate of left baseline of character |
|
Font size |
|
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.
|
An lglBarcode structure |
|
x coordinate of horizontal center of baseline of string |
|
y coordinate of horizontal center of baseline of string |
|
Font size |
|
String to add |
|
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.
|
An lglBarcode structure |
|
x coordinate of center of circle |
|
y coordinate of center of circle |
|
Radius of ring (center of line) |
|
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.
|
An lglBarcode structure |
|
x coordinate of top point of hexagon |
|
y coordinate of top point of hexagon |
|
Height of hexagon |