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

vg/vggio seems broken with current release of gioui #750

Closed
lotodore opened this issue Jul 27, 2022 · 6 comments · Fixed by #770
Closed

vg/vggio seems broken with current release of gioui #750

lotodore opened this issue Jul 27, 2022 · 6 comments · Fixed by #770

Comments

@lotodore
Copy link

I'm trying to use gonum plot with gio.

I copied the example at https://github.com/gonum/plot/blob/master/vg/vggio/vggio_example_test.go and tried to run it somehow. The result when building is:

Build Error: go build -o /Users/maygames/Projects/plottest/__debug_bin -gcflags all=-N -l .
# gonum.org/v1/plot/vg/vggio
../../go/pkg/mod/gonum.org/v1/plot@v0.11.0/vg/vggio/context.go:36:13: undefined: op.StateOp
../../go/pkg/mod/gonum.org/v1/plot@v0.11.0/vg/vggio/context.go:45:23: undefined: op.Save
../../go/pkg/mod/gonum.org/v1/plot@v0.11.0/vg/vggio/context.go:63:12: cannot use f32.Pt(float32(x), float32(y)) (value of type "gioui.org/f32".Point) as type image.Point in argument to op.Offset
../../go/pkg/mod/gonum.org/v1/plot@v0.11.0/vg/vggio/vggio.go:231:15: undefined: clip.Dash
../../go/pkg/mod/gonum.org/v1/plot@v0.11.0/vg/vggio/vggio.go:241:3: unknown field 'Style' in struct literal of type clip.Stroke
../../go/pkg/mod/gonum.org/v1/plot@v0.11.0/vg/vggio/vggio.go:241:15: undefined: clip.StrokeStyle
../../go/pkg/mod/gonum.org/v1/plot@v0.11.0/vg/vggio/vggio.go:243:16: undefined: clip.FlatCap
../../go/pkg/mod/gonum.org/v1/plot@v0.11.0/vg/vggio/vggio.go:245:3: unknown field 'Dashes' in struct literal of type clip.Stroke
../../go/pkg/mod/gonum.org/v1/plot@v0.11.0/vg/vggio/vggio.go:260:9: clip.Outline{…}.Op().Add undefined (type clip.Op has no field or method Add)
../../go/pkg/mod/gonum.org/v1/plot@v0.11.0/vg/vggio/vggio.go:334:8: undefined: unit.Px
../../go/pkg/mod/gonum.org/v1/plot@v0.11.0/vg/vggio/vggio.go:245:3: too many errors (exit status 2)

I ran

go get -u
go mod tidy

but the result stays the same.

Maybe I did not consider certain version dependencies. At the same time, it seems that vggio is not compatible with the current version of gio, or that the above mentioned example file maybe is outdated. Is there any fix available for this?

@szaydel
Copy link
Contributor

szaydel commented Jul 27, 2022

I just pulled the master branch and confirmed that I can test and build the package:

$ go test -v
=== RUN   TestCanvas
    vggio_test.go:65: TODO: github actions for darwin with headless setup.
--- SKIP: TestCanvas (0.00s)
=== RUN   TestCollectionName
--- PASS: TestCollectionName (0.00s)
=== RUN   TestLabels
    vggio_test.go:169: TODO: github actions for darwin with headless setup.
--- SKIP: TestLabels (0.00s)
PASS
ok  	gonum.org/v1/plot/vg/vggio	0.441s
$ git log | head -1
Thu Jul 14 09:10:44 2022 -0400 c2b6359 (HEAD -> master, origin/master, origin/HEAD) plotutil: fix off-by-one indexing error in MedianAndMinMax  [Scott Kiesel]

$ go build -o test -gcflags all='-N -l' . ; echo $status
0

Presumably you are having problems regardless of flags. What OS are you running on?

I am testing this on Darwin:

Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000

@lotodore
Copy link
Author

Thanks for the feedback. Yes it runs fine with the latest master branch, but this branch is using
gioui.org v0.0.0-20210308172011-57750fc8a0a6
(according to go.mod) which is very old.

I'm using latest gioui.org, which does not seem to be compatible and causes the above errors. I am also testing on Darwin arm64.

@szaydel
Copy link
Contributor

szaydel commented Jul 28, 2022

I think the point here is that the module file is specifying version with which it is compatible. The APIs in the later version(s) of gioui.org presumably changed (basing this assumption on the output you provided), thus creating the problems you are observing. I would assume that someone will have to do whatever necessary work to adopt later version of gioui.org in place of v0.0.0-20210308172011-57750fc8a0a6.

@sbinet
Copy link
Member

sbinet commented Aug 18, 2022

yes, end of last year I tried to bring the Gio version we were using up to date with Gio's main, but failed b/c of some reproducibility errors (images didn't match, even with fuzzy matching enabled, from on run to another).

I left it at that.

and now, the API differences are even greater :(
(when I tried again earlier this year, Gio was missing support for stroked arcs. I believe there is now a way to stroke them again).

PRs to get vg/vggio up to date with Gio are welcomed :)

@lotodore
Copy link
Author

lotodore commented Sep 2, 2022

I gave it a shot, but I do not know what "Save" was supposed to do in

ctx.cur().state = op.Save(ctx.ops)
. I only know recent gioui, and I don't think that any function like this exists in the current release.

@sbinet
Copy link
Member

sbinet commented Aug 29, 2023

this will be fixed by #770

sbinet added a commit to sbinet-gonum/plot that referenced this issue Aug 29, 2023
Fixes gonum#750.

Signed-off-by: Sebastien Binet <binet@cern.ch>
sbinet added a commit that referenced this issue Aug 31, 2023
Fixes #750.

Signed-off-by: Sebastien Binet <binet@cern.ch>
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.

3 participants