Gimp.Path¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gimp.Path(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Functions for querying and manipulating path.
- classmethod free(path)¶
- Parameters:
path ([
str
]) – A list of directories as returned byGimp.Path.parse
().
This function frees the memory allocated for the list and the strings it contains.
- classmethod get_by_id(path_id)¶
- Parameters:
path_id (
int
) – The path id.- Returns:
a
Gimp.Path
for path_id orNone
if path_id does not represent a valid path. The object belongs to libgimp and you must not modify or unref it.- Return type:
Returns a
Gimp.Path
representing path_id. This function callsGimp.Item.get_by_id
() and returns the item if it is a path orNone
otherwise.New in version 3.0.
- classmethod get_user_writable_dir(path)¶
- Parameters:
path ([
str
]) – A list of directories as returned byGimp.Path.parse
().- Returns:
The first directory in path where the user has write permission.
- Return type:
Note that you have to
GLib.free
() the returned string.
- classmethod new(image, name)¶
- Parameters:
image (
Gimp.Image
) – The image.name (
str
) – the name of the new path object.
- Returns:
the current path object, 0 if no path exists in the image.
- Return type:
Creates a new empty path object.
Creates a new empty path object. The path object needs to be added to the image using
Gimp.Image.insert_path
().New in version 2.4.
- classmethod new_from_text_layer(image, layer)¶
- Parameters:
image (
Gimp.Image
) – The image.layer (
Gimp.Layer
) – The text layer.
- Returns:
The path of the text layer.
- Return type:
Creates a new path object from a text layer.
Creates a new path object from a text layer. The path object needs to be added to the image using
Gimp.Image.insert_path
().New in version 2.6.
- classmethod parse(path, max_paths, check)¶
- Parameters:
path (
str
) – A list of directories separated byGLib.SEARCHPATH_SEPARATOR
.max_paths (
int
) – The maximum number of directories to return.check (
bool
) –True
if you want the directories to be checked.
- Returns:
A
GLib.List
of all directories in path.- check_failed:
Returns a
GLib.List
of path elements for which the check failed.
- Return type:
- classmethod to_str(path)¶
- Parameters:
path ([
str
]) – A list of directories as returned byGimp.Path.parse
().- Returns:
A searchpath string separated by
GLib.SEARCHPATH_SEPARATOR
.- Return type:
- bezier_stroke_conicto(stroke_id, x0, y0, x1, y1)¶
- Parameters:
- Returns:
True
on success.- Return type:
Extends a bezier stroke with a conic bezier spline.
Extends a bezier stroke with a conic bezier spline. Actually a cubic bezier spline gets added that realizes the shape of a conic bezier spline.
New in version 2.4.
- bezier_stroke_cubicto(stroke_id, x0, y0, x1, y1, x2, y2)¶
- Parameters:
stroke_id (
int
) – The stroke ID.x0 (
float
) – The x-coordinate of the first control point.y0 (
float
) – The y-coordinate of the first control point.x1 (
float
) – The x-coordinate of the second control point.y1 (
float
) – The y-coordinate of the second control point.x2 (
float
) – The x-coordinate of the end point.y2 (
float
) – The y-coordinate of the end point.
- Returns:
True
on success.- Return type:
Extends a bezier stroke with a cubic bezier spline.
Extends a bezier stroke with a cubic bezier spline.
New in version 2.4.
- bezier_stroke_lineto(stroke_id, x0, y0)¶
- Parameters:
- Returns:
True
on success.- Return type:
Extends a bezier stroke with a lineto.
Extends a bezier stroke with a lineto.
New in version 2.4.
- bezier_stroke_new_ellipse(x0, y0, radius_x, radius_y, angle)¶
- Parameters:
- Returns:
The resulting stroke.
- Return type:
Adds a bezier stroke describing an ellipse the path object.
Adds a bezier stroke describing an ellipse on the path object.
New in version 2.4.
- bezier_stroke_new_moveto(x0, y0)¶
- Parameters:
- Returns:
The resulting stroke.
- Return type:
Adds a bezier stroke with a single moveto to the path object.
Adds a bezier stroke with a single moveto to the path object.
New in version 2.4.
- copy()¶
- Returns:
The newly copied path object.
- Return type:
Copy a path object.
This procedure copies the specified path object and returns the copy.
New in version 2.6.
- get_strokes()¶
- Returns:
List of the strokes belonging to the path. The returned value must be freed with
GLib.free
().- Return type:
[
int
]
List the strokes associated with the passed path.
Returns an Array with the stroke-IDs associated with the passed path.
New in version 2.4.
- remove_stroke(stroke_id)¶
-
remove the stroke from a path object.
Remove the stroke from a path object.
New in version 2.4.
- stroke_close(stroke_id)¶
-
closes the specified stroke.
Closes the specified stroke.
New in version 2.4.
- stroke_flip(stroke_id, flip_type, axis)¶
- Parameters:
stroke_id (
int
) – The stroke ID.flip_type (
Gimp.OrientationType
) – Flip orientation, either vertical or horizontal.axis (
float
) – axis coordinate about which to flip, in pixels.
- Returns:
True
on success.- Return type:
flips the given stroke.
Rotates the given stroke around given center by angle (in degrees).
New in version 2.4.
- stroke_flip_free(stroke_id, x1, y1, x2, y2)¶
- Parameters:
stroke_id (
int
) – The stroke ID.x1 (
float
) – X coordinate of the first point of the flipping axis.y1 (
float
) – Y coordinate of the first point of the flipping axis.x2 (
float
) – X coordinate of the second point of the flipping axis.y2 (
float
) – Y coordinate of the second point of the flipping axis.
- Returns:
True
on success.- Return type:
flips the given stroke about an arbitrary axis.
Flips the given stroke about an arbitrary axis. Axis is defined by two coordinates in the image (in pixels), through which the flipping axis passes.
New in version 2.4.
- stroke_get_length(stroke_id, precision)¶
- Parameters:
- Returns:
The length (in pixels) of the given stroke.
- Return type:
Measure the length of the given stroke.
Measure the length of the given stroke.
New in version 2.4.
- stroke_get_point_at_dist(stroke_id, dist, precision)¶
- Parameters:
- Returns:
True
on success.- x_point:
The x position of the point.
- y_point:
The y position of the point.
- slope:
The slope (dy / dx) at the specified point.
- valid:
Indicator for the validity of the returned data.
- Return type:
(
bool
, x_point:float
, y_point:float
, slope:float
, valid:bool
)
Get point at a specified distance along the stroke.
This will return the x,y position of a point at a given distance along the stroke. The distance will be obtained by first digitizing the curve internally and then walking along the curve. For a closed stroke the start of the path is the first point on the path that was created. This might not be obvious. If the stroke is not long enough, a \”valid\” flag will be
False
.New in version 2.4.
- stroke_get_points(stroke_id)¶
- Parameters:
stroke_id (
int
) – The stroke ID.- Returns:
type of the stroke (always
Gimp.PathStrokeType.BEZIER
for now).- controlpoints:
List of the control points for the stroke (x0, y0, x1, y1, …).
- closed:
Whether the stroke is closed or not.
- Return type:
(
Gimp.PathStrokeType
, controlpoints: [float
], closed:bool
)
returns the control points of a stroke.
returns the control points of a stroke. The interpretation of the coordinates returned depends on the type of the stroke. For Gimp 2.4 this is always a bezier stroke, where the coordinates are the control points.
New in version 2.4.
- stroke_interpolate(stroke_id, precision)¶
- Parameters:
- Returns:
List of the coords along the path (x0, y0, x1, y1, …). The returned value must be freed with
GLib.free
().- closed:
Whether the stroke is closed or not.
- Return type:
returns polygonal approximation of the stroke.
returns polygonal approximation of the stroke.
New in version 2.4.
- stroke_new_from_points(type, controlpoints, closed)¶
- Parameters:
type (
Gimp.PathStrokeType
) – type of the stroke (alwaysGimp.PathStrokeType.BEZIER
for now).controlpoints ([
float
]) – List of the x- and y-coordinates of the control points.closed (
bool
) – Whether the stroke is to be closed or not.
- Returns:
The stroke ID of the newly created stroke.
- Return type:
Adds a stroke of a given type to the path object.
Adds a stroke of a given type to the path object. The coordinates of the control points can be specified. For now only strokes of the type
Gimp.PathStrokeType.BEZIER
are supported. The control points are specified as a pair of double values for the x- and y-coordinate. The Bezier stroke type needs a multiple of three control points. Each Bezier segment endpoint (anchor, A) has two additional control points (C) associated. They are specified in the order CACCACCAC…New in version 2.4.
- stroke_reverse(stroke_id)¶
-
reverses the specified stroke.
Reverses the specified stroke.
New in version 3.0.
- stroke_rotate(stroke_id, center_x, center_y, angle)¶
- Parameters:
- Returns:
True
on success.- Return type:
rotates the given stroke.
Rotates the given stroke around given center by angle (in degrees).
New in version 2.4.