libgnomecanvasmm
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gnome::Canvas::PathDef Class Reference

#include <path-def.h>

Public Member Functions

void reference () const
 
void unreference () const
 
GnomeCanvasPathDef * gobj ()
 Provides access to the underlying C instance. More...
 
const GnomeCanvasPathDef * gobj () const
 Provides access to the underlying C instance. More...
 
GnomeCanvasPathDef * gobj_copy () const
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
Glib::RefPtr< PathDefopen_parts ()
 This function creates a new GnomeCanvasPathDef that contains all of the open segments on the passed path. More...
 
Glib::RefPtr< PathDefclosed_parts ()
 This function returns a new GnomeCanvasPathDef that contains the all of close parts of passed path. More...
 
Glib::RefPtr< PathDefclose_all ()
 This function closes all of the open segments in the passed path and returns a new GnomeCanvasPathDef. More...
 
void finish ()
 Trims dynamic point array to exact length of path. More...
 
void ensure_space (int space)
 This function ensures that enough space for space points is allocated at the end of the path. More...
 
void reset ()
 This function clears the contents of the passed path. More...
 
void moveto (double x, double y)
 This function adds starts new subpath on path, and sets its starting point to x and y. More...
 
void lineto (double x, double y)
 This function add a line segment to the passed path with the specified x and y coordinates. More...
 
void lineto_moving (double x, double y)
 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. More...
 
void curveto (double x1, double y1, double x2, double y2, double x3, double y3)
 This function adds a bezier curve segment to the path definition. More...
 
void closepath ()
 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. More...
 
void closepath_current ()
 This function closes the last subpath by setting the coordinates of the endpoint of the last segment (line or curve) to starting point. More...
 
Gnome::Art::Point currentpoint () const
 
ArtBpath * get_bpath () const
 This function returns a ArtBpath that consists of the path definition. More...
 
ArtBpath * first_bpath () const
 This function returns the first ArtBpath point in the definition. More...
 
ArtBpath * last_bpath () const
 This function returns pointer to the last ArtBpath segment in the path definition. More...
 
bool is_empty () const
 This function is a boolean test to see if the path is empty, meaning containing no line segments. More...
 
int length () const
 This function returns the length of the path definition. More...
 
bool has_currentpoint () const
 This function is a boolean test checking to see if the path has a current point defined. More...
 
bool any_open () const
 This function returns a boolean value indicating if the path has any open segments. More...
 
bool all_open () const
 This function returns a boolean value indicating if the path only contains open segments. More...
 
bool any_closed () const
 This function returns a boolean valid indicating if the path has any closed segements. More...
 
bool all_closed () const
 This function returns a boolean value indicating if the path only contains closed segments. More...
 

Static Public Member Functions

static Glib::RefPtr< PathDefcreate ()
 
static Glib::RefPtr< PathDefcreate (int length)
 This funtion creates a new #gnome_canvas_path_def with length number of points allocated. More...
 
static Glib::RefPtr< PathDefcreate (ArtBpath &bpath)
 This function constructs a new #gnome_canvas_path_def and uses the passed bpath as the contents. More...
 

Protected Member Functions

 PathDef ()
 
