2
0
mirror of https://github.com/koreader/koreader synced 2024-11-18 03:25:46 +00:00
koreader/frontend/document/picdocument.lua

33 lines
713 B
Lua
Raw Normal View History

local Document = require("document/document")
2013-12-31 05:12:56 +00:00
local DrawContext = require("ffi/drawcontext")
2013-10-17 21:34:55 +00:00
local PicDocument = Document:new{
2013-10-17 21:34:55 +00:00
_document = false,
2013-12-31 05:12:56 +00:00
dc_null = DrawContext.new()
2013-10-17 21:34:55 +00:00
}
function PicDocument:init()
2013-12-31 05:12:56 +00:00
require "libs/libkoreader-pic"
2013-10-17 21:34:55 +00:00
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
2013-10-17 21:34:55 +00:00
return PicDocument