diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/lpdf-swf.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/lpdf-swf.lua | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lpdf-swf.lua b/Master/texmf-dist/tex/context/base/mkiv/lpdf-swf.lua index 0ac107f8b5e..44e42dc5f8d 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lpdf-swf.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lpdf-swf.lua @@ -11,6 +11,7 @@ if not modules then modules = { } end modules ['lpdf-swf'] = { local format, gsub = string.format, string.gsub local concat = table.concat +local formatters = string.formatters local backends = backends local lpdf = lpdf @@ -33,6 +34,43 @@ local trace_swf = false trackers.register("backend.swf", function(v) trace_swf local report_swf = logs.reporter("backend","swf") +-------------------------------------------------------------------------------------- + +local createimage = images.create +local embedimage = images.embed + +local basepoints = number.dimenfactors.bp + +local f_image = formatters["%.6F 0 0 %.6F 0 0 cm /%s Do"] + +directives.register("pdf.stripzeros",function() + f_image = formatters["%.6N 0 0 %.6N 0 0 cm /%s Do"] +end) + +local function package(image) -- see lpdf-u3d ** + local boundingbox = image.bbox + local imagetag = "Im" .. image.index -- this is not ok + local resources = pdfdictionary { + ProcSet = lpdf.procset(), + Resources = pdfdictionary { + XObject = pdfdictionary { + [imagetag] = pdfreference(image.objnum) + } + } + } + local width = boundingbox[3] + local height = boundingbox[4] + local xform = createimage { + attr = resources(), + stream = f_image(width,height,imagetag), + bbox = { 0, 0, width/basepoints, height/basepoints }, + } + embedimage(xform) + return xform +end + +-------------------------------------------------------------------------------------- + local activations = { click = "XA", page = "PO", @@ -65,7 +103,10 @@ local function insertswf(spec) local preview = checkedkey(display,"preview","string") local toolbar = checkedkey(display,"toolbar","boolean") - local embeddedreference = codeinjections.embedfile { file = filename } + local embeddedreference = codeinjections.embedfile { + file = filename, + compress = false, + } local flash = pdfdictionary { Subtype = pdfconstant("RichMediaConfiguration"), @@ -122,6 +163,7 @@ local function insertswf(spec) file = fullname, usedname = usedname, keepdir = true, + compress = false, } names[#names+1] = pdfstring(filename) names[#names+1] = embeddedreference @@ -275,7 +317,7 @@ local function insertswf(spec) end end if figure then - local image = img.package(figure.status.private) + local image = package(figure.status.private) appearance = pdfdictionary { N = pdfreference(image.objnum) } if trace_swf then report_swf("using preview %s",preview) |