mirror of https://github.com/GNOME/gimp.git
added gimp_vectors_new_from_text_layer().
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. svn path=/trunk/; revision=25367
This commit is contained in:
parent
ca205c10a3
commit
5fce4a4da6
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
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.
|
||||
|
||||
2008-04-04 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimpselection.c (gimp_selection_float): clear the
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "internal-procs.h"
|
||||
|
||||
|
||||
/* 582 procedures registered total */
|
||||
/* 583 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (GimpPDB *pdb)
|
||||
|
|
|
@ -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"
|
||||
|
@ -98,6 +101,49 @@ vectors_new_invoker (GimpProcedure *procedure,
|
|||
return return_vals;
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -1377,7 +1423,7 @@ register_vectors_procs (GimpPDB *pdb)
|
|||
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",
|
||||
|
@ -1404,6 +1450,41 @@ register_vectors_procs (GimpPDB *pdb)
|
|||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
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
|
||||
*/
|
||||
|
|
|
@ -665,6 +665,7 @@ EXPORTS
|
|||
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
|
||||
|
|
|
@ -67,8 +67,8 @@ gimp_vectors_is_valid (gint32 vectors_ID)
|
|||
*
|
||||
* 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.
|
||||
*
|
||||
|
@ -96,6 +96,42 @@ gimp_vectors_new (gint32 image_ID,
|
|||
return vectors_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
|
|
@ -32,6 +32,8 @@ G_BEGIN_DECLS
|
|||
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,
|
||||
|
|
|
@ -49,8 +49,8 @@ sub vectors_new {
|
|||
$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 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
# 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 @@ CODE
|
|||
"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 @@ CODE
|
|||
|
||||
@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
|
||||
|
|
Loading…
Reference in New Issue