Some changes to the GAP plug-in on request by the author Wolfgang Hofer.

Made the colorify plug-in work on drawables with alpha channel.


--Sven
This commit is contained in:
Sven Neumann 1999-06-24 20:46:55 +00:00
parent e52d0192fb
commit af75ccbae9
7 changed files with 36 additions and 15 deletions

View File

@ -1,3 +1,9 @@
Thu Jun 24 22:34:54 MEST 1999 Sven Neumann <sven@gimp.org>
* plug-ins/gap: some changes on request by the author Wolfgang Hofer
* plug-ins/common/colorify.c: make it work on drawables with alpha
channel
Wed Jun 23 17:55:58 PDT 1999 Manish Singh <yosh@gimp.org>
* more makefile fixes

View File

@ -37,7 +37,7 @@
#include "config.h"
#include "libgimp/stdplugins-intl.h"
#define PLUG_IN_NAME "Colorify"
#define PLUG_IN_NAME "plug_in_colorify"
#define PLUG_IN_VERSION "1.1"
static void query (void);
@ -123,7 +123,7 @@ query ()
_("Makes an average of the RGB channels and uses it to set the color"),
"Francisco Bustamante", "Francisco Bustamante",
"0.0.1",
_("<Image>/Filters/Colors/Colorify"), "RGB",
_("<Image>/Filters/Colors/Colorify"), "RGB*",
PROC_PLUG_IN,
nargs, nreturn_vals,
args, return_vals);
@ -207,7 +207,8 @@ run (char *name,
}
static void colorify_row (guchar *row,
gint width);
gint width,
gint bpp);
static void close_callback (GtkWidget *widget,
gpointer data);
static void colorify_ok_callback (GtkWidget *widget,
@ -224,6 +225,7 @@ colorify (GDrawable *drawable)
{
GPixelRgn source_region, dest_region;
guchar *row;
gint bpp;
gint y = 0;
gint progress = 0;
gint i = 0;
@ -237,7 +239,8 @@ colorify (GDrawable *drawable)
final_blue_lookup[i] = i * cvals.color[2] / 255;
}
row = g_malloc (sel_width * 3 * sizeof(guchar));
bpp = gimp_drawable_bpp(drawable->id);
row = g_malloc (sel_width * bpp * sizeof(guchar));
gimp_pixel_rgn_init (&source_region, drawable, sel_x1, sel_y1, sel_width, sel_height, FALSE, FALSE);
gimp_pixel_rgn_init (&dest_region, drawable, sel_x1, sel_y1, sel_width, sel_height, TRUE, TRUE);
@ -245,7 +248,7 @@ colorify (GDrawable *drawable)
for (y = sel_y1; y < sel_y2; y++) {
gimp_pixel_rgn_get_row (&source_region, row, sel_x1, y, sel_width);
colorify_row (row, sel_width);
colorify_row (row, sel_width, bpp);
gimp_pixel_rgn_set_row (&dest_region, row, sel_x1, y, sel_width);
gimp_progress_update ((double) ++progress / sel_height);
@ -261,7 +264,8 @@ colorify (GDrawable *drawable)
static void
colorify_row (guchar *row,
gint width)
gint width,
gint bpp)
{
gint cur_x;
gint lum; /* luminosity */
@ -274,7 +278,7 @@ colorify_row (guchar *row,
current[1] = final_green_lookup[lum];
current[2] = final_blue_lookup[lum];
current += 3;
current += bpp;
}
}

View File

@ -76,10 +76,10 @@ EXTRA_DIST = \
iter_ALT/mod/plug_in_sinus_iter_ALT.inc \
iter_ALT/mod/plug_in_solid_noise_iter_ALT.inc \
iter_ALT/mod/plug_in_sparkle_iter_ALT.inc \
iter_ALT/old/Colorify_iter_ALT.inc \
iter_ALT/old/plug_in_CentralReflection_iter_ALT.inc \
iter_ALT/old/plug_in_anamorphose_iter_ALT.inc \
iter_ALT/old/plug_in_blur2_iter_ALT.inc \
iter_ALT/old/plug-in_colorify_iter_ALT.inc \
iter_ALT/old/plug_in_encript_iter_ALT.inc \
iter_ALT/old/plug_in_figures_iter_ALT.inc \
iter_ALT/old/plug_in_gflare_iter_ALT.inc \

View File

@ -64,6 +64,7 @@
*/
/* Change Log:
* 1999.06.21 hof: removed Colorify iterator
* 1999.03.14 hof: added iterators for gimp 1.1.3 prerelease
* iterator code reorganized in _iter_ALT.inc Files
* 1998.06.12 hof: added p_delta_drawable (Iterate layers in the layerstack)
@ -214,6 +215,11 @@ static void p_delta_color(t_color *val, t_color *val_from, t_color *val_to, gint
{
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;
if(gap_debug) fprintf(stderr, "DEBUG: p_delta_color[%d] total: %d from: %d to: %d curr: %d delta: %f current_step: %f\n",
(int)l_idx, (int)total_steps,
(int)val_from->color[l_idx], (int)val_to->color[l_idx], (int)val->color[l_idx],
delta, current_step);
}
}
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)
@ -464,7 +470,7 @@ static void p_delta_LightSettings(t_LightSettings *val, t_LightSettings *val_fro
*/
static t_iter_ALT_tab g_iter_ALT_tab[] =
{
{ "Colorify", p_Colorify_iter_ALT }
/* { "Colorify", p_Colorify_iter_ALT } */
/*, { "perl_fu_blowinout", p_perl_fu_blowinout_iter_ALT } */
/*, { "perl_fu_feedback", p_perl_fu_feedback_iter_ALT } */
/*, { "perl_fu_prep4gif", p_perl_fu_prep4gif_iter_ALT } */
@ -476,7 +482,7 @@ static t_iter_ALT_tab g_iter_ALT_tab[] =
/*, { "perl_fu_xach_blocks", p_perl_fu_xach_blocks_iter_ALT } */
/*, { "perl_fu_xach_shadows", p_perl_fu_xach_shadows_iter_ALT } */
/*, { "perl_fu_xachvision", p_perl_fu_xachvision_iter_ALT } */
, { "plug_in_CML_explorer", p_plug_in_CML_explorer_iter_ALT }
{ "plug_in_CML_explorer", p_plug_in_CML_explorer_iter_ALT }
, { "plug_in_CentralReflection", p_plug_in_CentralReflection_iter_ALT }
, { "plug_in_Twist", p_plug_in_Twist_iter_ALT }
, { "plug_in_alienmap", p_plug_in_alienmap_iter_ALT }
@ -500,7 +506,7 @@ static t_iter_ALT_tab g_iter_ALT_tab[] =
, { "plug_in_checkerboard", p_plug_in_checkerboard_iter_ALT }
/*, { "plug_in_color_adjust", p_plug_in_color_adjust_iter_ALT } */
, { "plug_in_color_map", p_plug_in_color_map_iter_ALT }
/*, { "plug_in_colorify", p_plug_in_colorify_iter_ALT } */
, { "plug_in_colorify", p_plug_in_colorify_iter_ALT }
/*, { "plug_in_compose", p_plug_in_compose_iter_ALT } */
, { "plug_in_convmatrix", p_plug_in_convmatrix_iter_ALT }
, { "plug_in_cubism", p_plug_in_cubism_iter_ALT }

View File

@ -28,6 +28,7 @@
*/
/* revision history:
* gimp 1.1.6; 1999/06/21 hof: bugix: wrong iterator total_steps and direction
* gimp 1.1.15.1; 1999/05/08 hof: bugix (dont mix GDrawableType with GImageType)
* version 0.98.00 1998.11.27 hof: - use new module gap_pdb_calls.h
* version 0.97.00 1998.10.19 hof: - created module
@ -752,6 +753,7 @@ p_do_2nd_filter_dialogs(char *filter_procname,
int l_rc;
int l_idx;
static char l_key_to[512];
static char l_key_from[512];
gint32 l_last_image_id;
t_LayliElem *l_layli_ptr;
gint l_nlayers;
@ -809,6 +811,10 @@ p_do_2nd_filter_dialogs(char *filter_procname,
sprintf(l_key_to, "%s_ITER_TO", filter_procname);
p_set_data(l_key_to, l_plugin_data_len);
/* get FROM values */
sprintf(l_key_from, "%s_ITER_FROM", filter_procname);
l_plugin_data_len = p_get_data(l_key_from);
p_set_data(filter_procname, l_plugin_data_len);
l_rc = p_pitstop_dialog(1, filter_procname);
@ -882,7 +888,6 @@ p_frames_modify(t_anim_info *ainfo_ptr,
l_rc = 0;
l_plugin_iterator = NULL;
l_plugin_data_len = 0;
l_cur_step = 0;
l_apply_mode = PAPP_CONSTANT;
l_dpy_id = -1;
l_last_frame_filename = NULL;
@ -917,7 +922,7 @@ p_frames_modify(t_anim_info *ainfo_ptr,
l_total_steps = l_end - l_begin;
}
l_total_steps--;
l_cur_step = l_total_steps;
l_cur_frame_nr = l_begin;
while(1) /* loop foreach frame in range */
@ -1055,7 +1060,7 @@ p_frames_modify(t_anim_info *ainfo_ptr,
if((action_mode == ACM_APPLY_FILTER)
&& (l_plugin_iterator != NULL) && (l_apply_mode == PTYP_VARYING_LINEAR ))
{
l_cur_step += 1.0;
l_cur_step -= 1.0;
/* call plugin-specific iterator, to modify
* the plugin's last_values
*/

View File

@ -531,7 +531,7 @@ gint32 p_gimp_image_add_guide(gint32 image_id, gint32 position, gint32 orienta
gint32 p_gimp_image_findnext_guide(gint32 image_id, gint32 guide_id)
{
static char *l_findnext_guide_proc = "gimp_image_findnext_guide";
static char *l_findnext_guide_proc = "gimp_image_find_next_guide";
GParam *return_vals;
int nreturn_vals;