<refentry id="GtkCurve">
<refmeta>
<refentrytitle>GtkCurve</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GtkCurve</refname><refpurpose>allows direct editing of a curve.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>
<synopsis>

#include &lt;gtk/gtk.h&gt;


struct      <link linkend="GtkCurve-struct">GtkCurve</link>;
<link linkend="GtkWidget">GtkWidget</link>*  <link linkend="gtk-curve-new">gtk_curve_new</link>                   (void);
void        <link linkend="gtk-curve-reset">gtk_curve_reset</link>                 (<link linkend="GtkCurve">GtkCurve</link> *curve);
void        <link linkend="gtk-curve-set-gamma">gtk_curve_set_gamma</link>             (<link linkend="GtkCurve">GtkCurve</link> *curve,
                                             <link linkend="gfloat">gfloat</link> gamma);
void        <link linkend="gtk-curve-set-range">gtk_curve_set_range</link>             (<link linkend="GtkCurve">GtkCurve</link> *curve,
                                             <link linkend="gfloat">gfloat</link> min_x,
                                             <link linkend="gfloat">gfloat</link> max_x,
                                             <link linkend="gfloat">gfloat</link> min_y,
                                             <link linkend="gfloat">gfloat</link> max_y);
void        <link linkend="gtk-curve-get-vector">gtk_curve_get_vector</link>            (<link linkend="GtkCurve">GtkCurve</link> *curve,
                                             int veclen,
                                             <link linkend="gfloat">gfloat</link> vector[]);
void        <link linkend="gtk-curve-set-vector">gtk_curve_set_vector</link>            (<link linkend="GtkCurve">GtkCurve</link> *curve,
                                             int veclen,
                                             <link linkend="gfloat">gfloat</link> vector[]);
void        <link linkend="gtk-curve-set-curve-type">gtk_curve_set_curve_type</link>        (<link linkend="GtkCurve">GtkCurve</link> *curve,
                                             <link linkend="GtkCurveType">GtkCurveType</link> type);


</synopsis>
</refsynopsisdiv>

<refsect1>
<title>Object Hierarchy</title>
<synopsis>

  <link linkend="GObject">GObject</link>
   +----<link linkend="GtkObject">GtkObject</link>
         +----<link linkend="GtkWidget">GtkWidget</link>
               +----<link linkend="GtkDrawingArea">GtkDrawingArea</link>
                     +----GtkCurve
</synopsis>

</refsect1>

<refsect1>
<title>Properties</title>
<synopsis>

  &quot;<link linkend="GtkCurve--curve-type">curve-type</link>&quot;           <link linkend="GtkCurveType">GtkCurveType</link>         : Read / Write
  &quot;<link linkend="GtkCurve--min-x">min-x</link>&quot;                <link linkend="gfloat">gfloat</link>               : Read / Write
  &quot;<link linkend="GtkCurve--max-x">max-x</link>&quot;                <link linkend="gfloat">gfloat</link>               : Read / Write
  &quot;<link linkend="GtkCurve--min-y">min-y</link>&quot;                <link linkend="gfloat">gfloat</link>               : Read / Write
  &quot;<link linkend="GtkCurve--max-y">max-y</link>&quot;                <link linkend="gfloat">gfloat</link>               : Read / Write
</synopsis>
</refsect1>

<refsect1>
<title>Signal Prototypes</title>
<synopsis>

&quot;<link linkend="GtkCurve-curve-type-changed">curve-type-changed</link>&quot;
            void        user_function      (<link linkend="GtkCurve">GtkCurve</link> *curve,
                                            <link linkend="gpointer">gpointer</link> user_data);
</synopsis>
</refsect1>


<refsect1>
<title>Description</title>
<para>
 NOTE this widget is considered too specialized/little-used for
 GTK+, and will in the future be moved to some other package.  If
 your application needs this widget, feel free to use it, as the
 widget does work and is useful in some applications; it's just not
 of general interest. However, we are not accepting new features for
 the widget, and it will eventually move out of the GTK+
 distribution.
