From 8b678f473da7b81842dbc13b50c6303991570521 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sat, 25 May 2019 11:48:47 +0200 Subject: 2019-05-25 10:53:00 --- tex/context/base/mkiv/grph-bmp.lua | 44 +++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 17 deletions(-) (limited to 'tex/context/base/mkiv/grph-bmp.lua') diff --git a/tex/context/base/mkiv/grph-bmp.lua b/tex/context/base/mkiv/grph-bmp.lua index 256b64309..d863b1a98 100644 --- a/tex/context/base/mkiv/grph-bmp.lua +++ b/tex/context/base/mkiv/grph-bmp.lua @@ -38,29 +38,39 @@ function bitmaps.new(xsize,ysize,colorspace,colordepth,mask) } end +-- function backends.codeinjections.bitmap(bitmap) +-- return lpdf.injectors.bitmap(bitmap) +-- end + local function flush(bitmap) - return wrapimage(lpdf.injectors.bitmap(bitmap)) + local specification = backends.codeinjections.bitmap(bitmap) + if specification then + return wrapimage(specification) + end end bitmaps.flush = flush function bitmaps.tocontext(bitmap,width,height) - if type(width) == "number" then - width = width .. "sp" - end - if type(height) == "number" then - height = height .. "sp" - end - if width or height then - context.scale ( - { - width = width, - height = height, - }, - flush(bitmap) - ) - else - context(flush(bitmap)) + local bmp = flush(bitmap) + if bmp then + if type(width) == "number" then + width = width .. "sp" + end + if type(height) == "number" then + height = height .. "sp" + end + if width or height then + context.scale ( + { + width = width, + height = height, + }, + bmp + ) + else + context(bmp) + end end end -- cgit v1.2.3