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

A pen with a transparent color isn't homogenously transparent, but leaves less transparent circles #891

Open
NandorKovacs opened this issue Nov 17, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@NandorKovacs
Copy link

Describe the bug
If you write with a thicker pen and a transparent color, it isn't homogenously transparent, but rather leaves little circles where its less transparent. I think it "draws twice" in those places probably. This more visible if your stroke is fast. It appears with a mouse, as well as with my drawing tablet.

To Reproduce
Steps to reproduce the behavior:

  1. Click on the color picker
  2. Select any color you like, and set it to transparent, around halfway works well
  3. Select the thick pen option, or even the marker (that is even more thick)
  4. Make a few strokes
  5. You will see your stroke, with little darker circles inside of it

Expected behavior
The pen should leave a smooth transparent stroke

Console Output
Running the app with flatpak --env=RUST_LOG=rnote=debug --env=RUST_BACKTRACE=1 run com.github.flxzt.rnote gives following output:
` 2023-11-17T17:09:17.388Z DEBUG rnote > ... env_logger initialized

(rnote:2): Gtk-CRITICAL **: 18:09:17.690: gtk_widget_class_set_accessible_role: assertion '!gtk_accessible_role_is_abstract (accessible_role)' failed
2023-11-17T17:09:17.716Z WARN rnote::workspacebrowser::workspacesbar > failed to canonicalize dir "/home/nandor/Desktop/rnote/studium/analysis" for workspacelistentry with name: default, Err: No such file or directory (os error 2)
`
I don't think anything here is relevant, but why not include it
Screenshots
image
Well visible circles.

Desktop (please complete the following information):

  • OS: Ubuntu 23.04 x86_64
  • App Version: Rnote 0.9.0
  • Installation Source: Flatpak
  • Desktop Environment: Gnome 44.3

Additional context
It is vaguely related to #449 . I wanted to highlight on a pdf, and set the marker to be transparent. This looks not well enough for me to be able to use transparent colors anywhere. From what im guessing, the circles are perfectly circular because exactly one point overlaps, making the circle around it half as transparent.

@tipptop3d
Copy link

Maybe a pen with a multiply blend mode would be a quick fix (brush that only affects white colors but not black colors).

@flxzt
Copy link
Owner

flxzt commented Nov 20, 2023

Good idea, but unfortunately the underlying drawing API does not support blend modes, so currently this issue is a bit stuck

@flxzt flxzt added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels Nov 20, 2023
@taaem
Copy link

taaem commented Jun 24, 2024

As far as I understand it, this projet uses piet to render the canvas, piet is itself in this context an abstraction layer ontop of cairo.

Cairo itself supports all different types of rendering modes (https://www.cairographics.org/operators/), which in this case would be the CAIRO_OPERATOR_MULTIPLY - this is also what xournalpp uses for its highlighter (for reference: https://github.com/xournalpp/xournalpp/blob/583a4e4728c1cc0d33101c0d30f8605cd5312a00/src/core/view/ErasableStrokeView.cpp#L137).

Thus, this is blocked by piet not exposing cairo operators to its api? Because piet is using the operators itself (reference: https://github.com/linebender/piet/blob/master/piet-cairo/src/lib.rs#L97), isn't there a way to access the cairo context piet uses?

My understanding of the code is, that https://github.com/flxzt/rnote/blob/main/crates/rnote-engine/src/strokes/brushstroke.rs#L197 is place where the context is constructed, I'm not familiar with Rust, so I don't know if its possible to just access the underlaying cairo context and do something like:

ctx.set_operator(cairo::Operator::Multiply);

or if the stroke_styled() function of piet should expose a (optional?) operator field?

This is to the best of my knowledge and I'm sorry if this is all wrong, but if not I think this should also fix #449.

Thanks for this project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants