Cairo-GObject provides access to enums, but it won't automatically get you great cairo bindings. It might actually get you 90% of the way there, though, and I'd be interested seeing how far you can run with just that, and be happy to merge patches that make it easier.
Why? cairo has a subtype system where you have subtypes of cairo_surface_t (e.g. cairo_image_surface_t) or cairo_pattern_t (e.g. cairo_gradient_pattern_t) where some objects have special methods. You determine which type this is by calling cairo_surface_get_type(); and matching it against a closed enum (cairo_surface_type_t). It might be enough to do 90% of the work with GObject-Introspection and write some small by-hand functions when you need to "cast" to a specific type in your binding, but you do always need some small native glue code that calls cairo_surface_get_type(); On Thu, Jan 22, 2015 at 9:39 AM, Nicola Fontana <n...@entidi.it> wrote: > Il Thu, 22 Jan 2015 16:28:19 +0000 Emmanuele Bassi <eba...@gmail.com> > scrisse: > > > Cairo is not a GObject library, so introspection is fairly useless. > > Hi Emmanuele, > > the cairo source tree includes cairo-gobject [1] that already wraps > enums and structs in GObject style. I just browsed the code and added > the missing types to the gir file. > > > for Cairo, you should always prefer native bindings — like pycairo, or > > the cairo GJS module. > > I'm using LGI [2] which provides automatic bindings based on GObject > introspection. This gives me the ability to access all the libraries I > need (cairo is only one of them) through the same interface. > > One of my API needs the cairo_surface_type_t enum, so adding a new > dependency only for that is not an option. If the patches are rejected > I'll wrap the enum on my side instead (or drop that particular feature). > > > if you have patches, please attach them on Bugzilla. > > Sorry, my bad. I had really hard time trying to figure out how to submit > bugs to gobject-introspection. I just discovered (10 mins ago) I need to > select GLib as product first. > > Ciao. > -- > Nicola > > [1] http://cgit.freedesktop.org/cairo/tree/util/cairo-gobject > [2] https://github.com/pavouk/lgi > _______________________________________________ > gtk-devel-list mailing list > gtk-devel-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-devel-list > -- Jasper
_______________________________________________ gtk-devel-list mailing list gtk-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-devel-list