gimp/app/gimpdrawable.c gimp/app/channel.c gimp/app/layer.c

Tue Feb 15 23:27:42 GMT 2000 Andy Thomas <alt@gimp.org>

	 * gimp/app/gimpdrawable.c
	 * gimp/app/channel.c
	 * gimp/app/layer.c
	 * gimp/app/channel.h
	 * gimp/app/layer.h
	 * gimp/app/gimpimage.c
	 * gimp/app/gimpimage.h
	 * gimp/app/gimpdrawable.h
	 * gimp/tools/pdbgen/pdb/paths.pdb
	 * gimp/tools/pdbgen/pdb/layer.pdb
	 * gimp/tools/pdbgen/pdb/channel.pdb
	 * gimp/tools/pdbgen/pdb/gimage.pdb
	 * gimp/app/channel_cmds.c
	 * gimp/app/gimage_cmds.c
	 * gimp/app/internal_procs.c
	 * gimp/app/layer_cmds.c
	 * gimp/app/paths_cmds.c

	New gimp_*_set_tattoo procedures. This allows save/load plugins
        to save/restore tattoo states of layers, channels and paths. Note the
	internal tattoo state can also be set, however rigorous checks are
	performed to make sure that the internal tattoo states of layer,
	channels and paths are consistent and that the new state value is
	newval > MAX(MAX(layertattoo),MAX(channeltattoo),MAX(pathtattoo)).
This commit is contained in:
GMT 2000 Andy Thomas 2000-02-15 23:49:03 +00:00 committed by Andy Thomas
parent 9ee718ca8f
commit 8f6bca3234
45 changed files with 1364 additions and 48 deletions

View File

@ -1,3 +1,30 @@
Tue Feb 15 23:27:42 GMT 2000 Andy Thomas <alt@gimp.org>
* gimp/app/gimpdrawable.c
* gimp/app/channel.c
* gimp/app/layer.c
* gimp/app/channel.h
* gimp/app/layer.h
* gimp/app/gimpimage.c
* gimp/app/gimpimage.h
* gimp/app/gimpdrawable.h
* gimp/tools/pdbgen/pdb/paths.pdb
* gimp/tools/pdbgen/pdb/layer.pdb
* gimp/tools/pdbgen/pdb/channel.pdb
* gimp/tools/pdbgen/pdb/gimage.pdb
* gimp/app/channel_cmds.c
* gimp/app/gimage_cmds.c
* gimp/app/internal_procs.c
* gimp/app/layer_cmds.c
* gimp/app/paths_cmds.c
New gimp_*_set_tattoo procedures. This allows save/load plugins
to save/restore tattoo states of layers, channels and paths. Note the
internal tattoo state can also be set, however rigorous checks are
performed to make sure that the internal tattoo states of layer,
channels and paths are consistent and that the new state value is
newval > MAX(MAX(layertattoo),MAX(channeltattoo),MAX(pathtattoo)).
Tue Feb 15 13:14:31 CET 2000 Sven Neumann <sven@gimp.org>
* plug-ins/common/unsharp.c:

View File

@ -590,6 +590,12 @@ channel_get_tattoo (const Channel *channel)
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (channel)));
}
void
channel_set_tattoo (const Channel *channel, Tattoo val)
{
gimp_drawable_set_tattoo(GIMP_DRAWABLE (channel),val);
}
/******************************/
/* selection mask functions */
/******************************/

View File

@ -100,6 +100,7 @@ TempBuf * channel_preview (Channel *, gint, gint);
void channel_invalidate_previews (GimpImage*);
Tattoo channel_get_tattoo (const Channel *);
void channel_set_tattoo (const Channel *,Tattoo);
/* selection mask functions */

View File

@ -39,6 +39,7 @@ static ProcRecord channel_set_opacity_proc;
static ProcRecord channel_get_color_proc;
static ProcRecord channel_set_color_proc;
static ProcRecord channel_get_tattoo_proc;
static ProcRecord channel_set_tattoo_proc;
void
register_channel_procs (void)
@ -57,6 +58,7 @@ register_channel_procs (void)
procedural_db_register (&channel_get_color_proc);
procedural_db_register (&channel_set_color_proc);
procedural_db_register (&channel_get_tattoo_proc);
procedural_db_register (&channel_set_tattoo_proc);
}
static Argument *
@ -828,8 +830,8 @@ static ProcArg channel_get_tattoo_outargs[] =
static ProcRecord channel_get_tattoo_proc =
{
"gimp_channel_get_tattoo",
"Returns the tattoo associated with the specified channel.",
"This procedure returns the tattoo associated with the specified channel. A tattoo is a unique and permanent identifier attached to a channel that can be used to uniquely identify a channel within an image even between sessions",
"Get the tattoo of the specified channel.",
"This procedure returns the specified channel's tattoo. A tattoo is a unique and permanent identifier attached to a channel that can be used to uniquely identify a channel within an image even between sessions.",
"Jay Cox",
"Jay Cox",
"1998",
@ -840,3 +842,54 @@ static ProcRecord channel_get_tattoo_proc =
channel_get_tattoo_outargs,
{ { channel_get_tattoo_invoker } }
};
static Argument *
channel_set_tattoo_invoker (Argument *args)
{
gboolean success = TRUE;
Channel *channel;
gint32 tattoo;
channel = channel_get_ID (args[0].value.pdb_int);
if (channel == NULL)
success = FALSE;
tattoo = args[1].value.pdb_int;
if (tattoo == 0)
success = FALSE;
if (success)
channel_set_tattoo (channel, tattoo);
return procedural_db_return_args (&channel_set_tattoo_proc, success);
}
static ProcArg channel_set_tattoo_inargs[] =
{
{
PDB_CHANNEL,
"channel",
"The channel"
},
{
PDB_INT32,
"tattoo",
"The new channel tattoo"
}
};
static ProcRecord channel_set_tattoo_proc =
{
"gimp_channel_set_tattoo",
"Set the tattoo of the specified channel.",
"This procedure sets the specified channel's tattoo. A tattoo is a unique and permanent identifier attached to a channel that can be used to uniquely identify a channel within an image even between sessions.",
"Jay Cox",
"Jay Cox",
"1998",
PDB_INTERNAL,
2,
channel_set_tattoo_inargs,
0,
NULL,
{ { channel_set_tattoo_invoker } }
};

View File

@ -590,6 +590,12 @@ channel_get_tattoo (const Channel *channel)
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (channel)));
}
void
channel_set_tattoo (const Channel *channel, Tattoo val)
{
gimp_drawable_set_tattoo(GIMP_DRAWABLE (channel),val);
}
/******************************/
/* selection mask functions */
/******************************/

View File

@ -100,6 +100,7 @@ TempBuf * channel_preview (Channel *, gint, gint);
void channel_invalidate_previews (GimpImage*);
Tattoo channel_get_tattoo (const Channel *);
void channel_set_tattoo (const Channel *,Tattoo);
/* selection mask functions */

View File

@ -590,6 +590,12 @@ channel_get_tattoo (const Channel *channel)
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (channel)));
}
void
channel_set_tattoo (const Channel *channel, Tattoo val)
{
gimp_drawable_set_tattoo(GIMP_DRAWABLE (channel),val);
}
/******************************/
/* selection mask functions */
/******************************/

View File

@ -100,6 +100,7 @@ TempBuf * channel_preview (Channel *, gint, gint);
void channel_invalidate_previews (GimpImage*);
Tattoo channel_get_tattoo (const Channel *);
void channel_set_tattoo (const Channel *,Tattoo);
/* selection mask functions */

View File

@ -542,6 +542,14 @@ gimp_drawable_get_tattoo (const GimpDrawable *drawable)
return drawable->tattoo;
}
void
gimp_drawable_set_tattoo(GimpDrawable *drawable, Tattoo val)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
drawable->tattoo = val;
}
gboolean
gimp_drawable_is_rgb (GimpDrawable *drawable)
{

View File

@ -77,6 +77,7 @@ Parasite * gimp_drawable_parasite_find (const GimpDrawable *,
gchar ** gimp_drawable_parasite_list (GimpDrawable *drawable,
gint *count);
Tattoo gimp_drawable_get_tattoo (const GimpDrawable *);
void gimp_drawable_set_tattoo (GimpDrawable *, Tattoo);
GimpDrawable * gimp_drawable_get_ID (gint);
void gimp_drawable_deallocate (GimpDrawable *);

View File

@ -1169,6 +1169,96 @@ gimp_image_get_new_tattoo (GimpImage *image)
return (image->tattoo_state);
}
Tattoo
gimp_image_get_tattoo_state(GimpImage *image)
{
return (image->tattoo_state);
}
int
gimp_image_set_tattoo_state(GimpImage *gimage, Tattoo val)
{
Layer *layer;
GSList *layers = gimage->layers;
int retval = TRUE;
Channel *channel;
GSList *channels = gimage->channels;
Tattoo maxval = 0;
PATHP pptr = NULL;
PathsList *plist;
while (layers)
{
Tattoo ltattoo;
layer = (Layer *) layers->data;
ltattoo = layer_get_tattoo (layer);
if(ltattoo > maxval)
maxval = ltattoo;
if(gimp_image_get_channel_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in channel */
}
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
layers = g_slist_next (layers);
}
/* Now check that the paths channel tattoos don't overlap */
while (channels)
{
Tattoo ctattoo;
channel = (Channel *) channels->data;
ctattoo = channel_get_tattoo (channel);
if(ctattoo > maxval)
maxval = ctattoo;
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ctattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
channels = g_slist_next (channels);
}
/* Find the max tatto value in the paths */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
Tattoo ptattoo;
while (pl)
{
pptr = pl->data;
ptattoo = paths_get_tattoo (pptr);
if(ptattoo > maxval)
maxval = ptattoo;
pl = pl->next;
}
}
if(val <= maxval)
retval = FALSE;
/* Must check the state is valid */
if(retval == TRUE)
gimage->tattoo_state = val;
return retval;
}
void
gimp_image_colormap_changed (GimpImage *image,
gint col)

View File

@ -168,6 +168,8 @@ void gimp_image_parasite_attach (GimpImage *, Parasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
int gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
void gimp_image_set_paths (GimpImage *, PathsList *);
PathsList * gimp_image_get_paths (GimpImage *);

View File

@ -1169,6 +1169,96 @@ gimp_image_get_new_tattoo (GimpImage *image)
return (image->tattoo_state);
}
Tattoo
gimp_image_get_tattoo_state(GimpImage *image)
{
return (image->tattoo_state);
}
int
gimp_image_set_tattoo_state(GimpImage *gimage, Tattoo val)
{
Layer *layer;
GSList *layers = gimage->layers;
int retval = TRUE;
Channel *channel;
GSList *channels = gimage->channels;
Tattoo maxval = 0;
PATHP pptr = NULL;
PathsList *plist;
while (layers)
{
Tattoo ltattoo;
layer = (Layer *) layers->data;
ltattoo = layer_get_tattoo (layer);
if(ltattoo > maxval)
maxval = ltattoo;
if(gimp_image_get_channel_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in channel */
}
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
layers = g_slist_next (layers);
}
/* Now check that the paths channel tattoos don't overlap */
while (channels)
{
Tattoo ctattoo;
channel = (Channel *) channels->data;
ctattoo = channel_get_tattoo (channel);
if(ctattoo > maxval)
maxval = ctattoo;
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ctattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
channels = g_slist_next (channels);
}
/* Find the max tatto value in the paths */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
Tattoo ptattoo;
while (pl)
{
pptr = pl->data;
ptattoo = paths_get_tattoo (pptr);
if(ptattoo > maxval)
maxval = ptattoo;
pl = pl->next;
}
}
if(val <= maxval)
retval = FALSE;
/* Must check the state is valid */
if(retval == TRUE)
gimage->tattoo_state = val;
return retval;
}
void
gimp_image_colormap_changed (GimpImage *image,
gint col)

View File

@ -168,6 +168,8 @@ void gimp_image_parasite_attach (GimpImage *, Parasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
int gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
void gimp_image_set_paths (GimpImage *, PathsList *);
PathsList * gimp_image_get_paths (GimpImage *);

View File

@ -1169,6 +1169,96 @@ gimp_image_get_new_tattoo (GimpImage *image)
return (image->tattoo_state);
}
Tattoo
gimp_image_get_tattoo_state(GimpImage *image)
{
return (image->tattoo_state);
}
int
gimp_image_set_tattoo_state(GimpImage *gimage, Tattoo val)
{
Layer *layer;
GSList *layers = gimage->layers;
int retval = TRUE;
Channel *channel;
GSList *channels = gimage->channels;
Tattoo maxval = 0;
PATHP pptr = NULL;
PathsList *plist;
while (layers)
{
Tattoo ltattoo;
layer = (Layer *) layers->data;
ltattoo = layer_get_tattoo (layer);
if(ltattoo > maxval)
maxval = ltattoo;
if(gimp_image_get_channel_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in channel */
}
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
layers = g_slist_next (layers);
}
/* Now check that the paths channel tattoos don't overlap */
while (channels)
{
Tattoo ctattoo;
channel = (Channel *) channels->data;
ctattoo = channel_get_tattoo (channel);
if(ctattoo > maxval)
maxval = ctattoo;
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ctattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
channels = g_slist_next (channels);
}
/* Find the max tatto value in the paths */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
Tattoo ptattoo;
while (pl)
{
pptr = pl->data;
ptattoo = paths_get_tattoo (pptr);
if(ptattoo > maxval)
maxval = ptattoo;
pl = pl->next;
}
}
if(val <= maxval)
retval = FALSE;
/* Must check the state is valid */
if(retval == TRUE)
gimage->tattoo_state = val;
return retval;
}
void
gimp_image_colormap_changed (GimpImage *image,
gint col)

View File

@ -168,6 +168,8 @@ void gimp_image_parasite_attach (GimpImage *, Parasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
int gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
void gimp_image_set_paths (GimpImage *, PathsList *);
PathsList * gimp_image_get_paths (GimpImage *);

View File

@ -1169,6 +1169,96 @@ gimp_image_get_new_tattoo (GimpImage *image)
return (image->tattoo_state);
}
Tattoo
gimp_image_get_tattoo_state(GimpImage *image)
{
return (image->tattoo_state);
}
int
gimp_image_set_tattoo_state(GimpImage *gimage, Tattoo val)
{
Layer *layer;
GSList *layers = gimage->layers;
int retval = TRUE;
Channel *channel;
GSList *channels = gimage->channels;
Tattoo maxval = 0;
PATHP pptr = NULL;
PathsList *plist;
while (layers)
{
Tattoo ltattoo;
layer = (Layer *) layers->data;
ltattoo = layer_get_tattoo (layer);
if(ltattoo > maxval)
maxval = ltattoo;
if(gimp_image_get_channel_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in channel */
}
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
layers = g_slist_next (layers);
}
/* Now check that the paths channel tattoos don't overlap */
while (channels)
{
Tattoo ctattoo;
channel = (Channel *) channels->data;
ctattoo = channel_get_tattoo (channel);
if(ctattoo > maxval)
maxval = ctattoo;
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ctattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
channels = g_slist_next (channels);
}
/* Find the max tatto value in the paths */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
Tattoo ptattoo;
while (pl)
{
pptr = pl->data;
ptattoo = paths_get_tattoo (pptr);
if(ptattoo > maxval)
maxval = ptattoo;
pl = pl->next;
}
}
if(val <= maxval)
retval = FALSE;
/* Must check the state is valid */
if(retval == TRUE)
gimage->tattoo_state = val;
return retval;
}
void
gimp_image_colormap_changed (GimpImage *image,
gint col)

View File

@ -168,6 +168,8 @@ void gimp_image_parasite_attach (GimpImage *, Parasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
int gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
void gimp_image_set_paths (GimpImage *, PathsList *);
PathsList * gimp_image_get_paths (GimpImage *);

View File

@ -1169,6 +1169,96 @@ gimp_image_get_new_tattoo (GimpImage *image)
return (image->tattoo_state);
}
Tattoo
gimp_image_get_tattoo_state(GimpImage *image)
{
return (image->tattoo_state);
}
int
gimp_image_set_tattoo_state(GimpImage *gimage, Tattoo val)
{
Layer *layer;
GSList *layers = gimage->layers;
int retval = TRUE;
Channel *channel;
GSList *channels = gimage->channels;
Tattoo maxval = 0;
PATHP pptr = NULL;
PathsList *plist;
while (layers)
{
Tattoo ltattoo;
layer = (Layer *) layers->data;
ltattoo = layer_get_tattoo (layer);
if(ltattoo > maxval)
maxval = ltattoo;
if(gimp_image_get_channel_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in channel */
}
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
layers = g_slist_next (layers);
}
/* Now check that the paths channel tattoos don't overlap */
while (channels)
{
Tattoo ctattoo;
channel = (Channel *) channels->data;
ctattoo = channel_get_tattoo (channel);
if(ctattoo > maxval)
maxval = ctattoo;
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ctattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
channels = g_slist_next (channels);
}
/* Find the max tatto value in the paths */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
Tattoo ptattoo;
while (pl)
{
pptr = pl->data;
ptattoo = paths_get_tattoo (pptr);
if(ptattoo > maxval)
maxval = ptattoo;
pl = pl->next;
}
}
if(val <= maxval)
retval = FALSE;
/* Must check the state is valid */
if(retval == TRUE)
gimage->tattoo_state = val;
return retval;
}
void
gimp_image_colormap_changed (GimpImage *image,
gint col)

View File

@ -168,6 +168,8 @@ void gimp_image_parasite_attach (GimpImage *, Parasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
int gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
void gimp_image_set_paths (GimpImage *, PathsList *);
PathsList * gimp_image_get_paths (GimpImage *);

View File

@ -1169,6 +1169,96 @@ gimp_image_get_new_tattoo (GimpImage *image)
return (image->tattoo_state);
}
Tattoo
gimp_image_get_tattoo_state(GimpImage *image)
{
return (image->tattoo_state);
}
int
gimp_image_set_tattoo_state(GimpImage *gimage, Tattoo val)
{
Layer *layer;
GSList *layers = gimage->layers;
int retval = TRUE;
Channel *channel;
GSList *channels = gimage->channels;
Tattoo maxval = 0;
PATHP pptr = NULL;
PathsList *plist;
while (layers)
{
Tattoo ltattoo;
layer = (Layer *) layers->data;
ltattoo = layer_get_tattoo (layer);
if(ltattoo > maxval)
maxval = ltattoo;
if(gimp_image_get_channel_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in channel */
}
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
layers = g_slist_next (layers);
}
/* Now check that the paths channel tattoos don't overlap */
while (channels)
{
Tattoo ctattoo;
channel = (Channel *) channels->data;
ctattoo = channel_get_tattoo (channel);
if(ctattoo > maxval)
maxval = ctattoo;
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ctattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
channels = g_slist_next (channels);
}
/* Find the max tatto value in the paths */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
Tattoo ptattoo;
while (pl)
{
pptr = pl->data;
ptattoo = paths_get_tattoo (pptr);
if(ptattoo > maxval)
maxval = ptattoo;
pl = pl->next;
}
}
if(val <= maxval)
retval = FALSE;
/* Must check the state is valid */
if(retval == TRUE)
gimage->tattoo_state = val;
return retval;
}
void
gimp_image_colormap_changed (GimpImage *image,
gint col)

View File

@ -168,6 +168,8 @@ void gimp_image_parasite_attach (GimpImage *, Parasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
int gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
void gimp_image_set_paths (GimpImage *, PathsList *);
PathsList * gimp_image_get_paths (GimpImage *);

View File

@ -1290,6 +1290,13 @@ layer_get_tattoo (const Layer *layer)
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (layer)));
}
void
layer_set_tattoo (const Layer *layer , Tattoo val)
{
gimp_drawable_set_tattoo(GIMP_DRAWABLE (layer),val);
}
void
layer_invalidate_previews (GimpImage* gimage)
{

View File

@ -121,6 +121,7 @@ TempBuf * layer_mask_preview (Layer *, gint, gint);
void layer_invalidate_previews (GimpImage *);
Tattoo layer_get_tattoo (const Layer *);
void layer_set_tattoo (const Layer *, Tattoo);
#define drawable_layer GIMP_IS_LAYER
#define drawable_layer_mask GIMP_IS_LAYER_MASK

View File

@ -1169,6 +1169,96 @@ gimp_image_get_new_tattoo (GimpImage *image)
return (image->tattoo_state);
}
Tattoo
gimp_image_get_tattoo_state(GimpImage *image)
{
return (image->tattoo_state);
}
int
gimp_image_set_tattoo_state(GimpImage *gimage, Tattoo val)
{
Layer *layer;
GSList *layers = gimage->layers;
int retval = TRUE;
Channel *channel;
GSList *channels = gimage->channels;
Tattoo maxval = 0;
PATHP pptr = NULL;
PathsList *plist;
while (layers)
{
Tattoo ltattoo;
layer = (Layer *) layers->data;
ltattoo = layer_get_tattoo (layer);
if(ltattoo > maxval)
maxval = ltattoo;
if(gimp_image_get_channel_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in channel */
}
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
layers = g_slist_next (layers);
}
/* Now check that the paths channel tattoos don't overlap */
while (channels)
{
Tattoo ctattoo;
channel = (Channel *) channels->data;
ctattoo = channel_get_tattoo (channel);
if(ctattoo > maxval)
maxval = ctattoo;
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ctattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
channels = g_slist_next (channels);
}
/* Find the max tatto value in the paths */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
Tattoo ptattoo;
while (pl)
{
pptr = pl->data;
ptattoo = paths_get_tattoo (pptr);
if(ptattoo > maxval)
maxval = ptattoo;
pl = pl->next;
}
}
if(val <= maxval)
retval = FALSE;
/* Must check the state is valid */
if(retval == TRUE)
gimage->tattoo_state = val;
return retval;
}
void
gimp_image_colormap_changed (GimpImage *image,
gint col)

View File

@ -168,6 +168,8 @@ void gimp_image_parasite_attach (GimpImage *, Parasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
int gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
void gimp_image_set_paths (GimpImage *, PathsList *);
PathsList * gimp_image_get_paths (GimpImage *);

View File

@ -72,6 +72,8 @@ static ProcRecord image_clean_all_proc;
static ProcRecord image_floating_selection_proc;
static ProcRecord image_floating_sel_attached_to_proc;
static ProcRecord image_thumbnail_proc;
static ProcRecord image_set_tattoo_state_proc;
static ProcRecord image_get_tattoo_state_proc;
static ProcRecord image_width_proc;
static ProcRecord image_height_proc;
static ProcRecord image_get_active_layer_proc;
@ -133,6 +135,8 @@ register_gimage_procs (void)
procedural_db_register (&image_floating_selection_proc);
procedural_db_register (&image_floating_sel_attached_to_proc);
procedural_db_register (&image_thumbnail_proc);
procedural_db_register (&image_set_tattoo_state_proc);
procedural_db_register (&image_get_tattoo_state_proc);
procedural_db_register (&image_width_proc);
procedural_db_register (&image_height_proc);
procedural_db_register (&image_get_active_layer_proc);
@ -2491,6 +2495,116 @@ static ProcRecord image_thumbnail_proc =
{ { image_thumbnail_invoker } }
};
static Argument *
image_set_tattoo_state_invoker (Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage;
gint32 tattoo;
gimage = pdb_id_to_image (args[0].value.pdb_int);
if (gimage == NULL)
success = FALSE;
tattoo = args[1].value.pdb_int;
if (success)
{
success = gimp_image_set_tattoo_state(gimage,tattoo);
}
return procedural_db_return_args (&image_set_tattoo_state_proc, success);
}
static ProcArg image_set_tattoo_state_inargs[] =
{
{
PDB_IMAGE,
"image",
"The image"
},
{
PDB_INT32,
"tattoo",
"The new tattoo state of the image"
}
};
static ProcRecord image_set_tattoo_state_proc =
{
"gimp_image_set_tattoo_state",
"Set the tattoo state associated with the image.",
"This procedure sets the tattoo state of the image. Use only by save/load plugins that wish to preserve an images tattoo state. Using this function at other times will produce unexpected results. A full check of uniqueness of states in layers, channels and paths will be performed by this procedure and a execution failure will be returned if this fails. A failure will also be returned if the new tattoo state value is less than the maximum tattoo value from all of the tattoos from the paths,layers and channels.",
"Andy Thomas",
"Andy Thomas",
"2000",
PDB_INTERNAL,
2,
image_set_tattoo_state_inargs,
0,
NULL,
{ { image_set_tattoo_state_invoker } }
};
static Argument *
image_get_tattoo_state_invoker (Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
gint32 tattoo = 0;
gimage = pdb_id_to_image (args[0].value.pdb_int);
if (gimage == NULL)
success = FALSE;
if (success)
{
tattoo = gimp_image_get_tattoo_state(gimage);
}
return_args = procedural_db_return_args (&image_get_tattoo_state_proc, success);
if (success)
return_args[1].value.pdb_int = tattoo;
return return_args;
}
static ProcArg image_get_tattoo_state_inargs[] =
{
{
PDB_IMAGE,
"image",
"The image"
}
};
static ProcArg image_get_tattoo_state_outargs[] =
{
{
PDB_INT32,
"tattoo",
"The tattoo state associated with the image"
}
};
static ProcRecord image_get_tattoo_state_proc =
{
"gimp_image_get_tattoo_state",
"Returns the tattoo state associated with the image.",
"This procedure returns the tattoo state of the image. Use only by save/load plugins that wish to preserve an images tattoo state. Using this function at other times will produce unexpected results.",
"Andy Thomas",
"Andy Thomas",
"2000",
PDB_INTERNAL,
1,
image_get_tattoo_state_inargs,
1,
image_get_tattoo_state_outargs,
{ { image_get_tattoo_state_invoker } }
};
static Argument *
image_width_invoker (Argument *args)
{

View File

@ -590,6 +590,12 @@ channel_get_tattoo (const Channel *channel)
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (channel)));
}
void
channel_set_tattoo (const Channel *channel, Tattoo val)
{
gimp_drawable_set_tattoo(GIMP_DRAWABLE (channel),val);
}
/******************************/
/* selection mask functions */
/******************************/

