gegl r1990 - trunk/docs
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r1990 - trunk/docs
- Date: Sat, 9 Feb 2008 23:24:50 +0000 (GMT)
Author: ok
Date: Sat Feb 9 23:24:50 2008
New Revision: 1990
URL: http://svn.gnome.org/viewvc/gegl?rev=1990&view=rev
Log:
* Makefile.am: added rule to build hello-world-video
* hello-world-video.c: (main): added.
* hello-world.c: (main): modified to use fractal-explorer instead of
FractalExplorer.
Added:
trunk/docs/hello-world-video.c
Modified:
trunk/docs/ChangeLog
trunk/docs/Makefile.am
trunk/docs/hello-world.c
Modified: trunk/docs/Makefile.am
==============================================================================
--- trunk/docs/Makefile.am (original)
+++ trunk/docs/Makefile.am Sat Feb 9 23:24:50 2008
@@ -18,6 +18,7 @@
gegl.devhelp \
devhelp.css \
hello-world.c \
+ hello-world-video.c \
index-static.html.in \
api.html \
index.html
@@ -81,3 +82,6 @@
hello-world: hello-world.c
$(CC) $< -o $@ `pkg-config --cflags --libs gegl`
+
+hello-world-video: hello-world-video.c
+ $(CC) $< -o $@ `pkg-config --cflags --libs gegl`
Added: trunk/docs/hello-world-video.c
==============================================================================
--- (empty file)
+++ trunk/docs/hello-world-video.c Sat Feb 9 23:24:50 2008
@@ -0,0 +1,109 @@
+#include <gegl.h>
+
+gint
+main (gint argc,
+ gchar **argv)
+{
+ gegl_init (&argc, &argv); /* initialize the GEGL library */
+
+ {
+ /* instantiate a graph */
+ GeglNode *gegl = gegl_node_new ();
+
+/*
+This is the graph we're going to construct:
+
+.-----------.
+| ff-save |
+`-----------'
+ |
+.-------.
+| layer |
+`-------'
+ | \
+ | \
+ | \
+ | |
+ | .------.
+ | | text |
+ | `------'
+.------------------.
+| fractal-explorer |
+`------------------'
+
+*/
+
+ /*< The image nodes representing operations we want to perform */
+ GeglNode *display = gegl_node_new_child (gegl,
+ "operation","ff-save",
+ "path", "fractal-zoom.avi",
+ "bitrate", 1200000.0,
+ NULL);
+ GeglNode *layer = gegl_node_new_child (gegl,
+ "operation", "layer",
+ "x", 2.0,
+ "y", 4.0,
+ NULL);
+ GeglNode *text = gegl_node_new_child (gegl,
+ "operation", "text",
+ "size", 10.0,
+ "color", gegl_color_new ("rgb(1.0,1.0,1.0)"),
+ NULL);
+ GeglNode *mandelbrot = gegl_node_new_child (gegl,
+ "operation", "fractal-explorer",
+ "width", 640,
+ "height", 480,
+ NULL);
+
+ gegl_node_link_many (mandelbrot, layer, display, NULL);
+ gegl_node_connect_to (text, "output", layer, "aux");
+
+ /* request that the save node is processed, all dependencies will
+ * be processed as well
+ */
+ {
+ gint frame;
+ gint frames = 100;
+
+ 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;
+
+ gegl_node_set (mandelbrot, "xmin", xmin,
+ "ymin", ymin,
+ "xmax", xmax,
+ "ymax", ymax,
+ NULL);
+ g_sprintf (string, "%1.3f,%1.3f %1.3fÃ%1.3f",
+ xmin, ymin, xmax-xmin, ymax-ymin);
+ gegl_node_set (text, "string", string, NULL);
+ gegl_node_process (display);
+ g_print ("%3.0f%% \r", t * 100);
+ }
+ }
+ g_print (" \r");
+
+ /* free resources used by the graph and the nodes it owns */
+ g_object_unref (gegl);
+ }
+
+ /* free resources globally used by GEGL */
+ gegl_exit ();
+
+ return 0;
+}
Modified: trunk/docs/hello-world.c
==============================================================================
--- trunk/docs/hello-world.c (original)
+++ trunk/docs/hello-world.c Sat Feb 9 23:24:50 2008
@@ -27,9 +27,9 @@
| .------.
| | text |
| `------'
-.-----------------.
-| FractalExplorer |
-`-----------------'
+.------------------.
+| fractal-explorer |
+`------------------'
*/
@@ -46,9 +46,9 @@
"color", gegl_color_new ("rgb(1.0,1.0,1.0)"),
NULL);
GeglNode *mandelbrot = gegl_node_new_child (gegl,
- "operation", "FractalExplorer",
- "width", 256,
- "height", 256,
+ "operation", "fractal-explorer",
+ "width", 512,
+ "height", 384,
NULL);
gegl_node_link_many (mandelbrot, layer, display, NULL);
@@ -59,7 +59,7 @@
*/
{
gint frame;
- gint frames = 30;
+ gint frames = 200;
for (frame=0; frame<frames; frame++)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]