glbarcode++
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
Drawing Primitives

The main characteristic of glbarcode++ that contributes to its extensibility is that barcodes are internally represented in a format that is independent of both symbology and output format. This format is a collection of atomic drawing elements or "Drawing Primitives."

All drawing primitives are derived from the glbarcode::DrawingPrimitive class. This class provides the following properties:

  • x – X coordinate of the drawing primitives origin (points) as measured from the upper left corner of the barcode.
  • y – Y coordinate of the drawing primitives origin (points) as measured from the upper left corner of the barcode.

Line Drawing Primitive

The line primitive is the primary building block for 1-D barcodes and describes a simple vertical line. It is represented by the glbarcode::DrawingPrimitiveLine class. This class extends glbarcode::DrawingPrimitive and provides the following properties:

  • w – Line width (points)
  • h – Height or length of the line (points)

The following illustrates these properties:

figure-primitive-line.svg
Line primitive properties

Box Drawing Primitive

The box primitive is intended to be the primary building block for 2-D barcodes and describes a solid box. It is represented by the glbarcode::DrawingPrimitiveBox class. This class extends glbarcode::DrawingPrimitive and provides the following properties:

  • w – Box width (points)
  • h – Box height (points)

The following illustrates these properties:

figure-primitive-box.svg
Box primitive properties

Text Drawing Primitive

The text primitive is intended to provide a human readable text representing the encoded data. It is represented by the glbarcode::DrawingPrimitiveText class. This class extends glbarcode::DrawingPrimitive and provides the following properties:

  • fsize – Font size (points)
  • s – String containing the text to render

The following illustrates these properties:

figure-primitive-text.svg
Text primitive properties

Ring Drawing Primitive

The ring primitive is a special-purpose drawing element which is intended to be used by the Maxicode symbology, which is not currently implemented by glbarcode++. This primitive exists because glabels supports it indirectly with its zint backend.

figure-primitive-ring.svg
Ring primitive properties

Hexagon Drawing Primitive

The hexagon primitive is a special-purpose drawing element which is intended to be used by the Maxicode symbology, which is not currently implemented by glbarcode++. This primitive exists because glabels supports it indirectly with its zint backend.

figure-primitive-hexagon.svg
Hexagon primitive properties