grph-inc.mkiv /size: 37 Kb    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=grph-inc, % moved from core-fig
3
%D version=2006.08.26, % overhaul of 1997.03.31
4
%D title=\CONTEXT\ Graphic Macros,
5
%D subtitle=Figure Inclusion,
6
%D author=Hans Hagen,
7
%D date=\currentdate,
8
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
%C
10
%C This module is part of the \CONTEXT\ macro||package and is
11
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12
%C details.
13 14
% \enabledirectives[graphics.conversion.eps.cleanup.ai]
15 16
% \setupexternalfigures[directory=dirfile://./test/**]
17
% \externalfigure[crappname(2).eps][frame=on]
18 19
% todo: messages
20 21
\writestatus
{
loading
}{
ConTeXt
Graphic
Macros
/
Figure
Inclusion
}
22 23
\registerctxluafile
{
grph
-
img
}{}
24
\registerctxluafile
{
grph
-
inc
}{}
25 26
\ifcase
\contextlmtxmode
\else
27
\registerctxluafile
{
grph
-
bmp
}{}
28
\registerctxluafile
{
grph
-
chk
}{}
29
\fi
30 31
\registerctxluafile
{
grph
-
con
}{}
32
\registerctxluafile
{
grph
-
fil
}{}
33
\registerctxluafile
{
grph
-
mem
}{}
34
\registerctxluafile
{
grph
-
u
3
d
}{}
% this will become a module
35
\registerctxluafile
{
grph
-
swf
}{}
% this will become a module
36 37
\unprotect
38 39
%D Including graphics is complicated by the fact that we need to locate them first,
40
%D optionally manipulate them and scale then next. Lookups are to be done as efficient
41
%D as possible and inclusion of the data might happens only once. In \MKIV\ much of this
42
%D is delegated to the \LUA\ end. There is not so much less code as in \MKII\ but it's
43
%D more powerful, flexible, pluggable and some of the extended functionality has been
44
%D moved from modules to the core. The overall functionality is rather stable and has
45
%D not changed much over the years.
46 47
\ifdefined
\dotagfigure
\else
\let
\dotagfigure
\relax
\fi
48 49
\installcorenamespace
{
externalfigure
}
50
\installcorenamespace
{
externalfigureinstance
}
51
\installcorenamespace
{
externalfigurecollection
}
52 53
\installframedcommandhandler
\??externalfigure
{
externalfigure
}
\??externalfigure
54 55
\let
\setupexternalfigures\setupexternalfigure
56 57
\setupexternalfigures
[
% we really need the defaults
58
\c!method
=
,
59
\c!label
=
,
60
\c!size
=
,
61
\c!conversion
=
,
62
\c!resolution
=
,
63
\c!prefix
=
,
64
\c!cache
=
,
65
\c!page
=
\zerocount
,
66
\c!file
=
,
67
\c!display
=
,
68
\c!mask
=
,
69
\c!preset
=
\v!yes
,
70
\c!split
=
,
71
\c!color
=
,
72
\c!arguments
=
,
73
\c!symbol
=
\v!no
,
74
\c!controls
=
\v!no
,
75
\c!resources
=
,
76
\c!preview
=
\v!no
,
77
\c!repeat
=
\v!no
,
78
\c!foregroundcolor
=
,
79
\c!interaction
=
\v!none
,
80
\c!hfactor
=
,
81
\c!wfactor
=
,
82
\c!factor
=
,
83
\c!maxwidth
=
\externalfigureparameter
\c!width
,
84
\c!maxheight
=
\externalfigureparameter
\c!height
,
85
\c!xscale
=
,
86
\c!yscale
=
,
87
\c!scale
=
,
88
\c!sx
=
\externalfigureparameter
\c!s
,
89
\c!sy
=
\externalfigureparameter
\c!s
,
90
\c!s
=
1
,
91
\c!width
=
,
92
\c!height
=
,
93
\c!lines
=
,
94
\c!grid
=
,
95
\c!bodyfont
=
\bodyfontsize
,
96
\c!object
=
\v!yes
,
97
\c!corner
=
\v!rectangular
,
98
\c!frame
=
\v!off
,
99
\c!option
=
,
100
\c!reset
=
\v!no
,
101
\c!directory
=
,
102
\c!radius
=
.
5
\bodyfontsize
,
103
\c!background
=
,
104
\c!splitcolor
=
\s!white
,
105
\c!order
=
,
106
\c!equalwidth
=
,
107
\c!equalheight
=
,
108
\c!location
=
{
\v!local
,
\v!global
}
,
109
\c!frames
=
\v!off
,
110
\c!ymax
=
2
4
,
111
\c!xmax
=
,
112
\c!align
=
\v!none
,
% New, for Tacos extremely large graphics.
113
\c!crossreference
=
\v!no
,
114
\c!transform
=
\v!auto
,
115
\c!userpassword
=
,
116
\c!ownerpassword
=
,
117
\c!compact
=
,
118
\c!cmyk
=
,
119
]
120 121
%D Defining figures.
122 123
\newcount
\c_grph_include_nesting
124 125
\newtoks
\everyexternalfigureresets
% for the moment still public
126
\newtoks
\everyexternalfigurechecks
% for the moment still public
127 128
% \useexternalfigure[alpha][cow]
129
% \useexternalfigure[beta] [cow] [width=1cm]
130
% \useexternalfigure[gamma][cow][alpha]
131
% \useexternalfigure[delta][cow][alpha][width=2cm]
132
%
133
% full width : \externalfigure[cow] \par
134
% 3cm width : \externalfigure[cow] [width=3cm] \par
135
% full width : \externalfigure[alpha] \par
136
% 1cm width : \externalfigure[beta] \par
137
% full width : \externalfigure[gamma] \par
138
% 2cm width : \externalfigure[delta] \par
139
% 4cm width : \externalfigure[beta] [width=4cm] \par
140
% 5cm width : \externalfigure[gamma][width=5cm] \par
141
%
142
% \defineexternalfigure[a][width=10cm]
143
% \defineexternalfigure[b][width=5cm]
144
% \externalfigure[cow][a]
145
% \externalfigure[cow][b][height=8cm]
146
%
147
% \useexternalfigure[x][cow][width=10cm,height=1cm]
148
% \externalfigure[x]
149
% \externalfigure[x][width=3cm]
150
%
151
% [label] [filename]
152
% [label] [filename] [parent]
153
% [label] [filename] [parent] [settings]
154
% [label] [filename] [settings]
155
%
156
% new: more convenient/efficient than
157
%
158
% \use..[a][a][setting] \externalfigure[b][a]
159
%
160
% is equivalent to:
161
%
162
% \def..[a][setting] \externalfigure[b][a]
163
%
164
% see x-res modules for usage:
165
%
166
% \defineexternalfigure[name][settings]
167 168
%D Defining is persistent, i.e.\ when you redefine an instance, the already set
169
%D parameters need to be set again or otherwise the old values will be used.
170
%D
171
%D New: \type {method=auto}: strips suffix and uses \quote {order} which is handy in
172
%D some of four workflows where sources are used for web and print and where the web
173
%D tools need a suffix (like gif) which we don't want as we want a high quality
174
%D format.
175 176
\newconditional
\c_grph_include_trace_inheritance
177 178
\installtextracker
179
{
graphics
.
inheritance
}
180
{
\settrue
\c_grph_include_trace_inheritance
}
181
{
\setfalse
\c_grph_include_trace_inheritance
}
182 183
\installcorenamespace
{
externalfiguredefinition
}
184 185
% \unexpanded\def\defineexternalfigure
186
% {\dodoubleargument\grph_include_define}
187
%
188
% \def\grph_include_define[#1][#2]%
189
% {\setvalue{\??externalfiguredefinition#1}{\setupcurrentexternalfigure[#2]}}
190 191
\let
\defineexternalfigures
\defineexternalfigure
192 193
\unexpanded
\def
\useexternalfigure
194
{
\doquadrupleempty
\grph_include_use
}
195 196
% label file parent settings
197
% label file settings
198
% label file parent
199 200
% \def\grph_include_use[#1][#2][#3][#4]%
201
% {\doifelsenothing{#1}
202
% {\doifsomething{#2}
203
% {\doifelseassignment{#3}
204
% {\grph_include_use_indeed{#2}{#2}{#3}{#4}}
205
% {\grph_include_use_indeed{#2}{#2}\empty{#4}}}}
206
% {\doifelsenothing{#2}
207
% {\doifelseassignment{#3}
208
% {\grph_include_use_indeed{#1}{#1}\empty{#3}}
209
% {\grph_include_use_indeed{#1}{#1}{#3}{#4}}}
210
% {\doifelseassignment{#3}
211
% {\grph_include_use_indeed{#1}{#2}\empty{#3}}
212
% {\grph_include_use_indeed{#1}{#2}{#3}{#4}}}}}
213 214
\def
\grph_include_use
[#
1
][#
2
][#
3
][#
4
]
%
215
{
\doifelsenothing
{
#
1
}
216
{
\doifsomething
{
#
2
}
217
{
\ifcondition
\validassignment
{
#
3
}
%
218
\grph_include_use_indeed
{
#
2
}{
#
2
}{
#
3
}{
#
4
}
%
219
\else
220
\grph_include_use_indeed
{
#
2
}{
#
2
}
\empty
{
#
4
}
%
221
\fi
}}
%
222
{
\doifelsenothing
{
#
2
}
223
{
\ifcondition
\validassignment
{
#
3
}
%
224
\grph_include_use_indeed
{
#
1
}{
#
1
}
\empty
{
#
3
}
%
225
\else
226
\grph_include_use_indeed
{
#
1
}{
#
1
}{
#
3
}{
#
4
}
%
227
\fi
}
228
{
\ifcondition
\validassignment
{
#
3
}
%
229
\grph_include_use_indeed
{
#
1
}{
#
2
}
\empty
{
#
3
}
230
\else
231
\grph_include_use_indeed
{
#
1
}{
#
2
}{
#
3
}{
#
4
}
%
232
\fi
}}}
233 234
\def
\grph_include_use_indeed
#
1
#
2
#
3
#
4
%
235
{
\dodoglobal\setvalue
{
\??externalfigureinstance
#
1
}{
\grph_include_setup
{
#
2
}{
#
3
}{
#
4
}}
%
236
\grph_include_analyze_collection
[#
2
][#
4
]
}
237 238
% inclusion
239 240
\unexpanded
\def
\externalfigure
241
{
\dotripleempty
\grph_include_figure
}
242 243
\def
\grph_include_figure
[#
1
][#
2
][#
3
]
%
244
% {\docheckassignment{#2}%
245
% \ifassignment
246
{
\ifcondition
\validassignment
{
#
2
}
%
247
\grph_include_place
[#
1
][][#
2
]
%
248
\else
249
\grph_include_place
[#
1
][#
2
][#
3
]
%
250
\fi
}
251 252
% todo: chain them
253 254
\def
\grph_include_setup
#
1
#
2
#
3
% name parent settings
255
{
\edef
\m_grph_include_name
{
#
1
}
%
256
\edef
\m_grph_include_parent
{
#
2
}
%
257
\ifx
\m_grph_include_name
\empty
\else
258
\let
\p_grph_include_name
\m_grph_include_name
259
\fi
260
\ifx
\m_grph_include_parent
\empty
\else
261
\grph_include_inherit_from_parent
\m_grph_include_parent
262
\fi
263
\setupcurrentexternalfigure
[#
3
]
}
264 265
% \def\grph_include_inherit_from_parent#1%
266
% {\ifcsname\??externalfiguredefinition#1\endcsname
267
% \ifconditional\c_grph_include_trace_inheritance\c_grph_include_trace_inheritance\writestatus\m!figures{inheriting from definition: #1}\fi
268
% \csname\??externalfiguredefinition#1\endcsname
269
% \fi
270
% \ifcsname\??externalfigureinstance#1\endcsname
271
% \ifconditional\c_grph_include_trace_inheritance\c_grph_include_trace_inheritance\writestatus\m!figures{inheriting from instance: #1}\fi
272
% \csname\??externalfigureinstance#1\endcsname
273
% \fi}
274 275
\def
\grph_include_inherit_from_parent
#
1
%
276
{
%\ifcsname\??externalfiguredefinition#1\endcsname
277
% \ifconditional\c_grph_include_trace_inheritance\writestatus\m!figures{inheriting from definition: #1}\fi
278
% \csname\??externalfiguredefinition#1\endcsname
279
%\fi
280
\ifcsname
\??externalfigure
#
1
:
\s!parent
\endcsname
281
\let
\currentexternalfigure
#
1
%
282
\fi
283
\ifcsname
\??externalfigureinstance
#
1
\endcsname
284
\ifconditional
\c_grph_include_trace_inheritance
\writestatus
\m!figures
{
inheriting
from
instance
:
#
1
}
\fi
285
\csname
\??externalfigureinstance
#
1
\endcsname
286
\fi
}
287 288
\newtoks
\t_grph_include_local_settings
289 290
\appendtoks
291
\let
\textunderscore\letterunderscore
% {\string _} % space needed as _ is now letter in unprotected mode (probably no longer needed)
292
%
293
\dontcomplain
294
\restorecatcodes
295
\forgetall
296
\to
\t_grph_include_local_settings
297 298
\def
\grph_include_place_inherit
299
{
\ifconditional
\c_grph_include_trace_inheritance
300
\writestatus
\m!figures
{
label
:
\p_grph_include_label
,
name
:
\p_grph_include_name
,
parent
:
\p_grph_include_parent
}
%
301
\fi
302
\ifx
\p_grph_include_parent
\empty
303
% nothing to be done
304
\else\ifx
\p_grph_include_parent
\p_grph_include_label
305
% redundant
306
\else
307
\grph_include_inherit_from_parent
\p_grph_include_parent
308
\fi\fi
309
\ifx
\p_grph_include_label
\empty
310
% nothing to be done
311
\else
312
\grph_include_inherit_from_parent
\p_grph_include_label
313
\fi
}
314 315
\def
\grph_include_place
[#
1
][#
2
][#
3
]
% [label][file][settings] | [file][settings] | [file][parent][settings]
316
{
\bgroup
317
\advance
\c_grph_include_nesting
\plusone
318
\edef
\currentexternalfigure
{
\the
\c_grph_include_nesting
}
%
319
\checkexternalfigureparent
% each inherits from the root
320
%
321
\the
\everyexternalfigureresets
322
%
323
\edef
\p_grph_include_label
{
#
1
}
%
324
\let
\p_grph_include_name
\p_grph_include_label
325
% \docheckassignment{#2}%
326
% \ifassignment
327
\ifcondition
\validassignment
{
#
2
}
%
328
% [label] [settings]
329
\let
\p_grph_include_parent
\p_grph_include_label
330
\grph_include_place_inherit
331
\setupcurrentexternalfigure
[#
2
]
%
332
\else
333
% [label] [parent] [settings]
334
\edef
\p_grph_include_parent
{
#
2
}
%
335
\ifx
\p_grph_include_parent
\empty
336
\let
\p_grph_include_parent
\p_grph_include_label
337
\fi
338
\grph_include_place_inherit
339
\setupcurrentexternalfigure
[#
3
]
%
340
\fi
341
%
342
\the
\everyexternalfigurechecks
343
%
344
\the
\t_grph_include_local_settings
345
%
346
\edef
\p_width
{
\externalfigureparameter
\c!width
}
%
347
\edef
\p_height
{
\externalfigureparameter
\c!height
}
%
348
\edef
\p_label
{
\externalfigureparameter
\c!label
}
%
349
\edef
\p_reference
{
\externalfigureparameter
\c!reference
}
%
350
%
351
\dostarttagged
\t!image
\empty
352
\clf_figure_push
{
353
name
{
\p_grph_include_name
}
%
354
label
{
\ifx
\p_label
\empty
\p_grph_include_label
\else
\p_label
\fi
}
%
355
page
{
\externalfigureparameter
\c!page
}
%
356
file
{
\externalfigureparameter
\c!file
}
%
357
size
{
\externalfigureparameter
\c!size
}
%
358
object
{
\externalfigureparameter
\c!object
}
%
359
prefix
{
\externalfigureparameter
\c!prefix
}
%
360
cache
{
\externalfigureparameter
\c!cache
}
%
361
format
{
\externalfigureparameter
\c!method
}
%
362
preset
{
\externalfigureparameter
\c!prefix
}
%
363
controls
{
\externalfigureparameter
\c!controls
}
%
364
resources
{
\externalfigureparameter
\c!resources
}
%
365
preview
{
\externalfigureparameter
\c!preview
}
%
366
display
{
\externalfigureparameter
\c!display
}
%
367
mask
{
\externalfigureparameter
\c!mask
}
%
368
conversion
{
\externalfigureparameter
\c!conversion
}
%
369
resolution
{
\externalfigureparameter
\c!resolution
}
%
370
color
{
\externalfigureparameter
\c!color
}
% unprocessed raw key
371
cmyk
{
\externalfigureparameter
\c!cmyk
}
% kind of special
372
arguments
{
\externalfigureparameter
\c!arguments
}
% used for converters
373
repeat
{
\externalfigureparameter
\c!repeat
}
%
374
transform
{
\externalfigureparameter
\c!transform
}
%
375
compact
{
\externalfigureparameter
\c!compact
}
% experiment, share fonts
376
userpassword
{
\externalfigureparameter
\c!userpassword
}
%
377
ownerpassword
{
\externalfigureparameter
\c!ownerpassword
}
%
378
\ifx
\p_width
\empty
\else
379
width
\dimexpr
\p_width
\relax
380
\fi
381
\ifx
\p_height
\empty
\else
382
height
\dimexpr
\p_height
\relax
383
\fi
384
}
%\relax
385
\clf_figure_identify
386
\relax
387
\ifconditional
\c_grph_include_test_only
388
\ifcase
\figurestatus
\else
389
\clf_figure_check
390
\clf_figure_dummy
391
\clf_figure_scale
392
\clf_figure_done
393
\fi
394
\grph_include_set_mode
395
\else
396
\ifcase
\figurestatus
397
\clf_figure_dummy
398
\clf_figure_scale
399
\else
400
\clf_figure_check
401
\clf_figure_include
402
\clf_figure_scale
403
\fi
404
\clf_figure_done
405
\grph_include_set_mode
406
\grph_include_finalize
407
\fi
408
\clf_figure_pop
409
\dotagfigure
410
%
411
\scratchcounter
\zerocount
412
\edef
\p_crossreference
{
\externalfigureparameter
\c!crossreference
}
%
413
\iflocation\iftrialtypesetting
\else
414
\ifx
\p_crossreference
\empty
415
% nothing
416
\else\ifx
\p_crossreference
\v!no
417
% nothing
418
\else\ifx
\p_crossreference
\v!yes
419
\ifassignment
420
\scratchcounter
\clf_figure_register_page
{
#
1
}{}{
#
2
}
\relax
421
\else
422
\scratchcounter
\clf_figure_register_page
{
#
1
}{
#
2
}{
#
3
}
\relax
423
\fi
424
\else
425
\scratchcounter
-
\p_crossreference
% passed by repeater
426
\fi\fi\fi
427
\fi\fi
428
\naturalvpack
429
attr
\imageattribute
\plustwo
430
\ifnum
\scratchcounter
>
\zerocount
431
{
\strc_references_cross_forward
{
ex
:
\number
\scratchcounter
}{
\box
\foundexternalfigure
}}
%
432
\else\ifnum
\scratchcounter
<
\zerocount
433
{
\strc_references_cross_backward
{
ex
:
\number
-
\scratchcounter
}{
\box
\foundexternalfigure
}}
%
434
\else
435
{
\box
\foundexternalfigure
}
%
436
\fi\fi
437
%
438
\dostoptagged
439
\egroup
}
440 441
%D Next we provide a cross referenced scale-up mechanism:
442 443
\def
\strc_references_cross_forward
#
1
#
2
%
444
{
\begingroup
445
\strc_references_set_simple_internal_reference
{
cross
:
b
:
#
1
}
%
446
\naturalhpack
447
attr
\destinationattribute
\number
\lastdestinationattribute
448
{
\naturalhpack
{
\strc_references_flush_destination_nodes
\directgotodumbbox
{
#
2
}
[
cross
:
f
:
#
1
]
}}
%
449
\endgroup
}
450 451
\def
\strc_references_cross_backward
#
1
#
2
%
452
{
\begingroup
453
\strc_references_set_simple_internal_reference
{
cross
:
f
:
#
1
}
%
454
\naturalhpack
455
attr
\destinationattribute
\number
\lastdestinationattribute
456
{
\naturalhpack
{
\strc_references_flush_destination_nodes
\directgotodumbbox
{
#
2
}
[
cross
:
b
:
#
1
]
}}
%
457
\endgroup
}
458 459
\let
\doexternalfigurerepeat
\gobblefourarguments
% called from lua end
460 461
\unexpanded
\def
\placeregisteredexternalfigures
462
{
\dosingleempty
\grph_include_place_registered
}
463 464
\unexpanded
\def
\grph_include_place_registered
[#
1
]
%
465
{
\page
466
\begingroup
467
\unexpanded
\def
\doexternalfigurerepeat
{
\grph_include_place_registered_indeed
{
#
1
}}
%
468
\dorecurse
\clf_figure_nof_registered_pages
469
{
\page
470
\clf_figure_flush_registered_pages
\recurselevel
471
\page
}
%
472
\endgroup
473
\page
}
474 475
\unexpanded
\def
\grph_include_place_registered_indeed
#
1
#
2
#
3
#
4
#
5
% called from lua end
476
{
\grph_include_place
[#
2
][#
3
][#
4
,
%
477
\c!hfactor
=
,
\c!wfactor
=
,
\c!factor
=
,
%
478
\c!maxwidth
=
,
\c!maxheight
=
,
%
479
\c!xscale
=
,
\c!yscale
=
,
\c!scale
=
,
%
480
\c!sx
=
,
\c!sy
=
,
\c!s
=
,
%
481
\c!width
=
,
\c!height
=
,
%
482
\c!crossreference
=#
5
,
%
483
#
1
]
}
484 485
%D Scaling:
486 487
\let
\dowithfigure
\relax
% name might change (into a proper hook)
488 489
\unexpanded
\def
\doscalefigure
% used at lua end
490
{
\global\setbox
\foundexternalfigure
\vpack
{
\scale
[
\v!figure
]
{
\dowithfigure
{
\box
\foundexternalfigure
}}}}
491 492
\definescale
% some day we will inherit
493
[
\v!figure
]
494
[
\c!hfactor
=
\externalfigureparameter
\c!hfactor
,
495
\c!wfactor
=
\externalfigureparameter
\c!wfactor
,
496
\c!factor
=
\externalfigureparameter
\c!factor
,
497
\c!maxwidth
=
\externalfigureparameter
\c!maxwidth
,
498
\c!maxheight
=
\externalfigureparameter
\c!maxheight
,
499
\c!equalwidth
=
\externalfigureparameter
\c!equalwidth
,
500
\c!equalheight
=
\externalfigureparameter
\c!equalheight
,
501
\c!xscale
=
\externalfigureparameter
\c!xscale
,
502
\c!yscale
=
\externalfigureparameter
\c!yscale
,
503
\c!scale
=
\externalfigureparameter
\c!scale
,
504
\c!sx
=
\externalfigureparameter
\c!sx
,
505
\c!sy
=
\externalfigureparameter
\c!sy
,
506
\c!s
=
\externalfigureparameter
\c!s
,
507
\c!width
=
\externalfigureparameter
\c!width
,
508
\c!height
=
\externalfigureparameter
\c!height
,
509
\c!lines
=
\externalfigureparameter
\c!lines
]
510 511
%D You can register additional suffixes with the following command:
512
%D
513
%D \starttyping
514
%D \definegraphictypesynonym[jbig] [jb2]
515
%D \definegraphictypesynonym[jbig2][jb2]
516
%D \definegraphictypesynonym[jbg] [jb2]
517
%D \stoptyping
518 519
\unexpanded
\def
\definegraphictypesynonym
520
{
\dodoubleargument
\grph_include_set_type_synonym
}
521 522
\def
\grph_include_set_type_synonym
[#
1
][#
2
]
%
523
{
\clf_registerfiguresuffix
{
#
1
}{
#
2
}}
524 525
%D Additional paths can be installed with the regular setup command. The next
526
%D macro picks up the list.
527 528
\unexpanded
\def
\setfigurepathlist
529
{
\clf_setfigurepaths
{
\externalfigureparameter
\c!location
}{
\externalfigureparameter
\c!directory
}}
530 531
%D Variables:
532 533
\newbox
\foundexternalfigure
534
\newtoks
\externalfigurepostprocessors
535 536
\def
\defaultfigurewidth
{
8
\lineheight
}
537
\def
\defaultfigureheight
{
6
\lineheight
}
538 539
\def
\figurestatus
{
\numexpr
\clf_figurestatus
{
status
}{
0
}
\relax
}
% number: 0 = not found
540
\def
\figurewidth
{
\clf_figurestatus
{
width
}{
0
}
sp
}
541
\def
\figureheight
{
\clf_figurestatus
{
height
}{
0
}
sp
}
542
\def
\figurexscale
{
\clf_figurestatus
{
xscale
}{
1
}}
543
\def
\figureyscale
{
\clf_figurestatus
{
yscale
}{
1
}}
544 545
\def
\figuresize
{
\clf_figurerequest
{
size
}{}}
546
\def
\figurelabel
{
\clf_figurerequest
{
label
}{}}
547
\def
\figurefileoriginal
{
\clf_figurerequest
{
name
}{}}
548
\def
\figurefilepage
{
\clf_figurerequest
{
page
}{
1
}}
549
\def
\figurefileoptions
{
\clf_figurerequest
{
options
}{}}
550
\def
\figurefileconversion
{
\clf_figurerequest
{
conversion
}{}}
551
\def
\figurefileresolution
{
\clf_figurerequest
{
resolution
}{}}
552
\def
\figurefilecolor
{
\clf_figurerequest
{
color
}{}}
553
\def
\figurefilearguments
{
\clf_figurerequest
{
arguments
}{}}
554
\def
\figurefilecache
{
\clf_figurerequest
{
cache
}{}}
555
\def
\figurefileprefix
{
\clf_figurerequest
{
prefix
}{}}
556 557
\def
\figurenaturalwidth
{
\clf_figureused
{
width
}{
\number\dimexpr
\defaultfigurewidth
\relax
}
sp
}
558
\def
\figurenaturalheight
{
\clf_figureused
{
height
}{
\number\dimexpr
\defaultfigureheight
\relax
}
sp
}
559
\def
\figurexresolution
{
\clf_figureused
{
xresolution
}{
0
}}
560
\def
\figureyresolution
{
\clf_figureused
{
yresolution
}{
0
}}
561
\def
\figureorientation
{
\clf_figureused
{
orientation
}{
1
}}
562
\def
\figurerotation
{
\clf_figureused
{
rotation
}{
0
}}
563
\def
\figurexsize
{
\clf_figureused
{
xsize
}{
0
}}
564
\def
\figureysize
{
\clf_figureused
{
ysize
}{
0
}}
565
\def
\figurecolordepth
{
\clf_figureused
{
colordepth
}{
0
}}
566
\def
\figuredepth
{
\clf_figureused
{
depth
}{
0
}}
567 568
\def
\figurefullname
{
\clf_figureused
{
fullname
}{}}
569
\def
\noffigurepages
{
\clf_figureused
{
pages
}{
0
}}
570 571
\def
\figurefilepath
{
\clf_figurefilepath
}
572
\def
\figurefilename
{
\clf_figurefilename
}
573
\def
\figurefiletype
{
\clf_figurefiletype
}
574 575
\let
\naturalfigurewidth
\figurenaturalwidth
576
\let
\naturalfigureheight
\figurenaturalheight
577 578
\let
\figurescalewidth
\figurewidth
579
\let
\figurescaleheight
\figureheight
580
\let
\figurescalexscale
\figurexscale
581
\let
\figurescaleyscale
\figureyscale
582 583
%D Abuse:
584
%D
585
%D \starttyping
586
%D \externalfigure[rubish.pdf] \ifcase\figurestatus\relax \ctxlua{os.exit(999)} \fi
587
%D \stoptyping
588 589
%D Calculating:
590 591
% \enabletrackers[figures.conversion]
592
% \externalfigure[demo.svg]
593
% \externalfigure[demo.svg][conversion=png]
594 595
%D The following registers are used (if only to be downward compatible).
596 597
\newconditional
\c_grph_include_skip
598
\newconditional
\c_grph_include_test_only
599
\newconditional
\c_grph_include_level
\setfalse
\c_grph_include_level
% true=background false=normal
600
\newconditional
\c_grph_include_flush
\settrue
\c_grph_include_flush
% true=place false=ignore
601 602
\newsystemmode
\v!figure
603 604
\def
\grph_include_set_mode
605
{
\ifcase
\figurestatus
606
\globalresetsystemmode
\v!figure
% todo, also: \v!resource
607
\else
608
\globalsetsystemmode
\v!figure
% todo, also: \v!resource
609
\fi
}
610 611
\appendtoks
612
\clf_setfigurepaths
613
{
\externalfigureparameter
\c!location
}
%
614
{
\externalfigureparameter
\c!directory
}
%
615
\clf_figure_reset
616
\foundexternalfigure
617
\defaultfigurewidth
618
\defaultfigureheight
619
\relax
620
\to
\everyexternalfigureresets
621 622
\appendtoks
623
\edef
\p_option
{
\externalfigureparameter
\c!option
}
%
624
\ifx
\p_option
\v!frame
625
\setfalse
\c_grph_include_skip
626
\letexternalfigureparameter
\c!frame\v!on
627
\else\ifx
\p_option
\v!empty
628
\settrue
\c_grph_include_skip
629
\letexternalfigureparameter
\c!frame\v!off
630
\else
631
\setfalse
\c_grph_include_skip
632
\fi\fi
633
% fake color in gray bitmaps, assumes that
634
% a transparent color is used
635
\edef
\p_foregroundcolor
{
\externalfigureparameter
\c!foregroundcolor
}
%
636
\ifx
\p_foregroundcolor
\empty
\else
637
\setexternalfigureparameter
\c!background
{
\v!foreground
,
\v!color
}
%
638
\letexternalfigureparameter
\c!backgroundcolor
\p_foregroundcolor
639
\fi
640
\to
\everyexternalfigurechecks
641 642
%D Internal graphics are handled at the \TEX\ end:
643 644
\def
\grph_include_process_tex
#
1
%
645
{
\framed
646
[
\c!strut
=
\v!no
,
\c!align
=
\v!normal
,
\c!frame
=
\v!off
,
647
\c!offset
=
\v!overlay
,
\c!width
=
\v!fit
,
\c!height
=
\v!fit
]
648
{
\blank
[
\v!disable
]#
1
\endgraf
\removelastskip
}}
% disable should stay here!
649 650
% used al lua end:
651 652
\unexpanded
\def
\docheckfigurebuffer
#
1
{
\global\setbox
\foundexternalfigure
\vpack
{
\grph_include_process_tex
{
\getbuffer
[#
1
]
}}}
653
\unexpanded
\def
\docheckfiguretex
#
1
{
\global\setbox
\foundexternalfigure
\vpack
{
\grph_include_process_tex
{
\input
{
#
1
}}}}
654
\unexpanded
\def
\docheckfigurecld
#
1
{
\global\setbox
\foundexternalfigure
\vbox
{
\cldprocessfile
{
#
1
}}}
655
\unexpanded
\def
\docheckfiguremps
#
1
{
\global\setbox
\foundexternalfigure
\vpack
{
\convertMPtoPDF
{
#
1
}
1
1
}}
656
\unexpanded
\def
\docheckfiguremprun
#
1
#
2
{
\global\setbox
\foundexternalfigure
\vpack
{
\useMPrun
{
#
1
}{
#
2
}}}
657 658
% \unexpanded\def\relocateexternalfigure % easier here than in lua
659
% {\global\setbox\foundexternalfigure\vpack to \ht\foundexternalfigure\bgroup
660
% \vss
661
% \ht\foundexternalfigure\zeropoint
662
% \hpack to \wd\foundexternalfigure\bgroup
663
% \box\foundexternalfigure
664
% \hss
665
% \egroup
666
% \egroup}
667 668
\unexpanded
\def
\relocateexternalfigure
669
{
\global\setbox
\foundexternalfigure
\vpack
to
\ht
\foundexternalfigure
\bgroup
670
%
671
% The \vss can (!) introduce 1 sp excess visible in xform which in itself
672
% is not that important but some don't like these cosmetic side effects, for
673
% instance we can get:
674
%
675
% vss : \vbox(845.1575+0.0)x597.23125, glue set 845.15747fil, direction TLT
676
% vskip : \vbox(845.1575+0.0)x597.23125, direction TLT
677
%
678
% or
679
%
680
% 1 0 0 1 0 0.00003 cm
681
% 1 0 0 1 0 0 cm
682
%
683
% This is a known property of using glue and can even depend on the architecture
684
% (float implementation). Anyway, let's for now use a skip. Of course this can
685
% shift the issue elsewhere, as vss is used a lot elsewhere.
686
%
687
% \vss
688
\vkern
\ht
\foundexternalfigure
689
%
690
% \parfillskip\zeropoint
691
\ht
\foundexternalfigure
\zeropoint
692
\dp
\foundexternalfigure
\zeropoint
693
\hpack
to
\wd
\foundexternalfigure
\bgroup
694
\box
\foundexternalfigure
695
\hss
696
\egroup
697
\egroup
}
698 699
\unexpanded
\def
\startfoundexternalfigure
#
1
#
2
% ht wd
700
{
\global\setbox
\foundexternalfigure
\vbox
to
#
2
\bgroup
\vss\hbox
to
#
1
\bgroup
}
701 702
\unexpanded
\def
\stopfoundexternalfigure
703
{
\hss
\egroup\egroup
}
704 705
\unexpanded
\def
\emptyfoundexternalfigure
% sort of obsolete
706
{
\startfoundexternalfigure
\defaultfigurewidth
\defaultfigureheight
707
\stopfoundexternalfigure
}
708 709
% \doifmodeelse{*\v!last}
710
% {\settrue \c_grph_include_flush}
711
% {\setfalse\c_grph_include_flush}%
712 713
\def
\grph_include_finalize
714
{
\global\setbox
\foundexternalfigure
\vbox
715
{
\ifcase
\figurestatus
716
\letexternalfigureparameter
\c!frame\v!on
717
\fi
718
\ifconditional
\c_grph_include_flush
719
\ifconditional
\c_grph_include_level
% probably background
720
\ifconditional
\c_grph_include_skip
721
% nothing
722
\fakebox
\foundexternalfigure
723
\else\ifcase
\figurestatus
724
% nothing
725
\else
726
\the
\externalfigurepostprocessors
727
\box
\foundexternalfigure
728
\fi\fi
729
\else
730
\iftrialtypesetting
\else
\feedbackexternalfigure
\fi
731
\settrue
\c_grph_include_level
732
\ifconditional
\c_grph_include_skip
733
\ifcase
\figurestatus
734
\grph_include_replacement
\figurelabel
\figurefileoriginal
{
unknown
}
%
735
\else
736
\grph_include_replacement
\figurelabel
\figurefullname
{
skipped
}
%
737
\fi
738
\else\ifcase
\figurestatus
739
\grph_include_replacement
\figurelabel
\figurefileoriginal
{
unknown
}
%
740
\else
741
\the
\externalfigurepostprocessors
742
\edef
\p_reset
{
\externalfigureparameter
\c!reset
}
%
743
\ifx
\p_reset
\v!yes
744
\wd
\foundexternalfigure
\figurewidth
745
\ht
\foundexternalfigure
\figureheight
746
\dp
\foundexternalfigure
\zeropoint
747
\box
\foundexternalfigure
748
\else
749
\letexternalfigureparameter
\c!offset\v!overlay
750
\letexternalfigureparameter
\c!width
\figurewidth
751
\letexternalfigureparameter
\c!height
\figureheight
752
\inheritedexternalfigureframed
{
\box
\foundexternalfigure
}
%
753
\fi
754
\fi\fi
755
\fi
756
\else
757
% maybe also \the\externalfigurepostprocessors
758
\iftrialtypesetting
\else
\feedbackexternalfigure
\fi
759
\fi
}}
760 761
\let
\feedbackexternalfigure
\relax
% hook
762 763
\unexpanded
\def
\getfiguredimensions
764
{
\dodoubleempty
\grph_include_get_dimensions
}
765 766
\def
\grph_include_get_dimensions
[#
1
][#
2
]
%
767
{
\startnointerference
768
\settrue
\c_grph_include_test_only
769
\externalfigure
[#
1
][#
2
,
\c!display
=
,
\c!mask
=
,
\c!object
=
\v!no
]
%
770
\stopnointerference
}
771 772
\unexpanded
\def
\doifelsefigure
#
1
%
773
{
\getfiguredimensions
[#
1
]
% so data is available !
774
\ifcase
\figurestatus
775
\expandafter
\secondoftwoarguments
776
\else
777
\expandafter
\firstoftwoarguments
778
\fi
}
779 780
\let
\doiffigureelse\doifelsefigure
781 782
% No placement, handy for preprocessing:
783 784
\unexpanded
\def
\registerexternalfigure
785
{
\dotripleempty
\grph_include_register
}
786 787
\def
\grph_include_register
[#
1
][#
2
][#
3
]
%
788
{
\startnointerference
789
\c_grph_include_test_only
790
\setfalse
\c_grph_include_flush
% == test ?
791
\externalfigure
[#
1
][#
2
][#
3
]
% or
792
\externalfigure
[#
1
][#
2
,
\c!display
=
,
\c!mask
=
,
\c!object
=
\v!no
]
%
793
\stopnointerference
}
794 795
% Helpers will be replaced when xforms are accessible at the lua end but then
796
% we need to do the object offset there too.
797 798
\unexpanded
\def
\dosetfigureobject
#
1
#
2
%
799
{
\setobject
{
#
1
}{
#
2
}
\vpack
{
\box
\foundexternalfigure
}}
800 801
\unexpanded
\def
\doboxfigureobject
#
1
#
2
%
802
{
\global\setbox
\foundexternalfigure
\vpack
{
\getobject
{
#
1
}{
#
2
}}}
% probably one vbox too many
803 804
% Figure bases
805 806
\unexpanded
\def
\usefigurebase
[#
1
]
%
807
{
\clf_usefigurebase
{
#
1
}}
808 809
\appendtoks
810
\setfigurepathlist
% the path may be used elsewhere too (as in x-res-04)
811
\to
\everysetupexternalfigure
812 813
\appendtoks
814
\clf_setfigurelookuporder
{
\externalfigureparameter
\c!order
}
%
815
\to
\everysetupexternalfigure
816 817
\definecolor
[
missingfigurecolor
][
s
=
.
8
]
818 819
\def
\grph_include_replacement
#
1
#
2
#
3
%
820
{
\bgroup
821
\letexternalfigureparameter
\c!width
\figurewidth
822
\letexternalfigureparameter
\c!height
\figureheight
823
\letexternalfigureparameter
\c!background\v!color
824
\setexternalfigureparameter
\c!backgroundcolor
{
missingfigurecolor
}
%
825
\setexternalfigureparameter
\c!align
{
\v!middle
,
\v!lohi
}
% we default to \v!none
826
\inheritedexternalfigureframed
827
{
\tt
\tfxx
\nohyphens
828
name
:
\expanded
{
\verbatimstring
{
#
1
}}
\\
%
829
file
:
\expanded
{
\verbatimstring
{
#
2
}}
\\
%
830
state
:
\expanded
{
\verbatimstring
{
#
3
}}}
%
831
\egroup
}
832 833
% maybe setuphandler
834 835
\newconditional
\c_grph_include_in_collection
836 837
\newdimen
\d_grph_include_collection_minwidth
838
\newdimen
\d_grph_include_collection_maxwidth
839
\newdimen
\d_grph_include_collection_minheight
840
\newdimen
\d_grph_include_collection_maxheight
841 842
\def
\grph_include_analyze_collection
[#
1
][#
2
]
%
843
{
\ifconditional
\c_grph_include_in_collection
844
\setfalse
\c_grph_include_in_collection
845
\getfiguredimensions
[#
1
][#
2
]
%
846
\settrue
\c_grph_include_in_collection
847
\scratchdimen
\naturalfigurewidth
848
\ifdim
\scratchdimen
>
\d_grph_include_collection_maxwidth
\d_grph_include_collection_maxwidth
\scratchdimen
\fi
849
\ifdim
\scratchdimen
<
\d_grph_include_collection_minwidth
\d_grph_include_collection_minwidth
\scratchdimen
\fi
850
\scratchdimen
\naturalfigureheight
851
\ifdim
\scratchdimen
>
\d_grph_include_collection_maxheight
\d_grph_include_collection_maxheight
\scratchdimen
\fi
852
\ifdim
\scratchdimen
<
\d_grph_include_collection_minheight
\d_grph_include_collection_minheight
\scratchdimen
\fi
853
\fi
}
854 855
\unexpanded
\def
\startexternalfigurecollection
[#
1
]
%
856
{
\begingroup
857
\def
\currentexternalfigurecollection
{
#
1
}
%
858
\settrue
\c_grph_include_in_collection
859
\d_grph_include_collection_minwidth
\maxdimen
860
\d_grph_include_collection_maxwidth
\zeropoint
861
\d_grph_include_collection_minheight
\maxdimen
862
\d_grph_include_collection_maxheight
\zeropoint
}
863 864
\unexpanded
\def
\stopexternalfigurecollection
865
{
\setxvalue
{
\??externalfigurecollection
\currentexternalfigurecollection
:
\c!minwidth
}{
\the
\d_grph_include_collection_minwidth
}
%
866
\setxvalue
{
\??externalfigurecollection
\currentexternalfigurecollection
:
\c!maxwidth
}{
\the
\d_grph_include_collection_maxwidth
}
%
867
\setxvalue
{
\??externalfigurecollection
\currentexternalfigurecollection
:
\c!minheight
}{
\the
\d_grph_include_collection_minheight
}
%
868
\setxvalue
{
\??externalfigurecollection
\currentexternalfigurecollection
:
\c!maxheight
}{
\the
\d_grph_include_collection_maxheight
}
%
869
\endgroup
}
870 871
\def
\externalfigurecollectionparameter
#
1
#
2
%
872
{
\csname
873
\ifcsname
\??externalfigurecollection
#
1
:
#
2
\endcsname
874
\??externalfigurecollection
#
1
:
#
2
%
875
\else
876
\s!empty
877
\fi
878
\endcsname
}
879 880
\def
\externalfigurecollectionminwidth
#
1
{
\externalfigurecollectionparameter
{
#
1
}
\c!minwidth
}
881
\def
\externalfigurecollectionmaxwidth
#
1
{
\externalfigurecollectionparameter
{
#
1
}
\c!maxwidth
}
882
\def
\externalfigurecollectionminheight
#
1
{
\externalfigurecollectionparameter
{
#
1
}
\c!minheight
}
883
\def
\externalfigurecollectionmaxheight
#
1
{
\externalfigurecollectionparameter
{
#
1
}
\c!maxheight
}
884 885
\let
\efcparameter\externalfigurecollectionparameter
% still needed ?
886
\let
\efcminwidth
\externalfigurecollectionminwidth
% still needed ?
887
\let
\efcmaxwidth
\externalfigurecollectionmaxwidth
% still needed ?
888
\let
\efcminheight\externalfigurecollectionminheight
% still needed ?
889
\let
\efcmaxheight\externalfigurecollectionmaxheight
% still needed ?
890 891
% \startexternalfigurecollection[name]
892
% \useexternalfigure[cow] [cow.pdf]
893
% \useexternalfigure[mill][mill.png]
894
% \stopexternalfigurecollection
895
% \starttext
896
% \bTABLE
897
% \bTR
898
% \bTD \externalfigure[cow] [height=\externalfigurecollectionmaxheight{name}] \eTD
899
% \bTD \externalfigure[mill][height=\externalfigurecollectionmaxheight{name}] \eTD
900
% \eTR
901
% \eTABLE
902
% \stoptext
903 904
\unexpanded
\def
\overlayfigure
#
1
%
905
{
\externalfigure
[#
1
][
\c!width
=
\d_overlay_width
,
\c!height
=
\d_overlay_height
]
}
906 907
% Experimental (will become cleaner):
908 909
\ifcase
\contextlmtxmode
\else
910 911
\unexpanded
\def
\includesvgfile
{
\dontleavehmode
\begingroup
\dodoubleempty
\grph_include_svg_file
}
912
\unexpanded
\def
\includesvgbuffer
{
\dontleavehmode
\begingroup
\dodoubleempty
\grph_include_svg_buffer
}
913 914
\def
\grph_include_svg_file
[#
1
][#
2
]
%
915
{
\getdummyparameters
[
\c!offset
=
\zeropoint
,
#
2
]
%
916
\clf_includesvgfile
{
#
1
}
\dimexpr
\dummyparameter
\c!offset
\relax
917
\endgroup
}
918 919
\def
\grph_include_svg_buffer
[#
1
][#
2
]
%
920
{
\getdummyparameters
[
\c!offset
=
\zeropoint
,
#
2
]
%
921
\clf_includesvgbuffer
{
#
1
}
\dimexpr
\dummyparameter
\c!offset
\relax
922
\endgroup
}
923 924
\fi
925 926
% Bonus:
927 928
\useexternalfigure
929
[
\v!buffer
]
930
[
\jobname
.
buffer
]
931
[
\c!object
=
\v!no
]
932 933
% Another two:
934 935
\defineexternalfigure
936
[
\v!inline
]
937
[
\c!height
=
\lineheight
]
938 939
\definemeasure
940
[
\v!combination
]
941
[(
\textwidth
942
-
\effectiveleftskip
943
-
\effectiverightskip
944
-
\numexpr
\combinationparameter
\c!nx
-
\plusone
\relax\dimexpr
\combinationparameter
\c!distance
\relax
945
)
/
\combinationparameter
\c!nx
]
946 947
\defineexternalfigure
948
[
\v!combination
]
949
[
\c!width
=
\measure
{
\v!combination
}
]
950 951
% \startcombination[nx=2,ny=1]
952
% {\externalfigure[dummy][combination]} {}
953
% {\externalfigure[dummy][combination]} {}
954
% \stopcombination
955 956
% \startcombination[nx=2,ny=1]
957
% {\externalfigure[dummy][width=\measure{combination}]} {}
958
% {\externalfigure[dummy][width=\measure{combination}]} {}
959
% \stopcombination
960 961
% \startcombination[nx=2,ny=2]
962
% {\externalfigure[dummy][combination]} {}
963
% {\externalfigure[dummy][combination]} {}
964
% {\externalfigure[dummy][combination]} {}
965
% {\externalfigure[dummy][combination]} {}
966
% \stopcombination
967 968
% \startcombination[nx=3,ny=1]
969
% {\externalfigure[dummy][combination]} {}
970
% {\externalfigure[dummy][combination]} {}
971
% {\externalfigure[dummy][combination]} {}
972
% \stopcombination
973 974
% \startcombination[nx=4,ny=1]
975
% {\externalfigure[dummy][combination]} {}
976
% {\externalfigure[dummy][combination]} {}
977
% {\externalfigure[dummy][combination]} {}
978
% {\externalfigure[dummy][combination]} {}
979
% \stopcombination
980 981
\unexpanded
\def
\inlinefigure
[#
1
]
{
\dontleavehmode
\sbox
{
\externalfigure
[#
1
][
\v!inline
]
}}
982 983
%D Needs to be done global:
984 985
\definelayer
[
epdfcontent
]
986 987
\protect
\endinput
988 989
%D Moved here because this already old code is nowhere documents (so I need to check
990
%D it:
991
%
992
% \starttyping
993
% \starttext
994
%
995
% \startluaparameterset [u3d:myset:controls:1]
996
% view = {
997
% name = 'default',
998
% bg = {1,1,1},
999
% mag = 100,
1000
% coo = {0,0,0},
1001
% c2c = {0,0,1},
1002
% rot = {40,0,60},
1003
% roo = 6,
1004
% lights = 'CAD'
1005
% },
1006
% js = 'cloudq.js'
1007
% \stopluaparameterset
1008
%
1009
% \startluaparameterset [u3d:myset:controls:2]
1010
% views = {
1011
% {
1012
% name = 'AnglePositioning',
1013
% bg = {1,1,1},
1014
% azimuth = 45,
1015
% altitude = 45,
1016
% roo = 50,
1017
% aac = 2.5,
1018
% lights = 'Artwork'
1019
% },
1020
% {
1021
% name = 'RotationPositioning',
1022
% bg = {1,1,1},
1023
% rot = {0,45,45},
1024
% roo = 50,
1025
% aac = 2.5,
1026
% lights = 'Artwork'
1027
% },
1028
% {
1029
% name = 'VectorPositioning',
1030
% bg = {1,0,0},
1031
% c2c = {1,1,math.sqrt(2)},
1032
% roo = 50,
1033
% aac = 2.5,
1034
% lights = 'CAD'
1035
% },
1036
% {
1037
% name = 'PositionPositioning',
1038
% bg = {1,0,0},
1039
% pos = {1+25,1+25,1+50/math.sqrt(2)},
1040
% aac = 2.5,
1041
% lights = 'CAD'
1042
% },
1043
% {
1044
% name = 'ortho',
1045
% bg = {1,1,1},
1046
% mag = 300,
1047
% lights = 'CAD',
1048
% crossection = {}
1049
% }
1050
% },
1051
% view = {
1052
% name = 'default',
1053
% bg = {1,1,1},
1054
% c2c = {-1,-1,0},
1055
% roo = 50,
1056
% aac = 2.5,
1057
% roll = 45,
1058
% lights = 'CAD',
1059
% crossection = {
1060
% normal = {-1,-1,-1},
1061
% transparent = true
1062
% },
1063
% nodes = {
1064
% {
1065
% name = 'xlabel',
1066
% visible = false
1067
% },
1068
% {
1069
% name = 'ylabel',
1070
% opacity = 0.5
1071
% },
1072
% {
1073
% name = 'zlabel',
1074
% rendermode = 'Wireframe'
1075
% }
1076
% }
1077
% }
1078
% \stopluaparameterset
1079
%
1080
% \useexternalfigure
1081
% [cloudq]
1082
% [cloudq.u3d]
1083
% [width=0.7\textwidth,
1084
% height=.7\textwidth,
1085
% display=u3d:myset:display:1,
1086
% controls=u3d:myset:controls:1]
1087
%
1088
% \useexternalfigure
1089
% [axes]
1090
% [axes.u3d]
1091
% [width=0.7\textwidth,
1092
% height=.7\textwidth,
1093
% controls=u3d:myset:controls:1]
1094
%
1095
% \startluaparameterset[u3d:myset:display:2]
1096
% toolbar = true,
1097
% preview = 'cloudq.png'
1098
% \stopluaparameterset
1099
% \startluaparameterset[u3d:myset:display:3]
1100
% toolbar = true,
1101
% tree = false,
1102
% preview = 'axes.png'
1103
% \stopluaparameterset
1104
% \startluaparameterset[u3d:myset:display:4]
1105
% toolbar = true,
1106
% tree = false,
1107
% view = {
1108
% name = 'view',
1109
% bg = {0.1,0.1,0.1},
1110
% c2c = {-1,-1,0},
1111
% roo = 50,
1112
% aac = 2.5,
1113
% roll = 45,
1114
% lights = 'Red'
1115
% }
1116
% \stopluaparameterset
1117
% \startluaparameterset[u3d:myset:display:5]
1118
% toolbar = true,
1119
% tree = false,
1120
% view = 'ortho'
1121
% \stopluaparameterset
1122
%
1123
% \placefigure[here]{none}{\externalfigure[cloudq][frame=on,display=u3d:myset:display:2]}
1124
% \placefigure[here]{none}{\externalfigure[axes] [frame=on,display=u3d:myset:display:3]}
1125
% \placefigure[here]{none}{\externalfigure[axes] [frame=on,display=u3d:myset:display:4]}
1126
% \placefigure[here]{none}{\externalfigure[axes] [frame=on,display=u3d:myset:display:5,width=0.5\textwidth,height=.5\textwidth]}
1127
%
1128
% \stoptext
1129