<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% !TeX program = LuaLaTeX
% Copyright (C) 2019-2022 Roberto Giacomelli

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Libertinus Serif}

\usepackage[margin=18mm]{geometry}
\usepackage{array}
\usepackage{booktabs}

\newcolumntype{C}{&gt;{\ttfamily}c}
\newcolumntype{L}{&gt;{\ttfamily}l}

\begin{document}
Goal: describe geometrical object like lines and rectangles
mainly for a barcode drawing library.



\section{\texttt{ga} instruction set}

A graphic data specification format called '\texttt{ga}' \emph{graphic alchemy},
or if you want \emph{generic graphic assembler}.

\begin{verbatim}
ga&lt;DIM, UINT&gt; := generic graphic assembler
    &lt;DIM&gt;  := numeric type parameter for dimension, for example f64 or i32
    &lt;UINT&gt; := numeric type parameter for quantity, an unsigned integer, i.e. u8

ga&lt;DIM, UINT&gt; := +Elem&lt;DIM, UINT&gt;

Elem&lt;DIM, UINT&gt; := Code&lt;u8&gt; + Args&lt;DIM, UINT&gt;

Code&lt;u8&gt; := State&lt;u8&gt; | Object&lt;u8&gt; | Fn&lt;u8&gt;
    State&lt;u8&gt;  :=   1 -&gt;  31 -- graphic properties
    Object&lt;u8&gt; :=  32 -&gt; 239 -- graphic objects
    Fn&lt;u8&gt;     := 240 -&gt; 255 -- functions

Args&lt;DIM, UINT&gt; : &lt;x: DIM&gt; | &lt;e: u8&gt; | &lt;n: UINT&gt; | &lt;c: CHARS&gt;
   &lt;x: DIM&gt;    := a dimension value of type DIM
   &lt;e: u8&gt;     := an enumeration value of type u8 (unsigned byte)
   &lt;n: UINT&gt;   := an unsigned integer for multiplicity
   &lt;c: CHARS&gt;  := chars sequence ended with 0
\end{verbatim}



\section{Properties}

Colors, linecap style etc\dots

\noindent\begin{tabular}{CLlL}
\toprule
OpCode &amp; Mnemonic key &amp; Graphic property &amp; Operands\\
\midrule
 1 &amp; pen\_thick &amp; Line thick          &amp;  &lt;w: DIM&gt;\\
 2 &amp; line\_cap\_style &amp; Line cap style &amp;  &lt;e: u8&gt;\\
 3 &amp; line\_join\_style &amp; Line join style &amp;  &lt;e: u8&gt;\\
 8 &amp; color &amp; ... \\
\midrule
29 &amp; enable\_bbox &amp; start to update the bounding box &amp; -\\
30 &amp; disable\_bbox &amp; Stop to check the bounding box &amp; -\\
31 &amp; set\_bbox &amp; Set a bounding box &amp;  &lt;x1: DIM&gt; &lt;y1: DIM&gt; &lt;x2: DIM&gt; &lt;y2: DIM&gt;\\
\bottomrule
\end{tabular}



\section{Objects}

\subsection{Lines}

A segment that starts from point P1 (x1, y1) and ends to P2 (x2, y2).

\noindent\begin{tabular}{CLlL}
\toprule
OpCode &amp; Mnemonic key &amp; Graphic object &amp; Operands\\
\midrule
32 &amp; line  &amp; Line            &amp; &lt;x1: DIM&gt; &lt;y1: DIM&gt; &lt;x2: DIM&gt; &lt;y2: DIM&gt;\\
33 &amp; hline &amp; Horizontal line &amp; &lt;x1: DIM&gt; &lt;x2: DIM&gt; &lt;y: DIM&gt;\\
34 &amp; vline &amp; Vertical line   &amp; &lt;y1: DIM&gt; &lt;y2: DIM&gt; &lt;x: DIM&gt;\\
\midrule
36 &amp; vbar &amp; Vertical bars     &amp; &lt;y1: DIM&gt; &lt;y2: DIM&gt; &lt;b: UINT&gt; &lt;x1: DIM&gt; &lt;t1: DIM&gt; ...\\
37 &amp; hbar &amp; Horizontal bars   &amp; &lt;x1: DIM&gt; &lt;x2: DIM&gt; &lt;b: UINT&gt; &lt;y1: DIM&gt; &lt;t1: DIM&gt; ...\\
\midrule
38 &amp; polyline &amp; Open polyline  &amp; &lt;n: UINT&gt; &lt;x1: DIM&gt; &lt;y1: DIM&gt; &lt;x2: DIM&gt; &lt;y2: DIM&gt; ...\\
39 &amp; c\_polyline &amp; Closed polyline   &amp; &lt;n: UINT&gt; &lt;x1: DIM&gt; &lt;y1: DIM&gt; &lt;x2: DIM&gt; &lt;y2: DIM&gt; ...\\
\bottomrule
\end{tabular}


