Use HIG capitalization style. Added GPL license in a few places.

Minor code clean-up.
This commit is contained in:
Maurits Rijk 2004-05-26 17:29:30 +00:00
parent 64d83c7b68
commit b2bd0545ad
14 changed files with 228 additions and 323 deletions

View File

@ -1,3 +1,22 @@
2004-05-26 <maurits@b82017.upc-b.chello.nl>
2004-05-26 Maurits Rijk <m.rijk@chello.nl>
* plug-ins/common/decompose.c
* plug-ins/common/deinterlace.c
* plug-ins/common/depthmerge.c
* plug-ins/common/despeckle.c
* plug-ins/common/destripe.c
* plug-ins/common/diffraction.c
* plug-ins/common/displace.c
* plug-ins/common/edge.c
* plug-ins/common/emboss.c
* plug-ins/common/engrave.c
* plug-ins/common/exchange.c:
* plug-ins/common/film.c:
* plug-ins/common/flarefx.c:
2004-05-26 Sven Neumann <sven@gimp.org>
* app/widgets/gimpcolordisplayeditor.c
@ -177,20 +196,18 @@
* plug-ins/common/autostretch_hsv.c
* plug-ins/common/blinds.c
* plug-ins/common/blur.c
* plug-ins/common/borderaverage.c:
* plug-ins/common/bz2.c:
* plug-ins/common/c_astretch.c:
* plug-ins/common/ccanalyze.c:
* plug-ins/common/channel_mixer.c:
* plug-ins/common/color_enhance.c:
* plug-ins/common/colorify.c:
* plug-ins/common/colortoalpha.c:
* plug-ins/common/csource.c:
* plug-ins/common/cubism.c:
* plug-ins/common/curve_bend.c:
Use HIG capitalization style. Added GPL license in a few places.
Minor code clean-up.
* plug-ins/common/borderaverage.c
* plug-ins/common/bz2.c
* plug-ins/common/c_astretch.c
* plug-ins/common/ccanalyze.c
* plug-ins/common/channel_mixer.c
* plug-ins/common/color_enhance.c
* plug-ins/common/colorify.c
* plug-ins/common/colortoalpha.c
* plug-ins/common/csource.c
* plug-ins/common/cubism.c
* plug-ins/common/curve_bend.c: Use HIG capitalization style.
Added GPL license in a few places. Minor code clean-up.
2004-05-25 Sven Neumann <sven@gimp.org>

View File

@ -1231,7 +1231,7 @@ decompose_dialog (void)
decoint.extract_flag[j]);
}
toggle = gtk_check_button_new_with_label (_("Decompose to _Layers"));
toggle = gtk_check_button_new_with_mnemonic (_("Decompose to _layers"));
gtk_box_pack_start (GTK_BOX (main_vbox), toggle, FALSE, FALSE, 0);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),

View File

@ -1,4 +1,4 @@
/* Deinterlace 1.00 - image processing plug-in for the Gimp 1.0 API
/* Deinterlace 1.00 - image processing plug-in for the Gimp
*
* Copyright (C) 1997 Andrew Kieschnick (andrewk@mail.utexas.edu)
*
@ -6,9 +6,6 @@
*
* Copyright (C) 1996 Federico Mena Quintero
*
* Any bugs in this code are probably my (Andrew Kieschnick's) fault, as I
* pretty much rewrote it from scratch.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@ -26,8 +23,6 @@
#include "config.h"
#include <stdlib.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
@ -186,13 +181,6 @@ deinterlace (GimpDrawable *drawable)
gint row, col;
gint x1, y1, x2, y2;
/* Get the input area. This is the bounding box of the selection in
* the image (or the entire image if there is no selection). Only
* operating on the input area is simply an optimization. It doesn't
* need to be done for correct operation. (It simply makes it go
* faster, since fewer pixels need to be operated on).
*/
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
@ -215,7 +203,7 @@ deinterlace (GimpDrawable *drawable)
/* loop through the rows, performing our magic*/
for (row = y1; row < y2; row++)
{
gimp_pixel_rgn_get_row (&srcPR, dest, x1, row, (x2-x1));
gimp_pixel_rgn_get_row (&srcPR, dest, x1, row, x2 - x1);
/* Only do interpolation if the row:
(1) Isn't one we want to keep
@ -226,8 +214,8 @@ deinterlace (GimpDrawable *drawable)
(row - 1 < 0) ||
(row + 1 >= height)))
{
gimp_pixel_rgn_get_row (&srcPR, upper, x1, row-1, (x2-x1));
gimp_pixel_rgn_get_row (&srcPR, lower, x1, row+1, (x2-x1));
gimp_pixel_rgn_get_row (&srcPR, upper, x1, row - 1, x2 - x1);
gimp_pixel_rgn_get_row (&srcPR, lower, x1, row + 1, x2 - x1);
if (has_alpha)
{
@ -255,11 +243,11 @@ deinterlace (GimpDrawable *drawable)
}
else
{
for (col = 0; col < ((x2-x1)*bytes); col++)
dest[col] = (upper[col] + lower[col]) >> 1;
for (col = 0; col < (x2 - x1) * bytes; col++)
dest[col] = (upper[col] + lower[col]) / 2;
}
}
gimp_pixel_rgn_set_row (&destPR, dest, x1, row, (x2-x1));
gimp_pixel_rgn_set_row (&destPR, dest, x1, row, x2 - x1);
if ((row % 5) == 0)
gimp_progress_update ((double) row / (double) (y2 - y1));
@ -268,7 +256,7 @@ deinterlace (GimpDrawable *drawable)
/* update the deinterlaced region */
gimp_drawable_flush (drawable);
gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
gimp_drawable_update (drawable->drawable_id, x1, y1, (x2 - x1), (y2 - y1));
gimp_drawable_update (drawable->drawable_id, x1, y1, x2 - x1, y2 - y1);
g_free (lower);
g_free (upper);
@ -297,8 +285,8 @@ deinterlace_dialog (void)
G_CALLBACK (gimp_radio_button_update),
&DeinterlaceValue, DeinterlaceValue,
_("Keep O_dd Fields"), ODD_FIELDS, NULL,
_("Keep _Even Fields"), EVEN_FIELDS, NULL,
_("Keep o_dd Fields"), ODD_FIELDS, NULL,
_("Keep _even Fields"), EVEN_FIELDS, NULL,
NULL);

View File

@ -698,7 +698,7 @@ DepthMerge_dialog (DepthMerge *dm)
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (combo);
label = gtk_label_new(_("Depth Map:"));
label = gtk_label_new(_("Depth map:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
GTK_FILL, GTK_FILL, 0, 0);
@ -728,7 +728,7 @@ DepthMerge_dialog (DepthMerge *dm)
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (combo);
label = gtk_label_new (_("Depth Map:"));
label = gtk_label_new (_("Depth map:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
GTK_FILL, GTK_FILL, 0, 0);
@ -745,7 +745,7 @@ DepthMerge_dialog (DepthMerge *dm)
/* Numeric parameters */
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 4,
_("Overlap:"), 0, 6,
_("O_verlap:"), 0, 6,
dm->params.overlap, 0, 2, 0.001, 0.01, 3,
TRUE, 0, 0,
NULL, NULL);
@ -755,7 +755,7 @@ DepthMerge_dialog (DepthMerge *dm)
g_object_set_data (G_OBJECT (adj), "dm", dm);
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 5,
_("Offset:"), 0, 6,
_("O_ffset:"), 0, 6,
dm->params.offset, -1, 1, 0.001, 0.01, 3,
TRUE, 0, 0,
NULL, NULL);
@ -765,7 +765,7 @@ DepthMerge_dialog (DepthMerge *dm)
g_object_set_data (G_OBJECT (adj), "dm", dm);
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 6,
_("Scale 1:"), 0, 6,
_("Sc_ale 1:"), 0, 6,
dm->params.scale1, -1, 1, 0.001, 0.01, 3,
TRUE, 0, 0,
NULL, NULL);
@ -775,7 +775,7 @@ DepthMerge_dialog (DepthMerge *dm)
g_object_set_data (G_OBJECT (adj), "dm", dm);
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 7,
_("Scale 2:"), 0, 6,
_("Sca_le 2:"), 0, 6,
dm->params.scale2, -1, 1, 0.001, 0.01, 3,
TRUE, 0, 0,
NULL, NULL);
@ -924,14 +924,14 @@ dm_constraint (gint32 imageId,
{
DepthMerge *dm = (DepthMerge *)data;
return((drawableId == -1) ||
((gimp_drawable_width (drawableId) ==
gimp_drawable_width (dm->params.result)) &&
(gimp_drawable_height (drawableId) ==
gimp_drawable_height (dm->params.result)) &&
((gimp_drawable_is_rgb (drawableId) &&
(gimp_drawable_is_rgb (dm->params.result))) ||
gimp_drawable_is_gray (drawableId))));
return ((drawableId == -1) ||
((gimp_drawable_width (drawableId) ==
gimp_drawable_width (dm->params.result)) &&
(gimp_drawable_height (drawableId) ==
gimp_drawable_height (dm->params.result)) &&
((gimp_drawable_is_rgb (drawableId) &&
(gimp_drawable_is_rgb (dm->params.result))) ||
gimp_drawable_is_gray (drawableId))));
}
static void

View File

@ -19,26 +19,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Contents:
*
* main() - Main entry - just call gimp_main()...
* query() - Respond to a plug-in query...
* run() - Run the filter...
* despeckle() - Despeckle an image using a median filter.
* despeckle_dialog() - Popup a dialog window for the filter box size...
* preview_init() - Initialize the preview window...
* preview_scroll_callback() - Update the preview when a scrollbar is moved.
* preview_update() - Update the preview window.
* preview_exit() - Free all memory used by the preview window...
* dialog_iscale_update() - Update the value field using the scale.
* dialog_adaptive_callback() - Update the filter type...
* dialog_recursive_callback() - Update the filter type...
*
*
* Revision History:
*
* See ChangeLog
*/
#include "config.h"
@ -117,29 +97,29 @@ GimpPlugInInfo PLUG_IN_INFO =
run /* run */
};
GtkWidget *preview; /* Preview widget */
gint preview_width, /* Width of preview widget */
preview_height, /* Height of preview widget */
preview_x1, /* Upper-left X of preview */
preview_y1, /* Upper-left Y of preview */
preview_x2, /* Lower-right X of preview */
preview_y2; /* Lower-right Y of preview */
guchar *preview_src = NULL, /* Source pixel rows */
*preview_dst, /* Destination pixel row */
*preview_sort; /* Pixel value sort array */
GtkObject *hscroll_data, /* Horizontal scrollbar data */
*vscroll_data; /* Vertical scrollbar data */
static GtkWidget *preview; /* Preview widget */
static gint preview_width, /* Width of preview widget */
preview_height, /* Height of preview widget */
preview_x1, /* Upper-left X of preview */
preview_y1, /* Upper-left Y of preview */
preview_x2, /* Lower-right X of preview */
preview_y2; /* Lower-right Y of preview */
static guchar *preview_src = NULL, /* Source pixel rows */
*preview_dst, /* Destination pixel row */
*preview_sort; /* Pixel value sort array */
static GtkObject *hscroll_data, /* Horizontal scrollbar data */
*vscroll_data; /* Vertical scrollbar data */
GimpDrawable *drawable = NULL; /* Current image */
gint sel_x1, /* Selection bounds */
sel_y1,
sel_x2,
sel_y2;
gint sel_width, /* Selection width */
sel_height; /* Selection height */
gint img_bpp; /* Bytes-per-pixel in image */
static GimpDrawable *drawable = NULL; /* Current image */
static gint sel_x1, /* Selection bounds */
sel_y1,
sel_x2,
sel_y2;
static gint sel_width, /* Selection width */
sel_height; /* Selection height */
static gint img_bpp; /* Bytes-per-pixel in image */
gint despeckle_vals[4] =
static gint despeckle_vals[4] =
{
3,
FILTER_ADAPTIVE,
@ -747,7 +727,7 @@ despeckle_dialog (void)
*/
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
_("_Black Level:"), SCALE_WIDTH, ENTRY_WIDTH,
_("_Black level:"), SCALE_WIDTH, ENTRY_WIDTH,
black_level, -1, 255, 1, 8, 0,
TRUE, 0, 0,
NULL, NULL);
@ -760,7 +740,7 @@ despeckle_dialog (void)
*/
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
_("_White Level:"), SCALE_WIDTH, ENTRY_WIDTH,
_("_White level:"), SCALE_WIDTH, ENTRY_WIDTH,
white_level, 0, 256, 1, 8, 0,
TRUE, 0, 0,
NULL, NULL);

View File

@ -19,22 +19,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Contents:
*
* main() - Main entry - just call gimp_main()...
* query() - Respond to a plug-in query...
* run() - Run the filter...
* destripe() - Destripe an image.
* destripe_dialog() - Popup a dialog window...
* preview_init() - Initialize the preview window...
* preview_scroll_callback() - Update the preview when a scrollbar is moved.
* preview_update() - Update the preview window.
* preview_exit() - Free all memory used by the preview window...
* dialog_iscale_update() - Update the value field using the scale.
* dialog_histogram_callback()
*
* 1997/08/16 * Initial Revision.
* 1998/02/06 * Minor changes.
*/
#include "config.h"
@ -644,7 +628,7 @@ destripe_dialog (void)
G_CALLBACK (preview_update),
NULL);
button = gtk_check_button_new_with_mnemonic (_("Create _Histogram"));
button = gtk_check_button_new_with_mnemonic (_("Create _histogram"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), vals.histogram);
gtk_widget_show (button);
@ -672,13 +656,6 @@ destripe_dialog (void)
static void
preview_init (void)
{
gint width; /* Byte width of the image */
/*
* Setup for preview filter...
*/
width = preview_width * img_bpp;
preview_x1 = sel_x1;
preview_y1 = sel_y1;
preview_x2 = preview_x1 + MIN (preview_width, sel_x2 - sel_x1);

View File

@ -526,7 +526,7 @@ diffraction_dialog (void)
G_CALLBACK (gimp_double_adjustment_update),
&dvals.lam_b);
label = gtk_label_new_with_mnemonic (_("_Frequencies"));
label = gtk_label_new_with_mnemonic (_("Frequencies"));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), table, label);
/* Contours tab */
@ -564,7 +564,7 @@ diffraction_dialog (void)
G_CALLBACK (gimp_double_adjustment_update),
&dvals.contour_b);
label = gtk_label_new_with_mnemonic (_("Co_ntours"));
label = gtk_label_new_with_mnemonic (_("Contours"));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), table, label);
/* Sharp edges tab */
@ -602,7 +602,7 @@ diffraction_dialog (void)
G_CALLBACK (gimp_double_adjustment_update),
&dvals.edges_b);
label = gtk_label_new_with_mnemonic (_("_Sharp edges"));
label = gtk_label_new_with_mnemonic (_("Sharp edges"));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), table, label);
/* Other options tab */
@ -640,7 +640,7 @@ diffraction_dialog (void)
G_CALLBACK (gimp_double_adjustment_update),
&dvals.polarization);
label = gtk_label_new_with_mnemonic (_("O_ther options"));
label = gtk_label_new_with_mnemonic (_("Other options"));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), table, label);
/* Done */

View File

