From b2e1bbf8c375e1176d4b40acca1092354e211dd5 Mon Sep 17 00:00:00 2001 From: keringo <> Date: Thu, 26 Jun 2025 00:24:27 +0300 Subject: [PATCH] a few more black_hexes and white_hexes --- frontend/apps/reader/modules/readerpaging.lua | 6 ++++++ frontend/apps/reader/modules/readerview.lua | 12 ++++++++++-- frontend/document/koptinterface.lua | 4 ++-- frontend/ui/data/koptoptions.lua | 4 ++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/frontend/apps/reader/modules/readerpaging.lua b/frontend/apps/reader/modules/readerpaging.lua index 577ea40f0..922c871ee 100644 --- a/frontend/apps/reader/modules/readerpaging.lua +++ b/frontend/apps/reader/modules/readerpaging.lua @@ -19,6 +19,8 @@ local function copyPageState(page_state) zoom = page_state.zoom, rotation = page_state.rotation, gamma = page_state.gamma, + black_hex = page_state.black_hex, + white_hex = page_state.white_hex, offset = page_state.offset:copy(), visible_area = page_state.visible_area:copy(), page_area = page_state.page_area:copy(), @@ -739,6 +741,8 @@ function ReaderPaging:getNextPageState(blank_area, image_offset) zoom = self.view.state.zoom, rotation = self.view.state.rotation, gamma = self.view.state.gamma, + black_hex = self.view.state.black_hex, + white_hex = self.view.state.white_hex, offset = page_offset, visible_area = visible_area, page_area = page_area, @@ -766,6 +770,8 @@ function ReaderPaging:getPrevPageState(blank_area, image_offset) zoom = self.view.state.zoom, rotation = self.view.state.rotation, gamma = self.view.state.gamma, + black_hex = self.view.state.black_hex, + white_hex = self.view.state.white_hex, offset = page_offset, visible_area = visible_area, page_area = page_area, diff --git a/frontend/apps/reader/modules/readerview.lua b/frontend/apps/reader/modules/readerview.lua index f111018bc..6f16f0cb4 100644 --- a/frontend/apps/reader/modules/readerview.lua +++ b/frontend/apps/reader/modules/readerview.lua @@ -86,6 +86,8 @@ function ReaderView:init() zoom = 1.0, rotation = 0, gamma = 1.0, + black_hex = 0x000000, + white_hex = 0xFFFFFF, offset = nil, bbox = nil, } @@ -384,7 +386,9 @@ function ReaderView:drawScrollPages(bb, x, y) state.page, state.zoom, state.rotation, - state.gamma) + state.gamma, + state.black_hex, + state.white_hex) pos.y = pos.y + state.visible_area.h -- draw page gap if not the last part if page ~= #self.page_states then @@ -458,7 +462,9 @@ function ReaderView:drawSinglePage(bb, x, y) self.state.page, self.state.zoom, self.state.rotation, - self.state.gamma) + self.state.gamma, + self.state.black_hex, + self.state.white_hex) UIManager:nextTick(self.emitHintPageEvent) end @@ -871,6 +877,8 @@ function ReaderView:getViewContext() zoom = self.state.zoom, rotation = self.state.rotation, gamma = self.state.gamma, + black_hex = self.state.black_hex, + white_hex = self.state.white_hex, offset = self.state.offset:copy(), bbox = self.state.bbox, }, diff --git a/frontend/document/koptinterface.lua b/frontend/document/koptinterface.lua index 75a1bfe44..722255c34 100644 --- a/frontend/document/koptinterface.lua +++ b/frontend/document/koptinterface.lua @@ -537,13 +537,13 @@ function KoptInterface:hintReflowedPage(doc, pageno, zoom, rotation, gamma, hint end end -function KoptInterface:drawPage(doc, target, x, y, rect, pageno, zoom, rotation, gamma) +function KoptInterface:drawPage(doc, target, x, y, rect, pageno, zoom, rotation, gamma, black_hex, white_hex) if doc.configurable.text_wrap == 1 then self:drawContextPage(doc, target, x, y, rect, pageno, zoom, rotation) elseif doc.configurable.page_opt == 1 or doc.configurable.auto_straighten > 0 then self:drawContextPage(doc, target, x, y, rect, pageno, zoom, rotation) else - Document.drawPage(doc, target, x, y, rect, pageno, zoom, rotation, gamma) + Document.drawPage(doc, target, x, y, rect, pageno, zoom, rotation, gamma, black_hex, white_hex) end end diff --git a/frontend/ui/data/koptoptions.lua b/frontend/ui/data/koptoptions.lua index 043d80626..dc48ffe6a 100644 --- a/frontend/ui/data/koptoptions.lua +++ b/frontend/ui/data/koptoptions.lua @@ -507,7 +507,7 @@ Some of the other settings are only available when reflow mode is enabled.]]), buttonprogress = true, -- For pdf reflowing mode (kopt_contrast): values = {0x808080, 0x606060, 0x404040, 0x202020, 0x000000}, - default_pos = 2, + default_pos = 5, default_value = G_defaults:readSetting("DKOPTREADER_CONFIG_BLACK_HEX"), event = "BlackLevelUpdate", -- For pdf non-reflowing mode (mupdf): @@ -521,7 +521,7 @@ Some of the other settings are only available when reflow mode is enabled.]]), buttonprogress = true, -- For pdf reflowing mode (kopt_contrast): values = {0xFFFFFF, 0xE0E0E0, 0xC0C0C0, 0xA0A0A0, 0x808080}, - default_pos = 2, + default_pos = 1, default_value = G_defaults:readSetting("DKOPTREADER_CONFIG_WHITE_HEX"), event = "WhiteLevelUpdate", -- For pdf non-reflowing mode (mupdf):