void operator delete (void *, size_t)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr
< Gnome::Canvas::PathDef
wrap (GnomeCanvasPathDef *object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Constructor & Destructor Documentation

Gnome::Canvas::PathDef::PathDef ( )
protected

Member Function Documentation

bool Gnome::Canvas::PathDef::all_closed ( ) const

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

Returns
Boolean, indicating if the path has all closed segments.
bool Gnome::Canvas::PathDef::all_open ( ) const

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

Returns
Boolean, indicating if the path has all open segments.
bool Gnome::Canvas::PathDef::any_closed ( ) const

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

Returns
Boolean, indicating if the path has any closed segments.
bool Gnome::Canvas::PathDef::any_open ( ) const

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

Returns
Boolean, indicating if the path has any open segments.
Glib::RefPtr<PathDef> Gnome::Canvas::PathDef::close_all ( )

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

Returns
A GnomeCanvasPathDef that contains the contents of path but has modified the path is fully closed.
Glib::RefPtr<PathDef> Gnome::Canvas::PathDef::closed_parts ( )

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

Returns
A new GnomeCanvasPathDef that contains all of the closed parts of passed path.
void Gnome::Canvas::PathDef::closepath ( )

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.

void Gnome::Canvas::PathDef::closepath_current ( )

This function closes the last subpath by setting the coordinates of the endpoint of the last segment (line or curve) to starting point.

static Glib::RefPtr<PathDef> Gnome::Canvas::PathDef::create ( )
static
static Glib::RefPtr<PathDef> Gnome::Canvas::PathDef::create ( int  length)
static

This funtion 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.

Parameters
lengthNumber of points to allocate for the path.
Returns
The new canvas path definition.
static Glib::RefPtr<PathDef> Gnome::Canvas::PathDef::create ( ArtBpath &  bpath)
static

This function constructs a new #gnome_canvas_path_def and uses the passed bpath as the contents.

The passed bpath should not be static as the path definition is editable when constructed with this function. Also, passed bpath will be freed with art_free, if path is destroyed, so use it with caution. For constructing a #gnome_canvas_path_def from (non-modifiable) bpath use #gnome_canvas_path_def_new_from_static_bpath.

Parameters
bpathLibart bezier path.
Returns
The new canvas path definition that is populated with the passed bezier path, if the bpath is bad 0 is returned.
Gnome::Art::Point Gnome::Canvas::PathDef::currentpoint ( ) const
void Gnome::Canvas::PathDef::curveto ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3 
)

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

Parameters
x0First control point x coordinate.
y0First control point y coordinate.
x1Second control point x coordinate.
y1Second control point y coordinate.
x2End of curve x coordinate.
y2End of curve y coordinate.
void Gnome::Canvas::PathDef::ensure_space ( int  space)

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

Parameters
spaceNumber of points to guarantee are allocated at the end of the path.
void Gnome::Canvas::PathDef::finish ( )

Trims dynamic point array to exact length of path.

ArtBpath* Gnome::Canvas::PathDef::first_bpath ( ) const

This function returns the first ArtBpath point in the definition.

Returns
ArtBpath being the first point in the path definition or null if no points are defined.
ArtBpath* Gnome::Canvas::PathDef::get_bpath ( ) const

This function returns a ArtBpath that consists of the path definition.

Returns
ArtBpath.
GnomeCanvasPathDef* Gnome::Canvas::PathDef::gobj ( )

Provides access to the underlying C instance.

const GnomeCanvasPathDef* Gnome::Canvas::PathDef::gobj ( ) const

Provides access to the underlying C instance.

GnomeCanvasPathDef* Gnome::Canvas::PathDef::gobj_copy ( ) const

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

bool Gnome::Canvas::PathDef::has_currentpoint ( ) const

This function is a boolean test checking to see if the path has a current point defined.

Current point will be set by line operators, and cleared by closing subpath.

Returns
Boolean, indicating if the path has a current point defined.
bool Gnome::Canvas::PathDef::is_empty ( ) const

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

Returns
Boolean, indicating if the path is empty.
ArtBpath* Gnome::Canvas::PathDef::last_bpath ( ) const

This function returns pointer to the last ArtBpath segment in the path definition.

Returns
ArtBpath, being the last segment in the path definition or null if no line segments have been defined.
int Gnome::Canvas::PathDef::length ( ) const

This function returns the length of the path definition.

Not Euclidian length of the path but rather the number of points on the path.

Returns
Integer, number of points on the path.
void Gnome::Canvas::PathDef::lineto ( double  x,
double  y 
)

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

Parameters
xX coordinate.
yY coordinate.
void Gnome::Canvas::PathDef::lineto_moving ( double  x,
double  y 
)

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.

Parameters
xX coordinate.
yY coordinate.
void Gnome::Canvas::PathDef::moveto ( double  x,
double  y 
)

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.

Parameters
xX coordinate.
yY coordinate.
Glib::RefPtr<PathDef> Gnome::Canvas::PathDef::open_parts ( )

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

Returns
A new GnomeCanvasPathDef that contains all of the open segemtns in path.
void Gnome::Canvas::PathDef::operator delete ( void *  ,
size_t   
)
protected
void Gnome::Canvas::PathDef::reference ( ) const
void Gnome::Canvas::PathDef::reset ( )

This function clears the contents of the passed path.

void Gnome::Canvas::PathDef::unreference ( ) const

Friends And Related Function Documentation

Glib::RefPtr< Gnome::Canvas::PathDef > wrap ( GnomeCanvasPathDef *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file: