View Single Post
Old 04-14-2013, 05:39 AM   #155
NuPogodi
Connoisseur
NuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the endNuPogodi knows the complete value of PI to the end
 
Posts: 58
Karma: 31942
Join Date: Feb 2012
Device: Kindle 3, Tolino Shine, Kobo Glo
Quote:
Originally Posted by dimasic View Post
And maybe it's better to modify "Screen:" functions in lua than add three more compiled files?
If the following code still does not work, you may adjust it by yourself -- i still have neither K4 nor the framebuffer dump made by some lucky K4-owner.
Udachi!
Spoiler:

Code:
function Screen:fb2pgm(fin, fout, pack, bpp)
	local inputf = assert(io.open(fin,"rb"))
	if inputf then
		local outputf = assert(io.open(fout,"wb"))
		outputf:write("P5\n# Created by kindlepdfviewer\n"..G_width.." "..G_height.."\n255\n")
		if bpp == 8 then -- then needs free memory of G_width bytes, and not too fast
			local i, j, line
			for i=1, G_height do
				line = inputf:read(G_width)
				for j=1, G_width do
					outputf:write(string.char(255-string.byte(line, j)))
				end
			end
		else
...

Last edited by NuPogodi; 04-14-2013 at 07:50 AM. Reason: Added: string.char
NuPogodi is offline   Reply With Quote