View File

@ -100,6 +100,7 @@ TempBuf * channel_preview (Channel *, gint, gint);
void channel_invalidate_previews (GimpImage*);
Tattoo channel_get_tattoo (const Channel *);
void channel_set_tattoo (const Channel *,Tattoo);
/* selection mask functions */

View File

@ -542,6 +542,14 @@ gimp_drawable_get_tattoo (const GimpDrawable *drawable)
return drawable->tattoo;
}
void
gimp_drawable_set_tattoo(GimpDrawable *drawable, Tattoo val)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
drawable->tattoo = val;
}
gboolean
gimp_drawable_is_rgb (GimpDrawable *drawable)
{

View File

@ -77,6 +77,7 @@ Parasite * gimp_drawable_parasite_find (const GimpDrawable *,
gchar ** gimp_drawable_parasite_list (GimpDrawable *drawable,
gint *count);
Tattoo gimp_drawable_get_tattoo (const GimpDrawable *);
void gimp_drawable_set_tattoo (GimpDrawable *, Tattoo);
GimpDrawable * gimp_drawable_get_ID (gint);
void gimp_drawable_deallocate (GimpDrawable *);

View File

@ -1169,6 +1169,96 @@ gimp_image_get_new_tattoo (GimpImage *image)
return (image->tattoo_state);
}
Tattoo
gimp_image_get_tattoo_state(GimpImage *image)
{
return (image->tattoo_state);
}
int
gimp_image_set_tattoo_state(GimpImage *gimage, Tattoo val)
{
Layer *layer;
GSList *layers = gimage->layers;
int retval = TRUE;
Channel *channel;
GSList *channels = gimage->channels;
Tattoo maxval = 0;
PATHP pptr = NULL;
PathsList *plist;
while (layers)
{
Tattoo ltattoo;
layer = (Layer *) layers->data;
ltattoo = layer_get_tattoo (layer);
if(ltattoo > maxval)
maxval = ltattoo;
if(gimp_image_get_channel_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in channel */
}
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
layers = g_slist_next (layers);
}
/* Now check that the paths channel tattoos don't overlap */
while (channels)
{
Tattoo ctattoo;
channel = (Channel *) channels->data;
ctattoo = channel_get_tattoo (channel);
if(ctattoo > maxval)
maxval = ctattoo;
/* Now check path an't got this tattoo */
if(paths_get_path_by_tattoo(gimage,ctattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
channels = g_slist_next (channels);
}
/* Find the max tatto value in the paths */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
Tattoo ptattoo;
while (pl)
{
pptr = pl->data;
ptattoo = paths_get_tattoo (pptr);
if(ptattoo > maxval)
maxval = ptattoo;
pl = pl->next;
}
}
if(val <= maxval)
retval = FALSE;
/* Must check the state is valid */
if(retval == TRUE)
gimage->tattoo_state = val;
return retval;
}
void
gimp_image_colormap_changed (GimpImage *image,
gint col)

View File

@ -168,6 +168,8 @@ void gimp_image_parasite_attach (GimpImage *, Parasite *);
void gimp_image_parasite_detach (GimpImage *, const gchar *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
int gimp_image_set_tattoo_state (GimpImage *, Tattoo);
Tattoo gimp_image_get_tattoo_state (GimpImage *);
void gimp_image_set_paths (GimpImage *, PathsList *);
PathsList * gimp_image_get_paths (GimpImage *);

View File

@ -1290,6 +1290,13 @@ layer_get_tattoo (const Layer *layer)
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (layer)));
}
void
layer_set_tattoo (const Layer *layer , Tattoo val)
{
gimp_drawable_set_tattoo(GIMP_DRAWABLE (layer),val);
}
void
layer_invalidate_previews (GimpImage* gimage)
{

View File

@ -121,6 +121,7 @@ TempBuf * layer_mask_preview (Layer *, gint, gint);
void layer_invalidate_previews (GimpImage *);
Tattoo layer_get_tattoo (const Layer *);
void layer_set_tattoo (const Layer *, Tattoo);
#define drawable_layer GIMP_IS_LAYER
#define drawable_layer_mask GIMP_IS_LAYER_MASK

View File

@ -60,7 +60,7 @@ void register_tools_procs (void);
void register_undo_procs (void);
void register_unit_procs (void);
/* 315 procedures registered total */
/* 320 procedures registered total */
void
internal_procs_init (void)
@ -68,52 +68,52 @@ internal_procs_init (void)
app_init_update_status (_("Internal Procedures"), _("Brush UI"), 0.0);
register_brush_select_procs ();
app_init_update_status (NULL, _("Brushes"), 0.01);
app_init_update_status (NULL, _("Brushes"), 0.009);
register_brushes_procs ();
app_init_update_status (NULL, _("Channel"), 0.044);
register_channel_procs ();
app_init_update_status (NULL, _("Channel Ops"), 0.089);
app_init_update_status (NULL, _("Channel Ops"), 0.091);
register_channel_ops_procs ();
app_init_update_status (NULL, _("Color"), 0.095);
app_init_update_status (NULL, _("Color"), 0.097);
register_color_procs ();
app_init_update_status (NULL, _("Convert"), 0.133);
app_init_update_status (NULL, _("Convert"), 0.134);
register_convert_procs ();
app_init_update_status (NULL, _("Drawable procedures"), 0.143);
app_init_update_status (NULL, _("Drawable procedures"), 0.144);
register_drawable_procs ();
app_init_update_status (NULL, _("Edit procedures"), 0.213);
app_init_update_status (NULL, _("Edit procedures"), 0.212);
register_edit_procs ();
app_init_update_status (NULL, _("File Operations"), 0.232);
app_init_update_status (NULL, _("File Operations"), 0.231);
register_fileops_procs ();
app_init_update_status (NULL, _("Floating selections"), 0.257);
app_init_update_status (NULL, _("Floating selections"), 0.256);
register_floating_sel_procs ();
app_init_update_status (NULL, _("GDisplay procedures"), 0.276);
app_init_update_status (NULL, _("GDisplay procedures"), 0.275);
register_gdisplay_procs ();
app_init_update_status (NULL, _("Image"), 0.286);
app_init_update_status (NULL, _("Image"), 0.284);
register_gimage_procs ();
app_init_update_status (NULL, _("Image mask"), 0.467);
app_init_update_status (NULL, _("Image mask"), 0.469);
register_gimage_mask_procs ();
app_init_update_status (NULL, _("Gimprc procedures"), 0.521);
app_init_update_status (NULL, _("Gimprc procedures"), 0.522);
register_gimprc_procs ();
app_init_update_status (NULL, _("Help procedures"), 0.53);
app_init_update_status (NULL, _("Help procedures"), 0.531);
register_gimphelp_procs ();
app_init_update_status (NULL, _("Gradients"), 0.533);
app_init_update_status (NULL, _("Gradients"), 0.534);
register_gradient_procs ();
app_init_update_status (NULL, _("Gradient UI"), 0.549);
app_init_update_status (NULL, _("Gradient UI"), 0.55);
register_gradient_select_procs ();
app_init_update_status (NULL, _("Guide procedures"), 0.562);
@ -122,42 +122,42 @@ internal_procs_init (void)
app_init_update_status (NULL, _("Interface"), 0.581);
register_interface_procs ();
app_init_update_status (NULL, _("Layer"), 0.59);
app_init_update_status (NULL, _("Layer"), 0.591);
register_layer_procs ();
app_init_update_status (NULL, _("Miscellaneous"), 0.686);
app_init_update_status (NULL, _("Miscellaneous"), 0.688);
register_misc_procs ();
app_init_update_status (NULL, _("Palette"), 0.692);
app_init_update_status (NULL, _("Palette"), 0.694);
register_palette_procs ();
app_init_update_status (NULL, _("Parasite procedures"), 0.714);
app_init_update_status (NULL, _("Parasite procedures"), 0.716);
register_parasite_procs ();
app_init_update_status (NULL, _("Paths"), 0.756);
register_paths_procs ();
app_init_update_status (NULL, _("Pattern UI"), 0.794);
app_init_update_status (NULL, _("Pattern UI"), 0.797);
register_pattern_select_procs ();
app_init_update_status (NULL, _("Patterns"), 0.803);
app_init_update_status (NULL, _("Patterns"), 0.806);
register_patterns_procs ();
app_init_update_status (NULL, _("Plug-in"), 0.816);
app_init_update_status (NULL, _("Plug-in"), 0.819);
register_plug_in_procs ();
app_init_update_status (NULL, _("Procedural database"), 0.829);
app_init_update_status (NULL, _("Procedural database"), 0.831);
register_procedural_db_procs ();
app_init_update_status (NULL, _("Text procedures"), 0.854);
app_init_update_status (NULL, _("Text procedures"), 0.856);
register_text_tool_procs ();
app_init_update_status (NULL, _("Tool procedures"), 0.867);
app_init_update_status (NULL, _("Tool procedures"), 0.869);
register_tools_procs ();
app_init_update_status (NULL, _("Undo"), 0.959);
register_undo_procs ();
app_init_update_status (NULL, _("Units"), 0.965);
app_init_update_status (NULL, _("Units"), 0.966);
register_unit_procs ();
}

View File

@ -1290,6 +1290,13 @@ layer_get_tattoo (const Layer *layer)
return (gimp_drawable_get_tattoo (GIMP_DRAWABLE (layer)));
}
void
layer_set_tattoo (const Layer *layer , Tattoo val)
{
gimp_drawable_set_tattoo(GIMP_DRAWABLE (layer),val);
}
void
layer_invalidate_previews (GimpImage* gimage)
{

View File

@ -121,6 +121,7 @@ TempBuf * layer_mask_preview (Layer *, gint, gint);
void layer_invalidate_previews (GimpImage *);
Tattoo layer_get_tattoo (const Layer *);
void layer_set_tattoo (const Layer *, Tattoo);
#define drawable_layer GIMP_IS_LAYER
#define drawable_layer_mask GIMP_IS_LAYER_MASK

View File

@ -58,6 +58,7 @@ static ProcRecord layer_set_mode_proc;
static ProcRecord layer_get_linked_proc;
static ProcRecord layer_set_linked_proc;
static ProcRecord layer_get_tattoo_proc;
static ProcRecord layer_set_tattoo_proc;
void
register_layer_procs (void)
@ -92,6 +93,7 @@ register_layer_procs (void)
procedural_db_register (&layer_get_linked_proc);
procedural_db_register (&layer_set_linked_proc);
procedural_db_register (&layer_get_tattoo_proc);
procedural_db_register (&layer_set_tattoo_proc);
}
static Argument *
@ -1862,8 +1864,8 @@ static ProcArg layer_get_tattoo_outargs[] =
static ProcRecord layer_get_tattoo_proc =
{
"gimp_layer_get_tattoo",
"Returns the tattoo associated with the specified layer.",
"This procedure returns the tattoo associated with the specified layer. A tattoo is a unique and permanent identifier attached to a layer that can be used to uniquely identify a layer within an image even between sessions",
"Get the tattoo of the specified layer.",
"This procedure returns the specified layer's tattoo. A tattoo is a unique and permanent identifier attached to a layer that can be used to uniquely identify a layer within an image even between sessions",
"Jay Cox",
"Jay Cox",
"1998",
@ -1874,3 +1876,54 @@ static ProcRecord layer_get_tattoo_proc =
layer_get_tattoo_outargs,
{ { layer_get_tattoo_invoker } }
};
static Argument *
layer_set_tattoo_invoker (Argument *args)
{
gboolean success = TRUE;
GimpLayer *layer;
gint32 tattoo;
layer = layer_get_ID (args[0].value.pdb_int);
if (layer == NULL)
success = FALSE;
tattoo = args[1].value.pdb_int;
if (tattoo == 0)
success = FALSE;
if (success)
layer_set_tattoo (layer, tattoo);
return procedural_db_return_args (&layer_set_tattoo_proc, success);
}
static ProcArg layer_set_tattoo_inargs[] =
{
{
PDB_LAYER,
"layer",
"The layer"
},
{
PDB_INT32,
"tattoo",
"The new layer tattoo"
}
};
static ProcRecord layer_set_tattoo_proc =
{
"gimp_layer_set_tattoo",
"Set the tattoo of the specified layer.",
"This procedure sets the specified layer's tattoo. A tattoo is a unique and permanent identifier attached to a layer that can be used to uniquely identify a layer within an image even between sessions",
"Jay Cox",
"Jay Cox",
"1998",
PDB_INTERNAL,
2,
layer_set_tattoo_inargs,
0,
NULL,
{ { layer_set_tattoo_invoker } }
};

