gegl r2682 - in trunk: . gegl/property-types
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2682 - in trunk: . gegl/property-types
- Date: Sun, 2 Nov 2008 15:04:25 +0000 (UTC)
Author: ok
Date: Sun Nov 2 15:04:25 2008
New Revision: 2682
URL: http://svn.gnome.org/viewvc/gegl?rev=2682&view=rev
Log:
* gegl/property-types/gegl-path.[ch]: cleaned up header and made
it possible to query a path if it has any interpolated parameters.
Modified:
trunk/ChangeLog
trunk/gegl/property-types/gegl-path.c
trunk/gegl/property-types/gegl-path.h
Modified: trunk/gegl/property-types/gegl-path.c
==============================================================================
--- trunk/gegl/property-types/gegl-path.c (original)
+++ trunk/gegl/property-types/gegl-path.c Sun Nov 2 15:04:25 2008
@@ -779,16 +779,10 @@
return;
priv = GEGL_PATH_GET_PRIVATE (self);
-
ensure_flattened (self);
iter = priv->flat_path;
- if (*max_x < *min_x)
- *max_x = *min_x;
- if (*max_y < *min_y)
- *max_y = *min_y;
-
while (iter)
{
gint i;
@@ -811,6 +805,7 @@
*min_y = iter->d.point[i].y;
if (iter->d.point[i].y > *max_y)
*max_y = iter->d.point[i].y;
+
}
iter=iter->next;
}
@@ -1386,12 +1381,10 @@
}
}
-
-GeglPath *gegl_path_parameter_path (GeglPath *path,
- const gchar *parameter_name)
+GeglPath *gegl_path_get_parameter_path (GeglPath *path,
+ const gchar *parameter_name)
{
GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (path);
- GeglPath *parameter_path;
GSList *iter;
gint i;
for (iter=priv->parameter_names,i=0;iter;iter=iter->next,i++)
@@ -1399,9 +1392,23 @@
if (g_str_equal (parameter_name, (gchar*)iter->data))
return (GeglPath*) g_slist_nth_data (priv->parameter_paths, i);
}
+ return NULL;
+}
+
+/* creates a new path if one doesn't already exist */
+GeglPath *gegl_path_add_parameter_path (GeglPath *self,
+ const gchar *parameter_name)
+{
+ GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (self);
+ GeglPath *parameter_path;
+
+ parameter_path = gegl_path_get_parameter_path (self, parameter_name);
+ if (parameter_path)
+ return parameter_path;
+
priv->parameter_names = g_slist_append (priv->parameter_names, g_strdup (parameter_name));
parameter_path = gegl_path_new ();
- GEGL_PATH_GET_PRIVATE (parameter_path)->parent_path = path;
+ GEGL_PATH_GET_PRIVATE (parameter_path)->parent_path = self;
#if 0
/* hard coded for line width,.. */
@@ -1524,7 +1531,7 @@
const gchar *parameter_name,
gdouble pos)
{
- GeglPath *parameter_path = gegl_path_parameter_path (path, parameter_name);
+ GeglPath *parameter_path = gegl_path_get_parameter_path (path, parameter_name);
return param_calc (parameter_path, pos);
}
@@ -1533,7 +1540,7 @@
gdouble *min_value,
gdouble *max_value)
{
- GeglPath *parameter_path = gegl_path_parameter_path (self, parameter_name);
+ GeglPath *parameter_path = gegl_path_get_parameter_path (self, parameter_name);
param_bounds (parameter_path, gegl_path_get_length (self), min_value, max_value);
}
@@ -1543,7 +1550,7 @@
guint num_samples,
gdouble *samples)
{
- GeglPath *parameter_path = gegl_path_parameter_path (self, parameter_name);
+ GeglPath *parameter_path = gegl_path_get_parameter_path (self, parameter_name);
gdouble length = gegl_path_get_length (self);
gint i;
for (i=0; i<num_samples; i++)
@@ -1620,7 +1627,7 @@
}
gegl_buffer_get (buffer, 1.0, roi, format, buf, 0);
- for (i=0; i< roi->width; i++)
+ for (i=0; i < roi->width; i++)
{
gint j;
for (j=0; j<4; j++)
Modified: trunk/gegl/property-types/gegl-path.h
==============================================================================
--- trunk/gegl/property-types/gegl-path.h (original)
+++ trunk/gegl/property-types/gegl-path.h Sun Nov 2 15:04:25 2008
@@ -95,12 +95,18 @@
gpointer data),
gpointer data);
-/* auxilary data is handled as external data that is owned by the path,
- * fill it with positions stored in x and values stored in y, with type '0'
- * to get linear interpolation between the values stored.
+/* creates a new path if one doesn't already exist */
+GeglPath * gegl_path_add_parameter_path (GeglPath *path,
+ const gchar *parameter_name);
+
+/* the returned path is a special path that returns 1d
+ * data when rendering it's results, NULL is returned if
+ * this path does not exist on the queried path.
*/
-GeglPath *gegl_path_parameter_path (GeglPath *path,
+GeglPath *gegl_path_get_parameter_path (GeglPath *path,
const gchar *parameter_name);
+
+
/* get a list of the named datas following this path, should not be freed */
GSList *gegl_path_parameter_get_names (GeglPath *path,
gint count);
@@ -130,22 +136,8 @@
guint num_samples,
gdouble *dest_xs,
gdouble *dest_ys);
-/* the returned path is a special path that returns 1d
- * data when rendering it's results.
- */
-GeglPath *gegl_path_get_param_path (GeglPath *self,
- const gchar *name);
-/* pass in -1 to append at the current position (tail) of the path */
-void gegl_path_param_set (GeglPath *self,
- gdouble pos,
- const gchar *name, /* perhaps use a quark? */
- gdouble value);
-gdouble gegl_path_param_calc (GeglPath *self,
- gdouble pos);
-gdouble gegl_path_param_calc_values (GeglPath *self,
- guint num_samples,
- gdouble *values);
+
GParamSpec * gegl_param_spec_path (const gchar *name,
const gchar *nick,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]