gnomemm r1458 - in cluttermm/trunk: . clutter clutter/cluttermm clutter/cluttermm/private clutter/src examples tools/extra_defs_gen



Author: jjongsma
Date: Sun Apr 13 15:21:54 2008
New Revision: 1458
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1458&view=rev

Log:
wrap clutter-cairo library

	* clutter/cluttermm.h:
	* clutter/src/Makefile_list_of_hg.am_fragment:
	* clutter/src/cairo-texture.ccg:
	* clutter/src/cairo-texture.hg:
	* clutter/src/clutter_methods.defs:
	* examples/Makefile.am:
	* examples/flowers.cc:
	* examples/simple-cairo.cc:
	* examples/test-actors.cc: add support for the clutter-cairo library.
	Currently this is required unconditionally, I'm not sure if we want to wrap
	this in a separate library (e.g. cluttermm-cairo) since the underlying
	libraries are separate.


Added:
   cluttermm/trunk/clutter/src/cairo-texture.ccg
   cluttermm/trunk/clutter/src/cairo-texture.hg
   cluttermm/trunk/examples/flowers.cc
   cluttermm/trunk/examples/simple-cairo.cc
Modified:
   cluttermm/trunk/ChangeLog
   cluttermm/trunk/clutter/cluttermm/   (props changed)
   cluttermm/trunk/clutter/cluttermm.h
   cluttermm/trunk/clutter/cluttermm/private/   (props changed)
   cluttermm/trunk/clutter/src/Makefile_list_of_hg.am_fragment
   cluttermm/trunk/clutter/src/clutter_methods.defs
   cluttermm/trunk/configure.in
   cluttermm/trunk/examples/   (props changed)
   cluttermm/trunk/examples/Makefile.am
   cluttermm/trunk/examples/test-actors.cc
   cluttermm/trunk/tools/extra_defs_gen/generate_defs_clutter.cc

Modified: cluttermm/trunk/clutter/cluttermm.h
==============================================================================
--- cluttermm/trunk/clutter/cluttermm.h	(original)
+++ cluttermm/trunk/clutter/cluttermm.h	Sun Apr 13 15:21:54 2008
@@ -52,6 +52,7 @@
 #include <cluttermm/shader.h>
 #include <cluttermm/script.h>
 #include <cluttermm/types.h>
+#include <cluttermm/cairo-texture.h>
 
 //#include <cluttermm/box.h>
 //#include <cluttermm/container.h>

Modified: cluttermm/trunk/clutter/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- cluttermm/trunk/clutter/src/Makefile_list_of_hg.am_fragment	(original)
+++ cluttermm/trunk/clutter/src/Makefile_list_of_hg.am_fragment	Sun Apr 13 15:21:54 2008
@@ -28,5 +28,6 @@
 score.hg \
 shader.hg \
 script.hg \
-scriptable.hg
+scriptable.hg \
+cairo-texture.hg
 #layout.hg box.hg margin.hg

