gnomemm r1519 - in geglmm/trunk: . examples libgegl/src



Author: hub
Date: Wed May 21 23:12:09 2008
New Revision: 1519
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1519&view=rev

Log:
	* libgegl/src/node.{hg,ccg}: Wrap missing functions.
	* examples/hello-world.cc:
	* examples/Makefile.am:
	* examples/Makefile.am_fragment: Example
	* libgegl/src/curve.hg
	* libgegl/src/nodecontext.hg: Remove some linkage errors...


Added:
   geglmm/trunk/examples/hello-world.cc
Modified:
   geglmm/trunk/ChangeLog
   geglmm/trunk/examples/   (props changed)
   geglmm/trunk/examples/Makefile.am
   geglmm/trunk/examples/Makefile.am_fragment
   geglmm/trunk/libgegl/src/curve.hg
   geglmm/trunk/libgegl/src/node.ccg
   geglmm/trunk/libgegl/src/node.hg
   geglmm/trunk/libgegl/src/nodecontext.hg

Modified: geglmm/trunk/examples/Makefile.am
==============================================================================
--- geglmm/trunk/examples/Makefile.am	(original)
+++ geglmm/trunk/examples/Makefile.am	Wed May 21 23:12:09 2008
@@ -2,4 +2,11 @@
 
 EXTRA_DIST	=  Makefile.am_fragment README.txt
 
+include Makefile.am_fragment
+
+noinst_PROGRAMS = hello-world
+
+hello_world_SOURCES = hello-world.cc
+#hello_world_LDFLAGS    = $(common_ldflags)
+#hello_world_LDADD     = $(LIBGEGLMM_LIBS)
 

Modified: geglmm/trunk/examples/Makefile.am_fragment
==============================================================================
--- geglmm/trunk/examples/Makefile.am_fragment	(original)
+++ geglmm/trunk/examples/Makefile.am_fragment	Wed May 21 23:12:09 2008
@@ -1,4 +1,4 @@
-local_libgeglmm_lib = $(top_builddir)/libgegl/libgeglmm/libgeglmm-3.0.la
+local_libgeglmm_lib = $(top_builddir)/libgegl/libgeglmm/libgeglmm.la
 
 LIBS  = $(local_libgeglmm_lib) $(LIBGEGLMM_LIBS)
 

Added: geglmm/trunk/examples/hello-world.cc
==============================================================================
--- (empty file)
+++ geglmm/trunk/examples/hello-world.cc	Wed May 21 23:12:09 2008
@@ -0,0 +1,99 @@
+#include <glib.h>
+#include <libgeglmm/init.h>
+#include <libgeglmm/node.h>
+#include <libgeglmm/color.h>
+
+gint
+main (gint    argc,
+      gchar **argv)
+{
+  Gegl::init (&argc, &argv);  /* initialize the GEGL library */
+
+  {
+    /* instantiate a graph */
+    Glib::RefPtr<Gegl::Node> gegl(Gegl::Node::create ());
+
+/*
+This is the graph we're going to construct:
+ 
+.-----------.
+| display   |
+`-----------'
+   |
+.-------.
+| layer |
+`-------'
+   |   \
+   |    \
+   |     \
+   |      |
+   |   .------.
+   |   | text |
+   |   `------'
+.------------------.
+| fractal-explorer |
+`------------------'
+
+*/
+
+    /*< The image nodes representing operations we want to perform */
+    Glib::RefPtr<Gegl::Node> display = gegl->create_child("display");
+    Glib::RefPtr<Gegl::Node> layer = gegl->new_child("operation", "layer");
+    layer->set_property ("x", 2.0);
+    layer->set_property ("y", 4.0);
+    Glib::RefPtr<Gegl::Node> text = gegl->new_child("operation", "text");
+    text->set_property ("size", 10.0);
+    text->set_property ("color", Glib::RefPtr<Gegl::Color>(Gegl::Color::create ("rgb(1.0,1.0,1.0)")));
+    Glib::RefPtr<Gegl::Node> mandelbrot = gegl->new_child ("operation", "fractal-explorer");
+    mandelbrot->set_property ("width", 512);
+    mandelbrot->set_property ("height", 384);
+
+    mandelbrot->link (layer);
+    mandelbrot->link (display);
+    text->connect_to ("output",  layer, "aux");
+   
+    /* request that the save node is processed, all dependencies will
+     * be processed as well
+     */
+    {
+      gint frame;
+      gint frames = 200;
+
+      for (frame=0; frame<frames; frame++)
+        {
+          gchar string[512];
+          gdouble t = frame * 1.0/frames;
+          gdouble cx = -1.76;
+          gdouble cy = 0.0;
+
+#define INTERPOLATE(min,max) ((max)*(t)+(min)*(1.0-t))
+
+          gdouble xmin = INTERPOLATE(  cx-0.02, cx-2.5);
+          gdouble ymin = INTERPOLATE(  cy-0.02, cy-2.5);
+          gdouble xmax = INTERPOLATE(  cx+0.02, cx+2.5);
+          gdouble ymax = INTERPOLATE(  cy+0.02, cy+2.5);
+
+          if (xmin<-3.0)
+            xmin=-3.0;
+          if (ymin<-3.0)
+            ymin=-3.0;
+
+          mandelbrot->set_property ("xmin", xmin);
+          mandelbrot->set_property ("ymin", ymin);
+          mandelbrot->set_property ("xmax", xmax);
+	  mandelbrot->set_property ("ymax", ymax);
+          snprintf (string, sizeof string, "%1.3f,%1.3f %1.3fÃ%1.3f", xmin, ymin, xmax-xmin, ymax-ymin);
+          text->set_property ("string", &string);
+          display->process ();
+        }
+    }
+
+    /* free resources used by the graph and the nodes it owns */
+  }
+
+  /* free resources globally used by GEGL */
+//  Gegl::exit ();
+
+  return 0;
+}
+

