summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/barracuda/doc/barracuda-ga-asm.tex
blob: 1c403455f86f59554525b6c7f3ae9f736c5f8fba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
% !TeX program = LuaLaTeX
% Copyright (C) 2019 Roberto Giacomelli

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Libertinus Serif}

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

\newcolumntype{C}{>{\ttfamily}c}
\newcolumntype{L}{>{\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<DIM, UINT> := generic graphic assembler
    <DIM>  := numeric type parameter for dimension, for example f64 or i32
    <UINT> := numeric type parameter for quantity, an unsigned integer, i.e. u8

ga<DIM, UINT> := +Elem<DIM, UINT>

Elem<DIM, UINT> := Code<u8> + Args<DIM, UINT>

Code<u8> := State<u8> | Object<u8> | Fn<u8>
    State<u8>  :=   1 ->  31 -- graphic properties
    Object<u8> :=  32 -> 239 -- graphic objects
    Fn<u8>     := 240 -> 255 -- functions

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



\section{Properties}

Colors, linecap style etc\dots

\noindent\begin{tabular}{CLlL}
\toprule
OpCode & Mnemonic key & Graphic property & Operands\\
\midrule
 1 & pen\_thick & Line thick          &  <w: DIM>\\
 2 & line\_cap\_style & Line cap style &  <e: u8>\\
 3 & line\_join\_style & Line join style &  <e: u8>\\
 8 & color & ... \\
\midrule
30 & start\_bbox\_group & Stop to check the bounding box & -\\
31 & end\_bbox\_group   & Set a bounding box and restart to check &  <x1: DIM> <y1: DIM> <x2: DIM> <y2: DIM>\\
\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 & Mnemonic key & Graphic object & Operands\\
\midrule
32 & line  & Line            & <x1: DIM> <y1: DIM> <x2: DIM> <y2: DIM>\\
33 & hline & Horizontal line & <x1: DIM> <x2: DIM> <y: DIM>\\
34 & vline & Vertical line   & <y1: DIM> <y2: DIM> <x: DIM>\\
\midrule
36 & vbar & Vertical bars     & <y1: DIM> <y2: DIM> <b: UINT> <x1: DIM> <t1: DIM> ...\\
37 & hbar & Horizontal bars   & <x1: DIM> <x2: DIM> <b: UINT> <y1: DIM> <t1: DIM> ...\\
\midrule
38 & polyline & Open polyline  & <n: UINT> <x1: DIM> <y1: DIM> <x2: DIM> <y2: DIM> ...\\
39 & c\_polyline & Closed polyline   & <n: UINT> <x1: DIM> <y1: DIM> <x2: DIM> <y2: DIM> ...\\
\bottomrule
\end{tabular}


\subsection{Rectangles}

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

\bottomrule
\end{tabular}


\subsection{Text}

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


\subsection{Function}


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


\end{document}