summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkcurve.xml
blob: 2750d5f4af7a7663c4a93cdabfa4c388ae8b46ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-gtkcurve">
  <refnamediv>
    <refname>gtk.Curve</refname>
    <refpurpose>allows direct editing of a curve.</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.Curve</classname></ooclass>
      <ooclass><classname><link
linkend="class-gtkdrawingarea">gtk.DrawingArea</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-gtkcurve">gtk.Curve</link></methodname>
	<methodparam></methodparam>  </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkcurve--reset">reset</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkcurve--set-gamma">set_gamma</link></methodname>
	<methodparam><parameter
		       role="keyword">gamma</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkcurve--set-range">set_range</link></methodname>
	<methodparam><parameter
		       role="keyword">min_x</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">max_x</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">min_y</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">max_y</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkcurve--get-vector">get_vector</link></methodname>
	<methodparam><parameter
		       role="keyword">size</parameter><initializer>-1</initializer></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkcurve--set-vector">set_vector</link></methodname>
	<methodparam><parameter
		       role="keyword">vector</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkcurve--set-curve-type">set_curve_type</link></methodname>
	<methodparam><parameter
		       role="keyword">type</parameter></methodparam>
      </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkobject">gtk.Object</link>
    +-- <link linkend="class-gtkwidget">gtk.Widget</link>
      +-- <link linkend="class-gtkdrawingarea">gtk.DrawingArea</link>
        +-- <link linkend="class-gtkcurve">gtk.Curve</link>
</synopsis>

  </refsect1>
  
  <refsect1>
		<title>Implemented Interfaces</title>
		<para>
			<link linkend="class-gtkcurve"><classname>gtk.Curve</classname></link>
			implements 
			<link linkend="class-gtkbuildable"><classname>gtk.Buildable</classname></link>
		</para>
	</refsect1>

  <refsect1 id="properties-gtkcurve">
    <title>gtk.Curve Properties</title>

    <para><link linkend="properties-gtkobject">gtk.Object Properties</link></para>
    <para><link linkend="properties-gtkwidget">gtk.Widget Properties</link></para>

    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">

	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="3.5in"/>
	  <tbody>

	    <row valign="top">
	      <entry>"curve-type"</entry>
	      <entry>Read/Write</entry>
	<entry>The curve type. One of linear
(<literal>gtk.CURVE_TYPE_LINEAR</literal>), spline interpolated
(<literal>gtk.CURVE_TYPE_SPLINE</literal>), or free-form
(<literal>gtk.CURVE_TYPE_FREE</literal>).</entry>
	  </row>

	<row valign="top">
	  <entry>"max-x"</entry>
	  <entry>Read/Write</entry>
	  <entry>The maximum possible value for X</entry>
	</row>

	<row valign="top">
	  <entry>"max-y"</entry>
	  <entry>Read/Write</entry>
	  <entry>The maximum possible value for Y</entry>
	</row>

	<row valign="top">
	  <entry>"min-x"</entry>
	  <entry>Read/Write</entry>
	  <entry>The minimum possible value for X</entry>
	</row>

	<row valign="top">
	  <entry>"min-y"</entry>
	  <entry>Read/Write</entry>
	  <entry>The minimum possible value for Y</entry>
	</row>

	</tbody>
      </tgroup>
      </informaltable>
    </blockquote>

  </refsect1>


  <refsect1 id="style-properties-gtkcurve">
    <title>gtk.Curve Style Properties</title>

    <para><link linkend="style-properties-gtkwidget">gtk.Widget Style Properties</link></para>

  </refsect1>

  <refsect1 id="signal-prototypes-gtkcurve">
    <title>gtk.Curve Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkobject">gtk.Object Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkwidget">gtk.Widget Signal Prototypes</link></para>

    <variablelist>
      <varlistentry>
        <term>"<link
linkend="signal-gtkcurve--curve-type-changed">curve-type-changed</link>"</term>
        <listitem>
          <methodsynopsis
	    language="python"><methodname>callback</methodname>
            <methodparam><parameter>curve</parameter>
            </methodparam>
            <methodparam><parameter>widget</parameter>
            </methodparam>
            <methodparam><parameter>user_param1</parameter>
            </methodparam>
            <methodparam><parameter>...</parameter>
            </methodparam>
          </methodsynopsis>
        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <note>
      <para><link linkend="class-gtkcurve"><classname>gtk.Curve</classname></link>
      is deprecated in GTK+ 2.20 and PyGTK 2.22 since it is too specialized.</para>
    </note>

    <para>The <link
linkend="class-gtkcurve"><classname>gtk.Curve</classname></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
<application>Gimp</application>. The <link
linkend="class-gtkcurve"><classname>gtk.Curve</classname></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 id="constructor-gtkcurve">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.Curve</methodname>
	<methodparam></methodparam>  </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a new gtk.Curve object</simpara></listitem>
      </varlistentry>
    </variablelist>

    <para>Creates a new <link
linkend="class-gtkcurve"><classname>gtk.Curve</classname></link>
object</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkcurve--reset">
      <title>gtk.Curve.reset</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>reset</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>

      <para>The <methodname>reset</methodname>() method resets the curve to
a straight line from the minimum x and y values to the maximum x and y
values (i.e. from the bottom-left to the top-right corners). The curve type
is not changed.</para>

    </refsect2>

    <refsect2 id="method-gtkcurve--set-gamma">
      <title>gtk.Curve.set_gamma</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_gamma</methodname>
	  <methodparam><parameter
			 role="keyword">gamma</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">gamma</parameter>&nbsp;:</term>
	  <listitem><simpara>the gamma value</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_gamma</methodname>() method recomputes the
entire curve using the value in <parameter>gamma</parameter>. 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>.</para>

    </refsect2>

    <refsect2 id="method-gtkcurve--set-range">
      <title>gtk.Curve.set_range</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_range</methodname>
	  <methodparam><parameter
			 role="keyword">min_x</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">max_x</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">min_y</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">max_y</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">min_x</parameter>&nbsp;:</term>
	  <listitem><simpara>the new minimum x value</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">max_x</parameter>&nbsp;:</term>
	  <listitem><simpara>the maximum x value.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">min_y</parameter>&nbsp;:</term>
	  <listitem><simpara>the new minimum y value</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">max_y</parameter>&nbsp;:</term>
	  <listitem><simpara>the maximum y value.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_range</methodname>() method sets the
"min-x", "min-y", "max-x" and "max-y" properties from<parameter>
min_x</parameter>, <parameter>min_y</parameter>,<parameter>
max_x</parameter>, and <parameter>max_y</parameter>. The curve is also reset
with a call to <link
linkend="method-gtkcurve--reset"><methodname>reset</methodname>()</link>.</para>

    </refsect2>

    <refsect2 id="method-gtkcurve--get-vector">
      <title>gtk.Curve.get_vector</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_vector</methodname>
	  <methodparam><parameter
			 role="keyword">size</parameter><initializer>-1</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">size</parameter>&nbsp;:</term>
	  <listitem><simpara>the number of points to return or -1 to return
all the points in the curve.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a tuple containing the
points</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_vector</methodname>() method returns a tuple
of points representing the curve. The number of points to return is
specified by <parameter>size</parameter>; if <parameter>size</parameter> is
-1 all the points in the curve are returned.</para>

    </refsect2>

    <refsect2 id="method-gtkcurve--set-vector">
      <title>gtk.Curve.set_vector</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_vector</methodname>
	  <methodparam><parameter
			 role="keyword">vector</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">vector</parameter>&nbsp;:</term>
	  <listitem><simpara>a list or tuple containing the points of the
curve</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_vector</methodname>() method sets the curve
using the points in <parameter>vector</parameter>. The curve type is set to
<literal>gtk.CURVE_TYPE_FREE</literal>.</para>

    </refsect2>

    <refsect2 id="method-gtkcurve--set-curve-type">
      <title>gtk.Curve.set_curve_type</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_curve_type</methodname>
	  <methodparam><parameter
			 role="keyword">type</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">type</parameter>&nbsp;:</term>
	  <listitem><simpara>the new curve type:
<literal>gtk.CURVE_TYPE_LINEAR</literal>,
<literal>gtk.CURVE_TYPE_SPLINE</literal> or
<literal>gtk.CURVE_TYPE_FREE</literal></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_curve_type</methodname>() method sets the
"curve-type" property with the value of <parameter>type</parameter>. The
curve type must be one of <literal>gtk.CURVE_TYPE_LINEAR</literal>,
<literal>gtk.CURVE_TYPE_SPLINE</literal> or
<literal>gtk.CURVE_TYPE_FREE</literal>. 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>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Signals</title>

    <refsect2 id="signal-gtkcurve--curve-type-changed">
      <title>The "curve-type-changed" gtk.Curve Signal</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>callback</methodname>
	  <methodparam><parameter>curve</parameter></methodparam>
	  <methodparam><parameter>user_param1</parameter></methodparam>
	  <methodparam><parameter>...</parameter></methodparam>
	</methodsynopsis></programlisting>

      <variablelist>
	<varlistentry>
	  <term><parameter>curve</parameter>&nbsp;:</term>
	  <listitem><simpara>the curve that received the
signal</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>user_param1</parameter>&nbsp;:</term>
          <listitem><simpara>the first user parameter (if any) specified
with the <link
linkend="method-gobject--connect"><methodname>connect</methodname>()</link>
method</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>...</parameter>&nbsp;:</term>
	  <listitem><simpara>additional user parameters (if
any)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The "curve-type-changed" signal is emitted when the curve type
has been changed. The curve type can be changed explicitly with a call to
<link
linkend="method-gtkcurve--set-curve-type"><methodname>set_curve_type</methodname>()</link>. 
It is also changed as a side-effect of calling <link
linkend="method-gtkcurve--reset"><methodname>reset</methodname>()</link> or
<link
linkend="method-gtkcurve--set-gamma"><methodname>set_gamma</methodname>()</link></para>

    </refsect2>

  </refsect1>

</refentry>