Modified: geglmm/trunk/libgegl/src/curve.hg
==============================================================================
--- geglmm/trunk/libgegl/src/curve.hg	(original)
+++ geglmm/trunk/libgegl/src/curve.hg	Wed May 21 23:12:09 2008
@@ -37,7 +37,7 @@
 	_WRAP_METHOD(static Glib::RefPtr<Curve> create_default_curve(), gegl_curve_default_curve) //TODO: The default values should be in the C properties or its *_init(), so we don't need to use this C function.
 
 	_WRAP_METHOD(void get_y_bounds(double & min_y, double & max_y) const, gegl_curve_get_y_bounds)
-	_WRAP_METHOD(void get_bounds(double & min_x, double & max_x, double & min_y, double & max_y), gegl_curve_get_bounds)
+	//	_WRAP_METHOD(void get_bounds(double & min_x, double & max_x, double & min_y, double & max_y), gegl_curve_get_bounds)
 	_WRAP_METHOD(guint add_point(double x, double y), gegl_curve_add_point)
 	_WRAP_METHOD(void get_point(guint index, double &x, double &y) const, gegl_curve_get_point)
 	_WRAP_METHOD(void set_point(guint index, double x, double y), gegl_curve_set_point)

Modified: geglmm/trunk/libgegl/src/node.ccg
==============================================================================
--- geglmm/trunk/libgegl/src/node.ccg	(original)
+++ geglmm/trunk/libgegl/src/node.ccg	Wed May 21 23:12:09 2008
@@ -26,6 +26,15 @@
 
 namespace  Gegl {
 
+    Glib::RefPtr<Node> Node::new_child(const Glib::ustring & first_property_name, const Glib::ustring & first_value)
+	{
+		Glib::RefPtr<Node> node(Glib::wrap(
+									gegl_node_new_child(gobj(),
+														first_property_name.c_str(),
+														first_value.c_str(), NULL)));
+		return node;
+	}
+
 	Glib::RefPtr<Node> Node::get_producer(const Glib::ustring & input_pad_name, Glib::ustring * output_pad_name) const
 	{
 		gchar *s = NULL;

Modified: geglmm/trunk/libgegl/src/node.hg
==============================================================================
--- geglmm/trunk/libgegl/src/node.hg	(original)
+++ geglmm/trunk/libgegl/src/node.hg	Wed May 21 23:12:09 2008
@@ -39,22 +39,31 @@
 {
 	_CLASS_GOBJECT(Node, GeglNode, GEGL_NODE, Glib::Object, GObject)
 protected:
-	_CTOR_DEFAULT
+	_CTOR_DEFAULT()
 
 public:
 	_WRAP_CREATE()
+
+public:
+	/** create a new_child
+	 * @param first_property_name 
+	 */
+    Glib::RefPtr<Node> new_child(const Glib::ustring & first_property_name, const Glib::ustring & first_value);
+	_IGNORE(gegl_node_new_child)
 	
-	//	_WRAP_METHOD(static Glib::RefPtr<Node> new_child(const Glib::RefPtr<Node> & parent, const Glib::ustring & first_property_name, ...) G_GNUC_NULL_TERMINATED, gegl_node_new_child)
 	_WRAP_METHOD(bool connect_from(const Glib::ustring & input_pad_name, const Glib::RefPtr<Node> & source, const Glib::ustring & output_pad_name), gegl_node_connect_from)
 	_WRAP_METHOD(bool connect_to(const Glib::ustring & output_pad_name, const Glib::RefPtr<Node> & sink, const Glib::ustring & input_pad_name), gegl_node_connect_to)
 
 //TODO: Return this, and throw an exception, to allow node->link(node2)->link(node3), like in gstreammermm?
 	_WRAP_METHOD(void link(const Glib::RefPtr<Node> & sink), gegl_node_link)
+	_IGNORE(gegl_node_link_many)
 //	_WRAP_METHOD(void link_many(const Glib::RefPtr<Node> & first_sink, ...) G_GNUC_NULL_TERMINATED, gegl_node_link_many)
 
 	_WRAP_METHOD(bool disconnect(const Glib::ustring & input_pad), gegl_node_disconnect)
+	_IGNORE(gegl_node_set)
+	_IGNORE(gegl_node_get)
 //	_WRAP_METHOD(void set(const Glib::ustring & first_property_name, ...) G_GNUC_NULL_TERMINATED, gegl_node_set)
-//	_WRAP_METHOD(void get(const Glib::ustring & first_property_name, ...) G_GNUC_NULL_TERMINATED, gegl_node_get)	
+//	_WRAP_METHOD(void get(const Glib::ustring & first_property_name, ...) G_GNUC_NULL_TERMINATED, gegl_node_get)
 	
 	_WRAP_METHOD(void blit(double scale, const Rectangle &roi, const Babl * format, void * destination_buf, int rowstride, BlitFlags flags), gegl_node_blit)
 	_WRAP_METHOD(void process(), gegl_node_process)
@@ -85,15 +94,15 @@
 
 	// implemented by hand
 	//	_WRAP_METHOD(Glib::RefPtr<Node> get_producer(const Glib::ustring & input_pad_name, Glib::ustring * output_pad_name), gegl_node_get_producer)
-
 //TODO: Use a & instead of a * and add an override witout the output_pad_name:
+	_IGNORE(gegl_node_get_producer)
 	Glib::RefPtr<Node> get_producer(const Glib::ustring & input_pad_name, Glib::ustring * output_pad_name) const;
 
-	_WRAP_METHOD(static Glib::RefPtr<Node> create_child(const Glib::RefPtr<Node> & parent, const Glib::ustring & operation), gegl_node_create_child)
+	_WRAP_METHOD(Glib::RefPtr<Node> create_child(const Glib::ustring & operation), gegl_node_create_child)
+
 
-	// I guess we can use the property mechanism
-	//	_WRAP_METHOD(void get_property(const Glib::ustring & property_name, Glib::ValueBase & value), gegl_node_get_property)
-	//	_WRAP_METHOD(void set_property(const Glib::ustring & property_name, const Glib::ValueBase & value), gegl_node_set_property)
+	_IGNORE(gegl_node_get_property)
+	_IGNORE(gegl_node_set_property)
 
 	_WRAP_METHOD(static Glib::RefPtr<Node> new_from_xml(const Glib::ustring & xmldata, const Glib::ustring & path_root), gegl_node_new_from_xml)
 	_WRAP_METHOD(static Glib::RefPtr<Node> new_from_file(const Glib::ustring & path), gegl_node_new_from_file)

Modified: geglmm/trunk/libgegl/src/nodecontext.hg
==============================================================================
--- geglmm/trunk/libgegl/src/nodecontext.hg	(original)
+++ geglmm/trunk/libgegl/src/nodecontext.hg	Wed May 21 23:12:09 2008
@@ -34,9 +34,9 @@
 {
 	_CLASS_GOBJECT(NodeContext, GeglNodeContext, GEGL_NODE, Glib::Object, GObject)
 public:
-	_WRAP_METHOD(Glib::RefPtr<Buffer> get_source(const Glib::ustring & padname), gegl_node_context_get_source)
-	_WRAP_METHOD(Glib::RefPtr<Buffer> get_target(const Glib::ustring & padname), gegl_node_context_get_target)
-	_WRAP_METHOD(void set_object(const Glib::ustring & padname, const Glib::RefPtr<Glib::Object> & data), gegl_node_context_set_object)
+	//	_WRAP_METHOD(Glib::RefPtr<Buffer> get_source(const Glib::ustring & padname), gegl_node_context_get_source)
+	//	_WRAP_METHOD(Glib::RefPtr<Buffer> get_target(const Glib::ustring & padname), gegl_node_context_get_target)
+	//	_WRAP_METHOD(void set_object(const Glib::ustring & padname, const Glib::RefPtr<Glib::Object> & data), gegl_node_context_set_object)
 
 };
 



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