View File

@ -37,6 +37,7 @@ static ProcRecord get_path_by_tattoo_proc;
static ProcRecord path_delete_proc;
static ProcRecord path_get_locked_proc;
static ProcRecord path_set_locked_proc;
static ProcRecord path_set_tattoo_proc;
void
register_paths_procs (void)
@ -53,6 +54,7 @@ register_paths_procs (void)
procedural_db_register (&path_delete_proc);
procedural_db_register (&path_get_locked_proc);
procedural_db_register (&path_set_locked_proc);
procedural_db_register (&path_set_tattoo_proc);
}
static Argument *
@ -1040,3 +1042,90 @@ static ProcRecord path_set_locked_proc =
NULL,
{ { path_set_locked_invoker } }
};
static Argument *
path_set_tattoo_invoker (Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage;
gchar *pname;
gint32 tattovalue = 0;
PathsList *plist;
PATHP pptr = NULL;
gimage = pdb_id_to_image (args[0].value.pdb_int);
if (gimage == NULL)
success = FALSE;
pname = (gchar *) args[1].value.pdb_pointer;
if (pname == NULL)
success = FALSE;
tattovalue = args[2].value.pdb_int;
if (success)
{
/* Get the path with the given name */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
while (pl)
{
pptr = pl->data;
if (!strcmp (pname, pptr->name->str))
break; /* Found the path */
pl = pl->next;
pptr = NULL;
}
if (pl && pptr)
pptr->tattoo = tattovalue ;
else
success = FALSE;
}
else
success = FALSE;
}
return procedural_db_return_args (&path_set_tattoo_proc, success);
}
static ProcArg path_set_tattoo_inargs[] =
{
{
PDB_IMAGE,
"image",
"The image"
},
{
PDB_STRING,
"pathname",
"the name of the path whose tattoo should be set"
},
{
PDB_INT32,
"tattovalue",
"The tattoo associated with the name path. Only values returned from 'path_get_tattoo' should be used here"
}
};
static ProcRecord path_set_tattoo_proc =
{
"gimp_path_set_tattoo",
"Sets the tattoo associated with the name path.",
"This procedure sets the tattoo associated with the specified path. A tattoo is a unique and permenant identifier attached to a path that can be used to uniquely identify a path within an image even between sessions. Note that the value passed to this function must have been obtained from a previous call to path_get_tattoo.",
"Andy Thomas",
"Andy Thomas",
"1999",
PDB_INTERNAL,
3,
path_set_tattoo_inargs,
0,
NULL,
{ { path_set_tattoo_invoker } }
};

View File

@ -213,18 +213,14 @@ CODE
&channel_accessors('tattoo', 'tattoo', 'tattoo', 1,
<<'CODE');
$blurb = 'Returns the tattoo associated with the specified channel.';
$help = <<'HELP';
This procedure returns the tattoo associated with the specified channel. A
tattoo is a unique and permanent identifier attached to a channel that can be
used to uniquely identify a channel within an image even between sessions
$help .= <<'HELP';
A tattoo is a unique and permanent identifier attached to a channel that can be
used to uniquely identify a channel within an image even between sessions.
HELP
$author = $copyright = 'Jay Cox';
$date = '1998';
CODE
$#procs--;
@headers = qw("channel.h" "channel_pvt.h");

View File

