Modified Files: ChangeLog app/Makefile.am app/channel.c app/channel.h

Modified Files:
 	ChangeLog app/Makefile.am app/channel.c app/channel.h
 	app/channel_cmds.c app/channel_cmds.h app/drawable_cmds.c
 	app/gimage_cmds.c app/gimpdrawable.c app/gimpdrawable.h
 	app/gimpdrawableP.h app/gimpimage.c app/gimpimage.h
 	app/gimpimageP.h app/internal_procs.c app/layer.c app/layer.h
 	app/layer_cmds.c app/layer_cmds.h app/parasite_cmds.c
 	app/perspective_tool.c app/plug_in.c app/procedural_db.c
 	app/rotate_tool.c app/scale_tool.c app/shear_tool.c
 	app/transform_core.c app/transform_core.h docs/parasites.txt
 	libgimp/Makefile.am libgimp/gimp.c libgimp/gimp.h
 	libgimp/gimpdrawable.c libgimp/gimpimage.c
 	libgimp/gimpprotocol.c libgimp/gimpprotocol.h
 	plug-ins/gif/gif.c plug-ins/script-fu/script-fu.c
 	plug-ins/tiff/tiff.c
 Added Files:
 	libgimp/gimpmatrix.c libgimp/gimpmatrix.h libgimp/parasite.c
 	libgimp/parasite.h libgimp/parasiteF.h libgimp/parasiteP.h
 Removed Files:
 	app/parasite.c app/parasite.h app/parasiteF.h app/parasiteP.h
 	libgimp/gimpparasite.c libgimp/gimpparasite.h

Tue Oct 13 19:24:03 1998  Jay Cox  (jaycox@earthlink.net)

        * app/parasite.c
        * app/parasite.h
        * app/parasiteF.h
        * app/parasiteP.h : use a single name field instead of seperate
        creator/type fields.  moved to libgimp/parasite*

        * libgimp/Makefile.am
        * libgimp/gimp.c
        * libgimp/gimp.h
        * libgimp/gimpdrawable.c
        * libgimp/gimpimage.c
        * libgimp/gimpprotocol.c
        * libgimp/gimpprotocol.h
        * app/Makefile.am
        * app/channel.c
        * app/channel.h
        * app/channel_cmds.c
        * app/channel_cmds.h
        * app/drawable_cmds.c
        * app/gimage_cmds.c
        * app/gimpdrawable.c
        * app/gimpdrawable.h
        * app/gimpdrawableP.h
        * app/gimpimage.c
        * app/gimpimage.h
        * app/gimpimageP.h
        * app/internal_procs.c
        * app/layer.c
        * app/layer.h
        * app/layer_cmds.c
        * app/layer_cmds.h
        * app/parasite_cmds.c
        * app/plug_in.c
        * app/procedural_db.c: Add tattoos to layers and drawables.
        Use new style parasites.

        * libgimp/gimpmatrix.c
        * libgimp/gimpmatrix.h: new files for matrix math.

        * app/perspective_tool.c
        * app/rotate_tool.c
        * app/scale_tool.c
        * app/shear_tool.c
        * app/transform_core.c
        * app/transform_core.h: use GimpMatrix instead of the old matrix
        code from transform_core.

        * ligimp/gimpparasite*: removed.  now useing the same source
        for plug-ins and the core.

        * plug-ins/script-fu/script-fu.c
        * plug-ins/tiff/tiff.c
        * plug-ins/gif/gif.c: updated to use new style parasites.
This commit is contained in:
jaycox 1998-10-14 02:54:02 +00:00
parent 825fdecff0
commit c5a8b43846
113 changed files with 2132 additions and 1235 deletions

View file

@ -1,3 +1,59 @@
Tue Oct 13 19:24:03 1998 Jay Cox (jaycox@earthlink.net)
* app/parasite.c
* app/parasite.h
* app/parasiteF.h
* app/parasiteP.h : use a single name field instead of seperate
creator/type fields. moved to libgimp/parasite*
* libgimp/Makefile.am
* libgimp/gimp.c
* libgimp/gimp.h
* libgimp/gimpdrawable.c
* libgimp/gimpimage.c
* libgimp/gimpprotocol.c
* libgimp/gimpprotocol.h
* app/Makefile.am
* app/channel.c
* app/channel.h
* app/channel_cmds.c
* app/channel_cmds.h
* app/drawable_cmds.c
* app/gimage_cmds.c
* app/gimpdrawable.c
* app/gimpdrawable.h
* app/gimpdrawableP.h
* app/gimpimage.c
* app/gimpimage.h
* app/gimpimageP.h
* app/internal_procs.c
* app/layer.c
* app/layer.h
* app/layer_cmds.c
* app/layer_cmds.h
* app/parasite_cmds.c
* app/plug_in.c
* app/procedural_db.c: Add tattoos to layers and drawables.
Use new style parasites.
* libgimp/gimpmatrix.c
* libgimp/gimpmatrix.h: new files for matrix math.
* app/perspective_tool.c
* app/rotate_tool.c
* app/scale_tool.c
* app/shear_tool.c
* app/transform_core.c
* app/transform_core.h: use GimpMatrix instead of the old matrix
code from transform_core.
* ligimp/gimpparasite*: removed. now useing the same source
for plug-ins and the core.
* plug-ins/script-fu/script-fu.c
* plug-ins/tiff/tiff.c
* plug-ins/gif/gif.c: updated to use new style parasites.
Tue Oct 13 22:01:41 BST 1998 Andy Thomas <alt@picnic.demon.co.uk> Tue Oct 13 22:01:41 BST 1998 Andy Thomas <alt@picnic.demon.co.uk>
app/brush_select.[ch] Fixed problem with resizing the brush popup app/brush_select.[ch] Fixed problem with resizing the brush popup

View file

@ -227,10 +227,6 @@ gimp_SOURCES = \
paint_funcs.h \ paint_funcs.h \
paintbrush.c \ paintbrush.c \
paintbrush.h \ paintbrush.h \
parasite.c \
parasite.h \
parasiteP.h \
parasiteF.h \
parasite_cmds.c \ parasite_cmds.c \
parasite_cmds.h \ parasite_cmds.h \
pattern_header.h \ pattern_header.h \

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -27,7 +27,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "layer.h" #include "layer.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -475,6 +475,12 @@ channel_invalidate_previews (GimpImage* gimage)
} }
} }
guint32
channel_get_tattoo(const Channel *channel)
{
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(channel)));
}
/****************************/ /****************************/
/* selection mask functions */ /* selection mask functions */

View file

@ -95,6 +95,8 @@ int channel_toggle_visibility (Channel *);
TempBuf * channel_preview (Channel *, int, int); TempBuf * channel_preview (Channel *, int, int);
void channel_invalidate_previews (GimpImage*); void channel_invalidate_previews (GimpImage*);
guint32 channel_get_tattoo(const Channel *);
/* selection mask functions */ /* selection mask functions */

View file

@ -937,3 +937,72 @@ ProcRecord channel_set_color_proc =
/* Exec method */ /* Exec method */
{ { channel_set_color_invoker } }, { { channel_set_color_invoker } },
}; };
/***************************/
/* CHANNEL_GET_TATTOO_PROC */
static Argument *
channel_get_tattoo_invoker (Argument *args)
{
Channel *channel;
int tattoo;
Argument *return_args;
tattoo = 0;
success = TRUE;
if (success)
{
int_value = args[0].value.pdb_int;
if ((channel = channel_get_ID (int_value)))
tattoo = channel_get_tattoo (channel);
else
success = FALSE;
}
return_args = procedural_db_return_args (&channel_get_tattoo_proc, success);
if (success)
return_args[1].value.pdb_int = tattoo;
return return_args;
}
/* The procedure definition */
ProcArg channel_get_tattoo_args[] =
{
{ PDB_CHANNEL,
"channel",
"the channel"
}
};
ProcArg channel_get_tattoo_out_args[] =
{
{ PDB_INT32,
"tattoo",
"the tattoo associated with the given channel"
}
};
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 permenant 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,
/* Input arguments */
1,
channel_get_tattoo_args,
/* Output arguments */
1,
channel_get_tattoo_out_args,
/* Exec method */
{ { channel_get_tattoo_invoker } },
};

View file

@ -33,5 +33,6 @@ extern ProcRecord channel_get_opacity_proc;
extern ProcRecord channel_set_opacity_proc; extern ProcRecord channel_set_opacity_proc;
extern ProcRecord channel_get_color_proc; extern ProcRecord channel_get_color_proc;
extern ProcRecord channel_set_color_proc; extern ProcRecord channel_set_color_proc;
extern ProcRecord channel_get_tattoo_proc;
#endif /* __CHANNEL_CMDS_H__ */ #endif /* __CHANNEL_CMDS_H__ */

View file

@ -27,7 +27,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "layer.h" #include "layer.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -475,6 +475,12 @@ channel_invalidate_previews (GimpImage* gimage)
} }
} }
guint32
channel_get_tattoo(const Channel *channel)
{
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(channel)));
}
/****************************/ /****************************/
/* selection mask functions */ /* selection mask functions */

View file

@ -95,6 +95,8 @@ int channel_toggle_visibility (Channel *);
TempBuf * channel_preview (Channel *, int, int); TempBuf * channel_preview (Channel *, int, int);
void channel_invalidate_previews (GimpImage*); void channel_invalidate_previews (GimpImage*);
guint32 channel_get_tattoo(const Channel *);
/* selection mask functions */ /* selection mask functions */

View file

@ -27,7 +27,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "layer.h" #include "layer.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -475,6 +475,12 @@ channel_invalidate_previews (GimpImage* gimage)
} }
} }
guint32
channel_get_tattoo(const Channel *channel)
{
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(channel)));
}
/****************************/ /****************************/
/* selection mask functions */ /* selection mask functions */

View file

@ -95,6 +95,8 @@ int channel_toggle_visibility (Channel *);
TempBuf * channel_preview (Channel *, int, int); TempBuf * channel_preview (Channel *, int, int);
void channel_invalidate_previews (GimpImage*); void channel_invalidate_previews (GimpImage*);
guint32 channel_get_tattoo(const Channel *);
/* selection mask functions */ /* selection mask functions */

View file

@ -24,7 +24,7 @@
#include "gimpsignal.h" #include "gimpsignal.h"
#include "gimage.h" #include "gimage.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "parasite.h" #include "libgimp/parasite.h"
enum { enum {
@ -255,6 +255,18 @@ gimp_drawable_gimage (GimpDrawable *drawable)
} }
void
gimp_drawable_set_gimage (GimpDrawable *drawable, GimpImage *gimage)
{
g_assert(GIMP_IS_DRAWABLE(drawable));
drawable->gimage = gimage;
if (gimage == NULL)
drawable->tattoo = 0;
else
drawable->tattoo = gimp_image_get_new_tattoo(gimage);
}
int int
gimp_drawable_type (GimpDrawable *drawable) gimp_drawable_type (GimpDrawable *drawable)
{ {
@ -361,10 +373,9 @@ gimp_drawable_set_name (GimpDrawable *drawable, char *name)
Parasite * Parasite *
gimp_drawable_find_parasite (const GimpDrawable *drawable, gimp_drawable_find_parasite (const GimpDrawable *drawable, const char *name)
const char *creator, const char *type)
{ {
return parasite_find_in_gslist(drawable->parasites, creator, type); return parasite_find_in_gslist(drawable->parasites, name);
} }
void void
@ -374,12 +385,19 @@ gimp_drawable_attach_parasite (GimpDrawable *drawable, const Parasite *parasite)
} }
void void
gimp_drawable_detach_parasite (GimpDrawable *drawable, Parasite *parasite) gimp_drawable_detach_parasite (GimpDrawable *drawable, const char *parasite)
{ {
drawable->parasites = g_slist_remove (drawable->parasites, parasite); Parasite *p;
parasite_free(parasite); if ((p = parasite_find_in_gslist(drawable->parasites, parasite)))
drawable->parasites = g_slist_remove (drawable->parasites, p);
parasite_free(p);
} }
guint32
gimp_drawable_get_tattoo(const GimpDrawable *drawable)
{
return drawable->tattoo;
}
int int
gimp_drawable_type_with_alpha (GimpDrawable *drawable) gimp_drawable_type_with_alpha (GimpDrawable *drawable)
@ -539,6 +557,8 @@ gimp_drawable_init (GimpDrawable *drawable)
drawable->preview = NULL; drawable->preview = NULL;
drawable->preview_valid = FALSE; drawable->preview_valid = FALSE;
drawable->parasites = FALSE; drawable->parasites = FALSE;
drawable->tattoo = 0;
gimp_matrix_identity(drawable->transform);
drawable->ID = global_drawable_ID++; drawable->ID = global_drawable_ID++;
if (gimp_drawable_table == NULL) if (gimp_drawable_table == NULL)
@ -619,7 +639,8 @@ gimp_drawable_configure (GimpDrawable *drawable,
drawable->dirty = FALSE; drawable->dirty = FALSE;
drawable->visible = TRUE; drawable->visible = TRUE;
drawable->gimage = gimage; if (gimage)
gimp_drawable_set_gimage(drawable, gimage);
gimp_drawable_set_name(drawable, name); gimp_drawable_set_name(drawable, name);

View file

@ -23,7 +23,7 @@
#include "tile_manager.h" #include "tile_manager.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "gimpimageF.h" #include "gimpimageF.h"
#include "parasiteF.h" #include <libgimp/parasiteF.h>
#define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ()) #define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ())
#define GIMP_DRAWABLE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DRAWABLE, GimpDrawable)) #define GIMP_DRAWABLE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DRAWABLE, GimpDrawable))
@ -74,14 +74,16 @@ char * gimp_drawable_get_name (GimpDrawable *);
void gimp_drawable_set_name (GimpDrawable *, char *); void gimp_drawable_set_name (GimpDrawable *, char *);
Parasite * gimp_drawable_find_parasite (const GimpDrawable *, Parasite * gimp_drawable_find_parasite (const GimpDrawable *,
const char *creator, const char *name);
const char *type);
void gimp_drawable_attach_parasite (GimpDrawable *, const Parasite *); void gimp_drawable_attach_parasite (GimpDrawable *, const Parasite *);
void gimp_drawable_detach_parasite (GimpDrawable *, Parasite *); void gimp_drawable_detach_parasite (GimpDrawable *,
const char *);
guint32 gimp_drawable_get_tattoo (const GimpDrawable *);
GimpDrawable * gimp_drawable_get_ID (int); GimpDrawable * gimp_drawable_get_ID (int);
void gimp_drawable_deallocate (GimpDrawable *); void gimp_drawable_deallocate (GimpDrawable *);
GimpImage * gimp_drawable_gimage (GimpDrawable*); GimpImage * gimp_drawable_gimage (GimpDrawable*);
void gimp_drawable_set_gimage (GimpDrawable*, GimpImage *);
#endif /* __GIMPDRAWABLE_H__ */ #endif /* __GIMPDRAWABLE_H__ */

View file

@ -25,7 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->dirty = 1; gimage->dirty = 1;
gimage->undo_on = TRUE; gimage->undo_on = TRUE;
gimage->construct_flag = -1; gimage->construct_flag = -1;
gimage->tattoo_state = 0;
gimage->projection = NULL; gimage->projection = NULL;
gimage->guides = NULL; gimage->guides = NULL;
gimage->layers = NULL; gimage->layers = NULL;
@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL; gimage->parasites = NULL;
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage,
Parasite * Parasite *
gimp_image_find_parasite (const GimpImage *gimage, gimp_image_find_parasite (const GimpImage *gimage, const char *name)
const char *creator, const char *type)
{ {
return parasite_find_in_gslist(gimage->parasites, creator, type); return parasite_find_in_gslist(gimage->parasites, name);
} }
void void
@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
} }
void void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
{ {
gimage->parasites = g_slist_remove (gimage->parasites, parasite); Parasite *p;
parasite_free(parasite); if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
gimage->parasites = g_slist_remove (gimage->parasites, p);
parasite_free(p);
} }
guint32
gimp_image_get_new_tattoo(GimpImage *image)
{
return (++image->tattoo_state);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/
@ -1395,6 +1405,41 @@ gimp_image_get_active_channel (GimpImage *gimage)
} }
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Layer *layer;
GSList *layers = gimage->layers;
while (layers)
{
layer = (Layer *) layers->data;
if (layer_get_tattoo(layer) == tattoo)
return layer;
layers = g_slist_next (layers);
}
return NULL;
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Channel *channel;
GSList *channels = gimage->channels;
while (channels)
{
channel = (Channel *) channels->data;
if (channel_get_tattoo(channel) == tattoo)
return channel;
channels = g_slist_next (channels);
}
return NULL;
}
int int
gimp_image_get_component_active (GimpImage *gimage, ChannelType type) gimp_image_get_component_active (GimpImage *gimage, ChannelType type)
{ {
@ -2119,8 +2164,8 @@ gimp_image_add_layer (GimpImage *gimage, Layer *float_layer, int position)
gimage->floating_sel = float_layer; gimage->floating_sel = float_layer;
/* let the layer know about the gimage */ /* let the layer know about the gimage */
GIMP_DRAWABLE(float_layer)->gimage = gimage; gimp_drawable_set_gimage(GIMP_DRAWABLE(float_layer), gimage);
/* add the layer to the list at the specified position */ /* add the layer to the list at the specified position */
if (position == -1) if (position == -1)
position = gimp_image_get_layer_index (gimage, gimage->active_layer); position = gimp_image_get_layer_index (gimage, gimage->active_layer);

View file

@ -8,7 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h" #include <libgimp/parasiteF.h>
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator, const char *name);
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *); void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *); void gimp_image_detach_parasite (GimpImage *, const char *);
guint32 gimp_image_get_new_tattoo (GimpImage *);
/* layer/channel functions */ /* layer/channel functions */
@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *); int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *); Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *); Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_mask (GimpImage *); Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType); int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType); int gimp_image_get_component_visible (GimpImage *, ChannelType);
@ -170,7 +174,6 @@ void gimp_image_construct (GimpImage *, int, int, int, i
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int); void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
int gimp_image_is_empty (GimpImage *); int gimp_image_is_empty (GimpImage *);

View file

@ -25,7 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->dirty = 1; gimage->dirty = 1;
gimage->undo_on = TRUE; gimage->undo_on = TRUE;
gimage->construct_flag = -1; gimage->construct_flag = -1;
gimage->tattoo_state = 0;
gimage->projection = NULL; gimage->projection = NULL;
gimage->guides = NULL; gimage->guides = NULL;
gimage->layers = NULL; gimage->layers = NULL;
@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL; gimage->parasites = NULL;
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage,
Parasite * Parasite *
gimp_image_find_parasite (const GimpImage *gimage, gimp_image_find_parasite (const GimpImage *gimage, const char *name)
const char *creator, const char *type)
{ {
return parasite_find_in_gslist(gimage->parasites, creator, type); return parasite_find_in_gslist(gimage->parasites, name);
} }
void void
@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
} }
void void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
{ {
gimage->parasites = g_slist_remove (gimage->parasites, parasite); Parasite *p;
parasite_free(parasite); if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
gimage->parasites = g_slist_remove (gimage->parasites, p);
parasite_free(p);
} }
guint32
gimp_image_get_new_tattoo(GimpImage *image)
{
return (++image->tattoo_state);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/
@ -1395,6 +1405,41 @@ gimp_image_get_active_channel (GimpImage *gimage)
} }
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Layer *layer;
GSList *layers = gimage->layers;
while (layers)
{
layer = (Layer *) layers->data;
if (layer_get_tattoo(layer) == tattoo)
return layer;
layers = g_slist_next (layers);
}
return NULL;
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Channel *channel;
GSList *channels = gimage->channels;
while (channels)
{
channel = (Channel *) channels->data;
if (channel_get_tattoo(channel) == tattoo)
return channel;
channels = g_slist_next (channels);
}
return NULL;
}
int int
gimp_image_get_component_active (GimpImage *gimage, ChannelType type) gimp_image_get_component_active (GimpImage *gimage, ChannelType type)
{ {
@ -2119,8 +2164,8 @@ gimp_image_add_layer (GimpImage *gimage, Layer *float_layer, int position)
gimage->floating_sel = float_layer; gimage->floating_sel = float_layer;
/* let the layer know about the gimage */ /* let the layer know about the gimage */
GIMP_DRAWABLE(float_layer)->gimage = gimage; gimp_drawable_set_gimage(GIMP_DRAWABLE(float_layer), gimage);
/* add the layer to the list at the specified position */ /* add the layer to the list at the specified position */
if (position == -1) if (position == -1)
position = gimp_image_get_layer_index (gimage, gimage->active_layer); position = gimp_image_get_layer_index (gimage, gimage->active_layer);

View file

@ -8,7 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h" #include <libgimp/parasiteF.h>
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator, const char *name);
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *); void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *); void gimp_image_detach_parasite (GimpImage *, const char *);
guint32 gimp_image_get_new_tattoo (GimpImage *);
/* layer/channel functions */ /* layer/channel functions */
@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *); int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *); Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *); Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_mask (GimpImage *); Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType); int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType); int gimp_image_get_component_visible (GimpImage *, ChannelType);
@ -170,7 +174,6 @@ void gimp_image_construct (GimpImage *, int, int, int, i
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int); void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
int gimp_image_is_empty (GimpImage *); int gimp_image_is_empty (GimpImage *);

