CRE/ImageViewer: get scaled blitbuffer when long-press on SVG

Get a Lua userdata wrapping a crengine LVSvgImageSource object
when long-press on a SVG image, and have crengine/LunaSVG render
it smoothly scaled to the requested size by ImageViewer.
This commit is contained in:
poire-z
2022-09-11 19:55:28 +02:00
parent 1c44c4c584
commit 76a7d83079
3 changed files with 55 additions and 6 deletions

View File

@@ -1008,7 +1008,9 @@ function ReaderHighlight:onHold(arg, ges)
-- check if we were holding on an image
-- we provide want_frames=true, so we get a list of images for
-- animated GIFs (supported by ImageViewer)
local image = self.ui.document:getImageFromPosition(self.hold_pos, true)
-- We provide accept_cre_scalable_image=true to get, if the image is a SVG image,
-- a function that ImageViewer can use to get a perfect bb at any scale factor.
local image = self.ui.document:getImageFromPosition(self.hold_pos, true, true)
if image then
logger.dbg("hold on image")
local ImageViewer = require("ui/widget/imageviewer")