Gimp.Gradient¶
- Subclasses:
None
Methods¶
- Inherited:
Gimp.Resource (20), GObject.Object (37), Gimp.ConfigInterface (14)
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gimp.Gradient(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Installable object used by the gradient rendering tool.
- classmethod get_by_name(name)¶
- Parameters:
name (
str
) – The name of the gradient.- Returns:
The gradient.
- Return type:
Returns the gradient with the given name.
Returns an existing gradient having the given name. Returns
None
when no gradient exists of that name.New in version 3.0.
- classmethod new(name)¶
- Parameters:
name (
str
) – The requested name of the new gradient.- Returns:
The gradient.
- Return type:
Creates a new gradient
Creates a new gradient having no segments.
New in version 2.2.
- get_custom_samples(positions, reverse)¶
- Parameters:
- Returns:
Color samples. The returned value must be freed with
Gimp.color_array_free
().- Return type:
Sample the gradient in custom positions.
Samples the color of the gradient at positions from a list. The left endpoint of the gradient corresponds to position 0.0, and the right endpoint corresponds to 1.0. Returns a list of colors, one for each sample.
New in version 2.2.
- get_number_of_segments()¶
- Returns:
Number of segments.
- Return type:
Gets the number of segments of the gradient
Gets the number of segments of the gradient
New in version 2.6.
- get_uniform_samples(num_samples, reverse)¶
- Parameters:
- Returns:
Color samples. The returned value must be freed with
Gimp.color_array_free
().- Return type:
Sample the gradient in uniform parts.
Samples colors uniformly across the gradient. It returns a list of colors for each sample. The minimum number of samples to take is 2, in which case the returned colors will correspond to the
{ 0.0, 1.0 }
positions in the gradient. For example, if the number of samples is 3, the procedure will return the colors at positions{ 0.0, 0.5, 1.0 }
.New in version 2.2.
- segment_get_blending_function(segment)¶
- Parameters:
segment (
int
) – The index of a segment within the gradient.- Returns:
True
on success.- blend_func:
The blending function of the segment.
- Return type:
(
bool
, blend_func:Gimp.GradientSegmentType
)
Gets the gradient segment’s blending function
Gets the blending function of the segment at the index. Returns an error when the segment index is out of range.
New in version 2.2.
- segment_get_coloring_type(segment)¶
- Parameters:
segment (
int
) – The index of a segment within the gradient.- Returns:
True
on success.- coloring_type:
The coloring type of the segment.
- Return type:
(
bool
, coloring_type:Gimp.GradientSegmentColor
)
Gets the gradient segment’s coloring type
Gets the coloring type of the segment at the index. Returns an error when the segment index is out of range.
New in version 2.2.
- segment_get_left_color(segment)¶
- Parameters:
segment (
int
) – The index of a segment within the gradient.- Returns:
The return color.
- Return type:
Gets the left endpoint color of the segment
Gets the left endpoint color of the indexed segment of the gradient. Returns an error when the segment index is out of range.
New in version 2.2.
- segment_get_left_pos(segment)¶
- Parameters:
segment (
int
) – The index of a segment within the gradient.- Returns:
True
on success.- pos:
The return position.
- Return type:
Gets the left endpoint position of a segment
Gets the position of the left endpoint of the segment of the gradient. Returns an error when the segment index is out of range.
New in version 2.2.
- segment_get_middle_pos(segment)¶
- Parameters:
segment (
int
) – The index of a segment within the gradient.- Returns:
True
on success.- pos:
The return position.
- Return type:
Gets the midpoint position of the segment
Gets the position of the midpoint of the segment of the gradient. Returns an error when the segment index is out of range.
New in version 2.2.
- segment_get_right_color(segment)¶
- Parameters:
segment (
int
) – The index of a segment within the gradient.- Returns:
The return color.
- Return type:
Gets the right endpoint color of the segment
Gets the color of the right endpoint color of the segment of the gradient. Returns an error when the segment index is out of range.
New in version 2.2.
- segment_get_right_pos(segment)¶
- Parameters:
segment (
int
) – The index of a segment within the gradient.- Returns:
True
on success.- pos:
The return position.
- Return type:
Gets the right endpoint position of the segment
Gets the position of the right endpoint of the segment of the gradient. Returns an error when the segment index is out of range.
New in version 2.2.
- segment_range_blend_colors(start_segment, end_segment)¶
- Parameters:
- Returns:
True
on success.- Return type:
Blend the colors of the segment range.
Blends the colors (but not the opacity) of the range of segments. The colors’ transition will then be uniform across the range. Returns an error when a segment index is out of range, or gradient is not editable.
New in version 2.2.
- segment_range_blend_opacity(start_segment, end_segment)¶
- Parameters:
- Returns:
True
on success.- Return type:
Blend the opacity of the segment range.
Blends the opacity (but not the colors) of the range of segments. The opacity’s transition will then be uniform across the range. Returns an error when a segment index is out of range, or gradient is not editable.
New in version 2.2.
- segment_range_delete(start_segment, end_segment)¶
- Parameters:
- Returns:
True
on success.- Return type:
Delete the segment range
Deletes a range of segments. Returns an error when a segment index is out of range, or gradient is not editable. Deleting all the segments is undefined behavior.
New in version 2.2.
- segment_range_flip(start_segment, end_segment)¶
- Parameters:
- Returns:
True
on success.- Return type:
Flip the segment range
Reverses the order of segments in a range, and swaps the left and right colors in each segment. As if the range as a 1D line were rotated in a plane. Returns an error when a segment index is out of range, or gradient is not editable.
New in version 2.2.
- segment_range_move(start_segment, end_segment, delta, control_compress)¶
- Parameters:
start_segment (
int
) – Index of the first segment to operate on.end_segment (
int
) – Index of the last segment to operate on. If negative, the range will extend to the end segment.delta (
float
) – The delta to move the segment range.control_compress (
bool
) – Whether or not to compress the neighboring segments.
- Returns:
The final delta by which the range moved.
- Return type:
Move the position of an entire segment range by a delta.
Moves the position of an entire segment range by a delta. The actual delta (which is returned) will be limited by the control points of the neighboring segments. Returns the actual delta. Returns an error when a segment index is out of range, or gradient is not editable.
New in version 2.2.
- segment_range_redistribute_handles(start_segment, end_segment)¶
- Parameters:
- Returns:
True
on success.- Return type:
Uniformly redistribute the segment range’s handles
Redistributes the handles of the segment range of the gradient, so they’ll be evenly spaced. A handle is where two segments meet. Segments will then have the same width. Returns an error when a segment index is out of range, or gradient is not editable.
New in version 2.2.
- segment_range_replicate(start_segment, end_segment, replicate_times)¶
- Parameters:
- Returns:
True
on success.- Return type:
Replicate the segment range
Replicates a segment range a given number of times. Instead of the original segment range, several smaller scaled copies of it will appear in equal widths. Returns an error when a segment index is out of range, or gradient is not editable.
New in version 2.2.
- segment_range_set_blending_function(start_segment, end_segment, blending_function)¶
- Parameters:
start_segment (
int
) – Index of the first segment to operate on.end_segment (
int
) – Index of the last segment to operate on. If negative, the range will extend to the end segment.blending_function (
Gimp.GradientSegmentType
) – The blending function.
- Returns:
True
on success.- Return type:
Sets the blending function of a range of segments
Sets the blending function of a range of segments. Returns an error when a segment index is out of range, or gradient is not editable.
New in version 2.2.
- segment_range_set_coloring_type(start_segment, end_segment, coloring_type)¶
- Parameters:
start_segment (
int
) – Index of the first segment to operate on.end_segment (
int
) – Index of the last segment to operate on. If negative, the range will extend to the end segment.coloring_type (
Gimp.GradientSegmentColor
) – The coloring type.
- Returns:
True
on success.- Return type:
Sets the coloring type of a range of segments
Sets the coloring type of a range of segments. Returns an error when a segment index is out of range, or gradient is not editable.
New in version 2.2.
- segment_range_split_midpoint(start_segment, end_segment)¶
- Parameters:
- Returns:
True
on success.- Return type:
Splits each segment in the segment range at midpoint
Splits each segment in the segment range at its midpoint. Returns an error when a segment index is out of range, or gradient is not editable.
New in version 2.2.
- segment_range_split_uniform(start_segment, end_segment, split_parts)¶
- Parameters:
- Returns:
True
on success.- Return type:
Splits each segment in the segment range uniformly
Splits each segment in the segment range uniformly into to the number of parts given. Returns an error when a segment index is out of range, or gradient is not editable.
New in version 2.2.
- segment_set_left_color(segment, color)¶
- Parameters:
segment (
int
) – The index of a segment within the gradient.color (
Gegl.Color
) – The color to set.
- Returns:
True
on success.- Return type:
Sets the left endpoint color of a segment
Sets the color of the left endpoint the indexed segment of the gradient. The alpha channel of the [class`Gegl`.Color] is taken into account. Returns an error when gradient is not editable or index is out of range.
New in version 2.2.
- segment_set_left_pos(segment, pos)¶
- Parameters:
- Returns:
True
on success.- final_pos:
The return position.
- Return type:
Sets the left endpoint position of the segment
Sets the position of the left endpoint of the segment of the gradient. The final position will be the given fraction from the midpoint to the left to the midpoint of the current segment. Returns the final position. Returns an error when gradient is not editable or segment index is out of range.
New in version 2.2.
- segment_set_middle_pos(segment, pos)¶
- Parameters:
- Returns:
True
on success.- final_pos:
The return position.
- Return type:
Sets the midpoint position of the segment
Sets the midpoint position of the segment of the gradient. The final position will be the given fraction between the two endpoints of the segment. Returns the final position. Returns an error when gradient is not editable or segment index is out of range.
New in version 2.2.
- segment_set_right_color(segment, color)¶
- Parameters:
segment (
int
) – The index of a segment within the gradient.color (
Gegl.Color
) – The color to set.
- Returns:
True
on success.- Return type:
Sets the right endpoint color of the segment
Sets the right endpoint color of the segment of the gradient. The alpha channel of the [class`Gegl`.Color] is taken into account. Returns an error when gradient is not editable or segment index is out of range.
New in version 2.2.
- segment_set_right_pos(segment, pos)¶
- Parameters:
- Returns:
True
on success.- final_pos:
The return position.
- Return type:
Sets the right endpoint position of the segment
Sets the right endpoint position of the segment of the gradient. The final position will be the given fraction from the midpoint of the current segment to the midpoint of the segment to the right. Returns the final position. Returns an error when gradient is not editable or segment index is out of range.
New in version 2.2.