gimp r25367 - in trunk: . app/pdb libgimp tools/pdbgen/pdb
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25367 - in trunk: . app/pdb libgimp tools/pdbgen/pdb
- Date: Fri, 4 Apr 2008 15:50:42 +0100 (BST)
Author: neo
Date: Fri Apr 4 15:50:42 2008
New Revision: 25367
URL: http://svn.gnome.org/viewvc/gimp?rev=25367&view=rev
Log:
2008-04-04 Sven Neumann <sven gimp org>
* tools/pdbgen/pdb/vectors.pdb: added
gimp_vectors_new_from_text_layer().
* app/pdb/internal-procs.c
* app/pdb/vectors-cmds.c
* libgimp/gimpvectors_pdb.[ch]: regenerated.
* libgimp/gimp.def: updated.
Modified:
trunk/ChangeLog
trunk/app/pdb/internal-procs.c
trunk/app/pdb/vectors-cmds.c
trunk/libgimp/gimp.def
trunk/libgimp/gimpvectors_pdb.c
trunk/libgimp/gimpvectors_pdb.h
trunk/tools/pdbgen/pdb/vectors.pdb
Modified: trunk/app/pdb/internal-procs.c
==============================================================================
--- trunk/app/pdb/internal-procs.c (original)
+++ trunk/app/pdb/internal-procs.c Fri Apr 4 15:50:42 2008
@@ -29,7 +29,7 @@
#include "internal-procs.h"
-/* 582 procedures registered total */
+/* 583 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
Modified: trunk/app/pdb/vectors-cmds.c
==============================================================================
--- trunk/app/pdb/vectors-cmds.c (original)
+++ trunk/app/pdb/vectors-cmds.c Fri Apr 4 15:50:42 2008
@@ -28,8 +28,11 @@
#include "core/gimpchannel-select.h"
#include "core/gimpimage.h"
+#include "core/gimplayer.h"
#include "core/gimplist.h"
#include "core/gimpparamspecs.h"
+#include "text/gimptext-vectors.h"
+#include "text/gimptextlayer.h"
#include "vectors/gimpanchor.h"
#include "vectors/gimpbezierstroke.h"
#include "vectors/gimpstroke-new.h"
@@ -99,6 +102,49 @@
}
static GValueArray *
+vectors_new_from_text_layer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GValueArray *return_vals;
+ GimpImage *image;
+ GimpLayer *layer;
+ GimpVectors *vectors = NULL;
+
+ image = gimp_value_get_image (&args->values[0], gimp);
+ layer = gimp_value_get_layer (&args->values[1], gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, error))
+ {
+ gint x, y;
+
+ vectors = gimp_text_vectors_new (image,
+ gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)));
+
+ gimp_item_offsets (GIMP_ITEM (layer), &x, &y);
+ gimp_item_translate (GIMP_ITEM (vectors), x, y, FALSE);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success);
+
+ if (success)
+ gimp_value_set_vectors (&return_vals->values[1], vectors);
+
+ return return_vals;
+}
+
+static GValueArray *
vectors_get_image_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -1377,7 +1423,7 @@
gimp_procedure_set_static_strings (procedure,
"gimp-vectors-new",
"Creates a new empty vectors object.",
- "Creates a new empty vectors object. Needs to be added to an image using 'gimp-image-add-vectors'.",
+ "Creates a new empty vectors object. The vectors object needs to be added to the image using 'gimp-image-add-vectors'.",
"Simon Budig",
"Simon Budig",
"2005",
@@ -1405,6 +1451,41 @@
g_object_unref (procedure);
/*
+ * gimp-vectors-new-from-text-layer
+ */
+ procedure = gimp_procedure_new (vectors_new_from_text_layer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-new-from-text-layer");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-new-from-text-layer",
+ "Creates a new vectors object from a text layer.",
+ "Creates a new vectors object from a text layer. The vectors object needs to be added to the image using 'gimp-image-add-vectors'.",
+ "Marcus Heese <heese cip ifi lmu de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors of the text layer.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-vectors-get-image
*/
procedure = gimp_procedure_new (vectors_get_image_invoker);
Modified: trunk/libgimp/gimp.def
==============================================================================
--- trunk/libgimp/gimp.def (original)
+++ trunk/libgimp/gimp.def Fri Apr 4 15:50:42 2008
@@ -665,6 +665,7 @@
gimp_vectors_import_from_string
gimp_vectors_is_valid
gimp_vectors_new
+ gimp_vectors_new_from_text_layer
gimp_vectors_parasite_attach
gimp_vectors_parasite_detach
gimp_vectors_parasite_find
Modified: trunk/libgimp/gimpvectors_pdb.c
==============================================================================
--- trunk/libgimp/gimpvectors_pdb.c (original)
+++ trunk/libgimp/gimpvectors_pdb.c Fri Apr 4 15:50:42 2008
@@ -67,8 +67,8 @@
*
* Creates a new empty vectors object.
*
- * Creates a new empty vectors object. Needs to be added to an image
- * using gimp_image_add_vectors().
+ * Creates a new empty vectors object. The vectors object needs to be
+ * added to the image using gimp_image_add_vectors().
*
* Returns: the current vector object, 0 if no vector exists in the image.
*
@@ -97,6 +97,42 @@
}
/**
+ * gimp_vectors_new_from_text_layer:
+ * @image_ID: The image.
+ * @layer_ID: The text layer.
+ *
+ * Creates a new vectors object from a text layer.
+ *
+ * Creates a new vectors object from a text layer. The vectors object
+ * needs to be added to the image using gimp_image_add_vectors().
+ *
+ * Returns: The vectors of the text layer.
+ *
+ * Since: GIMP 2.6
+ */
+gint32
+gimp_vectors_new_from_text_layer (gint32 image_ID,
+ gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 vectors_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-new-from-text-layer",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ vectors_ID = return_vals[1].data.d_vectors;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return vectors_ID;
+}
+
+/**
* gimp_vectors_get_image:
* @vectors_ID: The vectors object.
*
Modified: trunk/libgimp/gimpvectors_pdb.h
==============================================================================
--- trunk/libgimp/gimpvectors_pdb.h (original)
+++ trunk/libgimp/gimpvectors_pdb.h Fri Apr 4 15:50:42 2008
@@ -32,6 +32,8 @@
gboolean gimp_vectors_is_valid (gint32 vectors_ID);
gint32 gimp_vectors_new (gint32 image_ID,
const gchar *name);
+gint32 gimp_vectors_new_from_text_layer (gint32 image_ID,
+ gint32 layer_ID);
gint32 gimp_vectors_get_image (gint32 vectors_ID);
gchar* gimp_vectors_get_name (gint32 vectors_ID);
gboolean gimp_vectors_set_name (gint32 vectors_ID,
Modified: trunk/tools/pdbgen/pdb/vectors.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/vectors.pdb (original)
+++ trunk/tools/pdbgen/pdb/vectors.pdb Fri Apr 4 15:50:42 2008
@@ -49,8 +49,8 @@
$blurb = 'Creates a new empty vectors object.';
$help = <<'HELP';
-Creates a new empty vectors object. Needs to be added to an image
-using gimp_image_add_vectors().
+Creates a new empty vectors object. The vectors object needs to be added to
+the image using gimp_image_add_vectors().
HELP
&simon_pdb_misc('2005', '2.4');
@@ -77,6 +77,51 @@
);
}
+# Get Vectors from text layer
+sub vectors_new_from_text_layer {
+ $blurb = 'Creates a new vectors object from a text layer.';
+
+ $help = <<'HELP';
+Creates a new vectors object from a text layer. The vectors object needs to
+be added to the image using gimp_image_add_vectors().
+HELP
+
+ &marcus_pdb_misc('2008', '2.6');
+
+ @inargs = (
+ { name => 'image', type => 'image',
+ desc => 'The image.' },
+ { name => 'layer', type => 'layer',
+ desc => 'The text layer.' }
+ );
+
+ @outargs = (
+ { name => 'vectors', type => 'vectors',
+ desc => 'The vectors of the text layer.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ if (gimp_pdb_layer_is_text_layer (layer, error))
+ {
+ gint x, y;
+
+ vectors = gimp_text_vectors_new (image,
+ gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)));
+
+ gimp_item_offsets (GIMP_ITEM (layer), &x, &y);
+ gimp_item_translate (GIMP_ITEM (vectors), x, y, FALSE);
+ }
+ else
+ {
+ success = FALSE;
+ }
+}
+CODE
+ );
+}
+
sub vectors_get_image {
$blurb = 'Returns the vectors objects image.';
$help = 'Returns the vectors objects image.';
@@ -1347,6 +1392,8 @@
"core/gimplist.h"
"core/gimpimage.h"
"core/gimpchannel-select.h"
+ "text/gimptext-vectors.h"
+ "text/gimptextlayer.h"
"vectors/gimpanchor.h"
"vectors/gimpstroke-new.h"
"vectors/gimpbezierstroke.h"
@@ -1356,6 +1403,7 @@
@procs = qw(vectors_is_valid
vectors_new
+ vectors_new_from_text_layer
vectors_get_image
vectors_get_name vectors_set_name
vectors_get_visible vectors_set_visible
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]