3 * Copyright (C) 2001-2010 Jim Evins <evins@snaught.com>.
5 * This file is part of libglbarcode.
7 * libglbarcode is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * libglbarcode is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with libglbarcode. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef __LGL_BARCODE_H__
22 #define __LGL_BARCODE_H__
29 /********************************/
30 /* Barcode Intermediate Format. */
31 /********************************/
35 * @width: Width of barcode bounding box (points)
36 * @height: Height of barcode bounding box (points)
37 * @shapes: List of #lglBarcodeShape drawing primitives
39 * This structure contains the libglbarcode intermediate barcode format. This
40 * structure contains a simple vectorized representation of the barcode. This
41 * vectorized representation is easy to interpret by a rendering backend for
42 * either vector or raster formats. A simple API is provided for constructing
43 * barcodes in this format.
51 GList *shapes; /* List of lglBarcodeShape drawing primitives */
56 /********************************/
57 /* Barcode Construction. */
58 /********************************/
60 lglBarcode *lgl_barcode_new (void);
62 void lgl_barcode_free (lglBarcode *bc);
64 void lgl_barcode_add_line (lglBarcode *bc,
70 void lgl_barcode_add_box (lglBarcode *bc,
76 void lgl_barcode_add_char (lglBarcode *bc,
82 void lgl_barcode_add_string (lglBarcode *bc,
89 void lgl_barcode_add_ring (lglBarcode *bc,
95 void lgl_barcode_add_hexagon (lglBarcode *bc,
100 /*******************************/
101 /* Barcode Drawing Primitives. */
102 /*******************************/
105 LGL_BARCODE_SHAPE_LINE,
106 LGL_BARCODE_SHAPE_BOX,
107 LGL_BARCODE_SHAPE_CHAR,
108 LGL_BARCODE_SHAPE_STRING,
109 LGL_BARCODE_SHAPE_RING,
110 LGL_BARCODE_SHAPE_HEXAGON
111 } lglBarcodeShapeType;
116 /* Begin Common Fields */
117 lglBarcodeShapeType type;
120 /* End Common Fields */
122 } lglBarcodeShapeAny;
126 * lglBarcodeShapeLine:
127 * @type: Always %LGL_BARCODE_SHAPE_LINE
128 * @x: x coordinate of top of line
129 * @y: y coordinate of top of line
130 * @length: Length of line
131 * @width: Width of line
133 * A vertical line drawing primitive.
137 * @ = origin (x,y) from top left corner of barcode
152 * All units are in points ( 1 point = 1/72 inch ).
156 /* Begin Common Fields */
157 lglBarcodeShapeType type; /* Always LGL_BARCODE_SHAPE_LINE. */
160 /* End Common Fields */
165 } lglBarcodeShapeLine;
169 * lglBarcodeShapeBox:
170 * @type: Always %LGL_BARCODE_SHAPE_BOX
171 * @x: x coordinate of top left corner of box
172 * @y: y coordinate of top left corner of box
173 * @width: Width of box
174 * @height: Height of box
176 * A solid box drawing primitive.
180 * @ = origin (x,y) from top left corner of barcode
195 * All units are in points ( 1 point = 1/72 inch ).
199 /* Begin Common Fields */
200 lglBarcodeShapeType type; /* Always LGL_BARCODE_SHAPE_BOX. */
203 /* End Common Fields */
208 } lglBarcodeShapeBox;
212 * lglBarcodeShapeChar:
213 * @type: Always %LGL_BARCODE_SHAPE_CHAR
214 * @x: x coordinate of left baseline of character
215 * @y: y coordinate of left baseline of character
217 * @c: Character to add
219 * An single byte character drawing primitive.
223 * @ = origin (x,y) from top left corner of barcode
229 * / ______ \ | ~fsize
233 * @ ----------------------
237 * All units are in points ( 1 point = 1/72 inch ).
241 /* Begin Common Fields */
242 lglBarcodeShapeType type; /* Always LGL_BARCODE_SHAPE_CHAR. */
245 /* End Common Fields */
250 } lglBarcodeShapeChar;
254 * lglBarcodeShapeString:
255 * @type: Always %LGL_BARCODE_SHAPE_STRING
256 * @x: x coordinate of horizontal center of baseline of string
257 * @y: y coordinate of horizontal center of baseline of string
259 * @string: String to add
260 * @length: Number of bytes in string
262 * A character string drawing primitive.
266 * @ = origin (x,y) from top left corner of barcode
268 * ____ _ ------------------
271 * / /__\ \ | |___ ____ |
272 * / ______ \ | ._ \ / __| | ~fsize
273 * / / \ \ | |_) | | (__ |
274 * /__/ \__\ |_.___/ \____| |
276 * @ ------------------
277 * x = horizontal center
281 * All units are in points ( 1 point = 1/72 inch ).
285 /* Begin Common Fields */
286 lglBarcodeShapeType type; /* Always LGL_BARCODE_SHAPE_STRING. */
289 /* End Common Fields */
294 } lglBarcodeShapeString;
298 * lglBarcodeShapeRing:
299 * @type: Always %LGL_BARCODE_SHAPE_RING
300 * @x: x coordinate of center of circle
301 * @y: y coordinate of center of circle
302 * @radius: Radius of ring (center of line)
303 * @line_width: Width of line
305 * A ring (an open circle) drawing primitive.
309 * @ = origin (x,y) is centre of circle
316 * | | @---|---|------
318 * \ `.____.' / | radius
319 * `._ ...._.'.......|
324 * All units are in points ( 1 point = 1/72 inch ).
329 /* Begin Common Fields */
330 lglBarcodeShapeType type; /* Always LGL_BARCODE_SHAPE_RING. */
333 /* End Common Fields */
338 } lglBarcodeShapeRing;
342 * lglBarcodeShapeHexagon:
343 * @type: Always %LGL_BARCODE_SHAPE_HEXAGON
344 * @x: x coordinate of top point of hexagon
345 * @y: y coordinate of top point of hexagon
346 * @height: Height of hexagon
348 * A solid regular hexagon (oriented with vertexes at top and bottom) drawing primitive.
352 * @ = origin (x,y) is top of hexagon
354 * @ ------------------
367 * " ------------------
371 * All units are in points ( 1 point = 1/72 inch ).
376 /* Begin Common Fields */
377 lglBarcodeShapeType type; /* Always LGL_BARCODE_SHAPE_HEXAGON. */
380 /* End Common Fields */
384 } lglBarcodeShapeHexagon;
389 lglBarcodeShapeType type;
390 lglBarcodeShapeAny any;
392 lglBarcodeShapeLine line;
393 lglBarcodeShapeBox box;
394 lglBarcodeShapeChar bchar;
395 lglBarcodeShapeString string;
396 lglBarcodeShapeRing ring;
397 lglBarcodeShapeHexagon hexagon;
404 #endif /* __LGL_BARCODE_H__ */
409 * Local Variables: -- emacs
411 * c-basic-offset: 8 -- emacs
412 * tab-width: 8 -- emacs
413 * indent-tabs-mode: nil -- emacs