|
|
@ -414,9 +414,18 @@ function Document:getDrawnImagesStatistics()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function Document:getPagePart(pageno, rect, rotation)
|
|
|
|
function Document:getPagePart(pageno, rect, rotation)
|
|
|
|
local tile = self:renderPage(pageno, rect, 1, rotation, 1, 0)
|
|
|
|
local canvas_size = CanvasContext:getSize()
|
|
|
|
local target = Blitbuffer.new(rect.w, rect.h, self.render_color and self.color_bb_type or nil)
|
|
|
|
local zoom = math.min(canvas_size.w*2 / rect.w, canvas_size.h*2 / rect.h)
|
|
|
|
target:blitFrom(tile.bb, 0, 0, rect.x, rect.y, rect.w, rect.h)
|
|
|
|
-- it's really, really important to do math.floor, otherwise we get image projection
|
|
|
|
|
|
|
|
local scaled_rect = {
|
|
|
|
|
|
|
|
x = math.floor(rect.x * zoom),
|
|
|
|
|
|
|
|
y = math.floor(rect.y * zoom),
|
|
|
|
|
|
|
|
w = math.floor(rect.w * zoom),
|
|
|
|
|
|
|
|
h = math.floor(rect.h * zoom),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
local tile = self:renderPage(pageno, scaled_rect, zoom, rotation, 1, 0)
|
|
|
|
|
|
|
|
local target = Blitbuffer.new(scaled_rect.w, scaled_rect.h, self.render_color and self.color_bb_type or nil)
|
|
|
|
|
|
|
|
target:blitFrom(tile.bb, 0, 0, scaled_rect.x, scaled_rect.y, scaled_rect.w, scaled_rect.h)
|
|
|
|
return target
|
|
|
|
return target
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|