View file

@ -25,7 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->dirty = 1; gimage->dirty = 1;
gimage->undo_on = TRUE; gimage->undo_on = TRUE;
gimage->construct_flag = -1; gimage->construct_flag = -1;
gimage->tattoo_state = 0;
gimage->projection = NULL; gimage->projection = NULL;
gimage->guides = NULL; gimage->guides = NULL;
gimage->layers = NULL; gimage->layers = NULL;
@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL; gimage->parasites = NULL;
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage,
Parasite * Parasite *
gimp_image_find_parasite (const GimpImage *gimage, gimp_image_find_parasite (const GimpImage *gimage, const char *name)
const char *creator, const char *type)
{ {
return parasite_find_in_gslist(gimage->parasites, creator, type); return parasite_find_in_gslist(gimage->parasites, name);
} }
void void
@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
} }
void void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
{ {
gimage->parasites = g_slist_remove (gimage->parasites, parasite); Parasite *p;
parasite_free(parasite); if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
gimage->parasites = g_slist_remove (gimage->parasites, p);
parasite_free(p);
} }
guint32
gimp_image_get_new_tattoo(GimpImage *image)
{
return (++image->tattoo_state);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/
@ -1395,6 +1405,41 @@ gimp_image_get_active_channel (GimpImage *gimage)
} }
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Layer *layer;
GSList *layers = gimage->layers;
while (layers)
{
layer = (Layer *) layers->data;
if (layer_get_tattoo(layer) == tattoo)
return layer;
layers = g_slist_next (layers);
}
return NULL;
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Channel *channel;
GSList *channels = gimage->channels;
while (channels)
{
channel = (Channel *) channels->data;
if (channel_get_tattoo(channel) == tattoo)
return channel;
channels = g_slist_next (channels);
}
return NULL;
}
int int
gimp_image_get_component_active (GimpImage *gimage, ChannelType type) gimp_image_get_component_active (GimpImage *gimage, ChannelType type)
{ {
@ -2119,8 +2164,8 @@ gimp_image_add_layer (GimpImage *gimage, Layer *float_layer, int position)
gimage->floating_sel = float_layer; gimage->floating_sel = float_layer;
/* let the layer know about the gimage */ /* let the layer know about the gimage */
GIMP_DRAWABLE(float_layer)->gimage = gimage; gimp_drawable_set_gimage(GIMP_DRAWABLE(float_layer), gimage);
/* add the layer to the list at the specified position */ /* add the layer to the list at the specified position */
if (position == -1) if (position == -1)
position = gimp_image_get_layer_index (gimage, gimage->active_layer); position = gimp_image_get_layer_index (gimage, gimage->active_layer);

View file

@ -8,7 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h" #include <libgimp/parasiteF.h>
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator, const char *name);
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *); void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *); void gimp_image_detach_parasite (GimpImage *, const char *);
guint32 gimp_image_get_new_tattoo (GimpImage *);
/* layer/channel functions */ /* layer/channel functions */
@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *); int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *); Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *); Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_mask (GimpImage *); Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType); int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType); int gimp_image_get_component_visible (GimpImage *, ChannelType);
@ -170,7 +174,6 @@ void gimp_image_construct (GimpImage *, int, int, int, i
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int); void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
int gimp_image_is_empty (GimpImage *); int gimp_image_is_empty (GimpImage *);

View file

@ -25,7 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->dirty = 1; gimage->dirty = 1;
gimage->undo_on = TRUE; gimage->undo_on = TRUE;
gimage->construct_flag = -1; gimage->construct_flag = -1;
gimage->tattoo_state = 0;
gimage->projection = NULL; gimage->projection = NULL;
gimage->guides = NULL; gimage->guides = NULL;
gimage->layers = NULL; gimage->layers = NULL;
@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL; gimage->parasites = NULL;
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage,
Parasite * Parasite *
gimp_image_find_parasite (const GimpImage *gimage, gimp_image_find_parasite (const GimpImage *gimage, const char *name)
const char *creator, const char *type)
{ {
return parasite_find_in_gslist(gimage->parasites, creator, type); return parasite_find_in_gslist(gimage->parasites, name);
} }
void void
@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
} }
void void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
{ {
gimage->parasites = g_slist_remove (gimage->parasites, parasite); Parasite *p;
parasite_free(parasite); if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
gimage->parasites = g_slist_remove (gimage->parasites, p);
parasite_free(p);
} }
guint32
gimp_image_get_new_tattoo(GimpImage *image)
{
return (++image->tattoo_state);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/
@ -1395,6 +1405,41 @@ gimp_image_get_active_channel (GimpImage *gimage)
} }
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Layer *layer;
GSList *layers = gimage->layers;
while (layers)
{
layer = (Layer *) layers->data;
if (layer_get_tattoo(layer) == tattoo)
return layer;
layers = g_slist_next (layers);
}
return NULL;
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Channel *channel;
GSList *channels = gimage->channels;
while (channels)
{
channel = (Channel *) channels->data;
if (channel_get_tattoo(channel) == tattoo)
return channel;
channels = g_slist_next (channels);
}
return NULL;
}
int int
gimp_image_get_component_active (GimpImage *gimage, ChannelType type) gimp_image_get_component_active (GimpImage *gimage, ChannelType type)
{ {
@ -2119,8 +2164,8 @@ gimp_image_add_layer (GimpImage *gimage, Layer *float_layer, int position)
gimage->floating_sel = float_layer; gimage->floating_sel = float_layer;
/* let the layer know about the gimage */ /* let the layer know about the gimage */
GIMP_DRAWABLE(float_layer)->gimage = gimage; gimp_drawable_set_gimage(GIMP_DRAWABLE(float_layer), gimage);
/* add the layer to the list at the specified position */ /* add the layer to the list at the specified position */
if (position == -1) if (position == -1)
position = gimp_image_get_layer_index (gimage, gimage->active_layer); position = gimp_image_get_layer_index (gimage, gimage->active_layer);

View file

@ -8,7 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h" #include <libgimp/parasiteF.h>
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator, const char *name);
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *); void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *); void gimp_image_detach_parasite (GimpImage *, const char *);
guint32 gimp_image_get_new_tattoo (GimpImage *);
/* layer/channel functions */ /* layer/channel functions */
@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *); int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *); Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *); Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_mask (GimpImage *); Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType); int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType); int gimp_image_get_component_visible (GimpImage *, ChannelType);
@ -170,7 +174,6 @@ void gimp_image_construct (GimpImage *, int, int, int, i
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int); void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
int gimp_image_is_empty (GimpImage *); int gimp_image_is_empty (GimpImage *);

View file

@ -25,7 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->dirty = 1; gimage->dirty = 1;
gimage->undo_on = TRUE; gimage->undo_on = TRUE;
gimage->construct_flag = -1; gimage->construct_flag = -1;
gimage->tattoo_state = 0;
gimage->projection = NULL; gimage->projection = NULL;
gimage->guides = NULL; gimage->guides = NULL;
gimage->layers = NULL; gimage->layers = NULL;
@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL; gimage->parasites = NULL;
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage,
Parasite * Parasite *
gimp_image_find_parasite (const GimpImage *gimage, gimp_image_find_parasite (const GimpImage *gimage, const char *name)
const char *creator, const char *type)
{ {
return parasite_find_in_gslist(gimage->parasites, creator, type); return parasite_find_in_gslist(gimage->parasites, name);
} }
void void
@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
} }
void void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
{ {
gimage->parasites = g_slist_remove (gimage->parasites, parasite); Parasite *p;
parasite_free(parasite); if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
gimage->parasites = g_slist_remove (gimage->parasites, p);
parasite_free(p);
} }
guint32
gimp_image_get_new_tattoo(GimpImage *image)
{
return (++image->tattoo_state);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/
@ -1395,6 +1405,41 @@ gimp_image_get_active_channel (GimpImage *gimage)
} }
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Layer *layer;
GSList *layers = gimage->layers;
while (layers)
{
layer = (Layer *) layers->data;
if (layer_get_tattoo(layer) == tattoo)
return layer;
layers = g_slist_next (layers);
}
return NULL;
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Channel *channel;
GSList *channels = gimage->channels;
while (channels)
{
channel = (Channel *) channels->data;
if (channel_get_tattoo(channel) == tattoo)
return channel;
channels = g_slist_next (channels);
}
return NULL;
}
int int
gimp_image_get_component_active (GimpImage *gimage, ChannelType type) gimp_image_get_component_active (GimpImage *gimage, ChannelType type)
{ {
@ -2119,8 +2164,8 @@ gimp_image_add_layer (GimpImage *gimage, Layer *float_layer, int position)
gimage->floating_sel = float_layer; gimage->floating_sel = float_layer;
/* let the layer know about the gimage */ /* let the layer know about the gimage */
GIMP_DRAWABLE(float_layer)->gimage = gimage; gimp_drawable_set_gimage(GIMP_DRAWABLE(float_layer), gimage);
/* add the layer to the list at the specified position */ /* add the layer to the list at the specified position */
if (position == -1) if (position == -1)
position = gimp_image_get_layer_index (gimage, gimage->active_layer); position = gimp_image_get_layer_index (gimage, gimage->active_layer);

View file

@ -8,7 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h" #include <libgimp/parasiteF.h>
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator, const char *name);
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *); void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *); void gimp_image_detach_parasite (GimpImage *, const char *);
guint32 gimp_image_get_new_tattoo (GimpImage *);
/* layer/channel functions */ /* layer/channel functions */
@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *); int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *); Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *); Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_mask (GimpImage *); Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType); int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType); int gimp_image_get_component_visible (GimpImage *, ChannelType);
@ -170,7 +174,6 @@ void gimp_image_construct (GimpImage *, int, int, int, i
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int); void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
int gimp_image_is_empty (GimpImage *); int gimp_image_is_empty (GimpImage *);

View file

@ -25,7 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->dirty = 1; gimage->dirty = 1;
gimage->undo_on = TRUE; gimage->undo_on = TRUE;
gimage->construct_flag = -1; gimage->construct_flag = -1;
gimage->tattoo_state = 0;
gimage->projection = NULL; gimage->projection = NULL;
gimage->guides = NULL; gimage->guides = NULL;
gimage->layers = NULL; gimage->layers = NULL;
@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL; gimage->parasites = NULL;
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage,
Parasite * Parasite *
gimp_image_find_parasite (const GimpImage *gimage, gimp_image_find_parasite (const GimpImage *gimage, const char *name)
const char *creator, const char *type)
{ {
return parasite_find_in_gslist(gimage->parasites, creator, type); return parasite_find_in_gslist(gimage->parasites, name);
} }
void void
@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
} }
void void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
{ {
gimage->parasites = g_slist_remove (gimage->parasites, parasite); Parasite *p;
parasite_free(parasite); if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
gimage->parasites = g_slist_remove (gimage->parasites, p);
parasite_free(p);
} }
guint32
gimp_image_get_new_tattoo(GimpImage *image)
{
return (++image->tattoo_state);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/
@ -1395,6 +1405,41 @@ gimp_image_get_active_channel (GimpImage *gimage)
} }
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Layer *layer;
GSList *layers = gimage->layers;
while (layers)
{
layer = (Layer *) layers->data;
if (layer_get_tattoo(layer) == tattoo)
return layer;
layers = g_slist_next (layers);
}
return NULL;
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Channel *channel;
GSList *channels = gimage->channels;
while (channels)
{
channel = (Channel *) channels->data;
if (channel_get_tattoo(channel) == tattoo)
return channel;
channels = g_slist_next (channels);
}
return NULL;
}
int int
gimp_image_get_component_active (GimpImage *gimage, ChannelType type) gimp_image_get_component_active (GimpImage *gimage, ChannelType type)
{ {
@ -2119,8 +2164,8 @@ gimp_image_add_layer (GimpImage *gimage, Layer *float_layer, int position)
gimage->floating_sel = float_layer; gimage->floating_sel = float_layer;
/* let the layer know about the gimage */ /* let the layer know about the gimage */
GIMP_DRAWABLE(float_layer)->gimage = gimage; gimp_drawable_set_gimage(GIMP_DRAWABLE(float_layer), gimage);
/* add the layer to the list at the specified position */ /* add the layer to the list at the specified position */
if (position == -1) if (position == -1)
position = gimp_image_get_layer_index (gimage, gimage->active_layer); position = gimp_image_get_layer_index (gimage, gimage->active_layer);

View file

@ -8,7 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h" #include <libgimp/parasiteF.h>
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator, const char *name);
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *); void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *); void gimp_image_detach_parasite (GimpImage *, const char *);
guint32 gimp_image_get_new_tattoo (GimpImage *);
/* layer/channel functions */ /* layer/channel functions */
@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *); int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *); Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *); Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_mask (GimpImage *); Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType); int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType); int gimp_image_get_component_visible (GimpImage *, ChannelType);
@ -170,7 +174,6 @@ void gimp_image_construct (GimpImage *, int, int, int, i
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int); void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
int gimp_image_is_empty (GimpImage *); int gimp_image_is_empty (GimpImage *);

View file

@ -1170,6 +1170,11 @@ layer_mask_preview (layer, w, h)
} }
} }
guint32
layer_get_tattoo(const Layer *layer)
{
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(layer)));
}
void void
layer_invalidate_previews (GimpImage* gimage) layer_invalidate_previews (GimpImage* gimage)

View file

@ -119,6 +119,7 @@ TempBuf * layer_preview (Layer *, int, int);
TempBuf * layer_mask_preview (Layer *, int, int); TempBuf * layer_mask_preview (Layer *, int, int);
void layer_invalidate_previews (GimpImage*); void layer_invalidate_previews (GimpImage*);
guint32 layer_get_tattoo(const Layer *);
#define drawable_layer GIMP_IS_LAYER #define drawable_layer GIMP_IS_LAYER

View file

@ -25,7 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->dirty = 1; gimage->dirty = 1;
gimage->undo_on = TRUE; gimage->undo_on = TRUE;
gimage->construct_flag = -1; gimage->construct_flag = -1;
gimage->tattoo_state = 0;
gimage->projection = NULL; gimage->projection = NULL;
gimage->guides = NULL; gimage->guides = NULL;
gimage->layers = NULL; gimage->layers = NULL;
@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL; gimage->parasites = NULL;
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage,
Parasite * Parasite *
gimp_image_find_parasite (const GimpImage *gimage, gimp_image_find_parasite (const GimpImage *gimage, const char *name)
const char *creator, const char *type)
{ {
return parasite_find_in_gslist(gimage->parasites, creator, type); return parasite_find_in_gslist(gimage->parasites, name);
} }
void void
@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
} }
void void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
{ {
gimage->parasites = g_slist_remove (gimage->parasites, parasite); Parasite *p;
parasite_free(parasite); if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
gimage->parasites = g_slist_remove (gimage->parasites, p);
parasite_free(p);
} }
guint32
gimp_image_get_new_tattoo(GimpImage *image)
{
return (++image->tattoo_state);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/
@ -1395,6 +1405,41 @@ gimp_image_get_active_channel (GimpImage *gimage)
} }
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Layer *layer;
GSList *layers = gimage->layers;
while (layers)
{
layer = (Layer *) layers->data;
if (layer_get_tattoo(layer) == tattoo)
return layer;
layers = g_slist_next (layers);
}
return NULL;
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Channel *channel;
GSList *channels = gimage->channels;
while (channels)
{
channel = (Channel *) channels->data;
if (channel_get_tattoo(channel) == tattoo)
return channel;
channels = g_slist_next (channels);
}
return NULL;
}
int int
gimp_image_get_component_active (GimpImage *gimage, ChannelType type) gimp_image_get_component_active (GimpImage *gimage, ChannelType type)
{ {
@ -2119,8 +2164,8 @@ gimp_image_add_layer (GimpImage *gimage, Layer *float_layer, int position)
gimage->floating_sel = float_layer; gimage->floating_sel = float_layer;
/* let the layer know about the gimage */ /* let the layer know about the gimage */
GIMP_DRAWABLE(float_layer)->gimage = gimage; gimp_drawable_set_gimage(GIMP_DRAWABLE(float_layer), gimage);
/* add the layer to the list at the specified position */ /* add the layer to the list at the specified position */
if (position == -1) if (position == -1)
position = gimp_image_get_layer_index (gimage, gimage->active_layer); position = gimp_image_get_layer_index (gimage, gimage->active_layer);

View file

@ -8,7 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h" #include <libgimp/parasiteF.h>
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator, const char *name);
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *); void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *); void gimp_image_detach_parasite (GimpImage *, const char *);
guint32 gimp_image_get_new_tattoo (GimpImage *);
/* layer/channel functions */ /* layer/channel functions */
@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *); int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *); Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *); Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_mask (GimpImage *); Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType); int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType); int gimp_image_get_component_visible (GimpImage *, ChannelType);
@ -170,7 +174,6 @@ void gimp_image_construct (GimpImage *, int, int, int, i
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int); void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
int gimp_image_is_empty (GimpImage *); int gimp_image_is_empty (GimpImage *);

View file

@ -22,7 +22,7 @@
#include "gimage.h" #include "gimage.h"
#include "drawable.h" #include "drawable.h"
#include "drawable_cmds.h" #include "drawable_cmds.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "tile.h" /* ick. */ #include "tile.h" /* ick. */
@ -1461,13 +1461,9 @@ ProcArg gimp_drawable_find_parasite_args[] =
"the input drawable" "the input drawable"
}, },
{ PDB_STRING, { PDB_STRING,
"creator", "name",
"The creator ID of the parasite to find" "The name of the parasite to find"
}, },
{ PDB_STRING,
"type",
"The type ID of the parasite to find"
}
}; };
ProcArg gimp_drawable_find_parasite_out_args[] = ProcArg gimp_drawable_find_parasite_out_args[] =
@ -1481,15 +1477,15 @@ ProcArg gimp_drawable_find_parasite_out_args[] =
ProcRecord gimp_drawable_find_parasite_proc = ProcRecord gimp_drawable_find_parasite_proc =
{ {
"gimp_drawable_find_parasite", "gimp_drawable_find_parasite",
"Finds a parasite of a specified type and creator in an drawable.", "Finds a parasite in a drawable.",
"Finds a parasite of a specified type and creator in an drawable.", "Finds a parasite in a drawable.",
"Jay Cox", "Jay Cox",
"Jay Cox", "Jay Cox",
"1998", "1998",
PDB_INTERNAL, PDB_INTERNAL,
/* Input arguments */ /* Input arguments */
3, 2,
gimp_drawable_find_parasite_args, gimp_drawable_find_parasite_args,
/* Output arguments */ /* Output arguments */
@ -1507,7 +1503,7 @@ gimp_drawable_find_parasite_invoker (Argument *args)
int int_value; int int_value;
GimpDrawable *gdrawable; GimpDrawable *gdrawable;
Argument *return_args; Argument *return_args;
char *creator, *type; char *name = NULL;
/* the GimpDrawable */ /* the GimpDrawable */
if (success) if (success)
@ -1520,13 +1516,7 @@ gimp_drawable_find_parasite_invoker (Argument *args)
/* creator */ /* creator */
if (success) if (success)
{ {
creator = (char *) args[1].value.pdb_pointer; name = (char *) args[1].value.pdb_pointer;
}
/* type */
if (success)
{
type = (char *) args[2].value.pdb_pointer;
} }
return_args = procedural_db_return_args (&gimp_drawable_find_parasite_proc, return_args = procedural_db_return_args (&gimp_drawable_find_parasite_proc,
@ -1535,7 +1525,7 @@ gimp_drawable_find_parasite_invoker (Argument *args)
if (success) if (success)
{ {
return_args[1].value.pdb_pointer = return_args[1].value.pdb_pointer =
gimp_drawable_find_parasite (gdrawable, creator, type); gimp_drawable_find_parasite (gdrawable, name);
if (return_args[1].value.pdb_pointer == NULL) if (return_args[1].value.pdb_pointer == NULL)
return_args[1].value.pdb_pointer = parasite_error(); return_args[1].value.pdb_pointer = parasite_error();
} }
@ -1625,9 +1615,9 @@ ProcArg gimp_drawable_detach_parasite_args[] =
"drawable", "drawable",
"the input drawable" "the input drawable"
}, },
{ PDB_PARASITE, { PDB_STRING,
"parasite", "parasite",
"The parasite to detach to the drawable" "The name of the parasite to detach from the drawable"
} }
}; };
@ -1660,7 +1650,7 @@ gimp_drawable_detach_parasite_invoker (Argument *args)
int success = TRUE; int success = TRUE;
int int_value; int int_value;
GimpDrawable *gdrawable; GimpDrawable *gdrawable;
Parasite *parasite = NULL; char *parasite = NULL;
Argument *return_args; Argument *return_args;
@ -1674,7 +1664,7 @@ gimp_drawable_detach_parasite_invoker (Argument *args)
if (success) if (success)
{ {
parasite = (Parasite *)args[1].value.pdb_pointer; parasite = (char *)args[1].value.pdb_pointer;
if (parasite == NULL) if (parasite == NULL)
success = FALSE; success = FALSE;
} }

View file

@ -25,7 +25,7 @@
#include "gimage.h" #include "gimage.h"
#include "gimage_cmds.h" #include "gimage_cmds.h"
#include "floating_sel.h" #include "floating_sel.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "undo.h" #include "undo.h"
#include "layer_pvt.h" /* ick. */ #include "layer_pvt.h" /* ick. */
@ -3511,7 +3511,8 @@ duplicate (GImage *gimage)
list = g_slist_next (list); list = g_slist_next (list);
new_layer = layer_copy (layer, FALSE); new_layer = layer_copy (layer, FALSE);
GIMP_DRAWABLE(new_layer)->gimage = new_gimage;
gimp_drawable_set_gimage(GIMP_DRAWABLE(new_layer), new_gimage);
/* Make sure the copied layer doesn't say: "<old layer> copy" */ /* Make sure the copied layer doesn't say: "<old layer> copy" */
layer_set_name(GIMP_LAYER(new_layer), layer_set_name(GIMP_LAYER(new_layer),
@ -3547,7 +3548,8 @@ duplicate (GImage *gimage)
list = g_slist_next (list); list = g_slist_next (list);
new_channel = channel_copy (channel); new_channel = channel_copy (channel);
GIMP_DRAWABLE(new_channel)->gimage = new_gimage;
gimp_drawable_set_gimage(GIMP_DRAWABLE(new_channel), new_gimage);
/* Make sure the copied channel doesn't say: "<old channel> copy" */ /* Make sure the copied channel doesn't say: "<old channel> copy" */
gimp_drawable_set_name(GIMP_DRAWABLE(new_channel), gimp_drawable_set_name(GIMP_DRAWABLE(new_channel),
@ -4324,13 +4326,9 @@ ProcArg gimp_image_find_parasite_args[] =
"the input image" "the input image"
}, },
{ PDB_STRING, { PDB_STRING,
"creator", "name",
"The creator ID of the parasite to find" "The name of the parasite to find"
}, },
{ PDB_STRING,
"type",
"The type ID of the parasite to find"
}
}; };
ProcArg gimp_image_find_parasite_out_args[] = ProcArg gimp_image_find_parasite_out_args[] =
@ -4352,7 +4350,7 @@ ProcRecord gimp_image_find_parasite_proc =
PDB_INTERNAL, PDB_INTERNAL,
/* Input arguments */ /* Input arguments */
3, 2,
gimp_image_find_parasite_args, gimp_image_find_parasite_args,
/* Output arguments */ /* Output arguments */
@ -4371,7 +4369,7 @@ gimp_image_find_parasite_invoker (Argument *args)
int int_value; int int_value;
GImage *gimage; GImage *gimage;
Argument *return_args; Argument *return_args;
char *creator, *type; char *name = NULL;
/* the gimage */ /* the gimage */
if (success) if (success)
@ -4381,16 +4379,10 @@ gimp_image_find_parasite_invoker (Argument *args)
success = FALSE; success = FALSE;
} }
/* creator */ /* name */
if (success) if (success)
{ {
creator = (char *) args[1].value.pdb_pointer; name = (char *) args[1].value.pdb_pointer;
}
/* type */
if (success)
{
type = (char *) args[2].value.pdb_pointer;
} }
return_args = procedural_db_return_args (&gimp_image_find_parasite_proc, return_args = procedural_db_return_args (&gimp_image_find_parasite_proc,
@ -4399,7 +4391,7 @@ gimp_image_find_parasite_invoker (Argument *args)
if (success) if (success)
{ {
return_args[1].value.pdb_pointer = return_args[1].value.pdb_pointer =
gimp_image_find_parasite (gimage, creator, type); gimp_image_find_parasite (gimage, name);
if (return_args[1].value.pdb_pointer == NULL) if (return_args[1].value.pdb_pointer == NULL)
return_args[1].value.pdb_pointer = parasite_error(); return_args[1].value.pdb_pointer = parasite_error();
} }
@ -4489,16 +4481,16 @@ ProcArg gimp_image_detach_parasite_args[] =
"image", "image",
"the input image" "the input image"
}, },
{ PDB_PARASITE, { PDB_STRING,
"parasite", "name",
"The parasite to detach to the image" "The name of the parasite to detach from the image"
} }
}; };
ProcRecord gimp_image_detach_parasite_proc = ProcRecord gimp_image_detach_parasite_proc =
{ {
"gimp_image_detach_parasite", "gimp_image_detach_parasite",
"Add a parasite to an image", "Removes a parasite from an image",
"This procedure detaches a parasite to an image. It has no return values.", "This procedure detaches a parasite to an image. It has no return values.",
"Jay Cox", "Jay Cox",
"Jay Cox", "Jay Cox",
@ -4524,7 +4516,7 @@ gimp_image_detach_parasite_invoker (Argument *args)
int success = TRUE; int success = TRUE;
int int_value; int int_value;
GImage *gimage; GImage *gimage;
Parasite *parasite = NULL; char *parasite = NULL;
Argument *return_args; Argument *return_args;
@ -4538,7 +4530,7 @@ gimp_image_detach_parasite_invoker (Argument *args)
if (success) if (success)
{ {
parasite = (Parasite *)args[1].value.pdb_pointer; parasite = (char *)args[1].value.pdb_pointer;
if (parasite == NULL) if (parasite == NULL)
success = FALSE; success = FALSE;
} }

View file

@ -27,7 +27,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "layer.h" #include "layer.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -475,6 +475,12 @@ channel_invalidate_previews (GimpImage* gimage)
} }
} }
guint32
channel_get_tattoo(const Channel *channel)
{
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(channel)));
}
/****************************/ /****************************/
/* selection mask functions */ /* selection mask functions */

View file

@ -95,6 +95,8 @@ int channel_toggle_visibility (Channel *);
TempBuf * channel_preview (Channel *, int, int); TempBuf * channel_preview (Channel *, int, int);
void channel_invalidate_previews (GimpImage*); void channel_invalidate_previews (GimpImage*);
guint32 channel_get_tattoo(const Channel *);
/* selection mask functions */ /* selection mask functions */

View file

@ -24,7 +24,7 @@
#include "gimpsignal.h" #include "gimpsignal.h"
#include "gimage.h" #include "gimage.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "parasite.h" #include "libgimp/parasite.h"
enum { enum {
@ -255,6 +255,18 @@ gimp_drawable_gimage (GimpDrawable *drawable)
} }
void
gimp_drawable_set_gimage (GimpDrawable *drawable, GimpImage *gimage)
{
g_assert(GIMP_IS_DRAWABLE(drawable));
drawable->gimage = gimage;
if (gimage == NULL)
drawable->tattoo = 0;
else
drawable->tattoo = gimp_image_get_new_tattoo(gimage);
}
int int
gimp_drawable_type (GimpDrawable *drawable) gimp_drawable_type (GimpDrawable *drawable)
{ {
@ -361,10 +373,9 @@ gimp_drawable_set_name (GimpDrawable *drawable, char *name)
Parasite * Parasite *
gimp_drawable_find_parasite (const GimpDrawable *drawable, gimp_drawable_find_parasite (const GimpDrawable *drawable, const char *name)
const char *creator, const char *type)
{ {
return parasite_find_in_gslist(drawable->parasites, creator, type); return parasite_find_in_gslist(drawable->parasites, name);
} }
void void
@ -374,12 +385,19 @@ gimp_drawable_attach_parasite (GimpDrawable *drawable, const Parasite *parasite)
} }
void void
gimp_drawable_detach_parasite (GimpDrawable *drawable, Parasite *parasite) gimp_drawable_detach_parasite (GimpDrawable *drawable, const char *parasite)
{ {
drawable->parasites = g_slist_remove (drawable->parasites, parasite); Parasite *p;
parasite_free(parasite); if ((p = parasite_find_in_gslist(drawable->parasites, parasite)))
drawable->parasites = g_slist_remove (drawable->parasites, p);
parasite_free(p);
} }
guint32
gimp_drawable_get_tattoo(const GimpDrawable *drawable)
{
return drawable->tattoo;
}
int int
gimp_drawable_type_with_alpha (GimpDrawable *drawable) gimp_drawable_type_with_alpha (GimpDrawable *drawable)
@ -539,6 +557,8 @@ gimp_drawable_init (GimpDrawable *drawable)
drawable->preview = NULL; drawable->preview = NULL;
drawable->preview_valid = FALSE; drawable->preview_valid = FALSE;
drawable->parasites = FALSE; drawable->parasites = FALSE;
drawable->tattoo = 0;
gimp_matrix_identity(drawable->transform);
drawable->ID = global_drawable_ID++; drawable->ID = global_drawable_ID++;
if (gimp_drawable_table == NULL) if (gimp_drawable_table == NULL)
@ -619,7 +639,8 @@ gimp_drawable_configure (GimpDrawable *drawable,
drawable->dirty = FALSE; drawable->dirty = FALSE;
drawable->visible = TRUE; drawable->visible = TRUE;
drawable->gimage = gimage; if (gimage)
gimp_drawable_set_gimage(drawable, gimage);
gimp_drawable_set_name(drawable, name); gimp_drawable_set_name(drawable, name);

View file

@ -23,7 +23,7 @@
#include "tile_manager.h" #include "tile_manager.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "gimpimageF.h" #include "gimpimageF.h"
#include "parasiteF.h" #include <libgimp/parasiteF.h>
#define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ()) #define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ())
#define GIMP_DRAWABLE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DRAWABLE, GimpDrawable)) #define GIMP_DRAWABLE(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DRAWABLE, GimpDrawable))
@ -74,14 +74,16 @@ char * gimp_drawable_get_name (GimpDrawable *);
void gimp_drawable_set_name (GimpDrawable *, char *); void gimp_drawable_set_name (GimpDrawable *, char *);
Parasite * gimp_drawable_find_parasite (const GimpDrawable *, Parasite * gimp_drawable_find_parasite (const GimpDrawable *,
const char *creator, const char *name);
const char *type);
void gimp_drawable_attach_parasite (GimpDrawable *, const Parasite *); void gimp_drawable_attach_parasite (GimpDrawable *, const Parasite *);
void gimp_drawable_detach_parasite (GimpDrawable *, Parasite *); void gimp_drawable_detach_parasite (GimpDrawable *,
const char *);
guint32 gimp_drawable_get_tattoo (const GimpDrawable *);
GimpDrawable * gimp_drawable_get_ID (int); GimpDrawable * gimp_drawable_get_ID (int);
void gimp_drawable_deallocate (GimpDrawable *); void gimp_drawable_deallocate (GimpDrawable *);
GimpImage * gimp_drawable_gimage (GimpDrawable*); GimpImage * gimp_drawable_gimage (GimpDrawable*);
void gimp_drawable_set_gimage (GimpDrawable*, GimpImage *);
#endif /* __GIMPDRAWABLE_H__ */ #endif /* __GIMPDRAWABLE_H__ */

View file

@ -20,6 +20,7 @@
#include "gimpobjectP.h" #include "gimpobjectP.h"
#include "gimpdrawable.h" #include "gimpdrawable.h"
#include "libgimp/gimpmatrix.h"
struct _GimpDrawable struct _GimpDrawable
{ {
@ -34,12 +35,17 @@ struct _GimpDrawable
int bytes; /* bytes per pixel */ int bytes; /* bytes per pixel */
int dirty; /* dirty bit */ int dirty; /* dirty bit */
int ID; /* provides a unique ID */ int ID; /* provides a unique ID */
guint32 tattoo; /* provides a perminant ID */
GimpImage* gimage; /* gimage owner */ GimpImage* gimage; /* gimage owner */
int type; /* type of drawable */ int type; /* type of drawable */
int has_alpha; /* drawable has alpha */ int has_alpha; /* drawable has alpha */
GSList *parasites; /* Plug-in parasite data */ GSList *parasites; /* Plug-in parasite data */
GimpMatrix transform; /* a matrix describing all of the
transformations this drawable
has undergone */
/* Preview variables */ /* Preview variables */
TempBuf *preview; /* preview of the channel */ TempBuf *preview; /* preview of the channel */
int preview_valid; /* is the preview valid? */ int preview_valid; /* is the preview valid? */

View file

@ -25,7 +25,7 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "undo.h" #include "undo.h"
#include "gimpsignal.h" #include "gimpsignal.h"
@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->dirty = 1; gimage->dirty = 1;
gimage->undo_on = TRUE; gimage->undo_on = TRUE;
gimage->construct_flag = -1; gimage->construct_flag = -1;
gimage->tattoo_state = 0;
gimage->projection = NULL; gimage->projection = NULL;
gimage->guides = NULL; gimage->guides = NULL;
gimage->layers = NULL; gimage->layers = NULL;
@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
gimage->parasites = NULL; gimage->parasites = NULL;
gimp_matrix_identity(gimage->transform);
gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ gimage->resolution = 72.0; /* maybe should be rc-supplied default? */
} }
@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage,
Parasite * Parasite *
gimp_image_find_parasite (const GimpImage *gimage, gimp_image_find_parasite (const GimpImage *gimage, const char *name)
const char *creator, const char *type)
{ {
return parasite_find_in_gslist(gimage->parasites, creator, type); return parasite_find_in_gslist(gimage->parasites, name);
} }
void void
@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite)
} }
void void
gimp_image_detach_parasite (GimpImage *gimage, Parasite *parasite) gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
{ {
gimage->parasites = g_slist_remove (gimage->parasites, parasite); Parasite *p;
parasite_free(parasite); if ((p = parasite_find_in_gslist(gimage->parasites, parasite)))
gimage->parasites = g_slist_remove (gimage->parasites, p);
parasite_free(p);
} }
guint32
gimp_image_get_new_tattoo(GimpImage *image)
{
return (++image->tattoo_state);
}
/************************************************************/ /************************************************************/
/* Projection functions */ /* Projection functions */
/************************************************************/ /************************************************************/
@ -1395,6 +1405,41 @@ gimp_image_get_active_channel (GimpImage *gimage)
} }
Layer *
gimp_image_get_layer_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Layer *layer;
GSList *layers = gimage->layers;
while (layers)
{
layer = (Layer *) layers->data;
if (layer_get_tattoo(layer) == tattoo)
return layer;
layers = g_slist_next (layers);
}
return NULL;
}
Channel *
gimp_image_get_channel_by_tattoo (GimpImage *gimage, guint32 tattoo)
{
Channel *channel;
GSList *channels = gimage->channels;
while (channels)
{
channel = (Channel *) channels->data;
if (channel_get_tattoo(channel) == tattoo)
return channel;
channels = g_slist_next (channels);
}
return NULL;
}
int int
gimp_image_get_component_active (GimpImage *gimage, ChannelType type) gimp_image_get_component_active (GimpImage *gimage, ChannelType type)
{ {
@ -2119,8 +2164,8 @@ gimp_image_add_layer (GimpImage *gimage, Layer *float_layer, int position)
gimage->floating_sel = float_layer; gimage->floating_sel = float_layer;
/* let the layer know about the gimage */ /* let the layer know about the gimage */
GIMP_DRAWABLE(float_layer)->gimage = gimage; gimp_drawable_set_gimage(GIMP_DRAWABLE(float_layer), gimage);
/* add the layer to the list at the specified position */ /* add the layer to the list at the specified position */
if (position == -1) if (position == -1)
position = gimp_image_get_layer_index (gimage, gimage->active_layer); position = gimp_image_get_layer_index (gimage, gimage->active_layer);

View file

@ -8,7 +8,7 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "parasiteF.h" #include <libgimp/parasiteF.h>
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *);
void gimp_image_delete_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *);
Parasite * gimp_image_find_parasite (const GimpImage *, Parasite * gimp_image_find_parasite (const GimpImage *,
const char *creator, const char *name);
const char *type);
void gimp_image_attach_parasite (GimpImage *, const Parasite *); void gimp_image_attach_parasite (GimpImage *, const Parasite *);
void gimp_image_detach_parasite (GimpImage *, Parasite *); void gimp_image_detach_parasite (GimpImage *, const char *);
guint32 gimp_image_get_new_tattoo (GimpImage *);
/* layer/channel functions */ /* layer/channel functions */
@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *);
int gimp_image_get_channel_index (GimpImage *, Channel *); int gimp_image_get_channel_index (GimpImage *, Channel *);
Layer * gimp_image_get_active_layer (GimpImage *); Layer * gimp_image_get_active_layer (GimpImage *);
Channel * gimp_image_get_active_channel (GimpImage *); Channel * gimp_image_get_active_channel (GimpImage *);
Layer * gimp_image_get_layer_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_channel_by_tattoo (GimpImage *, guint32);
Channel * gimp_image_get_mask (GimpImage *); Channel * gimp_image_get_mask (GimpImage *);
int gimp_image_get_component_active (GimpImage *, ChannelType); int gimp_image_get_component_active (GimpImage *, ChannelType);
int gimp_image_get_component_visible (GimpImage *, ChannelType); int gimp_image_get_component_visible (GimpImage *, ChannelType);
@ -170,7 +174,6 @@ void gimp_image_construct (GimpImage *, int, int, int, i
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int); void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *); void gimp_image_validate (TileManager *, Tile *);
/* Access functions */ /* Access functions */
int gimp_image_is_empty (GimpImage *); int gimp_image_is_empty (GimpImage *);

View file

@ -8,6 +8,7 @@
#include "temp_buf.h" #include "temp_buf.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "libgimp/gimpmatrix.h"
#define MAX_CHANNELS 4 #define MAX_CHANNELS 4
@ -31,6 +32,8 @@ struct _GimpImage
int instance_count; /* number of instances */ int instance_count; /* number of instances */
int ref_count; /* number of references */ int ref_count; /* number of references */
guint32 tattoo_state; /* the next unique tattoo to use*/
TileManager *shadow; /* shadow buffer tiles */ TileManager *shadow; /* shadow buffer tiles */
/* Projection attributes */ /* Projection attributes */
@ -55,6 +58,10 @@ struct _GimpImage
GSList *parasites; /* Plug-in parasite data */ GSList *parasites; /* Plug-in parasite data */
GimpMatrix transform; /* a matrix describing all of the
transformations this image
has undergone */
int visible [MAX_CHANNELS]; /* visible channels */ int visible [MAX_CHANNELS]; /* visible channels */
int active [MAX_CHANNELS]; /* active channels */ int active [MAX_CHANNELS]; /* active channels */

View file

@ -1170,6 +1170,11 @@ layer_mask_preview (layer, w, h)
} }
} }
guint32
layer_get_tattoo(const Layer *layer)
{
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(layer)));
}
void void
layer_invalidate_previews (GimpImage* gimage) layer_invalidate_previews (GimpImage* gimage)

View file

@ -119,6 +119,7 @@ TempBuf * layer_preview (Layer *, int, int);
TempBuf * layer_mask_preview (Layer *, int, int); TempBuf * layer_mask_preview (Layer *, int, int);
void layer_invalidate_previews (GimpImage*); void layer_invalidate_previews (GimpImage*);
guint32 layer_get_tattoo(const Layer *);
#define drawable_layer GIMP_IS_LAYER #define drawable_layer GIMP_IS_LAYER

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -80,7 +80,7 @@ internal_procs_init ()
{ {
gfloat pcount = 0; gfloat pcount = 0;
/* grep -c procedural_db_register internal_procs.c */ /* grep -c procedural_db_register internal_procs.c */
gfloat total_pcount = 235; gfloat total_pcount = 237;
app_init_update_status("Internal Procedures", "Tool procedures", app_init_update_status("Internal Procedures", "Tool procedures",
pcount/total_pcount); pcount/total_pcount);
@ -247,6 +247,7 @@ internal_procs_init ()
procedural_db_register (&layer_set_offsets_proc); pcount++; procedural_db_register (&layer_set_offsets_proc); pcount++;
procedural_db_register (&layer_mask_proc); pcount++; procedural_db_register (&layer_mask_proc); pcount++;
procedural_db_register (&layer_is_floating_sel_proc); pcount++; procedural_db_register (&layer_is_floating_sel_proc); pcount++;
procedural_db_register (&layer_get_tattoo_proc); pcount++;
app_init_update_status(NULL, "Channel procedures", app_init_update_status(NULL, "Channel procedures",
pcount/total_pcount); pcount/total_pcount);
@ -265,6 +266,7 @@ internal_procs_init ()
procedural_db_register (&channel_set_opacity_proc); pcount++; procedural_db_register (&channel_set_opacity_proc); pcount++;
procedural_db_register (&channel_get_color_proc); pcount++; procedural_db_register (&channel_get_color_proc); pcount++;
procedural_db_register (&channel_set_color_proc); pcount++; procedural_db_register (&channel_set_color_proc); pcount++;
procedural_db_register (&channel_get_tattoo_proc); pcount++;
app_init_update_status(NULL, "Drawable procedures", app_init_update_status(NULL, "Drawable procedures",
pcount/total_pcount); pcount/total_pcount);

View file

@ -1170,6 +1170,11 @@ layer_mask_preview (layer, w, h)
} }
} }
guint32
layer_get_tattoo(const Layer *layer)
{
return (gimp_drawable_get_tattoo(GIMP_DRAWABLE(layer)));
}
void void
layer_invalidate_previews (GimpImage* gimage) layer_invalidate_previews (GimpImage* gimage)

View file

@ -119,6 +119,7 @@ TempBuf * layer_preview (Layer *, int, int);
TempBuf * layer_mask_preview (Layer *, int, int); TempBuf * layer_mask_preview (Layer *, int, int);
void layer_invalidate_previews (GimpImage*); void layer_invalidate_previews (GimpImage*);
guint32 layer_get_tattoo(const Layer *);
#define drawable_layer GIMP_IS_LAYER #define drawable_layer GIMP_IS_LAYER

View file

@ -2022,3 +2022,73 @@ ProcRecord layer_is_floating_sel_proc =
/* Exec method */ /* Exec method */
{ { layer_is_floating_sel_invoker } }, { { layer_is_floating_sel_invoker } },
}; };
/***************************/
/* LAYER_GET_TATTOO_PROC */
static Argument *
layer_get_tattoo_invoker (Argument *args)
{
Layer *layer;
int tattoo;
Argument *return_args;
tattoo = 0;
success = TRUE;
if (success)
{
int_value = args[0].value.pdb_int;
if ((layer = layer_get_ID (int_value)))
tattoo = layer_get_tattoo (layer);
else
success = FALSE;
}
return_args = procedural_db_return_args (&layer_get_tattoo_proc, success);
if (success)
return_args[1].value.pdb_int = tattoo;
return return_args;
}
/* The procedure definition */
ProcArg layer_get_tattoo_args[] =
{
{ PDB_LAYER,
"layer",
"the layer"
}
};
ProcArg layer_get_tattoo_out_args[] =
{
{ PDB_INT32,
"tattoo",
"the tattoo associated with the given layer"
}
};
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 permenant 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,
/* Input arguments */
1,
layer_get_tattoo_args,
/* Output arguments */
1,
layer_get_tattoo_out_args,
/* Exec method */
{ { layer_get_tattoo_invoker } },
};

View file

@ -47,5 +47,6 @@ extern ProcRecord layer_set_mode_proc;
extern ProcRecord layer_set_offsets_proc; extern ProcRecord layer_set_offsets_proc;
extern ProcRecord layer_mask_proc; extern ProcRecord layer_mask_proc;
extern ProcRecord layer_is_floating_sel_proc; extern ProcRecord layer_is_floating_sel_proc;
extern ProcRecord layer_get_tattoo_proc;
#endif /* __LAYER_CMDS_H__ */ #endif /* __LAYER_CMDS_H__ */

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -17,7 +17,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include "parasite.h" #include "libgimp/parasite.h"
#include "procedural_db.h" #include "procedural_db.h"
#include "appenv.h" #include "appenv.h"
#include <stdio.h> #include <stdio.h>
@ -27,12 +27,8 @@ static Argument *parasite_new_invoker (Argument *args);
ProcArg parasite_new_args[] = ProcArg parasite_new_args[] =
{ {
{ PDB_STRING, { PDB_STRING,
"creator", "name",
"The creator ID of the parasite to create" "The name of the parasite to create"
},
{ PDB_STRING,
"type",
"The type ID of the parasite to create"
}, },
{ PDB_INT32, { PDB_INT32,
"flags", "flags",
@ -67,7 +63,7 @@ ProcRecord parasite_new_proc =
PDB_INTERNAL, PDB_INTERNAL,
/* Input arguments */ /* Input arguments */
5, 4,
parasite_new_args, parasite_new_args,
/* Output arguments */ /* Output arguments */
@ -83,26 +79,23 @@ parasite_new_invoker (Argument *args)
{ {
int success = TRUE; int success = TRUE;
Argument *return_args; Argument *return_args;
char *creator, *type; char *name;
guint32 flags, size; guint32 flags, size;
void *data; void *data;
/* creator */ /* creator */
if (success) if (success)
{ creator = (char *) args[0].value.pdb_pointer; } { name = (char *) args[0].value.pdb_pointer; }
/* type */
if (success)
{ type = (char *) args[1].value.pdb_pointer; }
/* flags */ /* flags */
if (success) if (success)
{ flags = args[2].value.pdb_int; } { flags = args[1].value.pdb_int; }
/* size */ /* size */
if (success) if (success)
{ size = args[3].value.pdb_int; } { size = args[2].value.pdb_int; }
/* data */ /* data */
if (success) if (success)
{ {
data = args[4].value.pdb_pointer; data = args[3].value.pdb_pointer;
if (size > 0 && data == 0) if (size > 0 && data == 0)
success = FALSE; success = FALSE;
} }
@ -113,7 +106,7 @@ parasite_new_invoker (Argument *args)
if (success) if (success)
{ {
return_args[1].value.pdb_pointer = return_args[1].value.pdb_pointer =
parasite_new (creator, type, flags, size, data); parasite_new (name, flags, size, data);
} }
return return_args; return return_args;

View file

@ -44,8 +44,8 @@
static char matrix_row_buf [3][MAX_INFO_BUF]; static char matrix_row_buf [3][MAX_INFO_BUF];
/* forward function declarations */ /* forward function declarations */
static void * perspective_tool_perspective (GImage *, GimpDrawable *, TileManager *, int, Matrix); static void * perspective_tool_perspective (GImage *, GimpDrawable *, TileManager *, int, GimpMatrix);
static void perspective_find_transform (double *, Matrix); static void perspective_find_transform (double *, GimpMatrix);
static void * perspective_tool_recalc (Tool *, void *); static void * perspective_tool_recalc (Tool *, void *);
static void perspective_tool_motion (Tool *, void *); static void perspective_tool_motion (Tool *, void *);
static void perspective_info_update (Tool *); static void perspective_info_update (Tool *);
@ -133,7 +133,7 @@ tools_new_perspective_tool ()
private->trans_info[Y3] = 0; private->trans_info[Y3] = 0;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (private->transform); gimp_matrix_identity (private->transform);
return tool; return tool;
} }
@ -219,7 +219,7 @@ perspective_tool_recalc (tool, gdisp_ptr)
{ {
TransformCore * transform_core; TransformCore * transform_core;
GDisplay * gdisp; GDisplay * gdisp;
Matrix m; GimpMatrix m;
double cx, cy; double cx, cy;
double scalex, scaley; double scalex, scaley;
@ -241,10 +241,10 @@ perspective_tool_recalc (tool, gdisp_ptr)
scaley = 1.0 / (transform_core->y2 - transform_core->y1); scaley = 1.0 / (transform_core->y2 - transform_core->y1);
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (transform_core->transform); gimp_matrix_identity (transform_core->transform);
translate_matrix (transform_core->transform, -cx, -cy); gimp_matrix_translate (transform_core->transform, -cx, -cy);
scale_matrix (transform_core->transform, scalex, scaley); gimp_matrix_scale (transform_core->transform, scalex, scaley);
mult_matrix (m, transform_core->transform); gimp_matrix_mult (m, transform_core->transform);
/* transform the bounding box */ /* transform the bounding box */
transform_bounding_box (tool); transform_bounding_box (tool);
@ -259,7 +259,7 @@ perspective_tool_recalc (tool, gdisp_ptr)
static void static void
perspective_find_transform (coords, m) perspective_find_transform (coords, m)
double * coords; double * coords;
Matrix m; GimpMatrix m;
{ {
double dx1, dx2, dx3, dy1, dy2, dy3; double dx1, dx2, dx3, dy1, dy2, dy3;
double det1, det2; double det1, det2;
@ -312,7 +312,7 @@ perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matr
GimpDrawable *drawable; GimpDrawable *drawable;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix);
} }
@ -410,7 +410,7 @@ perspective_invoker (args)
int int_value; int int_value;
TileManager *float_tiles; TileManager *float_tiles;
TileManager *new_tiles; TileManager *new_tiles;
Matrix matrix; GimpMatrix matrix;
int new_layer; int new_layer;
Layer *layer; Layer *layer;
Argument *return_args; Argument *return_args;
@ -457,7 +457,7 @@ perspective_invoker (args)
{ {
double cx, cy; double cx, cy;
double scalex, scaley; double scalex, scaley;
Matrix m; GimpMatrix m;
/* Start a transform undo group */ /* Start a transform undo group */
undo_push_group_start (gimage, TRANSFORM_CORE_UNDO); undo_push_group_start (gimage, TRANSFORM_CORE_UNDO);
@ -480,10 +480,10 @@ perspective_invoker (args)
scaley = 1.0 / float_tiles->height; scaley = 1.0 / float_tiles->height;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (matrix); gimp_matrix_identity (matrix);
translate_matrix (matrix, -cx, -cy); gimp_matrix_translate (matrix, -cx, -cy);
scale_matrix (matrix, scalex, scaley); gimp_matrix_scale (matrix, scalex, scaley);
mult_matrix (m, matrix); gimp_matrix_mult (m, matrix);
/* perspective the buffer */ /* perspective the buffer */
new_tiles = perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matrix); new_tiles = perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matrix);

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -28,8 +28,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "parasite.h" #include "libgimp/parasite.h"
#include "parasiteP.h" /* ick */ #include "libgimp/parasiteP.h" /* ick */
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args,
tmp = parasite_copy (args[i].value.pdb_pointer); tmp = parasite_copy (args[i].value.pdb_pointer);
if (tmp == NULL) if (tmp == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args,
{ {
if (args[i].value.pdb_pointer == NULL) if (args[i].value.pdb_pointer == NULL)
{ {
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.flags = 0;
params[i].data.d_parasite.size = 0; params[i].data.d_parasite.size = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params,
if (full_destroy) if (full_destroy)
if (params[i].data.d_parasite.data) if (params[i].data.d_parasite.data)
{ {
g_free (params[i].data.d_parasite.name);
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
params[i].data.d_parasite.name = 0;
params[i].data.d_parasite.data = 0; params[i].data.d_parasite.data = 0;
} }
break; break;
@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args,
if (full_destroy) if (full_destroy)
{ {
/* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); /* parasite_free ((Parasite *)(args[i].value.pdb_pointer));
args[i].value.pdb_pointer = NULL; */ args[i].value.pdb_pointer = NULL;*/
} }
break; break;
case PDB_STATUS: case PDB_STATUS:

View file

@ -26,7 +26,7 @@
#include "gdisplay.h" #include "gdisplay.h"
#include "plug_in.h" #include "plug_in.h"
#include "procedural_db.h" #include "procedural_db.h"
#include "parasite.h" #include "libgimp/parasite.h"
#include "config.h" #include "config.h"
#include "regex.h" #include "regex.h"

View file

@ -52,7 +52,7 @@ static char center_x_buf [MAX_INFO_BUF];
static char center_y_buf [MAX_INFO_BUF]; static char center_y_buf [MAX_INFO_BUF];
/* forward function declarations */ /* forward function declarations */
static void * rotate_tool_rotate (GImage *, GimpDrawable *, double, TileManager *, int, Matrix); static void * rotate_tool_rotate (GImage *, GimpDrawable *, double, TileManager *, int, GimpMatrix);
static void * rotate_tool_recalc (Tool *, void *); static void * rotate_tool_recalc (Tool *, void *);
static void rotate_tool_motion (Tool *, void *); static void rotate_tool_motion (Tool *, void *);
static void rotate_info_update (Tool *); static void rotate_info_update (Tool *);
@ -135,7 +135,7 @@ tools_new_rotate_tool ()
private->trans_info[CENTER_Y] = (private->y1 + private->y2) / 2; private->trans_info[CENTER_Y] = (private->y1 + private->y2) / 2;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (private->transform); gimp_matrix_identity (private->transform);
return tool; return tool;
} }
@ -339,10 +339,10 @@ rotate_tool_recalc (tool, gdisp_ptr)
cy = transform_core->cy; cy = transform_core->cy;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (transform_core->transform); gimp_matrix_identity (transform_core->transform);
translate_matrix (transform_core->transform, -cx, -cy); gimp_matrix_translate (transform_core->transform, -cx, -cy);
rotate_matrix (transform_core->transform, transform_core->trans_info[ANGLE]); gimp_matrix_rotate (transform_core->transform, transform_core->trans_info[ANGLE]);
translate_matrix (transform_core->transform, +cx, +cy); gimp_matrix_translate (transform_core->transform, +cx, +cy);
/* transform the bounding box */ /* transform the bounding box */
transform_bounding_box (tool); transform_bounding_box (tool);
@ -365,7 +365,7 @@ rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix)
double angle; double angle;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix);
} }
@ -435,7 +435,7 @@ rotate_invoker (args)
int int_value; int int_value;
TileManager *float_tiles; TileManager *float_tiles;
TileManager *new_tiles; TileManager *new_tiles;
Matrix matrix; GimpMatrix matrix;
int new_layer; int new_layer;
Layer *layer; Layer *layer;
Argument *return_args; Argument *return_args;
@ -483,10 +483,10 @@ rotate_invoker (args)
cy = float_tiles->y + float_tiles->height / 2.0; cy = float_tiles->y + float_tiles->height / 2.0;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (matrix); gimp_matrix_identity (matrix);
translate_matrix (matrix, -cx, -cy); gimp_matrix_translate (matrix, -cx, -cy);
rotate_matrix (matrix, angle); gimp_matrix_rotate (matrix, angle);
translate_matrix (matrix, +cx, +cy); gimp_matrix_translate (matrix, +cx, +cy);
/* rotate the buffer */ /* rotate the buffer */
new_tiles = rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix); new_tiles = rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix);

View file

@ -45,7 +45,7 @@ char x_ratio_buf [MAX_INFO_BUF];
char y_ratio_buf [MAX_INFO_BUF]; char y_ratio_buf [MAX_INFO_BUF];
/* forward function declarations */ /* forward function declarations */
static void * scale_tool_scale (GImage *, GimpDrawable *, double *, TileManager *, int, Matrix); static void * scale_tool_scale (GImage *, GimpDrawable *, double *, TileManager *, int, GimpMatrix);
static void * scale_tool_recalc (Tool *, void *); static void * scale_tool_recalc (Tool *, void *);
static void scale_tool_motion (Tool *, void *); static void scale_tool_motion (Tool *, void *);
static void scale_info_update (Tool *); static void scale_info_update (Tool *);
@ -128,7 +128,7 @@ tools_new_scale_tool ()
private->trans_info[Y2] = 0; private->trans_info[Y2] = 0;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (private->transform); gimp_matrix_identity (private->transform);
return tool; return tool;
} }
@ -407,10 +407,10 @@ scale_tool_recalc (tool, gdisp_ptr)
} }
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (transform_core->transform); gimp_matrix_identity (transform_core->transform);
translate_matrix (transform_core->transform, (double) -cx + diffx, (double) -cy + diffy); gimp_matrix_translate (transform_core->transform, (double) -cx + diffx, (double) -cy + diffy);
scale_matrix (transform_core->transform, scalex, scaley); gimp_matrix_scale (transform_core->transform, scalex, scaley);
translate_matrix (transform_core->transform, (double) cx, (double) cy); gimp_matrix_translate (transform_core->transform, (double) cx, (double) cy);
/* transform the bounding box */ /* transform the bounding box */
transform_bounding_box (tool); transform_bounding_box (tool);
@ -428,7 +428,7 @@ scale_tool_scale (gimage, drawable, trans_info, float_tiles, interpolation, matr
double *trans_info; double *trans_info;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
TileManager *new_tiles; TileManager *new_tiles;
int x1, y1, x2, y2; int x1, y1, x2, y2;
@ -538,7 +538,7 @@ scale_invoker (args)
int int_value; int int_value;
TileManager *float_tiles; TileManager *float_tiles;
TileManager *new_tiles; TileManager *new_tiles;
Matrix matrix; GimpMatrix matrix;
int new_layer; int new_layer;
Layer *layer; Layer *layer;
Argument *return_args; Argument *return_args;
@ -598,10 +598,10 @@ scale_invoker (args)
scaley = (trans_info[Y2] - trans_info[Y1]) / (double) float_tiles->height; scaley = (trans_info[Y2] - trans_info[Y1]) / (double) float_tiles->height;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (matrix); gimp_matrix_identity (matrix);
translate_matrix (matrix, float_tiles->x, float_tiles->y); gimp_matrix_translate (matrix, float_tiles->x, float_tiles->y);
scale_matrix (matrix, scalex, scaley); gimp_matrix_scale (matrix, scalex, scaley);
translate_matrix (matrix, trans_info[X1], trans_info[Y1]); gimp_matrix_translate (matrix, trans_info[X1], trans_info[Y1]);
/* scale the buffer */ /* scale the buffer */
new_tiles = scale_tool_scale (gimage, drawable, trans_info, new_tiles = scale_tool_scale (gimage, drawable, trans_info,

View file

@ -51,7 +51,7 @@ static char xshear_buf [MAX_INFO_BUF];
static char yshear_buf [MAX_INFO_BUF]; static char yshear_buf [MAX_INFO_BUF];
/* forward function declarations */ /* forward function declarations */
static void * shear_tool_shear (GImage *, GimpDrawable *, TileManager *, int, Matrix); static void * shear_tool_shear (GImage *, GimpDrawable *, TileManager *, int, GimpMatrix);
static void * shear_tool_recalc (Tool *, void *); static void * shear_tool_recalc (Tool *, void *);
static void shear_tool_motion (Tool *, void *); static void shear_tool_motion (Tool *, void *);
static void shear_info_update (Tool *); static void shear_info_update (Tool *);
@ -126,7 +126,7 @@ tools_new_shear_tool ()
private->trans_func = shear_tool_transform; private->trans_func = shear_tool_transform;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (private->transform); gimp_matrix_identity (private->transform);
return tool; return tool;
} }
@ -323,18 +323,18 @@ shear_tool_recalc (tool, gdisp_ptr)
height = 1; height = 1;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (transform_core->transform); gimp_matrix_identity (transform_core->transform);
translate_matrix (transform_core->transform, -cx, -cy); gimp_matrix_translate (transform_core->transform, -cx, -cy);
/* shear matrix */ /* shear matrix */
if (transform_core->trans_info[HORZ_OR_VERT] == HORZ) if (transform_core->trans_info[HORZ_OR_VERT] == HORZ)
xshear_matrix (transform_core->transform, gimp_matrix_xshear (transform_core->transform,
(float) transform_core->trans_info [XSHEAR] / height); (float) transform_core->trans_info [XSHEAR] / height);
else else
yshear_matrix (transform_core->transform, gimp_matrix_yshear (transform_core->transform,
(float) transform_core->trans_info [YSHEAR] / width); (float) transform_core->trans_info [YSHEAR] / width);
translate_matrix (transform_core->transform, +cx, +cy); gimp_matrix_translate (transform_core->transform, +cx, +cy);
/* transform the bounding box */ /* transform the bounding box */
transform_bounding_box (tool); transform_bounding_box (tool);
@ -352,7 +352,7 @@ shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix)
GimpDrawable *drawable; GimpDrawable *drawable;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix);
} }
@ -427,7 +427,7 @@ shear_invoker (args)
int int_value; int int_value;
TileManager *float_tiles; TileManager *float_tiles;
TileManager *new_tiles; TileManager *new_tiles;
Matrix matrix; GimpMatrix matrix;
int new_layer; int new_layer;
Layer *layer; Layer *layer;
Argument *return_args; Argument *return_args;
@ -488,14 +488,14 @@ shear_invoker (args)
cx = float_tiles->x + float_tiles->width / 2.0; cx = float_tiles->x + float_tiles->width / 2.0;
cy = float_tiles->y + float_tiles->height / 2.0; cy = float_tiles->y + float_tiles->height / 2.0;
identity_matrix (matrix); gimp_matrix_identity (matrix);
translate_matrix (matrix, -cx, -cy); gimp_matrix_translate (matrix, -cx, -cy);
/* shear matrix */ /* shear matrix */
if (shear_type == HORZ) if (shear_type == HORZ)
xshear_matrix (matrix, shear_magnitude / float_tiles->height); gimp_matrix_xshear (matrix, shear_magnitude / float_tiles->height);
else if (shear_type == VERT) else if (shear_type == VERT)
yshear_matrix (matrix, shear_magnitude / float_tiles->width); gimp_matrix_yshear (matrix, shear_magnitude / float_tiles->width);
translate_matrix (matrix, +cx, +cy); gimp_matrix_translate (matrix, +cx, +cy);
/* shear the buffer */ /* shear the buffer */
new_tiles = shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix); new_tiles = shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix);

View file

@ -44,8 +44,8 @@
static char matrix_row_buf [3][MAX_INFO_BUF]; static char matrix_row_buf [3][MAX_INFO_BUF];
/* forward function declarations */ /* forward function declarations */
static void * perspective_tool_perspective (GImage *, GimpDrawable *, TileManager *, int, Matrix); static void * perspective_tool_perspective (GImage *, GimpDrawable *, TileManager *, int, GimpMatrix);
static void perspective_find_transform (double *, Matrix); static void perspective_find_transform (double *, GimpMatrix);
static void * perspective_tool_recalc (Tool *, void *); static void * perspective_tool_recalc (Tool *, void *);
static void perspective_tool_motion (Tool *, void *); static void perspective_tool_motion (Tool *, void *);
static void perspective_info_update (Tool *); static void perspective_info_update (Tool *);
@ -133,7 +133,7 @@ tools_new_perspective_tool ()
private->trans_info[Y3] = 0; private->trans_info[Y3] = 0;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (private->transform); gimp_matrix_identity (private->transform);
return tool; return tool;
} }
@ -219,7 +219,7 @@ perspective_tool_recalc (tool, gdisp_ptr)
{ {
TransformCore * transform_core; TransformCore * transform_core;
GDisplay * gdisp; GDisplay * gdisp;
Matrix m; GimpMatrix m;
double cx, cy; double cx, cy;
double scalex, scaley; double scalex, scaley;
@ -241,10 +241,10 @@ perspective_tool_recalc (tool, gdisp_ptr)
scaley = 1.0 / (transform_core->y2 - transform_core->y1); scaley = 1.0 / (transform_core->y2 - transform_core->y1);
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (transform_core->transform); gimp_matrix_identity (transform_core->transform);
translate_matrix (transform_core->transform, -cx, -cy); gimp_matrix_translate (transform_core->transform, -cx, -cy);
scale_matrix (transform_core->transform, scalex, scaley); gimp_matrix_scale (transform_core->transform, scalex, scaley);
mult_matrix (m, transform_core->transform); gimp_matrix_mult (m, transform_core->transform);
/* transform the bounding box */ /* transform the bounding box */
transform_bounding_box (tool); transform_bounding_box (tool);
@ -259,7 +259,7 @@ perspective_tool_recalc (tool, gdisp_ptr)
static void static void
perspective_find_transform (coords, m) perspective_find_transform (coords, m)
double * coords; double * coords;
Matrix m; GimpMatrix m;
{ {
double dx1, dx2, dx3, dy1, dy2, dy3; double dx1, dx2, dx3, dy1, dy2, dy3;
double det1, det2; double det1, det2;
@ -312,7 +312,7 @@ perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matr
GimpDrawable *drawable; GimpDrawable *drawable;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix);
} }
@ -410,7 +410,7 @@ perspective_invoker (args)
int int_value; int int_value;
TileManager *float_tiles; TileManager *float_tiles;
TileManager *new_tiles; TileManager *new_tiles;
Matrix matrix; GimpMatrix matrix;
int new_layer; int new_layer;
Layer *layer; Layer *layer;
Argument *return_args; Argument *return_args;
@ -457,7 +457,7 @@ perspective_invoker (args)
{ {
double cx, cy; double cx, cy;
double scalex, scaley; double scalex, scaley;
Matrix m; GimpMatrix m;
/* Start a transform undo group */ /* Start a transform undo group */
undo_push_group_start (gimage, TRANSFORM_CORE_UNDO); undo_push_group_start (gimage, TRANSFORM_CORE_UNDO);
@ -480,10 +480,10 @@ perspective_invoker (args)
scaley = 1.0 / float_tiles->height; scaley = 1.0 / float_tiles->height;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (matrix); gimp_matrix_identity (matrix);
translate_matrix (matrix, -cx, -cy); gimp_matrix_translate (matrix, -cx, -cy);
scale_matrix (matrix, scalex, scaley); gimp_matrix_scale (matrix, scalex, scaley);
mult_matrix (m, matrix); gimp_matrix_mult (m, matrix);
/* perspective the buffer */ /* perspective the buffer */
new_tiles = perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matrix); new_tiles = perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matrix);

View file

@ -52,7 +52,7 @@ static char center_x_buf [MAX_INFO_BUF];
static char center_y_buf [MAX_INFO_BUF]; static char center_y_buf [MAX_INFO_BUF];
/* forward function declarations */ /* forward function declarations */
static void * rotate_tool_rotate (GImage *, GimpDrawable *, double, TileManager *, int, Matrix); static void * rotate_tool_rotate (GImage *, GimpDrawable *, double, TileManager *, int, GimpMatrix);
static void * rotate_tool_recalc (Tool *, void *); static void * rotate_tool_recalc (Tool *, void *);
static void rotate_tool_motion (Tool *, void *); static void rotate_tool_motion (Tool *, void *);
static void rotate_info_update (Tool *); static void rotate_info_update (Tool *);
@ -135,7 +135,7 @@ tools_new_rotate_tool ()
private->trans_info[CENTER_Y] = (private->y1 + private->y2) / 2; private->trans_info[CENTER_Y] = (private->y1 + private->y2) / 2;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (private->transform); gimp_matrix_identity (private->transform);
return tool; return tool;
} }
@ -339,10 +339,10 @@ rotate_tool_recalc (tool, gdisp_ptr)
cy = transform_core->cy; cy = transform_core->cy;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (transform_core->transform); gimp_matrix_identity (transform_core->transform);
translate_matrix (transform_core->transform, -cx, -cy); gimp_matrix_translate (transform_core->transform, -cx, -cy);
rotate_matrix (transform_core->transform, transform_core->trans_info[ANGLE]); gimp_matrix_rotate (transform_core->transform, transform_core->trans_info[ANGLE]);
translate_matrix (transform_core->transform, +cx, +cy); gimp_matrix_translate (transform_core->transform, +cx, +cy);
/* transform the bounding box */ /* transform the bounding box */
transform_bounding_box (tool); transform_bounding_box (tool);
@ -365,7 +365,7 @@ rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix)
double angle; double angle;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix);
} }
@ -435,7 +435,7 @@ rotate_invoker (args)
int int_value; int int_value;
TileManager *float_tiles; TileManager *float_tiles;
TileManager *new_tiles; TileManager *new_tiles;
Matrix matrix; GimpMatrix matrix;
int new_layer; int new_layer;
Layer *layer; Layer *layer;
Argument *return_args; Argument *return_args;
@ -483,10 +483,10 @@ rotate_invoker (args)
cy = float_tiles->y + float_tiles->height / 2.0; cy = float_tiles->y + float_tiles->height / 2.0;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (matrix); gimp_matrix_identity (matrix);
translate_matrix (matrix, -cx, -cy); gimp_matrix_translate (matrix, -cx, -cy);
rotate_matrix (matrix, angle); gimp_matrix_rotate (matrix, angle);
translate_matrix (matrix, +cx, +cy); gimp_matrix_translate (matrix, +cx, +cy);
/* rotate the buffer */ /* rotate the buffer */
new_tiles = rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix); new_tiles = rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix);

View file

@ -45,7 +45,7 @@ char x_ratio_buf [MAX_INFO_BUF];
char y_ratio_buf [MAX_INFO_BUF]; char y_ratio_buf [MAX_INFO_BUF];
/* forward function declarations */ /* forward function declarations */
static void * scale_tool_scale (GImage *, GimpDrawable *, double *, TileManager *, int, Matrix); static void * scale_tool_scale (GImage *, GimpDrawable *, double *, TileManager *, int, GimpMatrix);
static void * scale_tool_recalc (Tool *, void *); static void * scale_tool_recalc (Tool *, void *);
static void scale_tool_motion (Tool *, void *); static void scale_tool_motion (Tool *, void *);
static void scale_info_update (Tool *); static void scale_info_update (Tool *);
@ -128,7 +128,7 @@ tools_new_scale_tool ()
private->trans_info[Y2] = 0; private->trans_info[Y2] = 0;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (private->transform); gimp_matrix_identity (private->transform);
return tool; return tool;
} }
@ -407,10 +407,10 @@ scale_tool_recalc (tool, gdisp_ptr)
} }
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (transform_core->transform); gimp_matrix_identity (transform_core->transform);
translate_matrix (transform_core->transform, (double) -cx + diffx, (double) -cy + diffy); gimp_matrix_translate (transform_core->transform, (double) -cx + diffx, (double) -cy + diffy);
scale_matrix (transform_core->transform, scalex, scaley); gimp_matrix_scale (transform_core->transform, scalex, scaley);
translate_matrix (transform_core->transform, (double) cx, (double) cy); gimp_matrix_translate (transform_core->transform, (double) cx, (double) cy);
/* transform the bounding box */ /* transform the bounding box */
transform_bounding_box (tool); transform_bounding_box (tool);
@ -428,7 +428,7 @@ scale_tool_scale (gimage, drawable, trans_info, float_tiles, interpolation, matr
double *trans_info; double *trans_info;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
TileManager *new_tiles; TileManager *new_tiles;
int x1, y1, x2, y2; int x1, y1, x2, y2;
@ -538,7 +538,7 @@ scale_invoker (args)
int int_value; int int_value;
TileManager *float_tiles; TileManager *float_tiles;
TileManager *new_tiles; TileManager *new_tiles;
Matrix matrix; GimpMatrix matrix;
int new_layer; int new_layer;
Layer *layer; Layer *layer;
Argument *return_args; Argument *return_args;
@ -598,10 +598,10 @@ scale_invoker (args)
scaley = (trans_info[Y2] - trans_info[Y1]) / (double) float_tiles->height; scaley = (trans_info[Y2] - trans_info[Y1]) / (double) float_tiles->height;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (matrix); gimp_matrix_identity (matrix);
translate_matrix (matrix, float_tiles->x, float_tiles->y); gimp_matrix_translate (matrix, float_tiles->x, float_tiles->y);
scale_matrix (matrix, scalex, scaley); gimp_matrix_scale (matrix, scalex, scaley);
translate_matrix (matrix, trans_info[X1], trans_info[Y1]); gimp_matrix_translate (matrix, trans_info[X1], trans_info[Y1]);
/* scale the buffer */ /* scale the buffer */
new_tiles = scale_tool_scale (gimage, drawable, trans_info, new_tiles = scale_tool_scale (gimage, drawable, trans_info,

View file

@ -51,7 +51,7 @@ static char xshear_buf [MAX_INFO_BUF];
static char yshear_buf [MAX_INFO_BUF]; static char yshear_buf [MAX_INFO_BUF];
/* forward function declarations */ /* forward function declarations */
static void * shear_tool_shear (GImage *, GimpDrawable *, TileManager *, int, Matrix); static void * shear_tool_shear (GImage *, GimpDrawable *, TileManager *, int, GimpMatrix);
static void * shear_tool_recalc (Tool *, void *); static void * shear_tool_recalc (Tool *, void *);
static void shear_tool_motion (Tool *, void *); static void shear_tool_motion (Tool *, void *);
static void shear_info_update (Tool *); static void shear_info_update (Tool *);
@ -126,7 +126,7 @@ tools_new_shear_tool ()
private->trans_func = shear_tool_transform; private->trans_func = shear_tool_transform;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (private->transform); gimp_matrix_identity (private->transform);
return tool; return tool;
} }
@ -323,18 +323,18 @@ shear_tool_recalc (tool, gdisp_ptr)
height = 1; height = 1;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (transform_core->transform); gimp_matrix_identity (transform_core->transform);
translate_matrix (transform_core->transform, -cx, -cy); gimp_matrix_translate (transform_core->transform, -cx, -cy);
/* shear matrix */ /* shear matrix */
if (transform_core->trans_info[HORZ_OR_VERT] == HORZ) if (transform_core->trans_info[HORZ_OR_VERT] == HORZ)
xshear_matrix (transform_core->transform, gimp_matrix_xshear (transform_core->transform,
(float) transform_core->trans_info [XSHEAR] / height); (float) transform_core->trans_info [XSHEAR] / height);
else else
yshear_matrix (transform_core->transform, gimp_matrix_yshear (transform_core->transform,
(float) transform_core->trans_info [YSHEAR] / width); (float) transform_core->trans_info [YSHEAR] / width);
translate_matrix (transform_core->transform, +cx, +cy); gimp_matrix_translate (transform_core->transform, +cx, +cy);
/* transform the bounding box */ /* transform the bounding box */
transform_bounding_box (tool); transform_bounding_box (tool);
@ -352,7 +352,7 @@ shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix)
GimpDrawable *drawable; GimpDrawable *drawable;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix);
} }
@ -427,7 +427,7 @@ shear_invoker (args)
int int_value; int int_value;
TileManager *float_tiles; TileManager *float_tiles;
TileManager *new_tiles; TileManager *new_tiles;
Matrix matrix; GimpMatrix matrix;
int new_layer; int new_layer;
Layer *layer; Layer *layer;
Argument *return_args; Argument *return_args;
@ -488,14 +488,14 @@ shear_invoker (args)
cx = float_tiles->x + float_tiles->width / 2.0; cx = float_tiles->x + float_tiles->width / 2.0;
cy = float_tiles->y + float_tiles->height / 2.0; cy = float_tiles->y + float_tiles->height / 2.0;
identity_matrix (matrix); gimp_matrix_identity (matrix);
translate_matrix (matrix, -cx, -cy); gimp_matrix_translate (matrix, -cx, -cy);
/* shear matrix */ /* shear matrix */
if (shear_type == HORZ) if (shear_type == HORZ)
xshear_matrix (matrix, shear_magnitude / float_tiles->height); gimp_matrix_xshear (matrix, shear_magnitude / float_tiles->height);
else if (shear_type == VERT) else if (shear_type == VERT)
yshear_matrix (matrix, shear_magnitude / float_tiles->width); gimp_matrix_yshear (matrix, shear_magnitude / float_tiles->width);
translate_matrix (matrix, +cx, +cy); gimp_matrix_translate (matrix, +cx, +cy);
/* shear the buffer */ /* shear the buffer */
new_tiles = shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix); new_tiles = shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix);

View file

@ -44,8 +44,8 @@
static char matrix_row_buf [3][MAX_INFO_BUF]; static char matrix_row_buf [3][MAX_INFO_BUF];
/* forward function declarations */ /* forward function declarations */
static void * perspective_tool_perspective (GImage *, GimpDrawable *, TileManager *, int, Matrix); static void * perspective_tool_perspective (GImage *, GimpDrawable *, TileManager *, int, GimpMatrix);
static void perspective_find_transform (double *, Matrix); static void perspective_find_transform (double *, GimpMatrix);
static void * perspective_tool_recalc (Tool *, void *); static void * perspective_tool_recalc (Tool *, void *);
static void perspective_tool_motion (Tool *, void *); static void perspective_tool_motion (Tool *, void *);
static void perspective_info_update (Tool *); static void perspective_info_update (Tool *);
@ -133,7 +133,7 @@ tools_new_perspective_tool ()
private->trans_info[Y3] = 0; private->trans_info[Y3] = 0;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (private->transform); gimp_matrix_identity (private->transform);
return tool; return tool;
} }
@ -219,7 +219,7 @@ perspective_tool_recalc (tool, gdisp_ptr)
{ {
TransformCore * transform_core; TransformCore * transform_core;
GDisplay * gdisp; GDisplay * gdisp;
Matrix m; GimpMatrix m;
double cx, cy; double cx, cy;
double scalex, scaley; double scalex, scaley;
@ -241,10 +241,10 @@ perspective_tool_recalc (tool, gdisp_ptr)
scaley = 1.0 / (transform_core->y2 - transform_core->y1); scaley = 1.0 / (transform_core->y2 - transform_core->y1);
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (transform_core->transform); gimp_matrix_identity (transform_core->transform);
translate_matrix (transform_core->transform, -cx, -cy); gimp_matrix_translate (transform_core->transform, -cx, -cy);
scale_matrix (transform_core->transform, scalex, scaley); gimp_matrix_scale (transform_core->transform, scalex, scaley);
mult_matrix (m, transform_core->transform); gimp_matrix_mult (m, transform_core->transform);
/* transform the bounding box */ /* transform the bounding box */
transform_bounding_box (tool); transform_bounding_box (tool);
@ -259,7 +259,7 @@ perspective_tool_recalc (tool, gdisp_ptr)
static void static void
perspective_find_transform (coords, m) perspective_find_transform (coords, m)
double * coords; double * coords;
Matrix m; GimpMatrix m;
{ {
double dx1, dx2, dx3, dy1, dy2, dy3; double dx1, dx2, dx3, dy1, dy2, dy3;
double det1, det2; double det1, det2;
@ -312,7 +312,7 @@ perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matr
GimpDrawable *drawable; GimpDrawable *drawable;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix);
} }
@ -410,7 +410,7 @@ perspective_invoker (args)
int int_value; int int_value;
TileManager *float_tiles; TileManager *float_tiles;
TileManager *new_tiles; TileManager *new_tiles;
Matrix matrix; GimpMatrix matrix;
int new_layer; int new_layer;
Layer *layer; Layer *layer;
Argument *return_args; Argument *return_args;
@ -457,7 +457,7 @@ perspective_invoker (args)
{ {
double cx, cy; double cx, cy;
double scalex, scaley; double scalex, scaley;
Matrix m; GimpMatrix m;
/* Start a transform undo group */ /* Start a transform undo group */
undo_push_group_start (gimage, TRANSFORM_CORE_UNDO); undo_push_group_start (gimage, TRANSFORM_CORE_UNDO);
@ -480,10 +480,10 @@ perspective_invoker (args)
scaley = 1.0 / float_tiles->height; scaley = 1.0 / float_tiles->height;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (matrix); gimp_matrix_identity (matrix);
translate_matrix (matrix, -cx, -cy); gimp_matrix_translate (matrix, -cx, -cy);
scale_matrix (matrix, scalex, scaley); gimp_matrix_scale (matrix, scalex, scaley);
mult_matrix (m, matrix); gimp_matrix_mult (m, matrix);
/* perspective the buffer */ /* perspective the buffer */
new_tiles = perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matrix); new_tiles = perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matrix);

View file

@ -52,7 +52,7 @@ static char center_x_buf [MAX_INFO_BUF];
static char center_y_buf [MAX_INFO_BUF]; static char center_y_buf [MAX_INFO_BUF];
/* forward function declarations */ /* forward function declarations */
static void * rotate_tool_rotate (GImage *, GimpDrawable *, double, TileManager *, int, Matrix); static void * rotate_tool_rotate (GImage *, GimpDrawable *, double, TileManager *, int, GimpMatrix);
static void * rotate_tool_recalc (Tool *, void *); static void * rotate_tool_recalc (Tool *, void *);
static void rotate_tool_motion (Tool *, void *); static void rotate_tool_motion (Tool *, void *);
static void rotate_info_update (Tool *); static void rotate_info_update (Tool *);
@ -135,7 +135,7 @@ tools_new_rotate_tool ()
private->trans_info[CENTER_Y] = (private->y1 + private->y2) / 2; private->trans_info[CENTER_Y] = (private->y1 + private->y2) / 2;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (private->transform); gimp_matrix_identity (private->transform);
return tool; return tool;
} }
@ -339,10 +339,10 @@ rotate_tool_recalc (tool, gdisp_ptr)
cy = transform_core->cy; cy = transform_core->cy;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (transform_core->transform); gimp_matrix_identity (transform_core->transform);
translate_matrix (transform_core->transform, -cx, -cy); gimp_matrix_translate (transform_core->transform, -cx, -cy);
rotate_matrix (transform_core->transform, transform_core->trans_info[ANGLE]); gimp_matrix_rotate (transform_core->transform, transform_core->trans_info[ANGLE]);
translate_matrix (transform_core->transform, +cx, +cy); gimp_matrix_translate (transform_core->transform, +cx, +cy);
/* transform the bounding box */ /* transform the bounding box */
transform_bounding_box (tool); transform_bounding_box (tool);
@ -365,7 +365,7 @@ rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix)
double angle; double angle;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix);
} }
@ -435,7 +435,7 @@ rotate_invoker (args)
int int_value; int int_value;
TileManager *float_tiles; TileManager *float_tiles;
TileManager *new_tiles; TileManager *new_tiles;
Matrix matrix; GimpMatrix matrix;
int new_layer; int new_layer;
Layer *layer; Layer *layer;
Argument *return_args; Argument *return_args;
@ -483,10 +483,10 @@ rotate_invoker (args)
cy = float_tiles->y + float_tiles->height / 2.0; cy = float_tiles->y + float_tiles->height / 2.0;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (matrix); gimp_matrix_identity (matrix);
translate_matrix (matrix, -cx, -cy); gimp_matrix_translate (matrix, -cx, -cy);
rotate_matrix (matrix, angle); gimp_matrix_rotate (matrix, angle);
translate_matrix (matrix, +cx, +cy); gimp_matrix_translate (matrix, +cx, +cy);
/* rotate the buffer */ /* rotate the buffer */
new_tiles = rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix); new_tiles = rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix);

View file

@ -45,7 +45,7 @@ char x_ratio_buf [MAX_INFO_BUF];
char y_ratio_buf [MAX_INFO_BUF]; char y_ratio_buf [MAX_INFO_BUF];
/* forward function declarations */ /* forward function declarations */
static void * scale_tool_scale (GImage *, GimpDrawable *, double *, TileManager *, int, Matrix); static void * scale_tool_scale (GImage *, GimpDrawable *, double *, TileManager *, int, GimpMatrix);
static void * scale_tool_recalc (Tool *, void *); static void * scale_tool_recalc (Tool *, void *);
static void scale_tool_motion (Tool *, void *); static void scale_tool_motion (Tool *, void *);
static void scale_info_update (Tool *); static void scale_info_update (Tool *);
@ -128,7 +128,7 @@ tools_new_scale_tool ()
private->trans_info[Y2] = 0; private->trans_info[Y2] = 0;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (private->transform); gimp_matrix_identity (private->transform);
return tool; return tool;
} }
@ -407,10 +407,10 @@ scale_tool_recalc (tool, gdisp_ptr)
} }
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (transform_core->transform); gimp_matrix_identity (transform_core->transform);
translate_matrix (transform_core->transform, (double) -cx + diffx, (double) -cy + diffy); gimp_matrix_translate (transform_core->transform, (double) -cx + diffx, (double) -cy + diffy);
scale_matrix (transform_core->transform, scalex, scaley); gimp_matrix_scale (transform_core->transform, scalex, scaley);
translate_matrix (transform_core->transform, (double) cx, (double) cy); gimp_matrix_translate (transform_core->transform, (double) cx, (double) cy);
/* transform the bounding box */ /* transform the bounding box */
transform_bounding_box (tool); transform_bounding_box (tool);
@ -428,7 +428,7 @@ scale_tool_scale (gimage, drawable, trans_info, float_tiles, interpolation, matr
double *trans_info; double *trans_info;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
TileManager *new_tiles; TileManager *new_tiles;
int x1, y1, x2, y2; int x1, y1, x2, y2;
@ -538,7 +538,7 @@ scale_invoker (args)
int int_value; int int_value;
TileManager *float_tiles; TileManager *float_tiles;
TileManager *new_tiles; TileManager *new_tiles;
Matrix matrix; GimpMatrix matrix;
int new_layer; int new_layer;
Layer *layer; Layer *layer;
Argument *return_args; Argument *return_args;
@ -598,10 +598,10 @@ scale_invoker (args)
scaley = (trans_info[Y2] - trans_info[Y1]) / (double) float_tiles->height; scaley = (trans_info[Y2] - trans_info[Y1]) / (double) float_tiles->height;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (matrix); gimp_matrix_identity (matrix);
translate_matrix (matrix, float_tiles->x, float_tiles->y); gimp_matrix_translate (matrix, float_tiles->x, float_tiles->y);
scale_matrix (matrix, scalex, scaley); gimp_matrix_scale (matrix, scalex, scaley);
translate_matrix (matrix, trans_info[X1], trans_info[Y1]); gimp_matrix_translate (matrix, trans_info[X1], trans_info[Y1]);
/* scale the buffer */ /* scale the buffer */
new_tiles = scale_tool_scale (gimage, drawable, trans_info, new_tiles = scale_tool_scale (gimage, drawable, trans_info,

View file

@ -51,7 +51,7 @@ static char xshear_buf [MAX_INFO_BUF];
static char yshear_buf [MAX_INFO_BUF]; static char yshear_buf [MAX_INFO_BUF];
/* forward function declarations */ /* forward function declarations */
static void * shear_tool_shear (GImage *, GimpDrawable *, TileManager *, int, Matrix); static void * shear_tool_shear (GImage *, GimpDrawable *, TileManager *, int, GimpMatrix);
static void * shear_tool_recalc (Tool *, void *); static void * shear_tool_recalc (Tool *, void *);
static void shear_tool_motion (Tool *, void *); static void shear_tool_motion (Tool *, void *);
static void shear_info_update (Tool *); static void shear_info_update (Tool *);
@ -126,7 +126,7 @@ tools_new_shear_tool ()
private->trans_func = shear_tool_transform; private->trans_func = shear_tool_transform;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (private->transform); gimp_matrix_identity (private->transform);
return tool; return tool;
} }
@ -323,18 +323,18 @@ shear_tool_recalc (tool, gdisp_ptr)
height = 1; height = 1;
/* assemble the transformation matrix */ /* assemble the transformation matrix */
identity_matrix (transform_core->transform); gimp_matrix_identity (transform_core->transform);
translate_matrix (transform_core->transform, -cx, -cy); gimp_matrix_translate (transform_core->transform, -cx, -cy);
/* shear matrix */ /* shear matrix */
if (transform_core->trans_info[HORZ_OR_VERT] == HORZ) if (transform_core->trans_info[HORZ_OR_VERT] == HORZ)
xshear_matrix (transform_core->transform, gimp_matrix_xshear (transform_core->transform,
(float) transform_core->trans_info [XSHEAR] / height); (float) transform_core->trans_info [XSHEAR] / height);
else else
yshear_matrix (transform_core->transform, gimp_matrix_yshear (transform_core->transform,
(float) transform_core->trans_info [YSHEAR] / width); (float) transform_core->trans_info [YSHEAR] / width);
translate_matrix (transform_core->transform, +cx, +cy); gimp_matrix_translate (transform_core->transform, +cx, +cy);
/* transform the bounding box */ /* transform the bounding box */
transform_bounding_box (tool); transform_bounding_box (tool);
@ -352,7 +352,7 @@ shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix)
GimpDrawable *drawable; GimpDrawable *drawable;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix);
} }
@ -427,7 +427,7 @@ shear_invoker (args)
int int_value; int int_value;
TileManager *float_tiles; TileManager *float_tiles;
TileManager *new_tiles; TileManager *new_tiles;
Matrix matrix; GimpMatrix matrix;
int new_layer; int new_layer;
Layer *layer; Layer *layer;
Argument *return_args; Argument *return_args;
@ -488,14 +488,14 @@ shear_invoker (args)
cx = float_tiles->x + float_tiles->width / 2.0; cx = float_tiles->x + float_tiles->width / 2.0;
cy = float_tiles->y + float_tiles->height / 2.0; cy = float_tiles->y + float_tiles->height / 2.0;
identity_matrix (matrix); gimp_matrix_identity (matrix);
translate_matrix (matrix, -cx, -cy); gimp_matrix_translate (matrix, -cx, -cy);
/* shear matrix */ /* shear matrix */
if (shear_type == HORZ) if (shear_type == HORZ)
xshear_matrix (matrix, shear_magnitude / float_tiles->height); gimp_matrix_xshear (matrix, shear_magnitude / float_tiles->height);
else if (shear_type == VERT) else if (shear_type == VERT)
yshear_matrix (matrix, shear_magnitude / float_tiles->width); gimp_matrix_yshear (matrix, shear_magnitude / float_tiles->width);
translate_matrix (matrix, +cx, +cy); gimp_matrix_translate (matrix, +cx, +cy);
/* shear the buffer */ /* shear the buffer */
new_tiles = shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix); new_tiles = shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix);

View file

