gegl r2599 - in trunk: . gegl operations/common
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2599 - in trunk: . gegl operations/common
- Date: Sun, 5 Oct 2008 21:04:39 +0000 (UTC)
Author: ok
Date: Sun Oct 5 21:04:39 2008
New Revision: 2599
URL: http://svn.gnome.org/viewvc/gegl?rev=2599&view=rev
Log:
* gegl/gegl-chant.h: improved handling of vectors.
* operations/common/fill.c: new operation to fill a vector.
Added:
trunk/operations/common/fill.c
Modified:
trunk/ChangeLog
trunk/gegl/gegl-chant.h
Modified: trunk/gegl/gegl-chant.h
==============================================================================
--- trunk/gegl/gegl-chant.h (original)
+++ trunk/gegl/gegl-chant.h Sun Oct 5 21:04:39 2008
@@ -551,9 +551,13 @@
{/*XXX: remove old signal */ \
g_object_unref (properties->name); \
} \
- properties->name = g_value_dup_object (value); \
- g_signal_connect (G_OBJECT (properties->name), "changed", \
- G_CALLBACK(gegl_operation_vector_prop_changed), gobject); \
+ properties->name = NULL; \
+ if (g_value_peek_pointer (value)) \
+ { \
+ properties->name = g_value_dup_object (value); \
+ g_signal_connect (G_OBJECT (properties->name), "changed", \
+ G_CALLBACK(gegl_operation_vector_prop_changed), gobject); \
+ }
break; /*XXX*/
#include GEGL_CHANT_C_FILE
Added: trunk/operations/common/fill.c
==============================================================================
--- (empty file)
+++ trunk/operations/common/fill.c Sun Oct 5 21:04:39 2008
@@ -0,0 +1,102 @@
+/* This file is an image processing operation for GEGL
+ *
+ * GEGL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * GEGL 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
+ */
+
+
+#include "config.h"
+#include <glib/gi18n-lib.h>
+
+
+#ifdef GEGL_CHANT_PROPERTIES
+
+gegl_chant_vector (vector, _("Vector"),
+ _("A GeglVector representing the path of the fill"))
+gegl_chant_color (color, _("Color"), "rgba(0.1,0.2,0.3,1.0)",
+ _("Color of paint to use"))
+gegl_chant_boolean(winding, _("Winding"), TRUE,
+ _("what kind of fill rule to use"))
+
+#else
+
+#define GEGL_CHANT_TYPE_SOURCE
+#define GEGL_CHANT_C_FILE "fill.c"
+
+#include "gegl-plugin.h"
+
+/* the vector api isn't public yet */
+#include "property-types/gegl-vector.h"
+
+#include "gegl-chant.h"
+
+static void
+prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
+static GeglRectangle
+get_bounding_box (GeglOperation *operation)
+{
+ GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglRectangle defined = { 0, 0, 512, 512 };
+ gdouble x0, x1, y0, y1;
+
+ gegl_vector_get_bounds (o->vector, &x0, &x1, &y0, &y1);
+ defined.x = x0;
+ defined.y = y0;
+ defined.width = x1 - x0;
+ defined.height = y1 - y0;
+
+ return defined;
+}
+
+static gboolean
+process (GeglOperation *operation,
+ GeglBuffer *output,
+ const GeglRectangle *result)
+{
+ GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglRectangle box = get_bounding_box (operation);
+
+ gegl_buffer_clear (output, &box);
+ gegl_vector_fill (output, o->vector, o->color, TRUE);
+
+ return TRUE;
+}
+
+
+static void
+gegl_chant_class_init (GeglChantClass *klass)
+{
+ GeglOperationClass *operation_class;
+ GeglOperationSourceClass *source_class;
+
+ operation_class = GEGL_OPERATION_CLASS (klass);
+ source_class = GEGL_OPERATION_SOURCE_CLASS (klass);
+
+ source_class->process = process;
+ operation_class->get_bounding_box = get_bounding_box;
+ operation_class->prepare = prepare;
+
+ operation_class->name = "fill";
+ operation_class->categories = "render";
+ operation_class->description = _("Renders a fill of the provided GeglVector in a given color");
+ operation_class->get_cached_region = NULL;
+}
+
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]