From c5a8b4384640dfdb514b72b7f53d1f0a1dbcfaf7 Mon Sep 17 00:00:00 2001 From: jaycox Date: Wed, 14 Oct 1998 02:54:02 +0000 Subject: [PATCH] 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. --- ChangeLog | 56 +++++ app/Makefile.am | 4 - app/actions/plug-in-commands.c | 12 +- app/channel.c | 8 +- app/channel.h | 2 + app/channel_cmds.c | 69 ++++++ app/channel_cmds.h | 1 + app/core/gimpchannel-combine.c | 8 +- app/core/gimpchannel-combine.h | 2 + app/core/gimpchannel.c | 8 +- app/core/gimpchannel.h | 2 + app/core/gimpdrawable.c | 37 ++- app/core/gimpdrawable.h | 10 +- app/core/gimpimage-guides.c | 63 +++++- app/core/gimpimage-guides.h | 13 +- app/core/gimpimage-merge.c | 63 +++++- app/core/gimpimage-merge.h | 13 +- app/core/gimpimage-projection.c | 63 +++++- app/core/gimpimage-projection.h | 13 +- app/core/gimpimage-resize.c | 63 +++++- app/core/gimpimage-resize.h | 13 +- app/core/gimpimage-scale.c | 63 +++++- app/core/gimpimage-scale.h | 13 +- app/core/gimpimage.c | 63 +++++- app/core/gimpimage.h | 13 +- app/core/gimplayer.c | 5 + app/core/gimplayer.h | 1 + app/core/gimpprojection-construct.c | 63 +++++- app/core/gimpprojection-construct.h | 13 +- app/drawable_cmds.c | 36 ++- app/gimage_cmds.c | 44 ++-- app/gimpchannel.c | 8 +- app/gimpchannel.h | 2 + app/gimpdrawable.c | 37 ++- app/gimpdrawable.h | 10 +- app/gimpdrawableP.h | 6 + app/gimpimage.c | 63 +++++- app/gimpimage.h | 13 +- app/gimpimageP.h | 7 + app/gimplayer.c | 5 + app/gimplayer.h | 1 + app/gui/plug-in-commands.c | 12 +- app/gui/plug-in-menus.c | 12 +- app/internal_procs.c | 4 +- app/layer.c | 5 + app/layer.h | 1 + app/layer_cmds.c | 70 ++++++ app/layer_cmds.h | 1 + app/menus/plug-in-menus.c | 12 +- app/parasite_cmds.c | 27 +-- app/perspective_tool.c | 32 +-- app/plug-in/gimpplugin-message.c | 12 +- app/plug-in/gimpplugin-progress.c | 12 +- app/plug-in/gimpplugin.c | 12 +- app/plug-in/gimppluginmanager-call.c | 12 +- app/plug-in/gimppluginmanager-run.c | 12 +- app/plug-in/gimppluginmanager.c | 12 +- app/plug-in/gimppluginshm.c | 12 +- app/plug-in/plug-in-def.c | 12 +- app/plug-in/plug-in-message.c | 12 +- app/plug-in/plug-in-params.c | 12 +- app/plug-in/plug-in-progress.c | 12 +- app/plug-in/plug-in-run.c | 12 +- app/plug-in/plug-in-shm.c | 12 +- app/plug-in/plug-in.c | 12 +- app/plug-in/plug-ins.c | 12 +- app/plug_in.c | 12 +- app/procedural_db.c | 2 +- app/rotate_tool.c | 24 +- app/scale_tool.c | 24 +- app/shear_tool.c | 28 +-- app/tools/gimpperspectivetool.c | 32 +-- app/tools/gimprotatetool.c | 24 +- app/tools/gimpscaletool.c | 24 +- app/tools/gimpsheartool.c | 28 +-- app/tools/perspective_tool.c | 32 +-- app/tools/rotate_tool.c | 24 +- app/tools/scale_tool.c | 24 +- app/tools/shear_tool.c | 28 +-- app/tools/transform_core.c | 247 +++------------------ app/tools/transform_core.h | 19 +- app/transform_core.c | 247 +++------------------ app/transform_core.h | 19 +- docs/parasites.txt | 13 +- libgimp/Makefile.am | 23 +- libgimp/gimp.c | 17 +- libgimp/gimp.h | 36 ++- libgimp/gimpdrawable.c | 18 +- libgimp/gimpdrawable_pdb.c | 18 +- libgimp/gimpimage.c | 22 +- libgimp/gimpimage_pdb.c | 22 +- libgimp/gimpmatrix.c | 171 ++++++++++++++ libgimp/gimpmatrix.h | 38 ++++ libgimp/gimpparasite.c | 145 ++++++++++++ libgimp/gimpparasite.h | 49 ++++ app/parasiteF.h => libgimp/gimpparasiteF.h | 0 libgimp/gimpparasiteP.h | 34 +++ libgimp/gimpparasite_pdb.c | 110 --------- libgimp/gimpprotocol.c | 14 +- libgimp/gimpprotocol.h | 3 +- {app => libgimp}/parasite.c | 40 ++-- {app => libgimp}/parasite.h | 10 +- libgimp/parasiteF.h | 25 +++ {app => libgimp}/parasiteP.h | 11 +- libgimpbase/gimpparasite.c | 145 ++++++++++++ libgimpbase/gimpparasite.h | 49 ++++ libgimpbase/gimpprotocol.c | 14 +- libgimpbase/gimpprotocol.h | 3 +- plug-ins/common/gif.c | 18 +- plug-ins/common/tiff.c | 43 ++-- plug-ins/gif/gif.c | 18 +- plug-ins/script-fu/script-fu.c | 32 ++- plug-ins/tiff/tiff.c | 43 ++-- 113 files changed, 2132 insertions(+), 1235 deletions(-) create mode 100644 libgimp/gimpmatrix.c create mode 100644 libgimp/gimpmatrix.h create mode 100644 libgimp/gimpparasite.c create mode 100644 libgimp/gimpparasite.h rename app/parasiteF.h => libgimp/gimpparasiteF.h (100%) create mode 100644 libgimp/gimpparasiteP.h delete mode 100644 libgimp/gimpparasite_pdb.c rename {app => libgimp}/parasite.c (69%) rename {app => libgimp}/parasite.h (85%) create mode 100644 libgimp/parasiteF.h rename {app => libgimp}/parasiteP.h (79%) create mode 100644 libgimpbase/gimpparasite.c create mode 100644 libgimpbase/gimpparasite.h diff --git a/ChangeLog b/ChangeLog index b44187d76e..d32db9fb17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 app/brush_select.[ch] Fixed problem with resizing the brush popup diff --git a/app/Makefile.am b/app/Makefile.am index 60f3e89000..b076f2a806 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -227,10 +227,6 @@ gimp_SOURCES = \ paint_funcs.h \ paintbrush.c \ paintbrush.h \ - parasite.c \ - parasite.h \ - parasiteP.h \ - parasiteF.h \ parasite_cmds.c \ parasite_cmds.h \ pattern_header.h \ diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index d0683438a3..1dcc01f5e0 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/channel.c b/app/channel.c index a41baf1049..e1df961a1a 100644 --- a/app/channel.c +++ b/app/channel.c @@ -27,7 +27,7 @@ #include "gimage_mask.h" #include "layer.h" #include "paint_funcs.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "temp_buf.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 */ diff --git a/app/channel.h b/app/channel.h index a2fa9d86c5..ac9d30cf6e 100644 --- a/app/channel.h +++ b/app/channel.h @@ -95,6 +95,8 @@ int channel_toggle_visibility (Channel *); TempBuf * channel_preview (Channel *, int, int); void channel_invalidate_previews (GimpImage*); +guint32 channel_get_tattoo(const Channel *); + /* selection mask functions */ diff --git a/app/channel_cmds.c b/app/channel_cmds.c index 474324b39f..c7a6dedee8 100644 --- a/app/channel_cmds.c +++ b/app/channel_cmds.c @@ -937,3 +937,72 @@ ProcRecord channel_set_color_proc = /* Exec method */ { { 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 } }, +}; diff --git a/app/channel_cmds.h b/app/channel_cmds.h index 6904e3099b..8d1f017139 100644 --- a/app/channel_cmds.h +++ b/app/channel_cmds.h @@ -33,5 +33,6 @@ extern ProcRecord channel_get_opacity_proc; extern ProcRecord channel_set_opacity_proc; extern ProcRecord channel_get_color_proc; extern ProcRecord channel_set_color_proc; +extern ProcRecord channel_get_tattoo_proc; #endif /* __CHANNEL_CMDS_H__ */ diff --git a/app/core/gimpchannel-combine.c b/app/core/gimpchannel-combine.c index a41baf1049..e1df961a1a 100644 --- a/app/core/gimpchannel-combine.c +++ b/app/core/gimpchannel-combine.c @@ -27,7 +27,7 @@ #include "gimage_mask.h" #include "layer.h" #include "paint_funcs.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "temp_buf.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 */ diff --git a/app/core/gimpchannel-combine.h b/app/core/gimpchannel-combine.h index a2fa9d86c5..ac9d30cf6e 100644 --- a/app/core/gimpchannel-combine.h +++ b/app/core/gimpchannel-combine.h @@ -95,6 +95,8 @@ int channel_toggle_visibility (Channel *); TempBuf * channel_preview (Channel *, int, int); void channel_invalidate_previews (GimpImage*); +guint32 channel_get_tattoo(const Channel *); + /* selection mask functions */ diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c index a41baf1049..e1df961a1a 100644 --- a/app/core/gimpchannel.c +++ b/app/core/gimpchannel.c @@ -27,7 +27,7 @@ #include "gimage_mask.h" #include "layer.h" #include "paint_funcs.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "temp_buf.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 */ diff --git a/app/core/gimpchannel.h b/app/core/gimpchannel.h index a2fa9d86c5..ac9d30cf6e 100644 --- a/app/core/gimpchannel.h +++ b/app/core/gimpchannel.h @@ -95,6 +95,8 @@ int channel_toggle_visibility (Channel *); TempBuf * channel_preview (Channel *, int, int); void channel_invalidate_previews (GimpImage*); +guint32 channel_get_tattoo(const Channel *); + /* selection mask functions */ diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c index 381a674ab2..28ad900138 100644 --- a/app/core/gimpdrawable.c +++ b/app/core/gimpdrawable.c @@ -24,7 +24,7 @@ #include "gimpsignal.h" #include "gimage.h" #include "gimage_mask.h" -#include "parasite.h" +#include "libgimp/parasite.h" 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 gimp_drawable_type (GimpDrawable *drawable) { @@ -361,10 +373,9 @@ gimp_drawable_set_name (GimpDrawable *drawable, char *name) Parasite * -gimp_drawable_find_parasite (const GimpDrawable *drawable, - const char *creator, const char *type) +gimp_drawable_find_parasite (const GimpDrawable *drawable, const char *name) { - return parasite_find_in_gslist(drawable->parasites, creator, type); + return parasite_find_in_gslist(drawable->parasites, name); } void @@ -374,12 +385,19 @@ gimp_drawable_attach_parasite (GimpDrawable *drawable, const Parasite *parasite) } 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_free(parasite); + Parasite *p; + 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 gimp_drawable_type_with_alpha (GimpDrawable *drawable) @@ -539,6 +557,8 @@ gimp_drawable_init (GimpDrawable *drawable) drawable->preview = NULL; drawable->preview_valid = FALSE; drawable->parasites = FALSE; + drawable->tattoo = 0; + gimp_matrix_identity(drawable->transform); drawable->ID = global_drawable_ID++; if (gimp_drawable_table == NULL) @@ -619,7 +639,8 @@ gimp_drawable_configure (GimpDrawable *drawable, drawable->dirty = FALSE; drawable->visible = TRUE; - drawable->gimage = gimage; + if (gimage) + gimp_drawable_set_gimage(drawable, gimage); gimp_drawable_set_name(drawable, name); diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h index dea7a7b613..24e3145d12 100644 --- a/app/core/gimpdrawable.h +++ b/app/core/gimpdrawable.h @@ -23,7 +23,7 @@ #include "tile_manager.h" #include "temp_buf.h" #include "gimpimageF.h" -#include "parasiteF.h" +#include #define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ()) #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 *); Parasite * gimp_drawable_find_parasite (const GimpDrawable *, - const char *creator, - const char *type); + const char *name); 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); void gimp_drawable_deallocate (GimpDrawable *); GimpImage * gimp_drawable_gimage (GimpDrawable*); +void gimp_drawable_set_gimage (GimpDrawable*, GimpImage *); #endif /* __GIMPDRAWABLE_H__ */ diff --git a/app/core/gimpimage-guides.c b/app/core/gimpimage-guides.c index 3d68d8a483..f8780ee8d6 100644 --- a/app/core/gimpimage-guides.c +++ b/app/core/gimpimage-guides.c @@ -25,7 +25,7 @@ #include "gimage_mask.h" #include "paint_funcs.h" #include "palette.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "undo.h" #include "gimpsignal.h" @@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->dirty = 1; gimage->undo_on = TRUE; gimage->construct_flag = -1; + gimage->tattoo_state = 0; gimage->projection = NULL; gimage->guides = NULL; gimage->layers = NULL; @@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview = NULL; gimage->parasites = NULL; + gimp_matrix_identity(gimage->transform); gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ } @@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage, Parasite * -gimp_image_find_parasite (const GimpImage *gimage, - const char *creator, const char *type) +gimp_image_find_parasite (const GimpImage *gimage, const char *name) { - return parasite_find_in_gslist(gimage->parasites, creator, type); + return parasite_find_in_gslist(gimage->parasites, name); } void @@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite) } 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_free(parasite); + Parasite *p; + 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 */ /************************************************************/ @@ -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 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; /* 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 */ if (position == -1) position = gimp_image_get_layer_index (gimage, gimage->active_layer); diff --git a/app/core/gimpimage-guides.h b/app/core/gimpimage-guides.h index 42ea48209d..7210c26ceb 100644 --- a/app/core/gimpimage-guides.h +++ b/app/core/gimpimage-guides.h @@ -8,7 +8,7 @@ #include "drawable.h" #include "channel.h" #include "layer.h" -#include "parasiteF.h" +#include #include "temp_buf.h" #include "tile_manager.h" @@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *); Parasite * gimp_image_find_parasite (const GimpImage *, - const char *creator, - const char *type); + const char *name); 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 */ @@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *); int gimp_image_get_channel_index (GimpImage *, Channel *); Layer * gimp_image_get_active_layer (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 *); int gimp_image_get_component_active (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_validate (TileManager *, Tile *); - /* Access functions */ int gimp_image_is_empty (GimpImage *); diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c index 3d68d8a483..f8780ee8d6 100644 --- a/app/core/gimpimage-merge.c +++ b/app/core/gimpimage-merge.c @@ -25,7 +25,7 @@ #include "gimage_mask.h" #include "paint_funcs.h" #include "palette.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "undo.h" #include "gimpsignal.h" @@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->dirty = 1; gimage->undo_on = TRUE; gimage->construct_flag = -1; + gimage->tattoo_state = 0; gimage->projection = NULL; gimage->guides = NULL; gimage->layers = NULL; @@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview = NULL; gimage->parasites = NULL; + gimp_matrix_identity(gimage->transform); gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ } @@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage, Parasite * -gimp_image_find_parasite (const GimpImage *gimage, - const char *creator, const char *type) +gimp_image_find_parasite (const GimpImage *gimage, const char *name) { - return parasite_find_in_gslist(gimage->parasites, creator, type); + return parasite_find_in_gslist(gimage->parasites, name); } void @@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite) } 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_free(parasite); + Parasite *p; + 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 */ /************************************************************/ @@ -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 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; /* 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 */ if (position == -1) position = gimp_image_get_layer_index (gimage, gimage->active_layer); diff --git a/app/core/gimpimage-merge.h b/app/core/gimpimage-merge.h index 42ea48209d..7210c26ceb 100644 --- a/app/core/gimpimage-merge.h +++ b/app/core/gimpimage-merge.h @@ -8,7 +8,7 @@ #include "drawable.h" #include "channel.h" #include "layer.h" -#include "parasiteF.h" +#include #include "temp_buf.h" #include "tile_manager.h" @@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *); Parasite * gimp_image_find_parasite (const GimpImage *, - const char *creator, - const char *type); + const char *name); 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 */ @@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *); int gimp_image_get_channel_index (GimpImage *, Channel *); Layer * gimp_image_get_active_layer (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 *); int gimp_image_get_component_active (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_validate (TileManager *, Tile *); - /* Access functions */ int gimp_image_is_empty (GimpImage *); diff --git a/app/core/gimpimage-projection.c b/app/core/gimpimage-projection.c index 3d68d8a483..f8780ee8d6 100644 --- a/app/core/gimpimage-projection.c +++ b/app/core/gimpimage-projection.c @@ -25,7 +25,7 @@ #include "gimage_mask.h" #include "paint_funcs.h" #include "palette.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "undo.h" #include "gimpsignal.h" @@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->dirty = 1; gimage->undo_on = TRUE; gimage->construct_flag = -1; + gimage->tattoo_state = 0; gimage->projection = NULL; gimage->guides = NULL; gimage->layers = NULL; @@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview = NULL; gimage->parasites = NULL; + gimp_matrix_identity(gimage->transform); gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ } @@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage, Parasite * -gimp_image_find_parasite (const GimpImage *gimage, - const char *creator, const char *type) +gimp_image_find_parasite (const GimpImage *gimage, const char *name) { - return parasite_find_in_gslist(gimage->parasites, creator, type); + return parasite_find_in_gslist(gimage->parasites, name); } void @@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite) } 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_free(parasite); + Parasite *p; + 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 */ /************************************************************/ @@ -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 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; /* 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 */ if (position == -1) position = gimp_image_get_layer_index (gimage, gimage->active_layer); diff --git a/app/core/gimpimage-projection.h b/app/core/gimpimage-projection.h index 42ea48209d..7210c26ceb 100644 --- a/app/core/gimpimage-projection.h +++ b/app/core/gimpimage-projection.h @@ -8,7 +8,7 @@ #include "drawable.h" #include "channel.h" #include "layer.h" -#include "parasiteF.h" +#include #include "temp_buf.h" #include "tile_manager.h" @@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *); Parasite * gimp_image_find_parasite (const GimpImage *, - const char *creator, - const char *type); + const char *name); 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 */ @@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *); int gimp_image_get_channel_index (GimpImage *, Channel *); Layer * gimp_image_get_active_layer (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 *); int gimp_image_get_component_active (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_validate (TileManager *, Tile *); - /* Access functions */ int gimp_image_is_empty (GimpImage *); diff --git a/app/core/gimpimage-resize.c b/app/core/gimpimage-resize.c index 3d68d8a483..f8780ee8d6 100644 --- a/app/core/gimpimage-resize.c +++ b/app/core/gimpimage-resize.c @@ -25,7 +25,7 @@ #include "gimage_mask.h" #include "paint_funcs.h" #include "palette.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "undo.h" #include "gimpsignal.h" @@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->dirty = 1; gimage->undo_on = TRUE; gimage->construct_flag = -1; + gimage->tattoo_state = 0; gimage->projection = NULL; gimage->guides = NULL; gimage->layers = NULL; @@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview = NULL; gimage->parasites = NULL; + gimp_matrix_identity(gimage->transform); gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ } @@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage, Parasite * -gimp_image_find_parasite (const GimpImage *gimage, - const char *creator, const char *type) +gimp_image_find_parasite (const GimpImage *gimage, const char *name) { - return parasite_find_in_gslist(gimage->parasites, creator, type); + return parasite_find_in_gslist(gimage->parasites, name); } void @@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite) } 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_free(parasite); + Parasite *p; + 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 */ /************************************************************/ @@ -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 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; /* 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 */ if (position == -1) position = gimp_image_get_layer_index (gimage, gimage->active_layer); diff --git a/app/core/gimpimage-resize.h b/app/core/gimpimage-resize.h index 42ea48209d..7210c26ceb 100644 --- a/app/core/gimpimage-resize.h +++ b/app/core/gimpimage-resize.h @@ -8,7 +8,7 @@ #include "drawable.h" #include "channel.h" #include "layer.h" -#include "parasiteF.h" +#include #include "temp_buf.h" #include "tile_manager.h" @@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *); Parasite * gimp_image_find_parasite (const GimpImage *, - const char *creator, - const char *type); + const char *name); 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 */ @@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *); int gimp_image_get_channel_index (GimpImage *, Channel *); Layer * gimp_image_get_active_layer (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 *); int gimp_image_get_component_active (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_validate (TileManager *, Tile *); - /* Access functions */ int gimp_image_is_empty (GimpImage *); diff --git a/app/core/gimpimage-scale.c b/app/core/gimpimage-scale.c index 3d68d8a483..f8780ee8d6 100644 --- a/app/core/gimpimage-scale.c +++ b/app/core/gimpimage-scale.c @@ -25,7 +25,7 @@ #include "gimage_mask.h" #include "paint_funcs.h" #include "palette.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "undo.h" #include "gimpsignal.h" @@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->dirty = 1; gimage->undo_on = TRUE; gimage->construct_flag = -1; + gimage->tattoo_state = 0; gimage->projection = NULL; gimage->guides = NULL; gimage->layers = NULL; @@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview = NULL; gimage->parasites = NULL; + gimp_matrix_identity(gimage->transform); gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ } @@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage, Parasite * -gimp_image_find_parasite (const GimpImage *gimage, - const char *creator, const char *type) +gimp_image_find_parasite (const GimpImage *gimage, const char *name) { - return parasite_find_in_gslist(gimage->parasites, creator, type); + return parasite_find_in_gslist(gimage->parasites, name); } void @@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite) } 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_free(parasite); + Parasite *p; + 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 */ /************************************************************/ @@ -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 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; /* 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 */ if (position == -1) position = gimp_image_get_layer_index (gimage, gimage->active_layer); diff --git a/app/core/gimpimage-scale.h b/app/core/gimpimage-scale.h index 42ea48209d..7210c26ceb 100644 --- a/app/core/gimpimage-scale.h +++ b/app/core/gimpimage-scale.h @@ -8,7 +8,7 @@ #include "drawable.h" #include "channel.h" #include "layer.h" -#include "parasiteF.h" +#include #include "temp_buf.h" #include "tile_manager.h" @@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *); Parasite * gimp_image_find_parasite (const GimpImage *, - const char *creator, - const char *type); + const char *name); 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 */ @@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *); int gimp_image_get_channel_index (GimpImage *, Channel *); Layer * gimp_image_get_active_layer (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 *); int gimp_image_get_component_active (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_validate (TileManager *, Tile *); - /* Access functions */ int gimp_image_is_empty (GimpImage *); diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 3d68d8a483..f8780ee8d6 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -25,7 +25,7 @@ #include "gimage_mask.h" #include "paint_funcs.h" #include "palette.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "undo.h" #include "gimpsignal.h" @@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->dirty = 1; gimage->undo_on = TRUE; gimage->construct_flag = -1; + gimage->tattoo_state = 0; gimage->projection = NULL; gimage->guides = NULL; gimage->layers = NULL; @@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview = NULL; gimage->parasites = NULL; + gimp_matrix_identity(gimage->transform); gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ } @@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage, Parasite * -gimp_image_find_parasite (const GimpImage *gimage, - const char *creator, const char *type) +gimp_image_find_parasite (const GimpImage *gimage, const char *name) { - return parasite_find_in_gslist(gimage->parasites, creator, type); + return parasite_find_in_gslist(gimage->parasites, name); } void @@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite) } 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_free(parasite); + Parasite *p; + 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 */ /************************************************************/ @@ -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 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; /* 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 */ if (position == -1) position = gimp_image_get_layer_index (gimage, gimage->active_layer); diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h index 42ea48209d..7210c26ceb 100644 --- a/app/core/gimpimage.h +++ b/app/core/gimpimage.h @@ -8,7 +8,7 @@ #include "drawable.h" #include "channel.h" #include "layer.h" -#include "parasiteF.h" +#include #include "temp_buf.h" #include "tile_manager.h" @@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *); Parasite * gimp_image_find_parasite (const GimpImage *, - const char *creator, - const char *type); + const char *name); 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 */ @@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *); int gimp_image_get_channel_index (GimpImage *, Channel *); Layer * gimp_image_get_active_layer (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 *); int gimp_image_get_component_active (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_validate (TileManager *, Tile *); - /* Access functions */ int gimp_image_is_empty (GimpImage *); diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c index 1c27f90dac..701cb3721a 100644 --- a/app/core/gimplayer.c +++ b/app/core/gimplayer.c @@ -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 layer_invalidate_previews (GimpImage* gimage) diff --git a/app/core/gimplayer.h b/app/core/gimplayer.h index de8a39c2e9..da5507bb28 100644 --- a/app/core/gimplayer.h +++ b/app/core/gimplayer.h @@ -119,6 +119,7 @@ TempBuf * layer_preview (Layer *, int, int); TempBuf * layer_mask_preview (Layer *, int, int); void layer_invalidate_previews (GimpImage*); +guint32 layer_get_tattoo(const Layer *); #define drawable_layer GIMP_IS_LAYER diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c index 3d68d8a483..f8780ee8d6 100644 --- a/app/core/gimpprojection-construct.c +++ b/app/core/gimpprojection-construct.c @@ -25,7 +25,7 @@ #include "gimage_mask.h" #include "paint_funcs.h" #include "palette.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "undo.h" #include "gimpsignal.h" @@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->dirty = 1; gimage->undo_on = TRUE; gimage->construct_flag = -1; + gimage->tattoo_state = 0; gimage->projection = NULL; gimage->guides = NULL; gimage->layers = NULL; @@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview = NULL; gimage->parasites = NULL; + gimp_matrix_identity(gimage->transform); gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ } @@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage, Parasite * -gimp_image_find_parasite (const GimpImage *gimage, - const char *creator, const char *type) +gimp_image_find_parasite (const GimpImage *gimage, const char *name) { - return parasite_find_in_gslist(gimage->parasites, creator, type); + return parasite_find_in_gslist(gimage->parasites, name); } void @@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite) } 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_free(parasite); + Parasite *p; + 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 */ /************************************************************/ @@ -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 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; /* 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 */ if (position == -1) position = gimp_image_get_layer_index (gimage, gimage->active_layer); diff --git a/app/core/gimpprojection-construct.h b/app/core/gimpprojection-construct.h index 42ea48209d..7210c26ceb 100644 --- a/app/core/gimpprojection-construct.h +++ b/app/core/gimpprojection-construct.h @@ -8,7 +8,7 @@ #include "drawable.h" #include "channel.h" #include "layer.h" -#include "parasiteF.h" +#include #include "temp_buf.h" #include "tile_manager.h" @@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *); Parasite * gimp_image_find_parasite (const GimpImage *, - const char *creator, - const char *type); + const char *name); 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 */ @@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *); int gimp_image_get_channel_index (GimpImage *, Channel *); Layer * gimp_image_get_active_layer (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 *); int gimp_image_get_component_active (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_validate (TileManager *, Tile *); - /* Access functions */ int gimp_image_is_empty (GimpImage *); diff --git a/app/drawable_cmds.c b/app/drawable_cmds.c index af18a58755..6e8debcd5c 100644 --- a/app/drawable_cmds.c +++ b/app/drawable_cmds.c @@ -22,7 +22,7 @@ #include "gimage.h" #include "drawable.h" #include "drawable_cmds.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "tile.h" /* ick. */ @@ -1461,13 +1461,9 @@ ProcArg gimp_drawable_find_parasite_args[] = "the input drawable" }, { PDB_STRING, - "creator", - "The creator ID of the parasite to find" + "name", + "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[] = @@ -1481,15 +1477,15 @@ ProcArg gimp_drawable_find_parasite_out_args[] = ProcRecord gimp_drawable_find_parasite_proc = { "gimp_drawable_find_parasite", - "Finds a parasite of a specified type and creator in an drawable.", - "Finds a parasite of a specified type and creator in an drawable.", + "Finds a parasite in a drawable.", + "Finds a parasite in a drawable.", "Jay Cox", "Jay Cox", "1998", PDB_INTERNAL, /* Input arguments */ - 3, + 2, gimp_drawable_find_parasite_args, /* Output arguments */ @@ -1507,7 +1503,7 @@ gimp_drawable_find_parasite_invoker (Argument *args) int int_value; GimpDrawable *gdrawable; Argument *return_args; - char *creator, *type; + char *name = NULL; /* the GimpDrawable */ if (success) @@ -1520,13 +1516,7 @@ gimp_drawable_find_parasite_invoker (Argument *args) /* creator */ if (success) { - creator = (char *) args[1].value.pdb_pointer; - } - - /* type */ - if (success) - { - type = (char *) args[2].value.pdb_pointer; + name = (char *) args[1].value.pdb_pointer; } return_args = procedural_db_return_args (&gimp_drawable_find_parasite_proc, @@ -1535,7 +1525,7 @@ gimp_drawable_find_parasite_invoker (Argument *args) if (success) { 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) return_args[1].value.pdb_pointer = parasite_error(); } @@ -1625,9 +1615,9 @@ ProcArg gimp_drawable_detach_parasite_args[] = "drawable", "the input drawable" }, - { PDB_PARASITE, + { PDB_STRING, "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 int_value; GimpDrawable *gdrawable; - Parasite *parasite = NULL; + char *parasite = NULL; Argument *return_args; @@ -1674,7 +1664,7 @@ gimp_drawable_detach_parasite_invoker (Argument *args) if (success) { - parasite = (Parasite *)args[1].value.pdb_pointer; + parasite = (char *)args[1].value.pdb_pointer; if (parasite == NULL) success = FALSE; } diff --git a/app/gimage_cmds.c b/app/gimage_cmds.c index abf4192044..c0abb19cb7 100644 --- a/app/gimage_cmds.c +++ b/app/gimage_cmds.c @@ -25,7 +25,7 @@ #include "gimage.h" #include "gimage_cmds.h" #include "floating_sel.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "undo.h" #include "layer_pvt.h" /* ick. */ @@ -3511,7 +3511,8 @@ duplicate (GImage *gimage) list = g_slist_next (list); 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: " copy" */ layer_set_name(GIMP_LAYER(new_layer), @@ -3547,7 +3548,8 @@ duplicate (GImage *gimage) list = g_slist_next (list); 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: " copy" */ gimp_drawable_set_name(GIMP_DRAWABLE(new_channel), @@ -4324,13 +4326,9 @@ ProcArg gimp_image_find_parasite_args[] = "the input image" }, { PDB_STRING, - "creator", - "The creator ID of the parasite to find" + "name", + "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[] = @@ -4352,7 +4350,7 @@ ProcRecord gimp_image_find_parasite_proc = PDB_INTERNAL, /* Input arguments */ - 3, + 2, gimp_image_find_parasite_args, /* Output arguments */ @@ -4371,7 +4369,7 @@ gimp_image_find_parasite_invoker (Argument *args) int int_value; GImage *gimage; Argument *return_args; - char *creator, *type; + char *name = NULL; /* the gimage */ if (success) @@ -4381,16 +4379,10 @@ gimp_image_find_parasite_invoker (Argument *args) success = FALSE; } - /* creator */ + /* name */ if (success) { - creator = (char *) args[1].value.pdb_pointer; - } - - /* type */ - if (success) - { - type = (char *) args[2].value.pdb_pointer; + name = (char *) args[1].value.pdb_pointer; } return_args = procedural_db_return_args (&gimp_image_find_parasite_proc, @@ -4399,7 +4391,7 @@ gimp_image_find_parasite_invoker (Argument *args) if (success) { 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) return_args[1].value.pdb_pointer = parasite_error(); } @@ -4489,16 +4481,16 @@ ProcArg gimp_image_detach_parasite_args[] = "image", "the input image" }, - { PDB_PARASITE, - "parasite", - "The parasite to detach to the image" + { PDB_STRING, + "name", + "The name of the parasite to detach from the image" } }; ProcRecord gimp_image_detach_parasite_proc = { "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.", "Jay Cox", "Jay Cox", @@ -4524,7 +4516,7 @@ gimp_image_detach_parasite_invoker (Argument *args) int success = TRUE; int int_value; GImage *gimage; - Parasite *parasite = NULL; + char *parasite = NULL; Argument *return_args; @@ -4538,7 +4530,7 @@ gimp_image_detach_parasite_invoker (Argument *args) if (success) { - parasite = (Parasite *)args[1].value.pdb_pointer; + parasite = (char *)args[1].value.pdb_pointer; if (parasite == NULL) success = FALSE; } diff --git a/app/gimpchannel.c b/app/gimpchannel.c index a41baf1049..e1df961a1a 100644 --- a/app/gimpchannel.c +++ b/app/gimpchannel.c @@ -27,7 +27,7 @@ #include "gimage_mask.h" #include "layer.h" #include "paint_funcs.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "temp_buf.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 */ diff --git a/app/gimpchannel.h b/app/gimpchannel.h index a2fa9d86c5..ac9d30cf6e 100644 --- a/app/gimpchannel.h +++ b/app/gimpchannel.h @@ -95,6 +95,8 @@ int channel_toggle_visibility (Channel *); TempBuf * channel_preview (Channel *, int, int); void channel_invalidate_previews (GimpImage*); +guint32 channel_get_tattoo(const Channel *); + /* selection mask functions */ diff --git a/app/gimpdrawable.c b/app/gimpdrawable.c index 381a674ab2..28ad900138 100644 --- a/app/gimpdrawable.c +++ b/app/gimpdrawable.c @@ -24,7 +24,7 @@ #include "gimpsignal.h" #include "gimage.h" #include "gimage_mask.h" -#include "parasite.h" +#include "libgimp/parasite.h" 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 gimp_drawable_type (GimpDrawable *drawable) { @@ -361,10 +373,9 @@ gimp_drawable_set_name (GimpDrawable *drawable, char *name) Parasite * -gimp_drawable_find_parasite (const GimpDrawable *drawable, - const char *creator, const char *type) +gimp_drawable_find_parasite (const GimpDrawable *drawable, const char *name) { - return parasite_find_in_gslist(drawable->parasites, creator, type); + return parasite_find_in_gslist(drawable->parasites, name); } void @@ -374,12 +385,19 @@ gimp_drawable_attach_parasite (GimpDrawable *drawable, const Parasite *parasite) } 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_free(parasite); + Parasite *p; + 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 gimp_drawable_type_with_alpha (GimpDrawable *drawable) @@ -539,6 +557,8 @@ gimp_drawable_init (GimpDrawable *drawable) drawable->preview = NULL; drawable->preview_valid = FALSE; drawable->parasites = FALSE; + drawable->tattoo = 0; + gimp_matrix_identity(drawable->transform); drawable->ID = global_drawable_ID++; if (gimp_drawable_table == NULL) @@ -619,7 +639,8 @@ gimp_drawable_configure (GimpDrawable *drawable, drawable->dirty = FALSE; drawable->visible = TRUE; - drawable->gimage = gimage; + if (gimage) + gimp_drawable_set_gimage(drawable, gimage); gimp_drawable_set_name(drawable, name); diff --git a/app/gimpdrawable.h b/app/gimpdrawable.h index dea7a7b613..24e3145d12 100644 --- a/app/gimpdrawable.h +++ b/app/gimpdrawable.h @@ -23,7 +23,7 @@ #include "tile_manager.h" #include "temp_buf.h" #include "gimpimageF.h" -#include "parasiteF.h" +#include #define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ()) #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 *); Parasite * gimp_drawable_find_parasite (const GimpDrawable *, - const char *creator, - const char *type); + const char *name); 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); void gimp_drawable_deallocate (GimpDrawable *); GimpImage * gimp_drawable_gimage (GimpDrawable*); +void gimp_drawable_set_gimage (GimpDrawable*, GimpImage *); #endif /* __GIMPDRAWABLE_H__ */ diff --git a/app/gimpdrawableP.h b/app/gimpdrawableP.h index 7a6655c417..22c48ec118 100644 --- a/app/gimpdrawableP.h +++ b/app/gimpdrawableP.h @@ -20,6 +20,7 @@ #include "gimpobjectP.h" #include "gimpdrawable.h" +#include "libgimp/gimpmatrix.h" struct _GimpDrawable { @@ -34,12 +35,17 @@ struct _GimpDrawable int bytes; /* bytes per pixel */ int dirty; /* dirty bit */ int ID; /* provides a unique ID */ + guint32 tattoo; /* provides a perminant ID */ GimpImage* gimage; /* gimage owner */ int type; /* type of drawable */ int has_alpha; /* drawable has alpha */ GSList *parasites; /* Plug-in parasite data */ + GimpMatrix transform; /* a matrix describing all of the + transformations this drawable + has undergone */ + /* Preview variables */ TempBuf *preview; /* preview of the channel */ int preview_valid; /* is the preview valid? */ diff --git a/app/gimpimage.c b/app/gimpimage.c index 3d68d8a483..f8780ee8d6 100644 --- a/app/gimpimage.c +++ b/app/gimpimage.c @@ -25,7 +25,7 @@ #include "gimage_mask.h" #include "paint_funcs.h" #include "palette.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "undo.h" #include "gimpsignal.h" @@ -137,6 +137,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->dirty = 1; gimage->undo_on = TRUE; gimage->construct_flag = -1; + gimage->tattoo_state = 0; gimage->projection = NULL; gimage->guides = NULL; gimage->layers = NULL; @@ -152,6 +153,7 @@ static void gimp_image_init (GimpImage *gimage) gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview = NULL; gimage->parasites = NULL; + gimp_matrix_identity(gimage->transform); gimage->resolution = 72.0; /* maybe should be rc-supplied default? */ } @@ -860,10 +862,9 @@ gimp_image_delete_guide (GimpImage *gimage, Parasite * -gimp_image_find_parasite (const GimpImage *gimage, - const char *creator, const char *type) +gimp_image_find_parasite (const GimpImage *gimage, const char *name) { - return parasite_find_in_gslist(gimage->parasites, creator, type); + return parasite_find_in_gslist(gimage->parasites, name); } void @@ -873,12 +874,21 @@ gimp_image_attach_parasite (GimpImage *gimage, const Parasite *parasite) } 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_free(parasite); + Parasite *p; + 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 */ /************************************************************/ @@ -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 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; /* 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 */ if (position == -1) position = gimp_image_get_layer_index (gimage, gimage->active_layer); diff --git a/app/gimpimage.h b/app/gimpimage.h index 42ea48209d..7210c26ceb 100644 --- a/app/gimpimage.h +++ b/app/gimpimage.h @@ -8,7 +8,7 @@ #include "drawable.h" #include "channel.h" #include "layer.h" -#include "parasiteF.h" +#include #include "temp_buf.h" #include "tile_manager.h" @@ -128,10 +128,12 @@ void gimp_image_remove_guide (GimpImage *, Guide *); void gimp_image_delete_guide (GimpImage *, Guide *); Parasite * gimp_image_find_parasite (const GimpImage *, - const char *creator, - const char *type); + const char *name); 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 */ @@ -139,6 +141,8 @@ int gimp_image_get_layer_index (GimpImage *, Layer *); int gimp_image_get_channel_index (GimpImage *, Channel *); Layer * gimp_image_get_active_layer (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 *); int gimp_image_get_component_active (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_validate (TileManager *, Tile *); - /* Access functions */ int gimp_image_is_empty (GimpImage *); diff --git a/app/gimpimageP.h b/app/gimpimageP.h index 52c2ab15c3..092838a847 100644 --- a/app/gimpimageP.h +++ b/app/gimpimageP.h @@ -8,6 +8,7 @@ #include "temp_buf.h" #include "channel.h" #include "layer.h" +#include "libgimp/gimpmatrix.h" #define MAX_CHANNELS 4 @@ -31,6 +32,8 @@ struct _GimpImage int instance_count; /* number of instances */ int ref_count; /* number of references */ + guint32 tattoo_state; /* the next unique tattoo to use*/ + TileManager *shadow; /* shadow buffer tiles */ /* Projection attributes */ @@ -55,6 +58,10 @@ struct _GimpImage 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 active [MAX_CHANNELS]; /* active channels */ diff --git a/app/gimplayer.c b/app/gimplayer.c index 1c27f90dac..701cb3721a 100644 --- a/app/gimplayer.c +++ b/app/gimplayer.c @@ -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 layer_invalidate_previews (GimpImage* gimage) diff --git a/app/gimplayer.h b/app/gimplayer.h index de8a39c2e9..da5507bb28 100644 --- a/app/gimplayer.h +++ b/app/gimplayer.h @@ -119,6 +119,7 @@ TempBuf * layer_preview (Layer *, int, int); TempBuf * layer_mask_preview (Layer *, int, int); void layer_invalidate_previews (GimpImage*); +guint32 layer_get_tattoo(const Layer *); #define drawable_layer GIMP_IS_LAYER diff --git a/app/gui/plug-in-commands.c b/app/gui/plug-in-commands.c index d0683438a3..1dcc01f5e0 100644 --- a/app/gui/plug-in-commands.c +++ b/app/gui/plug-in-commands.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index d0683438a3..1dcc01f5e0 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/internal_procs.c b/app/internal_procs.c index 26f7145181..c7a190d283 100644 --- a/app/internal_procs.c +++ b/app/internal_procs.c @@ -80,7 +80,7 @@ internal_procs_init () { gfloat pcount = 0; /* grep -c procedural_db_register internal_procs.c */ - gfloat total_pcount = 235; + gfloat total_pcount = 237; app_init_update_status("Internal Procedures", "Tool procedures", pcount/total_pcount); @@ -247,6 +247,7 @@ internal_procs_init () procedural_db_register (&layer_set_offsets_proc); pcount++; procedural_db_register (&layer_mask_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", pcount/total_pcount); @@ -265,6 +266,7 @@ internal_procs_init () procedural_db_register (&channel_set_opacity_proc); pcount++; procedural_db_register (&channel_get_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", pcount/total_pcount); diff --git a/app/layer.c b/app/layer.c index 1c27f90dac..701cb3721a 100644 --- a/app/layer.c +++ b/app/layer.c @@ -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 layer_invalidate_previews (GimpImage* gimage) diff --git a/app/layer.h b/app/layer.h index de8a39c2e9..da5507bb28 100644 --- a/app/layer.h +++ b/app/layer.h @@ -119,6 +119,7 @@ TempBuf * layer_preview (Layer *, int, int); TempBuf * layer_mask_preview (Layer *, int, int); void layer_invalidate_previews (GimpImage*); +guint32 layer_get_tattoo(const Layer *); #define drawable_layer GIMP_IS_LAYER diff --git a/app/layer_cmds.c b/app/layer_cmds.c index d1b972be07..36b949c447 100644 --- a/app/layer_cmds.c +++ b/app/layer_cmds.c @@ -2022,3 +2022,73 @@ ProcRecord layer_is_floating_sel_proc = /* Exec method */ { { 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 } }, +}; diff --git a/app/layer_cmds.h b/app/layer_cmds.h index 02eb67504e..1e1f028f53 100644 --- a/app/layer_cmds.h +++ b/app/layer_cmds.h @@ -47,5 +47,6 @@ extern ProcRecord layer_set_mode_proc; extern ProcRecord layer_set_offsets_proc; extern ProcRecord layer_mask_proc; extern ProcRecord layer_is_floating_sel_proc; +extern ProcRecord layer_get_tattoo_proc; #endif /* __LAYER_CMDS_H__ */ diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index d0683438a3..1dcc01f5e0 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/parasite_cmds.c b/app/parasite_cmds.c index 5aa294d8b8..c34480b05b 100644 --- a/app/parasite_cmds.c +++ b/app/parasite_cmds.c @@ -17,7 +17,7 @@ * Boston, MA 02111-1307, USA. */ -#include "parasite.h" +#include "libgimp/parasite.h" #include "procedural_db.h" #include "appenv.h" #include @@ -27,12 +27,8 @@ static Argument *parasite_new_invoker (Argument *args); ProcArg parasite_new_args[] = { { PDB_STRING, - "creator", - "The creator ID of the parasite to create" - }, - { PDB_STRING, - "type", - "The type ID of the parasite to create" + "name", + "The name of the parasite to create" }, { PDB_INT32, "flags", @@ -67,7 +63,7 @@ ProcRecord parasite_new_proc = PDB_INTERNAL, /* Input arguments */ - 5, + 4, parasite_new_args, /* Output arguments */ @@ -83,26 +79,23 @@ parasite_new_invoker (Argument *args) { int success = TRUE; Argument *return_args; - char *creator, *type; + char *name; guint32 flags, size; void *data; /* creator */ if (success) - { creator = (char *) args[0].value.pdb_pointer; } - /* type */ - if (success) - { type = (char *) args[1].value.pdb_pointer; } + { name = (char *) args[0].value.pdb_pointer; } /* flags */ if (success) - { flags = args[2].value.pdb_int; } + { flags = args[1].value.pdb_int; } /* size */ if (success) - { size = args[3].value.pdb_int; } + { size = args[2].value.pdb_int; } /* data */ if (success) { - data = args[4].value.pdb_pointer; + data = args[3].value.pdb_pointer; if (size > 0 && data == 0) success = FALSE; } @@ -113,7 +106,7 @@ parasite_new_invoker (Argument *args) if (success) { return_args[1].value.pdb_pointer = - parasite_new (creator, type, flags, size, data); + parasite_new (name, flags, size, data); } return return_args; diff --git a/app/perspective_tool.c b/app/perspective_tool.c index e5f58962a0..4fbb268f1a 100644 --- a/app/perspective_tool.c +++ b/app/perspective_tool.c @@ -44,8 +44,8 @@ static char matrix_row_buf [3][MAX_INFO_BUF]; /* forward function declarations */ -static void * perspective_tool_perspective (GImage *, GimpDrawable *, TileManager *, int, Matrix); -static void perspective_find_transform (double *, Matrix); +static void * perspective_tool_perspective (GImage *, GimpDrawable *, TileManager *, int, GimpMatrix); +static void perspective_find_transform (double *, GimpMatrix); static void * perspective_tool_recalc (Tool *, void *); static void perspective_tool_motion (Tool *, void *); static void perspective_info_update (Tool *); @@ -133,7 +133,7 @@ tools_new_perspective_tool () private->trans_info[Y3] = 0; /* assemble the transformation matrix */ - identity_matrix (private->transform); + gimp_matrix_identity (private->transform); return tool; } @@ -219,7 +219,7 @@ perspective_tool_recalc (tool, gdisp_ptr) { TransformCore * transform_core; GDisplay * gdisp; - Matrix m; + GimpMatrix m; double cx, cy; double scalex, scaley; @@ -241,10 +241,10 @@ perspective_tool_recalc (tool, gdisp_ptr) scaley = 1.0 / (transform_core->y2 - transform_core->y1); /* assemble the transformation matrix */ - identity_matrix (transform_core->transform); - translate_matrix (transform_core->transform, -cx, -cy); - scale_matrix (transform_core->transform, scalex, scaley); - mult_matrix (m, transform_core->transform); + gimp_matrix_identity (transform_core->transform); + gimp_matrix_translate (transform_core->transform, -cx, -cy); + gimp_matrix_scale (transform_core->transform, scalex, scaley); + gimp_matrix_mult (m, transform_core->transform); /* transform the bounding box */ transform_bounding_box (tool); @@ -259,7 +259,7 @@ perspective_tool_recalc (tool, gdisp_ptr) static void perspective_find_transform (coords, m) double * coords; - Matrix m; + GimpMatrix m; { double dx1, dx2, dx3, dy1, dy2, dy3; double det1, det2; @@ -312,7 +312,7 @@ perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matr GimpDrawable *drawable; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); } @@ -410,7 +410,7 @@ perspective_invoker (args) int int_value; TileManager *float_tiles; TileManager *new_tiles; - Matrix matrix; + GimpMatrix matrix; int new_layer; Layer *layer; Argument *return_args; @@ -457,7 +457,7 @@ perspective_invoker (args) { double cx, cy; double scalex, scaley; - Matrix m; + GimpMatrix m; /* Start a transform undo group */ undo_push_group_start (gimage, TRANSFORM_CORE_UNDO); @@ -480,10 +480,10 @@ perspective_invoker (args) scaley = 1.0 / float_tiles->height; /* assemble the transformation matrix */ - identity_matrix (matrix); - translate_matrix (matrix, -cx, -cy); - scale_matrix (matrix, scalex, scaley); - mult_matrix (m, matrix); + gimp_matrix_identity (matrix); + gimp_matrix_translate (matrix, -cx, -cy); + gimp_matrix_scale (matrix, scalex, scaley); + gimp_matrix_mult (m, matrix); /* perspective the buffer */ new_tiles = perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matrix); diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/gimppluginshm.c +++ b/app/plug-in/gimppluginshm.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/plug-in-def.c b/app/plug-in/plug-in-def.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/plug-in-def.c +++ b/app/plug-in/plug-in-def.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/plug-in-params.c +++ b/app/plug-in/plug-in-params.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/plug-in-shm.c b/app/plug-in/plug-in-shm.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/plug-in-shm.c +++ b/app/plug-in/plug-in-shm.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug-in/plug-ins.c b/app/plug-in/plug-ins.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug-in/plug-ins.c +++ b/app/plug-in/plug-ins.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/plug_in.c b/app/plug_in.c index d0683438a3..1dcc01f5e0 100644 --- a/app/plug_in.c +++ b/app/plug_in.c @@ -28,8 +28,8 @@ #include #include #include -#include "parasite.h" -#include "parasiteP.h" /* ick */ +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" /* ick */ #ifdef HAVE_IPC_H #include @@ -2798,6 +2798,8 @@ plug_in_args_to_params (Argument *args, tmp = parasite_copy (args[i].value.pdb_pointer); 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.data = 0; } @@ -2811,6 +2813,8 @@ plug_in_args_to_params (Argument *args, { 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.data = 0; } @@ -2893,7 +2897,9 @@ plug_in_params_destroy (GPParam *params, if (full_destroy) if (params[i].data.d_parasite.data) { + g_free (params[i].data.d_parasite.name); g_free (params[i].data.d_parasite.data); + params[i].data.d_parasite.name = 0; params[i].data.d_parasite.data = 0; } break; @@ -2976,7 +2982,7 @@ plug_in_args_destroy (Argument *args, if (full_destroy) { /* parasite_free ((Parasite *)(args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; */ + args[i].value.pdb_pointer = NULL;*/ } break; case PDB_STATUS: diff --git a/app/procedural_db.c b/app/procedural_db.c index 94c68f3bc0..349a893841 100644 --- a/app/procedural_db.c +++ b/app/procedural_db.c @@ -26,7 +26,7 @@ #include "gdisplay.h" #include "plug_in.h" #include "procedural_db.h" -#include "parasite.h" +#include "libgimp/parasite.h" #include "config.h" #include "regex.h" diff --git a/app/rotate_tool.c b/app/rotate_tool.c index 8e85b19048..e805ef0ab5 100644 --- a/app/rotate_tool.c +++ b/app/rotate_tool.c @@ -52,7 +52,7 @@ static char center_x_buf [MAX_INFO_BUF]; static char center_y_buf [MAX_INFO_BUF]; /* 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_motion (Tool *, void *); static void rotate_info_update (Tool *); @@ -135,7 +135,7 @@ tools_new_rotate_tool () private->trans_info[CENTER_Y] = (private->y1 + private->y2) / 2; /* assemble the transformation matrix */ - identity_matrix (private->transform); + gimp_matrix_identity (private->transform); return tool; } @@ -339,10 +339,10 @@ rotate_tool_recalc (tool, gdisp_ptr) cy = transform_core->cy; /* assemble the transformation matrix */ - identity_matrix (transform_core->transform); - translate_matrix (transform_core->transform, -cx, -cy); - rotate_matrix (transform_core->transform, transform_core->trans_info[ANGLE]); - translate_matrix (transform_core->transform, +cx, +cy); + gimp_matrix_identity (transform_core->transform); + gimp_matrix_translate (transform_core->transform, -cx, -cy); + gimp_matrix_rotate (transform_core->transform, transform_core->trans_info[ANGLE]); + gimp_matrix_translate (transform_core->transform, +cx, +cy); /* transform the bounding box */ transform_bounding_box (tool); @@ -365,7 +365,7 @@ rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix) double angle; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); } @@ -435,7 +435,7 @@ rotate_invoker (args) int int_value; TileManager *float_tiles; TileManager *new_tiles; - Matrix matrix; + GimpMatrix matrix; int new_layer; Layer *layer; Argument *return_args; @@ -483,10 +483,10 @@ rotate_invoker (args) cy = float_tiles->y + float_tiles->height / 2.0; /* assemble the transformation matrix */ - identity_matrix (matrix); - translate_matrix (matrix, -cx, -cy); - rotate_matrix (matrix, angle); - translate_matrix (matrix, +cx, +cy); + gimp_matrix_identity (matrix); + gimp_matrix_translate (matrix, -cx, -cy); + gimp_matrix_rotate (matrix, angle); + gimp_matrix_translate (matrix, +cx, +cy); /* rotate the buffer */ new_tiles = rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix); diff --git a/app/scale_tool.c b/app/scale_tool.c index e85609c47f..7d83bb64bd 100644 --- a/app/scale_tool.c +++ b/app/scale_tool.c @@ -45,7 +45,7 @@ char x_ratio_buf [MAX_INFO_BUF]; char y_ratio_buf [MAX_INFO_BUF]; /* 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_motion (Tool *, void *); static void scale_info_update (Tool *); @@ -128,7 +128,7 @@ tools_new_scale_tool () private->trans_info[Y2] = 0; /* assemble the transformation matrix */ - identity_matrix (private->transform); + gimp_matrix_identity (private->transform); return tool; } @@ -407,10 +407,10 @@ scale_tool_recalc (tool, gdisp_ptr) } /* assemble the transformation matrix */ - identity_matrix (transform_core->transform); - translate_matrix (transform_core->transform, (double) -cx + diffx, (double) -cy + diffy); - scale_matrix (transform_core->transform, scalex, scaley); - translate_matrix (transform_core->transform, (double) cx, (double) cy); + gimp_matrix_identity (transform_core->transform); + gimp_matrix_translate (transform_core->transform, (double) -cx + diffx, (double) -cy + diffy); + gimp_matrix_scale (transform_core->transform, scalex, scaley); + gimp_matrix_translate (transform_core->transform, (double) cx, (double) cy); /* transform the bounding box */ transform_bounding_box (tool); @@ -428,7 +428,7 @@ scale_tool_scale (gimage, drawable, trans_info, float_tiles, interpolation, matr double *trans_info; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { TileManager *new_tiles; int x1, y1, x2, y2; @@ -538,7 +538,7 @@ scale_invoker (args) int int_value; TileManager *float_tiles; TileManager *new_tiles; - Matrix matrix; + GimpMatrix matrix; int new_layer; Layer *layer; Argument *return_args; @@ -598,10 +598,10 @@ scale_invoker (args) scaley = (trans_info[Y2] - trans_info[Y1]) / (double) float_tiles->height; /* assemble the transformation matrix */ - identity_matrix (matrix); - translate_matrix (matrix, float_tiles->x, float_tiles->y); - scale_matrix (matrix, scalex, scaley); - translate_matrix (matrix, trans_info[X1], trans_info[Y1]); + gimp_matrix_identity (matrix); + gimp_matrix_translate (matrix, float_tiles->x, float_tiles->y); + gimp_matrix_scale (matrix, scalex, scaley); + gimp_matrix_translate (matrix, trans_info[X1], trans_info[Y1]); /* scale the buffer */ new_tiles = scale_tool_scale (gimage, drawable, trans_info, diff --git a/app/shear_tool.c b/app/shear_tool.c index 8419bb391c..dbab53702f 100644 --- a/app/shear_tool.c +++ b/app/shear_tool.c @@ -51,7 +51,7 @@ static char xshear_buf [MAX_INFO_BUF]; static char yshear_buf [MAX_INFO_BUF]; /* 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_motion (Tool *, void *); static void shear_info_update (Tool *); @@ -126,7 +126,7 @@ tools_new_shear_tool () private->trans_func = shear_tool_transform; /* assemble the transformation matrix */ - identity_matrix (private->transform); + gimp_matrix_identity (private->transform); return tool; } @@ -323,18 +323,18 @@ shear_tool_recalc (tool, gdisp_ptr) height = 1; /* assemble the transformation matrix */ - identity_matrix (transform_core->transform); - translate_matrix (transform_core->transform, -cx, -cy); + gimp_matrix_identity (transform_core->transform); + gimp_matrix_translate (transform_core->transform, -cx, -cy); /* shear matrix */ 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); else - yshear_matrix (transform_core->transform, + gimp_matrix_yshear (transform_core->transform, (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_bounding_box (tool); @@ -352,7 +352,7 @@ shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix) GimpDrawable *drawable; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); } @@ -427,7 +427,7 @@ shear_invoker (args) int int_value; TileManager *float_tiles; TileManager *new_tiles; - Matrix matrix; + GimpMatrix matrix; int new_layer; Layer *layer; Argument *return_args; @@ -488,14 +488,14 @@ shear_invoker (args) cx = float_tiles->x + float_tiles->width / 2.0; cy = float_tiles->y + float_tiles->height / 2.0; - identity_matrix (matrix); - translate_matrix (matrix, -cx, -cy); + gimp_matrix_identity (matrix); + gimp_matrix_translate (matrix, -cx, -cy); /* shear matrix */ 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) - yshear_matrix (matrix, shear_magnitude / float_tiles->width); - translate_matrix (matrix, +cx, +cy); + gimp_matrix_yshear (matrix, shear_magnitude / float_tiles->width); + gimp_matrix_translate (matrix, +cx, +cy); /* shear the buffer */ new_tiles = shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix); diff --git a/app/tools/gimpperspectivetool.c b/app/tools/gimpperspectivetool.c index e5f58962a0..4fbb268f1a 100644 --- a/app/tools/gimpperspectivetool.c +++ b/app/tools/gimpperspectivetool.c @@ -44,8 +44,8 @@ static char matrix_row_buf [3][MAX_INFO_BUF]; /* forward function declarations */ -static void * perspective_tool_perspective (GImage *, GimpDrawable *, TileManager *, int, Matrix); -static void perspective_find_transform (double *, Matrix); +static void * perspective_tool_perspective (GImage *, GimpDrawable *, TileManager *, int, GimpMatrix); +static void perspective_find_transform (double *, GimpMatrix); static void * perspective_tool_recalc (Tool *, void *); static void perspective_tool_motion (Tool *, void *); static void perspective_info_update (Tool *); @@ -133,7 +133,7 @@ tools_new_perspective_tool () private->trans_info[Y3] = 0; /* assemble the transformation matrix */ - identity_matrix (private->transform); + gimp_matrix_identity (private->transform); return tool; } @@ -219,7 +219,7 @@ perspective_tool_recalc (tool, gdisp_ptr) { TransformCore * transform_core; GDisplay * gdisp; - Matrix m; + GimpMatrix m; double cx, cy; double scalex, scaley; @@ -241,10 +241,10 @@ perspective_tool_recalc (tool, gdisp_ptr) scaley = 1.0 / (transform_core->y2 - transform_core->y1); /* assemble the transformation matrix */ - identity_matrix (transform_core->transform); - translate_matrix (transform_core->transform, -cx, -cy); - scale_matrix (transform_core->transform, scalex, scaley); - mult_matrix (m, transform_core->transform); + gimp_matrix_identity (transform_core->transform); + gimp_matrix_translate (transform_core->transform, -cx, -cy); + gimp_matrix_scale (transform_core->transform, scalex, scaley); + gimp_matrix_mult (m, transform_core->transform); /* transform the bounding box */ transform_bounding_box (tool); @@ -259,7 +259,7 @@ perspective_tool_recalc (tool, gdisp_ptr) static void perspective_find_transform (coords, m) double * coords; - Matrix m; + GimpMatrix m; { double dx1, dx2, dx3, dy1, dy2, dy3; double det1, det2; @@ -312,7 +312,7 @@ perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matr GimpDrawable *drawable; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); } @@ -410,7 +410,7 @@ perspective_invoker (args) int int_value; TileManager *float_tiles; TileManager *new_tiles; - Matrix matrix; + GimpMatrix matrix; int new_layer; Layer *layer; Argument *return_args; @@ -457,7 +457,7 @@ perspective_invoker (args) { double cx, cy; double scalex, scaley; - Matrix m; + GimpMatrix m; /* Start a transform undo group */ undo_push_group_start (gimage, TRANSFORM_CORE_UNDO); @@ -480,10 +480,10 @@ perspective_invoker (args) scaley = 1.0 / float_tiles->height; /* assemble the transformation matrix */ - identity_matrix (matrix); - translate_matrix (matrix, -cx, -cy); - scale_matrix (matrix, scalex, scaley); - mult_matrix (m, matrix); + gimp_matrix_identity (matrix); + gimp_matrix_translate (matrix, -cx, -cy); + gimp_matrix_scale (matrix, scalex, scaley); + gimp_matrix_mult (m, matrix); /* perspective the buffer */ new_tiles = perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matrix); diff --git a/app/tools/gimprotatetool.c b/app/tools/gimprotatetool.c index 8e85b19048..e805ef0ab5 100644 --- a/app/tools/gimprotatetool.c +++ b/app/tools/gimprotatetool.c @@ -52,7 +52,7 @@ static char center_x_buf [MAX_INFO_BUF]; static char center_y_buf [MAX_INFO_BUF]; /* 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_motion (Tool *, void *); static void rotate_info_update (Tool *); @@ -135,7 +135,7 @@ tools_new_rotate_tool () private->trans_info[CENTER_Y] = (private->y1 + private->y2) / 2; /* assemble the transformation matrix */ - identity_matrix (private->transform); + gimp_matrix_identity (private->transform); return tool; } @@ -339,10 +339,10 @@ rotate_tool_recalc (tool, gdisp_ptr) cy = transform_core->cy; /* assemble the transformation matrix */ - identity_matrix (transform_core->transform); - translate_matrix (transform_core->transform, -cx, -cy); - rotate_matrix (transform_core->transform, transform_core->trans_info[ANGLE]); - translate_matrix (transform_core->transform, +cx, +cy); + gimp_matrix_identity (transform_core->transform); + gimp_matrix_translate (transform_core->transform, -cx, -cy); + gimp_matrix_rotate (transform_core->transform, transform_core->trans_info[ANGLE]); + gimp_matrix_translate (transform_core->transform, +cx, +cy); /* transform the bounding box */ transform_bounding_box (tool); @@ -365,7 +365,7 @@ rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix) double angle; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); } @@ -435,7 +435,7 @@ rotate_invoker (args) int int_value; TileManager *float_tiles; TileManager *new_tiles; - Matrix matrix; + GimpMatrix matrix; int new_layer; Layer *layer; Argument *return_args; @@ -483,10 +483,10 @@ rotate_invoker (args) cy = float_tiles->y + float_tiles->height / 2.0; /* assemble the transformation matrix */ - identity_matrix (matrix); - translate_matrix (matrix, -cx, -cy); - rotate_matrix (matrix, angle); - translate_matrix (matrix, +cx, +cy); + gimp_matrix_identity (matrix); + gimp_matrix_translate (matrix, -cx, -cy); + gimp_matrix_rotate (matrix, angle); + gimp_matrix_translate (matrix, +cx, +cy); /* rotate the buffer */ new_tiles = rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix); diff --git a/app/tools/gimpscaletool.c b/app/tools/gimpscaletool.c index e85609c47f..7d83bb64bd 100644 --- a/app/tools/gimpscaletool.c +++ b/app/tools/gimpscaletool.c @@ -45,7 +45,7 @@ char x_ratio_buf [MAX_INFO_BUF]; char y_ratio_buf [MAX_INFO_BUF]; /* 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_motion (Tool *, void *); static void scale_info_update (Tool *); @@ -128,7 +128,7 @@ tools_new_scale_tool () private->trans_info[Y2] = 0; /* assemble the transformation matrix */ - identity_matrix (private->transform); + gimp_matrix_identity (private->transform); return tool; } @@ -407,10 +407,10 @@ scale_tool_recalc (tool, gdisp_ptr) } /* assemble the transformation matrix */ - identity_matrix (transform_core->transform); - translate_matrix (transform_core->transform, (double) -cx + diffx, (double) -cy + diffy); - scale_matrix (transform_core->transform, scalex, scaley); - translate_matrix (transform_core->transform, (double) cx, (double) cy); + gimp_matrix_identity (transform_core->transform); + gimp_matrix_translate (transform_core->transform, (double) -cx + diffx, (double) -cy + diffy); + gimp_matrix_scale (transform_core->transform, scalex, scaley); + gimp_matrix_translate (transform_core->transform, (double) cx, (double) cy); /* transform the bounding box */ transform_bounding_box (tool); @@ -428,7 +428,7 @@ scale_tool_scale (gimage, drawable, trans_info, float_tiles, interpolation, matr double *trans_info; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { TileManager *new_tiles; int x1, y1, x2, y2; @@ -538,7 +538,7 @@ scale_invoker (args) int int_value; TileManager *float_tiles; TileManager *new_tiles; - Matrix matrix; + GimpMatrix matrix; int new_layer; Layer *layer; Argument *return_args; @@ -598,10 +598,10 @@ scale_invoker (args) scaley = (trans_info[Y2] - trans_info[Y1]) / (double) float_tiles->height; /* assemble the transformation matrix */ - identity_matrix (matrix); - translate_matrix (matrix, float_tiles->x, float_tiles->y); - scale_matrix (matrix, scalex, scaley); - translate_matrix (matrix, trans_info[X1], trans_info[Y1]); + gimp_matrix_identity (matrix); + gimp_matrix_translate (matrix, float_tiles->x, float_tiles->y); + gimp_matrix_scale (matrix, scalex, scaley); + gimp_matrix_translate (matrix, trans_info[X1], trans_info[Y1]); /* scale the buffer */ new_tiles = scale_tool_scale (gimage, drawable, trans_info, diff --git a/app/tools/gimpsheartool.c b/app/tools/gimpsheartool.c index 8419bb391c..dbab53702f 100644 --- a/app/tools/gimpsheartool.c +++ b/app/tools/gimpsheartool.c @@ -51,7 +51,7 @@ static char xshear_buf [MAX_INFO_BUF]; static char yshear_buf [MAX_INFO_BUF]; /* 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_motion (Tool *, void *); static void shear_info_update (Tool *); @@ -126,7 +126,7 @@ tools_new_shear_tool () private->trans_func = shear_tool_transform; /* assemble the transformation matrix */ - identity_matrix (private->transform); + gimp_matrix_identity (private->transform); return tool; } @@ -323,18 +323,18 @@ shear_tool_recalc (tool, gdisp_ptr) height = 1; /* assemble the transformation matrix */ - identity_matrix (transform_core->transform); - translate_matrix (transform_core->transform, -cx, -cy); + gimp_matrix_identity (transform_core->transform); + gimp_matrix_translate (transform_core->transform, -cx, -cy); /* shear matrix */ 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); else - yshear_matrix (transform_core->transform, + gimp_matrix_yshear (transform_core->transform, (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_bounding_box (tool); @@ -352,7 +352,7 @@ shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix) GimpDrawable *drawable; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); } @@ -427,7 +427,7 @@ shear_invoker (args) int int_value; TileManager *float_tiles; TileManager *new_tiles; - Matrix matrix; + GimpMatrix matrix; int new_layer; Layer *layer; Argument *return_args; @@ -488,14 +488,14 @@ shear_invoker (args) cx = float_tiles->x + float_tiles->width / 2.0; cy = float_tiles->y + float_tiles->height / 2.0; - identity_matrix (matrix); - translate_matrix (matrix, -cx, -cy); + gimp_matrix_identity (matrix); + gimp_matrix_translate (matrix, -cx, -cy); /* shear matrix */ 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) - yshear_matrix (matrix, shear_magnitude / float_tiles->width); - translate_matrix (matrix, +cx, +cy); + gimp_matrix_yshear (matrix, shear_magnitude / float_tiles->width); + gimp_matrix_translate (matrix, +cx, +cy); /* shear the buffer */ new_tiles = shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix); diff --git a/app/tools/perspective_tool.c b/app/tools/perspective_tool.c index e5f58962a0..4fbb268f1a 100644 --- a/app/tools/perspective_tool.c +++ b/app/tools/perspective_tool.c @@ -44,8 +44,8 @@ static char matrix_row_buf [3][MAX_INFO_BUF]; /* forward function declarations */ -static void * perspective_tool_perspective (GImage *, GimpDrawable *, TileManager *, int, Matrix); -static void perspective_find_transform (double *, Matrix); +static void * perspective_tool_perspective (GImage *, GimpDrawable *, TileManager *, int, GimpMatrix); +static void perspective_find_transform (double *, GimpMatrix); static void * perspective_tool_recalc (Tool *, void *); static void perspective_tool_motion (Tool *, void *); static void perspective_info_update (Tool *); @@ -133,7 +133,7 @@ tools_new_perspective_tool () private->trans_info[Y3] = 0; /* assemble the transformation matrix */ - identity_matrix (private->transform); + gimp_matrix_identity (private->transform); return tool; } @@ -219,7 +219,7 @@ perspective_tool_recalc (tool, gdisp_ptr) { TransformCore * transform_core; GDisplay * gdisp; - Matrix m; + GimpMatrix m; double cx, cy; double scalex, scaley; @@ -241,10 +241,10 @@ perspective_tool_recalc (tool, gdisp_ptr) scaley = 1.0 / (transform_core->y2 - transform_core->y1); /* assemble the transformation matrix */ - identity_matrix (transform_core->transform); - translate_matrix (transform_core->transform, -cx, -cy); - scale_matrix (transform_core->transform, scalex, scaley); - mult_matrix (m, transform_core->transform); + gimp_matrix_identity (transform_core->transform); + gimp_matrix_translate (transform_core->transform, -cx, -cy); + gimp_matrix_scale (transform_core->transform, scalex, scaley); + gimp_matrix_mult (m, transform_core->transform); /* transform the bounding box */ transform_bounding_box (tool); @@ -259,7 +259,7 @@ perspective_tool_recalc (tool, gdisp_ptr) static void perspective_find_transform (coords, m) double * coords; - Matrix m; + GimpMatrix m; { double dx1, dx2, dx3, dy1, dy2, dy3; double det1, det2; @@ -312,7 +312,7 @@ perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matr GimpDrawable *drawable; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); } @@ -410,7 +410,7 @@ perspective_invoker (args) int int_value; TileManager *float_tiles; TileManager *new_tiles; - Matrix matrix; + GimpMatrix matrix; int new_layer; Layer *layer; Argument *return_args; @@ -457,7 +457,7 @@ perspective_invoker (args) { double cx, cy; double scalex, scaley; - Matrix m; + GimpMatrix m; /* Start a transform undo group */ undo_push_group_start (gimage, TRANSFORM_CORE_UNDO); @@ -480,10 +480,10 @@ perspective_invoker (args) scaley = 1.0 / float_tiles->height; /* assemble the transformation matrix */ - identity_matrix (matrix); - translate_matrix (matrix, -cx, -cy); - scale_matrix (matrix, scalex, scaley); - mult_matrix (m, matrix); + gimp_matrix_identity (matrix); + gimp_matrix_translate (matrix, -cx, -cy); + gimp_matrix_scale (matrix, scalex, scaley); + gimp_matrix_mult (m, matrix); /* perspective the buffer */ new_tiles = perspective_tool_perspective (gimage, drawable, float_tiles, interpolation, matrix); diff --git a/app/tools/rotate_tool.c b/app/tools/rotate_tool.c index 8e85b19048..e805ef0ab5 100644 --- a/app/tools/rotate_tool.c +++ b/app/tools/rotate_tool.c @@ -52,7 +52,7 @@ static char center_x_buf [MAX_INFO_BUF]; static char center_y_buf [MAX_INFO_BUF]; /* 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_motion (Tool *, void *); static void rotate_info_update (Tool *); @@ -135,7 +135,7 @@ tools_new_rotate_tool () private->trans_info[CENTER_Y] = (private->y1 + private->y2) / 2; /* assemble the transformation matrix */ - identity_matrix (private->transform); + gimp_matrix_identity (private->transform); return tool; } @@ -339,10 +339,10 @@ rotate_tool_recalc (tool, gdisp_ptr) cy = transform_core->cy; /* assemble the transformation matrix */ - identity_matrix (transform_core->transform); - translate_matrix (transform_core->transform, -cx, -cy); - rotate_matrix (transform_core->transform, transform_core->trans_info[ANGLE]); - translate_matrix (transform_core->transform, +cx, +cy); + gimp_matrix_identity (transform_core->transform); + gimp_matrix_translate (transform_core->transform, -cx, -cy); + gimp_matrix_rotate (transform_core->transform, transform_core->trans_info[ANGLE]); + gimp_matrix_translate (transform_core->transform, +cx, +cy); /* transform the bounding box */ transform_bounding_box (tool); @@ -365,7 +365,7 @@ rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix) double angle; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); } @@ -435,7 +435,7 @@ rotate_invoker (args) int int_value; TileManager *float_tiles; TileManager *new_tiles; - Matrix matrix; + GimpMatrix matrix; int new_layer; Layer *layer; Argument *return_args; @@ -483,10 +483,10 @@ rotate_invoker (args) cy = float_tiles->y + float_tiles->height / 2.0; /* assemble the transformation matrix */ - identity_matrix (matrix); - translate_matrix (matrix, -cx, -cy); - rotate_matrix (matrix, angle); - translate_matrix (matrix, +cx, +cy); + gimp_matrix_identity (matrix); + gimp_matrix_translate (matrix, -cx, -cy); + gimp_matrix_rotate (matrix, angle); + gimp_matrix_translate (matrix, +cx, +cy); /* rotate the buffer */ new_tiles = rotate_tool_rotate (gimage, drawable, angle, float_tiles, interpolation, matrix); diff --git a/app/tools/scale_tool.c b/app/tools/scale_tool.c index e85609c47f..7d83bb64bd 100644 --- a/app/tools/scale_tool.c +++ b/app/tools/scale_tool.c @@ -45,7 +45,7 @@ char x_ratio_buf [MAX_INFO_BUF]; char y_ratio_buf [MAX_INFO_BUF]; /* 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_motion (Tool *, void *); static void scale_info_update (Tool *); @@ -128,7 +128,7 @@ tools_new_scale_tool () private->trans_info[Y2] = 0; /* assemble the transformation matrix */ - identity_matrix (private->transform); + gimp_matrix_identity (private->transform); return tool; } @@ -407,10 +407,10 @@ scale_tool_recalc (tool, gdisp_ptr) } /* assemble the transformation matrix */ - identity_matrix (transform_core->transform); - translate_matrix (transform_core->transform, (double) -cx + diffx, (double) -cy + diffy); - scale_matrix (transform_core->transform, scalex, scaley); - translate_matrix (transform_core->transform, (double) cx, (double) cy); + gimp_matrix_identity (transform_core->transform); + gimp_matrix_translate (transform_core->transform, (double) -cx + diffx, (double) -cy + diffy); + gimp_matrix_scale (transform_core->transform, scalex, scaley); + gimp_matrix_translate (transform_core->transform, (double) cx, (double) cy); /* transform the bounding box */ transform_bounding_box (tool); @@ -428,7 +428,7 @@ scale_tool_scale (gimage, drawable, trans_info, float_tiles, interpolation, matr double *trans_info; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { TileManager *new_tiles; int x1, y1, x2, y2; @@ -538,7 +538,7 @@ scale_invoker (args) int int_value; TileManager *float_tiles; TileManager *new_tiles; - Matrix matrix; + GimpMatrix matrix; int new_layer; Layer *layer; Argument *return_args; @@ -598,10 +598,10 @@ scale_invoker (args) scaley = (trans_info[Y2] - trans_info[Y1]) / (double) float_tiles->height; /* assemble the transformation matrix */ - identity_matrix (matrix); - translate_matrix (matrix, float_tiles->x, float_tiles->y); - scale_matrix (matrix, scalex, scaley); - translate_matrix (matrix, trans_info[X1], trans_info[Y1]); + gimp_matrix_identity (matrix); + gimp_matrix_translate (matrix, float_tiles->x, float_tiles->y); + gimp_matrix_scale (matrix, scalex, scaley); + gimp_matrix_translate (matrix, trans_info[X1], trans_info[Y1]); /* scale the buffer */ new_tiles = scale_tool_scale (gimage, drawable, trans_info, diff --git a/app/tools/shear_tool.c b/app/tools/shear_tool.c index 8419bb391c..dbab53702f 100644 --- a/app/tools/shear_tool.c +++ b/app/tools/shear_tool.c @@ -51,7 +51,7 @@ static char xshear_buf [MAX_INFO_BUF]; static char yshear_buf [MAX_INFO_BUF]; /* 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_motion (Tool *, void *); static void shear_info_update (Tool *); @@ -126,7 +126,7 @@ tools_new_shear_tool () private->trans_func = shear_tool_transform; /* assemble the transformation matrix */ - identity_matrix (private->transform); + gimp_matrix_identity (private->transform); return tool; } @@ -323,18 +323,18 @@ shear_tool_recalc (tool, gdisp_ptr) height = 1; /* assemble the transformation matrix */ - identity_matrix (transform_core->transform); - translate_matrix (transform_core->transform, -cx, -cy); + gimp_matrix_identity (transform_core->transform); + gimp_matrix_translate (transform_core->transform, -cx, -cy); /* shear matrix */ 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); else - yshear_matrix (transform_core->transform, + gimp_matrix_yshear (transform_core->transform, (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_bounding_box (tool); @@ -352,7 +352,7 @@ shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix) GimpDrawable *drawable; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { return transform_core_do (gimage, drawable, float_tiles, interpolation, matrix); } @@ -427,7 +427,7 @@ shear_invoker (args) int int_value; TileManager *float_tiles; TileManager *new_tiles; - Matrix matrix; + GimpMatrix matrix; int new_layer; Layer *layer; Argument *return_args; @@ -488,14 +488,14 @@ shear_invoker (args) cx = float_tiles->x + float_tiles->width / 2.0; cy = float_tiles->y + float_tiles->height / 2.0; - identity_matrix (matrix); - translate_matrix (matrix, -cx, -cy); + gimp_matrix_identity (matrix); + gimp_matrix_translate (matrix, -cx, -cy); /* shear matrix */ 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) - yshear_matrix (matrix, shear_magnitude / float_tiles->width); - translate_matrix (matrix, +cx, +cy); + gimp_matrix_yshear (matrix, shear_magnitude / float_tiles->width); + gimp_matrix_translate (matrix, +cx, +cy); /* shear the buffer */ new_tiles = shear_tool_shear (gimage, drawable, float_tiles, interpolation, matrix); diff --git a/app/tools/transform_core.c b/app/tools/transform_core.c index b82e9f7fe0..32975bbed2 100644 --- a/app/tools/transform_core.c +++ b/app/tools/transform_core.c @@ -57,7 +57,6 @@ static void * transform_core_recalc (Tool *, void *); static void transform_core_doit (Tool *, gpointer); static double cubic (double, int, int, int, int); static void transform_core_setup_grid (Tool *); -static void invert (Matrix, Matrix); #define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \ ((1-dy) * ((1-dx)*jk + dx*j1k) + \ @@ -742,23 +741,23 @@ transform_bounding_box (tool) transform_core = (TransformCore *) tool->private; - transform_point (transform_core->transform, - transform_core->x1, transform_core->y1, - &transform_core->tx1, &transform_core->ty1); - transform_point (transform_core->transform, - transform_core->x2, transform_core->y1, - &transform_core->tx2, &transform_core->ty2); - transform_point (transform_core->transform, - transform_core->x1, transform_core->y2, - &transform_core->tx3, &transform_core->ty3); - transform_point (transform_core->transform, - transform_core->x2, transform_core->y2, - &transform_core->tx4, &transform_core->ty4); + gimp_matrix_transform_point (transform_core->transform, + transform_core->x1, transform_core->y1, + &transform_core->tx1, &transform_core->ty1); + gimp_matrix_transform_point (transform_core->transform, + transform_core->x2, transform_core->y1, + &transform_core->tx2, &transform_core->ty2); + gimp_matrix_transform_point (transform_core->transform, + transform_core->x1, transform_core->y2, + &transform_core->tx3, &transform_core->ty3); + gimp_matrix_transform_point (transform_core->transform, + transform_core->x2, transform_core->y2, + &transform_core->tx4, &transform_core->ty4); if (tool->type == ROTATE) - transform_point (transform_core->transform, - transform_core->cx, transform_core->cy, - &transform_core->tcx, &transform_core->tcy); + gimp_matrix_transform_point (transform_core->transform, + transform_core->cx, transform_core->cy, + &transform_core->tcx, &transform_core->tcy); if (transform_core->grid_coords != NULL && transform_core->tgrid_coords != NULL) @@ -767,204 +766,16 @@ transform_bounding_box (tool) k = (transform_core->ngx + transform_core->ngy) * 2; for (i = 0; i < k; i++) { - transform_point (transform_core->transform, - transform_core->grid_coords[gci], - transform_core->grid_coords[gci+1], - &(transform_core->tgrid_coords[gci]), - &(transform_core->tgrid_coords[gci+1])); + gimp_matrix_transform_point (transform_core->transform, + transform_core->grid_coords[gci], + transform_core->grid_coords[gci+1], + &(transform_core->tgrid_coords[gci]), + &(transform_core->tgrid_coords[gci+1])); 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 transform_core_reset(tool, gdisp_ptr) Tool * tool; @@ -1127,12 +938,12 @@ transform_core_do (gimage, drawable, float_tiles, interpolation, matrix) GimpDrawable *drawable; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { PixelRegion destPR; TileManager *tiles; - Matrix m; - Matrix im; + GimpMatrix m; + GimpMatrix im; int itx, ity; int tx1, ty1, tx2, ty2; int width, height; @@ -1183,12 +994,12 @@ transform_core_do (gimage, drawable, float_tiles, interpolation, matrix) if (transform_tool_direction () == TRANSFORM_CORRECTIVE) { - invert (matrix, im); + gimp_matrix_invert (matrix, im); matrix = im; } /* Find the inverse of the transformation matrix */ - invert (matrix, m); + gimp_matrix_invert (matrix, m); x1 = float_tiles->x; 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; - transform_point (matrix, x1, y1, &dx1, &dy1); - transform_point (matrix, x2, y1, &dx2, &dy2); - transform_point (matrix, x1, y2, &dx3, &dy3); - transform_point (matrix, x2, y2, &dx4, &dy4); + gimp_matrix_transform_point (matrix, x1, y1, &dx1, &dy1); + gimp_matrix_transform_point (matrix, x2, y1, &dx2, &dy2); + gimp_matrix_transform_point (matrix, x1, y2, &dx3, &dy3); + gimp_matrix_transform_point (matrix, x2, y2, &dx4, &dy4); tx1 = MINIMUM (dx1, dx2); tx1 = MINIMUM (tx1, dx3); diff --git a/app/tools/transform_core.h b/app/tools/transform_core.h index 08faf32089..0a4e162678 100644 --- a/app/tools/transform_core.h +++ b/app/tools/transform_core.h @@ -21,6 +21,7 @@ #include "info_dialog.h" #include "draw_core.h" #include "temp_buf.h" +#include "libgimp/gimpmatrix.h" /* possible scaling functions */ #define CREATING 0 @@ -45,8 +46,6 @@ #define INTERACTIVE 1 -typedef double Vector[3]; -typedef Vector Matrix[3]; typedef double TranInfo[TRAN_INFO_SIZE]; typedef void * (* TransformFunc) (Tool *, void *, int); @@ -83,7 +82,7 @@ struct _transform_core int sx4, sy4; /* */ int scx, scy; /* and center for rotation */ - Matrix transform; /* transformation matrix */ + GimpMatrix transform; /* transformation matrix */ TranInfo trans_info; /* transformation info */ TileManager * original; /* pointer to original tiles */ @@ -137,20 +136,10 @@ void transform_core_reset (Tool *, void *); void transform_core_grid_density_changed (void); /* 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 *); Layer * transform_core_paste (GImage *, GimpDrawable *, TileManager *, int); - -/* 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); +void transform_bounding_box (Tool*); #endif /* __TRANSFORM_CORE_H__ */ diff --git a/app/transform_core.c b/app/transform_core.c index b82e9f7fe0..32975bbed2 100644 --- a/app/transform_core.c +++ b/app/transform_core.c @@ -57,7 +57,6 @@ static void * transform_core_recalc (Tool *, void *); static void transform_core_doit (Tool *, gpointer); static double cubic (double, int, int, int, int); static void transform_core_setup_grid (Tool *); -static void invert (Matrix, Matrix); #define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \ ((1-dy) * ((1-dx)*jk + dx*j1k) + \ @@ -742,23 +741,23 @@ transform_bounding_box (tool) transform_core = (TransformCore *) tool->private; - transform_point (transform_core->transform, - transform_core->x1, transform_core->y1, - &transform_core->tx1, &transform_core->ty1); - transform_point (transform_core->transform, - transform_core->x2, transform_core->y1, - &transform_core->tx2, &transform_core->ty2); - transform_point (transform_core->transform, - transform_core->x1, transform_core->y2, - &transform_core->tx3, &transform_core->ty3); - transform_point (transform_core->transform, - transform_core->x2, transform_core->y2, - &transform_core->tx4, &transform_core->ty4); + gimp_matrix_transform_point (transform_core->transform, + transform_core->x1, transform_core->y1, + &transform_core->tx1, &transform_core->ty1); + gimp_matrix_transform_point (transform_core->transform, + transform_core->x2, transform_core->y1, + &transform_core->tx2, &transform_core->ty2); + gimp_matrix_transform_point (transform_core->transform, + transform_core->x1, transform_core->y2, + &transform_core->tx3, &transform_core->ty3); + gimp_matrix_transform_point (transform_core->transform, + transform_core->x2, transform_core->y2, + &transform_core->tx4, &transform_core->ty4); if (tool->type == ROTATE) - transform_point (transform_core->transform, - transform_core->cx, transform_core->cy, - &transform_core->tcx, &transform_core->tcy); + gimp_matrix_transform_point (transform_core->transform, + transform_core->cx, transform_core->cy, + &transform_core->tcx, &transform_core->tcy); if (transform_core->grid_coords != NULL && transform_core->tgrid_coords != NULL) @@ -767,204 +766,16 @@ transform_bounding_box (tool) k = (transform_core->ngx + transform_core->ngy) * 2; for (i = 0; i < k; i++) { - transform_point (transform_core->transform, - transform_core->grid_coords[gci], - transform_core->grid_coords[gci+1], - &(transform_core->tgrid_coords[gci]), - &(transform_core->tgrid_coords[gci+1])); + gimp_matrix_transform_point (transform_core->transform, + transform_core->grid_coords[gci], + transform_core->grid_coords[gci+1], + &(transform_core->tgrid_coords[gci]), + &(transform_core->tgrid_coords[gci+1])); 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 transform_core_reset(tool, gdisp_ptr) Tool * tool; @@ -1127,12 +938,12 @@ transform_core_do (gimage, drawable, float_tiles, interpolation, matrix) GimpDrawable *drawable; TileManager *float_tiles; int interpolation; - Matrix matrix; + GimpMatrix matrix; { PixelRegion destPR; TileManager *tiles; - Matrix m; - Matrix im; + GimpMatrix m; + GimpMatrix im; int itx, ity; int tx1, ty1, tx2, ty2; int width, height; @@ -1183,12 +994,12 @@ transform_core_do (gimage, drawable, float_tiles, interpolation, matrix) if (transform_tool_direction () == TRANSFORM_CORRECTIVE) { - invert (matrix, im); + gimp_matrix_invert (matrix, im); matrix = im; } /* Find the inverse of the transformation matrix */ - invert (matrix, m); + gimp_matrix_invert (matrix, m); x1 = float_tiles->x; 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; - transform_point (matrix, x1, y1, &dx1, &dy1); - transform_point (matrix, x2, y1, &dx2, &dy2); - transform_point (matrix, x1, y2, &dx3, &dy3); - transform_point (matrix, x2, y2, &dx4, &dy4); + gimp_matrix_transform_point (matrix, x1, y1, &dx1, &dy1); + gimp_matrix_transform_point (matrix, x2, y1, &dx2, &dy2); + gimp_matrix_transform_point (matrix, x1, y2, &dx3, &dy3); + gimp_matrix_transform_point (matrix, x2, y2, &dx4, &dy4); tx1 = MINIMUM (dx1, dx2); tx1 = MINIMUM (tx1, dx3); diff --git a/app/transform_core.h b/app/transform_core.h index 08faf32089..0a4e162678 100644 --- a/app/transform_core.h +++ b/app/transform_core.h @@ -21,6 +21,7 @@ #include "info_dialog.h" #include "draw_core.h" #include "temp_buf.h" +#include "libgimp/gimpmatrix.h" /* possible scaling functions */ #define CREATING 0 @@ -45,8 +46,6 @@ #define INTERACTIVE 1 -typedef double Vector[3]; -typedef Vector Matrix[3]; typedef double TranInfo[TRAN_INFO_SIZE]; typedef void * (* TransformFunc) (Tool *, void *, int); @@ -83,7 +82,7 @@ struct _transform_core int sx4, sy4; /* */ int scx, scy; /* and center for rotation */ - Matrix transform; /* transformation matrix */ + GimpMatrix transform; /* transformation matrix */ TranInfo trans_info; /* transformation info */ TileManager * original; /* pointer to original tiles */ @@ -137,20 +136,10 @@ void transform_core_reset (Tool *, void *); void transform_core_grid_density_changed (void); /* 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 *); Layer * transform_core_paste (GImage *, GimpDrawable *, TileManager *, int); - -/* 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); +void transform_bounding_box (Tool*); #endif /* __TRANSFORM_CORE_H__ */ diff --git a/docs/parasites.txt b/docs/parasites.txt index ba146b5311..4fa4dce5e8 100644 --- a/docs/parasites.txt +++ b/docs/parasites.txt @@ -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 +"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 includes a trailing \0 string terminator. The size of the parasite data may not exceed 241 bytes. This parasite attaches to images only. -"tiff" / "sopt" : The TiffSaveVals structure from the TIFF plugin. - This parasite attaches to images only. +"tiff-save-options" : The TiffSaveVals structure from the TIFF plugin. + This parasite attaches to images only. ------------------------------------------------------------------ diff --git a/libgimp/Makefile.am b/libgimp/Makefile.am index 9102fbc8fe..d857bdca07 100644 --- a/libgimp/Makefile.am +++ b/libgimp/Makefile.am @@ -10,10 +10,16 @@ lib_LTLIBRARIES = libgimp.la libgimpui.la noinst_LIBRARIES = libgimpi.a libgimpi_a_SOURCES = \ + gimpmatrix.c \ + gimpmatrix.h \ gimpprotocol.c \ gimpprotocol.h \ 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 libgimpi_a_DEPENDENCIES = libgimp.la @@ -26,6 +32,8 @@ libgimp_la_SOURCES = \ gimpgradient.c \ gimpimage.c \ gimplayer.c \ + gimpmatrix.c \ + gimpmatrix.h \ gimppalette.c \ gimppixelrgn.c \ gimpprotocol.c \ @@ -33,8 +41,10 @@ libgimp_la_SOURCES = \ gimptile.c \ gimpwire.c \ gimpwire.h \ - gimpparasite.c \ - gimpparasite.h + parasite.c \ + parasite.h \ + parasiteF.h \ + parasiteP.h libgimpui_la_SOURCES = \ gimpmenu.c \ @@ -44,13 +54,16 @@ gimpinclude_HEADERS = \ gimp.h \ gimpenums.h \ gimpfeatures.h \ + gimpmatrix.h \ gimpmenu.h \ gimpui.h \ gimpintl.h \ - gimpparasite.h + parasite.h \ + parasiteF.h \ + parasiteP.h 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 = \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) diff --git a/libgimp/gimp.c b/libgimp/gimp.c index 3b5f7a3dee..c9f411f5c2 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -28,6 +28,7 @@ #include #include #include +#include "parasiteP.h" #ifdef HAVE_IPC_H #include @@ -624,7 +625,7 @@ gimp_run_procedure (char *name, (void) va_arg (args, guchar*); break; case PARAM_PARASITE: - (void) va_arg (args, GParasite*); + (void) va_arg (args, Parasite*); break; case PARAM_REGION: break; @@ -712,19 +713,13 @@ gimp_run_procedure (char *name, break; case PARAM_PARASITE: { - GParasite *p = va_arg (args, GParasite*); + Parasite *p = va_arg (args, Parasite*); if (p == NULL) - p = gparasite_error(); - memcpy(proc_run.params[i].data.d_parasite.creator, p->creator, 4); - memcpy(proc_run.params[i].data.d_parasite.type, p->type, 4); + p = parasite_error(); + proc_run.params[i].data.d_parasite.name = p->name; proc_run.params[i].data.d_parasite.flags = p->flags; proc_run.params[i].data.d_parasite.size = p->size; - if (p->size > 0) - proc_run.params[i].data.d_parasite.data = g_memdup (p->data, - p->size); - else - proc_run.params[i].data.d_parasite.data = NULL; - + proc_run.params[i].data.d_parasite.data = p->data; } break; case PARAM_STATUS: proc_run.params[i].data.d_status = va_arg (args, gint32); diff --git a/libgimp/gimp.h b/libgimp/gimp.h index e4bb2637c1..1b23c51fe8 100644 --- a/libgimp/gimp.h +++ b/libgimp/gimp.h @@ -21,9 +21,10 @@ #include -#include -#include -#include +#include "libgimp/gimpenums.h" +#include "libgimp/gimpfeatures.h" +#include "libgimp/parasite.h" +#include "libgimp/parasiteP.h" #ifdef __cplusplus @@ -158,7 +159,7 @@ union _GParamData gint32 d_selection; gint32 d_boundary; gint32 d_path; - GParasite d_parasite; + Parasite d_parasite; gint32 d_status; }; @@ -427,13 +428,12 @@ void gimp_image_set_component_visible (gint32 image_ID, gint visible); void gimp_image_set_filename (gint32 image_ID, char *name); -GParasite *gimp_image_find_parasite (gint32 image_ID, - const char *creator, - const char *type); +Parasite *gimp_image_find_parasite (gint32 image_ID, + const char *name); void gimp_image_attach_parasite (gint32 image_ID, - const GParasite *p); + const Parasite *p); void gimp_image_detach_parasite (gint32 image_ID, - GParasite *p); + const char *name); void gimp_image_set_resolution (gint32 image_ID, float resolution); float gimp_image_get_resolution (gint32 image_ID); @@ -529,13 +529,12 @@ void gimp_layer_set_show_mask (gint32 layer_ID, gint show_mask); void gimp_layer_set_visible (gint32 layer_ID, gint visible); -GParasite *gimp_layer_find_parasite (gint32 image_ID, - const char *creator, - const char *type); +Parasite *gimp_layer_find_parasite (gint32 image_ID, + const char *name); void gimp_layer_attach_parasite (gint32 layer_ID, - const GParasite *p); + const Parasite *p); 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 x, gint y); -GParasite *gimp_drawable_find_parasite (gint32 drawable, - const char *creator, - const char *type); +Parasite *gimp_drawable_find_parasite (gint32 drawable, + const char *name); void gimp_drawable_attach_parasite (gint32 drawable, - const GParasite *p); + const Parasite *p); void gimp_drawable_detach_parasite (gint32 drawable, - GParasite *p); + const char *name); /**************************************** * GTiles * diff --git a/libgimp/gimpdrawable.c b/libgimp/gimpdrawable.c index fc2401ca13..896d3b718e 100644 --- a/libgimp/gimpdrawable.c +++ b/libgimp/gimpdrawable.c @@ -576,25 +576,23 @@ gimp_drawable_get_tile2 (GDrawable *drawable, return gimp_drawable_get_tile (drawable, shadow, row, col); } -GParasite * +Parasite * gimp_drawable_find_parasite (gint32 drawable_ID, - const char *creator, - const char *type) + const char *name) { GParam *return_vals; int nreturn_vals; - GParasite *parasite; + Parasite *parasite; return_vals = gimp_run_procedure ("gimp_drawable_find_parasite", &nreturn_vals, PARAM_DRAWABLE, drawable_ID, - PARAM_STRING, creator, - PARAM_STRING, type, + PARAM_STRING, name, PARAM_END); 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 parasite = NULL; @@ -606,7 +604,7 @@ gimp_drawable_find_parasite (gint32 drawable_ID, void gimp_drawable_attach_parasite (gint32 drawable_ID, - const GParasite *p) + const Parasite *p) { GParam *return_vals; int nreturn_vals; @@ -623,7 +621,7 @@ gimp_drawable_attach_parasite (gint32 drawable_ID, void gimp_drawable_detach_parasite (gint32 drawable_ID, - GParasite *p) + const char *name) { GParam *return_vals; int nreturn_vals; @@ -631,7 +629,7 @@ gimp_drawable_detach_parasite (gint32 drawable_ID, return_vals = gimp_run_procedure ("gimp_drawable_detach_parasite", &nreturn_vals, PARAM_DRAWABLE, drawable_ID, - PARAM_PARASITE, p, + PARAM_STRING, name, PARAM_END); diff --git a/libgimp/gimpdrawable_pdb.c b/libgimp/gimpdrawable_pdb.c index fc2401ca13..896d3b718e 100644 --- a/libgimp/gimpdrawable_pdb.c +++ b/libgimp/gimpdrawable_pdb.c @@ -576,25 +576,23 @@ gimp_drawable_get_tile2 (GDrawable *drawable, return gimp_drawable_get_tile (drawable, shadow, row, col); } -GParasite * +Parasite * gimp_drawable_find_parasite (gint32 drawable_ID, - const char *creator, - const char *type) + const char *name) { GParam *return_vals; int nreturn_vals; - GParasite *parasite; + Parasite *parasite; return_vals = gimp_run_procedure ("gimp_drawable_find_parasite", &nreturn_vals, PARAM_DRAWABLE, drawable_ID, - PARAM_STRING, creator, - PARAM_STRING, type, + PARAM_STRING, name, PARAM_END); 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 parasite = NULL; @@ -606,7 +604,7 @@ gimp_drawable_find_parasite (gint32 drawable_ID, void gimp_drawable_attach_parasite (gint32 drawable_ID, - const GParasite *p) + const Parasite *p) { GParam *return_vals; int nreturn_vals; @@ -623,7 +621,7 @@ gimp_drawable_attach_parasite (gint32 drawable_ID, void gimp_drawable_detach_parasite (gint32 drawable_ID, - GParasite *p) + const char *name) { GParam *return_vals; int nreturn_vals; @@ -631,7 +629,7 @@ gimp_drawable_detach_parasite (gint32 drawable_ID, return_vals = gimp_run_procedure ("gimp_drawable_detach_parasite", &nreturn_vals, PARAM_DRAWABLE, drawable_ID, - PARAM_PARASITE, p, + PARAM_STRING, name, PARAM_END); diff --git a/libgimp/gimpimage.c b/libgimp/gimpimage.c index 4e4d953fc6..48ef786079 100644 --- a/libgimp/gimpimage.c +++ b/libgimp/gimpimage.c @@ -910,25 +910,21 @@ gimp_image_set_filename (gint32 image_ID, gimp_destroy_params (return_vals, nreturn_vals); } -GParasite * -gimp_image_find_parasite (gint32 image_ID, - const char *creator, - const char *type) - +Parasite * +gimp_image_find_parasite (gint32 image_ID, const char *name) { GParam *return_vals; int nreturn_vals; - GParasite *parasite; + Parasite *parasite; return_vals = gimp_run_procedure ("gimp_image_find_parasite", &nreturn_vals, PARAM_IMAGE, image_ID, - PARAM_STRING, creator, - PARAM_STRING, type, + PARAM_STRING, name, PARAM_END); 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 parasite = NULL; @@ -939,8 +935,7 @@ gimp_image_find_parasite (gint32 image_ID, } void -gimp_image_attach_parasite (gint32 image_ID, - const GParasite *p) +gimp_image_attach_parasite (gint32 image_ID, const Parasite *p) { GParam *return_vals; int nreturn_vals; @@ -955,8 +950,7 @@ gimp_image_attach_parasite (gint32 image_ID, } void -gimp_image_detach_parasite (gint32 image_ID, - GParasite *p) +gimp_image_detach_parasite (gint32 image_ID, const char *name) { GParam *return_vals; int nreturn_vals; @@ -964,7 +958,7 @@ gimp_image_detach_parasite (gint32 image_ID, return_vals = gimp_run_procedure ("gimp_image_detach_parasite", &nreturn_vals, PARAM_IMAGE, image_ID, - PARAM_PARASITE, p, + PARAM_STRING, name, PARAM_END); gimp_destroy_params (return_vals, nreturn_vals); diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c index 4e4d953fc6..48ef786079 100644 --- a/libgimp/gimpimage_pdb.c +++ b/libgimp/gimpimage_pdb.c @@ -910,25 +910,21 @@ gimp_image_set_filename (gint32 image_ID, gimp_destroy_params (return_vals, nreturn_vals); } -GParasite * -gimp_image_find_parasite (gint32 image_ID, - const char *creator, - const char *type) - +Parasite * +gimp_image_find_parasite (gint32 image_ID, const char *name) { GParam *return_vals; int nreturn_vals; - GParasite *parasite; + Parasite *parasite; return_vals = gimp_run_procedure ("gimp_image_find_parasite", &nreturn_vals, PARAM_IMAGE, image_ID, - PARAM_STRING, creator, - PARAM_STRING, type, + PARAM_STRING, name, PARAM_END); 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 parasite = NULL; @@ -939,8 +935,7 @@ gimp_image_find_parasite (gint32 image_ID, } void -gimp_image_attach_parasite (gint32 image_ID, - const GParasite *p) +gimp_image_attach_parasite (gint32 image_ID, const Parasite *p) { GParam *return_vals; int nreturn_vals; @@ -955,8 +950,7 @@ gimp_image_attach_parasite (gint32 image_ID, } void -gimp_image_detach_parasite (gint32 image_ID, - GParasite *p) +gimp_image_detach_parasite (gint32 image_ID, const char *name) { GParam *return_vals; int nreturn_vals; @@ -964,7 +958,7 @@ gimp_image_detach_parasite (gint32 image_ID, return_vals = gimp_run_procedure ("gimp_image_detach_parasite", &nreturn_vals, PARAM_IMAGE, image_ID, - PARAM_PARASITE, p, + PARAM_STRING, name, PARAM_END); gimp_destroy_params (return_vals, nreturn_vals); diff --git a/libgimp/gimpmatrix.c b/libgimp/gimpmatrix.c new file mode 100644 index 0000000000..e3882e2d74 --- /dev/null +++ b/libgimp/gimpmatrix.c @@ -0,0 +1,171 @@ +/* gimpmatrix.c + * Copyright (C) 1998 Jay Cox + * + * 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 + +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; +} diff --git a/libgimp/gimpmatrix.h b/libgimp/gimpmatrix.h new file mode 100644 index 0000000000..5df9e01677 --- /dev/null +++ b/libgimp/gimpmatrix.h @@ -0,0 +1,38 @@ +/* gimpmatrix.h + * Copyright (C) 1998 Jay Cox + * + * 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__ */ diff --git a/libgimp/gimpparasite.c b/libgimp/gimpparasite.c new file mode 100644 index 0000000000..e9f7a44a86 --- /dev/null +++ b/libgimp/gimpparasite.c @@ -0,0 +1,145 @@ +/* parasite.c + * Copyright (C) 1998 Jay Cox + * + * 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 +#include + +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); + } +} diff --git a/libgimp/gimpparasite.h b/libgimp/gimpparasite.h new file mode 100644 index 0000000000..89ef0fbb3f --- /dev/null +++ b/libgimp/gimpparasite.h @@ -0,0 +1,49 @@ +/* parasite.h + * Copyright (C) 1998 Jay Cox + * + * 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 +#include + +#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_ diff --git a/app/parasiteF.h b/libgimp/gimpparasiteF.h similarity index 100% rename from app/parasiteF.h rename to libgimp/gimpparasiteF.h diff --git a/libgimp/gimpparasiteP.h b/libgimp/gimpparasiteP.h new file mode 100644 index 0000000000..5045050907 --- /dev/null +++ b/libgimp/gimpparasiteP.h @@ -0,0 +1,34 @@ +/* parasiteP.h + * Copyright (C) 1998 Jay Cox + * + * 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 + +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_ diff --git a/libgimp/gimpparasite_pdb.c b/libgimp/gimpparasite_pdb.c deleted file mode 100644 index c6441fed00..0000000000 --- a/libgimp/gimpparasite_pdb.c +++ /dev/null @@ -1,110 +0,0 @@ -/* gimpparasite.c - * Copyright (C) 1998 Jay Cox - * - * 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 -#include -#include - -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; -} diff --git a/libgimp/gimpprotocol.c b/libgimp/gimpprotocol.c index 45de71db45..b47a186f9d 100644 --- a/libgimp/gimpprotocol.c +++ b/libgimp/gimpprotocol.c @@ -19,7 +19,8 @@ #include "gimpenums.h" #include "gimpprotocol.h" #include "gimpwire.h" -#include "gimpparasite.h" +#include "parasite.h" +#include "parasiteP.h" #include @@ -911,10 +912,7 @@ _gp_params_read (int fd, GPParam **params, guint *nparams) break; case PARAM_PARASITE: { - if (!wire_read_int8 (fd, &((*params)[i].data.d_parasite.creator[0]), - 4)) - return; - if (!wire_read_int8 (fd, &((*params)[i].data.d_parasite.type[0]), 4)) + if (!wire_read_string (fd, &(*params)[i].data.d_parasite.name, 1)) return; if (!wire_read_int32 (fd, &((*params)[i].data.d_parasite.flags), 1)) return; @@ -1048,10 +1046,8 @@ _gp_params_write (int fd, GPParam *params, int nparams) break; case PARAM_PARASITE: { - GParasite *p = (GParasite *)¶ms[i].data.d_parasite; - if (!wire_write_int8 (fd, &p->creator[0], 4)) - return; - if (!wire_write_int8 (fd, &p->type[0], 4)) + Parasite *p = (Parasite *)¶ms[i].data.d_parasite; + if (!wire_write_string (fd, &p->name, 1)) return; if (!wire_write_int32 (fd, &p->flags, 1)) return; diff --git a/libgimp/gimpprotocol.h b/libgimp/gimpprotocol.h index f1b06a48e9..0b18053f5c 100644 --- a/libgimp/gimpprotocol.h +++ b/libgimp/gimpprotocol.h @@ -123,8 +123,7 @@ struct _GPParam gint32 d_path; struct { - guchar creator[4]; - guchar type[4]; + char *name; guint32 flags; guint32 size; void *data; diff --git a/app/parasite.c b/libgimp/parasite.c similarity index 69% rename from app/parasite.c rename to libgimp/parasite.c index 2231de3db6..e9f7a44a86 100644 --- a/app/parasite.c +++ b/libgimp/parasite.c @@ -23,19 +23,15 @@ #include Parasite * -parasite_new (const char *creator, const char *type, guint32 flags, +parasite_new (const char *name, guint32 flags, guint32 size, const void *data) { Parasite *p; p = (Parasite *)g_malloc(sizeof(Parasite)); - if (creator) - memcpy(p->creator, creator, 4); + if (name) + p->name = g_strdup(name); else - memset(p->creator, 0, 4); - if (type) - memcpy(p->type, type, 4); - else - memset(p->type, 0, 4); + p->name = NULL; p->flags = flags; p->size = size; if (size) @@ -49,25 +45,19 @@ 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_has_type (const Parasite *parasite, const char *creator, const char *type) +parasite_is_type (const Parasite *parasite, const char *name) { 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; + return (strcmp(parasite->name, name) == 0); } Parasite * @@ -75,8 +65,8 @@ parasite_copy (const Parasite *parasite) { if (parasite == NULL) return NULL; - return parasite_new (¶site->creator[0], ¶site->type[0], - parasite->flags, parasite->size, parasite->data); + return parasite_new (parasite->name, parasite->flags, + parasite->size, parasite->data); } Parasite * @@ -84,7 +74,7 @@ parasite_error() { static Parasite *error_p = NULL; if (!error_p) - error_p = parasite_new("eror", "eror", 0, 0, NULL); + error_p = parasite_new("error", 0, 0, NULL); return error_p; } @@ -93,7 +83,7 @@ parasite_is_error(const Parasite *p) { if (p == NULL) return TRUE; - return parasite_has_type(p, "eror", "eror"); + return parasite_is_type(p, "error"); } int @@ -107,11 +97,11 @@ parasite_is_persistant(const Parasite *p) /* parasite list functions */ Parasite * -parasite_find_in_gslist (const GSList *list, const char *creator, const char *type) +parasite_find_in_gslist (const GSList *list, const char *name) { while (list) { - if (parasite_has_type((Parasite *)(list->data), creator, type)) + if (parasite_is_type((Parasite *)(list->data), name)) return (Parasite *)(list->data); list = list->next; } @@ -124,7 +114,7 @@ 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->creator, parasite->type))) + if ((p = parasite_find_in_gslist(list, parasite->name))) { list = g_slist_remove(list, p); parasite_free(p); diff --git a/app/parasite.h b/libgimp/parasite.h similarity index 85% rename from app/parasite.h rename to libgimp/parasite.h index cc3b0418d4..89ef0fbb3f 100644 --- a/app/parasite.h +++ b/libgimp/parasite.h @@ -21,16 +21,15 @@ #define _PARASITE_H_ #include -#include +#include #define PARASITE_PERSISTANT 1 -Parasite *parasite_new (const char *creator, const char *type, guint32 flags, +Parasite *parasite_new (const char *name, guint32 flags, guint32 size, const void *data); void parasite_free (Parasite *parasite); -int parasite_has_type (const Parasite *parasite, const char *creator, - const char *type); +int parasite_is_type (const Parasite *parasite, const char *name); Parasite *parasite_copy (const Parasite *parasite); Parasite *parasite_error (); @@ -42,8 +41,7 @@ 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 *creator, - const char *type); +Parasite *parasite_find_in_gslist (const GSList *list, const char *name); GSList *parasite_gslist_copy (const GSList *list); void parasite_gslist_destroy (GSList *list); diff --git a/libgimp/parasiteF.h b/libgimp/parasiteF.h new file mode 100644 index 0000000000..5bf5775764 --- /dev/null +++ b/libgimp/parasiteF.h @@ -0,0 +1,25 @@ +/* parasiteF.h + * Copyright (C) 1998 Jay Cox + * + * 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 _PARASITEF_H_ +#define _PARASITEF_H_ + +typedef struct _Parasite Parasite; + +#endif _PARASITEF_H_ diff --git a/app/parasiteP.h b/libgimp/parasiteP.h similarity index 79% rename from app/parasiteP.h rename to libgimp/parasiteP.h index 8a20ab4a45..5045050907 100644 --- a/app/parasiteP.h +++ b/libgimp/parasiteP.h @@ -24,12 +24,11 @@ struct _Parasite { - guchar creator[4]; /* the creator code of the plug-in/author */ - guchar type[4]; /* the data type of the parasite */ - 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 */ + 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_ diff --git a/libgimpbase/gimpparasite.c b/libgimpbase/gimpparasite.c new file mode 100644 index 0000000000..e9f7a44a86 --- /dev/null +++ b/libgimpbase/gimpparasite.c @@ -0,0 +1,145 @@ +/* parasite.c + * Copyright (C) 1998 Jay Cox + * + * 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 +#include + +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); + } +} diff --git a/libgimpbase/gimpparasite.h b/libgimpbase/gimpparasite.h new file mode 100644 index 0000000000..89ef0fbb3f --- /dev/null +++ b/libgimpbase/gimpparasite.h @@ -0,0 +1,49 @@ +/* parasite.h + * Copyright (C) 1998 Jay Cox + * + * 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 +#include + +#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_ diff --git a/libgimpbase/gimpprotocol.c b/libgimpbase/gimpprotocol.c index 45de71db45..b47a186f9d 100644 --- a/libgimpbase/gimpprotocol.c +++ b/libgimpbase/gimpprotocol.c @@ -19,7 +19,8 @@ #include "gimpenums.h" #include "gimpprotocol.h" #include "gimpwire.h" -#include "gimpparasite.h" +#include "parasite.h" +#include "parasiteP.h" #include @@ -911,10 +912,7 @@ _gp_params_read (int fd, GPParam **params, guint *nparams) break; case PARAM_PARASITE: { - if (!wire_read_int8 (fd, &((*params)[i].data.d_parasite.creator[0]), - 4)) - return; - if (!wire_read_int8 (fd, &((*params)[i].data.d_parasite.type[0]), 4)) + if (!wire_read_string (fd, &(*params)[i].data.d_parasite.name, 1)) return; if (!wire_read_int32 (fd, &((*params)[i].data.d_parasite.flags), 1)) return; @@ -1048,10 +1046,8 @@ _gp_params_write (int fd, GPParam *params, int nparams) break; case PARAM_PARASITE: { - GParasite *p = (GParasite *)¶ms[i].data.d_parasite; - if (!wire_write_int8 (fd, &p->creator[0], 4)) - return; - if (!wire_write_int8 (fd, &p->type[0], 4)) + Parasite *p = (Parasite *)¶ms[i].data.d_parasite; + if (!wire_write_string (fd, &p->name, 1)) return; if (!wire_write_int32 (fd, &p->flags, 1)) return; diff --git a/libgimpbase/gimpprotocol.h b/libgimpbase/gimpprotocol.h index f1b06a48e9..0b18053f5c 100644 --- a/libgimpbase/gimpprotocol.h +++ b/libgimpbase/gimpprotocol.h @@ -123,8 +123,7 @@ struct _GPParam gint32 d_path; struct { - guchar creator[4]; - guchar type[4]; + char *name; guint32 flags; guint32 size; void *data; diff --git a/plug-ins/common/gif.c b/plug-ins/common/gif.c index 316f79674f..f48deb69b3 100644 --- a/plug-ins/common/gif.c +++ b/plug-ins/common/gif.c @@ -263,7 +263,7 @@ /* Does the version of GIMP we're compiling for support data attachments to images? ('Parasites') */ -#ifdef _GIMPPARASITE_H_ +#ifdef _PARASITE_H_ #define FACEHUGGERS aieee #endif /* PS: I know that technically facehuggers aren't parasites, @@ -342,7 +342,7 @@ static guchar highest_used_index; static gboolean promote_to_rgb = FALSE; static guchar gimp_cmap[768]; #ifdef FACEHUGGERS -GParasite* comment_parasite = NULL; +Parasite* comment_parasite = NULL; #endif /* For compression code */ @@ -796,7 +796,7 @@ load_image (char *filename) if (comment_parasite != NULL) { gimp_image_attach_parasite (image_ID, comment_parasite); - gparasite_free (comment_parasite); + parasite_free (comment_parasite); comment_parasite = NULL; } #endif @@ -885,10 +885,10 @@ DoExtension (FILE *fd, #ifdef FACEHUGGERS if (comment_parasite != NULL) { - gparasite_free (comment_parasite); + parasite_free (comment_parasite); } - comment_parasite = gparasite_new ("GIF2","CMNT",TRUE, + comment_parasite = parasite_new ("gimp-comment",TRUE, strlen(buf)+1, (void*)buf); #else if (showComment) @@ -2059,7 +2059,7 @@ save_dialog ( gint32 image_ID ) GtkWidget *menu; GtkWidget *disposal_option_menu; #ifdef FACEHUGGERS - GParasite* GIF2_CMNT; + Parasite* GIF2_CMNT; #endif @@ -2141,8 +2141,8 @@ save_dialog ( gint32 image_ID ) g_free(globalcomment); } #ifdef FACEHUGGERS - GIF2_CMNT = gimp_image_find_parasite (image_ID, "GIF2", "CMNT"); - if (!gparasite_is_error(GIF2_CMNT)) + GIF2_CMNT = gimp_image_find_parasite (image_ID, "gimp-comment"); + if (!parasite_is_error(GIF2_CMNT)) { globalcomment = g_malloc(GIF2_CMNT->size); strcpy(globalcomment, GIF2_CMNT->data); @@ -2154,7 +2154,7 @@ save_dialog ( gint32 image_ID ) strcpy(globalcomment, DEFAULT_COMMENT); #ifdef FACEHUGGERS } - gparasite_free (GIF2_CMNT); + parasite_free (GIF2_CMNT); #endif gtk_entry_set_text (GTK_ENTRY (entry), globalcomment); diff --git a/plug-ins/common/tiff.c b/plug-ins/common/tiff.c index e9d0b54fde..579e0ea90f 100644 --- a/plug-ins/common/tiff.c +++ b/plug-ins/common/tiff.c @@ -199,13 +199,13 @@ run (char *name, /* get the image comment either from a parasite, or from our * compiled-in default */ { - GParasite *parasite; + Parasite *parasite; image_comment = NULL; - parasite = gimp_image_find_parasite(image, "GIF2", "CMNT"); - if (!gparasite_is_error(parasite)) + parasite = gimp_image_find_parasite(image, "gimp-comment"); + if (!parasite_is_error(parasite)) image_comment = g_strdup(parasite->data); - gparasite_free(parasite); + parasite_free(parasite); if (!image_comment) image_comment = g_strdup(DEFAULT_COMMENT); } @@ -214,16 +214,16 @@ run (char *name, { case RUN_INTERACTIVE: { - GParasite *parasite; + Parasite *parasite; /* Possibly retrieve data */ gimp_get_data ("file_tiff_save", &tsvals); - parasite = gimp_image_find_parasite(image, "tiff", "sopt"); - if (!gparasite_is_error(parasite)) + parasite = gimp_image_find_parasite(image, "tiff-save-options"); + if (!parasite_is_error(parasite)) { tsvals.compression = ((TiffSaveVals *)parasite->data)->compression; tsvals.fillorder = ((TiffSaveVals *)parasite->data)->fillorder; } - gparasite_free(parasite); + parasite_free(parasite); /* First acquire information with a dialog */ if (! save_dialog ()) @@ -254,15 +254,15 @@ run (char *name, case RUN_WITH_LAST_VALS: /* Possibly retrieve data */ { - GParasite *parasite; + Parasite *parasite; gimp_get_data ("file_tiff_save", &tsvals); - parasite = gimp_image_find_parasite(image, "tiff", "sopt"); - if (!gparasite_is_error(parasite)) + parasite = gimp_image_find_parasite(image, "tiff-save-options"); + if (!parasite_is_error(parasite)) { tsvals.compression = ((TiffSaveVals *)parasite->data)->compression; tsvals.fillorder = ((TiffSaveVals *)parasite->data)->fillorder; } - gparasite_free(parasite); + parasite_free(parasite); } break; @@ -316,7 +316,7 @@ static gint32 load_image (char *filename) { channel_data *channel= NULL; TiffSaveVals save_vals; - GParasite *parasite; + Parasite *parasite; guint16 tmp; tif = TIFFOpen (filename, "r"); if (!tif) { @@ -419,13 +419,14 @@ static gint32 load_image (char *filename) { save_vals.fillorder = FILLORDER_LSB2MSB; else save_vals.fillorder = tmp; - parasite = gparasite_new("tiff", "sopt", 0, sizeof(save_vals), &save_vals); + parasite = parasite_new("tiff-save-options", 0, + sizeof(save_vals), &save_vals); gimp_image_attach_parasite(image, parasite); - gparasite_free(parasite); + parasite_free(parasite); /* Attach a parasite containing the image description. Pretend to - * be a GIF2 comment so other plugins will use this description as + * be a gimp comment so other plugins will use this description as * an image comment where appropriate. */ { char *img_desc; @@ -438,9 +439,9 @@ static gint32 load_image (char *filename) { len = MIN(len, 241); img_desc[len-1] = '\000'; - parasite = gparasite_new("GIF2", "CMNT", 1, len, img_desc); + parasite = parasite_new("gimp-comment", 1, len, img_desc); gimp_image_attach_parasite(image, parasite); - gparasite_free(parasite); + parasite_free(parasite); } } @@ -866,13 +867,13 @@ static gint save_image (char *filename, gint32 image, gint32 layer) { * detaches a previous incarnation of the parasite. */ if (image_comment && *image_comment != '\000') { - GParasite *parasite; + Parasite *parasite; TIFFSetField (tif, TIFFTAG_IMAGEDESCRIPTION, image_comment); - parasite = gparasite_new ("GIF2", "CMNT", 1, + parasite = parasite_new ("gimp-comment", 1, strlen(image_comment)+1, image_comment); gimp_image_attach_parasite (image, parasite); - gparasite_free (parasite); + parasite_free (parasite); } if (drawable_type == INDEXED_IMAGE) diff --git a/plug-ins/gif/gif.c b/plug-ins/gif/gif.c index 316f79674f..f48deb69b3 100644 --- a/plug-ins/gif/gif.c +++ b/plug-ins/gif/gif.c @@ -263,7 +263,7 @@ /* Does the version of GIMP we're compiling for support data attachments to images? ('Parasites') */ -#ifdef _GIMPPARASITE_H_ +#ifdef _PARASITE_H_ #define FACEHUGGERS aieee #endif /* PS: I know that technically facehuggers aren't parasites, @@ -342,7 +342,7 @@ static guchar highest_used_index; static gboolean promote_to_rgb = FALSE; static guchar gimp_cmap[768]; #ifdef FACEHUGGERS -GParasite* comment_parasite = NULL; +Parasite* comment_parasite = NULL; #endif /* For compression code */ @@ -796,7 +796,7 @@ load_image (char *filename) if (comment_parasite != NULL) { gimp_image_attach_parasite (image_ID, comment_parasite); - gparasite_free (comment_parasite); + parasite_free (comment_parasite); comment_parasite = NULL; } #endif @@ -885,10 +885,10 @@ DoExtension (FILE *fd, #ifdef FACEHUGGERS if (comment_parasite != NULL) { - gparasite_free (comment_parasite); + parasite_free (comment_parasite); } - comment_parasite = gparasite_new ("GIF2","CMNT",TRUE, + comment_parasite = parasite_new ("gimp-comment",TRUE, strlen(buf)+1, (void*)buf); #else if (showComment) @@ -2059,7 +2059,7 @@ save_dialog ( gint32 image_ID ) GtkWidget *menu; GtkWidget *disposal_option_menu; #ifdef FACEHUGGERS - GParasite* GIF2_CMNT; + Parasite* GIF2_CMNT; #endif @@ -2141,8 +2141,8 @@ save_dialog ( gint32 image_ID ) g_free(globalcomment); } #ifdef FACEHUGGERS - GIF2_CMNT = gimp_image_find_parasite (image_ID, "GIF2", "CMNT"); - if (!gparasite_is_error(GIF2_CMNT)) + GIF2_CMNT = gimp_image_find_parasite (image_ID, "gimp-comment"); + if (!parasite_is_error(GIF2_CMNT)) { globalcomment = g_malloc(GIF2_CMNT->size); strcpy(globalcomment, GIF2_CMNT->data); @@ -2154,7 +2154,7 @@ save_dialog ( gint32 image_ID ) strcpy(globalcomment, DEFAULT_COMMENT); #ifdef FACEHUGGERS } - gparasite_free (GIF2_CMNT); + parasite_free (GIF2_CMNT); #endif gtk_entry_set_text (GTK_ENTRY (entry), globalcomment); diff --git a/plug-ins/script-fu/script-fu.c b/plug-ins/script-fu/script-fu.c index a865aff936..03a5f36b90 100644 --- a/plug-ins/script-fu/script-fu.c +++ b/plug-ins/script-fu/script-fu.c @@ -517,7 +517,7 @@ static LISP marshall_proc_db_call (LISP a) { GParam *args; - GParam *values; + GParam *values = NULL; int nvalues; char *proc_name; char *proc_blurb; @@ -775,15 +775,10 @@ marshall_proc_db_call (LISP a) { args[i].type = PARAM_PARASITE; - /* parasite->creator */ + /* parasite->name */ intermediate_val = car (a); - memcpy(args[i].data.d_parasite.creator, - get_c_string (car (intermediate_val)), 4); - - /* parasite->type */ - intermediate_val = cdr (intermediate_val); - memcpy(args[i].data.d_parasite.type, - get_c_string (car (intermediate_val)), 4); + args[i].data.d_parasite.name = + get_c_string (car (intermediate_val)); /* parasite->flags */ intermediate_val = cdr (intermediate_val); @@ -852,7 +847,7 @@ marshall_proc_db_call (LISP a) return_val = cons (flocons (values[i + 1].data.d_float), return_val); break; case PARAM_STRING: - string = g_strdup ((gchar *) values[i + 1].data.d_string); + string = (gchar *) values[i + 1].data.d_string; string_len = strlen (string); return_val = cons (strcons (string_len, string), return_val); break; @@ -908,7 +903,7 @@ marshall_proc_db_call (LISP a) for (j = 0; j < num_strings; j++) { string_len = strlen (array[j]); - string_array = cons (strcons (string_len, g_strdup (array[j])), string_array); + string_array = cons (strcons (string_len, array[j]), string_array); } return_val = cons (nreverse (string_array), return_val); @@ -950,17 +945,20 @@ marshall_proc_db_call (LISP a) break; case PARAM_PARASITE: { - LISP creator, type, flags, data; - creator = strcons (4, values[i + 1].data.d_parasite.creator); - type = strcons (4, values[i + 1].data.d_parasite.type); + LISP name, flags, data; + + string_len = strlen (values[i + 1].data.d_parasite.name); + name = strcons (string_len, + values[i + 1].data.d_parasite.name); + flags = flocons (values[i + 1].data.d_parasite.flags); - data = arcons (tc_byte_array, values[i+1].data.d_parasite.size, 0); + data = arcons (tc_byte_array, + values[i+1].data.d_parasite.size, 0); memcpy(data->storage_as.string.data, values[i+1].data.d_parasite.data, values[i+1].data.d_parasite.size); - intermediate_val = cons (creator, cons(type, cons(flags, - cons(data, NIL)))); + intermediate_val = cons (name, cons(flags, cons(data, NIL))); return_val = cons (intermediate_val, return_val); } break; diff --git a/plug-ins/tiff/tiff.c b/plug-ins/tiff/tiff.c index e9d0b54fde..579e0ea90f 100644 --- a/plug-ins/tiff/tiff.c +++ b/plug-ins/tiff/tiff.c @@ -199,13 +199,13 @@ run (char *name, /* get the image comment either from a parasite, or from our * compiled-in default */ { - GParasite *parasite; + Parasite *parasite; image_comment = NULL; - parasite = gimp_image_find_parasite(image, "GIF2", "CMNT"); - if (!gparasite_is_error(parasite)) + parasite = gimp_image_find_parasite(image, "gimp-comment"); + if (!parasite_is_error(parasite)) image_comment = g_strdup(parasite->data); - gparasite_free(parasite); + parasite_free(parasite); if (!image_comment) image_comment = g_strdup(DEFAULT_COMMENT); } @@ -214,16 +214,16 @@ run (char *name, { case RUN_INTERACTIVE: { - GParasite *parasite; + Parasite *parasite; /* Possibly retrieve data */ gimp_get_data ("file_tiff_save", &tsvals); - parasite = gimp_image_find_parasite(image, "tiff", "sopt"); - if (!gparasite_is_error(parasite)) + parasite = gimp_image_find_parasite(image, "tiff-save-options"); + if (!parasite_is_error(parasite)) { tsvals.compression = ((TiffSaveVals *)parasite->data)->compression; tsvals.fillorder = ((TiffSaveVals *)parasite->data)->fillorder; } - gparasite_free(parasite); + parasite_free(parasite); /* First acquire information with a dialog */ if (! save_dialog ()) @@ -254,15 +254,15 @@ run (char *name, case RUN_WITH_LAST_VALS: /* Possibly retrieve data */ { - GParasite *parasite; + Parasite *parasite; gimp_get_data ("file_tiff_save", &tsvals); - parasite = gimp_image_find_parasite(image, "tiff", "sopt"); - if (!gparasite_is_error(parasite)) + parasite = gimp_image_find_parasite(image, "tiff-save-options"); + if (!parasite_is_error(parasite)) { tsvals.compression = ((TiffSaveVals *)parasite->data)->compression; tsvals.fillorder = ((TiffSaveVals *)parasite->data)->fillorder; } - gparasite_free(parasite); + parasite_free(parasite); } break; @@ -316,7 +316,7 @@ static gint32 load_image (char *filename) { channel_data *channel= NULL; TiffSaveVals save_vals; - GParasite *parasite; + Parasite *parasite; guint16 tmp; tif = TIFFOpen (filename, "r"); if (!tif) { @@ -419,13 +419,14 @@ static gint32 load_image (char *filename) { save_vals.fillorder = FILLORDER_LSB2MSB; else save_vals.fillorder = tmp; - parasite = gparasite_new("tiff", "sopt", 0, sizeof(save_vals), &save_vals); + parasite = parasite_new("tiff-save-options", 0, + sizeof(save_vals), &save_vals); gimp_image_attach_parasite(image, parasite); - gparasite_free(parasite); + parasite_free(parasite); /* Attach a parasite containing the image description. Pretend to - * be a GIF2 comment so other plugins will use this description as + * be a gimp comment so other plugins will use this description as * an image comment where appropriate. */ { char *img_desc; @@ -438,9 +439,9 @@ static gint32 load_image (char *filename) { len = MIN(len, 241); img_desc[len-1] = '\000'; - parasite = gparasite_new("GIF2", "CMNT", 1, len, img_desc); + parasite = parasite_new("gimp-comment", 1, len, img_desc); gimp_image_attach_parasite(image, parasite); - gparasite_free(parasite); + parasite_free(parasite); } } @@ -866,13 +867,13 @@ static gint save_image (char *filename, gint32 image, gint32 layer) { * detaches a previous incarnation of the parasite. */ if (image_comment && *image_comment != '\000') { - GParasite *parasite; + Parasite *parasite; TIFFSetField (tif, TIFFTAG_IMAGEDESCRIPTION, image_comment); - parasite = gparasite_new ("GIF2", "CMNT", 1, + parasite = parasite_new ("gimp-comment", 1, strlen(image_comment)+1, image_comment); gimp_image_attach_parasite (image, parasite); - gparasite_free (parasite); + parasite_free (parasite); } if (drawable_type == INDEXED_IMAGE)