summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/lpdf-u3d.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/lpdf-u3d.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/lpdf-u3d.lua52
1 files changed, 37 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/context/base/lpdf-u3d.lua b/Master/texmf-dist/tex/context/base/lpdf-u3d.lua
index f7a62c6c904..f5a2bc2fa9a 100644
--- a/Master/texmf-dist/tex/context/base/lpdf-u3d.lua
+++ b/Master/texmf-dist/tex/context/base/lpdf-u3d.lua
@@ -13,22 +13,31 @@ if not modules then modules = { } end modules ['lpdf-u3d'] = {
-- an overhaul. There are some messy leftovers that will be
-- removed in future versions.
+-- For some reason no one really tested this code so at some
+-- point we will end up with a reimplementation. For instance
+-- it makes sense to add the same activation code as with swf.
+
local format, find = string.format, string.find
local cos, sin, sqrt, pi, atan2, abs = math.cos, math.sin, math.sqrt, math.pi, math.atan2, math.abs
-local pdfconstant = lpdf.constant
-local pdfboolean = lpdf.boolean
-local pdfnumber = lpdf.number
-local pdfunicode = lpdf.unicode
-local pdfdictionary = lpdf.dictionary
-local pdfarray = lpdf.array
-local pdfnull = lpdf.null
-local pdfreference = lpdf.reference
+local backends, lpdf = backends, lpdf
+
+local nodeinjections = backends.pdf.nodeinjections
+
+local pdfconstant = lpdf.constant
+local pdfboolean = lpdf.boolean
+local pdfnumber = lpdf.number
+local pdfunicode = lpdf.unicode
+local pdfdictionary = lpdf.dictionary
+local pdfarray = lpdf.array
+local pdfnull = lpdf.null
+local pdfreference = lpdf.reference
+local pdfimmediateobject = lpdf.immediateobject
-local pdfimmediateobj = pdf.immediateobj
+local checkedkey = lpdf.checkedkey
+local limited = lpdf.limited
-local checkedkey = lpdf.checkedkey
-local limited = lpdf.limited
+local pdfannotation_node = nodes.pool.pdfannotation
local schemes = table.tohash {
"Artwork", "None", "White", "Day", "Night", "Hard",
@@ -338,7 +347,7 @@ end
local stored_js, stored_3d, stored_pr, streams = { }, { }, { }, { }
-function backends.pdf.helpers.insert3d(spec) -- width, height, factor, display, controls, label, foundname
+local function insert3d(spec) -- width, height, factor, display, controls, label, foundname
local width, height, factor = spec.width, spec.height, spec.factor or number.dimenfactors.bp
local display, controls, label, foundname = spec.display, spec.controls, spec.label, spec.foundname
@@ -388,12 +397,12 @@ function backends.pdf.helpers.insert3d(spec) -- width, height, factor, display,
if js then
local jsref = stored_js[js]
if not jsref then
- jsref = pdfimmediateobj("streamfile",js)
+ jsref = pdfimmediateobject("streamfile",js)
stored_js[js] = jsref
end
attr.OnInstantiate = pdfreference(jsref)
end
- stored_3d[label] = pdfimmediateobj("streamfile",foundname,attr())
+ stored_3d[label] = pdfimmediateobject("streamfile",foundname,attr())
stream = 1
else
stream = stream + 1
@@ -456,7 +465,7 @@ function backends.pdf.helpers.insert3d(spec) -- width, height, factor, display,
},
ProcSet = pdfarray { pdfconstant("PDF"), pdfconstant("ImageC") },
}
- local pwd = pdfimmediateobj(
+ local pwd = pdfimmediateobject(
"stream",
format("q /GS gs %s 0 0 %s 0 0 cm /IM Do Q",
factor*width,factor*height),
@@ -472,3 +481,16 @@ function backends.pdf.helpers.insert3d(spec) -- width, height, factor, display,
return annot, nil, nil
end
end
+
+function nodeinjections.insertu3d(spec)
+ local annotation, preview, ref = insert3d { -- just spec
+ foundname = spec.foundname,
+ width = spec.width,
+ height = spec.height,
+ factor = spec.factor,
+ display = spec.display,
+ controls = spec.controls,
+ label = spec.label,
+ }
+ node.write(pdfannotation_node(spec.width,spec.height,0,annotation()))
+end