lucasrla / remarks

Extract annotations (highlights and scribbles) from PDF, EPUB, and notebooks marked with reMarkable tablets. Export to Markdown, PDF, PNG, SVG
GNU General Public License v3.0
347 stars 20 forks source link

Improve eraser handling #69

Open Azeirah opened 1 year ago

Azeirah commented 1 year ago

I made two improvements to the eraser.

  1. I made sure that the eraser will always draw with a white color.
  2. The eraser width now scales linearly with base_width rather than exponentially

I think the fix to always draw with a white color is correct.

The width scaling is still a bit off, but I think it's better to have a more constant scaling.

I have tested this with three notebooks, one is a notebook with hundreds of pages of written text, and the others are shown in the related issue request: https://github.com/lucasrla/remarks/issues/65

Azeirah commented 1 year ago

Just to make sure this code won't have major impacts on certain notebooks, I wanted to check whether I could influence the eraser size on my ReMarkable.

I took a notebook with a lot of black, so I can see the size of the eraser clearly.

  1. Move the physical eraser at the back of the pen from the top to the bottom of the page, gradually increasing pressure. The width of the eraser remained constant
  2. Move the eraser tool using the pen tip from the top to the bottom of the page, gradually increasing pressure. The width of the eraser remained constant

I think if we want to solve the eraser width very precisely, we could approach it the following way

  1. Find out how to reproduce the varying base_widths of the eraser on a real notebook.
    • in my .rm files I found values of [1, 2, 2.4] so far). With base_width I mean the w value that is read from the .rm file, corresponding to an eventual stroke_width after some calculations.
    • Does pressure influence this value?
      • For the pen eraser tool
      • For the physical eraser on the back
    • Does tilt influence this value?
      • For the pen eraser tool
      • For the physical eraser on the back
    • What values can we get?
  2. Create a notebook that is entirely black
  3. For all base_width values that we have found are possible, measure as exactly as possible the width of the eraser that ReMarkable renders on their device.
  4. Use those measurements to create a table that is as precise as possible.

Although, this approach might not work as long as other tools also have stroke-widths that do not correspond exactly with ReMarkable's internal output.

Alternatively, we could simplify the measuring steps by reading the actual framebuffer or possibly even by going through the binary using ghidra.


Anyway, that's for if we want to achieve perfection. For now "pretty good" is good enough :p

Azeirah commented 1 year ago

I'm having trouble finding good values for the eraser width. The linear scaling does not work quite as I want.

In one document, a larger linear parameter results is desired, in another this makes the eraser too large.

rmc Doesn't have a better approach either. It simply does base_width * 2.

Azeirah commented 1 year ago

Might be best to split this PR up into two individual PRs. One for the color issue, which I think is ready for merging, and another for the scaling.