@ -248,14 +248,12 @@ static gboolean
displace_dialog (GimpDrawable *drawable)
{
GtkWidget *dlg;
GtkWidget *label;
GtkWidget *toggle;
GtkWidget *toggle_hbox;
GtkWidget *table;
GtkWidget *spinbutton;
GtkObject *adj;
GtkWidget *combo;
GSList *group = NULL;
GtkWidget *frame;
gboolean run;
gimp_ui_init ("displace", FALSE);
@ -278,7 +276,7 @@ displace_dialog (GimpDrawable *drawable)
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), table, TRUE, TRUE, 0);
/* X options */
toggle = gtk_check_button_new_with_mnemonic (_("_X Displacement:"));
toggle = gtk_check_button_new_with_mnemonic (_("_X displacement:"));
gtk_table_attach (GTK_TABLE (table), toggle, 0, 1, 0, 1,
GTK_FILL, GTK_FILL, 0, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), dvals.do_x);
@ -316,7 +314,7 @@ displace_dialog (GimpDrawable *drawable)
g_object_set_data (G_OBJECT (spinbutton), "set_sensitive", combo);
/* Y Options */
toggle = gtk_check_button_new_with_mnemonic (_("_Y Displacement:"));
toggle = gtk_check_button_new_with_mnemonic (_("_Y displacement:"));
gtk_table_attach (GTK_TABLE (table), toggle, 0, 1, 1, 2,
GTK_FILL, GTK_FILL, 0, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), dvals.do_y);
@ -353,58 +351,22 @@ displace_dialog (GimpDrawable *drawable)
gtk_widget_set_sensitive (combo, dvals.do_y);
g_object_set_data (G_OBJECT (spinbutton), "set_sensitive", combo);
/* Displacement Type */
toggle_hbox = gtk_hbox_new (FALSE, 6);
gtk_table_attach (GTK_TABLE (table), toggle_hbox, 0, 3, 2, 3,
frame = gimp_int_radio_group_new (TRUE, _("On Edges:"),
G_CALLBACK (gimp_radio_button_update),
&dvals.displace_type, dvals.displace_type,
_("_Wrap"), GIMP_PIXEL_FETCHER_EDGE_WRAP,
NULL,
_("_Smear"), GIMP_PIXEL_FETCHER_EDGE_SMEAR,
NULL,
_("_Black"), GIMP_PIXEL_FETCHER_EDGE_BLACK,
NULL,
NULL);
gtk_table_attach (GTK_TABLE (table), frame, 0, 3, 2, 3,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (frame);
label = gtk_label_new ( _("On Edges:"));
gtk_box_pack_start (GTK_BOX (toggle_hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
toggle = gtk_radio_button_new_with_mnemonic (group, _("_Wrap"));
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
gtk_box_pack_start (GTK_BOX (toggle_hbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
GINT_TO_POINTER (GIMP_PIXEL_FETCHER_EDGE_WRAP));
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_radio_button_update),
&dvals.displace_type);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
dvals.displace_type == GIMP_PIXEL_FETCHER_EDGE_WRAP);
toggle = gtk_radio_button_new_with_mnemonic (group, _("_Smear"));
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
gtk_box_pack_start (GTK_BOX (toggle_hbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
GINT_TO_POINTER (GIMP_PIXEL_FETCHER_EDGE_SMEAR));
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_radio_button_update),
&dvals.displace_type);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
dvals.displace_type == GIMP_PIXEL_FETCHER_EDGE_SMEAR);
toggle = gtk_radio_button_new_with_mnemonic (group, _("_Black"));
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
gtk_box_pack_start (GTK_BOX (toggle_hbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
GINT_TO_POINTER (GIMP_PIXEL_FETCHER_EDGE_BLACK));
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_radio_button_update),
&dvals.displace_type);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
dvals.displace_type == GIMP_PIXEL_FETCHER_EDGE_BLACK);
gtk_widget_show (toggle_hbox);
gtk_widget_show (table);
gtk_widget_show (dlg);
@ -493,7 +455,7 @@ displace (GimpDrawable *drawable)
{
map_y = gimp_drawable_get (dvals.displace_map_y);
gimp_pixel_rgn_init (&map_y_rgn, map_y,
x1, y1, (x2 - x1), (y2 - y1), FALSE, FALSE);
x1, y1, x2 - x1, y2 - y1, FALSE, FALSE);
if (gimp_drawable_has_alpha(map_y->drawable_id))
ym_alpha = 1;
ym_bytes = gimp_drawable_bpp(map_y->drawable_id);

View File

@ -4,6 +4,23 @@
* This filter performs edge detection on the input image.
* The code for this filter is based on "pgmedge", a program
* that is part of the netpbm package.
*
* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* pgmedge.c - edge-detect a portable graymap
@ -24,15 +41,6 @@
*
* Tips: you can enter arbitrary value into entry.
* (not bounded between 1.0 and 10.0)
*
* Changes from version 1.06 to version 1.07:
* - Added entry
* - Cleaned up code a bit
*
* Differences from Peter Mattis's original `edge' plug-in:
* - Added Wrapmode. (useful for tilable images)
* - Enhanced speed in this version.
* - It works with the alpha channel.
*/
/* 29 July 2003 Dave Neary <bolsh@gimp.org>
@ -255,10 +263,6 @@ run (const gchar *name,
static void
edge (GimpDrawable *drawable)
{
/*
* this function is too long, so I must split this into a few
* functions later ... -- taka
*/
GimpPixelRgn src_rgn, dest_rgn;
gpointer pr;
GimpPixelFetcher *pft;
@ -425,7 +429,7 @@ edge_detect (guchar *data)
ret = -1;
break;
}
return ret;
return CLAMP0255 (ret);
}
@ -453,8 +457,8 @@ sobel (guchar *data)
v_grad += v_kernel[i] * data[i];
h_grad += h_kernel[i] * data[i];
}
return CLAMP(sqrt (v_grad * v_grad * evals.amount +
h_grad * h_grad * evals.amount), 0, 255);
return sqrt (v_grad * v_grad * evals.amount +
h_grad * h_grad * evals.amount);
}
/*
@ -497,10 +501,9 @@ prewitt (guchar *data)
if (max < m[k])
max = m[k];
return CLAMP(evals.amount * max, 0, 255);
return evals.amount * max;
}
/*
* Gradient Edge detector
*/
@ -526,12 +529,10 @@ gradient (guchar *data)
h_grad += h_kernel[i] * data[i];
}
return CLAMP(sqrt (v_grad * v_grad * evals.amount +
h_grad * h_grad * evals.amount), 0, 255);
return sqrt (v_grad * v_grad * evals.amount +
h_grad * h_grad * evals.amount);
}
/*
* Roberts Edge detector
*/
@ -557,12 +558,10 @@ roberts (guchar *data)
h_grad += h_kernel[i] * data[i];
}
return CLAMP(sqrt (v_grad * v_grad * evals.amount +
h_grad * h_grad * evals.amount), 0, 255);
return sqrt (v_grad * v_grad * evals.amount +
h_grad * h_grad * evals.amount);
}
/*
* Differential Edge detector
*/
@ -589,11 +588,10 @@ differential (guchar *data)
h_grad += h_kernel[i] * data[i];
}
return CLAMP(sqrt (v_grad * v_grad * evals.amount +
h_grad * h_grad * evals.amount), 0, 255);
return sqrt (v_grad * v_grad * evals.amount +
h_grad * h_grad * evals.amount);
}
/*
* Laplace Edge detector
*/
@ -605,7 +603,7 @@ laplace (guchar *data)
1, 1, 1};
gint i;
gint grad;
gint grad;
grad = 0;
@ -614,8 +612,7 @@ laplace (guchar *data)
grad += kernel[i] * data[i];
}
return CLAMP(grad * evals.amount, 0, 255);
return grad * evals.amount;
}

