"How to make a gimp plugin a "animated" one" contained in the GAP source code in docs
For commodity i upload that guide here http://www.gimptalk.com/forum/viewtopic.php?f=9&t=31050&p=229417#p229417
as i wrote on that linked page guide seems not fully correct and updated as example
>2 # change to the directory, where you like to generate the >sourcecode
>cd /usr/local/gimp-0.99.17/plug-ins/whirlpinch
that path seems wrong i have nothing similar to that path and that reference to a gimp-0.99.17 seems quite outdated
may be this the right path " /usr/lib/gimp/2.0/plug-ins"?
(Note:seems that my distro, ubuntu install extra plugin
with the other and not in the user plugin directory)
Then that reference to gimp -0.99 seems suspiciously outdated
more plugin are not directory so i could not do this
cd /usr/local/gimp-0.99.17/plug-ins/whirlpinch
Anyway after some fiddling (for all detail please have a look to the link) i get some results.
Problem is that i get much more results of what i expected, instead then 4 files about 600 , 4 for each plugin was in the plugin folder.
Also that i wanted lqr-plugin_iter.c, more a _iter.c for resyntetyzer,refocus, greycstoration and so on
Well seems to nice to be true, more i never see a _iter.c file before and i will like to know if what i get is correct
this below is the _iter.c for Liquid Resize, do you think is correct and that i can go on to the next step?
below the line (or in last message here http://www.gimptalk.com/forum/viewtopic.php?f=9&t=31050&p=229417#p229417 )
#################################################
/* lqr_plugin_iter.c
* generated by gap_filter_codegen.c
* generation date: 19.05.108 01:36
*
* generation source Gimp PDB entry name: lqr_plugin
* version : 2007
*
* The generated code will not work if the internal data stucture
* (used to store and retrieve "LastValues") is different to the
* PDB Calling Interface.
*
* In that case you will get an Error message like that:
* ERROR: xxxx_Iterator stored Data missmatch in size N != M
* if the Iterator is called.
* (via "Filter all Layers" using "Apply Varying" Button)
*
* When you get this Error, you should change this generated code.
*
*/
/* SYTEM (UNIX) includes */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* GIMP includes */
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
typedef struct { guchar color[3]; } t_color;
typedef struct { gint color[3]; } t_gint_color;
static void query(void);
static void run(const gchar *name, gint nparam, const GimpParam *param, gint *nretvals, GimpParam **retvals);
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
};
/* ----------------------------------------------------------------------
* iterator functions for basic datatypes
* ----------------------------------------------------------------------
*/
static void p_delta_long(long *val, long val_from, long val_to, gint32 total_steps, gdouble current_step)
{
double delta;
if(total_steps < 1) return;
delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step);
*val = val_from + delta;
}
static void p_delta_short(short *val, short val_from, short val_to, gint32 total_steps, gdouble current_step)
{
double delta;
if(total_steps < 1) return;
delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step);
*val = val_from + delta;
}
static void p_delta_gint(gint *val, gint val_from, gint val_to, gint32 total_steps, gdouble current_step)
{
double delta;
if(total_steps < 1) return;
delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step);
*val = val_from + delta;
}
static void p_delta_char(char *val, char val_from, char val_to, gint32 total_steps, gdouble current_step)
{
double delta;
if(total_steps < 1) return;
delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step);
*val = val_from + delta;
}
static void p_delta_gdouble(double *val, double val_from, double val_to, gint32 total_steps, gdouble current_step)
{
double delta;
if(total_steps < 1) return;
delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step);
*val = val_from + delta;
}
static void p_delta_float(float *val, float val_from, float val_to, gint32 total_steps, gdouble current_step)
{
double delta;
if(total_steps < 1) return;
delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step);
*val = val_from + delta;
}
static void p_delta_color(t_color *val, t_color *val_from, t_color *val_to, gint32 total_steps, gdouble current_step)
{
double delta;
int l_idx;
if(total_steps < 1) return;
for(l_idx = 0; l_idx < 3; l_idx++)
{
delta = ((double)(val_to->color[l_idx] - val_from->color[l_idx]) / (double)total_steps) * ((double)total_steps - current_step);
val->color[l_idx] = val_from->color[l_idx] + delta;
}
}
static void p_delta_gint_color(t_gint_color *val, t_gint_color *val_from, t_gint_color *val_to, gint32 total_steps, gdouble current_step)
{
double delta;
int l_idx;
if(total_steps < 1) return;
for(l_idx = 0; l_idx < 3; l_idx++)
{
delta = ((double)(val_to->color[l_idx] - val_from->color[l_idx]) / (double)total_steps) * ((double)total_steps - current_step);
val->color[l_idx] = val_from->color[l_idx] + delta;
}
}
static void p_delta_drawable(gint32 *val, gint32 val_from, gint32 val_to, gint32 total_steps, gdouble current_step)
{
gint l_nlayers;
gint32 *l_layers_list;
gint32 l_tmp_image_id;
gint l_idx, l_idx_from, l_idx_to;
l_tmp_image_id = gimp_drawable_get_image(val_from);
/* check if from and to values are both valid drawables within the same image */
if ((l_tmp_image_id > 0)
&& (l_tmp_image_id = gimp_drawable_get_image(val_to)))
{
l_idx_from = -1;
l_idx_to = -1;
/* check the layerstack index of from and to drawable */
l_layers_list = gimp_image_get_layers(l_tmp_image_id, &l_nlayers);
for (l_idx = l_nlayers -1; l_idx >= 0; l_idx--)
{
if( l_layers_list[l_idx] == val_from ) l_idx_from = l_idx;
if( l_layers_list[l_idx] == val_to ) l_idx_to = l_idx;
if((l_idx_from != -1) && (l_idx_to != -1))
{
/* OK found both index values, iterate the index (proceed to next layer) */
p_delta_gint(&l_idx, l_idx_from, l_idx_to, total_steps, current_step);
*val = l_layers_list[l_idx];
break;
}
}
g_free (l_layers_list);
}
}
/* ----------------------------------------------------------------------
* p_lqr_plugin_iter
* ----------------------------------------------------------------------
*/
gint p_lqr_plugin_iter(GimpRunMode run_mode, gint32 total_steps, gdouble current_step, gint32 len_struct)
{
typedef struct t_lqr_plugin_Vals
{
long width;
long height;
long pres_layer;
long pres_coeff;
long disc_layer;
long disc_coeff;
long rigidity;
long resize_aux_layers;
long resize_canvas;
long new_layer;
long seams;
long mask_behavior;
long grad_func;
} t_lqr_plugin_Vals;
t_lqr_plugin_Vals buf, buf_from, buf_to;
if(len_struct != sizeof(t_lqr_plugin_Vals))
{
fprintf(stderr, "ERROR: p_lqr_plugin_iter stored Data missmatch in size %d != %d\n",
(int)len_struct, sizeof(t_lqr_plugin_Vals) );
return -1; /* ERROR */
}
gimp_get_data("lqr_plugin-ITER-FROM", &buf_from);
gimp_get_data("lqr_plugin-ITER-TO", &buf_to);
memcpy(&buf, &buf_from, sizeof(buf));
p_delta_long(&buf.width, buf_from.width, buf_to.width, total_steps, current_step);
p_delta_long(&buf.height, buf_from.height, buf_to.height, total_steps, current_step);
p_delta_long(&buf.pres_layer, buf_from.pres_layer, buf_to.pres_layer, total_steps, current_step);
p_delta_long(&buf.pres_coeff, buf_from.pres_coeff, buf_to.pres_coeff, total_steps, current_step);
p_delta_long(&buf.disc_layer, buf_from.disc_layer, buf_to.disc_layer, total_steps, current_step);
p_delta_long(&buf.disc_coeff, buf_from.disc_coeff, buf_to.disc_coeff, total_steps, current_step);
p_delta_long(&buf.rigidity, buf_from.rigidity, buf_to.rigidity, total_steps, current_step);
p_delta_long(&buf.resize_aux_layers, buf_from.resize_aux_layers, buf_to.resize_aux_layers, total_steps, current_step);
p_delta_long(&buf.resize_canvas, buf_from.resize_canvas, buf_to.resize_canvas, total_steps, current_step);
p_delta_long(&buf.new_layer, buf_from.new_layer, buf_to.new_layer, total_steps, current_step);
p_delta_long(&buf.seams, buf_from.seams, buf_to.seams, total_steps, current_step);
p_delta_long(&buf.mask_behavior, buf_from.mask_behavior, buf_to.mask_behavior, total_steps, current_step);
p_delta_long(&buf.grad_func, buf_from.grad_func, buf_to.grad_func, total_steps, current_step);
gimp_set_data("lqr_plugin", &buf, sizeof(buf));
return 0; /* OK */
}
MAIN ()
/* ----------------------------------------------------------------------
* install (query) -Iterator
* ----------------------------------------------------------------------
*/
static void query ()
{
char l_blurb_text[300];
static GimpParamDef args_iter[] =
{
{GIMP_PDB_INT32, "run_mode", "non-interactive"},
{GIMP_PDB_INT32, "total_steps", "total number of steps (# of layers-1 to apply the related plug-in)"},
{GIMP_PDB_FLOAT, "current_step", "current (for linear iterations this is the layerstack position, otherwise some value inbetween)"},
{GIMP_PDB_INT32, "len_struct", "length of stored data structure with id is equal to the plug_in proc_name"},
};
static int nargs_iter = G_N_ELEMENTS (args_iter);
static GimpParamDef *return_vals = NULL;
static int nreturn_vals = 0;
g_snprintf(l_blurb_text, sizeof(l_blurb_text), "This procedure calculates the modified values for one iterationstep for the call of lqr_plugin");
gimp_install_procedure("lqr_plugin-Iterator",
l_blurb_text,
"",
"Wolfgang Hofer",
"Wolfgang Hofer",
"19.05.108 01:36",
NULL, /* do not appear in menus */
NULL,
GIMP_PLUGIN,
nargs_iter, nreturn_vals,
args_iter, return_vals);
}
/* ----------------------------------------------------------------------
* run Iterator
* ----------------------------------------------------------------------
*/
static void
run (const gchar *name,
gint n_params,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[1];
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 image_id;
gint32 len_struct;
gint32 total_steps;
gdouble current_step;
gint32 l_rc;
*nreturn_vals = 1;
*return_vals = values;
l_rc = 0;
run_mode = param[0].data.d_int32;
if ((run_mode == GIMP_RUN_NONINTERACTIVE) && (n_params == 4))
{
total_steps = param[1].data.d_int32;
current_step = param[2].data.d_float;
len_struct = param[3].data.d_int32;
l_rc = p_lqr_plugin_iter(run_mode, total_steps, current_step, len_struct);
if(l_rc < 0)
{
status = GIMP_PDB_EXECUTION_ERROR;
}
}
else status = GIMP_PDB_CALLING_ERROR;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
}
#########################################
Is that correct ? some suggestion?
gimp-developer-request@xxxxxxxxxxxxxxxxxxxxxx ha scritto:
Send Gimp-developer mailing list submissions to
gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
or, via email, send a message with subject or body 'help' to
gimp-developer-request@xxxxxxxxxxxxxxxxxxxxxx
You can reach the person managing the list at
gimp-developer-owner@xxxxxxxxxxxxxxxxxxxxxx
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Gimp-developer digest..."
Today's Topics:
1. Option for locking tabs? (ccrisis@xxxxxxxxx)
2. Re: Option for locking tabs? (Martin Nordholts)
3. Re: Option for locking tabs? (Sven Neumann)
4. Re: Option for locking tabs? (Jon Senior)
----------------------------------------------------------------------
Message: 1
Date: Sat, 17 May 2008 19:43:57 -0600
From: ccrisis@xxxxxxxxx
Subject: Option for locking tabs?
To: gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
Message-ID: <482F89DD.5080700@xxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi,
I was directed here for suggesting features. If this is the wrong place,
I apologize.
When selecting tabs with a tablet, sometimes (often) there is accidental
dragging and the tab ends up being pulled into it's own window. It's a
big annoyance in my case, maybe other tablet users as well. I suggest an
option to lock these.
D.R.
------------------------------
Message: 2
Date: Sun, 18 May 2008 14:45:52 +0200
From: Martin Nordholts
Subject: Re: Option for locking tabs?
To: ccrisis@xxxxxxxxx
Cc: gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
Message-ID: <48302500.5050007@xxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1
ccrisis@xxxxxxxxx wrote:
> Hi,
>
> I was directed here for suggesting features. If this is the wrong place,
> I apologize.
> When selecting tabs with a tablet, sometimes (often) there is accidental
> dragging and the tab ends up being pulled into it's own window. It's a
> big annoyance in my case, maybe other tablet users as well. I suggest an
> option to lock these.
>
> D.R.
Hello
It doesn't sound like a bad idea, but at the same time it feels like a
hack and that the core problem is something else. If this was to be
added though, it is necessary to sort out how to access this
functionality in a discoverable way.
Regards,
Martin Nordholts
------------------------------
Message: 3
Date: Sun, 18 May 2008 15:08:44 +0200
From: Sven Neumann
Subject: Re: Option for locking tabs?
To: ccrisis@xxxxxxxxx
Cc: gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
Message-ID: <1211116124.18095.7.camel@bender>
Content-Type: text/plain
Hi,
On Sat, 2008-05-17 at 19:43 -0600, ccrisis@xxxxxxxxx wrote:
> I was directed here for suggesting features. If this is the wrong place,
> I apologize.
> When selecting tabs with a tablet, sometimes (often) there is accidental
> dragging and the tab ends up being pulled into it's own window. It's a
> big annoyance in my case, maybe other tablet users as well. I suggest an
> option to lock these.
Have you tried to increase the gtk-dnd-drag-threshold? It's a GtkSetting
that you can adjust in your ~/.gtkrc-2.0 file.
Sven
------------------------------
Message: 4
Date: Sun, 18 May 2008 20:41:28 +0200
From: Jon Senior
Subject: Re: Option for locking tabs?
To: gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
Message-ID: <20080518204128.b729ef24.jon@xxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset=US-ASCII
On Sun, 18 May 2008 14:45:52 +0200
Martin Nordholtswrote:
> It doesn't sound like a bad idea, but at the same time it feels like a
> hack and that the core problem is something else. If this was to be
> added though, it is necessary to sort out how to access this
> functionality in a discoverable way.
I suffer from the same problem from time to time. I'd love to see an option to "lock" the windows. I have a setup that works for me and that I don't change, and it'd be good to be able to lock that down. Not sure if that would need to be on the GTK side, or the GIMP side though.
--
Jon Senior
------------------------------
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
End of Gimp-developer Digest, Vol 68, Issue 16
**********************************************
Alchemie Foto\grafiche
Scopri il Blog di Yahoo! Mail: trucchi, novità, consigli... e la tua opinione!
_______________________________________________ Gimp-developer mailing list Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer