Re: [Vala] Call cairo_destroy() function explicilty



I use Clutter.CairoTexture without explicit destruction and it works fine.

Should be something like this:

public void draw()
{
        var ctx = cairo_texture.create();
        // draw
}

ctx then goes out of scope and is destroyed, and Clutter updates the CairoTexture.

Unless you wanted to keep the context around... but then calling destroy on it would invalidate it anyways.

Here is a use of it: http://git.gnome.org/browse/ease/tree/ease-core/ease-cairo-actor.vala

-Nate


On Sep 29, 2010, at 4:58 PM, Erick Pérez wrote:

Hi:

I was experimenting with cairo and i need to call cairo_destroy
function explicitly. cairo_destroy its tagged with unref_function in
cairo.vapi but i dunno how to call it explicitly.

The reason is: "when using Clutter.CairoTexture you need to call
cairo_destroy on the cairo_context to actually draw on the texture."
So in vala i need to find a way to call that function.

cairo.vapi
----
[CCode (cheader_filename = "cairo.h", gir_namespace = "cairo",
gir_version = "1.0")]
namespace Cairo {
      [Compact]
      [CCode (ref_function = "cairo_reference", unref_function =
"cairo_destroy", cname = "cairo_t", cprefix = "cairo_",
cheader_filename = "cairo.h")]
      public class Context {
              [CCode (cname = "cairo_create")]
...
----

Thxs

-- 
El derecho de expresar nuestros pensamientos tiene algún significado
tan sólo si somos capaces de tener pensamientos propios.
El miedo a la libertad, Erich Fromm
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]