\subsection{Rectangles}

\noindent\begin{tabular}{CLlL}
\toprule
OpCode &amp; Mnemonic key &amp; Graphic object &amp; Operands\\
\midrule
 48 &amp; rect &amp; Rectangle &amp; &lt;x1: DIM&gt; &lt;y1: DIM&gt; &lt;x2: DIM&gt; &lt;y2: DIM&gt;\\
 49 &amp; f\_rect &amp; Filled rectangle &amp; &lt;x1: DIM&gt; &lt;y1: DIM&gt; &lt;x2: DIM&gt; &lt;y2: DIM&gt;\\
 50 &amp; rect\_size &amp; Rectangle &amp; &lt;x1: DIM&gt; &lt;y1: DIM&gt; &lt;w: DIM&gt; &lt;h: DIM&gt;\\
 51 &amp; f\_rect\_size &amp; Filled rectangle &amp; &lt;x1: DIM&gt; &lt;y1: DIM&gt; &lt;w: DIM&gt; &lt;h: DIM&gt;\\
\bottomrule
\end{tabular}


\subsection{Text}

\noindent\begin{tabular}{CLl}
\toprule
OpCode &amp; Mnemonic key &amp; Graphic object/Operands\\
\midrule
 130 &amp; text         &amp; A text with several glyphs\\
     &amp; &amp; \ttfamily &lt;ax: FLOAT&gt; &lt;ay: FLOAT&gt; &lt;xpos: DIM&gt; &lt;ypos: DIM&gt; &lt;c: CHARS&gt;\\
\midrule
 131 &amp; text\_xspaced &amp; A text with glyphs equally spaced on its vertical axis\\
     &amp; &amp; \ttfamily &lt;x1: DIM&gt; &lt;xgap: DIM&gt; &lt;ay: FLOAT&gt; &lt;ypos: DIM&gt; &lt;c: CHARS&gt;\\
\midrule
 132 &amp; text\_xwidth &amp; Glyphs equally spaced on vertical axis between two x coordinates\\
      &amp; &amp; \ttfamily &lt;ay: FLOAT&gt; &lt;x1: DIM&gt; &lt;x2: DIM&gt; &lt;y: DIM&gt; &lt;c: CHARS&gt;\\
\midrule
     &amp; under design assessment\\
 140 &amp; \_text\_group &amp; Texts on the same baseline \\
     &amp; &amp; \ttfamily &lt;ay: DIM&gt; &lt;y: DIM&gt; &lt;n: UINT&gt; &lt;&lt;xi: DIM&gt; &lt;ai: FLOAT&gt; &lt;ci: CHARS&gt;&gt; \\
\bottomrule
\end{tabular}


\subsection{Function}


\noindent\begin{tabular}{CLlL}
\toprule
OpCode &amp; Mnemonic key &amp; Function &amp; Operands\\
\midrule
 240 &amp; move &amp; Translate objects &amp;  &lt;n: UINT&gt; &lt;dx: DIM&gt; &lt;dy: UINT&gt;\\
 241 &amp; copy &amp; Copy object &amp;  &lt;n: UINT&gt; &lt;c: UINT&gt; &lt;dx1: DIM&gt; &lt;dy1: UINT&gt; ...\\
 242 &amp; and\_copy &amp; Place and copy objects &amp;  &lt;n: UINT&gt; &lt;c: UINT&gt; &lt;dx1: DIM&gt; &lt;dy1: UINT&gt; ...\\
 243 &amp; grid &amp; Copy next \(n\) objects on a grid &amp;  &lt;n: UINT&gt; &lt;col: UINT&gt; &lt;row: UINT&gt; &lt;dx: DIM&gt; &lt;dy: DIM&gt;\\
 244 &amp; sl\_grid\\
 250 &amp; mirror\\
 255 &amp; comment &amp; A string comment &amp;  &lt;s: STRING&gt;\\
\bottomrule
\end{tabular}


\end{document}
</pre></body></html>