mirror of https://github.com/GNOME/gimp.git
Use HIG capitalization style. Added GPL license in a few places.
Minor code clean-up.
This commit is contained in:
parent
9158152f7b
commit
013cc9c3b9
25
ChangeLog
25
ChangeLog
|
@ -1,3 +1,28 @@
|
|||
2004-05-25 Maurits Rijk <m.rijk@chello.nl>
|
||||
|
||||
* plug-ins/common/align_layers.c
|
||||
* plug-ins/common/animoptimize.c
|
||||
* plug-ins/common/animationplay.c
|
||||
* plug-ins/common/apply_lens.c
|
||||
* plug-ins/common/autocrop.c
|
||||
* 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.
|
||||
|
||||
2004-05-25 Sven Neumann <sven@gimp.org>
|
||||
|
||||
Sorry, couldn't resist to finish this task...
|
||||
|
|
|
@ -21,10 +21,6 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
|
@ -389,7 +385,6 @@ align_layers_get_align_offsets (gint32 drawable_id,
|
|||
gimp_drawable_detach (layer);
|
||||
}
|
||||
|
||||
/* dialog stuff */
|
||||
static int
|
||||
align_layers_dialog (void)
|
||||
{
|
||||
|
@ -423,7 +418,7 @@ align_layers_dialog (void)
|
|||
_("Collect"), H_COLLECT,
|
||||
_("Fill (left to right)"), LEFT2RIGHT,
|
||||
_("Fill (right to left)"), RIGHT2LEFT,
|
||||
_("Snap to Grid"), SNAP2HGRID,
|
||||
_("Snap to grid"), SNAP2HGRID,
|
||||
NULL);
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), VALS.h_style);
|
||||
|
||||
|
@ -432,13 +427,13 @@ align_layers_dialog (void)
|
|||
&VALS.h_style);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("_Horizontal Style:"), 0.0, 0.5,
|
||||
_("_Horizontal style:"), 0.0, 0.5,
|
||||
combo, 2, FALSE);
|
||||
|
||||
|
||||
combo = gimp_int_combo_box_new (_("Left Edge"), H_BASE_LEFT,
|
||||
combo = gimp_int_combo_box_new (_("Left edge"), H_BASE_LEFT,
|
||||
_("Center"), H_BASE_CENTER,
|
||||
_("Right Edge"), H_BASE_RIGHT,
|
||||
_("Right edge"), H_BASE_RIGHT,
|
||||
NULL);
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), VALS.h_base);
|
||||
|
||||
|
@ -447,14 +442,14 @@ align_layers_dialog (void)
|
|||
&VALS.h_base);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||
_("Ho_rizontal Base:"), 0.0, 0.5,
|
||||
_("Ho_rizontal base:"), 0.0, 0.5,
|
||||
combo, 2, FALSE);
|
||||
|
||||
combo = gimp_int_combo_box_new (_("None"), V_NONE,
|
||||
_("Collect"), V_COLLECT,
|
||||
_("Fill (top to bottom)"), TOP2BOTTOM,
|
||||
_("Fill (bottom to top)"), BOTTOM2TOP,
|
||||
_("Snap to Grid"), SNAP2VGRID,
|
||||
_("Snap to grid"), SNAP2VGRID,
|
||||
NULL);
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), VALS.v_style);
|
||||
|
||||
|
@ -463,12 +458,12 @@ align_layers_dialog (void)
|
|||
&VALS.v_style);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
||||
_("_Vertical Style:"), 0.0, 0.5,
|
||||
_("_Vertical style:"), 0.0, 0.5,
|
||||
combo, 2, FALSE);
|
||||
|
||||
combo = gimp_int_combo_box_new (_("Top Edge"), V_BASE_TOP,
|
||||
combo = gimp_int_combo_box_new (_("Top edge"), V_BASE_TOP,
|
||||
_("Center"), V_BASE_CENTER,
|
||||
_("Bottom Edge"), V_BASE_BOTTOM,
|
||||
_("Bottom edge"), V_BASE_BOTTOM,
|
||||
NULL);
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), VALS.v_base);
|
||||
|
||||
|
@ -477,11 +472,11 @@ align_layers_dialog (void)
|
|||
&VALS.v_base);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 3,
|
||||
_("Ver_tical Base:"), 0.0, 0.5,
|
||||
_("Ver_tical base:"), 0.0, 0.5,
|
||||
combo, 2, FALSE);
|
||||
|
||||
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 4,
|
||||
_("_Grid Size:"), SCALE_WIDTH, 0,
|
||||
_("_Grid size:"), SCALE_WIDTH, 0,
|
||||
VALS.grid_size, 0, 200, 1, 10, 0,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
|
@ -490,7 +485,7 @@ align_layers_dialog (void)
|
|||
&VALS.grid_size);
|
||||
|
||||
toggle = gtk_check_button_new_with_mnemonic
|
||||
(_("_Ignore the Bottom Layer even if Visible"));
|
||||
(_("_Ignore the bottom layer even if visible"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), VALS.ignore_bottom);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), toggle, 0, 3, 5, 6);
|
||||
gtk_widget_show (toggle);
|
||||
|
@ -500,7 +495,7 @@ align_layers_dialog (void)
|
|||
&VALS.ignore_bottom);
|
||||
|
||||
toggle = gtk_check_button_new_with_mnemonic
|
||||
(_("_Use the (Invisible) Bottom Layer as the Base"));
|
||||
(_("_Use the (invisible) bottom layer as the base"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
VALS.base_is_bottom_layer);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), toggle, 0, 3, 6, 7);
|
||||
|
|
|
@ -3,84 +3,22 @@
|
|||
*
|
||||
* (c) Adam D. Moss : 1997-2000 : adam@gimp.org : adam@foxbox.org
|
||||
*
|
||||
* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This is part of the GIMP package and is released under the GNU
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* REVISION HISTORY:
|
||||
* 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.
|
||||
*
|
||||
* 2000-08-30 : version 0.98.8
|
||||
* Default frame timing is now 100ms instead of 125ms.
|
||||
* 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.
|
||||
*
|
||||
* 2000-06-05 : version 0.98.7
|
||||
* Fix old bug which could cause errors in evaluating the
|
||||
* final pixel of each composed layer.
|
||||
*
|
||||
* 2000-01-13 : version 0.98.6
|
||||
* Looser parsing of (XXXXX) layer-name tags
|
||||
*
|
||||
* 98.07.27 : version 0.98.5
|
||||
* UI tweaks, fix for pseudocolor displays w/gdkrgb.
|
||||
*
|
||||
* 98.07.20 : version 0.98.4
|
||||
* User interface improvements.
|
||||
*
|
||||
* 98.07.19 : version 0.98.2
|
||||
* Another speedup for some kinds of shaped animations.
|
||||
*
|
||||
* 98.07.19 : version 0.98.0
|
||||
* Adapted to use GDKRGB (from recent GTK >= 1.1) if
|
||||
* available - good speed and reliability improvement.
|
||||
* Plus some minor tweaks.
|
||||
*
|
||||
* 98.04.28 : version 0.94.2
|
||||
* Fixed a time-parsing bug.
|
||||
*
|
||||
* 98.04.05 : version 0.94.0
|
||||
* Improved performance and removed flicker when shaped.
|
||||
* Shaped mode also works with RGB* images now.
|
||||
* Fixed some longstanding potential visual debris.
|
||||
*
|
||||
* 98.04.04 : version 0.92.0
|
||||
* Improved responsiveness and performance for the new
|
||||
* shaped-animation mode. Still some flicker.
|
||||
*
|
||||
* 98.04.02 : version 0.90.0
|
||||
* EXPERIMENTAL wackyness - try dragging the animation
|
||||
* out of the plugin dialog's preview box...
|
||||
* (only works on non-RGB* images for now)
|
||||
*
|
||||
* 98.03.16 : version 0.85.0
|
||||
* Implemented some more rare opaque/alpha combinations.
|
||||
*
|
||||
* 98.03.15 : version 0.84.0
|
||||
* Tried to clear up the GTK object/cast warnings. Only
|
||||
* partially successful. Could use some help.
|
||||
*
|
||||
* 97.12.11 : version 0.83.0
|
||||
* GTK's timer logic changed a little... adjusted
|
||||
* plugin to fit.
|
||||
*
|
||||
* 97.09.16 : version 0.81.7
|
||||
* Fixed progress bar's off-by-one problem with
|
||||
* the new timing. Fixed erroneous black bars which
|
||||
* were sometimes visible when the first frame was
|
||||
* smaller than the image itself. Made playback
|
||||
* controls inactive when image doesn't have multiple
|
||||
* frames. Moved progress bar above control buttons,
|
||||
* it's less distracting there. More cosmetic stuff.
|
||||
*
|
||||
* 97.09.15 : version 0.81.0
|
||||
* Now plays INDEXED and GRAY animations.
|
||||
*
|
||||
* 97.09.15 : version 0.75.0
|
||||
* Next frame is generated ahead of time - results
|
||||
* in more precise timing.
|
||||
*
|
||||
* 97.09.14 : version 0.70.0
|
||||
* Initial release. RGB only.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -166,8 +104,8 @@ static void init_preview_misc (void);
|
|||
/* tag util functions*/
|
||||
static int parse_ms_tag (const char *str);
|
||||
static DisposeType parse_disposal_tag (const char *str);
|
||||
static DisposeType get_frame_disposal (const guint whichframe);
|
||||
static guint32 get_frame_duration (const guint whichframe);
|
||||
static DisposeType get_frame_disposal (guint whichframe);
|
||||
static guint32 get_frame_duration (guint whichframe);
|
||||
static int is_disposal_tag (const char *str,
|
||||
DisposeType *disposal,
|
||||
int *taglength);
|
||||
|
@ -310,7 +248,6 @@ reshape_from_bitmap (gchar* bitmap)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
shape_pressed (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
|
@ -339,7 +276,6 @@ shape_pressed (GtkWidget *widget,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
maybeblocked_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
|
@ -391,7 +327,6 @@ shape_motion (GtkWidget *widget,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
repaint_da (GtkWidget *darea,
|
||||
GdkEventExpose *event,
|
||||
|
@ -406,7 +341,6 @@ repaint_da (GtkWidget *darea,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
repaint_sda (GtkWidget *darea,
|
||||
GdkEventExpose *event,
|
||||
|
@ -421,7 +355,6 @@ repaint_sda (GtkWidget *darea,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
preview_pressed (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
|
@ -460,8 +393,6 @@ preview_pressed (GtkWidget *widget,
|
|||
return shape_pressed (shape_window, event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
build_dialog (GimpImageBaseType basetype,
|
||||
gchar *imagename)
|
||||
|
@ -1192,7 +1123,6 @@ render_frame (gint32 whichframe)
|
|||
gimp_drawable_detach(drawable);
|
||||
}
|
||||
|
||||
|
||||
/* If we're using GDKRGB, we don't reshape in this function because
|
||||
it's too late (GDKRGB is synchronous). So this just updates the
|
||||
progress bar. */
|
||||
|
@ -1210,7 +1140,6 @@ show_frame (void)
|
|||
g_free (text);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init_preview_misc (void)
|
||||
{
|
||||
|
@ -1247,30 +1176,27 @@ init_preview_misc (void)
|
|||
shape_drawing_area_data = preview_data;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
total_alpha_preview (guchar* ptr)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (shaping)
|
||||
{
|
||||
memset(shape_preview_mask, 0, (width*height)/8 + height);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i=0;i<height;i++)
|
||||
gint i;
|
||||
|
||||
for (i = 0;i < height; i++)
|
||||
{
|
||||
if (i&8)
|
||||
memcpy(&ptr[i*3*width], preview_alpha1_data, 3*width);
|
||||
if (i & 8)
|
||||
memcpy (&ptr[i*3*width], preview_alpha1_data, 3*width);
|
||||
else
|
||||
memcpy(&ptr[i*3*width], preview_alpha2_data, 3*width);
|
||||
memcpy (&ptr[i*3*width], preview_alpha2_data, 3*width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Util. */
|
||||
|
||||
static void
|
||||
|
@ -1374,35 +1300,29 @@ step_callback (GtkWidget *widget,
|
|||
show_frame();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* tag util. */
|
||||
|
||||
static DisposeType
|
||||
get_frame_disposal (const guint whichframe)
|
||||
get_frame_disposal (guint whichframe)
|
||||
{
|
||||
gchar *layer_name;
|
||||
DisposeType disposal;
|
||||
|
||||
layer_name = gimp_drawable_get_name(layers[total_frames-(whichframe+1)]);
|
||||
disposal = parse_disposal_tag(layer_name);
|
||||
g_free(layer_name);
|
||||
layer_name = gimp_drawable_get_name (layers[total_frames-(whichframe+1)]);
|
||||
disposal = parse_disposal_tag (layer_name);
|
||||
g_free (layer_name);
|
||||
|
||||
return(disposal);
|
||||
return disposal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static guint32
|
||||
get_frame_duration (const guint whichframe)
|
||||
get_frame_duration (guint whichframe)
|
||||
{
|
||||
gchar *layer_name;
|
||||
gint duration = 0;
|
||||
|
||||
layer_name = gimp_drawable_get_name(layers[total_frames-(whichframe+1)]);
|
||||
if (layer_name != NULL)
|
||||
if (layer_name)
|
||||
{
|
||||
duration = parse_ms_tag(layer_name);
|
||||
g_free(layer_name);
|
||||
|
@ -1412,12 +1332,13 @@ get_frame_duration (const guint whichframe)
|
|||
else
|
||||
if (duration == 0) duration = 100; /* FIXME - 0-wait is nasty */
|
||||
|
||||
return ((guint32) duration);
|
||||
return (guint32) duration;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
is_ms_tag (const char *str, int *duration, int *taglength)
|
||||
is_ms_tag (const char *str,
|
||||
int *duration,
|
||||
int *taglength)
|
||||
{
|
||||
gint sum = 0;
|
||||
gint offset;
|
||||
|
@ -1474,7 +1395,6 @@ is_ms_tag (const char *str, int *duration, int *taglength)
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
parse_ms_tag (const char *str)
|
||||
{
|
||||
|
@ -1485,7 +1405,7 @@ parse_ms_tag (const char *str)
|
|||
|
||||
length = strlen(str);
|
||||
|
||||
for (i=0; i<length; i++)
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
if (is_ms_tag (&str[i], &rtn, &dummy))
|
||||
return rtn;
|
||||
|
@ -1494,9 +1414,10 @@ parse_ms_tag (const char *str)
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
is_disposal_tag (const char *str, DisposeType *disposal, int *taglength)
|
||||
is_disposal_tag (const char *str,
|
||||
DisposeType *disposal,
|
||||
int *taglength)
|
||||
{
|
||||
if (strlen(str) != 9)
|
||||
return 0;
|
||||
|
@ -1517,7 +1438,6 @@ is_disposal_tag (const char *str, DisposeType *disposal, int *taglength)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static DisposeType
|
||||
parse_disposal_tag (const char *str)
|
||||
{
|
||||
|
@ -1527,14 +1447,14 @@ parse_disposal_tag (const char *str)
|
|||
|
||||
length = strlen(str);
|
||||
|
||||
for (i=0; i<length; i++)
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
if (is_disposal_tag(&str[i], &rtn, &dummy))
|
||||
if (is_disposal_tag (&str[i], &rtn, &dummy))
|
||||
{
|
||||
return rtn;
|
||||
}
|
||||
}
|
||||
|
||||
return (DISPOSE_UNDEFINED); /* FIXME */
|
||||
return DISPOSE_UNDEFINED; /* FIXME */
|
||||
}
|
||||
|
||||
|
|
|
@ -5,78 +5,22 @@
|
|||
* adam@gimp.org
|
||||
* adam@foxbox.org
|
||||
*
|
||||
* This is part of the GIMP package and falls under the GPL.
|
||||
*/
|
||||
|
||||
/*
|
||||
* REVISION HISTORY:
|
||||
* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 2003-11-23 : version 1.1.2
|
||||
* Improved optimization for GIF and file formats using
|
||||
* compression on a line-by-line basis. See bug #66367.
|
||||
* (Raphaël Quinet)
|
||||
* 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.
|
||||
*
|
||||
* 2003-08-12 : version 1.1.1
|
||||
* Disable the semi-broken background/foreground stuff
|
||||
* unless EXPERIMENTAL_BACKDROP_CODE is defined...
|
||||
* 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.
|
||||
*
|
||||
* 2001-04-28 : version 1.1.0 [ALPHA]
|
||||
* Support automated background (or foreground) removal.
|
||||
* It's half-broken.
|
||||
* Eliminated special optimized frame alignment cases --
|
||||
* we're not trying to be real-time like animationplay
|
||||
* and it complicates the code.
|
||||
*
|
||||
* 2000-08-30 : version 1.0.4
|
||||
* Change default frame duration from 125ms to 100ms for
|
||||
* consistancy.
|
||||
*
|
||||
* 2000-06-05 : version 1.0.3
|
||||
* Fix old bug which could cause errors in evaluating the
|
||||
* final pixel of each composed layer.
|
||||
*
|
||||
* 2000-01-13 : version 1.0.2
|
||||
* Collapse timing of completely optimized-away frames
|
||||
* onto previous surviving frame. Also be looser with
|
||||
* (XXXXX) tag parsing.
|
||||
*
|
||||
* 2000-01-07 : version 1.0.1
|
||||
* PDB interface submitted by Andreas Jaekel
|
||||
* <jaekel@cablecats.de>
|
||||
*
|
||||
* 98.05.17 : version 1.0.0
|
||||
* Finally preserves frame timings / layer names. Has
|
||||
* a progress bar now. No longer beta, I suppose.
|
||||
*
|
||||
* 98.04.19 : version 0.70.0
|
||||
* Plug-in doubles up as Animation UnOptimize too! (This
|
||||
* is somewhat more useful than it sounds.)
|
||||
*
|
||||
* 98.03.16 : version 0.61.0
|
||||
* Support more rare opaque/transparent combinations.
|
||||
*
|
||||
* 97.12.09 : version 0.60.0
|
||||
* Added support for INDEXED* and GRAY* images.
|
||||
*
|
||||
* 97.12.09 : version 0.52.0
|
||||
* Fixed some bugs.
|
||||
*
|
||||
* 97.12.08 : version 0.51.0
|
||||
* Relaxed bounding box on optimized layers marked
|
||||
* 'replace'.
|
||||
*
|
||||
* 97.12.07 : version 0.50.0
|
||||
* Initial release.
|
||||
*/
|
||||
|
||||
/*
|
||||
* BUGS:
|
||||
* ?
|
||||
*/
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* User interface
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -1171,9 +1115,6 @@ do_optimizations (GimpRunMode run_mode,
|
|||
return new_image_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Util. */
|
||||
|
||||
static DisposeType
|
||||
|
@ -1186,11 +1127,9 @@ get_frame_disposal (guint whichframe)
|
|||
disposal = parse_disposal_tag(layer_name);
|
||||
g_free(layer_name);
|
||||
|
||||
return(disposal);
|
||||
return disposal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static guint32
|
||||
get_frame_duration (guint whichframe)
|
||||
{
|
||||
|
@ -1198,7 +1137,7 @@ get_frame_duration (guint whichframe)
|
|||
gint duration = 0;
|
||||
|
||||
layer_name = gimp_drawable_get_name(layers[total_frames-(whichframe+1)]);
|
||||
if (layer_name != NULL)
|
||||
if (layer_name)
|
||||
{
|
||||
duration = parse_ms_tag(layer_name);
|
||||
g_free(layer_name);
|
||||
|
@ -1207,10 +1146,9 @@ get_frame_duration (guint whichframe)
|
|||
if (duration < 0) duration = 100; /* FIXME for default-if-not-said */
|
||||
if (duration == 0) duration = 100; /* FIXME - 0-wait is nasty */
|
||||
|
||||
return ((guint32) duration);
|
||||
return (guint32) duration;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
is_ms_tag (const gchar *str,
|
||||
gint *duration,
|
||||
|
@ -1271,7 +1209,6 @@ is_ms_tag (const gchar *str,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
parse_ms_tag (const char *str)
|
||||
{
|
||||
|
@ -1282,7 +1219,7 @@ parse_ms_tag (const char *str)
|
|||
|
||||
length = strlen (str);
|
||||
|
||||
for (i=0; i<length; i++)
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
if (is_ms_tag (&str[i], &rtn, &dummy))
|
||||
return rtn;
|
||||
|
@ -1291,7 +1228,6 @@ parse_ms_tag (const char *str)
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
is_disposal_tag (const gchar *str,
|
||||
DisposeType *disposal,
|
||||
|
@ -1337,8 +1273,6 @@ parse_disposal_tag (const gchar *str)
|
|||
return DISPOSE_UNDEFINED; /* FIXME */
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
remove_disposal_tag (gchar *dest,
|
||||
gchar *src)
|
||||
|
@ -1367,8 +1301,6 @@ remove_disposal_tag (gchar *dest,
|
|||
dest[offset] = '\0';
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
remove_ms_tag (gchar *dest,
|
||||
gchar *src)
|
||||
|
|
|
@ -382,8 +382,8 @@ lens_dialog (GimpDrawable *drawable)
|
|||
toggle = gtk_radio_button_new_with_mnemonic_from_widget
|
||||
(GTK_RADIO_BUTTON (toggle),
|
||||
gimp_drawable_is_indexed (drawable->drawable_id)
|
||||
? _("_Set Surroundings to Index 0")
|
||||
: _("_Set Surroundings to Background Color"));
|
||||
? _("_Set surroundings to index 0")
|
||||
: _("_Set surroundings to background color"));
|
||||
gtk_box_pack_start(GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), lvals.use_bkgr);
|
||||
gtk_widget_show (toggle);
|
||||
|
@ -395,7 +395,7 @@ lens_dialog (GimpDrawable *drawable)
|
|||
if (gimp_drawable_has_alpha (drawable->drawable_id))
|
||||
{
|
||||
toggle = gtk_radio_button_new_with_mnemonic_from_widget
|
||||
(GTK_RADIO_BUTTON (toggle), _("_Make Surroundings Transparent"));
|
||||
(GTK_RADIO_BUTTON (toggle), _("_Make surroundings transparent"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
lvals.set_transparent);
|
||||
|
@ -409,7 +409,7 @@ lens_dialog (GimpDrawable *drawable)
|
|||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("_Lens Refraction Index:"));
|
||||
label = gtk_label_new_with_mnemonic (_("_Lens refraction index:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
|
|
@ -30,28 +30,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/* Change log:-
|
||||
*
|
||||
* Version 0.5 10 June 1997.
|
||||
* Changes required to work with 0.99.10.
|
||||
*
|
||||
* Version 0.4 20 May 1997.
|
||||
* Fixed problem with using this plugin in GIMP_RUN_NONINTERACTIVE mode
|
||||
*
|
||||
* Version 0.3 8 May 1997.
|
||||
* Make preview work in Quartics words "The Right Way".
|
||||
*
|
||||
* Allow the background to be transparent.
|
||||
*
|
||||
* Version 0.2 1 May 1997 (not released).
|
||||
* Added patches supplied by Tim Mooney mooney@dogbert.cc.ndsu.NoDak.edu
|
||||
* to allow the plug-in to build with Digitals compiler.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
@ -351,7 +331,7 @@ blinds_dialog (void)
|
|||
&bvals.angledsp);
|
||||
|
||||
size_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
||||
_("_Num Segments:"), SCALE_WIDTH, 0,
|
||||
_("_Number of segments:"), SCALE_WIDTH, 0,
|
||||
bvals.numsegs, 1, MAX_FANS, 1, 2, 0,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
|
|
|
@ -55,10 +55,7 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
@ -413,13 +410,6 @@ blur (GimpDrawable *drawable)
|
|||
gint repeat_count;
|
||||
gboolean has_alpha;
|
||||
|
||||
/*
|
||||
* 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);
|
||||
/*
|
||||
* Get the size of the input image. (This will/must be the same
|
||||
|
@ -614,7 +604,7 @@ blur_dialog (void)
|
|||
/* Random Seed */
|
||||
seed_hbox = gimp_random_seed_new (&pivals.blur_seed, &pivals.blur_randomize);
|
||||
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("_Random Seed:"), 0.0, 0.5,
|
||||
_("Random _seed:"), 0.0, 0.5,
|
||||
seed_hbox, 2, TRUE);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label),
|
||||
GIMP_RANDOM_SEED_SPINBUTTON (seed_hbox));
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
|
@ -43,10 +41,10 @@ static void borderaverage (GimpDrawable *drawable,
|
|||
|
||||
static gboolean borderaverage_dialog (void);
|
||||
|
||||
static void add_new_color (gint bytes,
|
||||
guchar *buffer,
|
||||
gint *cube,
|
||||
gint bucket_expo);
|
||||
static void add_new_color (gint bytes,
|
||||
const guchar *buffer,
|
||||
gint *cube,
|
||||
gint bucket_expo);
|
||||
|
||||
|
||||
GimpPlugInInfo PLUG_IN_INFO =
|
||||
|
@ -65,12 +63,14 @@ struct borderaverage_data
|
|||
gint thickness;
|
||||
gint bucket_exponent;
|
||||
}
|
||||
borderaverage_data =
|
||||
|
||||
static borderaverage_data =
|
||||
{
|
||||
3,
|
||||
4
|
||||
};
|
||||
|
||||
static GimpRunMode run_mode;
|
||||
|
||||
MAIN ()
|
||||
|
||||
|
@ -116,7 +116,6 @@ run (const gchar *name,
|
|||
{
|
||||
static GimpParam values[3];
|
||||
GimpDrawable *drawable;
|
||||
GimpRunMode run_mode;
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
GimpRGB result_color;
|
||||
|
||||
|
@ -194,6 +193,30 @@ run (const gchar *name,
|
|||
gimp_drawable_detach (drawable);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
gint x1, x2, y1, y2;
|
||||
gint bucket_expo;
|
||||
gint *cube;
|
||||
} BorderAverageParam_t;
|
||||
|
||||
static void
|
||||
borderaverage_func (gint x,
|
||||
gint y,
|
||||
const guchar *src,
|
||||
gint bpp,
|
||||
gpointer data)
|
||||
{
|
||||
BorderAverageParam_t *param = (BorderAverageParam_t*) data;
|
||||
|
||||
if (x < param->x1 + borderaverage_thickness ||
|
||||
x >= param->x2 - borderaverage_thickness ||
|
||||
y < param->y1 + borderaverage_thickness ||
|
||||
y >= param->y2 - borderaverage_thickness)
|
||||
{
|
||||
add_new_color (bpp, src, param->cube, param->bucket_expo);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
borderaverage (GimpDrawable *drawable,
|
||||
GimpRGB *result)
|
||||
|
@ -207,15 +230,15 @@ borderaverage (GimpDrawable *drawable,
|
|||
guchar *buffer;
|
||||
gint bucket_num, bucket_expo, bucket_rexpo;
|
||||
gint *cube;
|
||||
gint row, col;
|
||||
gint i, j, k; /* index variables */
|
||||
GimpRgnIterator *iter;
|
||||
|
||||
GimpPixelRgn myPR;
|
||||
BorderAverageParam_t param;
|
||||
|
||||
/* allocate and clear the cube before */
|
||||
bucket_expo = borderaverage_bucket_exponent;
|
||||
bucket_rexpo = 8 - bucket_expo;
|
||||
cube = g_new (gint, 1 << (bucket_rexpo * 3));
|
||||
param.cube = cube = g_new (gint, 1 << (bucket_rexpo * 3));
|
||||
bucket_num = 1 << bucket_rexpo;
|
||||
|
||||
for (i = 0; i < bucket_num; i++)
|
||||
|
@ -229,13 +252,12 @@ borderaverage (GimpDrawable *drawable,
|
|||
}
|
||||
}
|
||||
|
||||
/* 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);
|
||||
param.x1 = x1;
|
||||
param.y1 = y1;
|
||||
param.x2 = x2;
|
||||
param.y2 = y2;
|
||||
param.bucket_expo = bucket_expo;
|
||||
|
||||
/* Get the size of the input image. (This will/must be the same
|
||||
* as the size of the output image.
|
||||
|
@ -249,41 +271,9 @@ borderaverage (GimpDrawable *drawable,
|
|||
/* allocate row buffer */
|
||||
buffer = g_new (guchar, (x2 - x1) * bytes);
|
||||
|
||||
/* initialize the pixel regions */
|
||||
gimp_pixel_rgn_init (&myPR, drawable, 0, 0, width, height, FALSE, FALSE);
|
||||
|
||||
/* loop through the rows, performing our magic*/
|
||||
for (row = y1; row < y2; row++)
|
||||
{
|
||||
gimp_pixel_rgn_get_row (&myPR, buffer, x1, row, (x2-x1));
|
||||
|
||||
if (row < y1 + borderaverage_thickness ||
|
||||
row >= y2 - borderaverage_thickness)
|
||||
{
|
||||
/* add the whole row */
|
||||
for (col = 0; col < ((x2 - x1) * bytes); col += bytes)
|
||||
{
|
||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add the left border */
|
||||
for (col = 0; col < (borderaverage_thickness * bytes); col += bytes)
|
||||
{
|
||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
/* add the right border */
|
||||
for (col = ((x2 - x1 - borderaverage_thickness) * bytes);
|
||||
col < ((x2 - x1) * bytes); col += bytes)
|
||||
{
|
||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
}
|
||||
|
||||
if ((row % 5) == 0)
|
||||
gimp_progress_update ((double) row / (double) (y2 - y1));
|
||||
}
|
||||
iter = gimp_rgn_iterator_new (drawable, run_mode);
|
||||
gimp_rgn_iterator_src (iter, borderaverage_func, ¶m);
|
||||
gimp_rgn_iterator_free (iter);
|
||||
|
||||
max = 0; r = 0; g = 0; b = 0;
|
||||
|
||||
|
@ -315,32 +305,18 @@ borderaverage (GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
static void
|
||||
add_new_color (gint bytes,
|
||||
guchar *buffer,
|
||||
gint *cube,
|
||||
gint bucket_expo)
|
||||
add_new_color (gint bytes,
|
||||
const guchar *buffer,
|
||||
gint *cube,
|
||||
gint bucket_expo)
|
||||
{
|
||||
guchar r, g, b;
|
||||
gint bucket_rexpo;
|
||||
|
||||
bucket_rexpo = 8 - bucket_expo;
|
||||
r = buffer[0] >>bucket_expo;
|
||||
if (bytes > 1)
|
||||
{
|
||||
g = buffer[1] >>bucket_expo;
|
||||
}
|
||||
else
|
||||
{
|
||||
g = 0;
|
||||
}
|
||||
if (bytes > 2)
|
||||
{
|
||||
b = buffer[2] >>bucket_expo;
|
||||
}
|
||||
else
|
||||
{
|
||||
b = 0;
|
||||
}
|
||||
r = buffer[0] >> bucket_expo;
|
||||
g = (bytes > 1) ? buffer[1] >> bucket_expo : 0;
|
||||
b = (bytes > 2) ? buffer[2] >> bucket_expo : 0;
|
||||
cube[(r << (bucket_rexpo << 1)) + (g << bucket_rexpo) + b]++;
|
||||
}
|
||||
|
||||
|
@ -412,7 +388,7 @@ borderaverage_dialog (void)
|
|||
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("_Bucket Size:"));
|
||||
label = gtk_label_new_with_mnemonic (_("_Bucket size:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
|
|
@ -965,16 +965,16 @@ bumpmap_dialog (void)
|
|||
G_CALLBACK (dialog_map_type_callback),
|
||||
&bmvals.type, bmvals.type,
|
||||
|
||||
_("_Linear Map"), LINEAR, NULL,
|
||||
_("_Spherical Map"), SPHERICAL, NULL,
|
||||
_("S_inusoidal Map"), SINUSOIDAL, NULL,
|
||||
_("_Linear"), LINEAR, NULL,
|
||||
_("_Spherical"), SPHERICAL, NULL,
|
||||
_("S_inusoidal"), SINUSOIDAL, NULL,
|
||||
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
/* Compensate darkening */
|
||||
button = gtk_check_button_new_with_mnemonic (_("Co_mpensate for Darkening"));
|
||||
button = gtk_check_button_new_with_mnemonic (_("Co_mpensate for darkening"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
bmvals.compensate ? TRUE : FALSE);
|
||||
|
@ -985,7 +985,7 @@ bumpmap_dialog (void)
|
|||
NULL);
|
||||
|
||||
/* Invert bumpmap */
|
||||
button = gtk_check_button_new_with_mnemonic (_("I_nvert Bumpmap"));
|
||||
button = gtk_check_button_new_with_mnemonic (_("I_nvert bumpmap"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
bmvals.invert ? TRUE : FALSE);
|
||||
|
@ -996,7 +996,7 @@ bumpmap_dialog (void)
|
|||
NULL);
|
||||
|
||||
/* Tile bumpmap */
|
||||
button = gtk_check_button_new_with_mnemonic (_("_Tile Bumpmap"));
|
||||
button = gtk_check_button_new_with_mnemonic (_("_Tile bumpmap"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
bmvals.tiled ? TRUE : FALSE);
|
||||
|
@ -1020,7 +1020,7 @@ bumpmap_dialog (void)
|
|||
|
||||
row = 0;
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), row++, 0,
|
||||
_("_Bump Map:"), 1.0, 0.5, combo, 2, FALSE);
|
||||
_("_Bump map:"), 1.0, 0.5, combo, 2, FALSE);
|
||||
|
||||
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
|
||||
_("_Azimuth:"), SCALE_WIDTH, 6,
|
||||
|
@ -1052,7 +1052,7 @@ bumpmap_dialog (void)
|
|||
|
||||
bmint.offset_adj_x = adj =
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
|
||||
_("_X Offset:"), SCALE_WIDTH, 6,
|
||||
_("_X offset:"), SCALE_WIDTH, 6,
|
||||
bmvals.xofs, -1000.0, 1001.0, 1.0, 10.0, 0,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
|
@ -1062,7 +1062,7 @@ bumpmap_dialog (void)
|
|||
|
||||
bmint.offset_adj_y = adj =
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, row,
|
||||
_("_Y Offset:"), SCALE_WIDTH, 6,
|
||||
_("_Y offset:"), SCALE_WIDTH, 6,
|
||||
bmvals.yofs, -1000.0, 1001.0, 1.0, 10.0, 0,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
|
|
|
@ -382,10 +382,7 @@ valid_file (const gchar* filename)
|
|||
|
||||
stat_res = stat (filename, &buf);
|
||||
|
||||
if ((0 == stat_res) && (buf.st_size > 0))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
return 0 == stat_res && buf.st_size > 0;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
|
|
|
@ -21,17 +21,8 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* This simple plug-in does an automatic contrast stretch. For each
|
||||
channel in the image, it finds the minimum and maximum values... it
|
||||
uses those values to stretch the individual histograms to the full
|
||||
contrast range. For some images it may do just what you want; for
|
||||
others it may not work that well */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
@ -154,34 +145,34 @@ indexed_c_astretch (gint32 image_ID)
|
|||
{
|
||||
guchar *cmap;
|
||||
gint ncols, i;
|
||||
gint rhi=0, ghi=0, bhi=0, rlo=255, glo=255, blo=255;
|
||||
gint rhi = 0, ghi = 0, bhi = 0, rlo = 255, glo = 255, blo = 255;
|
||||
|
||||
cmap = gimp_image_get_cmap (image_ID, &ncols);
|
||||
|
||||
if (cmap==NULL)
|
||||
if (!cmap)
|
||||
{
|
||||
printf("c_astretch: cmap was NULL! Quitting...\n");
|
||||
g_message (_("c_astretch: cmap was NULL! Quitting...\n"));
|
||||
gimp_quit();
|
||||
}
|
||||
|
||||
for (i=0;i<ncols;i++)
|
||||
for (i = 0; i < ncols; i++)
|
||||
{
|
||||
if (cmap[i*3 +0] > rhi) rhi=cmap[i*3 +0];
|
||||
if (cmap[i*3 +1] > ghi) ghi=cmap[i*3 +1];
|
||||
if (cmap[i*3 +2] > bhi) bhi=cmap[i*3 +2];
|
||||
if (cmap[i*3 +0] < rlo) rlo=cmap[i*3 +0];
|
||||
if (cmap[i*3 +1] < glo) glo=cmap[i*3 +1];
|
||||
if (cmap[i*3 +2] < blo) blo=cmap[i*3 +2];
|
||||
if (cmap[i * 3 + 0] > rhi) rhi = cmap[i * 3 + 0];
|
||||
if (cmap[i * 3 + 1] > ghi) ghi = cmap[i * 3 + 1];
|
||||
if (cmap[i * 3 + 2] > bhi) bhi = cmap[i * 3 + 2];
|
||||
if (cmap[i * 3 + 0] < rlo) rlo = cmap[i * 3 + 0];
|
||||
if (cmap[i * 3 + 1] < glo) glo = cmap[i * 3 + 1];
|
||||
if (cmap[i * 3 + 2] < blo) blo = cmap[i * 3 + 2];
|
||||
}
|
||||
|
||||
for (i=0;i<ncols;i++)
|
||||
for (i = 0; i < ncols; i++)
|
||||
{
|
||||
if (rhi!=rlo)
|
||||
cmap[i*3 +0] = (255 * (cmap[i*3 +0] - rlo)) / (rhi-rlo);
|
||||
if (ghi!=glo)
|
||||
cmap[i*3 +1] = (255 * (cmap[i*3 +1] - glo)) / (ghi-glo);
|
||||
if (rhi!=rlo)
|
||||
cmap[i*3 +2] = (255 * (cmap[i*3 +2] - blo)) / (bhi-blo);
|
||||
if (rhi != rlo)
|
||||
cmap[i * 3 + 0] = (255 * (cmap[i * 3 + 0] - rlo)) / (rhi - rlo);
|
||||
if (ghi != glo)
|
||||
cmap[i * 3 + 1] = (255 * (cmap[i * 3 + 1] - glo)) / (ghi - glo);
|
||||
if (rhi != rlo)
|
||||
cmap[i * 3 + 2] = (255 * (cmap[i * 3 + 2] - blo)) / (bhi - blo);
|
||||
}
|
||||
|
||||
gimp_image_set_cmap (image_ID, cmap, ncols);
|
||||
|
|
|
@ -24,15 +24,8 @@
|
|||
* Author: robert@experimental.net
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by Manish Singh <yosh@gimp.org> 2003
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
|
|
@ -344,9 +344,6 @@ run (const gchar *name,
|
|||
gimp_drawable_detach (drawable);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static gdouble
|
||||
cm_calculate_norm (CmParamsType *mix,
|
||||
CmChannelType *ch)
|
||||
|
@ -361,9 +358,6 @@ cm_calculate_norm (CmParamsType *mix,
|
|||
return fabs (1 / sum);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static inline guchar
|
||||
cm_mix_pixel (CmChannelType *ch,
|
||||
guchar r,
|
||||
|
@ -375,18 +369,9 @@ cm_mix_pixel (CmChannelType *ch,
|
|||
|
||||
c *= norm;
|
||||
|
||||
if (c > 255.0)
|
||||
c = 255.0;
|
||||
|
||||
if (c < 0.0)
|
||||
c = 0.0;
|
||||
|
||||
return (guchar) c;
|
||||
return (guchar) CLAMP0255 (c);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
channel_mixer (GimpDrawable *drawable)
|
||||
{
|
||||
|
@ -474,9 +459,6 @@ channel_mixer (GimpDrawable *drawable)
|
|||
sel_x1, sel_y1, sel_width, sel_height);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static gboolean
|
||||
cm_dialog (void)
|
||||
{
|
||||
|
@ -587,7 +569,7 @@ cm_dialog (void)
|
|||
gtk_frame_set_label_widget (GTK_FRAME (frame), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("O_utput Channel:"));
|
||||
label = gtk_label_new_with_mnemonic (_("O_utput channel:"));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
@ -701,7 +683,7 @@ cm_dialog (void)
|
|||
|
||||
/* The preserve luminosity toggle */
|
||||
mix.preserve_luminosity_toggle =
|
||||
gtk_check_button_new_with_mnemonic (_("Preserve _Luminosity"));
|
||||
gtk_check_button_new_with_mnemonic (_("Preserve _luminosity"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
|
||||
(mix.preserve_luminosity_toggle),
|
||||
mix.preserve_luminosity_flag);
|
||||
|
@ -735,8 +717,6 @@ cm_dialog (void)
|
|||
G_CALLBACK (cm_save_file_callback),
|
||||
&mix);
|
||||
|
||||
/*........................................................... */
|
||||
|
||||
if (mix.preview_flag)
|
||||
cm_preview (&mix);
|
||||
|
||||
|
@ -749,9 +729,6 @@ cm_dialog (void)
|
|||
return run;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_red_scale_callback (GtkAdjustment *adjustment,
|
||||
CmParamsType *mix)
|
||||
|
@ -776,9 +753,6 @@ cm_red_scale_callback (GtkAdjustment *adjustment,
|
|||
cm_preview (mix);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_green_scale_callback (GtkAdjustment *adjustment,
|
||||
CmParamsType *mix)
|
||||
|
@ -803,9 +777,6 @@ cm_green_scale_callback (GtkAdjustment *adjustment,
|
|||
cm_preview (mix);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_blue_scale_callback (GtkAdjustment *adjustment,
|
||||
CmParamsType *mix)
|
||||
|
@ -830,9 +801,6 @@ cm_blue_scale_callback (GtkAdjustment *adjustment,
|
|||
cm_preview (mix);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_preview (CmParamsType *mix)
|
||||
{
|
||||
|
@ -892,9 +860,6 @@ cm_preview (CmParamsType *mix)
|
|||
g_free (dst);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static mwPreview *
|
||||
mw_preview_build_virgin (GimpDrawable *drawable)
|
||||
{
|
||||
|
@ -921,9 +886,6 @@ mw_preview_build_virgin (GimpDrawable *drawable)
|
|||
return mwp;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static mwPreview *
|
||||
mw_preview_build (GimpDrawable *drawable)
|
||||
{
|
||||
|
@ -965,9 +927,6 @@ mw_preview_build (GimpDrawable *drawable)
|
|||
return mwp;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_preview_callback (GtkWidget *widget,
|
||||
CmParamsType *mix)
|
||||
|
@ -981,9 +940,6 @@ cm_preview_callback (GtkWidget *widget,
|
|||
mix->preview_flag = FALSE;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_monochrome_callback (GtkWidget *widget,
|
||||
CmParamsType *mix)
|
||||
|
@ -1007,9 +963,6 @@ cm_monochrome_callback (GtkWidget *widget,
|
|||
cm_preview (mix);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_preserve_luminosity_callback (GtkWidget *widget,
|
||||
CmParamsType *mix)
|
||||
|
@ -1052,9 +1005,6 @@ cm_settings_filename (CmParamsType *mix)
|
|||
return filename;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_load_file_callback (GtkWidget *widget,
|
||||
CmParamsType *mix)
|
||||
|
@ -1094,9 +1044,6 @@ cm_load_file_callback (GtkWidget *widget,
|
|||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_load_file_response_callback (GtkWidget *dialog,
|
||||
gint response_id,
|
||||
|
@ -1198,9 +1145,6 @@ cm_load_file_response_callback (GtkWidget *dialog,
|
|||
gtk_widget_hide (dialog);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_save_file_callback (GtkWidget *widget,
|
||||
CmParamsType *mix)
|
||||
|
@ -1240,9 +1184,6 @@ cm_save_file_callback (GtkWidget *widget,
|
|||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_save_file_response_callback (GtkWidget *dialog,
|
||||
gint response_id,
|
||||
|
@ -1289,9 +1230,6 @@ cm_save_file_response_callback (GtkWidget *dialog,
|
|||
gtk_widget_hide (dialog);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static gboolean
|
||||
cm_force_overwrite (const gchar *filename,
|
||||
GtkWidget *parent)
|
||||
|
@ -1335,9 +1273,6 @@ cm_force_overwrite (const gchar *filename,
|
|||
return overwrite;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_save_file (CmParamsType *mix,
|
||||
FILE *fp)
|
||||
|
@ -1406,9 +1341,6 @@ cm_save_file (CmParamsType *mix,
|
|||
fclose (fp);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_combo_callback (GtkWidget *widget,
|
||||
CmParamsType *mix)
|
||||
|
@ -1419,9 +1351,6 @@ cm_combo_callback (GtkWidget *widget,
|
|||
cm_set_adjusters (mix);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
*
|
||||
*--------------------------------------------------------------------*/
|
||||
static void
|
||||
cm_set_adjusters (CmParamsType *mix)
|
||||
{
|
||||
|
|
|
@ -22,19 +22,8 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* This simple plug-in does an automatic Saturation stretch. For each
|
||||
channel in the image, it finds the minimum and maximum values... it
|
||||
uses those values to stretch the individual histograms to the full
|
||||
range. For some images it may do just what you want; for others
|
||||
it may not work that well. This version operates in HSV space
|
||||
and preserves hue. Most code is taken from autostretch_hsv */
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
@ -231,7 +220,7 @@ indexed_Color_Enhance (gint32 image_ID)
|
|||
|
||||
if (!cmap)
|
||||
{
|
||||
printf("Color_Enhance: cmap was NULL! Quitting...\n");
|
||||
g_message(_("Color_Enhance: cmap was NULL! Quitting...\n"));
|
||||
gimp_quit();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,20 +19,8 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* Changes:
|
||||
|
||||
1.1
|
||||
-Corrected small bug when calling color selection dialog
|
||||
-Added LUTs to speed things a little bit up
|
||||
|
||||
1.0
|
||||
-First release */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
|
@ -205,9 +193,8 @@ colorify_func (const guchar *src,
|
|||
{
|
||||
gint lum;
|
||||
|
||||
lum = (lum_red_lookup[src[0]] +
|
||||
lum_green_lookup[src[1]] +
|
||||
lum_blue_lookup[src[2]]);
|
||||
lum = lum_red_lookup[src[0]] + lum_green_lookup[src[1]] +
|
||||
lum_blue_lookup[src[2]];
|
||||
|
||||
dest[0] = final_red_lookup[lum];
|
||||
dest[1] = final_green_lookup[lum];
|
||||
|
|
|
@ -328,6 +328,9 @@ colortoalpha_dialog (GimpDrawable *drawable)
|
|||
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
|
||||
hbox, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new (_("From:"));
|
||||
|
@ -345,7 +348,7 @@ colortoalpha_dialog (GimpDrawable *drawable)
|
|||
G_CALLBACK (gimp_color_button_get_color),
|
||||
&pvals.color);
|
||||
|
||||
label = gtk_label_new (_("to Alpha"));
|
||||
label = gtk_label_new (_("to alpha"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
|
|
@ -658,7 +658,7 @@ run_save_dialog (Config *config)
|
|||
*/
|
||||
prefixed_name = gtk_entry_new ();
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("_Prefixed Name:"), 0.0, 0.5,
|
||||
_("_Prefixed name:"), 0.0, 0.5,
|
||||
prefixed_name, 1, FALSE);
|
||||
gtk_entry_set_text (GTK_ENTRY (prefixed_name),
|
||||
config->prefixed_name ? config->prefixed_name : "");
|
||||
|
@ -674,7 +674,7 @@ run_save_dialog (Config *config)
|
|||
|
||||
/* Use Comment
|
||||
*/
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("_Save Comment to File"));
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("_Save comment to file"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
config->use_comment);
|
||||
|
@ -698,7 +698,7 @@ run_save_dialog (Config *config)
|
|||
|
||||
/* Use Macros
|
||||
*/
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("Us_e Macros instead of Struct"));
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("Us_e macros instead of struct"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
config->use_macros);
|
||||
|
@ -710,7 +710,7 @@ run_save_dialog (Config *config)
|
|||
|
||||
/* Use RLE
|
||||
*/
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("Use _1 Byte Run-Length-Encoding"));
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("Use _1 byte Run-Length-Encoding"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
config->use_rle);
|
||||
|
@ -722,7 +722,7 @@ run_save_dialog (Config *config)
|
|||
|
||||
/* Alpha
|
||||
*/
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("Sa_ve Alpha Channel (RGBA/RGB)"));
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("Sa_ve alpha channel (RGBA/RGB)"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
config->alpha);
|
||||
|
|
|
@ -276,7 +276,7 @@ cubism_dialog (void)
|
|||
gtk_widget_show (table);
|
||||
|
||||
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
|
||||
_("_Tile Size:"), SCALE_WIDTH, 5,
|
||||
_("_Tile size:"), SCALE_WIDTH, 5,
|
||||
cvals.tile_size, 0.0, 100.0, 1.0, 10.0, 1,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
|
@ -286,7 +286,7 @@ cubism_dialog (void)
|
|||
|
||||
scale_data =
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
||||
_("T_ile Saturation:"), SCALE_WIDTH, 5,
|
||||
_("T_ile saturation:"), SCALE_WIDTH, 5,
|
||||
cvals.tile_saturation, 0.0, 10.0, 0.1, 1, 1,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
|
@ -294,7 +294,7 @@ cubism_dialog (void)
|
|||
G_CALLBACK (gimp_double_adjustment_update),
|
||||
&cvals.tile_saturation);
|
||||
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("_Use Background Color"));
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("_Use background color"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
|
|
|
@ -1310,7 +1310,7 @@ bender_new_dialog (GimpDrawable *drawable)
|
|||
cd);
|
||||
|
||||
/* The preview toggle */
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("Automatic Pre_view"));
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("Automatic pre_view"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), cd->preview);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_widget_show (toggle);
|
||||
|
@ -1372,7 +1372,7 @@ bender_new_dialog (GimpDrawable *drawable)
|
|||
cd);
|
||||
|
||||
/* The wor_on_copy toggle */
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("Work on Cop_y"));
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("Work on cop_y"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), cd->work_on_copy);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_widget_show (toggle);
|
||||
|
|
Loading…
Reference in New Issue