Include libart headers app/vectors/gimpvectors.[ch]

2003-09-06  Dave Neary  <bolsh@gimp.org>

	* app/vectors/Makefile.am: Include libart headers
	* app/vectors/gimpvectors.[ch]
	* app/vectors/gimpstroke.[ch]
	* app/vectors/gimpbezierstroke.[ch]: Committing unfinished,
	useless stub code for converting a GimpVectors object to a
	libart vector path. Will pad this out later.
This commit is contained in:
Dave Neary 2003-09-06 16:39:08 +00:00 committed by David Neary
parent 27ad396d10
commit 0508bdcc4b
7 changed files with 82 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2003-09-06 Dave Neary <bolsh@gimp.org>
* app/vectors/Makefile.am: Include libart headers
* app/vectors/gimpvectors.[ch]
* app/vectors/gimpstroke.[ch]
* app/vectors/gimpbezierstroke.[ch]: Committing unfinished,
useless stub code for converting a GimpVectors object to a
libart vector path. Will pad this out later.
2003-09-06 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable.c (gimp_drawable_fill): made my last

View File

@ -9,6 +9,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/app \
$(GTK_CFLAGS) \
$(LIBART_CFLAGS) \
-I$(includedir)
noinst_LIBRARIES = libappvectors.a

View File

@ -115,6 +115,7 @@ static void gimp_bezier_coords_subdivide2 (const GimpCoords *beziercoords,
static gboolean gimp_bezier_coords_is_straight (const GimpCoords *beziercoords,
const gdouble precision);
static void gimp_bezier_stroke_to_art_point (ArtVpath *vec);
/* private variables */
@ -178,6 +179,7 @@ gimp_bezier_stroke_class_init (GimpBezierStrokeClass *klass)
stroke_class->extend = gimp_bezier_stroke_extend;
stroke_class->connect_stroke = gimp_bezier_stroke_connect_stroke;
stroke_class->interpolate = gimp_bezier_stroke_interpolate;
stroke_class->to_art_point = gimp_bezier_stroke_to_art_point;
}
static void
@ -1606,3 +1608,11 @@ gimp_bezier_coords_subdivide2 (const GimpCoords *beziercoords,
ret_coords, depth-1);
}
}
static void
gimp_bezier_stroke_to_art_point (ArtVpath *vec)
{
g_printerr ("gimp_bezier_stroke_to_art_point: default implementation\n");
return;
}

View File

@ -21,6 +21,9 @@
#include "config.h"
/* For ArtVpath */
#include <libart_lgpl/libart.h>
#include "glib-object.h"
#include "vectors-types.h"
@ -146,6 +149,7 @@ static GList * gimp_stroke_real_get_draw_anchors (const GimpStroke *stroke);
static GList * gimp_stroke_real_get_draw_controls (const GimpStroke *stroke);
static GArray * gimp_stroke_real_get_draw_lines (const GimpStroke *stroke);
static void gimp_stroke_to_art_point (ArtVpath *vec);
/* private variables */
@ -237,6 +241,8 @@ gimp_stroke_class_init (GimpStrokeClass *klass)
klass->get_draw_anchors = gimp_stroke_real_get_draw_anchors;
klass->get_draw_controls = gimp_stroke_real_get_draw_controls;
klass->get_draw_lines = gimp_stroke_real_get_draw_lines;
klass->to_art_point = gimp_stroke_to_art_point;
}
static void
@ -1205,3 +1211,11 @@ gimp_stroke_real_get_draw_lines (const GimpStroke *stroke)
return ret_lines;
}
static void
gimp_stroke_to_art_point (ArtVpath *vec)
{
g_printerr ("gimp_stroke_to_art_point: default implementation\n");
return;
}

View File

@ -22,6 +22,8 @@
#ifndef __GIMP_STROKE_H__
#define __GIMP_STROKE_H__
/* For ArtVpath */
#include <libart_lgpl/libart.h>
#include "core/gimpobject.h"
@ -163,6 +165,8 @@ struct _GimpStrokeClass
GList * (* get_draw_anchors) (const GimpStroke *stroke);
GList * (* get_draw_controls) (const GimpStroke *stroke);
GArray * (* get_draw_lines) (const GimpStroke *stroke);
void (* to_art_point) (ArtVpath *vec);
};
@ -303,3 +307,4 @@ GArray * gimp_stroke_get_draw_lines (const GimpStroke *stroke);
#endif /* __GIMP_STROKE_H__ */

View File

@ -946,3 +946,43 @@ gimp_vectors_real_make_bezier (const GimpVectors *vectors)
return NULL;
}
/*
* gimp_vectors_to_art_vpath: Create an ArtVpath from a GimpVectors object.
* @vectors: The source path
*
* Traverses the stroke list of a GimpVector object, adding nodes to an
* ArtVpath as it goes.
* The destination path is allocated inside this function, and must be
* freed after use.
*
* Return value: Newly allocated ArtVpath.
*/
ArtVpath *
gimp_vectors_to_art_vpath(const GimpVectors *vectors)
{
ArtVpath * vec; /* Libart path we're creating */
GimpStroke *cur_stroke;
guint num_points = g_list_length (vectors->strokes);
vec = art_new (ArtVpath, num_points);
gimp_vectors_freeze (vectors);
/* Get the list of Strokes in the vector, and create the equivalent
* ArtVpath node */
for (cur_stroke = gimp_vectors_stroke_get_next (vectors, NULL);
cur_stroke;
cur_stroke = gimp_vectors_stroke_get_next (vectors, cur_stroke))
{
/* Add this stroke to the art_vpath */
GIMP_STROKE_GET_CLASS(cur_stroke)->to_art_point (vec);
}
gimp_vectors_thaw (vectors);
/* That's it - nothing else to see here */
return vec;
}

View File

@ -22,6 +22,7 @@
#ifndef __GIMP_VECTORS_H__
#define __GIMP_VECTORS_H__
#include <libart_lgpl/libart.h>
#include "core/gimpitem.h"
@ -162,5 +163,7 @@ gint gimp_vectors_interpolate (const GimpVectors *vectors,
GimpVectors * gimp_vectors_make_bezier (const GimpVectors *vectors);
/* Convert to libart vector path */
ArtVpath * gimp_vectors_to_art_vpath(const GimpVectors * vectors);
#endif /* __GIMP_VECTORS_H__ */