</para>
<para>
The <link linkend="GtkCurve">GtkCurve</link> widget allows the user to edit a curve covering a range of
values. It is typically used to fine-tune color balances in graphics
applications like the Gimp.
</para>
<para>
The <link linkend="GtkCurve">GtkCurve</link> widget has 3 modes of operation - spline, linear and free.
In spline mode the user places points on the curve which are automatically
connected together into a smooth curve. In linear mode the user places points
on the curve which are connected by straight lines. In free mode the user can
draw the points of the curve freely, and they are not connected at all.
</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="GtkCurve-struct">struct GtkCurve</title>
<programlisting>struct GtkCurve;</programlisting>
<para>
The <link linkend="GtkCurve-struct">GtkCurve</link> struct contains private data only, and
should be accessed using the functions below.
</para></refsect2>
<refsect2>
<title><anchor id="gtk-curve-new">gtk_curve_new ()</title>
<programlisting><link linkend="GtkWidget">GtkWidget</link>*  gtk_curve_new                   (void);</programlisting>
<para>
Creates a new <link linkend="GtkCurve">GtkCurve</link>.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>a new <link linkend="GtkCurve">GtkCurve</link>.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-curve-reset">gtk_curve_reset ()</title>
<programlisting>void        gtk_curve_reset                 (<link linkend="GtkCurve">GtkCurve</link> *curve);</programlisting>
<para>
Resets the curve to a straight line from the minimum x & y values to the
maximum x & y values (i.e. from the bottom-left to the top-right corners).
The curve type is not changed.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>curve</parameter>&nbsp;:</entry>
<entry>a <link linkend="GtkCurve">GtkCurve</link>.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-curve-set-gamma">gtk_curve_set_gamma ()</title>
<programlisting>void        gtk_curve_set_gamma             (<link linkend="GtkCurve">GtkCurve</link> *curve,
                                             <link linkend="gfloat">gfloat</link> gamma);</programlisting>
<para>
Recomputes the entire curve using the given gamma value.
A gamma value of 1 results in a straight line. Values greater than 1 result
in a curve above the straight line. Values less than 1 result in a curve
below the straight line. The curve type is changed to <literal>GTK_CURVE_TYPE_FREE</literal>.
FIXME: Needs a more precise definition of gamma.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>curve</parameter>&nbsp;:</entry>
<entry>a <link linkend="GtkCurve">GtkCurve</link>.
</entry></row>
<row><entry align="right"><parameter>gamma</parameter>&nbsp;:</entry>
<entry>the gamma value.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-curve-set-range">gtk_curve_set_range ()</title>
<programlisting>void        gtk_curve_set_range             (<link linkend="GtkCurve">GtkCurve</link> *curve,
                                             <link linkend="gfloat">gfloat</link> min_x,
                                             <link linkend="gfloat">gfloat</link> max_x,
                                             <link linkend="gfloat">gfloat</link> min_y,
                                             <link linkend="gfloat">gfloat</link> max_y);</programlisting>
<para>
Sets the minimum and maximum x & y values of the curve.
The curve is also reset with a call to <link linkend="gtk-curve-reset">gtk_curve_reset</link>().
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>curve</parameter>&nbsp;:</entry>
<entry>a <link linkend="GtkCurve">GtkCurve</link>.
</entry></row>
<row><entry align="right"><parameter>min_x</parameter>&nbsp;:</entry>
<entry>the minimum x value.
</entry></row>
<row><entry align="right"><parameter>max_x</parameter>&nbsp;:</entry>
<entry>the maximum x value.
</entry></row>
<row><entry align="right"><parameter>min_y</parameter>&nbsp;:</entry>
<entry>the minimum y value.
</entry></row>
<row><entry align="right"><parameter>max_y</parameter>&nbsp;:</entry>
<entry>the maximum y value.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-curve-get-vector">gtk_curve_get_vector ()</title>
<programlisting>void        gtk_curve_get_vector            (<link linkend="GtkCurve">GtkCurve</link> *curve,
                                             int veclen,
                                             <link linkend="gfloat">gfloat</link> vector[]);</programlisting>
<para>
Returns a vector of points representing the curve.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>curve</parameter>&nbsp;:</entry>
<entry>a <link linkend="GtkCurve">GtkCurve</link>.
</entry></row>
<row><entry align="right"><parameter>veclen</parameter>&nbsp;:</entry>
<entry>the number of points to calculate.
</entry></row>
<row><entry align="right"><parameter>vector</parameter>&nbsp;:</entry>
<entry>returns the points.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-curve-set-vector">gtk_curve_set_vector ()</title>
<programlisting>void        gtk_curve_set_vector            (<link linkend="GtkCurve">GtkCurve</link> *curve,
                                             int veclen,
                                             <link linkend="gfloat">gfloat</link> vector[]);</programlisting>
<para>
Sets the vector of points on the curve.
The curve type is set to <literal>GTK_CURVE_TYPE_FREE</literal>.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>curve</parameter>&nbsp;:</entry>
<entry>a <link linkend="GtkCurve">GtkCurve</link>.
</entry></row>
<row><entry align="right"><parameter>veclen</parameter>&nbsp;:</entry>
<entry>the number of points.
</entry></row>
<row><entry align="right"><parameter>vector</parameter>&nbsp;:</entry>
<entry>the points on the curve.


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-curve-set-curve-type">gtk_curve_set_curve_type ()</title>
<programlisting>void        gtk_curve_set_curve_type        (<link linkend="GtkCurve">GtkCurve</link> *curve,
                                             <link linkend="GtkCurveType">GtkCurveType</link> type);</programlisting>
<para>
Sets the type of the curve. The curve will remain unchanged except when
changing from a free curve to a linear or spline curve, in which case the
curve will be changed as little as possible.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>curve</parameter>&nbsp;:</entry>
<entry>a <link linkend="GtkCurve">GtkCurve</link>.
</entry></row>
<row><entry align="right"><parameter>type</parameter>&nbsp;:</entry>
<entry>the type of the curve.


</entry></row>
</tbody></tgroup></informaltable></refsect2>

</refsect1>
<refsect1>
<title>Properties</title>
<variablelist>
<varlistentry><term><anchor id="GtkCurve--curve-type">&quot;<literal>curve-type</literal>&quot; (<link linkend="GtkCurveType">GtkCurveType</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkCurve--min-x">&quot;<literal>min-x</literal>&quot; (<link linkend="gfloat">gfloat</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkCurve--max-x">&quot;<literal>max-x</literal>&quot; (<link linkend="gfloat">gfloat</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkCurve--min-y">&quot;<literal>min-y</literal>&quot; (<link linkend="gfloat">gfloat</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkCurve--max-y">&quot;<literal>max-y</literal>&quot; (<link linkend="gfloat">gfloat</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>

</variablelist>
</refsect1>

<refsect1>
<title>Signals</title>
<refsect2><title><anchor id="GtkCurve-curve-type-changed">The &quot;curve-type-changed&quot; signal</title>
<programlisting>void        user_function                  (<link linkend="GtkCurve">GtkCurve</link> *curve,
                                            <link linkend="gpointer">gpointer</link> user_data);</programlisting>
<para>
Emitted when the curve type has been changed.
The curve type can be changed explicitly with a call to
<link linkend="gtk-curve-set-curve-type">gtk_curve_set_curve_type</link>(). It is also changed as a side-effect of
calling <link linkend="gtk-curve-reset">gtk_curve_reset</link>() or <link linkend="gtk-curve-set-gamma">gtk_curve_set_gamma</link>().
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>curve</parameter>&nbsp;:</entry>
<entry>the object which received the signal.

</entry></row>
<row><entry align="right"><parameter>user_data</parameter>&nbsp;:</entry>
<entry>user data set when the signal handler was connected.</entry></row>
</tbody></tgroup></informaltable></refsect2>
</refsect1>


<refsect1>
<title>See Also</title>
<para>
<variablelist>
<varlistentry>
<term><link linkend="GtkGammaCurve">GtkGammaCurve</link></term>
<listitem><para>a subclass for editing gamma curves.</para>
</listitem>
</varlistentry>
</variablelist>

</para>
</refsect1>

</refentry>
