2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00
koreader/frontend/document/picdocument.lua
2013-12-31 13:12:56 +08:00

33 lines
713 B
Lua

local Document = require("document/document")
local DrawContext = require("ffi/drawcontext")
local PicDocument = Document:new{
_document = false,
dc_null = DrawContext.new()
}
function PicDocument:init()
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
self.info.has_pages = true
self.info.configurable = false
self:readMetadata()
end
function PicDocument:readMetadata()
self.info.number_of_pages = 1
end
function PicDocument:register(registry)
registry:addProvider("jpeg", "application/jpeg", self)
registry:addProvider("jpg", "application/jpeg", self)
end
return PicDocument