Files
koreader/frontend/document/picdocument.lua

33 lines
761 B
Lua
Raw Normal View History

local Document = require("document/document")
2013-12-31 13:12:56 +08:00
local DrawContext = require("ffi/drawcontext")
2013-10-17 17:34:55 -04:00
local PicDocument = Document:new{
2014-03-13 21:52:43 +08:00
_document = false,
dc_null = DrawContext.new()
2013-10-17 17:34:55 -04:00
}
function PicDocument:init()
2014-03-13 21:52:43 +08:00
require "libs/libkoreader-pic"
ok, self._document = pcall(pic.openDocument, self.file)
if not ok then
self.error_message = "failed to open jpeg image"
return
end
2013-10-17 17:34:55 -04:00
2014-03-13 21:52:43 +08:00
self.info.has_pages = true
self.info.configurable = false
2013-10-17 17:34:55 -04:00
2014-03-13 21:52:43 +08:00
self:readMetadata()
2013-10-17 17:34:55 -04:00
end
function PicDocument:readMetadata()
2014-03-13 21:52:43 +08:00
self.info.number_of_pages = 1
2013-10-17 17:34:55 -04:00
end
function PicDocument:register(registry)
2014-03-13 21:52:43 +08:00
registry:addProvider("jpeg", "application/jpeg", self)
registry:addProvider("jpg", "application/jpeg", self)
end
2013-10-17 17:34:55 -04:00
return PicDocument