Skip to content

vg: consider adding a Gio-backed canvas #627

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

Closed
4 of 5 tasks
sbinet opened this issue Jun 11, 2020 · 14 comments · Fixed by #646
Closed
4 of 5 tasks

vg: consider adding a Gio-backed canvas #627

sbinet opened this issue Jun 11, 2020 · 14 comments · Fixed by #646

Comments

@sbinet
Copy link
Member

sbinet commented Jun 11, 2020

x/exp/shiny seems... not particularly maintained.

but there is a new kid in town: Gio.
and @ajstarks just created a canvas API on top of that:

(it'd be great to also have some kind of plot interactivity built on top of that...)

  • Gio support for affine transforms (translate,rotate,scale)
  • Gio support for stroke path
  • Gio support for arc path component
  • Gio support for dash-lines
  • integrate w/ Gio fonts handling

img

@kortschak
Copy link
Member

Agreed!

sbinet added a commit to sbinet-gonum/plot that referenced this issue Jun 11, 2020
@sbinet
Copy link
Member Author

sbinet commented Jun 17, 2020

Update: Gio is missing a few things just yet (I have added that list to the issue).

in the meantime, one could do the same trick than what I did for x/exp/shiny: draw the plot using vg/vgimg and display the resulting image in the Gio window.
it wouldn't be as fast as with direct Gio (which IIUC is GPU-accelerated) though.

@ajstarks
Copy link

FYI, giocanvas has a not-quite working version of arcs: https://github.com/ajstarks/giocanvas/blob/master/giocanvas.go Lines 522-586

@sbinet
Copy link
Member Author

sbinet commented Jun 18, 2020

here is what it could look like:

@kevinschoon
Copy link

I recently started work on a toy project to do interactive plotting here. Currently it just writes the resulting plot to a file which is monitored by another program, but Gio would be welcomed addition for native support. By interactive I'm referring to the modify->display feedback cycle, not interactivity of the plot itself.

@kortschak
Copy link
Member

By interactive I'm referring to the modify->display feedback cycle, not interactivity of the plot itself.

Both of these are very valuable.

sbinet added a commit to sbinet-gonum/plot that referenced this issue Jun 18, 2020
@sbinet
Copy link
Member Author

sbinet commented Jun 19, 2020

so, would the submission of a vg/vggio (? or vg/vgio?) backend using vg/vgimg to paint canvas as a (hopefully) temporary work around, be a well received PR?

having used my x/exp/vgshiny for some time and now my x/exp/vggio for a couple of days, the latter seems much smoother in redrawing things (at least on my machine), even via that hacky scaffolding.

@kortschak
Copy link
Member

I think so.

sbinet added a commit to sbinet-gonum/plot that referenced this issue Jun 19, 2020
sbinet added a commit to sbinet-gonum/plot that referenced this issue Jun 19, 2020
sbinet added a commit that referenced this issue Jun 19, 2020
* vg/vggio: first import of a Gio-backed canvas

Updates #627.
sbinet added a commit to sbinet-gonum/plot that referenced this issue Jun 23, 2020
sbinet added a commit to sbinet-gonum/plot that referenced this issue Jun 23, 2020
sbinet added a commit to sbinet-gonum/plot that referenced this issue Jun 23, 2020
@sbinet
Copy link
Member Author

sbinet commented Jun 23, 2020

since e7bc1a4 Gioui exposes affine transforms (rotate,scale,...).
I've started a "real" implementation using this API:
master...sbinet-gonum:vg-gio

not ready yet but it's starting to look somewhat ok. (if you don't need to draw any line, that is...)

sbinet added a commit to sbinet-gonum/plot that referenced this issue Jun 23, 2020
sbinet added a commit to sbinet-gonum/plot that referenced this issue Jul 1, 2020
sbinet added a commit to sbinet-gonum/plot that referenced this issue Aug 27, 2020
@sbinet
Copy link
Member Author

sbinet commented Aug 27, 2020

with 7054ba6, Gioui implements an "arc" path component.

sbinet added a commit to sbinet-gonum/plot that referenced this issue Aug 27, 2020
sbinet added a commit to sbinet-gonum/plot that referenced this issue Sep 2, 2020
sbinet added a commit to sbinet-gonum/plot that referenced this issue Nov 8, 2020
@sbinet
Copy link
Member Author

sbinet commented Nov 10, 2020

with 33c5fb6, Gioui implements a basic stroked path API.

@sbinet
Copy link
Member Author

sbinet commented Nov 10, 2020

dashed lines aren't implemented yet, but it's starting to come quite nicely together (if I may say so myself)
(the legend labels seem a bit akward)

func_golden

@sbinet
Copy link
Member Author

sbinet commented Nov 13, 2020

and.... dashing paths are almost in. (PR in flight upstream.)

here is what it looks like:
out

versus the equivalent vg/vgimg:
foo

sbinet added a commit to sbinet-gonum/plot that referenced this issue Dec 9, 2020
sbinet added a commit to sbinet-gonum/plot that referenced this issue Dec 9, 2020
@sbinet
Copy link
Member Author

sbinet commented Dec 9, 2020

with e71bf13, Gio has dashed stroked paths.

sbinet added a commit to sbinet-gonum/plot that referenced this issue Dec 9, 2020
sbinet added a commit to sbinet-gonum/plot that referenced this issue Dec 9, 2020
sbinet added a commit to sbinet-gonum/plot that referenced this issue Dec 9, 2020
sbinet added a commit to sbinet-gonum/plot that referenced this issue Dec 10, 2020
sbinet added a commit to sbinet-gonum/plot that referenced this issue Dec 11, 2020
sbinet added a commit that referenced this issue Dec 11, 2020
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 a pull request may close this issue.

4 participants