Does the ecosystem need a standard interface for vector graphic?

164 views
Skip to first unread message

Robert Johnstone

unread,
Aug 14, 2018, 11:16:16 AM8/14/18
to golang-nuts
In two recent projects, I have run up to the problem of creating vector graphics.  In one case, the project used gonum.org/v1/plot/vg to provide output, and in another github.com/llgcode/draw2d.  I've also found golang.org/x/image/vector.  In all of these cases, we have an interface that models fairly close the postscript model for drawing 2D graphics.  There is also duplication in the backends.  It would be nice if there was a standard ecosystem wide interface for painting 2D graphics.

I expect that providing implementations would be outside the scope of the language, but I see an approach similar to database/sql being useful here.  There would be a package containing a standard interface to provide a graphics context (either image/gc or golang.org/x/image/gc).  

Has this been discussed elsewhere?  Would it be useful?

george.mo...@gmail.com

unread,
Aug 14, 2018, 6:45:58 PM8/14/18
to golang-nuts
A general interface would be extremely useful (at least to me ;-).
I am not sure about the postscript-based API (I am not against it though) and I find the the name `image/gc` a bit confusing (vector <-> image, gc ~ garbage-collector).

Sebastien Binet

unread,
Aug 14, 2018, 6:50:22 PM8/14/18
to george.mo...@gmail.com, golang-nuts
FYI (and IIRC), the vg package from (now) gonum/plot is actually inspired from the canvas html5 API.

-s

sent from my droid

On Wed, Aug 15, 2018, 00:45 <george.mo...@gmail.com> wrote:
A general interface would be extremely useful (at least to me ;-).
I am not sure about the postscript-based API (I am not against it though) and I find the the name `image/gc` a bit confusing (vector <-> image, gc ~ garbage-collector).

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

george.mo...@gmail.com

unread,
Aug 15, 2018, 12:46:13 AM8/15/18
to golang-nuts
 inspired from the canvas html5 API.

That's another option, but maybe it's optimized for raster-graphics rather than vector graphics?

Robert Johnstone

unread,
Aug 15, 2018, 1:04:45 PM8/15/18
to golang-nuts
Agreed.  image/vector would be better, but it would conflict with the existing golang.org/x/image/vector

George Moschovitis

unread,
Aug 15, 2018, 1:11:16 PM8/15/18
to Robert Johnstone, golang-nuts

--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/cdRpSOjVyRg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages