Feature: Highlighter that works on PDFs
Creates a new type of brush: Highlighter
Addresses: #449
I added a new Highlighter brush designed for highlighting text on PDFs or notes. It features a pipeline to handle transparency correctly and includes an auto-straightening helper for cleaner lines.
Technical Implementation:
- New Layering: Added a PDFHighlighter layer to StrokeLayer
- Auto-Straighten: Added logic to detect roughly straight strokes and replace them with a single straight line automatically.
To fix Alpha-Accumulation
- Stroke is first drawn at 100% opacity
- Once the stroke is rasterized into an image, the alpha is applied
Demo:
Disclaimer: This implementation was primarily generated with the assistance of GitHub Copilot.
I just realized a similar highlighter exists https://github.com/flxzt/rnote/pull/1210, but my implementation still seems useful, because it is easier to find and usable as a pen instead of a shape.
An useful addition could be to modify the transparency/opacity
I agree. Although the shape is nice, the pen is what I'm most likely to use. Is the Auto-Straighten feature for all pens, or just for the highlighter?
Just for the highlighter right now