Skip to content

Conversation

@shivaprsd
Copy link
Owner

Fixes #19.

Recently I started noticing that pages can have AnnotationEditorLayers
*even* when their canvas is discarded, so... that's that. #pdfjsQuirks
Those highlights can be a bit brighter when there is no text underneath.
This is a major overhaul of both SVG and non-SVG annotation handling.
The patch achieves the following things:

  * fully seperate add-on logic from core by moving the remaining viewer
    related code from `lib/` to `app/`, completing the work of 7b0c8de;
  * generalise SVG annotation handling and correctly recolor ink (draw)
    annotations in PDF.js 4.9+, as they have now been made SVG as well;
  * better reassign various parts of annotations event handling to the
    different modules; and
  * rename, reorder and clean up the `annots.js` functions and exports.

This refactor should also finally enable *doq* lib users to theme PDF.js
annotations in non-viewer environments, as they can pass the appropriate
container elements to the exported functions of `annots.js`.
Instead of drawing the mask on the canvas and waiting for PDF.js, we can
directly blend the image with the mask and return the result for drawing
with the normal source-over. This is logically simpler and less prone to
breaking with complicated multi-image arrangements (sometimes found for
title decorations in books). This also calls for some apt renamings.
Like 89a6f95; since canvas gradients and patterns are currently left off
from interpolation, we need to test against backgrounds containing them.
Apparently, this can happen in normal PDFs and PDF.js still proceeds to
render them, so... that's that. #pdfjsQuirks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

readCanvasColor returns empty Color object if text is outside canvas boundaries

2 participants