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

Custom renderers #218

Open
bmuessig opened this issue Apr 9, 2023 · 3 comments
Open

Custom renderers #218

bmuessig opened this issue Apr 9, 2023 · 3 comments

Comments

@bmuessig
Copy link

bmuessig commented Apr 9, 2023

Hi @tdewolff,

thanks a lot for providing this well-written and useful library.

I am currently in the process of writing a custom renderer for a JSON-based vector format I developed and use in many projects.
The internal renderers do most of their path rendering directly in path.go with access to the private backing array.

Is there a way to do this with similar efficiency via the public API?
I've had a quick look at Scanner, but it does not appear to provide the same amount of command detail as is available internally.

A perhaps more modular renderer system would be useful for the next major version, where renderers are implemented externally and could be put into their own repositories (especially OpenGL, which has many dependencies).

@tdewolff
Copy link
Owner

tdewolff commented Apr 9, 2023

Hey Benedikt, thanks for the kind words, I'm happy to hear that the library is proving useful to you!

I've added the Path.Data function to get the private d []float64 data field, however the Scanner interface actually allows you to fully retrieve all path data and is a cleaner approach. What does the scanner not allow you to get?

@bmuessig
Copy link
Author

bmuessig commented Apr 9, 2023

I've added the Path.Data function to get the private d []float64 data field

Thank you very much for the quick reply and the addition.

however the Scanner interface actually allows you to fully retrieve all path data and is a cleaner approach. What does the scanner not allow you to get?

You are right, I have no idea how I did not see the Scanner.Cmd() at first glance - perhaps it somehow got lost in my IDE autocomplete. It appears to be all there.

What I thought might be useful for the next major version would be to implement the existing renderers via the Scanner interface to avoid baking them into the Path struct.

@tdewolff
Copy link
Owner

tdewolff commented Apr 9, 2023

That's a great idea, especially for the OpenGL renderer and maybe the Fyne and Gio renderers!

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

No branches or pull requests

2 participants