@ -1337,6 +1337,70 @@ CODE
);
}
sub image_get_tattoo_state {
$blurb = 'Returns the tattoo state associated with the image.';
$help = <<'HELP';
This procedure returns the tattoo state of the image. Use only by
save/load plugins that wish to preserve an images tattoo state. Using this
function at other times will produce unexpected results.
HELP
$author = $copyright = 'Andy Thomas';
$date = '2000';
@inargs = ( &std_image_arg );
@outargs = (
{ name => 'tattoo', type => 'int32',
desc => 'The tattoo state associated with the image', init => 1 }
);
%invoke = (
code => <<'CODE'
{
tattoo = gimp_image_get_tattoo_state(gimage);
}
CODE
);
}
sub image_set_tattoo_state {
$blurb = 'Set the tattoo state associated with the image.';
$help = <<'HELP';
This procedure sets the tattoo state of the image. Use only by
save/load plugins that wish to preserve an images tattoo state. Using this
function at other times will produce unexpected results. A full check of
uniqueness of states in layers, channels and paths will be performed by this
procedure and a execution failure will be returned if this fails. A failure
will also be returned if the new tattoo state value is less than the maximum
tattoo value from all of the tattoos from the paths,layers and channels. After
the image data has been loaded and all the tattoos have been set then this is
the last procedure that should be called. If effectively does a status check
on the tattoo values that have been set to make sure that all is OK.
HELP
$author = $copyright = 'Andy Thomas';
$date = '2000';
@inargs = (
&std_image_arg,
{ name => 'tattoo', type => 'int32',
desc => 'The new tattoo state of the image'
}
);
%invoke = (
code => <<'CODE'
{
success = gimp_image_set_tattoo_state(gimage,tattoo);
}
CODE
);
}
@headers = qw(<string.h> "gimage.h" "libgimp/gimplimits.h");
$extra{app}->{code} = <<'CODE';
@ -1364,7 +1428,8 @@ unshift @procs, qw(image_list image_new image_resize image_scale image_delete
image_set_cmap image_undo_is_enabled image_undo_enable
image_undo_disable image_undo_freeze image_undo_thaw
image_clean_all image_floating_selection
image_floating_sel_attached_to image_thumbnail);
image_floating_sel_attached_to image_thumbnail
image_set_tattoo_state image_get_tattoo_state);
%exports = (app => [@procs],
lib => [@procs[0..4,6..11,14,16..24,26..35,37..$#procs]]);

View File

@ -1337,6 +1337,70 @@ CODE
);
}
sub image_get_tattoo_state {
$blurb = 'Returns the tattoo state associated with the image.';
$help = <<'HELP';
This procedure returns the tattoo state of the image. Use only by
save/load plugins that wish to preserve an images tattoo state. Using this
function at other times will produce unexpected results.
HELP
$author = $copyright = 'Andy Thomas';
$date = '2000';
@inargs = ( &std_image_arg );
@outargs = (
{ name => 'tattoo', type => 'int32',
desc => 'The tattoo state associated with the image', init => 1 }
);
%invoke = (
code => <<'CODE'
{
tattoo = gimp_image_get_tattoo_state(gimage);
}
CODE
);
}
sub image_set_tattoo_state {
$blurb = 'Set the tattoo state associated with the image.';
$help = <<'HELP';
This procedure sets the tattoo state of the image. Use only by
save/load plugins that wish to preserve an images tattoo state. Using this
function at other times will produce unexpected results. A full check of
uniqueness of states in layers, channels and paths will be performed by this
procedure and a execution failure will be returned if this fails. A failure
will also be returned if the new tattoo state value is less than the maximum
tattoo value from all of the tattoos from the paths,layers and channels. After
the image data has been loaded and all the tattoos have been set then this is
the last procedure that should be called. If effectively does a status check
on the tattoo values that have been set to make sure that all is OK.
HELP
$author = $copyright = 'Andy Thomas';
$date = '2000';
@inargs = (
&std_image_arg,
{ name => 'tattoo', type => 'int32',
desc => 'The new tattoo state of the image'
}
);
%invoke = (
code => <<'CODE'
{
success = gimp_image_set_tattoo_state(gimage,tattoo);
}
CODE
);
}
@headers = qw(<string.h> "gimage.h" "libgimp/gimplimits.h");
$extra{app}->{code} = <<'CODE';
@ -1364,7 +1428,8 @@ unshift @procs, qw(image_list image_new image_resize image_scale image_delete
image_set_cmap image_undo_is_enabled image_undo_enable
image_undo_disable image_undo_freeze image_undo_thaw
image_clean_all image_floating_selection
image_floating_sel_attached_to image_thumbnail);
image_floating_sel_attached_to image_thumbnail
image_set_tattoo_state image_get_tattoo_state);
%exports = (app => [@procs],
lib => [@procs[0..4,6..11,14,16..24,26..35,37..$#procs]]);

View File

@ -529,18 +529,14 @@ CODE
&layer_accessors('tattoo', 'tattoo', 'tattoo', 1, 0,
<<'CODE');
$blurb = 'Returns the tattoo associated with the specified layer.';
$help = <<'HELP';
This procedure returns the tattoo associated with the specified layer. A tattoo
is a unique and permanent identifier attached to a layer that can be used to
uniquely identify a layer within an image even between sessions
$help .= <<'HELP';
A tattoo is a unique and permanent identifier attached to a
layer that can be used to uniquely identify a layer within an image even between sessions
HELP
$author = $copyright = 'Jay Cox';
$date = '1998';
CODE
$#procs--;
@headers = qw("layer.h" "layer_pvt.h");

View File

@ -422,6 +422,58 @@ CODE
);
}
sub path_set_tattoo {
$blurb = 'Sets the tattoo associated with the name path.';
$help = <<'HELP';
This procedure sets the tattoo associated with the specified path. A tattoo is a unique and permenant identifier attached to a path that can be used to uniquely identify a path within an image even between sessions. Note that the value passed to this function must have been obtained from a previous call to path_get_tattoo.
HELP
&pdb_misc;
@inargs = (
&std_image_arg,
{ name => 'pathname', type => 'string',
desc => 'the name of the path whose tattoo should be set',
alias => 'pname' },
{ name => 'tattovalue', type => 'int32',
desc => 'The tattoo associated with the name path. Only values returned from \'path_get_tattoo\' should be used here', init => 1 }
);
%invoke = (
vars => [ 'PathsList *plist', 'PATHP pptr = NULL' ],
code => <<'CODE'
{
/* Get the path with the given name */
plist = gimage->paths;
if (plist && plist->bz_paths)
{
GSList *pl = plist->bz_paths;
while (pl)
{
pptr = pl->data;
if (!strcmp (pname, pptr->name->str))
break; /* Found the path */
pl = pl->next;
pptr = NULL;
}
if (pl && pptr)
pptr->tattoo = tattovalue ;
else
success = FALSE;
}
else
success = FALSE;
}
CODE
);
}
sub get_path_by_tattoo {
$blurb = 'Return the name of the path with the given tattoo.';
@ -716,7 +768,7 @@ CODE
@procs = qw(path_list path_get_points path_get_current path_set_current
path_set_points path_stroke_current path_get_point_at_dist
path_get_tattoo get_path_by_tattoo path_delete path_get_locked
path_set_locked);
path_set_locked path_set_tattoo);
%exports = (app => [@procs]);
$desc = 'Paths';