@ -57,7 +57,6 @@ static void * transform_core_recalc (Tool *, void *);
static void transform_core_doit (Tool *, gpointer); static void transform_core_doit (Tool *, gpointer);
static double cubic (double, int, int, int, int); static double cubic (double, int, int, int, int);
static void transform_core_setup_grid (Tool *); static void transform_core_setup_grid (Tool *);
static void invert (Matrix, Matrix);
#define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \ #define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \
((1-dy) * ((1-dx)*jk + dx*j1k) + \ ((1-dy) * ((1-dx)*jk + dx*j1k) + \
@ -742,23 +741,23 @@ transform_bounding_box (tool)
transform_core = (TransformCore *) tool->private; transform_core = (TransformCore *) tool->private;
transform_point (transform_core->transform, gimp_matrix_transform_point (transform_core->transform,
transform_core->x1, transform_core->y1, transform_core->x1, transform_core->y1,
&transform_core->tx1, &transform_core->ty1); &transform_core->tx1, &transform_core->ty1);
transform_point (transform_core->transform, gimp_matrix_transform_point (transform_core->transform,
transform_core->x2, transform_core->y1, transform_core->x2, transform_core->y1,
&transform_core->tx2, &transform_core->ty2); &transform_core->tx2, &transform_core->ty2);
transform_point (transform_core->transform, gimp_matrix_transform_point (transform_core->transform,
transform_core->x1, transform_core->y2, transform_core->x1, transform_core->y2,
&transform_core->tx3, &transform_core->ty3); &transform_core->tx3, &transform_core->ty3);
transform_point (transform_core->transform, gimp_matrix_transform_point (transform_core->transform,
transform_core->x2, transform_core->y2, transform_core->x2, transform_core->y2,
&transform_core->tx4, &transform_core->ty4); &transform_core->tx4, &transform_core->ty4);
if (tool->type == ROTATE) if (tool->type == ROTATE)
transform_point (transform_core->transform, gimp_matrix_transform_point (transform_core->transform,
transform_core->cx, transform_core->cy, transform_core->cx, transform_core->cy,
&transform_core->tcx, &transform_core->tcy); &transform_core->tcx, &transform_core->tcy);
if (transform_core->grid_coords != NULL && if (transform_core->grid_coords != NULL &&
transform_core->tgrid_coords != NULL) transform_core->tgrid_coords != NULL)
@ -767,204 +766,16 @@ transform_bounding_box (tool)
k = (transform_core->ngx + transform_core->ngy) * 2; k = (transform_core->ngx + transform_core->ngy) * 2;
for (i = 0; i < k; i++) for (i = 0; i < k; i++)
{ {
transform_point (transform_core->transform, gimp_matrix_transform_point (transform_core->transform,
transform_core->grid_coords[gci], transform_core->grid_coords[gci],
transform_core->grid_coords[gci+1], transform_core->grid_coords[gci+1],
&(transform_core->tgrid_coords[gci]), &(transform_core->tgrid_coords[gci]),
&(transform_core->tgrid_coords[gci+1])); &(transform_core->tgrid_coords[gci+1]));
gci += 2; gci += 2;
} }
} }
} }
void
transform_point (m, x, y, nx, ny)
Matrix m;
double x, y;
double *nx, *ny;
{
double xx, yy, ww;
xx = m[0][0] * x + m[0][1] * y + m[0][2];
yy = m[1][0] * x + m[1][1] * y + m[1][2];
ww = m[2][0] * x + m[2][1] * y + m[2][2];
if (!ww)
ww = 1.0;
*nx = xx / ww;
*ny = yy / ww;
}
void
mult_matrix (m1, m2)
Matrix m1, m2;
{
Matrix result;
int i, j, k;
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
{
result [i][j] = 0.0;
for (k = 0; k < 3; k++)
result [i][j] += m1 [i][k] * m2[k][j];
}
/* copy the result into matrix 2 */
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
m2 [i][j] = result [i][j];
}
void
identity_matrix (m)
Matrix m;
{
int i, j;
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
m[i][j] = (i == j) ? 1 : 0;
}
void
translate_matrix (m, x, y)
Matrix m;
double x, y;
{
Matrix trans;
identity_matrix (trans);
trans[0][2] = x;
trans[1][2] = y;
mult_matrix (trans, m);
}
void
scale_matrix (m, x, y)
Matrix m;
double x, y;
{
Matrix scale;
identity_matrix (scale);
scale[0][0] = x;
scale[1][1] = y;
mult_matrix (scale, m);
}
void
rotate_matrix (m, theta)
Matrix m;
double theta;
{
Matrix rotate;
double cos_theta, sin_theta;
cos_theta = cos (theta);
sin_theta = sin (theta);
identity_matrix (rotate);
rotate[0][0] = cos_theta;
rotate[0][1] = -sin_theta;
rotate[1][0] = sin_theta;
rotate[1][1] = cos_theta;
mult_matrix (rotate, m);
}
void
xshear_matrix (m, shear)
Matrix m;
double shear;
{
Matrix shear_m;
identity_matrix (shear_m);
shear_m[0][1] = shear;
mult_matrix (shear_m, m);
}
void
yshear_matrix (m, shear)
Matrix m;
double shear;
{
Matrix shear_m;
identity_matrix (shear_m);
shear_m[1][0] = shear;
mult_matrix (shear_m, m);
}
/* find the determinate for a 3x3 matrix */
static double
determinate (Matrix m)
{
int i;
double det = 0;
for (i = 0; i < 3; i ++)
{
det += m[0][i] * m[1][(i+1)%3] * m[2][(i+2)%3];
det -= m[2][i] * m[1][(i+1)%3] * m[0][(i+2)%3];
}
return det;
}
/* find the cofactor matrix of a matrix */
static void
cofactor (Matrix m, Matrix m_cof)
{
int i, j;
int x1, y1;
int x2, y2;
x1 = y1 = x2 = y2 = 0;
for (i = 0; i < 3; i++)
{
switch (i)
{
case 0 : y1 = 1; y2 = 2; break;
case 1 : y1 = 0; y2 = 2; break;
case 2 : y1 = 0; y2 = 1; break;
}
for (j = 0; j < 3; j++)
{
switch (j)
{
case 0 : x1 = 1; x2 = 2; break;
case 1 : x1 = 0; x2 = 2; break;
case 2 : x1 = 0; x2 = 1; break;
}
m_cof[i][j] = (m[x1][y1] * m[x2][y2] - m[x1][y2] * m[x2][y1]) *
(((i+j) % 2) ? -1 : 1);
}
}
}
/* find the inverse of a 3x3 matrix */
static void
invert (Matrix m, Matrix m_inv)
{
double det = determinate (m);
int i, j;
if (det == 0.0)
return;
/* Find the cofactor matrix of m, store it in m_inv */
cofactor (m, m_inv);
/* divide by the determinate */
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
m_inv[i][j] = m_inv[i][j] / det;
}
void void
transform_core_reset(tool, gdisp_ptr) transform_core_reset(tool, gdisp_ptr)
Tool * tool; Tool * tool;
@ -1127,12 +938,12 @@ transform_core_do (gimage, drawable, float_tiles, interpolation, matrix)
GimpDrawable *drawable; GimpDrawable *drawable;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
PixelRegion destPR; PixelRegion destPR;
TileManager *tiles; TileManager *tiles;
Matrix m; GimpMatrix m;
Matrix im; GimpMatrix im;
int itx, ity; int itx, ity;
int tx1, ty1, tx2, ty2; int tx1, ty1, tx2, ty2;
int width, height; int width, height;
@ -1183,12 +994,12 @@ transform_core_do (gimage, drawable, float_tiles, interpolation, matrix)
if (transform_tool_direction () == TRANSFORM_CORRECTIVE) if (transform_tool_direction () == TRANSFORM_CORRECTIVE)
{ {
invert (matrix, im); gimp_matrix_invert (matrix, im);
matrix = im; matrix = im;
} }
/* Find the inverse of the transformation matrix */ /* Find the inverse of the transformation matrix */
invert (matrix, m); gimp_matrix_invert (matrix, m);
x1 = float_tiles->x; x1 = float_tiles->x;
y1 = float_tiles->y; y1 = float_tiles->y;
@ -1207,10 +1018,10 @@ transform_core_do (gimage, drawable, float_tiles, interpolation, matrix)
{ {
double dx1, dy1, dx2, dy2, dx3, dy3, dx4, dy4; double dx1, dy1, dx2, dy2, dx3, dy3, dx4, dy4;
transform_point (matrix, x1, y1, &dx1, &dy1); gimp_matrix_transform_point (matrix, x1, y1, &dx1, &dy1);
transform_point (matrix, x2, y1, &dx2, &dy2); gimp_matrix_transform_point (matrix, x2, y1, &dx2, &dy2);
transform_point (matrix, x1, y2, &dx3, &dy3); gimp_matrix_transform_point (matrix, x1, y2, &dx3, &dy3);
transform_point (matrix, x2, y2, &dx4, &dy4); gimp_matrix_transform_point (matrix, x2, y2, &dx4, &dy4);
tx1 = MINIMUM (dx1, dx2); tx1 = MINIMUM (dx1, dx2);
tx1 = MINIMUM (tx1, dx3); tx1 = MINIMUM (tx1, dx3);

View file

@ -21,6 +21,7 @@
#include "info_dialog.h" #include "info_dialog.h"
#include "draw_core.h" #include "draw_core.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "libgimp/gimpmatrix.h"
/* possible scaling functions */ /* possible scaling functions */
#define CREATING 0 #define CREATING 0
@ -45,8 +46,6 @@
#define INTERACTIVE 1 #define INTERACTIVE 1
typedef double Vector[3];
typedef Vector Matrix[3];
typedef double TranInfo[TRAN_INFO_SIZE]; typedef double TranInfo[TRAN_INFO_SIZE];
typedef void * (* TransformFunc) (Tool *, void *, int); typedef void * (* TransformFunc) (Tool *, void *, int);
@ -83,7 +82,7 @@ struct _transform_core
int sx4, sy4; /* */ int sx4, sy4; /* */
int scx, scy; /* and center for rotation */ int scx, scy; /* and center for rotation */
Matrix transform; /* transformation matrix */ GimpMatrix transform; /* transformation matrix */
TranInfo trans_info; /* transformation info */ TranInfo trans_info; /* transformation info */
TileManager * original; /* pointer to original tiles */ TileManager * original; /* pointer to original tiles */
@ -137,20 +136,10 @@ void transform_core_reset (Tool *, void *);
void transform_core_grid_density_changed (void); void transform_core_grid_density_changed (void);
/* transform functions */ /* transform functions */
TileManager * transform_core_do (GImage *, GimpDrawable *, TileManager *, int, Matrix); TileManager * transform_core_do (GImage *, GimpDrawable *, TileManager *, int, GimpMatrix);
TileManager * transform_core_cut (GImage *, GimpDrawable *, int *); TileManager * transform_core_cut (GImage *, GimpDrawable *, int *);
Layer * transform_core_paste (GImage *, GimpDrawable *, TileManager *, int); Layer * transform_core_paste (GImage *, GimpDrawable *, TileManager *, int);
void transform_bounding_box (Tool*);
/* matrix functions */
void transform_bounding_box (Tool *);
void transform_point (Matrix, double, double, double *, double *);
void mult_matrix (Matrix, Matrix);
void identity_matrix (Matrix);
void translate_matrix (Matrix, double, double);
void scale_matrix (Matrix, double, double);
void rotate_matrix (Matrix, double);
void xshear_matrix (Matrix, double);
void yshear_matrix (Matrix, double);
#endif /* __TRANSFORM_CORE_H__ */ #endif /* __TRANSFORM_CORE_H__ */

View file

@ -57,7 +57,6 @@ static void * transform_core_recalc (Tool *, void *);
static void transform_core_doit (Tool *, gpointer); static void transform_core_doit (Tool *, gpointer);
static double cubic (double, int, int, int, int); static double cubic (double, int, int, int, int);
static void transform_core_setup_grid (Tool *); static void transform_core_setup_grid (Tool *);
static void invert (Matrix, Matrix);
#define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \ #define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \
((1-dy) * ((1-dx)*jk + dx*j1k) + \ ((1-dy) * ((1-dx)*jk + dx*j1k) + \
@ -742,23 +741,23 @@ transform_bounding_box (tool)
transform_core = (TransformCore *) tool->private; transform_core = (TransformCore *) tool->private;
transform_point (transform_core->transform, gimp_matrix_transform_point (transform_core->transform,
transform_core->x1, transform_core->y1, transform_core->x1, transform_core->y1,
&transform_core->tx1, &transform_core->ty1); &transform_core->tx1, &transform_core->ty1);
transform_point (transform_core->transform, gimp_matrix_transform_point (transform_core->transform,
transform_core->x2, transform_core->y1, transform_core->x2, transform_core->y1,
&transform_core->tx2, &transform_core->ty2); &transform_core->tx2, &transform_core->ty2);
transform_point (transform_core->transform, gimp_matrix_transform_point (transform_core->transform,
transform_core->x1, transform_core->y2, transform_core->x1, transform_core->y2,
&transform_core->tx3, &transform_core->ty3); &transform_core->tx3, &transform_core->ty3);
transform_point (transform_core->transform, gimp_matrix_transform_point (transform_core->transform,
transform_core->x2, transform_core->y2, transform_core->x2, transform_core->y2,
&transform_core->tx4, &transform_core->ty4); &transform_core->tx4, &transform_core->ty4);
if (tool->type == ROTATE) if (tool->type == ROTATE)
transform_point (transform_core->transform, gimp_matrix_transform_point (transform_core->transform,
transform_core->cx, transform_core->cy, transform_core->cx, transform_core->cy,
&transform_core->tcx, &transform_core->tcy); &transform_core->tcx, &transform_core->tcy);
if (transform_core->grid_coords != NULL && if (transform_core->grid_coords != NULL &&
transform_core->tgrid_coords != NULL) transform_core->tgrid_coords != NULL)
@ -767,204 +766,16 @@ transform_bounding_box (tool)
k = (transform_core->ngx + transform_core->ngy) * 2; k = (transform_core->ngx + transform_core->ngy) * 2;
for (i = 0; i < k; i++) for (i = 0; i < k; i++)
{ {
transform_point (transform_core->transform, gimp_matrix_transform_point (transform_core->transform,
transform_core->grid_coords[gci], transform_core->grid_coords[gci],
transform_core->grid_coords[gci+1], transform_core->grid_coords[gci+1],
&(transform_core->tgrid_coords[gci]), &(transform_core->tgrid_coords[gci]),
&(transform_core->tgrid_coords[gci+1])); &(transform_core->tgrid_coords[gci+1]));
gci += 2; gci += 2;
} }
} }
} }
void
transform_point (m, x, y, nx, ny)
Matrix m;
double x, y;
double *nx, *ny;
{
double xx, yy, ww;
xx = m[0][0] * x + m[0][1] * y + m[0][2];
yy = m[1][0] * x + m[1][1] * y + m[1][2];
ww = m[2][0] * x + m[2][1] * y + m[2][2];
if (!ww)
ww = 1.0;
*nx = xx / ww;
*ny = yy / ww;
}
void
mult_matrix (m1, m2)
Matrix m1, m2;
{
Matrix result;
int i, j, k;
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
{
result [i][j] = 0.0;
for (k = 0; k < 3; k++)
result [i][j] += m1 [i][k] * m2[k][j];
}
/* copy the result into matrix 2 */
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
m2 [i][j] = result [i][j];
}
void
identity_matrix (m)
Matrix m;
{
int i, j;
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
m[i][j] = (i == j) ? 1 : 0;
}
void
translate_matrix (m, x, y)
Matrix m;
double x, y;
{
Matrix trans;
identity_matrix (trans);
trans[0][2] = x;
trans[1][2] = y;
mult_matrix (trans, m);
}
void
scale_matrix (m, x, y)
Matrix m;
double x, y;
{
Matrix scale;
identity_matrix (scale);
scale[0][0] = x;
scale[1][1] = y;
mult_matrix (scale, m);
}
void
rotate_matrix (m, theta)
Matrix m;
double theta;
{
Matrix rotate;
double cos_theta, sin_theta;
cos_theta = cos (theta);
sin_theta = sin (theta);
identity_matrix (rotate);
rotate[0][0] = cos_theta;
rotate[0][1] = -sin_theta;
rotate[1][0] = sin_theta;
rotate[1][1] = cos_theta;
mult_matrix (rotate, m);
}
void
xshear_matrix (m, shear)
Matrix m;
double shear;
{
Matrix shear_m;
identity_matrix (shear_m);
shear_m[0][1] = shear;
mult_matrix (shear_m, m);
}
void
yshear_matrix (m, shear)
Matrix m;
double shear;
{
Matrix shear_m;
identity_matrix (shear_m);
shear_m[1][0] = shear;
mult_matrix (shear_m, m);
}
/* find the determinate for a 3x3 matrix */
static double
determinate (Matrix m)
{
int i;
double det = 0;
for (i = 0; i < 3; i ++)
{
det += m[0][i] * m[1][(i+1)%3] * m[2][(i+2)%3];
det -= m[2][i] * m[1][(i+1)%3] * m[0][(i+2)%3];
}
return det;
}
/* find the cofactor matrix of a matrix */
static void
cofactor (Matrix m, Matrix m_cof)
{
int i, j;
int x1, y1;
int x2, y2;
x1 = y1 = x2 = y2 = 0;
for (i = 0; i < 3; i++)
{
switch (i)
{
case 0 : y1 = 1; y2 = 2; break;
case 1 : y1 = 0; y2 = 2; break;
case 2 : y1 = 0; y2 = 1; break;
}
for (j = 0; j < 3; j++)
{
switch (j)
{
case 0 : x1 = 1; x2 = 2; break;
case 1 : x1 = 0; x2 = 2; break;
case 2 : x1 = 0; x2 = 1; break;
}
m_cof[i][j] = (m[x1][y1] * m[x2][y2] - m[x1][y2] * m[x2][y1]) *
(((i+j) % 2) ? -1 : 1);
}
}
}
/* find the inverse of a 3x3 matrix */
static void
invert (Matrix m, Matrix m_inv)
{
double det = determinate (m);
int i, j;
if (det == 0.0)
return;
/* Find the cofactor matrix of m, store it in m_inv */
cofactor (m, m_inv);
/* divide by the determinate */
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
m_inv[i][j] = m_inv[i][j] / det;
}
void void
transform_core_reset(tool, gdisp_ptr) transform_core_reset(tool, gdisp_ptr)
Tool * tool; Tool * tool;
@ -1127,12 +938,12 @@ transform_core_do (gimage, drawable, float_tiles, interpolation, matrix)
GimpDrawable *drawable; GimpDrawable *drawable;
TileManager *float_tiles; TileManager *float_tiles;
int interpolation; int interpolation;
Matrix matrix; GimpMatrix matrix;
{ {
PixelRegion destPR; PixelRegion destPR;
TileManager *tiles; TileManager *tiles;
Matrix m; GimpMatrix m;
Matrix im; GimpMatrix im;
int itx, ity; int itx, ity;
int tx1, ty1, tx2, ty2; int tx1, ty1, tx2, ty2;
int width, height; int width, height;
@ -1183,12 +994,12 @@ transform_core_do (gimage, drawable, float_tiles, interpolation, matrix)
if (transform_tool_direction () == TRANSFORM_CORRECTIVE) if (transform_tool_direction () == TRANSFORM_CORRECTIVE)
{ {
invert (matrix, im); gimp_matrix_invert (matrix, im);
matrix = im; matrix = im;
} }
/* Find the inverse of the transformation matrix */ /* Find the inverse of the transformation matrix */
invert (matrix, m); gimp_matrix_invert (matrix, m);
x1 = float_tiles->x; x1 = float_tiles->x;
y1 = float_tiles->y; y1 = float_tiles->y;
@ -1207,10 +1018,10 @@ transform_core_do (gimage, drawable, float_tiles, interpolation, matrix)
{ {
double dx1, dy1, dx2, dy2, dx3, dy3, dx4, dy4; double dx1, dy1, dx2, dy2, dx3, dy3, dx4, dy4;
transform_point (matrix, x1, y1, &dx1, &dy1); gimp_matrix_transform_point (matrix, x1, y1, &dx1, &dy1);
transform_point (matrix, x2, y1, &dx2, &dy2); gimp_matrix_transform_point (matrix, x2, y1, &dx2, &dy2);
transform_point (matrix, x1, y2, &dx3, &dy3); gimp_matrix_transform_point (matrix, x1, y2, &dx3, &dy3);
transform_point (matrix, x2, y2, &dx4, &dy4); gimp_matrix_transform_point (matrix, x2, y2, &dx4, &dy4);
tx1 = MINIMUM (dx1, dx2); tx1 = MINIMUM (dx1, dx2);
tx1 = MINIMUM (tx1, dx3); tx1 = MINIMUM (tx1, dx3);

View file

@ -21,6 +21,7 @@
#include "info_dialog.h" #include "info_dialog.h"
#include "draw_core.h" #include "draw_core.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "libgimp/gimpmatrix.h"
/* possible scaling functions */ /* possible scaling functions */
#define CREATING 0 #define CREATING 0
@ -45,8 +46,6 @@
#define INTERACTIVE 1 #define INTERACTIVE 1
typedef double Vector[3];
typedef Vector Matrix[3];
typedef double TranInfo[TRAN_INFO_SIZE]; typedef double TranInfo[TRAN_INFO_SIZE];
typedef void * (* TransformFunc) (Tool *, void *, int); typedef void * (* TransformFunc) (Tool *, void *, int);
@ -83,7 +82,7 @@ struct _transform_core
int sx4, sy4; /* */ int sx4, sy4; /* */
int scx, scy; /* and center for rotation */ int scx, scy; /* and center for rotation */
Matrix transform; /* transformation matrix */ GimpMatrix transform; /* transformation matrix */
TranInfo trans_info; /* transformation info */ TranInfo trans_info; /* transformation info */
TileManager * original; /* pointer to original tiles */ TileManager * original; /* pointer to original tiles */
@ -137,20 +136,10 @@ void transform_core_reset (Tool *, void *);
void transform_core_grid_density_changed (void); void transform_core_grid_density_changed (void);
/* transform functions */ /* transform functions */
TileManager * transform_core_do (GImage *, GimpDrawable *, TileManager *, int, Matrix); TileManager * transform_core_do (GImage *, GimpDrawable *, TileManager *, int, GimpMatrix);
TileManager * transform_core_cut (GImage *, GimpDrawable *, int *); TileManager * transform_core_cut (GImage *, GimpDrawable *, int *);
Layer * transform_core_paste (GImage *, GimpDrawable *, TileManager *, int); Layer * transform_core_paste (GImage *, GimpDrawable *, TileManager *, int);
void transform_bounding_box (Tool*);
/* matrix functions */
void transform_bounding_box (Tool *);
void transform_point (Matrix, double, double, double *, double *);
void mult_matrix (Matrix, Matrix);
void identity_matrix (Matrix);
void translate_matrix (Matrix, double, double);
void scale_matrix (Matrix, double, double);
void rotate_matrix (Matrix, double);
void xshear_matrix (Matrix, double);
void yshear_matrix (Matrix, double);
#endif /* __TRANSFORM_CORE_H__ */ #endif /* __TRANSFORM_CORE_H__ */

View file

@ -9,23 +9,24 @@ If your plugin or script writes parasites, please amend this file.
------------------------------------------------------------------ ------------------------------------------------------------------
*** CREATORS: *** PREFIXES:
"GIF2" : The standard GIMP GIF plugin "gif2" : The standard GIMP GIF plugin
"tiff" : The standard GIMP TIFF plugin "tiff" : The standard GIMP TIFF plugin
"gimp" : For common and standard parasites
------------------------------------------------------------------ ------------------------------------------------------------------
*** CREATOR / TYPE: *** PARASITES:
"GIF2" / "CMNT" : Standard GIF-style comments. This parasite is "gimp-comment" : Standard GIF-style comments. This parasite is
human-readable text in unspecified 8-bit ASCII. It human-readable text in unspecified 8-bit ASCII. It
includes a trailing \0 string terminator. The size includes a trailing \0 string terminator. The size
of the parasite data may not exceed 241 bytes. of the parasite data may not exceed 241 bytes.
This parasite attaches to images only. This parasite attaches to images only.
"tiff" / "sopt" : The TiffSaveVals structure from the TIFF plugin. "tiff-save-options" : The TiffSaveVals structure from the TIFF plugin.
This parasite attaches to images only. This parasite attaches to images only.
------------------------------------------------------------------ ------------------------------------------------------------------

View file

@ -10,10 +10,16 @@ lib_LTLIBRARIES = libgimp.la libgimpui.la
noinst_LIBRARIES = libgimpi.a noinst_LIBRARIES = libgimpi.a
libgimpi_a_SOURCES = \ libgimpi_a_SOURCES = \
gimpmatrix.c \
gimpmatrix.h \
gimpprotocol.c \ gimpprotocol.c \
gimpprotocol.h \ gimpprotocol.h \
gimpwire.c \ gimpwire.c \
gimpwire.h gimpwire.h \
parasite.c \
parasite.h \
parasiteF.h \
parasiteP.h
## Evil hack to insure all deps are satisfied on first-run make ## Evil hack to insure all deps are satisfied on first-run make
libgimpi_a_DEPENDENCIES = libgimp.la libgimpi_a_DEPENDENCIES = libgimp.la
@ -26,6 +32,8 @@ libgimp_la_SOURCES = \
gimpgradient.c \ gimpgradient.c \
gimpimage.c \ gimpimage.c \
gimplayer.c \ gimplayer.c \
gimpmatrix.c \
gimpmatrix.h \
gimppalette.c \ gimppalette.c \
gimppixelrgn.c \ gimppixelrgn.c \
gimpprotocol.c \ gimpprotocol.c \
@ -33,8 +41,10 @@ libgimp_la_SOURCES = \
gimptile.c \ gimptile.c \
gimpwire.c \ gimpwire.c \
gimpwire.h \ gimpwire.h \
gimpparasite.c \ parasite.c \
gimpparasite.h parasite.h \
parasiteF.h \
parasiteP.h
libgimpui_la_SOURCES = \ libgimpui_la_SOURCES = \
gimpmenu.c \ gimpmenu.c \
@ -44,13 +54,16 @@ gimpinclude_HEADERS = \
gimp.h \ gimp.h \
gimpenums.h \ gimpenums.h \
gimpfeatures.h \ gimpfeatures.h \
gimpmatrix.h \
gimpmenu.h \ gimpmenu.h \
gimpui.h \ gimpui.h \
gimpintl.h \ gimpintl.h \
gimpparasite.h parasite.h \
parasiteF.h \
parasiteP.h
libgimp_la_LDFLAGS = \ libgimp_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) -lm
libgimpui_la_LDFLAGS = \ libgimpui_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE)

View file

@ -28,6 +28,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <sys/param.h> #include <sys/param.h>
#include <unistd.h> #include <unistd.h>
#include "parasiteP.h"
#ifdef HAVE_IPC_H #ifdef HAVE_IPC_H
#include <sys/ipc.h> #include <sys/ipc.h>
@ -624,7 +625,7 @@ gimp_run_procedure (char *name,
(void) va_arg (args, guchar*); (void) va_arg (args, guchar*);
break; break;
case PARAM_PARASITE: case PARAM_PARASITE:
(void) va_arg (args, GParasite*); (void) va_arg (args, Parasite*);
break; break;
case PARAM_REGION: case PARAM_REGION:
break; break;
@ -712,19 +713,13 @@ gimp_run_procedure (char *name,
break; break;
case PARAM_PARASITE: case PARAM_PARASITE:
{ {
GParasite *p = va_arg (args, GParasite*); Parasite *p = va_arg (args, Parasite*);
if (p == NULL) if (p == NULL)
p = gparasite_error(); p = parasite_error();
memcpy(proc_run.params[i].data.d_parasite.creator, p->creator, 4); proc_run.params[i].data.d_parasite.name = p->name;
memcpy(proc_run.params[i].data.d_parasite.type, p->type, 4);
proc_run.params[i].data.d_parasite.flags = p->flags; proc_run.params[i].data.d_parasite.flags = p->flags;
proc_run.params[i].data.d_parasite.size = p->size; proc_run.params[i].data.d_parasite.size = p->size;
if (p->size > 0) proc_run.params[i].data.d_parasite.data = p->data;
proc_run.params[i].data.d_parasite.data = g_memdup (p->data,
p->size);
else
proc_run.params[i].data.d_parasite.data = NULL;
} break; } break;
case PARAM_STATUS: case PARAM_STATUS:
proc_run.params[i].data.d_status = va_arg (args, gint32); proc_run.params[i].data.d_status = va_arg (args, gint32);

View file

@ -21,9 +21,10 @@
#include <glib.h> #include <glib.h>
#include <libgimp/gimpenums.h> #include "libgimp/gimpenums.h"
#include <libgimp/gimpfeatures.h> #include "libgimp/gimpfeatures.h"
#include <libgimp/gimpparasite.h> #include "libgimp/parasite.h"
#include "libgimp/parasiteP.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -158,7 +159,7 @@ union _GParamData
gint32 d_selection; gint32 d_selection;
gint32 d_boundary; gint32 d_boundary;
gint32 d_path; gint32 d_path;
GParasite d_parasite; Parasite d_parasite;
gint32 d_status; gint32 d_status;
}; };
@ -427,13 +428,12 @@ void gimp_image_set_component_visible (gint32 image_ID,
gint visible); gint visible);
void gimp_image_set_filename (gint32 image_ID, void gimp_image_set_filename (gint32 image_ID,
char *name); char *name);
GParasite *gimp_image_find_parasite (gint32 image_ID, Parasite *gimp_image_find_parasite (gint32 image_ID,
const char *creator, const char *name);
const char *type);
void gimp_image_attach_parasite (gint32 image_ID, void gimp_image_attach_parasite (gint32 image_ID,
const GParasite *p); const Parasite *p);
void gimp_image_detach_parasite (gint32 image_ID, void gimp_image_detach_parasite (gint32 image_ID,
GParasite *p); const char *name);
void gimp_image_set_resolution (gint32 image_ID, void gimp_image_set_resolution (gint32 image_ID,
float resolution); float resolution);
float gimp_image_get_resolution (gint32 image_ID); float gimp_image_get_resolution (gint32 image_ID);
@ -529,13 +529,12 @@ void gimp_layer_set_show_mask (gint32 layer_ID,
gint show_mask); gint show_mask);
void gimp_layer_set_visible (gint32 layer_ID, void gimp_layer_set_visible (gint32 layer_ID,
gint visible); gint visible);
GParasite *gimp_layer_find_parasite (gint32 image_ID, Parasite *gimp_layer_find_parasite (gint32 image_ID,
const char *creator, const char *name);
const char *type);
void gimp_layer_attach_parasite (gint32 layer_ID, void gimp_layer_attach_parasite (gint32 layer_ID,
const GParasite *p); const Parasite *p);
void gimp_layer_detach_parasite (gint32 layer_ID, void gimp_layer_detach_parasite (gint32 layer_ID,
GParasite *p); const char *name);
/**************************************** /****************************************
@ -627,13 +626,12 @@ GTile* gimp_drawable_get_tile2 (GDrawable *drawable,
gint shadow, gint shadow,
gint x, gint x,
gint y); gint y);
GParasite *gimp_drawable_find_parasite (gint32 drawable, Parasite *gimp_drawable_find_parasite (gint32 drawable,
const char *creator, const char *name);
const char *type);
void gimp_drawable_attach_parasite (gint32 drawable, void gimp_drawable_attach_parasite (gint32 drawable,
const GParasite *p); const Parasite *p);
void gimp_drawable_detach_parasite (gint32 drawable, void gimp_drawable_detach_parasite (gint32 drawable,
GParasite *p); const char *name);
/**************************************** /****************************************
* GTiles * * GTiles *

View file

@ -576,25 +576,23 @@ gimp_drawable_get_tile2 (GDrawable *drawable,
return gimp_drawable_get_tile (drawable, shadow, row, col); return gimp_drawable_get_tile (drawable, shadow, row, col);
} }
GParasite * Parasite *
gimp_drawable_find_parasite (gint32 drawable_ID, gimp_drawable_find_parasite (gint32 drawable_ID,
const char *creator, const char *name)
const char *type)
{ {
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
GParasite *parasite; Parasite *parasite;
return_vals = gimp_run_procedure ("gimp_drawable_find_parasite", return_vals = gimp_run_procedure ("gimp_drawable_find_parasite",
&nreturn_vals, &nreturn_vals,
PARAM_DRAWABLE, drawable_ID, PARAM_DRAWABLE, drawable_ID,
PARAM_STRING, creator, PARAM_STRING, name,
PARAM_STRING, type,
PARAM_END); PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS) if (return_vals[0].data.d_status == STATUS_SUCCESS)
{ {
parasite = gparasite_copy(&return_vals[1].data.d_parasite); parasite = parasite_copy(&return_vals[1].data.d_parasite);
} }
else else
parasite = NULL; parasite = NULL;
@ -606,7 +604,7 @@ gimp_drawable_find_parasite (gint32 drawable_ID,
void void
gimp_drawable_attach_parasite (gint32 drawable_ID, gimp_drawable_attach_parasite (gint32 drawable_ID,
const GParasite *p) const Parasite *p)
{ {
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
@ -623,7 +621,7 @@ gimp_drawable_attach_parasite (gint32 drawable_ID,
void void
gimp_drawable_detach_parasite (gint32 drawable_ID, gimp_drawable_detach_parasite (gint32 drawable_ID,
GParasite *p) const char *name)
{ {
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
@ -631,7 +629,7 @@ gimp_drawable_detach_parasite (gint32 drawable_ID,
return_vals = gimp_run_procedure ("gimp_drawable_detach_parasite", return_vals = gimp_run_procedure ("gimp_drawable_detach_parasite",
&nreturn_vals, &nreturn_vals,
PARAM_DRAWABLE, drawable_ID, PARAM_DRAWABLE, drawable_ID,
PARAM_PARASITE, p, PARAM_STRING, name,
PARAM_END); PARAM_END);

View file

@ -576,25 +576,23 @@ gimp_drawable_get_tile2 (GDrawable *drawable,
return gimp_drawable_get_tile (drawable, shadow, row, col); return gimp_drawable_get_tile (drawable, shadow, row, col);
} }
GParasite * Parasite *
gimp_drawable_find_parasite (gint32 drawable_ID, gimp_drawable_find_parasite (gint32 drawable_ID,
const char *creator, const char *name)
const char *type)
{ {
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
GParasite *parasite; Parasite *parasite;
return_vals = gimp_run_procedure ("gimp_drawable_find_parasite", return_vals = gimp_run_procedure ("gimp_drawable_find_parasite",
&nreturn_vals, &nreturn_vals,
PARAM_DRAWABLE, drawable_ID, PARAM_DRAWABLE, drawable_ID,
PARAM_STRING, creator, PARAM_STRING, name,
PARAM_STRING, type,
PARAM_END); PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS) if (return_vals[0].data.d_status == STATUS_SUCCESS)
{ {
parasite = gparasite_copy(&return_vals[1].data.d_parasite); parasite = parasite_copy(&return_vals[1].data.d_parasite);
} }
else else
parasite = NULL; parasite = NULL;
@ -606,7 +604,7 @@ gimp_drawable_find_parasite (gint32 drawable_ID,
void void
gimp_drawable_attach_parasite (gint32 drawable_ID, gimp_drawable_attach_parasite (gint32 drawable_ID,
const GParasite *p) const Parasite *p)
{ {
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
@ -623,7 +621,7 @@ gimp_drawable_attach_parasite (gint32 drawable_ID,
void void
gimp_drawable_detach_parasite (gint32 drawable_ID, gimp_drawable_detach_parasite (gint32 drawable_ID,
GParasite *p) const char *name)
{ {
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
@ -631,7 +629,7 @@ gimp_drawable_detach_parasite (gint32 drawable_ID,
return_vals = gimp_run_procedure ("gimp_drawable_detach_parasite", return_vals = gimp_run_procedure ("gimp_drawable_detach_parasite",
&nreturn_vals, &nreturn_vals,
PARAM_DRAWABLE, drawable_ID, PARAM_DRAWABLE, drawable_ID,
PARAM_PARASITE, p, PARAM_STRING, name,
PARAM_END); PARAM_END);

View file

@ -910,25 +910,21 @@ gimp_image_set_filename (gint32 image_ID,
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
} }
GParasite * Parasite *
gimp_image_find_parasite (gint32 image_ID, gimp_image_find_parasite (gint32 image_ID, const char *name)
const char *creator,
const char *type)
{ {
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
GParasite *parasite; Parasite *parasite;
return_vals = gimp_run_procedure ("gimp_image_find_parasite", return_vals = gimp_run_procedure ("gimp_image_find_parasite",
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_ID, PARAM_IMAGE, image_ID,
PARAM_STRING, creator, PARAM_STRING, name,
PARAM_STRING, type,
PARAM_END); PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS) if (return_vals[0].data.d_status == STATUS_SUCCESS)
{ {
parasite = gparasite_copy(&return_vals[1].data.d_parasite); parasite = parasite_copy(&return_vals[1].data.d_parasite);
} }
else else
parasite = NULL; parasite = NULL;
@ -939,8 +935,7 @@ gimp_image_find_parasite (gint32 image_ID,
} }
void void
gimp_image_attach_parasite (gint32 image_ID, gimp_image_attach_parasite (gint32 image_ID, const Parasite *p)
const GParasite *p)
{ {
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
@ -955,8 +950,7 @@ gimp_image_attach_parasite (gint32 image_ID,
} }
void void
gimp_image_detach_parasite (gint32 image_ID, gimp_image_detach_parasite (gint32 image_ID, const char *name)
GParasite *p)
{ {
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
@ -964,7 +958,7 @@ gimp_image_detach_parasite (gint32 image_ID,
return_vals = gimp_run_procedure ("gimp_image_detach_parasite", return_vals = gimp_run_procedure ("gimp_image_detach_parasite",
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_ID, PARAM_IMAGE, image_ID,
PARAM_PARASITE, p, PARAM_STRING, name,
PARAM_END); PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);

View file

@ -910,25 +910,21 @@ gimp_image_set_filename (gint32 image_ID,
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
} }
GParasite * Parasite *
gimp_image_find_parasite (gint32 image_ID, gimp_image_find_parasite (gint32 image_ID, const char *name)
const char *creator,
const char *type)
{ {
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
GParasite *parasite; Parasite *parasite;
return_vals = gimp_run_procedure ("gimp_image_find_parasite", return_vals = gimp_run_procedure ("gimp_image_find_parasite",
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_ID, PARAM_IMAGE, image_ID,
PARAM_STRING, creator, PARAM_STRING, name,
PARAM_STRING, type,
PARAM_END); PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS) if (return_vals[0].data.d_status == STATUS_SUCCESS)
{ {
parasite = gparasite_copy(&return_vals[1].data.d_parasite); parasite = parasite_copy(&return_vals[1].data.d_parasite);
} }
else else
parasite = NULL; parasite = NULL;
@ -939,8 +935,7 @@ gimp_image_find_parasite (gint32 image_ID,
} }
void void
gimp_image_attach_parasite (gint32 image_ID, gimp_image_attach_parasite (gint32 image_ID, const Parasite *p)
const GParasite *p)
{ {
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
@ -955,8 +950,7 @@ gimp_image_attach_parasite (gint32 image_ID,
} }
void void
gimp_image_detach_parasite (gint32 image_ID, gimp_image_detach_parasite (gint32 image_ID, const char *name)
GParasite *p)
{ {
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
@ -964,7 +958,7 @@ gimp_image_detach_parasite (gint32 image_ID,
return_vals = gimp_run_procedure ("gimp_image_detach_parasite", return_vals = gimp_run_procedure ("gimp_image_detach_parasite",
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_ID, PARAM_IMAGE, image_ID,
PARAM_PARASITE, p, PARAM_STRING, name,
PARAM_END); PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);

171
libgimp/gimpmatrix.c Normal file
View file

@ -0,0 +1,171 @@
/* gimpmatrix.c
* Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gimpmatrix.h"
#include <math.h>
void
gimp_matrix_transform_point (const GimpMatrix m, double x, double y,
double *newx, double *newy)
{
double w;
w = m[2][0]*x + m[2][1]*y + m[2][2];
if (w == 0.0)
w = 1.0;
else
w = 1.0/w;
*newx = (m[0][0]*x + m[0][1]*y + m[0][2])*w;
*newy = (m[1][0]*x + m[1][1]*y + m[1][2])*w;
}
void
gimp_matrix_mult (const GimpMatrix m1, GimpMatrix m2)
{
int i, j;
GimpMatrix tmp;
double t1, t2, t3;
for (i = 0; i < 3; i++)
{
t1 = m1[i][0];
t2 = m1[i][1];
t3 = m1[i][2];
for (j = 0; j < 3; j++)
{
tmp[i][j] = t1 * m2[0][j];
tmp[i][j] += t2 * m2[1][j];
tmp[i][j] += t3 * m2[2][j];
}
}
/* put the results in m2 */
memcpy(&m2[0][0], &tmp[0][0], sizeof(double)*9);
}
void
gimp_matrix_identity (GimpMatrix m)
{
static GimpMatrix identity = {{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0} };
memcpy(&m[0][0], &identity[0][0], sizeof(double)*9);
}
void
gimp_matrix_translate (GimpMatrix m, double x, double y)
{
double g, h, i;
g = m[2][0];
h = m[2][1];
i = m[2][2];
m[0][0] += x*g;
m[0][1] += x*h;
m[0][2] += x*i;
m[1][0] += y*g;
m[1][1] += y*h;
m[1][2] += y*i;
}
void
gimp_matrix_scale (GimpMatrix m, double x, double y)
{
m[0][0] *= x;
m[0][1] *= x;
m[0][2] *= x;
m[1][0] *= y;
m[1][1] *= y;
m[1][2] *= y;
}
void
gimp_matrix_rotate (GimpMatrix m, double theta)
{
double t1, t2;
double cost, sint;
cost = cos(theta);
sint = sin(theta);
t1 = m[0][0];
t2 = m[1][0];
m[0][0] = cost*t1 - sint*t2;
m[1][0] = sint*t1 + cost*t2;
t1 = m[0][1];
t2 = m[1][1];
m[0][1] = cost*t1 - sint*t2;
m[1][1] = sint*t1 + cost*t2;
t1 = m[0][2];
t2 = m[1][2];
m[0][2] = cost*t1 - sint*t2;
m[1][2] = sint*t1 + cost*t2;
}
void
gimp_matrix_xshear (GimpMatrix m, double amnt)
{
m[0][0] += amnt * m[1][0];
m[0][1] += amnt * m[1][1];
m[0][2] += amnt * m[1][2];
}
void
gimp_matrix_yshear (GimpMatrix m, double amnt)
{
m[1][0] += amnt * m[0][0];
m[1][1] += amnt * m[0][1];
m[1][2] += amnt * m[0][2];
}
double
gimp_matrix_determinant (const GimpMatrix m)
{
double determinant;
determinant = m[0][0] * (m[1][1]*m[2][2] - m[1][2]*m[2][1]);
determinant -= m[1][0] * (m[0][1]*m[2][2] - m[0][2]*m[2][1]);
determinant += m[2][0] * (m[0][1]*m[1][2] - m[0][2]*m[1][1]);
return determinant;
}
void
gimp_matrix_invert (const GimpMatrix m, GimpMatrix m_inv)
{
double det_1;
det_1 = gimp_matrix_determinant (m);
if (det_1 == 0.0)
return;
det_1 = 1.0 / det_1;
m_inv[0][0] = ( m[1][1] * m[2][2] - m[1][2] * m[2][1] ) * det_1;
m_inv[1][0] = - ( m[1][0] * m[2][2] - m[1][2] * m[2][0] ) * det_1;
m_inv[2][0] = ( m[1][0] * m[2][1] - m[1][1] * m[2][0] ) * det_1;
m_inv[0][1] = - ( m[0][1] * m[2][2] - m[0][2] * m[2][1] ) * det_1;
m_inv[1][1] = ( m[0][0] * m[2][2] - m[0][2] * m[2][0] ) * det_1;
m_inv[2][1] = - ( m[0][0] * m[2][1] - m[0][1] * m[2][0] ) * det_1;
m_inv[0][2] = ( m[0][1] * m[1][2] - m[0][2] * m[1][1] ) * det_1;
m_inv[1][2] = - ( m[0][0] * m[1][2] - m[0][2] * m[1][0] ) * det_1;
m_inv[2][2] = ( m[0][0] * m[1][1] - m[0][1] * m[1][0] ) * det_1;
}

