Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Efficiency vs accuracy of rendering eraser strokes #8

Open
bordaigorl opened this issue Dec 26, 2020 · 0 comments
Open

Efficiency vs accuracy of rendering eraser strokes #8

bordaigorl opened this issue Dec 26, 2020 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@bordaigorl
Copy link
Owner

@karlicoss asked:

I didn't quite understand from the readme (and from a brief look at pagerender.py), what's the core cause of slow erasing? Is this because without eraser drawing is relatively straightforward -- you need to draw the layers from bottom to top; whereas the eraser acts on all the layers simultaneously? Or is it because it's not a 'native' operation in QT canvas, and you have to 'subtract' the strokes?

Mainly it's because there is no native way to clip to the outline of a path.
I don't know if there is a better way, but my best guess to reproduce the eraser accurately works like this:

  1. you draw everything from bottom to top (i.e. following the order of appearance in the file)
  2. when processing an eraser stroke you have to clip everything you drew in the current layer so far
  3. the clipping needs to be wrt the complement of the outline of the strokes of the eraser, drawn as if it was a fineliner stroke. The expensive part is computing the complement of the outline: in Qt this triggers a path simplification routine which blocks everything and is very expensive on the kind of strokes produced by the remarkable.

Annoyingly:

  • you cannot just do one clip per layer
  • you cannot really avoid the simplification step
  • you could ignore the eraser strokes completely if they only intersect with some other strokes like fineliner: this is because the tablet itself already removes the strokes that intersect with the eraser from the file; but for dynamic width brushes that can be used to paint wide black areas (like paintbrush) some parts of the eraser strokes may have intersections with the painted area that cannot be reduced to removing strokes (try painting an area black and then erase a smiley from it with the various tools)
  • you cannot use Qt.transparent because it only works as expected in raster mode

As far as I know, all other renderers either:

  • ignore eraser strokes completely
  • paint white
  • only properly handle eraser in raster output

I am opening this issue in case somebody has suggestions on how to improve eraser rendering.

@bordaigorl bordaigorl added the help wanted Extra attention is needed label Dec 26, 2020
@bordaigorl bordaigorl mentioned this issue Dec 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant