Python Bindings?

947 views
Skip to first unread message

Christopher Barker

unread,
Feb 10, 2013, 2:36:02 PM2/10/13
to skia-d...@googlegroups.com
Hey folks,

It looks like Python bindings to skia have been on the "we'd like to do that" list for a while now.

Is anyone working on that?

I've got a Python-based project that skia would be good for, so I may start on a bindings project myself, but I don't want to start from scratch if I don't need to. Also, I"ll probably only bind the bits that I really need, so a larger development group would be nice, to flesh it out into a full package.

If there isn't anything started, I'll most likely use Cython to write the bindings, but if there is a project started, I' open to other approaches.

Thanks,
  -Chris

Mike Reed

unread,
Feb 11, 2013, 9:29:52 AM2/11/13
to skia-d...@googlegroups.com
Hi Chris,

There is no project that I'm aware of. We have started a couple of times to create a stable C layer on top of Skia. Do you think you would need that for your python bindings, or do you plan to map directly onto Skia's C++ interface?

mike




--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/skia-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Janez Zemva

unread,
Feb 11, 2013, 9:35:24 AM2/11/13
to skia-d...@googlegroups.com
I've had some luck using swig. Not all bindings could be created due
to nested classes (which my version of swig did not support). Some
manual fiddling was necessary. Developers will change skia over time
and you will have to update your binding hacks, which can be
time-consuming.

2013/2/11 Mike Reed <re...@google.com>:

Christopher Barker

unread,
Feb 11, 2013, 12:24:26 PM2/11/13
to skia-d...@googlegroups.com
On Mon, Feb 11, 2013 at 6:29 AM, Mike Reed <re...@google.com> wrote:

> There is no project that I'm aware of. We have started a couple of times to
> create a stable C layer on top of Skia. Do you think you would need that for
> your python bindings, or do you plan to map directly onto Skia's C++
> interface?

I'd be just as happy to work directly the the C++ interface --
probably happier, as I"d want the Python interface to be OO, and
closely mapped to the Skia API.

Thanks,
-Chris

--
Christopher Barker, PhD

Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython

Christopher Barker

unread,
Feb 11, 2013, 12:28:07 PM2/11/13
to skia-d...@googlegroups.com
On Mon, Feb 11, 2013 at 6:35 AM, Janez Zemva <jane...@gmail.com> wrote:
> I've had some luck using swig. Not all bindings could be created due
> to nested classes (which my version of swig did not support). Some
> manual fiddling was necessary.

Well, you can pretty much never do anything more than trivial with
SWIG without some manual fiddling...

> Developers will change skia over time
> and you will have to update your binding hacks, which can be
> time-consuming.

True -- I assume that the API is fairly stable, though, there is a lo
tof other code depending on it.

I've pretty much given up on SWIG -- the hand-caching is pretty
painful, and the SWIG-ified pointers are pretty ugly.

The primary advantage it does have is that it can build bindings for
multiple languages, so if there was an effort to use SWIG to build a
multiple bindings, that may be the way to go.

Has anyone looked at SIP? It was built from the ground up for C++,
which is promising. Robin Dunn is moving wxPython from SWIG to SIP --
and he knew SWIG about as well as anyone, that that means something.

Cosmos Jiang

unread,
Jul 25, 2013, 4:03:46 AM7/25/13
to skia-d...@googlegroups.com

Hi mike,

I am evaluating graphics library for my program. I prefer to use skia instead of cairo, due to license issue. The C interface is important for me, but I can not find skia C document in wiki, nor SVN. Did the C interface release already? Would you kindly give me hint?

Thanks.

Christopher Barker

unread,
Jul 25, 2013, 11:13:52 AM7/25/13
to skia-d...@googlegroups.com


On Thursday, July 25, 2013, Cosmos Jiang wrote:
I am evaluating graphics library for my program. I prefer to use skia instead of cairo, due to license issue. The C interface is important for me, 

Are you planning to use it directly from C? Or another language binding layer?
 
but I can not find skia C document in wiki, nor SVN. Did the C interface release already? Would you kindly give me hint?

Thanks.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/KL7C3Ko-EOg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/skia-discuss.

For more options, visit https://groups.google.com/groups/opt_out.


If I were to do it for Python, I'd give x-dress a try--very cool project.


In fact, it is written in a nicely modular fashion, so one could write a c-generator with it if you wanted.

As for me, I decided I needed fast and simple ( and 8 bit ) more than pretty, so I'm using libgd for now -- writing a new python wrapper for it.



Chris

Cosmos Jiang

unread,
Sep 7, 2013, 10:04:16 AM9/7/13
to skia-d...@googlegroups.com

Thanks for your information, the projects are interesting. I use graphics library from C directly.

Finally, I decided to use cairo in my desktop version and CoreGraphics in iOS version.


Christopher Barker於 2013年7月25日星期四UTC+8下午11時13分52秒寫道:


On Thursday, July 25, 2013, Cosmos Jiang wrote:
I am evaluating graphics library for my program. I prefer to use skia instead of cairo, due to license issue. The C interface is important for me, 

Are you planning to use it directly from C? Or another language binding layer?
but I can not find skia C document in wiki, nor SVN. Did the C interface release already? Would you kindly give me hint?

Thanks.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/KL7C3Ko-EOg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss+unsubscribe@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Matthew Leibowitz

unread,
Feb 28, 2017, 9:11:04 PM2/28/17
to skia-discuss
Hey there, just posting just in case. I have been working on a C API (that I still need to get around to upstreaming) for mono's SkiaSharp (C# bindings for skia) project. This has been going for some time and we have a huge C API cover.

The actual C API lives here: https://github.com/mono/skia

The main C# project is here: https://github.com/mono/SkiaSharp

I also just whipped up a sample Python script: https://github.com/mono/SkiaSharp/wiki/SkiaSharp-with-Python

Although SkiaSharp's real aim is to bring skia to the .NET masses, we use a C API. And, that can be useful to anyone out there. If you would like to have a look, please do. I hope it is helpful to the world.

Christopher Barker

unread,
Mar 6, 2017, 7:12:01 PM3/6/17
to skia-d...@googlegroups.com
Pretty cool, thanks for posting.


On Tue, Feb 28, 2017 at 6:11 PM, Matthew Leibowitz <mattl...@live.com> wrote:
Hey there, just posting just in case. I have been working on a C API (that I still need to get around to upstreaming) for mono's SkiaSharp (C# bindings for skia) project.

interesting. As C## is OO, why do the C API, rather than calling the C++ API directly?

I partly ask because if I were to do Python bindings (which I'd like to some day...) I'd probably call the C++ directly via Cython, so I could fairly easily get a similar OO structure in Python.

OF course, you could wrap a Python OO structure around a C "flattened" API, but why?

One reason folks do this is that C is more ABI-consistent, so you can write a shared lib in C and call it with code compiled with a different compiler (of different compiler version -- make sit easier to ship dlls (Particularly on Windows)

Is that the motivation here?

Also -- I see you are using ctypes to call the C code -- works well and pretty easy to do, but if you want really robust and performant bindings, you're probably better off using Cython to call the C (or C++).

http://cython.org/

A relevant example is my wrappers for the venerable (if krufty) libgd:

https://github.com/NOAA-ORR-ERD/py_gd

in fact, it would be pretty cool to have a Skia wrapper that uses the same Python API.

Anyway, thanks for sharing!

-CHB









 
This has been going for some time and we have a huge C API cover.

The actual C API lives here: https://github.com/mono/skia

The main C# project is here: https://github.com/mono/SkiaSharp

I also just whipped up a sample Python script: https://github.com/mono/SkiaSharp/wiki/SkiaSharp-with-Python

Although SkiaSharp's real aim is to bring skia to the .NET masses, we use a C API. And, that can be useful to anyone out there. If you would like to have a look, please do. I hope it is helpful to the world.


On Sunday, February 10, 2013 at 9:36:02 PM UTC+2, Christopher Barker wrote:
Hey folks,

It looks like Python bindings to skia have been on the "we'd like to do that" list for a while now.

Is anyone working on that?

I've got a Python-based project that skia would be good for, so I may start on a bindings project myself, but I don't want to start from scratch if I don't need to. Also, I"ll probably only bind the bits that I really need, so a larger development group would be nice, to flesh it out into a full package.

If there isn't anything started, I'll most likely use Cython to write the bindings, but if there is a project started, I' open to other approaches.

Thanks,
  -Chris

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