View File

@ -713,7 +713,7 @@ mw_preview_new (GtkWidget *parent,
gtk_container_add (GTK_CONTAINER (frame), preview);
gtk_widget_show (preview);
button = gtk_check_button_new_with_mnemonic (_("Do _Preview"));
button = gtk_check_button_new_with_mnemonic (_("Do pre_view"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), do_preview);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);

View File

@ -18,16 +18,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* This plug-in creates a black-and-white 'engraved' version of an image.
* Much of the code is stolen from the Pixelize plug-in.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
@ -234,7 +226,7 @@ engrave_dialog (void)
G_CALLBACK (gimp_int_adjustment_update),
&pvals.height);
toggle = gtk_check_button_new_with_mnemonic (_("_Limit Line Width"));
toggle = gtk_check_button_new_with_mnemonic (_("_Limit line width"));
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), pvals.limit);
gtk_widget_show (toggle);
@ -262,8 +254,8 @@ engrave (GimpDrawable *drawable)
gint limit;
tile_width = gimp_tile_width();
height = (gint) pvals.height;
limit = (gint) pvals.limit;
height = pvals.height;
limit = pvals.limit;
if (height >= tile_width)
engrave_large (drawable, height, limit);
else
@ -286,12 +278,9 @@ engrave_large (GimpDrawable *drawable,
gint progress, max_progress;
gpointer pr;
gimp_drawable_mask_bounds(drawable->drawable_id, &x1, &y1, &x2, &y2);
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
if (gimp_drawable_is_rgb(drawable->drawable_id))
bpp = 3;
else
bpp = 1;
bpp = (gimp_drawable_is_rgb(drawable->drawable_id)) ? 3 : 1;
average = g_new(gulong, bpp);
/* Initialize progress */
@ -305,12 +294,13 @@ engrave_large (GimpDrawable *drawable,
y_step = height - (y % height);
y_step = MIN(y_step, x2 - x);
gimp_pixel_rgn_init(&src_rgn, drawable, x, y, 1, y_step, FALSE, FALSE);
gimp_pixel_rgn_init (&src_rgn, drawable, x, y, 1, y_step,
FALSE, FALSE);
for (b = 0; b < bpp; b++)
average[b] = 0;
count = 0;
for (pr = gimp_pixel_rgns_register(1, &src_rgn);
for (pr = gimp_pixel_rgns_register (1, &src_rgn);
pr != NULL;
pr = gimp_pixel_rgns_process(pr))
{
@ -329,7 +319,7 @@ engrave_large (GimpDrawable *drawable,
}
/* Update progress */
progress += src_rgn.w * src_rgn.h;
gimp_progress_update((double) progress / (double) max_progress);
gimp_progress_update ((double) progress / (double) max_progress);
}
if (count > 0)
@ -343,9 +333,9 @@ engrave_large (GimpDrawable *drawable,
average[1],
average[2]) / 254.0 * height;
gimp_pixel_rgn_init(&dest_rgn,
drawable, x, y, 1, y_step, TRUE, TRUE);
for (pr = gimp_pixel_rgns_register(1, &dest_rgn);
gimp_pixel_rgn_init (&dest_rgn,
drawable, x, y, 1, y_step, TRUE, TRUE);
for (pr = gimp_pixel_rgns_register (1, &dest_rgn);
pr != NULL;
pr = gimp_pixel_rgns_process(pr))
{
@ -377,7 +367,7 @@ engrave_large (GimpDrawable *drawable,
/* update the engraved region */
gimp_drawable_flush(drawable);
gimp_drawable_merge_shadow(drawable->drawable_id, TRUE);
gimp_drawable_update(drawable->drawable_id, x1, y1, (x2 - x1), (y2 - y1));
gimp_drawable_update(drawable->drawable_id, x1, y1, x2 - x1, y2 - y1);
}
typedef struct
@ -408,21 +398,18 @@ engrave_small (GimpDrawable *drawable,
x1%height != 0 etc.), operates on the remainder pixels.
*/
gimp_drawable_mask_bounds(drawable->drawable_id, &x1, &y1, &x2, &y2);
gimp_pixel_rgn_init(&src_rgn, drawable,
x1, y1, x2 - x1, y2 - y1, FALSE, FALSE);
gimp_pixel_rgn_init(&dest_rgn, drawable,
x1, y1, x2 - x1, y2 - y1, TRUE, TRUE);
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
gimp_pixel_rgn_init (&src_rgn, drawable,
x1, y1, x2 - x1, y2 - y1, FALSE, FALSE);
gimp_pixel_rgn_init (&dest_rgn, drawable,
x1, y1, x2 - x1, y2 - y1, TRUE, TRUE);
/* Initialize progress */
progress = 0;
max_progress = (x2 - x1) * (y2 - y1);
bpp = drawable->bpp;
if (gimp_drawable_is_rgb(drawable->drawable_id))
color_n = 3;
else
color_n = 1;
color_n = (gimp_drawable_is_rgb (drawable->drawable_id)) ? 3 : 1;
area.width = (tile_width / height) * height;
area.data = g_new(guchar, (glong) bpp * area.width * area.width);
@ -434,24 +421,26 @@ engrave_small (GimpDrawable *drawable,
area.h = MIN(area.h, y2 - area.y);
for (area.x = x1; area.x < x2; ++area.x)
{
gimp_pixel_rgn_get_rect(&src_rgn, area.data, area.x, area.y, 1, area.h);
gimp_pixel_rgn_get_rect (&src_rgn, area.data, area.x, area.y, 1,
area.h);
engrave_sub(height, limit, bpp, color_n);
engrave_sub (height, limit, bpp, color_n);
gimp_pixel_rgn_set_rect(&dest_rgn, area.data, area.x, area.y, 1, area.h);
gimp_pixel_rgn_set_rect (&dest_rgn, area.data, area.x, area.y, 1,
area.h);
/* Update progress */
progress += area.h;
gimp_progress_update((double) progress / (double) max_progress);
gimp_progress_update ((double) progress / (double) max_progress);
}
}
g_free(area.data);
/* update the engraved region */
gimp_drawable_flush(drawable);
gimp_drawable_merge_shadow(drawable->drawable_id, TRUE);
gimp_drawable_update(drawable->drawable_id, x1, y1, (x2 - x1), (y2 - y1));
gimp_drawable_flush (drawable);
gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
gimp_drawable_update (drawable->drawable_id, x1, y1, x2 - x1, y2 - y1);
}
static void

View File

@ -452,7 +452,7 @@ exchange_dialog (void)
if (! framenumber)
{
adj = gimp_scale_entry_new (GTK_TABLE (table), 1, row++,
_("R_ed Threshold:"), SCALE_WIDTH, 0,
_("R_ed threshold:"), SCALE_WIDTH, 0,
xargs.threshold.r,
0.0, 1.0, 0.01, 0.1, 3,
TRUE, 0, 0,
@ -506,7 +506,7 @@ exchange_dialog (void)
if (!framenumber)
{
adj = gimp_scale_entry_new (GTK_TABLE (table), 1, row++,
_("G_reen Threshold:"), SCALE_WIDTH, 0,
_("G_reen threshold:"), SCALE_WIDTH, 0,
xargs.threshold.g,
0.0, 1.0, 0.01, 0.1, 3,
TRUE, 0, 0,
@ -560,7 +560,7 @@ exchange_dialog (void)
if (! framenumber)
{
adj = gimp_scale_entry_new (GTK_TABLE (table), 1, row++,
_("B_lue Threshold:"), SCALE_WIDTH, 0,
_("B_lue threshold:"), SCALE_WIDTH, 0,
xargs.threshold.b,
0.0, 1.0, 0.01, 0.1, 3,
TRUE, 0, 0,
@ -585,7 +585,7 @@ exchange_dialog (void)
{
GtkWidget *button;
button = gtk_check_button_new_with_mnemonic (_("Lock _Thresholds"));
button = gtk_check_button_new_with_mnemonic (_("Lock _thresholds"));
gtk_table_attach (GTK_TABLE (table), button, 2, 4, row, row + 1,
GTK_FILL, 0, 0, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),

View File

@ -22,15 +22,6 @@
* This plug-in generates a film roll with several images
*/
/* Event history:
* V 1.00, PK, 01-Jul-97, Creation
* V 1.01, PK, 24-Jul-97, Fix problem with previews on Irix
* V 1.02, PK, 24-Sep-97, Try different font sizes when inquire failed.
* Fit film height to images
* V 1.03, nn, 20-Dec-97, Initialize layers in film()
* V 1.04, PK, 08-Oct-99, Fix problem with image id zero
* Internationalization
*/
static char ident[] = "@(#) GIMP Film plug-in v1.04 1999-10-08";
#include "config.h"
@ -1195,7 +1186,7 @@ create_selection_tab (GtkWidget *notebook,
hbox = gtk_hbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), hbox,
gtk_label_new_with_mnemonic (_("_Selection")));
gtk_label_new_with_mnemonic (_("Selection")));
gtk_widget_show (hbox);
vbox2 = gtk_vbox_new (FALSE, 12);
@ -1214,7 +1205,7 @@ create_selection_tab (GtkWidget *notebook,
gtk_widget_show (vbox);
/* Keep maximum image height */
toggle = gtk_check_button_new_with_mnemonic (_("_Fit Height to Images"));
toggle = gtk_check_button_new_with_mnemonic (_("_Fit height to images"));
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
@ -1282,7 +1273,7 @@ create_selection_tab (GtkWidget *notebook,
spinbutton = gimp_spin_button_new (&adj, filmvals.number_start, 0,
GIMP_MAX_IMAGE_SIZE, 1, 10, 0, 1, 0);
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Start _Index:"), 0.0, 0.5,
_("Start _index:"), 0.0, 0.5,
spinbutton, 1, TRUE);
gtk_size_group_add_widget (group, label);
@ -1316,8 +1307,8 @@ create_selection_tab (GtkWidget *notebook,
for (j = 0; j < 2; j++)
{
toggle = gtk_check_button_new_with_mnemonic (j ? _("At _Bottom")
: _("At _Top"));
toggle = gtk_check_button_new_with_mnemonic (j ? _("At _bottom")
: _("At _top"));
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
filmvals.number_pos[j]);
@ -1380,7 +1371,7 @@ create_advanced_tab (GtkWidget *notebook)
filmint.advanced_adj[0] = adj =
gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Image _Height:"), 0, 0,
_("Image _height:"), 0, 0,
filmvals.picture_height,
0.0, 1.0, 0.001, 0.01, 3,
TRUE, 0, 0,
@ -1391,7 +1382,7 @@ create_advanced_tab (GtkWidget *notebook)
filmint.advanced_adj[1] = adj =
gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Image Spac_ing:"), 0, 0,
_("Image spac_ing:"), 0, 0,
filmvals.picture_space,
0.0, 1.0, 0.001, 0.01, 3,
TRUE, 0, 0,
@ -1402,7 +1393,7 @@ create_advanced_tab (GtkWidget *notebook)
filmint.advanced_adj[2] = adj =
gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("_Hole Offset:"), 0, 0,
_("_Hole offset:"), 0, 0,
filmvals.hole_offset,
0.0, 1.0, 0.001, 0.01, 3,
TRUE, 0, 0,
@ -1413,7 +1404,7 @@ create_advanced_tab (GtkWidget *notebook)
filmint.advanced_adj[3] = adj =
gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Ho_le Width:"), 0, 0,
_("Ho_le width:"), 0, 0,
filmvals.hole_width,
0.0, 1.0, 0.001, 0.01, 3,
TRUE, 0, 0,
@ -1424,7 +1415,7 @@ create_advanced_tab (GtkWidget *notebook)
filmint.advanced_adj[4] = adj =
gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Hol_e Height:"), 0, 0,
_("Hol_e height:"), 0, 0,
filmvals.hole_height,
0.0, 1.0, 0.001, 0.01, 3,
TRUE, 0, 0,
@ -1435,7 +1426,7 @@ create_advanced_tab (GtkWidget *notebook)
filmint.advanced_adj[5] = adj =
gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Hole Sp_acing:"), 0, 0,
_("Hole sp_acing:"), 0, 0,
filmvals.hole_space,
0.0, 1.0, 0.001, 0.01, 3,
TRUE, 0, 0,
@ -1446,7 +1437,7 @@ create_advanced_tab (GtkWidget *notebook)
filmint.advanced_adj[6] = adj =
gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("_Number Height:"), 0, 0,
_("_Number height:"), 0, 0,
filmvals.number_height,
0.0, 1.0, 0.001, 0.01, 3,
TRUE, 0, 0,

View File

@ -136,11 +136,11 @@ static void minner (guchar *s, gfloat h);
static void mouter (guchar *s, gfloat h);
static void mhalo (guchar *s, gfloat h);
static void initref (gint sx, gint sy, gint width, gint height, gint matt);
static void fixpix (guchar *data, float procent, RGBfloat colpro);
static void mrt1 (guchar *s, gint i, gint col, gint row);
static void mrt2 (guchar *s, gint i, gint col, gint row);
static void mrt3 (guchar *s, gint i, gint col, gint row);
static void mrt4 (guchar *s, gint i, gint col, gint row);
static void fixpix (guchar *data, float procent, RGBfloat *colpro);
static void mrt1 (guchar *s, Reflect *ref, gint col, gint row);
static void mrt2 (guchar *s, Reflect *ref, gint col, gint row);
static void mrt3 (guchar *s, Reflect *ref, gint col, gint row);
static void mrt4 (guchar *s, Reflect *ref, gint col, gint row);
/* --- Variables --- */
GimpPlugInInfo PLUG_IN_INFO =
@ -336,6 +336,7 @@ FlareFX (GimpDrawable *drawable,
gint x1, y1, x2, y2;
gint matt;
gfloat hyp;
GTimer *timer = g_timer_new();
if (preview_mode)
{
@ -407,26 +408,28 @@ FlareFX (GimpDrawable *drawable,
for (col = x1; col < x2; col++) /* x-coord */
{
hyp = hypot (col-xs, row-ys);
mcolor (s, hyp); /* make color */
mglow (s, hyp); /* make glow */
minner (s, hyp); /* make inner */
mouter (s, hyp); /* make outer */
mhalo (s, hyp); /* make halo */
for (i = 0; i < numref; i++)
{
switch (ref1[i].type)
{
case 1:
mrt1 (s, i, col, row);
mrt1 (s, ref1 + i, col, row);
break;
case 2:
mrt2 (s, i, col, row);
mrt2 (s, ref1 + i, col, row);
break;
case 3:
mrt3 (s, i, col, row);
mrt3 (s, ref1 + i, col, row);
break;
case 4:
mrt4 (s, i, col, row);
mrt4 (s, ref1 + i, col, row);
break;
}
}
@ -456,6 +459,7 @@ FlareFX (GimpDrawable *drawable,
gimp_drawable_flush (drawable);
gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
gimp_drawable_update (drawable->drawable_id, x1, y1, (x2 - x1), (y2 - y1));
printf("%lf\n", g_timer_elapsed(timer, NULL));
}
g_free (cur_row);
@ -466,14 +470,14 @@ static void
mcolor (guchar *s,
gfloat h)
{
static gfloat procent;
gfloat procent;
procent = scolor - h;
procent/=scolor;
if (procent > 0.0)
{
procent*=procent;
fixpix (s, procent, color);
procent *= procent;
fixpix (s, procent, &color);
}
}
@ -481,14 +485,14 @@ static void
mglow (guchar *s,
gfloat h)
{
static gfloat procent;
gfloat procent;
procent = sglow - h;
procent/=sglow;
if (procent > 0.0)
{
procent*=procent;
fixpix (s, procent, glow);
fixpix (s, procent, &glow);
}
}
@ -496,14 +500,14 @@ static void
minner (guchar *s,
gfloat h)
{
static gfloat procent;
gfloat procent;
procent = sinner - h;
procent/=sinner;
if (procent > 0.0)
{
procent*=procent;
fixpix (s, procent, inner);
fixpix (s, procent, &inner);
}
}
@ -511,35 +515,35 @@ static void
mouter (guchar *s,
gfloat h)
{
static gfloat procent;
gfloat procent;
procent = souter - h;
procent/=souter;
if (procent > 0.0)
fixpix (s, procent, outer);
fixpix (s, procent, &outer);
}
static void
mhalo (guchar *s,
gfloat h)
{
static gfloat procent;
gfloat procent;
procent = h - shalo;
procent/=(shalo*0.07);
procent = fabs (procent);
if (procent < 1.0)
fixpix (s, 1.0 - procent, halo);
fixpix (s, 1.0 - procent, &halo);
}
static void
fixpix (guchar *data,
float procent,
RGBfloat colpro)
RGBfloat *colpro)
{
data[0] = data[0] + (255 - data[0]) * procent * colpro.r;
data[1] = data[1] + (255 - data[1]) * procent * colpro.g;
data[2] = data[2] + (255 - data[2]) * procent * colpro.b;
data[0] += (255 - data[0]) * procent * colpro->r;
data[1] += (255 - data[1]) * procent * colpro->g;
data[2] += (255 - data[2]) * procent * colpro->b;
}
static void
@ -614,69 +618,69 @@ initref (gint sx,
}
static void
mrt1 (guchar *s,
gint i,
gint col,
gint row)
mrt1 (guchar *s,
Reflect *ref,
gint col,
gint row)
{
static gfloat procent;
gfloat procent;
procent = ref1[i].size - hypot (ref1[i].xp - col, ref1[i].yp - row);
procent/=ref1[i].size;
procent = ref->size - hypot (ref->xp - col, ref->yp - row);
procent/=ref->size;
if (procent > 0.0)
{
procent*=procent;
fixpix (s, procent, ref1[i].ccol);
fixpix (s, procent, &ref->ccol);
}
}
static void
mrt2 (guchar *s,
gint i,
Reflect *ref,
gint col,
gint row)
{
static gfloat procent;
gfloat procent;
procent = ref1[i].size - hypot (ref1[i].xp - col, ref1[i].yp - row);
procent/=(ref1[i].size * 0.15);
procent = ref->size - hypot (ref->xp - col, ref->yp - row);
procent/=(ref->size * 0.15);
if (procent > 0.0)
{
if (procent > 1.0) procent = 1.0;
fixpix (s, procent, ref1[i].ccol);
fixpix (s, procent, &ref->ccol);
}
}
static void
mrt3 (guchar *s,
gint i,
Reflect *ref,
gint col,
gint row)
{
static gfloat procent;
gfloat procent;
procent = ref1[i].size - hypot (ref1[i].xp - col, ref1[i].yp - row);
procent/=(ref1[i].size * 0.12);
procent = ref->size - hypot (ref->xp - col, ref->yp - row);
procent/=(ref->size * 0.12);
if (procent > 0.0)
{
if (procent > 1.0) procent = 1.0 - (procent * 0.12);
fixpix (s, procent, ref1[i].ccol);
fixpix (s, procent, &ref->ccol);
}
}
static void
mrt4 (guchar *s,
gint i,
Reflect *ref,
gint col,
gint row)
{
static gfloat procent;
gfloat procent;
procent = hypot (ref1[i].xp - col, ref1[i].yp - row) - ref1[i].size;
procent/=(ref1[i].size*0.04);
procent = hypot (ref->xp - col, ref->yp - row) - ref->size;
procent/=(ref->size*0.04);
procent = fabs (procent);
if (procent < 1.0)
fixpix(s, 1.0 - procent, ref1[i].ccol);
fixpix(s, 1.0 - procent, &ref->ccol);
}
/*=================================================================
@ -789,7 +793,7 @@ flare_center_create (GimpDrawable *drawable)
gtk_widget_show (frame);
/* show / hide cursor */
check = gtk_check_button_new_with_mnemonic (_("_Show Cursor"));
check = gtk_check_button_new_with_mnemonic (_("_Show cursor"));
gtk_table_attach (GTK_TABLE (table), check, 0, 4, 2, 3,
GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), show_cursor);