luametafun-mesh.tex /size: 2683 b    last modification: 2023-12-21 09:43
1% language=us runpath=texruns:manuals/luametafun
2
3\environment luametafun-style
4\environment luametafun-mesh-examples
5
6% runtime
7
8\doiffileelse{luatex-mesh-examples.pdf} {
9    % okay
10} {
11    \ctxlua{os.execute("context luatex-mesh-examples.tex")}
12}
13
14\startcomponent luametafun-mesh
15
16\startchapter[title={Mesh}]
17
18This is more a gimmick than of real practical use. A mesh is a set of paths that
19gets transformed into hyperlinks. So, as a start you need to enable these:
20
21\starttyping[option=TEX]
22\setupinteraction
23  [state=start,
24   color=white,
25   contrastcolor=white]
26\stoptyping
27
28We just give a bunch of examples of meshes. A path is divided in smaller paths and
29each of them is part of the same hyperlink. An application is for instance clickable
30maps but (so far) only Acrobat supports such paths.
31
32\typebuffer[1][option=TEX]
33
34Such a definition is used as follows. First we define the mesh as overlay:
35
36\starttyping[option=TEX]
37\defineoverlay[MyPath1][\useMPgraphic{MyPath1}]
38\stoptyping
39
40Then, later on, this overlay can be used as background for a button. Here we just
41jump to another page. The rendering is shown in \in {figure} [mesh:1].
42
43\starttyping[option=TEX]
44\button
45  [height=3cm,
46   width=4cm,
47   background=MyPath1,
48   frame=off]
49  {Example 1}
50  [realpage(2)]
51\stoptyping
52
53\startplacefigure[reference=mesh:1]
54    \externalfigure[luametafun-mesh-examples][page=1,width=.45\textwidth]
55\stopplacefigure
56
57More interesting are non|-|rectangular shapes so we show a bunch of them. You can
58pass multiple paths, influence the accuracy by setting the number of steps and show
59the mesh with the tracing option.
60
61\typebuffer[2][option=TEX]
62\typebuffer[3][option=TEX]
63\typebuffer[4][option=TEX]
64\typebuffer[5][option=TEX]
65\typebuffer[6][option=TEX]
66\typebuffer[7][option=TEX]
67
68This is typical a feature that, if used at all, needs some experimenting but at
69least the traced images look interesting enough. The six examples are shown in
70\in {figure} [mesh:2].
71
72\startplacefigure[reference=mesh:2]
73    \startcombination[2*3]
74        {\externalfigure[luametafun-mesh-examples][page=2,width=.45\textwidth]} {\type {MyPath2}}
75        {\externalfigure[luametafun-mesh-examples][page=3,width=.45\textwidth]} {\type {MyPath3}}
76        {\externalfigure[luametafun-mesh-examples][page=4,width=.45\textwidth]} {\type {MyPath4}}
77        {\externalfigure[luametafun-mesh-examples][page=5,width=.45\textwidth]} {\type {MyPath5}}
78        {\externalfigure[luametafun-mesh-examples][page=6,width=.45\textwidth]} {\type {MyPath6}}
79        {\externalfigure[luametafun-mesh-examples][page=7,width=.45\textwidth]} {\type {MyPath7}}
80    \stopcombination
81\stopplacefigure
82
83\stopchapter
84
85\stopcomponent
86
87