38
libgimp/gimpmatrix.h Normal file
View file

@ -0,0 +1,38 @@
/* gimpmatrix.h
* Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GIMPMATRIX_H__
#define __GIMPMATRIX_H__
typedef double GimpMatrix[3][3];
void gimp_matrix_transform_point (const GimpMatrix, double, double,
double *, double *);
void gimp_matrix_mult (const GimpMatrix, GimpMatrix);
void gimp_matrix_identity (GimpMatrix);
void gimp_matrix_translate (GimpMatrix, double, double);
void gimp_matrix_scale (GimpMatrix, double, double);
void gimp_matrix_rotate (GimpMatrix, double);
void gimp_matrix_xshear (GimpMatrix, double);
void gimp_matrix_yshear (GimpMatrix, double);
double gimp_matrix_determinant (const GimpMatrix);
void gimp_matrix_invert (const GimpMatrix m, GimpMatrix m_inv);
#endif /* __GIMPMATRIX_H__ */

145
libgimp/gimpparasite.c Normal file
View file

@ -0,0 +1,145 @@
/* parasite.c
* Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "parasiteP.h"
#include "parasite.h"
#include <string.h>
#include <glib.h>
Parasite *
parasite_new (const char *name, guint32 flags,
guint32 size, const void *data)
{
Parasite *p;
p = (Parasite *)g_malloc(sizeof(Parasite));
if (name)
p->name = g_strdup(name);
else
p->name = NULL;
p->flags = flags;
p->size = size;
if (size)
p->data = g_memdup(data, size);
else
p->data = NULL;
return p;
}
void
parasite_free (Parasite *parasite)
{
g_return_if_fail(parasite != NULL);
if (parasite->name)
g_free(parasite->name);
if (parasite->data)
g_free(parasite->data);
g_free(parasite);
}
int
parasite_is_type (const Parasite *parasite, const char *name)
{
if (!parasite)
return FALSE;
return (strcmp(parasite->name, name) == 0);
}
Parasite *
parasite_copy (const Parasite *parasite)
{
if (parasite == NULL)
return NULL;
return parasite_new (parasite->name, parasite->flags,
parasite->size, parasite->data);
}
Parasite *
parasite_error()
{
static Parasite *error_p = NULL;
if (!error_p)
error_p = parasite_new("error", 0, 0, NULL);
return error_p;
}
int
parasite_is_error(const Parasite *p)
{
if (p == NULL)
return TRUE;
return parasite_is_type(p, "error");
}
int
parasite_is_persistant(const Parasite *p)
{
if (p == NULL)
return FALSE;
return (p->flags & PARASITE_PERSISTANT);
}
/* parasite list functions */
Parasite *
parasite_find_in_gslist (const GSList *list, const char *name)
{
while (list)
{
if (parasite_is_type((Parasite *)(list->data), name))
return (Parasite *)(list->data);
list = list->next;
}
return NULL;
}
GSList*
parasite_add_to_gslist (const Parasite *parasite, GSList *list)
{
Parasite *p;
if (parasite_is_error(parasite))
return list;
if ((p = parasite_find_in_gslist(list, parasite->name)))
{
list = g_slist_remove(list, p);
parasite_free(p);
}
return g_slist_prepend (list, parasite_copy(parasite));
}
GSList*
parasite_gslist_copy (const GSList *list)
{
GSList *copy = NULL;
while (list)
{
copy = g_slist_append (copy, parasite_copy((Parasite *)list->data));
list = list->next;
}
return copy;
}
void
parasite_gslist_destroy (GSList *list)
{
while (list)
{
parasite_free((Parasite *)list->data);
list = g_slist_remove (list, list->data);
}
}

49
libgimp/gimpparasite.h Normal file
View file

@ -0,0 +1,49 @@
/* parasite.h
* Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _PARASITE_H_
#define _PARASITE_H_
#include <glib.h>
#include <libgimp/parasiteF.h>
#define PARASITE_PERSISTANT 1
Parasite *parasite_new (const char *name, guint32 flags,
guint32 size, const void *data);
void parasite_free (Parasite *parasite);
int parasite_is_type (const Parasite *parasite, const char *name);
Parasite *parasite_copy (const Parasite *parasite);
Parasite *parasite_error ();
int parasite_is_error (const Parasite *p);
int parasite_is_persistant (const Parasite *p);
/* parasite list functions */
GSList *parasite_add_to_gslist (const Parasite *parasite, GSList *list);
Parasite *parasite_find_in_gslist (const GSList *list, const char *name);
GSList *parasite_gslist_copy (const GSList *list);
void parasite_gslist_destroy (GSList *list);
#endif _PARASITE_H_

34
libgimp/gimpparasiteP.h Normal file
View file

@ -0,0 +1,34 @@
/* parasiteP.h
* Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _PARASITEP_H_
#define _PARASITEP_H_
#include <glib.h>
struct _Parasite
{
char *name; /* The name of the parasite. USE A UNIQUE PREFIX! */
guint32 flags; /* save Parasite in XCF file, etc. */
guint32 size; /* amount of data */
void *data; /* a pointer to the data. plugin is *
* responsible for tracking byte order */
};
#endif _PARASITEP_H_

View file

@ -1,110 +0,0 @@
/* gimpparasite.c
* Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gimpparasite.h"
#include <string.h>
#include <glib.h>
#include <stdio.h>
GParasite *
gparasite_new (const char *creator, const char *type, guint32 flags, guint32 size,
const void *data)
{
GParasite *p;
p = (GParasite *)g_malloc(sizeof(GParasite));
if (creator)
memcpy(p->creator, creator, 4);
else
memset(p->creator, 0, 4);
if (type)
memcpy(p->type, type, 4);
else
memset(p->type, 0, 4);
p->flags = flags;
p->size = size;
if (size)
p->data = g_memdup(data, size);
else
p->data = NULL;
return p;
}
void
gparasite_free (GParasite *parasite)
{
if (!parasite)
return;
if (parasite->data)
g_free(parasite->data);
g_free(parasite);
}
int
gparasite_has_type (const GParasite *parasite, const char *creator, const char *type)
{
if (!parasite)
return FALSE;
if (creator && parasite->creator && strncmp(creator, parasite->creator, 4) != 0)
return FALSE;
if (creator != 0 && parasite->creator == 0)
return FALSE;
if (type && parasite->type && strncmp(type, parasite->type, 4) != 0)
return FALSE;
if (type != 0 && parasite->type == 0)
return FALSE;
return TRUE;
}
GParasite *
gparasite_copy (const GParasite *parasite)
{
GParasite *p;
p = (GParasite *)g_malloc(sizeof(GParasite));
if (parasite->creator)
memcpy(p->creator, parasite->creator, 4);
else
memset(p->creator, 0, 4);
if (parasite->type)
memcpy(p->type, parasite->type, 4);
else
memset(p->type, 0, 4);
p->size = parasite->size;
if (parasite->size)
p->data = g_memdup(parasite->data, parasite->size);
else
p->data = NULL;
return p;
}
int
gparasite_is_error(const GParasite *p)
{
if (p == NULL)
return TRUE;
return gparasite_has_type(p, "eror", "eror");
}
GParasite *
gparasite_error()
{
static GParasite *error_p = NULL;
if (!error_p)
error_p = gparasite_new("eror", "eror", 0, 0, NULL);
return error_p;
}

View file

@ -19,7 +19,8 @@
#include "gimpenums.h" #include "gimpenums.h"
#include "gimpprotocol.h" #include "gimpprotocol.h"
#include "gimpwire.h" #include "gimpwire.h"
#include "gimpparasite.h" #include "parasite.h"
#include "parasiteP.h"
#include <stdio.h> #include <stdio.h>
@ -911,10 +912,7 @@ _gp_params_read (int fd, GPParam **params, guint *nparams)
break; break;
case PARAM_PARASITE: case PARAM_PARASITE:
{ {
if (!wire_read_int8 (fd, &((*params)[i].data.d_parasite.creator[0]), if (!wire_read_string (fd, &(*params)[i].data.d_parasite.name, 1))
4))
return;
if (!wire_read_int8 (fd, &((*params)[i].data.d_parasite.type[0]), 4))
return; return;
if (!wire_read_int32 (fd, &((*params)[i].data.d_parasite.flags), 1)) if (!wire_read_int32 (fd, &((*params)[i].data.d_parasite.flags), 1))
return; return;
@ -1048,10 +1046,8 @@ _gp_params_write (int fd, GPParam *params, int nparams)
break; break;
case PARAM_PARASITE: case PARAM_PARASITE:
{ {
GParasite *p = (GParasite *)&params[i].data.d_parasite; Parasite *p = (Parasite *)&params[i].data.d_parasite;
if (!wire_write_int8 (fd, &p->creator[0], 4)) if (!wire_write_string (fd, &p->name, 1))
return;
if (!wire_write_int8 (fd, &p->type[0], 4))
return; return;
if (!wire_write_int32 (fd, &p->flags, 1)) if (!wire_write_int32 (fd, &p->flags, 1))
return; return;

View file

@ -123,8 +123,7 @@ struct _GPParam
gint32 d_path; gint32 d_path;
struct struct
{ {
guchar creator[4]; char *name;
guchar type[4];
guint32 flags; guint32 flags;
guint32 size; guint32 size;
void *data; void *data;

Some files were not shown because too many files have changed in this diff Show more