Next: , Previous: GnomeCanvasLine, Up: Top


8 gnome-canvas-path-def

Container and functions for manipulating ArtBpaths

8.1 Overview

Convenient container and functions for manipulating ArtBpaths, which are paths defined by line and curve segments.

8.2 Usage

— Class: <gnome-canvas-path-def>

Derives from <gboxed>.

— Function: gnome-canvas-path-def-new ⇒  (ret <gnome-canvas-path-def>)

This function creates a new empty <gnome-canvas-path-def>.

ret
the new canvas path definition.
— Function: gnome-canvas-path-def-new-sized (length int) ⇒  (ret <gnome-canvas-path-def>)

This function creates a new <gnome-canvas-path-def> with length number of points allocated. It is useful, if you know the exact number of points in path, so you can avoid automatic point array reallocation.

length
number of points to allocate for the path
ret
the new canvas path definition
— Function: gnome-canvas-path-def-finish (self <gnome-canvas-path-def>)

Trims dynamic point array to exact length of path.

path
a GnomeCanvasPathDef
— Function: gnome-canvas-path-def-ensure-space (self <gnome-canvas-path-def>) (space int)

This function ensures that enough space for space points is allocated at the end of the path.

path
a GnomeCanvasPathDef
space
number of points to guarantee are allocated at the end of the path.
— Function: gnome-canvas-path-def-duplicate (self <gnome-canvas-path-def>) ⇒  (ret <gnome-canvas-path-def>)

This function duplicates the passed path. The new path is marked as non-static regardless of the state of original.

path
a GnomeCanvasPathDef to duplicate
ret
a GnomeCanvasPathDef which is a duplicate of path.
— Function: gnome-canvas-path-def-concat (list gslist-of) ⇒  (ret <gnome-canvas-path-def>)

This function concatenates a list of GnomeCanvasPathDefs into one newly created GnomeCanvasPathDef.

list
a GSList of GnomeCanvasPathDefs to concatenate into one new path.
ret
a new GnomeCanvasPathDef
— Function: gnome-canvas-path-def-split (self <gnome-canvas-path-def>) ⇒  (ret gslist-of)

This function splits the passed path into a list of GnomeCanvasPathDefs which represent each segment of the origional path. The path is split when ever an ART_MOVETO or ART_MOVETO_OPEN is encountered. The closedness of resulting paths is set accordingly to closedness of corresponding segment.

path
a GnomeCanvasPathDef
ret
a list of GnomeCanvasPathDef(s).
— Function: gnome-canvas-path-def-open-parts (self <gnome-canvas-path-def>) ⇒  (ret <gnome-canvas-path-def>)

This function creates a new GnomeCanvasPathDef that contains all of the open segments on the passed path.

path
a GnomeCanvasPathDef
ret
a new GnomeCanvasPathDef that contains all of the open segemtns in path.
— Function: gnome-canvas-path-def-closed-parts (self <gnome-canvas-path-def>) ⇒  (ret <gnome-canvas-path-def>)

This function returns a new GnomeCanvasPathDef that contains the all of close parts of passed path.

path
a GnomeCanvasPathDef
ret
a new GnomeCanvasPathDef that contains all of the closed parts of passed path.
— Function: gnome-canvas-path-def-close-all (self <gnome-canvas-path-def>) ⇒  (ret <gnome-canvas-path-def>)

This function closes all of the open segments in the passed path and returns a new GnomeCanvasPathDef.

path
a GnomeCanvasPathDef
ret
a GnomeCanvasPathDef that contains the contents of path but has modified the path is fully closed
— Function: gnome-canvas-path-def-reset (self <gnome-canvas-path-def>)

This function clears the contents of the passed path.

path
a GnomeCanvasPathDef
— Function: gnome-canvas-path-def-moveto (self <gnome-canvas-path-def>) (double) (double)

This function adds starts new subpath on path, and sets its starting point to x and y. If current subpath is empty, it simply changes its starting coordinates to new values.

path
a GnomeCanvasPathDef
x
x coordinate
y
y coordinate
— Function: gnome-canvas-path-def-lineto (self <gnome-canvas-path-def>) (double) (double)

This function add a line segment to the passed path with the specified x and y coordinates.

path
a GnomeCanvasPathDef
x
x coordinate
y
y coordinate
— Function: gnome-canvas-path-def-lineto-moving (self <gnome-canvas-path-def>) (double) (double)

This functions adds a new line segment with loose endpoint to the path, or if endpoint is already loose, changes its coordinates to x, y. You can change the coordinates of loose endpoint as many times as you want, the last ones set will be fixed, if you continue line. This is useful for handling drawing with mouse.

path
a GnomeCanvasPathDef
x
x coordinate
y
y coordinate
— Function: gnome-canvas-path-def-curveto (self <gnome-canvas-path-def>) (x0 double) (y0 double) (x1 double) (y1 double) (x2 double) (y2 double)

This function adds a bezier curve segment to the path definition.

path
a GnomeCanvasPathDef
x0
first control point x coordinate
y0
first control point y coordinate
x1
second control point x coordinate
y1
second control point y coordinate
x2
end of curve x coordinate
y2
end of curve y coordinate
— Function: gnome-canvas-path-def-closepath (self <gnome-canvas-path-def>)

This function closes the last subpath of path, adding a ART_LINETO to subpath starting point, if needed and changing starting pathcode to ART_MOVETO

path
a GnomeCanvasPathDef
— Function: gnome-canvas-path-def-length (self <gnome-canvas-path-def>) ⇒  (ret int)

This function returns the length of the path definition. Not Euclidian length of the path but rather the number of points on the path.

path
a GnomeCanvasPathDef
ret
integer, number of points on the path.
— Function: gnome-canvas-path-def-is-empty (self <gnome-canvas-path-def>) ⇒  (ret bool)

This function is a boolean test to see if the path is empty, meaning containing no line segments.

path
a GnomeCanvasPathDef
ret
boolean, indicating if the path is empty.
— Function: gnome-canvas-path-def-any-open (self <gnome-canvas-path-def>) ⇒  (ret bool)

This function returns a boolean value indicating if the path has any open segments.

path
a GnomeCanvasPathDef
ret
boolean, indicating if the path has any open segments.
— Function: gnome-canvas-path-def-all-open (self <gnome-canvas-path-def>) ⇒  (ret bool)

This function returns a boolean value indicating if the path only contains open segments.

path
a GnomeCanvasPathDef
ret
boolean, indicating if the path has all open segments.
— Function: gnome-canvas-path-def-any-closed (self <gnome-canvas-path-def>) ⇒  (ret bool)

This function returns a boolean valid indicating if the path has any closed segements.

path
a GnomeCanvasPathDef
ret
boolean, indicating if the path has any closed segments.
— Function: gnome-canvas-path-def-all-closed (self <gnome-canvas-path-def>) ⇒  (ret bool)

This function returns a boolean value indicating if the path only contains closed segments.

path
a GnomeCanvasPathDef
ret
boolean, indicating if the path has all closed segments.