|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
local Blitbuffer = require("ffi/blitbuffer")
|
|
|
|
|
local Document = require("document/document")
|
|
|
|
|
local DrawContext = require("ffi/drawcontext")
|
|
|
|
|
local KoptOptions = require("ui/data/koptoptions")
|
|
|
|
@ -10,7 +11,7 @@ local DjvuDocument = Document:new{
|
|
|
|
|
dc_null = DrawContext.new(),
|
|
|
|
|
options = KoptOptions,
|
|
|
|
|
koptinterface = nil,
|
|
|
|
|
is_color_capable = false,
|
|
|
|
|
color_bb_type = Blitbuffer.TYPE_BBRGB24,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- check DjVu magic string to validate
|
|
|
|
@ -33,7 +34,7 @@ function DjvuDocument:init()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local ok
|
|
|
|
|
ok, self._document = pcall(djvu.openDocument, self.file, self.djvulibre_cache_size)
|
|
|
|
|
ok, self._document = pcall(djvu.openDocument, self.file, self.render_color, self.djvulibre_cache_size)
|
|
|
|
|
if not ok then
|
|
|
|
|
error(self._document) -- will contain error message
|
|
|
|
|
end
|
|
|
|
@ -43,6 +44,13 @@ function DjvuDocument:init()
|
|
|
|
|
self:_readMetadata()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function DjvuDocument:updateColorRendering()
|
|
|
|
|
Document.updateColorRendering(self) -- will set self.render_color
|
|
|
|
|
if self._document then
|
|
|
|
|
self._document:setColorRendering(self.render_color)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function DjvuDocument:getProps()
|
|
|
|
|
local _, _, docname = self.file:find(".*/(.*)")
|
|
|
|
|
docname = docname or self.file
|
|
|
|
|