mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Add color highlight menu (#11044)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
local BlitBuffer = require("ffi/blitbuffer")
|
||||
local CacheItem = require("cacheitem")
|
||||
local CanvasContext = require("document/canvascontext")
|
||||
local DocCache = require("document/doccache")
|
||||
@@ -244,6 +245,7 @@ function PdfDocument:saveHighlight(pageno, item)
|
||||
local quadpoints, n = _quadpointsFromPboxes(item.pboxes)
|
||||
local page = self._document:openPage(pageno)
|
||||
local annot_type = C.PDF_ANNOT_HIGHLIGHT
|
||||
local annot_color = BlitBuffer.colorFromName(item.color)
|
||||
if item.drawer == "lighten" then
|
||||
annot_type = C.PDF_ANNOT_HIGHLIGHT
|
||||
elseif item.drawer == "underscore" then
|
||||
@@ -251,7 +253,9 @@ function PdfDocument:saveHighlight(pageno, item)
|
||||
elseif item.drawer == "strikeout" then
|
||||
annot_type = C.PDF_ANNOT_STRIKE_OUT
|
||||
end
|
||||
page:addMarkupAnnotation(quadpoints, n, annot_type) -- may update/adjust quadpoints
|
||||
-- NOTE: For highlights, display style may differ compared to ReaderView:drawHighlightRect...
|
||||
-- (e.g., we do a MUL blend, MuPDF currently appears to do an OVER blend).
|
||||
page:addMarkupAnnotation(quadpoints, n, annot_type, annot_color) -- may update/adjust quadpoints
|
||||
-- Update pboxes with the possibly adjusted coordinates (this will have it updated
|
||||
-- in self.view.highlight.saved[page])
|
||||
item.pboxes = _quadpointsToPboxes(quadpoints, n)
|
||||
|
||||
Reference in New Issue
Block a user