changed gamma handling: now we multiply.

pull/2/merge
HW 13 years ago
parent a6541596ce
commit e54ce6a358

@ -29,7 +29,7 @@ ZOOM_FIT_TO_CONTENT = -4
ZOOM_FIT_TO_CONTENT_WIDTH = -5 ZOOM_FIT_TO_CONTENT_WIDTH = -5
ZOOM_FIT_TO_CONTENT_HEIGHT = -6 ZOOM_FIT_TO_CONTENT_HEIGHT = -6
GAMMA_NO_GAMMA = -1.0 GAMMA_NO_GAMMA = 1.0
-- option parsing: -- option parsing:
longopts = { longopts = {
@ -66,6 +66,8 @@ globalgamma = GAMMA_NO_GAMMA
fullwidth = 0 fullwidth = 0
fullheight = 0 fullheight = 0
offset_x = 0
offset_y = 0
shiftmode = false shiftmode = false
@ -100,8 +102,6 @@ nulldc = pdf.newDC()
function setzoom(page, cacheslot) function setzoom(page, cacheslot)
local dc = pdf.newDC() local dc = pdf.newDC()
local pwidth, pheight = page:getSize(nulldc) local pwidth, pheight = page:getSize(nulldc)
local offset_x = 0
local offset_y = 0
if globalzoommode == ZOOM_FIT_TO_PAGE then if globalzoommode == ZOOM_FIT_TO_PAGE then
globalzoom = width / pwidth globalzoom = width / pwidth
@ -189,12 +189,9 @@ function goto(no)
end end
end end
function modify_gamma(offset) function modify_gamma(factor)
if globalgamma == -1 then print("modify_gamma, gamma="..globalgamma.." factor="..factor)
globalgamma = 1 globalgamma = globalgamma * factor;
end
print("modify_gamma, gamma="..globalgamma.." offset="..offset)
globalgamma = globalgamma + offset;
goto(pageno) goto(pageno)
end end
function setglobalzoommode(newzoommode) function setglobalzoommode(newzoommode)
@ -233,9 +230,9 @@ function mainloop()
elseif ev.code == KEY_BACK then elseif ev.code == KEY_BACK then
return return
elseif ev.code == KEY_FW_UP then elseif ev.code == KEY_FW_UP then
modify_gamma( 0.2 ) modify_gamma( 1.25 )
elseif ev.code == KEY_FW_DOWN then elseif ev.code == KEY_FW_DOWN then
modify_gamma( -0.2 ) modify_gamma( 0.8 )
elseif ev.code == KEY_A then elseif ev.code == KEY_A then
if shiftmode then if shiftmode then
setglobalzoommode(ZOOM_FIT_TO_CONTENT) setglobalzoommode(ZOOM_FIT_TO_CONTENT)

Loading…
Cancel
Save