mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-22 04:22:29 +00:00
replaced GTK_CFLAGS by GDK_PIXBUF_CFLAGS.
2003-09-11 Sven Neumann <sven@gimp.org> * app/vectors/Makefile.am (INCLUDES): replaced GTK_CFLAGS by GDK_PIXBUF_CFLAGS. * app/vectors/gimpvectors-export.c: added a first draft of GimpVectors SVG export. * app/gui/vectors-commands.c (vectors_export_cmd_callback): call gimp_vectors_export() with a hardcoded filename.
This commit is contained in:
parent
2ae38423af
commit
2e33617669
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2003-09-11 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/vectors/Makefile.am (INCLUDES): replaced GTK_CFLAGS by
|
||||
GDK_PIXBUF_CFLAGS.
|
||||
|
||||
* app/vectors/gimpvectors-export.c: added a first draft of
|
||||
GimpVectors SVG export.
|
||||
|
||||
* app/gui/vectors-commands.c (vectors_export_cmd_callback): call
|
||||
gimp_vectors_export() with a hardcoded filename.
|
||||
|
||||
2003-09-10 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* app/text/gimpfonts.c: include text-types.h instead of core-types.h
|
||||
|
@ -23,7 +34,7 @@
|
|||
|
||||
Removed any GTK+ dependency from the plug-ins/ directory:
|
||||
|
||||
* app/plug-in/Makefile.am (INCLUDES): replaces GTK_CFLAGS by
|
||||
* app/plug-in/Makefile.am (INCLUDES): replaced GTK_CFLAGS by
|
||||
GDK_PIXBUF_CFLAGS.
|
||||
|
||||
* app/plug-in/plug-in-progress.c
|
||||
|
|
|
@ -8,7 +8,7 @@ AM_CPPFLAGS = \
|
|||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/app \
|
||||
$(GTK_CFLAGS) \
|
||||
$(GDK_PIXBUF_CFLAGS) \
|
||||
$(LIBART_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
|
||||
#include "vectors-types.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpitem.h"
|
||||
|
||||
#include "gimpanchor.h"
|
||||
#include "gimpstroke.h"
|
||||
#include "gimpvectors.h"
|
||||
#include "gimpvectors-export.h"
|
||||
|
@ -32,17 +36,26 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
static gchar * gimp_vectors_path_data (const GimpVectors *vectors);
|
||||
|
||||
|
||||
gboolean
|
||||
gimp_vectors_export (const GimpVectors *vectors,
|
||||
const gchar *filename,
|
||||
GError **error)
|
||||
{
|
||||
FILE *file;
|
||||
GimpImage *image;
|
||||
FILE *file;
|
||||
gchar *data;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
|
||||
g_return_val_if_fail (filename != NULL, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
image = gimp_item_get_image (GIMP_ITEM (vectors));
|
||||
|
||||
data = gimp_vectors_path_data (vectors);
|
||||
|
||||
file = fopen (filename, "w");
|
||||
if (!file)
|
||||
{
|
||||
|
@ -52,8 +65,20 @@ gimp_vectors_export (const GimpVectors *vectors,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* FIXME: add export implementation here */
|
||||
g_warning ("gimp_vectors_export: unimplemented");
|
||||
fprintf (file,
|
||||
"<?xml version=\"1.0\" standalone=\"no\"?>\n"
|
||||
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 20010904//EN\"\n"
|
||||
"\"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n");
|
||||
fprintf (file,
|
||||
"<svg viewBox=\"0 0 %d %d\"\n"
|
||||
" xmlns=\"http://www.w3.org/2000/svg\">\n",
|
||||
image->width, image->height);
|
||||
fprintf (file,
|
||||
" <path d=\"%s\"\n"
|
||||
" fill=\"none\" stroke=\"black\", stroke-width=\"1\">\n",
|
||||
data);
|
||||
fprintf (file,
|
||||
"</svg>\n");
|
||||
|
||||
if (fclose (file))
|
||||
{
|
||||
|
@ -63,5 +88,45 @@ gimp_vectors_export (const GimpVectors *vectors,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
g_free (data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gimp_vectors_path_data (const GimpVectors *vectors)
|
||||
{
|
||||
GString *str;
|
||||
GList *strokes;
|
||||
|
||||
str = g_string_new (NULL);
|
||||
|
||||
for (strokes = vectors->strokes; strokes; strokes = strokes->next)
|
||||
{
|
||||
GimpStroke *stroke = strokes->data;
|
||||
GList *anchors;
|
||||
GimpAnchor *anchor;
|
||||
|
||||
anchors = stroke->anchors;
|
||||
if (!anchors)
|
||||
continue;
|
||||
|
||||
anchor = anchors->data;
|
||||
g_string_append_printf (str, "M%d,%d",
|
||||
(gint) anchor->position.x,
|
||||
(gint) anchor->position.y);
|
||||
|
||||
for (anchors = anchors->next; anchors; anchors = anchors->next)
|
||||
{
|
||||
anchor = anchors->data;
|
||||
g_string_append_printf (str, " L%d,%d",
|
||||
(gint) anchor->position.x,
|
||||
(gint) anchor->position.y);
|
||||
}
|
||||
|
||||
if (stroke->closed)
|
||||
g_string_append_printf (str, " Z");
|
||||
}
|
||||
|
||||
return g_string_free (str, FALSE);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue