[seed] Cairo stuff
- From: Robert Carr <racarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] Cairo stuff
- Date: Thu, 14 May 2009 22:58:51 -0400 (EDT)
commit 4515ec61c20c6613f298bb81c0b4d7aeff0516cc
Author: Robert Carr <racarr svn gnome org>
Date: Thu May 14 22:57:01 2009 -0400
Cairo stuff
---
configure.ac | 3 +++
modules/cairo/Makefile.am | 2 ++
modules/cairo/seed-cairo.c | 29 +++++++++++++++++++++++++++++
3 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index 7a1d70b..9627308 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,9 @@ if test x"$want_canvas_module" == x"yes" ; then
PKG_CHECK_MODULES(CAIRO, cairo)
AC_SUBST(CAIRO_CFLAGS)
AC_SUBST(CAIRO_LDFLAGS)
+ PKG_CHECK_MODULES(GDK, gdk-2.0)
+ AC_SUBST(GDK_CFLAGS)
+ AC_SUBST(GDK_LDFLAGS)
fi
AM_CONDITIONAL(BUILD_CANVAS_MODULE, test "x$want_canvas_module" = "xyes")
diff --git a/modules/cairo/Makefile.am b/modules/cairo/Makefile.am
index 5bcad71..15de8e5 100644
--- a/modules/cairo/Makefile.am
+++ b/modules/cairo/Makefile.am
@@ -19,11 +19,13 @@ libcairo_la_CFLAGS = \
$(GOBJECT_INTROSPECTION_CFLAGS) \
-I top_srcdir@/libseed/ \
$(CAIRO_CFLAGS) \
+ $(GDK_CFLAGS) \
$(SEED_DEBUG_CFLAGS) \
$(SEED_PROFILE_CFLAGS)
libcairo_la_LDFLAGS = \
$(GOBJECT_INTROSPECTION_LDFLAGS) \
+ $(GDK_LDFLAGS) \
$(CAIRO_LDFLAGS) \
$(SEED_PROFILE_LIBS)
diff --git a/modules/cairo/seed-cairo.c b/modules/cairo/seed-cairo.c
index 4ae0647..301b2c6 100644
--- a/modules/cairo/seed-cairo.c
+++ b/modules/cairo/seed-cairo.c
@@ -1,5 +1,6 @@
#include <seed.h>
#include <cairo/cairo.h>
+#include <gdk/gdk.h>
#include "seed-cairo.h"
#include "seed-cairo-surface.h"
#include "seed-cairo-image-surface.h"
@@ -97,6 +98,28 @@ seed_cairo_construct_context (SeedContext ctx,
return seed_object_from_cairo_context (ctx, cairo_create (surf));
}
+static SeedObject
+seed_cairo_construct_context_from_drawable (SeedContext ctx,
+ SeedObject constructor,
+ size_t argument_count,
+ const SeedValue arguments[],
+ SeedException * exception)
+{
+ GObject *obj;
+ if (argument_count != 1)
+ {
+ EXPECTED_EXCEPTION ("Context", "1 argument");
+ }
+ obj = seed_value_to_object (ctx, arguments[0], exception);
+ if (!GDK_IS_DRAWABLE(obj))
+ {
+ seed_make_exception (ctx, exception, "ArgumentError", "Context.from_drawable requires a GdkDrawable argument");
+ return seed_make_null (ctx);
+ }
+
+ return seed_object_from_cairo_context (ctx, gdk_cairo_create (GDK_DRAWABLE (obj)));
+}
+
static SeedValue
seed_cairo_save (SeedContext ctx,
SeedObject function,
@@ -1693,6 +1716,7 @@ SeedObject
seed_module_init(SeedEngine * local_eng)
{
SeedObject context_constructor_ref;
+ SeedObject gdk_context_constructor_ref;
SeedObject namespace_ref;
seed_class_definition cairo_def = seed_empty_class;
eng = local_eng;
@@ -1716,8 +1740,13 @@ seed_module_init(SeedEngine * local_eng)
NULL,
// seed_cairo_context_class,
seed_cairo_construct_context);
+ gdk_context_constructor_ref = seed_make_constructor (eng->context,
+ NULL,
+ // seed_cairo_context_class,
+ seed_cairo_construct_context_from_drawable);
seed_object_set_property (eng->context, namespace_ref, "Context", context_constructor_ref);
+ seed_object_set_property (eng->context, context_constructor_ref, "from_drawable", gdk_context_constructor_ref);
return namespace_ref;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]