Commit f28b32a4 authored by Øyvind Kolås's avatar Øyvind Kolås

cleaned up header and made it possible to query a path if it has any

* gegl/property-types/gegl-path.[ch]: cleaned up header and made
it possible to query a path if it has any interpolated parameters.

svn path=/trunk/; revision=2682
parent b14e2ae2
2008-11-02 Øyvind Kolås <pippin@gimp.org>
* gegl/property-types/gegl-path.[ch]: cleaned up header and made
it possible to query a path if it has any interpolated parameters.
2008-11-01 Øyvind Kolås <pippin@gimp.org>
* operations/external/fill.c: removed unused winding parameter.
......
......@@ -779,16 +779,10 @@ void gegl_path_get_bounds (GeglPath *self,
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 @@ void gegl_path_get_bounds (GeglPath *self,
*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 @@ gegl_path_append (GeglPath *self,
}
}
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 @@ GeglPath *gegl_path_parameter_path (GeglPath *path,
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 @@ gdouble gegl_path_parameter_calc (GeglPath *path,
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 @@ void gegl_path_parameter_get_bounds (GeglPath *self,
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 @@ void gegl_path_parameter_calc_values (GeglPath *self,
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 @@ static void gegl_buffer_accumulate (GeglBuffer *buffer,
}
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++)
......
......@@ -95,12 +95,18 @@ void gegl_path_foreach_flat (GeglPath *path,
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 @@ void gegl_path_calc_values (GeglPath *self,
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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment