diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-08-06 02:07:31 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-08-06 02:07:31 +0200 |
commit | ffb7a5f21df9b0802cb00f9ef3578209a372ae2f (patch) | |
tree | 8ac376cfc657222b5be6d498a2f4395eda0b54d6 /tex/context/base/mkxl/lpdf-img.lmt | |
parent | 898d8e12e219efa15e367285cee56cab77f84339 (diff) | |
download | context-ffb7a5f21df9b0802cb00f9ef3578209a372ae2f.tar.gz |
2021-08-06 01:21:00
Diffstat (limited to 'tex/context/base/mkxl/lpdf-img.lmt')
-rw-r--r-- | tex/context/base/mkxl/lpdf-img.lmt | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/tex/context/base/mkxl/lpdf-img.lmt b/tex/context/base/mkxl/lpdf-img.lmt index f937f2ed4..95235959e 100644 --- a/tex/context/base/mkxl/lpdf-img.lmt +++ b/tex/context/base/mkxl/lpdf-img.lmt @@ -75,14 +75,36 @@ trackers.register("graphics.backend", function(v) trace = v end) local injectors = { } lpdf.injectors = injectors --- todo: load from a virtual file +-- local function loadcontent(filename,method) +-- return method == "string" and filename or loaddata(filename) +-- end + +-- local function newcontent(filename,method) +-- return newreader(filename,method) +-- end -local function loadcontent(filename,method) - return method == "string" and filename or loaddata(filename) +local function loadcontent(filename,method,wipe) + if method == "string" then + return filename + else + local found, data = resolvers.loadbinfile(filename) + if wipe then + resolvers.cleanupbinfile(filename) + end + return data + end end -local function newcontent(filename,method) - return newreader(filename,method) +local function newcontent(filename,method,wipe) + if method == "string" then + return newreader(filename,method) + else + local found, data = resolvers.loadbinfile(filename) + if wipe then + resolvers.cleanupbinfile(filename) + end + return newreader(data or "", "string") + end end -- @@ -118,7 +140,7 @@ do local xsize = specification.xsize local ysize = specification.ysize local colordepth = specification.colordepth - local content = loadcontent(filename,method) + local content = loadcontent(filename,method,true) local xobject = pdfdictionary { Type = pdfconstant("XObject"), Subtype = pdfconstant("Image"), @@ -160,7 +182,7 @@ do -- todo: set filename local xsize = specification.xsize local ysize = specification.ysize - local content = loadcontent(filename,method) + local content = loadcontent(filename,method,true) local xobject = pdfdictionary { Type = pdfconstant("XObject"), Subtype = pdfconstant("Image"), @@ -972,7 +994,7 @@ do if not idat then return end - local pngfile = newcontent(filename,method) + local pngfile = newcontent(filename,method,true) if not pngfile then return end |