summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/lpdf-u3d.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/lpdf-u3d.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/lpdf-u3d.lua26
1 files changed, 10 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lpdf-u3d.lua b/Master/texmf-dist/tex/context/base/mkiv/lpdf-u3d.lua
index f6897e92d20..dfd4c1b0686 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/lpdf-u3d.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/lpdf-u3d.lua
@@ -27,6 +27,7 @@ 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
@@ -38,8 +39,6 @@ local pdfflushstreamfileobject = lpdf.flushstreamfileobject
local checkedkey = lpdf.checkedkey
local limited = lpdf.limited
-local embedimage = images.embed
-
local schemes = table.tohash {
"Artwork", "None", "White", "Day", "Night", "Hard",
"Primary", "Blue", "Red", "Cube", "CAD", "Headlamp",
@@ -348,12 +347,6 @@ end
local stored_js, stored_3d, stored_pr, streams = { }, { }, { }, { }
-local f_image = formatters["q /GS gs %.6F 0 0 %.6F 0 0 cm /IM Do Q"]
-
-directives.register("pdf.stripzeros",function()
- f_image = formatters["q /GS gs %.6N 0 0 %.6N 0 0 cm /IM Do Q"]
-end)
-
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
@@ -438,7 +431,7 @@ local function insert3d(spec) -- width, height, factor, display, controls, label
local tag = formatters["%s:%s:%s"](label,stream,preview)
local ref = stored_pr[tag]
if not ref then
- local figure = embedimage {
+ local figure = img.immediatewrite {
filename = preview,
width = width,
height = height
@@ -447,13 +440,13 @@ local function insert3d(spec) -- width, height, factor, display, controls, label
stored_pr[tag] = ref
end
if ref then -- see back-pdf ** .. here we have a local /IM !
+ local zero, one = pdfnumber(0), pdfnumber(1) -- not really needed
local pw = pdfdictionary {
Type = pdfconstant("XObject"),
Subtype = pdfconstant("Form"),
- FormType = 1,
- BBox = pdfarray { 0, 0, pdfnumber(factor*width), pdfnumber(factor*height) },
- Matrix = pdfarray { 1, 0, 0, 1, 0, 0 },
- ProcSet = lpdf.procset(),
+ FormType = one,
+ BBox = pdfarray { zero, zero, pdfnumber(factor*width), pdfnumber(factor*height) },
+ Matrix = pdfarray { one, zero, zero, one, zero, zero },
Resources = pdfdictionary {
XObject = pdfdictionary {
IM = pdfreference(ref)
@@ -462,12 +455,13 @@ local function insert3d(spec) -- width, height, factor, display, controls, label
ExtGState = pdfdictionary {
GS = pdfdictionary {
Type = pdfconstant("ExtGState"),
- CA = 1,
- ca = 1,
+ CA = one,
+ ca = one,
}
},
+ ProcSet = pdfarray { pdfconstant("PDF"), pdfconstant("ImageC") },
}
- local pwd = pdfflushstreamobject(f_image(factor*width,factor*height),pw)
+ local pwd = pdfflushstreamobject(formatters["q /GS gs %.6F 0 0 %.6F 0 0 cm /IM Do Q"](factor*width,factor*height),pw)
annot.AP = pdfdictionary {
N = pdfreference(pwd)
}