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

Render PDF with Vello[WIP] #26

Merged
merged 25 commits into from
Oct 10, 2024
Merged

Render PDF with Vello[WIP] #26

merged 25 commits into from
Oct 10, 2024

Conversation

videni
Copy link

@videni videni commented Jul 22, 2024

This Pull Request is currently under progress and is not ready for merging, here are what this PR focuses on:

PDF

  • Able to render pages with Vello
  • Show bookmarks
  • Add annotation
  • Freepen drawing
  • Erazer

UI

What GUI libraries I checked

  • Iced
    Simple in concept, but not practical for complex projects, the Elm philosophy in Iced forces users to create a big message tree and a view tree associated with these messages, lots of boilerplate codes. I spent 3 weeks to build a demo on top of Iced. But the source code of Iced is structured very well, with clear separation for each layer, high-quality code. It may evolve rapidly to figure out a better way to mitigate the pain I just mentioned. I might be wrong about this, please correct me if it is not this case.

  • Xilem
    More natural than Iced, but not ready to use, lots of essential widgets are missing.

Goal

After evaluating all these features above, we will start to implement a full version of modern PDF note-taking, reader app that will be available for ALL platforms including MacOS, Linux, Windows, Android, IOS, also the web.

@videni videni changed the title Render PDF with Vello Render PDF with Vello[WIP] Jul 22, 2024
@mermerico
Copy link

Thanks for doing all this work! It seems like this is well on the way to becoming the best (fastest) open source PDF viewer! I'd like to contribute if possible (I'm a Rust newbie, but I have C++ experience). What (if any) UI framework were you thinking of using? My initial assumption was Xilem due to its relationship with Vello, but it seems like it's currently very early in its development. I would personally love to implement the basic UI of Evince: a scrolling list of pages in the main view and a smaller one as thumbnails. I think the key here would be to have a facility for lazily loading the pages according to what's currently in view.

Evince

Key::Named(NamedKey::ArrowLeft) => self.view_ctx.seek_backwards(1),
_ => {}
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my local copy I added a render_state.window.request_redraw() here so that the page change shows up.

@videni
Copy link
Author

videni commented Aug 22, 2024

@mermerico , Xilem is not GUI yet, currently we have to wait, otherwise, we will do lots of duplicate works. I am evaluating the Iced GUI recently, I checked its source code, build a home page to show a list of PDF files on my local, it is well structured, high quality code, it seems very future proving. so I prefer the Iced GUI at the moment.

@videni
Copy link
Author

videni commented Aug 22, 2024

By the way, I really dislike the phylosophy of Elm that Iced used to structure application logic, it results in lots of boilerplate codes, you can check this real project hecrj/icebreaker) from the founder of the Iced GUI. basically, it needs a big message tree you must define for all your views also a view tree to handle these message, and we have to dispatch the massage to its view from top to bottom manually. Comparing with the example from Xilem TodoMvc, Xilem is a great relief to me after experiment with Iced for 3 weeks.

@mermerico
Copy link

Iced looks like a good choice (although I agree it seems like you have to do a lot of boilerplate work). It looks like they haven't implemented a lazy view / infinite scrolling functionality so I think I might just roll my own. I'm thinking that for the pages and thumbnails view panes we can basically ignore the GUI library and render everything directly in Vello.

@videni
Copy link
Author

videni commented Aug 23, 2024

@mermerico They have a list widget, but not in the master branch. Check branch feature/list-widget-reloaded instead.

@mermerico
Copy link

Oh, very cool! I missed that. Okay, it'll take me a bit to get fully acquainted with how Iced works. I'll let you know when I have a prototype!

@s3bk s3bk merged commit f8b02aa into pdf-rs:vello Oct 10, 2024
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.

3 participants