/**
 * gnome_canvas_path_def_new_from_foreign_bpath:
 * @bpath: libart bezier path
 *
 * This function constructs a new #gnome_canvas_path_def and
 * duplicates the contents of the passed @bpath in the definition.
 *
 * Returns: the newly created #gnome_canvas_path_def or NULL if the
 * path is invalid.
 */
GnomeCanvasPathDef *
gnome_canvas_path_def_new_from_foreign_bpath (ArtBpath * bpath)
{
	GnomeCanvasPathDef * path;
	gint length;

	g_return_val_if_fail (sp_bpath_good (bpath), NULL);

	length = sp_bpath_length (bpath);

	path = gnome_canvas_path_def_new_sized (length);
	memcpy (path->bpath, bpath, sizeof (ArtBpath) * length);
	path->end = length - 1;
	path->allclosed = sp_bpath_all_closed (bpath);
	path->allopen = sp_bpath_all_open (bpath);

	return path;
}
예제 #2
0
GPPath *
gp_path_new_from_foreign_bpath (const ArtBpath * bpath)
{
	GPPath * path;
	gint length;

	g_return_val_if_fail (sp_bpath_good (bpath), NULL);

	length = sp_bpath_length (bpath);

	path = gp_path_new_sized (length);
	memcpy (path->bpath, bpath, sizeof (ArtBpath) * length);
	path->end = length - 1;
	path->allclosed = sp_bpath_all_closed (bpath);
	path->allopen = sp_bpath_all_open (bpath);

	return path;
}
/**
 * gnome_canvas_path_def_new_from_static_bpath:
 * @bpath: libart bezier path
 *
 * This function constructs a new #gnome_canvas_path_def and
 * references the passed @bpath as its contents.  The
 * #gnome_canvas_path_def returned from this function is to be
 * considered static and non-editable (meaning you cannot change the
 * path from what you passed in @bpath). The bpath will not be freed,
 * if path will be destroyed, so use it with caution.
 *
 * Returns: the new canvas path definition that references the passed
 * @bpath, or if the path is bad NULL is returned.
 */
GnomeCanvasPathDef *
gnome_canvas_path_def_new_from_static_bpath (ArtBpath * bpath)
{
	GnomeCanvasPathDef * path;

	g_return_val_if_fail (sp_bpath_good (bpath), NULL);

	path = g_new (GnomeCanvasPathDef, 1);

	path->refcount = 1;
	path->bpath = bpath;
	path->length = sp_bpath_length (bpath);
	path->end = path->length - 1;
	path->sbpath = TRUE;
	path->hascpt = FALSE;
	path->posset = FALSE;
	path->moving = FALSE;
	path->allclosed = sp_bpath_all_closed (bpath);
	path->allopen = sp_bpath_all_open (bpath);

	return path;
}
예제 #4
0
GPPath *
gp_path_new_from_bpath (ArtBpath * bpath)
{
	GPPath * path;

	g_return_val_if_fail (sp_bpath_good (bpath), NULL);

	path = g_new (GPPath, 1);

	path->refcount = 1;
	path->bpath = bpath;
	path->length = sp_bpath_length (bpath);
	path->end = path->length - 1;
	path->sbpath = FALSE;
	path->hascpt = FALSE;
	path->posset = FALSE;
	path->moving = FALSE;
	path->allclosed = sp_bpath_all_closed (bpath);
	path->allopen = sp_bpath_all_open (bpath);

	return path;
}