Blame gegl/property-types/gegl-curve.h

Packit bc1512
/* This file is part of GEGL
Packit bc1512
 *
Packit bc1512
 * GEGL is free software; you can redistribute it and/or
Packit bc1512
 * modify it under the terms of the GNU Lesser General Public
Packit bc1512
 * License as published by the Free Software Foundation; either
Packit bc1512
 * version 3 of the License, or (at your option) any later version.
Packit bc1512
 *
Packit bc1512
 * GEGL is distributed in the hope that it will be useful,
Packit bc1512
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit bc1512
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit bc1512
 * Lesser General Public License for more details.
Packit bc1512
 *
Packit bc1512
 * You should have received a copy of the GNU Lesser General Public
Packit bc1512
 * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
Packit bc1512
 *
Packit bc1512
 * Copyright 2007 Mark Probst <mark.probst@gmail.com>
Packit bc1512
 */
Packit bc1512
Packit bc1512
#ifndef __GEGL_CURVE_H__
Packit bc1512
#define __GEGL_CURVE_H__
Packit bc1512
Packit bc1512
/***
Packit bc1512
 * GeglCurve:
Packit bc1512
 *
Packit bc1512
 * #GeglCurve is a curve describing a unique mapping of values.
Packit bc1512
 *
Packit bc1512
 * Used for things like the curves widget in gimp it is a form of doodle
Packit bc1512
 * alpha.
Packit bc1512
 */
Packit bc1512
#include <glib-object.h>
Packit bc1512
Packit bc1512
G_BEGIN_DECLS
Packit bc1512
Packit bc1512
#define GEGL_TYPE_CURVE            (gegl_curve_get_type ())
Packit bc1512
#define GEGL_CURVE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_CURVE, GeglCurve))
Packit bc1512
#define GEGL_CURVE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GEGL_TYPE_CURVE, GeglCurveClass))
Packit bc1512
#define GEGL_IS_CURVE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_CURVE))
Packit bc1512
#define GEGL_IS_CURVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GEGL_TYPE_CURVE))
Packit bc1512
#define GEGL_CURVE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GEGL_TYPE_CURVE, GeglCurveClass))
Packit bc1512
Packit bc1512
typedef struct _GeglCurveClass  GeglCurveClass;
Packit bc1512
Packit bc1512
struct _GeglCurve
Packit bc1512
{
Packit bc1512
  GObject parent_instance;
Packit bc1512
};
Packit bc1512
Packit bc1512
struct _GeglCurveClass
Packit bc1512
{
Packit bc1512
  GObjectClass parent_class;
Packit bc1512
};
Packit bc1512
Packit bc1512
GType        gegl_curve_get_type       (void) G_GNUC_CONST;
Packit bc1512
Packit bc1512
/**
Packit bc1512
 * gegl_curve_new:
Packit bc1512
 * @y_min: minimum y value for curve.
Packit bc1512
 * @y_max: maximum y value for curve.
Packit bc1512
 *
Packit bc1512
 * Create a #GeglCurve that can store a curve with values between @y_min and
Packit bc1512
 * @y_max.
Packit bc1512
 *
Packit bc1512
 * Returns the newly created #GeglCurve.
Packit bc1512
 */
Packit bc1512
GeglCurve  * gegl_curve_new            (gdouble      y_min,
Packit bc1512
                                        gdouble      y_max);
Packit bc1512
Packit bc1512
Packit bc1512
/**
Packit bc1512
 * gegl_curve_get_y_bounds:
Packit bc1512
 * @curve: a #GeglCurve.
Packit bc1512
 * @min_y: return location for minimal value.
Packit bc1512
 * @max_y: return location for maximal value.
Packit bc1512
 *
Packit bc1512
 * Get the bounds on the values of the curve and store the values in
Packit bc1512
 * the return locaitons provided in @min_y and @max_y.
Packit bc1512
 */
Packit bc1512
void         gegl_curve_get_y_bounds   (GeglCurve   *curve,
Packit bc1512
                                        gdouble     *min_y,
Packit bc1512
                                        gdouble     *max_y);
Packit bc1512
Packit bc1512
/**
Packit bc1512
 * gegl_curve_add_point:
Packit bc1512
 * @curve: a #GeglCurve.
Packit bc1512
 * @x: x coordinate
Packit bc1512
 * @y: y coordinate
Packit bc1512
 *
Packit bc1512
 * Add a point to the curve at @x @y (replacing the value exactly for @x if it
Packit bc1512
 * already exists.
Packit bc1512
 */
Packit bc1512
guint        gegl_curve_add_point      (GeglCurve   *curve,
Packit bc1512
                                        gdouble      x,
Packit bc1512
                                        gdouble      y);
Packit bc1512
Packit bc1512
/**
Packit bc1512
 * gegl_curve_get_point:
Packit bc1512
 * @curve: a #GeglCurve.
Packit bc1512
 * @index: the position of the value number to retrieve.
Packit bc1512
 * @x: x coordinate return location.
Packit bc1512
 * @y: y coordinate return location.
Packit bc1512
 *
Packit bc1512
 * Retrive the coordinates for an index.
Packit bc1512
 */
Packit bc1512
void         gegl_curve_get_point      (GeglCurve   *curve,
Packit bc1512
                                        guint        index,
Packit bc1512
                                        gdouble     *x,
Packit bc1512
                                        gdouble     *y);
Packit bc1512
Packit bc1512
/**
Packit bc1512
 * gegl_curve_set_point:
Packit bc1512
 * @curve: a #GeglCurve.
Packit bc1512
 * @index: the position of the value number to retrieve.
Packit bc1512
 * @x: x coordinate
Packit bc1512
 * @y: y coordinate
Packit bc1512
 *
Packit bc1512
 * Replace an existing point in a curve.
Packit bc1512
 */
Packit bc1512
void         gegl_curve_set_point      (GeglCurve   *curve,
Packit bc1512
                                        guint        index,
Packit bc1512
                                        gdouble      x,
Packit bc1512
                                        gdouble      y);
Packit bc1512
Packit bc1512
/**
Packit bc1512
 * gegl_curve_num_points:
Packit bc1512
 * @curve: a #GeglCurve.
Packit bc1512
 *
Packit bc1512
 * Retrieve the number of points in the curve.
Packit bc1512
 *
Packit bc1512
 * Returns the number of points for the coordinates in the curve.
Packit bc1512
 */
Packit bc1512
guint        gegl_curve_num_points     (GeglCurve   *curve);
Packit bc1512
Packit bc1512
/**
Packit bc1512
 * gegl_curve_calc_value:
Packit bc1512
 * @curve: a #GeglCurve.
Packit bc1512
 *
Packit bc1512
 * Retrieve the number of points in the curve.
Packit bc1512
 *
Packit bc1512
 * Returns the number of points for the coordinates in the curve.
Packit bc1512
 */
Packit bc1512
gdouble      gegl_curve_calc_value     (GeglCurve   *curve,
Packit bc1512
                                        gdouble      x);
Packit bc1512
Packit bc1512
/**
Packit bc1512
 * gegl_curve_calc_values:
Packit bc1512
 * @curve: a #GeglCurve.
Packit bc1512
 * @x_min: the minimum value to compute for
Packit bc1512
 * @x_max: the maxmimum value to compute for
Packit bc1512
 * @num_samples: number of samples to calculate
Packit bc1512
 * @xs: return location for the x coordinates
Packit bc1512
 * @ys: return location for the y coordinates
Packit bc1512
 *
Packit bc1512
 * Compute a set (lookup table) of coordinates.
Packit bc1512
 */
Packit bc1512
void         gegl_curve_calc_values    (GeglCurve   *curve,
Packit bc1512
                                        gdouble      x_min,
Packit bc1512
                                        gdouble      x_max,
Packit bc1512
                                        guint        num_samples,
Packit bc1512
                                        gdouble     *xs,
Packit bc1512
                                        gdouble     *ys);
Packit bc1512
Packit bc1512
/***
Packit bc1512
 */
Packit bc1512
Packit bc1512
#define GEGL_TYPE_PARAM_CURVE           (gegl_param_curve_get_type ())
Packit bc1512
#define GEGL_IS_PARAM_SPEC_CURVE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GEGL_TYPE_PARAM_CURVE))
Packit bc1512
Packit bc1512
GeglCurve  * gegl_curve_default_curve  (void) G_GNUC_CONST;
Packit bc1512
Packit bc1512
GType        gegl_param_curve_get_type (void) G_GNUC_CONST;
Packit bc1512
Packit bc1512
GParamSpec * gegl_param_spec_curve     (const gchar *name,
Packit bc1512
                                        const gchar *nick,
Packit bc1512
                                        const gchar *blurb,
Packit bc1512
                                        GeglCurve   *default_curve,
Packit bc1512
                                        GParamFlags  flags);
Packit bc1512
Packit bc1512
G_END_DECLS
Packit bc1512
Packit bc1512
#endif /* __GEGL_CURVE_H__ */