Gimp.Curve¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/c/en |
The curve type |
||
r/w/c/en |
The number of samples |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
Emitted when any points are added, deleted, or edited in curve. |
|
Emitted when any sample is edited, or if the number of samples changed, in curve. |
Fields¶
- Inherited:
Class Details¶
- class Gimp.Curve(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new()¶
- Returns:
a new curve.
- Return type:
Creates a new
Gimp.Curveobject, of type [enum`Gimp`.CurveType.SMOOTH], with 0 points initially.New in version 3.2.
- add_point(x, y)¶
- Parameters:
- Returns:
a point identifier to be used in other functions.
- Return type:
Add a new point in a [enum`Gimp`.CurveType.SMOOTH] self, with coordinates
(x, y). Any value outside the[0.0, 1.0]range will be silently clamped.The returned identifier can later be used e.g. in [method`Gimp`.Curve.get_point] or other functions taking a point number as argument.
Calling this may change identifiers for other points and the total number of points in this self. Any such information you currently hold should be considered invalid once the curve is changed.
New in version 3.2.
- clear_points()¶
Deletes all points from a [enum`Gimp`.CurveType.SMOOTH] self.
A subsequent call to [method`Gimp`.Curve.get_n_points] will return 0.
New in version 3.2.
- delete_point(point)¶
- Parameters:
point (
int) – a point identifier.
Deletes a specific point from a [enum`Gimp`.CurveType.SMOOTH] self.
The point identifier must be between 0 and the value returned by [method`Gimp`.Curve.get_n_points].
You may also use a point identifier as returned by [method`Gimp`.Curve.add_point], which will correspond to the same point, unless you modified the self since (e.g. by calling
gimp_curve_add_pointagain, or by deleting or modifying a point).New in version 3.2.
- get_curve_type()¶
- Returns:
the self type.
- Return type:
New in version 3.2.
- get_n_points()¶
- Returns:
the number of points in a smooth curve.
- Return type:
Gets the number of points in a [enum`Gimp`.CurveType.SMOOTH] curve. Note that it will always be 0 for a [enum`Gimp`.CurveType.FREE] curve.
This can later be used e.g. in [method`Gimp`.Curve.get_point] as points are numbered from 0 (included) to the returned number (excluded).
Note that the
Gimp.CurveAPI is not thread-safe. So be careful that the information on the number of points is still valid when you use it (you may have added or removed points in particular).New in version 3.2.
- get_n_samples()¶
- Returns:
the number of samples in a freehand curve.
- Return type:
Gets the number of samples in a [enum`Gimp`.CurveType.FREE] curve.
New in version 3.2.
- get_point(point)¶
- Parameters:
point (
int) – a point identifier.- Returns:
- x:
the point abscissa on a
[0.0, 1.0]range.- y:
the point ordinate on a
[0.0, 1.0]range.
- Return type:
Gets the point coordinates for a [enum`Gimp`.CurveType.SMOOTH] self.
The point identifier must be between 0 and the value returned by [method`Gimp`.Curve.get_n_points].
You may also use a point identifier as returned by [method`Gimp`.Curve.add_point], which will correspond to the same point, unless you modified the self since (e.g. by calling
gimp_curve_add_pointagain, or by deleting or modifying a point).New in version 3.2.
- get_point_type(point)¶
- Parameters:
point (
int) – a point identifier.- Returns:
the point type of a [enum`Gimp`.CurveType.SMOOTH] self.
- Return type:
New in version 3.2.
- get_sample(x)¶
-
Gets the ordinate y value corresponding to the passed x abscissa value, in a [enum`Gimp`.CurveType.FREE] self.
Note that while the y coordinate will be stored exactly, the x coordinate will be rounded to the closest curve sample on the abscissa. The more sample was set with [method`Gimp`.Curve.set_n_samples], the more precise the rounding will be.
New in version 3.2.
- is_identity()¶
-
If this function returns
True, then the curve maps each value to itself. If it returnsFalse, then this assumption can not be made.New in version 3.2.
- set_curve_type(curve_type)¶
- Parameters:
curve_type (
Gimp.CurveType) – the new curve type.
Sets the curve type of self, as follows:
Nothing happens if the curve type is unchanged.
If you change to [enum`Gimp`.CurveType.SMOOTH], it will create a non-specified number of points and will approximate their position along the freehand curve. All default points will be [enum`Gimp`.CurvePointType.SMOOTH].
If you change to [enum`Gimp`.CurveType.FREE], all existing points will be cleared.
New in version 3.2.
- set_n_samples(n_samples)¶
- Parameters:
n_samples (
int) – the number of samples.
Sets the number of sample in a [enum`Gimp`.CurveType.FREE] self.
Samples will be positioned on the curve abscissa at regular interval. The more samples, the more your curve will have details. Currently, the value of n_samples is limited and must be between
2^8and2^12.Note that changing the number of samples will reset the curve to an identity curve.
New in version 3.2.
- set_point(point, x, y)¶
- Parameters:
Sets the point coordinates in a [enum`Gimp`.CurveType.SMOOTH] self. Any value outside the
[0.0, 1.0]range will be silently clamped.New in version 3.2.
- set_point_type(point, type)¶
- Parameters:
point (
int) – a point identifier.type (
Gimp.CurvePointType) – a point type.
Sets the point type in a [enum`Gimp`.CurveType.SMOOTH] self.
New in version 3.2.
- set_sample(x, y)¶
- Parameters:
Sets a sample in a [enum`Gimp`.CurveType.FREE] self, with coordinates
(x, y).Note that while the y coordinate will be stored exactly, the x coordinate will be rounded to the closest curve sample on the abscissa. The more sample was set with [method`Gimp`.Curve.set_n_samples], the more precise the rounding will be.
New in version 3.2.
Signal Details¶
- Gimp.Curve.signals.points_changed(curve)¶
- Signal Name:
points-changed- Flags:
- Parameters:
curve (
Gimp.Curve) – The object which received the signal
Emitted when any points are added, deleted, or edited in curve.
New in version 3.2.
- Gimp.Curve.signals.samples_changed(curve)¶
- Signal Name:
samples-changed- Flags:
- Parameters:
curve (
Gimp.Curve) – The object which received the signal
Emitted when any sample is edited, or if the number of samples changed, in curve.
New in version 3.2.
Property Details¶
- Gimp.Curve.props.curve_type¶
- Name:
curve-type- Type:
- Default Value:
- Flags:
The curve type.
New in version 3.2.