Added: cluttermm/trunk/clutter/src/cairo-texture.ccg
==============================================================================
--- (empty file)
+++ cluttermm/trunk/clutter/src/cairo-texture.ccg	Sun Apr 13 15:21:54 2008
@@ -0,0 +1,28 @@
+/* Copyright (C) 2007 The cluttermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <clutter-cairo/clutter-cairo.h>
+
+namespace Clutter
+{
+    void CairoTexture::set_source_color (const Cairo::RefPtr<Cairo::Context>& cr, const Color& color)
+    {
+        clutter_cairo_set_source_color (cr->cobj (), color.gobj ());
+    }
+
+} //namespace Clutter
+

Added: cluttermm/trunk/clutter/src/cairo-texture.hg
==============================================================================
--- (empty file)
+++ cluttermm/trunk/clutter/src/cairo-texture.hg	Sun Apr 13 15:21:54 2008
@@ -0,0 +1,47 @@
+/* Copyright (C) 2007 The cluttermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <cluttermm/texture.h>
+#include <cairomm/context.h>
+ 
+_DEFS(cluttermm,clutter)
+_PINCLUDE(cluttermm/private/texture_p.h)
+
+
+namespace Clutter
+{
+
+class CairoTexture :
+  public Texture
+{
+  _CLASS_GOBJECT(CairoTexture, ClutterCairo, CLUTTER_CAIRO, Texture, ClutterTexture)
+
+protected:
+  _WRAP_CTOR(CairoTexture(guint surface_width, guint surface_height), clutter_cairo_new)
+
+public:
+  _WRAP_CREATE(guint width, guint height);
+
+#m4 _CONVERSION(`cairo_t*',`Cairo::RefPtr<Cairo::Context>',`$2(new Cairo::Context ($3, true))')
+  _WRAP_METHOD(Cairo::RefPtr<Cairo::Context> create_cairo_context (), clutter_cairo_create)
+
+  static void set_source_color (const Cairo::RefPtr<Cairo::Context>& cr, const Color& color);
+};
+
+} // namespace Clutter
+
+//vim: ts=2,sw=2

Modified: cluttermm/trunk/clutter/src/clutter_methods.defs
==============================================================================
--- cluttermm/trunk/clutter/src/clutter_methods.defs	(original)
+++ cluttermm/trunk/clutter/src/clutter_methods.defs	Sun Apr 13 15:21:54 2008
@@ -180,6 +180,13 @@
   (gtype-id "CLUTTER_TYPE_TEXTURE")
 )
 
+(define-object Cairo
+  (in-module "Clutter")
+  (parent "ClutterTexture")
+  (c-name "ClutterCairo")
+  (gtype-id "CLUTTER_TYPE_CAIRO")
+)
+
 (define-object Timeline
   (in-module "Clutter")
   (parent "GObject")
@@ -200,27 +207,6 @@
   )
 )
 
-(define-flags DebugFlag
-  (in-module "Clutter")
-  (c-name "ClutterDebugFlag")
-  (gtype-id "CLUTTER_TYPE_DEBUG_FLAG")
-  (values
-    '("misc" "CLUTTER_DEBUG_MISC")
-    '("actor" "CLUTTER_DEBUG_ACTOR")
-    '("texture" "CLUTTER_DEBUG_TEXTURE")
-    '("event" "CLUTTER_DEBUG_EVENT")
-    '("paint" "CLUTTER_DEBUG_PAINT")
-    '("gl" "CLUTTER_DEBUG_GL")
-    '("alpha" "CLUTTER_DEBUG_ALPHA")
-    '("behaviour" "CLUTTER_DEBUG_BEHAVIOUR")
-    '("pango" "CLUTTER_DEBUG_PANGO")
-    '("backend" "CLUTTER_DEBUG_BACKEND")
-    '("scheduler" "CLUTTER_DEBUG_SCHEDULER")
-    '("script" "CLUTTER_DEBUG_SCRIPT")
-    '("shader" "CLUTTER_DEBUG_SHADER")
-  )
-)
-
 (define-flags ModifierType
   (in-module "Clutter")
   (c-name "ClutterModifierType")
@@ -325,30 +311,6 @@
   )
 )
 
-(define-flags PrivateFlags
-  (in-module "Clutter")
-  (c-name "ClutterPrivateFlags")
-  (gtype-id "CLUTTER_TYPE_PRIVATE_FLAGS")
-  (values
-    '("unused-flag" "CLUTTER_ACTOR_UNUSED_FLAG")
-    '("in-destruction" "CLUTTER_ACTOR_IN_DESTRUCTION")
-    '("is-toplevel" "CLUTTER_ACTOR_IS_TOPLEVEL")
-    '("in-reparent" "CLUTTER_ACTOR_IN_REPARENT")
-    '("sync-matrices" "CLUTTER_ACTOR_SYNC_MATRICES")
-  )
-)
-
-(define-enum PickMode
-  (in-module "Clutter")
-  (c-name "ClutterPickMode")
-  (gtype-id "CLUTTER_TYPE_PICK_MODE")
-  (values
-    '("none" "CLUTTER_PICK_NONE")
-    '("reactive" "CLUTTER_PICK_REACTIVE")
-    '("all" "CLUTTER_PICK_ALL")
-  )
-)
-
 (define-enum ScriptError
   (in-module "Clutter")
   (c-name "ClutterScriptError")
@@ -2629,10 +2591,6 @@
 
 
 
-;; From clutter-debug.h
-
-
-
 ;; From clutter-deprecated.h
 
 
@@ -2902,7 +2860,7 @@
 (define-method handle_key_event
   (of-object "ClutterEntry")
   (c-name "clutter_entry_handle_key_event")
-  (return-type "none")
+  (return-type "gboolean")
   (parameters
     '("ClutterKeyEvent*" "kev")
   )
@@ -3295,6 +3253,10 @@
 
 
 
+;; From clutter-glx.h
+
+
+
 ;; From clutter-group.h
 
 (define-function clutter_group_get_type
@@ -3398,10 +3360,6 @@
 
 
 
-;; From clutter-keysyms-table.h
-
-
-
 ;; From clutter-label.h
 
 (define-function clutter_label_get_type
@@ -3849,10 +3807,6 @@
 
 
 
-;; From clutter-marshal.h
-
-
-
 ;; From clutter-media.h
 
 (define-function clutter_media_get_type
@@ -4280,58 +4234,6 @@
 
 
 
-;; From clutter-model-private.h
-
-(define-method set_n_columns
-  (of-object "ClutterModel")
-  (c-name "clutter_model_set_n_columns")
-  (return-type "none")
-  (parameters
-    '("gint" "n_columns")
-    '("gboolean" "set_types")
-    '("gboolean" "set_names")
-  )
-)
-
-(define-function clutter_model_check_type
-  (c-name "clutter_model_check_type")
-  (return-type "gboolean")
-  (parameters
-    '("GType" "gtype")
-  )
-)
-
-(define-method set_column_type
-  (of-object "ClutterModel")
-  (c-name "clutter_model_set_column_type")
-  (return-type "none")
-  (parameters
-    '("gint" "column")
-    '("GType" "gtype")
-  )
-)
-
-(define-method set_column_name
-  (of-object "ClutterModel")
-  (c-name "clutter_model_set_column_name")
-  (return-type "none")
-  (parameters
-    '("gint" "column")
-    '("const-gchar*" "name")
-  )
-)
-
-
-
-;; From clutter-private.h
-
-(define-function clutter_context_get_default
-  (c-name "clutter_context_get_default")
-  (return-type "ClutterMainContext*")
-)
-
-
-
 ;; From clutter-rectangle.h
 
 (define-function clutter_rectangle_get_type
@@ -4664,112 +4566,6 @@
 
 
 
-;; From clutter-script-private.h
-
-(define-function object_info_free
-  (c-name "object_info_free")
-  (return-type "none")
-  (parameters
-    '("gpointer" "data")
-  )
-)
-
-(define-function property_info_free
-  (c-name "property_info_free")
-  (return-type "none")
-  (parameters
-    '("gpointer" "data")
-  )
-)
-
-(define-method parse_node
-  (of-object "ClutterScript")
-  (c-name "clutter_script_parse_node")
-  (return-type "gboolean")
-  (parameters
-    '("GValue*" "value")
-    '("const-gchar*" "name")
-    '("JsonNode*" "node")
-    '("GParamSpec*" "pspec")
-  )
-)
-
-(define-function clutter_script_get_type_from_symbol
-  (c-name "clutter_script_get_type_from_symbol")
-  (return-type "GType")
-  (parameters
-    '("const-gchar*" "symbol")
-  )
-)
-
-(define-function clutter_script_get_type_from_class
-  (c-name "clutter_script_get_type_from_class")
-  (return-type "GType")
-  (parameters
-    '("const-gchar*" "name")
-  )
-)
-
-(define-method construct_object
-  (of-object "ClutterScript")
-  (c-name "clutter_script_construct_object")
-  (return-type "GObject*")
-  (parameters
-    '("ObjectInfo*" "info")
-  )
-)
-
-(define-function clutter_script_enum_from_string
-  (c-name "clutter_script_enum_from_string")
-  (return-type "gboolean")
-  (parameters
-    '("GType" "gtype")
-    '("const-gchar*" "string")
-    '("gint*" "enum_value")
-  )
-)
-
-(define-function clutter_script_flags_from_string
-  (c-name "clutter_script_flags_from_string")
-  (return-type "gboolean")
-  (parameters
-    '("GType" "gtype")
-    '("const-gchar*" "string")
-    '("gint*" "flags_value")
-  )
-)
-
-(define-method parse_knot
-  (of-object "ClutterScript")
-  (c-name "clutter_script_parse_knot")
-  (return-type "gboolean")
-  (parameters
-    '("JsonNode*" "node")
-    '("ClutterKnot*" "knot")
-  )
-)
-
-(define-method parse_geometry
-  (of-object "ClutterScript")
-  (c-name "clutter_script_parse_geometry")
-  (return-type "gboolean")
-  (parameters
-    '("JsonNode*" "node")
-    '("ClutterGeometry*" "geometry")
-  )
-)
-
-(define-method parse_alpha
-  (of-object "ClutterScript")
-  (c-name "clutter_script_parse_alpha")
-  (return-type "GObject*")
-  (parameters
-    '("JsonNode*" "node")
-  )
-)
-
-
-
 ;; From clutter-shader.h
 
 (define-function clutter_shader_error_quark
@@ -5580,10 +5376,699 @@
 
 
 
-;; From stamp-clutter-enum-types.h
+;; From clutter-x11.h
+
+(define-function clutter_x11_trap_x_errors
+  (c-name "clutter_x11_trap_x_errors")
+  (return-type "none")
+)
+
+(define-function clutter_x11_untrap_x_errors
+  (c-name "clutter_x11_untrap_x_errors")
+  (return-type "gint")
+)
+
+(define-function clutter_x11_get_default_display
+  (c-name "clutter_x11_get_default_display")
+  (return-type "Display*")
+)
+
+(define-function clutter_x11_get_default_screen
+  (c-name "clutter_x11_get_default_screen")
+  (return-type "int")
+)
+
+(define-function clutter_x11_get_root_window
+  (c-name "clutter_x11_get_root_window")
+  (return-type "Window")
+)
+
+(define-function clutter_x11_get_stage_window
+  (c-name "clutter_x11_get_stage_window")
+  (return-type "Window")
+  (parameters
+    '("ClutterStage*" "stage")
+  )
+)
+
+(define-function clutter_x11_get_stage_visual
+  (c-name "clutter_x11_get_stage_visual")
+  (return-type "XVisualInfo*")
+  (parameters
+    '("ClutterStage*" "stage")
+  )
+)
+
+(define-function clutter_x11_set_stage_foreign
+  (c-name "clutter_x11_set_stage_foreign")
+  (return-type "gboolean")
+  (parameters
+    '("ClutterStage*" "stage")
+    '("Window" "xwindow")
+  )
+)
+
+(define-function clutter_x11_add_filter
+  (c-name "clutter_x11_add_filter")
+  (return-type "none")
+  (parameters
+    '("ClutterX11FilterFunc" "func")
+    '("gpointer" "data")
+  )
+)
+
+(define-function clutter_x11_remove_filter
+  (c-name "clutter_x11_remove_filter")
+  (return-type "none")
+  (parameters
+    '("ClutterX11FilterFunc" "func")
+    '("gpointer" "data")
+  )
+)
+
+
+
+;; From cogl-defines.h
+
+
+
+;; From cogl.h
+
+(define-function cogl_get_proc_address
+  (c-name "cogl_get_proc_address")
+  (return-type "CoglFuncPtr")
+  (parameters
+    '("const-gchar*" "name")
+  )
+)
+
+(define-function cogl_check_extension
+  (c-name "cogl_check_extension")
+  (return-type "gboolean")
+  (parameters
+    '("const-gchar*" "name")
+    '("const-gchar*" "ext")
+  )
+)
+
+(define-function cogl_perspective
+  (c-name "cogl_perspective")
+  (return-type "none")
+  (parameters
+    '("ClutterFixed" "fovy")
+    '("ClutterFixed" "aspect")
+    '("ClutterFixed" "zNear")
+    '("ClutterFixed" "zFar")
+  )
+)
+
+(define-function cogl_setup_viewport
+  (c-name "cogl_setup_viewport")
+  (return-type "none")
+  (parameters
+    '("guint" "width")
+    '("guint" "height")
+    '("ClutterFixed" "fovy")
+    '("ClutterFixed" "aspect")
+    '("ClutterFixed" "z_near")
+    '("ClutterFixed" "z_far")
+  )
+)
+
+(define-function cogl_paint_init
+  (c-name "cogl_paint_init")
+  (return-type "none")
+  (parameters
+    '("const-ClutterColor*" "color")
+  )
+)
+
+(define-function cogl_push_matrix
+  (c-name "cogl_push_matrix")
+  (return-type "none")
+)
+
+(define-function cogl_pop_matrix
+  (c-name "cogl_pop_matrix")
+  (return-type "none")
+)
+
+(define-function cogl_scale
+  (c-name "cogl_scale")
+  (return-type "none")
+  (parameters
+    '("ClutterFixed" "x")
+    '("ClutterFixed" "z")
+  )
+)
+
+(define-function cogl_translatex
+  (c-name "cogl_translatex")
+  (return-type "none")
+  (parameters
+    '("ClutterFixed" "x")
+    '("ClutterFixed" "y")
+    '("ClutterFixed" "z")
+  )
+)
+
+(define-function cogl_translate
+  (c-name "cogl_translate")
+  (return-type "none")
+  (parameters
+    '("gint" "x")
+    '("gint" "y")
+    '("gint" "z")
+  )
+)
 
+(define-function cogl_rotatex
+  (c-name "cogl_rotatex")
+  (return-type "none")
+  (parameters
+    '("ClutterFixed" "angle")
+    '("gint" "x")
+    '("gint" "y")
+    '("gint" "z")
+  )
+)
 
+(define-function cogl_rotate
+  (c-name "cogl_rotate")
+  (return-type "none")
+  (parameters
+    '("gint" "angle")
+    '("gint" "x")
+    '("gint" "y")
+    '("gint" "z")
+  )
+)
 
-;; From stamp-clutter-marshal.h
+(define-function cogl_color
+  (c-name "cogl_color")
+  (return-type "none")
+  (parameters
+    '("const-ClutterColor*" "color")
+  )
+)
+
+(define-function cogl_clip_set
+  (c-name "cogl_clip_set")
+  (return-type "none")
+  (parameters
+    '("ClutterFixed" "x_offset")
+    '("ClutterFixed" "y_offset")
+    '("ClutterFixed" "width")
+    '("ClutterFixed" "height")
+  )
+)
+
+(define-function cogl_clip_unset
+  (c-name "cogl_clip_unset")
+  (return-type "none")
+)
+
+(define-function cogl_enable
+  (c-name "cogl_enable")
+  (return-type "none")
+  (parameters
+    '("gulong" "flags")
+  )
+)
+
+(define-function cogl_enable_depth_test
+  (c-name "cogl_enable_depth_test")
+  (return-type "none")
+  (parameters
+    '("gboolean" "setting")
+  )
+)
+
+(define-function cogl_texture_can_size
+  (c-name "cogl_texture_can_size")
+  (return-type "gboolean")
+  (parameters
+    '("COGLenum" "target")
+    '("COGLenum" "pixel_format")
+    '("COGLenum" "pixel_type")
+    '("int" "width")
+    '("int" "height")
+  )
+)
+
+(define-function cogl_texture_quad
+  (c-name "cogl_texture_quad")
+  (return-type "none")
+  (parameters
+    '("gint" "x1")
+    '("gint" "x2")
+    '("gint" "y1")
+    '("gint" "y2")
+    '("ClutterFixed" "tx1")
+    '("ClutterFixed" "ty1")
+    '("ClutterFixed" "tx2")
+    '("ClutterFixed" "ty2")
+  )
+)
+
+(define-function cogl_textures_create
+  (c-name "cogl_textures_create")
+  (return-type "none")
+  (parameters
+    '("guint" "num")
+    '("COGLuint*" "textures")
+  )
+)
+
+(define-function cogl_textures_destroy
+  (c-name "cogl_textures_destroy")
+  (return-type "none")
+  (parameters
+    '("guint" "num")
+    '("const-COGLuint*" "textures")
+  )
+)
+
+(define-function cogl_texture_bind
+  (c-name "cogl_texture_bind")
+  (return-type "none")
+  (parameters
+    '("COGLenum" "target")
+    '("COGLuint" "texture")
+  )
+)
+
+(define-function cogl_texture_set_alignment
+  (c-name "cogl_texture_set_alignment")
+  (return-type "none")
+  (parameters
+    '("COGLenum" "target")
+    '("guint" "alignment")
+    '("guint" "row_length")
+  )
+)
+
+(define-function cogl_texture_set_filters
+  (c-name "cogl_texture_set_filters")
+  (return-type "none")
+  (parameters
+    '("COGLenum" "target")
+    '("COGLenum" "min_filter")
+    '("COGLenum" "max_filter")
+  )
+)
+
+(define-function cogl_texture_set_wrap
+  (c-name "cogl_texture_set_wrap")
+  (return-type "none")
+  (parameters
+    '("COGLenum" "target")
+    '("COGLenum" "wrap_s")
+    '("COGLenum" "wrap_t")
+  )
+)
+
+(define-function cogl_texture_image_2d
+  (c-name "cogl_texture_image_2d")
+  (return-type "none")
+  (parameters
+    '("COGLenum" "target")
+    '("COGLint" "internal_format")
+    '("gint" "width")
+    '("gint" "height")
+    '("COGLenum" "format")
+    '("COGLenum" "type")
+    '("const-guchar*" "pixels")
+  )
+)
+
+(define-function cogl_texture_sub_image_2d
+  (c-name "cogl_texture_sub_image_2d")
+  (return-type "none")
+  (parameters
+    '("COGLenum" "target")
+    '("gint" "xoff")
+    '("gint" "yoff")
+    '("gint" "width")
+    '("gint" "height")
+    '("COGLenum" "format")
+    '("COGLenum" "type")
+    '("const-guchar*" "pixels")
+  )
+)
+
+(define-function cogl_rectangle
+  (c-name "cogl_rectangle")
+  (return-type "none")
+  (parameters
+    '("gint" "x")
+    '("gint" "y")
+    '("guint" "width")
+    '("guint" "height")
+  )
+)
+
+(define-function cogl_trapezoid
+  (c-name "cogl_trapezoid")
+  (return-type "none")
+  (parameters
+    '("gint" "y1")
+    '("gint" "x11")
+    '("gint" "x21")
+    '("gint" "y2")
+    '("gint" "x12")
+    '("gint" "x22")
+  )
+)
+
+(define-function cogl_alpha_func
+  (c-name "cogl_alpha_func")
+  (return-type "none")
+  (parameters
+    '("COGLenum" "func")
+    '("ClutterFixed" "ref")
+  )
+)
+
+(define-function cogl_get_features
+  (c-name "cogl_get_features")
+  (return-type "ClutterFeatureFlags")
+  (parameters
+  )
+)
+
+(define-function cogl_get_modelview_matrix
+  (c-name "cogl_get_modelview_matrix")
+  (return-type "none")
+  (parameters
+    '("ClutterFixed" "m[16]")
+  )
+)
+
+(define-function cogl_get_projection_matrix
+  (c-name "cogl_get_projection_matrix")
+  (return-type "none")
+  (parameters
+    '("ClutterFixed" "m[16]")
+  )
+)
+
+(define-function cogl_get_viewport
+  (c-name "cogl_get_viewport")
+  (return-type "none")
+  (parameters
+    '("ClutterFixed" "v[4]")
+  )
+)
+
+(define-function cogl_get_bitmasks
+  (c-name "cogl_get_bitmasks")
+  (return-type "none")
+  (parameters
+    '("gint*" "red")
+    '("gint*" "green")
+    '("gint*" "blue")
+    '("gint*" "alpha")
+  )
+)
+
+(define-function cogl_fog_set
+  (c-name "cogl_fog_set")
+  (return-type "none")
+  (parameters
+    '("const-ClutterColor*" "fog_color")
+    '("ClutterFixed" "density")
+    '("ClutterFixed" "z_near")
+    '("ClutterFixed" "z_far")
+  )
+)
+
+(define-function cogl_create_shader
+  (c-name "cogl_create_shader")
+  (return-type "COGLhandle")
+  (parameters
+    '("COGLenum" "shaderType")
+  )
+)
+
+(define-function cogl_shader_destroy
+  (c-name "cogl_shader_destroy")
+  (return-type "none")
+  (parameters
+    '("COGLhandle" "handle")
+  )
+)
+
+(define-function cogl_shader_source
+  (c-name "cogl_shader_source")
+  (return-type "none")
+  (parameters
+    '("COGLhandle" "shader")
+    '("const-gchar*" "source")
+  )
+)
+
+(define-function cogl_shader_compile
+  (c-name "cogl_shader_compile")
+  (return-type "none")
+  (parameters
+    '("COGLhandle" "shader_handle")
+  )
+)
+
+(define-function cogl_shader_get_info_log
+  (c-name "cogl_shader_get_info_log")
+  (return-type "none")
+  (parameters
+    '("COGLhandle" "handle")
+    '("guint" "size")
+    '("gchar*" "buffer")
+  )
+)
+
+(define-function cogl_shader_get_parameteriv
+  (c-name "cogl_shader_get_parameteriv")
+  (return-type "none")
+  (parameters
+    '("COGLhandle" "handle")
+    '("COGLenum" "pname")
+    '("COGLint*" "dest")
+  )
+)
+
+(define-function cogl_create_program
+  (c-name "cogl_create_program")
+  (return-type "COGLhandle")
+)
+
+(define-function cogl_program_destroy
+  (c-name "cogl_program_destroy")
+  (return-type "none")
+  (parameters
+    '("COGLhandle" "handle")
+  )
+)
+
+(define-function cogl_program_attach_shader
+  (c-name "cogl_program_attach_shader")
+  (return-type "none")
+  (parameters
+    '("COGLhandle" "program_handle")
+    '("COGLhandle" "shader_handle")
+  )
+)
+
+(define-function cogl_program_link
+  (c-name "cogl_program_link")
+  (return-type "none")
+  (parameters
+    '("COGLhandle" "program_handle")
+  )
+)
+
+(define-function cogl_program_use
+  (c-name "cogl_program_use")
+  (return-type "none")
+  (parameters
+    '("COGLhandle" "program_handle")
+  )
+)
+
+(define-function cogl_program_get_uniform_location
+  (c-name "cogl_program_get_uniform_location")
+  (return-type "COGLint")
+  (parameters
+    '("COGLhandle" "program_int")
+    '("const-gchar*" "uniform_name")
+  )
+)
+
+(define-function cogl_program_uniform_1f
+  (c-name "cogl_program_uniform_1f")
+  (return-type "none")
+  (parameters
+    '("COGLint" "uniform_no")
+    '("gfloat" "value")
+  )
+)
+
+(define-function cogl_offscreen_create
+  (c-name "cogl_offscreen_create")
+  (return-type "COGLuint")
+  (parameters
+    '("COGLuint" "target_texture")
+  )
+)
+
+(define-function cogl_offscreen_destroy
+  (c-name "cogl_offscreen_destroy")
+  (return-type "none")
+  (parameters
+    '("COGLuint" "offscreen_handle")
+  )
+)
+
+(define-function cogl_offscreen_redirect_start
+  (c-name "cogl_offscreen_redirect_start")
+  (return-type "none")
+  (parameters
+    '("COGLuint" "offscreen_handle")
+    '("gint" "width")
+    '("gint" "height")
+  )
+)
+
+(define-function cogl_offscreen_redirect_end
+  (c-name "cogl_offscreen_redirect_end")
+  (return-type "none")
+  (parameters
+    '("COGLuint" "offscreen_handle")
+    '("gint" "width")
+    '("gint" "height")
+  )
+)
+
+
+
+;; From pangoclutter.h
+
+(define-function pango_clutter_font_map_get_type
+  (c-name "pango_clutter_font_map_get_type")
+  (return-type "GType")
+)
+
+(define-function pango_clutter_font_map_new
+  (c-name "pango_clutter_font_map_new")
+  (is-constructor-of "PangoClutterFontMap")
+  (return-type "PangoFontMap*")
+)
+
+(define-method set_default_substitute
+  (of-object "PangoClutterFontMap")
+  (c-name "pango_clutter_font_map_set_default_substitute")
+  (return-type "none")
+  (parameters
+    '("PangoClutterSubstituteFunc" "func")
+    '("gpointer" "data")
+    '("GDestroyNotify" "notify")
+  )
+)
+
+(define-method set_resolution
+  (of-object "PangoClutterFontMap")
+  (c-name "pango_clutter_font_map_set_resolution")
+  (return-type "none")
+  (parameters
+    '("double" "dpi")
+  )
+)
+
+(define-method substitute_changed
+  (of-object "PangoClutterFontMap")
+  (c-name "pango_clutter_font_map_substitute_changed")
+  (return-type "none")
+)
+
+(define-method create_context
+  (of-object "PangoClutterFontMap")
+  (c-name "pango_clutter_font_map_create_context")
+  (return-type "PangoContext*")
+)
+
+(define-function pango_clutter_render_layout_subpixel
+  (c-name "pango_clutter_render_layout_subpixel")
+  (return-type "none")
+  (parameters
+    '("PangoLayout*" "layout")
+    '("int" "x")
+    '("int" "y")
+    '("ClutterColor*" "color")
+    '("int" "flags")
+  )
+)
+
+(define-function pango_clutter_render_layout
+  (c-name "pango_clutter_render_layout")
+  (return-type "none")
+  (parameters
+    '("PangoLayout*" "layout")
+    '("int" "x")
+    '("int" "y")
+    '("ClutterColor*" "color")
+    '("int" "flags")
+  )
+)
+
+(define-function pango_clutter_render_layout_line
+  (c-name "pango_clutter_render_layout_line")
+  (return-type "none")
+  (parameters
+    '("PangoLayoutLine*" "line")
+    '("int" "x")
+    '("int" "y")
+    '("ClutterColor*" "color")
+  )
+)
+
+(define-function pango_clutter_render_clear_caches
+  (c-name "pango_clutter_render_clear_caches")
+  (return-type "none")
+  (parameters
+  )
+)
+
+
+
+;; From clutter-cairo.h
+
+(define-function clutter_cairo_get_type
+  (c-name "clutter_cairo_get_type")
+  (return-type "GType")
+)
+
+(define-function clutter_cairo_new
+  (c-name "clutter_cairo_new")
+  (is-constructor-of "ClutterCairo")
+  (return-type "ClutterActor*")
+  (parameters
+    '("guint" "width")
+    '("guint" "height")
+  )
+)
+
+(define-method create
+  (of-object "ClutterCairo")
+  (c-name "clutter_cairo_create")
+  (return-type "cairo_t*")
+)
+
+(define-function clutter_cairo_set_source_color
+  (c-name "clutter_cairo_set_source_color")
+  (return-type "none")
+  (parameters
+    '("cairo_t*" "cr")
+    '("const-ClutterColor*" "color")
+  )
+)
 
 

Modified: cluttermm/trunk/configure.in
==============================================================================
--- cluttermm/trunk/configure.in	(original)
+++ cluttermm/trunk/configure.in	Sun Apr 13 15:21:54 2008
@@ -82,7 +82,11 @@
 #########################################################################
 #  Dependancy checks
 #########################################################################
-PKG_CHECK_MODULES(CLUTTERMM, gtkmm-2.4 >= 2.10.9 clutter-0.6 )
+PKG_CHECK_MODULES(CLUTTERMM,
+                  gtkmm-2.4 >= 2.10.9
+                  clutter-0.6
+                  clutter-cairo-0.6
+                  cairomm-1.0)
 AC_SUBST(CLUTTERMM_CFLAGS)
 AC_SUBST(CLUTTERMM_LIBS)
 

Modified: cluttermm/trunk/examples/Makefile.am
==============================================================================
--- cluttermm/trunk/examples/Makefile.am	(original)
+++ cluttermm/trunk/examples/Makefile.am	Sun Apr 13 15:21:54 2008
@@ -4,6 +4,8 @@
 
 include Makefile.am_fragment
 
-noinst_PROGRAMS = actors
+noinst_PROGRAMS = actors flowers simple-cairo
 actors_SOURCES = test-actors.cc
+flowers_SOURCES = flowers.cc
+simple_cairo_SOURCES = simple-cairo.cc
 #boxes_SOURCES = test-boxes.cc

Added: cluttermm/trunk/examples/flowers.cc
==============================================================================
--- (empty file)
+++ cluttermm/trunk/examples/flowers.cc	Sun Apr 13 15:21:54 2008
@@ -0,0 +1,198 @@
+/* 
+ * Pretty cairo flower hack.
+ */
+
+#include <cluttermm/cairo-texture.h>
+#include <cluttermm/stage.h>
+#include <cluttermm/init.h>
+#include <clutter/clutter.h>
+
+#include <unistd.h> 		/* for sleep(), used for screenshots */
+#include <stdlib.h>
+#include "math.h"
+
+#define PETAL_MIN 20
+#define PETAL_VAR 40
+#define N_FLOWERS 40 /* reduce if you have a small card */
+
+using namespace Clutter;
+
+struct Flower : public CairoTexture
+{
+    static Glib::RefPtr<Flower> create ()
+    {
+        gint size;
+        gint petal_size; 
+        petal_size = PETAL_MIN + rand() % PETAL_VAR;
+        size = petal_size * 8;
+
+        return Glib::RefPtr<Flower> (new Flower (size));
+
+        petal_size -= rand() % (size/8);
+    }
+
+    Flower (guint size) :
+        CairoTexture (size, size)
+    {
+        gint i, j;
+
+        double colors[] = {
+            0.71, 0.81, 0.83,
+            1.0,  0.78, 0.57,
+            0.64, 0.30, 0.35,
+            0.73, 0.40, 0.39,
+            0.91, 0.56, 0.64,
+            0.70, 0.47, 0.45,
+            0.92, 0.75, 0.60,
+            0.82, 0.86, 0.85,
+            0.51, 0.56, 0.67,
+            1.0, 0.79, 0.58,
+
+        };
+        gint n_groups;    /* Num groups of petals 1-3 */
+        gint n_petals;    /* num of petals 4 - 8  */
+        gint pm1, pm2;
+
+        gint idx, last_idx = -1;
+
+        n_groups = rand() % 3 + 1;
+
+        gint petal_size = size / 8; 
+        Cairo::RefPtr<Cairo::Context> cr = create_cairo_context ();
+
+        cr->set_tolerance (0.1);
+
+        /* Clear */
+        cr->set_operator (Cairo::OPERATOR_CLEAR);
+        cr->paint();
+        cr->set_operator (Cairo::OPERATOR_OVER);
+
+        cr->translate(size/2, size/2);
+
+        for (i=0; i<n_groups; i++)
+        {
+            n_petals = rand() % 5 + 4;
+            cr->save ();
+
+            cr->rotate (rand() % 6);
+
+            do {
+                idx = (rand() % (sizeof (colors) / sizeof (double) / 3)) * 3;
+            } while (idx == last_idx);
+
+            cr->set_source_rgba (colors[idx], colors[idx+1],
+                    colors[idx+2], 0.5);
+
+            last_idx = idx;
+
+            /* some bezier randomness */
+            pm1 = rand() % 20;
+            pm2 = rand() % 4;
+
+            for (j=1; j<n_petals+1; j++)
+            {
+                cr->save ();
+                cr->rotate (((2*M_PI)/n_petals)*j);
+
+                /* Petals are made up beziers */
+                cr->begin_new_path ();
+                cr->move_to (0, 0);
+                cr->rel_curve_to (petal_size, petal_size,
+                                  (pm2+2)*petal_size, petal_size,
+                                  (2*petal_size) + pm1, 0);
+                cr->rel_curve_to (0 + (pm2*petal_size), -petal_size,
+                                  -petal_size, -petal_size,
+                                  -((2*petal_size) + pm1), 0);
+                cr->close_path ();
+                cr->fill ();
+                cr->restore ();
+            }
+
+            cr->restore ();
+        }
+
+        /* Finally draw flower center */
+        do {
+            idx = (rand() % (sizeof (colors) / sizeof (double) / 3)) * 3;
+        } while (idx == last_idx);
+
+        if (petal_size < 0)
+            petal_size = rand() % 10;
+
+        cr->set_source_rgba (colors[idx], colors[idx+1], colors[idx+2], 0.5);
+
+        cr->arc(0, 0, petal_size, 0, M_PI * 2);
+        cr->fill();
+    }
+
+    gint x,y,rot,v,rv;
+};
+
+bool
+tick (Glib::RefPtr<Flower> flowers[])
+{
+    gint i = 0;
+
+    for (i=0; i< N_FLOWERS; i++)
+    {
+        flowers[i]->y   += flowers[i]->v;
+        flowers[i]->rot += flowers[i]->rv;
+
+        if (flowers[i]->y > (gint) Stage::get_default ()->get_height ())
+            flowers[i]->y = -flowers[i]->get_height ();
+
+        flowers[i]->set_position (flowers[i]->x, flowers[i]->y);
+
+        flowers[i]->set_rotation (Z_AXIS,
+                flowers[i]->rot,
+                flowers[i]->get_width ()/2,
+                flowers[i]->get_height ()/2,
+                0);
+    }
+
+    return true;
+}
+
+void foo(void) { g_usleep(10000000); }
+
+int
+main (int argc, char **argv)
+{
+  int              i;
+  Glib::RefPtr<Stage> stage;
+  Color stage_color (0x0, 0x0, 0x0, 0xff);
+  Glib::RefPtr<Flower> flowers[N_FLOWERS];
+
+  srand(time(NULL));
+
+  Clutter::init (&argc, &argv);
+
+  stage = Stage::get_default ();
+
+  stage->set_color (stage_color);
+
+  stage->fullscreen ();
+
+  for (i=0; i< N_FLOWERS; i++)
+    {
+      flowers[i]      = Flower::create ();
+      flowers[i]->x   = rand() % stage->get_width()
+                            - (PETAL_MIN+PETAL_VAR)*2;
+      flowers[i]->y   = rand() % stage->get_height();
+      flowers[i]->rv  = rand() % 5 + 1;
+      flowers[i]->v   = rand() % 10 + 2;
+
+      stage->add_actor (flowers[i]);
+      flowers[i]->set_position (flowers[i]->x, flowers[i]->y);
+    }
+
+  Glib::signal_timeout ().connect (sigc::bind (sigc::ptr_fun (&tick), flowers), 50);
+
+  stage->show_all ();
+  stage->signal_key_press_event ().connect (sigc::hide (sigc::bind_return (sigc::ptr_fun (&clutter_main_quit), true)));
+
+  // TODO: wrap clutter_main ?
+  clutter_main();
+
+  return 1;
+}

Added: cluttermm/trunk/examples/simple-cairo.cc
==============================================================================
--- (empty file)
+++ cluttermm/trunk/examples/simple-cairo.cc	Sun Apr 13 15:21:54 2008
@@ -0,0 +1,51 @@
+/* 
+ * Pretty cairo flower hack.
+ */
+
+#include <cluttermm.h>
+#include <clutter/clutter.h>
+
+using namespace Clutter;
+
+int
+main (int argc, char **argv)
+{
+  Clutter::init (&argc, &argv);
+
+  Glib::RefPtr<Stage> stage = Stage::get_default ();
+  Color stage_color (0x0, 0x0, 0x0, 0xff);
+  stage->set_color (stage_color);
+
+  guint size = stage->get_height () / 4;
+  Glib::RefPtr<CairoTexture> circle = CairoTexture::create (size, size);
+  // TODO: These brackets are necessary at the moment to limit the scope of the
+  // Cairo::Context object.  Because of the way ClutterCairo is implemented,
+  // whatever is drawn to the cairo context is not transferred to the Clutter
+  // actor until the cairo context is destroyed.  So we need to force it to be
+  // destroyed before we call clutter_main here
+  {
+      Cairo::RefPtr<Cairo::Context> cr = circle->create_cairo_context ();
+      cr->set_operator (Cairo::OPERATOR_CLEAR);
+      cr->paint ();
+      cr->set_operator (Cairo::OPERATOR_OVER);
+      cr->set_source_rgba (0.686, 0.96, 0.235, 0.8);
+      cr->translate (size / 2, size / 2);
+      cr->begin_new_path ();
+      cr->arc (0.0,
+              0.0,
+              size / 2,
+              0.0, 2 * M_PI);
+      cr->fill ();
+  }
+  circle->set_position (stage->get_width () / 2 - size / 2,
+                        stage->get_height () / 2 - size / 2);
+  stage->add_actor (circle);
+
+  stage->show_all ();
+  stage->signal_key_press_event ().connect (sigc::hide (sigc::bind_return (sigc::ptr_fun (&clutter_main_quit), true)));
+
+  // TODO: wrap clutter_main ?
+  clutter_main();
+
+  return 0;
+}

Modified: cluttermm/trunk/examples/test-actors.cc
==============================================================================
--- cluttermm/trunk/examples/test-actors.cc	(original)
+++ cluttermm/trunk/examples/test-actors.cc	Sun Apr 13 15:21:54 2008
@@ -248,6 +248,7 @@
     // and start it
     timeline->start ();
 
+    // TODO: wrap clutter_main ?
     clutter_main ();
 
     delete oh;

Modified: cluttermm/trunk/tools/extra_defs_gen/generate_defs_clutter.cc
==============================================================================
--- cluttermm/trunk/tools/extra_defs_gen/generate_defs_clutter.cc	(original)
+++ cluttermm/trunk/tools/extra_defs_gen/generate_defs_clutter.cc	Sun Apr 13 15:21:54 2008
@@ -18,6 +18,7 @@
 #include "glibmm_generate_extra_defs/generate_extra_defs.h"
 #include <gtk/gtk.h>
 #include <clutter/clutter.h>
+#include <clutter-cairo/clutter-cairo.h>
 #include <iostream>
 
 
@@ -58,6 +59,7 @@
     << get_defs(CLUTTER_TYPE_SCORE)
     << get_defs(CLUTTER_TYPE_SHADER)
     << get_defs(CLUTTER_TYPE_SCRIPT)
+    << get_defs(CLUTTER_TYPE_CAIRO)
     ;
 //    << get_defs(CLUTTER_TYPE_VBOX)
 //    << get_defs(CLUTTER_TYPE_MARGIN);



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