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

feat: add inkml parser and writer #1320

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Doublonmousse
Copy link
Collaborator

@Doublonmousse Doublonmousse commented Dec 8, 2024

Related to #744 (import of selected onenote strokes, but exclusive to that. No text nor images are read).

As I'm on windows, I'm using #1282 for now.
The parser/writer crate is on a separate repository here https://github.com/Doublonmousse/writer_reader_inkml

Export and import are supported (from the clipboard).

  • I think it would make sense to move some of the import code inside the engine (conversion from inkml to stroke ?)
  • The export part is only for brush strokes (I could extend it to shapes with lines being the easiest to do, and other shapes would have to be discretized)
  • I'm using the windows equivalent of the mime type for the inkml clipboard export part
  • The crate still needs some polishing (better error message and removing some potentially panic inducing unwrap with error propagation instead).

I've encountered a weird behavior with clipboards in gtk and windows (that ofc I can't reproduce today ...). Copying ink content then an image from a source application wouldn't work as somehow gtk would think the inkml format was still present before failing with a gio quark error.

@Doublonmousse Doublonmousse changed the title add inkml parser feat: add inkml parser and writer Dec 13, 2024
Moving some of the methods closer to the engine for pasting.
@Doublonmousse
Copy link
Collaborator Author

It's starting to look somewhat reasonable. I'm still not fully sure the modifications are done in the right place.

And I've encountered again a gtk bug with the clipboard (this time I could reproduce)
Recording 2024-12-30 171734_compress.webm

56.954780700s ERROR rnote::appwindow::actions: Failed to read clipboard data while pasting as inkml, Err: Error { domain: g-io-error-quark, code: 0, message: "Cannot get clipboard data. No compatible transfer format found." }

I wonder if it's possible to refactor the code to try the next mimetype if the first one failed. Though that's ultimately a workaround for a gtk/gio bug (I'll probably try to open a bug report on the gtk or gio gitlab later)

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.

1 participant