]> git.sur5r.net Git - glabels/blobdiff - docs/libglbarcode/html/libglbarcode-intro.html
Imported Upstream version 3.0.0
[glabels] / docs / libglbarcode / html / libglbarcode-intro.html
diff --git a/docs/libglbarcode/html/libglbarcode-intro.html b/docs/libglbarcode/html/libglbarcode-intro.html
new file mode 100644 (file)
index 0000000..8261dfc
--- /dev/null
@@ -0,0 +1,166 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Introduction</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="LibGlbarcode 3.0 Reference Manual">
+<link rel="up" href="overview.html" title="LibGlbarcode Overview">
+<link rel="prev" href="overview.html" title="LibGlbarcode Overview">
+<link rel="next" href="api.html" title="API Reference">
+<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="overview.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="overview.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">LibGlbarcode 3.0 Reference Manual</th>
+<td><a accesskey="n" href="api.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="libglbarcode-intro"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="libglbarcode-intro.top_of_page"></a>Introduction</span></h2>
+<p>Introduction — 
+Introduction to libglbarcode library
+</p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="id2963460"></a><h2>Overview</h2>
+<p>
+Libglbarcode provides the core barcode functionality for <span class="application">glabels</span>.  It provides
+an intermediate barcode format, a small set of built-in barcode back-ends, and a cairo renderer.  While
+libglbarcode does not currently include a large set of built-in barcode back-ends or renderers, its
+simple architecture would easily support extending its functionality beyond the needs of
+<span class="application">glabels</span>.
+</p>
+</div>
+<div class="refsect1">
+<a name="id2963536"></a><h2>Basic Usage</h2>
+<pre class="programlisting">
+
+#include &lt;libglbarcode/lgl-barcode-create.h&gt;
+#include &lt;libglbarcode/lgl-barcode-render-to-cairo.h&gt;
+
+void
+example (gchar   *data,
+         cairo_t *cr)
+{
+        glBarcode *bc;
+
+        bc = lgl_barcode_create (LGL_BARCODE_TYPE_CODE39, TRUE, FALSE, 0, 0, data);
+
+        /* Render to cairo context.  Assume context has appropriate scale and translation.
+         * Scale should be such that world units are points (1 point = 1/72 inch) and that
+         * positive y values go downward.
+         */
+        lgl_barcode_render_to_cairo (bc, cr);
+
+        lgl_free (bc);
+}
+
+</pre>
+</div>
+<div class="refsect1">
+<a name="id2963569"></a><h2>Writing Renderers</h2>
+<p>
+The <a class="link" href="libglbarcode-3.0-lgl-barcode.html#lglBarcode" title="lglBarcode">lglBarcode</a> structure is independent of
+barcode type, and consists of a simple list of drawing primitives.
+A renderer simply traverses this list translating these primitives into native
+drawing commands for its target format or device.
+All renderers will follow this simple pattern as illustrated in the example
+below.
+</p>
+<pre class="programlisting">
+
+#include &lt;libglbarcode/lgl-barcode.h&gt;
+#include &lt;xxx.h&gt;
+
+void
+lgl_barcode_render_to_xxx (const lglBarcode  *bc)
+{
+        GList                  *p;
+
+        lglBarcodeShape        *shape;
+        lglBarcodeShapeLine    *line;
+        lglBarcodeShapeBox     *box;
+        lglBarcodeShapeChar    *bchar;
+        lglBarcodeShapeString  *bstring;
+        lglBarcodeShapeRing    *ring;
+        lglBarcodeShapeHexagon *hexagon;
+
+
+        for (p = bc-&gt;shapes; p != NULL; p = p-&gt;next) {
+
+                shape = (lglBarcodeShape *)p-&gt;data;
+
+                switch (shape-&gt;type)
+                {
+
+                case LGL_BARCODE_SHAPE_LINE:
+                        line = (lglBarcodeShapeLine *) shape;
+
+                        xxx_plot_line (line-&gt;x, line-&gt;y,
+                                       line-&gt;x, line-&gt;y + line-&gt;length,
+                                       line-&gt;width );
+                        break;
+
+                case LGL_BARCODE_SHAPE_BOX:
+                        box = (lglBarcodeShapeBox *) shape;
+
+                        xxx_plot_rectangle (box-&gt;x, box-&gt;y,
+                                            box-&gt;width, box-&gt;height);
+                        break;
+
+                case LGL_BARCODE_SHAPE_CHAR:
+                        bchar = (lglBarcodeShapeChar *) shape;
+
+                        ...
+                        xxx_plot_char (...);
+                        break;
+
+                case LGL_BARCODE_SHAPE_STRING:
+                        bstring = (lglBarcodeShapeString *) shape;
+
+                        ...
+                        xxx_plot_string (...);
+                        break;
+
+                case LGL_BARCODE_SHAPE_RING:
+                        ring = (lglBarcodeShapeRing *) shape;
+
+                        ...
+                        xxx_plot_circle (...);
+                        break;
+
+                case LGL_BARCODE_SHAPE_HEXAGON:
+                        hexagon = (lglBarcodeShapeHexagon *) shape;
+
+                        ...
+                        xxx_plot_polygon (...);
+                        break;
+
+                default:
+                        g_assert_not_reached ();
+                        break;
+
+                }
+
+        }
+
+}
+
+
+</pre>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.17</div>
+</body>
+</html>
\ No newline at end of file