mirror of https://github.com/GNOME/gimp.git
small cosmetic changes, such as removing tabs.
This commit is contained in:
parent
0632251cff
commit
39bf72558c
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
||||||
|
2003-12-22 DindinX <david@dindinx.org>
|
||||||
|
|
||||||
|
* plug-ins/common/AlienMap.c:
|
||||||
|
* plug-ins/common/AlienMap2.c:
|
||||||
|
* plug-ins/common/CEL.c:
|
||||||
|
* plug-ins/common/aa.c:
|
||||||
|
* plug-ins/common/align_layers.c:
|
||||||
|
* plug-ins/common/animationplay.c:
|
||||||
|
* plug-ins/common/animoptimize.c:
|
||||||
|
* plug-ins/common/apply_lens.c:
|
||||||
|
* plug-ins/common/autocrop.c:
|
||||||
|
* plug-ins/common/blinds.c:
|
||||||
|
* plug-ins/common/blur.c:
|
||||||
|
* plug-ins/common/borderaverage.c:
|
||||||
|
* plug-ins/common/bumpmap.c:
|
||||||
|
* plug-ins/common/bz2.c:
|
||||||
|
* plug-ins/common/c_astretch.c:
|
||||||
|
* plug-ins/common/channel_mixer.c:
|
||||||
|
* plug-ins/common/nova.c: small cosmetic changes, such as removing
|
||||||
|
tabs.
|
||||||
|
|
||||||
2003-12-22 DindinX <david@dindinx.org>
|
2003-12-22 DindinX <david@dindinx.org>
|
||||||
|
|
||||||
* app/gui/user-install-dialog.c (user_install_dialog_run): added a
|
* app/gui/user-install-dialog.c (user_install_dialog_run): added a
|
||||||
|
|
|
@ -1346,10 +1346,10 @@ alienmap_logo_dialog (GtkWidget *parent)
|
||||||
GtkWidget *xframe, *xframe2;
|
GtkWidget *xframe, *xframe2;
|
||||||
GtkWidget *xvbox;
|
GtkWidget *xvbox;
|
||||||
GtkWidget *xhbox;
|
GtkWidget *xhbox;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
guchar *temp, *temp2;
|
guchar *temp, *temp2;
|
||||||
guchar *datapointer;
|
guchar *datapointer;
|
||||||
gint y,x;
|
gint y, x;
|
||||||
|
|
||||||
if (logodlg)
|
if (logodlg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -849,7 +849,7 @@ typedef struct
|
||||||
gdouble greenangle;
|
gdouble greenangle;
|
||||||
gdouble bluefrequency;
|
gdouble bluefrequency;
|
||||||
gdouble blueangle;
|
gdouble blueangle;
|
||||||
gint colormodel;
|
gint colormodel;
|
||||||
gint redmode;
|
gint redmode;
|
||||||
gint greenmode;
|
gint greenmode;
|
||||||
gint bluemode;
|
gint bluemode;
|
||||||
|
@ -864,25 +864,25 @@ typedef struct
|
||||||
|
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (const gchar *name,
|
static void run (const gchar *name,
|
||||||
gint nparams,
|
gint nparams,
|
||||||
const GimpParam *param,
|
const GimpParam *param,
|
||||||
gint *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GimpParam **return_vals);
|
GimpParam **return_vals);
|
||||||
|
|
||||||
static void alienmap2 (GimpDrawable *drawable);
|
static void alienmap2 (GimpDrawable *drawable);
|
||||||
static void transform (guchar*, guchar*, guchar*);
|
static void transform (guchar*, guchar*, guchar*);
|
||||||
|
|
||||||
static gint alienmap2_dialog (void);
|
static gint alienmap2_dialog (void);
|
||||||
static void dialog_update_preview (void);
|
static void dialog_update_preview (void);
|
||||||
static void dialog_scale_update (GtkAdjustment *adjustment,
|
static void dialog_scale_update (GtkAdjustment *adjustment,
|
||||||
gdouble *value);
|
gdouble *value);
|
||||||
static void dialog_response (GtkWidget *widget,
|
static void dialog_response (GtkWidget *widget,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void alienmap2_toggle_update (GtkWidget *widget,
|
static void alienmap2_toggle_update (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void alienmap2_radio_update (GtkWidget *widget,
|
static void alienmap2_radio_update (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void alienmap2_logo_dialog (GtkWidget *parent);
|
static void alienmap2_logo_dialog (GtkWidget *parent);
|
||||||
|
|
||||||
/***** Variables *****/
|
/***** Variables *****/
|
||||||
|
@ -946,22 +946,22 @@ query (void)
|
||||||
static int nreturn_vals = 0;
|
static int nreturn_vals = 0;
|
||||||
|
|
||||||
gimp_install_procedure ("plug_in_alienmap2",
|
gimp_install_procedure ("plug_in_alienmap2",
|
||||||
"AlienMap2 Color Transformation Plug-In",
|
"AlienMap2 Color Transformation Plug-In",
|
||||||
"No help yet. Just try it and you'll see!",
|
"No help yet. Just try it and you'll see!",
|
||||||
"Martin Weber (martweb@gmx.net)",
|
"Martin Weber (martweb@gmx.net)",
|
||||||
"Martin Weber (martweb@gmx.net",
|
"Martin Weber (martweb@gmx.net",
|
||||||
"24th April 1998",
|
"24th April 1998",
|
||||||
N_("<Image>/Filters/Colors/Map/Alien Map _2..."),
|
N_("<Image>/Filters/Colors/Map/Alien Map _2..."),
|
||||||
"RGB*",
|
"RGB*",
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (args), nreturn_vals,
|
G_N_ELEMENTS (args), nreturn_vals,
|
||||||
args, return_vals);
|
args, return_vals);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
transform (guchar *r,
|
transform (guchar *r,
|
||||||
guchar *g,
|
guchar *g,
|
||||||
guchar *b)
|
guchar *b)
|
||||||
{
|
{
|
||||||
if (wvals.colormodel == HSL_MODEL)
|
if (wvals.colormodel == HSL_MODEL)
|
||||||
{
|
{
|
||||||
|
@ -972,15 +972,15 @@ transform (guchar *r,
|
||||||
gimp_rgb_to_hsl (&rgb, &hsl);
|
gimp_rgb_to_hsl (&rgb, &hsl);
|
||||||
|
|
||||||
if (wvals.redmode)
|
if (wvals.redmode)
|
||||||
hsl.h = 0.5 * (1.0 + sin (((2 * hsl.h - 1.0) * wvals.redfrequency +
|
hsl.h = 0.5 * (1.0 + sin (((2 * hsl.h - 1.0) * wvals.redfrequency +
|
||||||
wvals.redangle / 180.0) * G_PI));
|
wvals.redangle / 180.0) * G_PI));
|
||||||
|
|
||||||
if (wvals.greenmode)
|
if (wvals.greenmode)
|
||||||
hsl.s = 0.5 * (1.0 + sin (((2 * hsl.s - 1.0) * wvals.greenfrequency +
|
hsl.s = 0.5 * (1.0 + sin (((2 * hsl.s - 1.0) * wvals.greenfrequency +
|
||||||
wvals.greenangle / 180.0) * G_PI));
|
wvals.greenangle / 180.0) * G_PI));
|
||||||
|
|
||||||
if (wvals.bluemode)
|
if (wvals.bluemode)
|
||||||
hsl.l = 0.5 * (1.0 + sin (((2 * hsl.l - 1.0) * wvals.bluefrequency +
|
hsl.l = 0.5 * (1.0 + sin (((2 * hsl.l - 1.0) * wvals.bluefrequency +
|
||||||
wvals.blueangle / 180.0) * G_PI));
|
wvals.blueangle / 180.0) * G_PI));
|
||||||
|
|
||||||
gimp_hsl_to_rgb (&hsl, &rgb);
|
gimp_hsl_to_rgb (&hsl, &rgb);
|
||||||
|
@ -989,12 +989,12 @@ transform (guchar *r,
|
||||||
else if (wvals.colormodel == RGB_MODEL)
|
else if (wvals.colormodel == RGB_MODEL)
|
||||||
{
|
{
|
||||||
if (wvals.redmode)
|
if (wvals.redmode)
|
||||||
*r = ROUND (127.5 * (1.0 +
|
*r = ROUND (127.5 * (1.0 +
|
||||||
sin (((*r / 127.5 - 1.0) * wvals.redfrequency +
|
sin (((*r / 127.5 - 1.0) * wvals.redfrequency +
|
||||||
wvals.redangle / 180.0) * G_PI)));
|
wvals.redangle / 180.0) * G_PI)));
|
||||||
|
|
||||||
if (wvals.greenmode)
|
if (wvals.greenmode)
|
||||||
*g = ROUND (127.5 * (1.0 +
|
*g = ROUND (127.5 * (1.0 +
|
||||||
sin (((*g / 127.5 - 1.0) * wvals.greenfrequency +
|
sin (((*g / 127.5 - 1.0) * wvals.greenfrequency +
|
||||||
wvals.greenangle / 180.0) * G_PI)));
|
wvals.greenangle / 180.0) * G_PI)));
|
||||||
|
|
||||||
|
@ -1037,28 +1037,28 @@ run (const gchar *name,
|
||||||
|
|
||||||
/* Get information from the dialog */
|
/* Get information from the dialog */
|
||||||
if (!alienmap2_dialog())
|
if (!alienmap2_dialog())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_NONINTERACTIVE:
|
case GIMP_RUN_NONINTERACTIVE:
|
||||||
/* Make sure all the arguments are present */
|
/* Make sure all the arguments are present */
|
||||||
if (nparams != 13)
|
if (nparams != 13)
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
|
|
||||||
if (status == GIMP_PDB_SUCCESS)
|
if (status == GIMP_PDB_SUCCESS)
|
||||||
{
|
{
|
||||||
wvals.redfrequency = param[3].data.d_float;
|
wvals.redfrequency = param[3].data.d_float;
|
||||||
wvals.redangle = param[4].data.d_float;
|
wvals.redangle = param[4].data.d_float;
|
||||||
wvals.greenfrequency = param[5].data.d_float;
|
wvals.greenfrequency = param[5].data.d_float;
|
||||||
wvals.greenangle = param[6].data.d_float;
|
wvals.greenangle = param[6].data.d_float;
|
||||||
wvals.bluefrequency = param[7].data.d_float;
|
wvals.bluefrequency = param[7].data.d_float;
|
||||||
wvals.blueangle = param[8].data.d_float;
|
wvals.blueangle = param[8].data.d_float;
|
||||||
wvals.colormodel = param[9].data.d_int8;
|
wvals.colormodel = param[9].data.d_int8;
|
||||||
wvals.redmode = param[10].data.d_int8 ? TRUE : FALSE;
|
wvals.redmode = param[10].data.d_int8 ? TRUE : FALSE;
|
||||||
wvals.greenmode = param[11].data.d_int8 ? TRUE : FALSE;
|
wvals.greenmode = param[11].data.d_int8 ? TRUE : FALSE;
|
||||||
wvals.bluemode = param[12].data.d_int8 ? TRUE : FALSE;
|
wvals.bluemode = param[12].data.d_int8 ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1078,22 +1078,22 @@ run (const gchar *name,
|
||||||
{
|
{
|
||||||
gimp_progress_init (_("AlienMap2: Transforming..."));
|
gimp_progress_init (_("AlienMap2: Transforming..."));
|
||||||
|
|
||||||
/* Set the tile cache size */
|
/* Set the tile cache size */
|
||||||
gimp_tile_cache_ntiles(2*(drawable->width / gimp_tile_width()+1));
|
gimp_tile_cache_ntiles(2*(drawable->width / gimp_tile_width()+1));
|
||||||
|
|
||||||
/* Run! */
|
/* Run! */
|
||||||
|
|
||||||
alienmap2 (drawable);
|
alienmap2 (drawable);
|
||||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||||
gimp_displays_flush();
|
gimp_displays_flush();
|
||||||
|
|
||||||
/* Store data */
|
/* Store data */
|
||||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||||
gimp_set_data("plug_in_alienmap2", &wvals, sizeof(alienmap2_vals_t));
|
gimp_set_data("plug_in_alienmap2", &wvals, sizeof(alienmap2_vals_t));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* gimp_message("This filter only applies on RGB_MODEL-images"); */
|
/* gimp_message("This filter only applies on RGB_MODEL-images"); */
|
||||||
status = GIMP_PDB_EXECUTION_ERROR;
|
status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1168,7 +1168,7 @@ alienmap2_dialog (void)
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (top_table), 6);
|
gtk_container_set_border_width (GTK_CONTAINER (top_table), 6);
|
||||||
gtk_table_set_row_spacings (GTK_TABLE (top_table), 4);
|
gtk_table_set_row_spacings (GTK_TABLE (top_table), 4);
|
||||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), top_table,
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), top_table,
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
gtk_widget_show (top_table);
|
gtk_widget_show (top_table);
|
||||||
|
|
||||||
/* Preview */
|
/* Preview */
|
||||||
|
@ -1187,65 +1187,65 @@ alienmap2_dialog (void)
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||||
gtk_table_attach (GTK_TABLE (top_table), table, 0, 2, 1, 2,
|
gtk_table_attach (GTK_TABLE (top_table), table, 0, 2, 1, 2,
|
||||||
GTK_EXPAND | GTK_FILL, 0, 0, 0);
|
GTK_EXPAND | GTK_FILL, 0, 0, 0);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
|
||||||
_("R/H-_Frequency:"), SCALE_WIDTH, ENTRY_WIDTH,
|
_("R/H-_Frequency:"), SCALE_WIDTH, ENTRY_WIDTH,
|
||||||
wvals.redfrequency, 0, 5.0, 0.1, 1, 2,
|
wvals.redfrequency, 0, 5.0, 0.1, 1, 2,
|
||||||
TRUE, 0, 0,
|
TRUE, 0, 0,
|
||||||
_("Change frequency of the red/hue channel"),
|
_("Change frequency of the red/hue channel"),
|
||||||
NULL);
|
NULL);
|
||||||
g_signal_connect (adj, "value_changed",
|
g_signal_connect (adj, "value_changed",
|
||||||
G_CALLBACK (dialog_scale_update),
|
G_CALLBACK (dialog_scale_update),
|
||||||
&wvals.redfrequency);
|
&wvals.redfrequency);
|
||||||
|
|
||||||
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
||||||
_("R/H-_Phaseshift:"), SCALE_WIDTH, ENTRY_WIDTH,
|
_("R/H-_Phaseshift:"), SCALE_WIDTH, ENTRY_WIDTH,
|
||||||
wvals.redangle, 0, 360.0, 1, 15, 2,
|
wvals.redangle, 0, 360.0, 1, 15, 2,
|
||||||
TRUE, 0, 0,
|
TRUE, 0, 0,
|
||||||
_("Change angle of the red/hue channel"),
|
_("Change angle of the red/hue channel"),
|
||||||
NULL);
|
NULL);
|
||||||
g_signal_connect (adj, "value_changed",
|
g_signal_connect (adj, "value_changed",
|
||||||
G_CALLBACK (dialog_scale_update),
|
G_CALLBACK (dialog_scale_update),
|
||||||
&wvals.redangle);
|
&wvals.redangle);
|
||||||
|
|
||||||
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
|
||||||
_("G/S-Fr_equency:"), SCALE_WIDTH, ENTRY_WIDTH,
|
_("G/S-Fr_equency:"), SCALE_WIDTH, ENTRY_WIDTH,
|
||||||
wvals.greenfrequency, 0, 5.0, 0.1, 1, 2,
|
wvals.greenfrequency, 0, 5.0, 0.1, 1, 2,
|
||||||
TRUE, 0, 0,
|
TRUE, 0, 0,
|
||||||
_("Change frequency of the green/saturation "
|
_("Change frequency of the green/saturation "
|
||||||
"channel"), NULL);
|
"channel"), NULL);
|
||||||
g_signal_connect (adj, "value_changed",
|
g_signal_connect (adj, "value_changed",
|
||||||
G_CALLBACK (dialog_scale_update),
|
G_CALLBACK (dialog_scale_update),
|
||||||
&wvals.greenfrequency);
|
&wvals.greenfrequency);
|
||||||
|
|
||||||
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 3,
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 3,
|
||||||
_("G/S-Ph_aseshift:"), SCALE_WIDTH, ENTRY_WIDTH,
|
_("G/S-Ph_aseshift:"), SCALE_WIDTH, ENTRY_WIDTH,
|
||||||
wvals.redangle, 0, 360.0, 1, 15, 2,
|
wvals.redangle, 0, 360.0, 1, 15, 2,
|
||||||
TRUE, 0, 0,
|
TRUE, 0, 0,
|
||||||
_("Change angle of the green/saturation channel"),
|
_("Change angle of the green/saturation channel"),
|
||||||
NULL);
|
NULL);
|
||||||
g_signal_connect (adj, "value_changed",
|
g_signal_connect (adj, "value_changed",
|
||||||
G_CALLBACK (dialog_scale_update),
|
G_CALLBACK (dialog_scale_update),
|
||||||
&wvals.greenangle);
|
&wvals.greenangle);
|
||||||
|
|
||||||
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 4,
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 4,
|
||||||
_("B/L-Freq_uency:"), SCALE_WIDTH, ENTRY_WIDTH,
|
_("B/L-Freq_uency:"), SCALE_WIDTH, ENTRY_WIDTH,
|
||||||
wvals.bluefrequency, 0, 5.0, 0.1, 1, 2,
|
wvals.bluefrequency, 0, 5.0, 0.1, 1, 2,
|
||||||
TRUE, 0, 0,
|
TRUE, 0, 0,
|
||||||
_("Change frequency of the blue/luminance "
|
_("Change frequency of the blue/luminance "
|
||||||
"channel"), NULL);
|
"channel"), NULL);
|
||||||
g_signal_connect (adj, "value_changed",
|
g_signal_connect (adj, "value_changed",
|
||||||
G_CALLBACK (dialog_scale_update),
|
G_CALLBACK (dialog_scale_update),
|
||||||
&wvals.bluefrequency);
|
&wvals.bluefrequency);
|
||||||
|
|
||||||
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 5,
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 5,
|
||||||
_("B/L-Pha_seshift:"), SCALE_WIDTH, ENTRY_WIDTH,
|
_("B/L-Pha_seshift:"), SCALE_WIDTH, ENTRY_WIDTH,
|
||||||
wvals.blueangle, 0, 360.0, 1, 15, 2,
|
wvals.blueangle, 0, 360.0, 1, 15, 2,
|
||||||
TRUE, 0, 0,
|
TRUE, 0, 0,
|
||||||
_("Change angle of the blue/luminance channel"),
|
_("Change angle of the blue/luminance channel"),
|
||||||
NULL);
|
NULL);
|
||||||
g_signal_connect (adj, "value_changed",
|
g_signal_connect (adj, "value_changed",
|
||||||
G_CALLBACK (dialog_scale_update),
|
G_CALLBACK (dialog_scale_update),
|
||||||
&wvals.blueangle);
|
&wvals.blueangle);
|
||||||
|
@ -1253,15 +1253,15 @@ alienmap2_dialog (void)
|
||||||
/* Mode toggle box */
|
/* Mode toggle box */
|
||||||
frame =
|
frame =
|
||||||
gimp_int_radio_group_new (TRUE, _("Mode"),
|
gimp_int_radio_group_new (TRUE, _("Mode"),
|
||||||
G_CALLBACK (alienmap2_radio_update),
|
G_CALLBACK (alienmap2_radio_update),
|
||||||
&wvals.colormodel, wvals.colormodel,
|
&wvals.colormodel, wvals.colormodel,
|
||||||
|
|
||||||
_("_RGB Color Model"), RGB_MODEL, NULL,
|
_("_RGB Color Model"), RGB_MODEL, NULL,
|
||||||
_("_HSL Color Model"), HSL_MODEL, NULL,
|
_("_HSL Color Model"), HSL_MODEL, NULL,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
gtk_table_attach (GTK_TABLE (top_table), frame, 1, 2, 0, 1,
|
gtk_table_attach (GTK_TABLE (top_table), frame, 1, 2, 0, 1,
|
||||||
GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
|
GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
|
||||||
|
|
||||||
toggle_vbox = GTK_BIN (frame)->child;
|
toggle_vbox = GTK_BIN (frame)->child;
|
||||||
|
|
||||||
|
@ -1275,7 +1275,7 @@ alienmap2_dialog (void)
|
||||||
gtk_widget_show (toggle);
|
gtk_widget_show (toggle);
|
||||||
|
|
||||||
gimp_help_set_help_data (toggle, _("Use function for red/hue component"),
|
gimp_help_set_help_data (toggle, _("Use function for red/hue component"),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_signal_connect (toggle, "toggled",
|
g_signal_connect (toggle, "toggled",
|
||||||
G_CALLBACK (alienmap2_toggle_update),
|
G_CALLBACK (alienmap2_toggle_update),
|
||||||
|
@ -1287,8 +1287,8 @@ alienmap2_dialog (void)
|
||||||
gtk_widget_show (toggle);
|
gtk_widget_show (toggle);
|
||||||
|
|
||||||
gimp_help_set_help_data (toggle,
|
gimp_help_set_help_data (toggle,
|
||||||
_("Use function for green/saturation component"),
|
_("Use function for green/saturation component"),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_signal_connect (toggle, "toggled",
|
g_signal_connect (toggle, "toggled",
|
||||||
G_CALLBACK (alienmap2_toggle_update),
|
G_CALLBACK (alienmap2_toggle_update),
|
||||||
|
@ -1300,8 +1300,8 @@ alienmap2_dialog (void)
|
||||||
gtk_widget_show (toggle);
|
gtk_widget_show (toggle);
|
||||||
|
|
||||||
gimp_help_set_help_data (toggle,
|
gimp_help_set_help_data (toggle,
|
||||||
_("Use function for blue/luminance component"),
|
_("Use function for blue/luminance component"),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_signal_connect (toggle, "toggled",
|
g_signal_connect (toggle, "toggled",
|
||||||
G_CALLBACK (alienmap2_toggle_update),
|
G_CALLBACK (alienmap2_toggle_update),
|
||||||
|
@ -1326,7 +1326,7 @@ dialog_update_preview (void)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_scale_update (GtkAdjustment *adjustment,
|
dialog_scale_update (GtkAdjustment *adjustment,
|
||||||
gdouble *value)
|
gdouble *value)
|
||||||
{
|
{
|
||||||
gimp_double_adjustment_update (adjustment, value);
|
gimp_double_adjustment_update (adjustment, value);
|
||||||
|
|
||||||
|
@ -1355,7 +1355,7 @@ dialog_response (GtkWidget *widget,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
alienmap2_toggle_update (GtkWidget *widget,
|
alienmap2_toggle_update (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gimp_toggle_button_update (widget, data);
|
gimp_toggle_button_update (widget, data);
|
||||||
|
|
||||||
|
@ -1364,7 +1364,7 @@ alienmap2_toggle_update (GtkWidget *widget,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
alienmap2_radio_update (GtkWidget *widget,
|
alienmap2_radio_update (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gimp_radio_button_update (widget, data);
|
gimp_radio_button_update (widget, data);
|
||||||
|
|
||||||
|
@ -1381,10 +1381,10 @@ alienmap2_logo_dialog (GtkWidget *parent)
|
||||||
GtkWidget *xframe, *xframe2;
|
GtkWidget *xframe, *xframe2;
|
||||||
GtkWidget *xvbox;
|
GtkWidget *xvbox;
|
||||||
GtkWidget *xhbox;
|
GtkWidget *xhbox;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
guchar *temp, *temp2;
|
guchar *temp, *temp2;
|
||||||
guchar *datapointer;
|
guchar *datapointer;
|
||||||
gint y,x;
|
gint y, x;
|
||||||
|
|
||||||
if (logodlg)
|
if (logodlg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* History:
|
/* History:
|
||||||
* 0.1 Very limited functionality (modern 4bit only)
|
* 0.1 Very limited functionality (modern 4bit only)
|
||||||
* 0.2 Default palette (nice yellows) is automatically used
|
* 0.2 Default palette (nice yellows) is automatically used
|
||||||
* 0.3 Support for the older (pre KISS/GS) cell format
|
* 0.3 Support for the older (pre KISS/GS) cell format
|
||||||
* 0.4 First support for saving images
|
* 0.4 First support for saving images
|
||||||
|
@ -41,24 +41,24 @@
|
||||||
|
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (const gchar *name,
|
static void run (const gchar *name,
|
||||||
gint nparams,
|
gint nparams,
|
||||||
const GimpParam *param,
|
const GimpParam *param,
|
||||||
gint *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GimpParam **return_vals);
|
GimpParam **return_vals);
|
||||||
|
|
||||||
static gint load_palette (FILE *fp,
|
static gint load_palette (FILE *fp,
|
||||||
guchar palette[]);
|
guchar palette[]);
|
||||||
static gint32 load_image (const gchar *file,
|
static gint32 load_image (const gchar *file,
|
||||||
const gchar *brief);
|
const gchar *brief);
|
||||||
static gint save_image (const gchar *file,
|
static gint save_image (const gchar *file,
|
||||||
const gchar *brief,
|
const gchar *brief,
|
||||||
gint32 image,
|
gint32 image,
|
||||||
gint32 layer);
|
gint32 layer);
|
||||||
static void palette_dialog (const gchar *title);
|
static void palette_dialog (const gchar *title);
|
||||||
|
|
||||||
/* Globals... */
|
/* Globals... */
|
||||||
|
|
||||||
GimpPlugInInfo PLUG_IN_INFO =
|
GimpPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
NULL, /* init_proc */
|
NULL, /* init_proc */
|
||||||
NULL, /* quit_proc */
|
NULL, /* quit_proc */
|
||||||
|
@ -101,37 +101,37 @@ query (void)
|
||||||
};
|
};
|
||||||
|
|
||||||
gimp_install_procedure ("file_cel_load",
|
gimp_install_procedure ("file_cel_load",
|
||||||
"Loads files in KISS CEL file format",
|
"Loads files in KISS CEL file format",
|
||||||
"This plug-in loads individual KISS cell files.",
|
"This plug-in loads individual KISS cell files.",
|
||||||
"Nick Lamb",
|
"Nick Lamb",
|
||||||
"Nick Lamb <njl195@zepler.org.uk>",
|
"Nick Lamb <njl195@zepler.org.uk>",
|
||||||
"May 1998",
|
"May 1998",
|
||||||
"<Load>/CEL",
|
"<Load>/CEL",
|
||||||
NULL,
|
NULL,
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (load_args),
|
G_N_ELEMENTS (load_args),
|
||||||
G_N_ELEMENTS (load_return_vals),
|
G_N_ELEMENTS (load_return_vals),
|
||||||
load_args, load_return_vals);
|
load_args, load_return_vals);
|
||||||
|
|
||||||
gimp_install_procedure ("file_cel_save",
|
gimp_install_procedure ("file_cel_save",
|
||||||
"Saves files in KISS CEL file format",
|
"Saves files in KISS CEL file format",
|
||||||
"This plug-in saves individual KISS cell files.",
|
"This plug-in saves individual KISS cell files.",
|
||||||
"Nick Lamb",
|
"Nick Lamb",
|
||||||
"Nick Lamb <njl195@zepler.org.uk>",
|
"Nick Lamb <njl195@zepler.org.uk>",
|
||||||
"May 1998",
|
"May 1998",
|
||||||
"<Save>/CEL",
|
"<Save>/CEL",
|
||||||
"INDEXEDA",
|
"INDEXEDA",
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (save_args), 0,
|
G_N_ELEMENTS (save_args), 0,
|
||||||
save_args, NULL);
|
save_args, NULL);
|
||||||
|
|
||||||
gimp_register_magic_load_handler ("file_cel_load",
|
gimp_register_magic_load_handler ("file_cel_load",
|
||||||
"cel",
|
"cel",
|
||||||
"",
|
"",
|
||||||
"0,string,KiSS\\040");
|
"0,string,KiSS\\040");
|
||||||
gimp_register_save_handler ("file_cel_save",
|
gimp_register_save_handler ("file_cel_save",
|
||||||
"cel",
|
"cel",
|
||||||
"");
|
"");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -160,58 +160,58 @@ run (const gchar *name,
|
||||||
if (strcmp (name, "file_cel_load") == 0)
|
if (strcmp (name, "file_cel_load") == 0)
|
||||||
{
|
{
|
||||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||||
{
|
{
|
||||||
gimp_get_data ("file_cel_save:length", &data_length);
|
gimp_get_data ("file_cel_save:length", &data_length);
|
||||||
if (data_length > 0)
|
if (data_length > 0)
|
||||||
{
|
{
|
||||||
palette_file = (char *) g_malloc(data_length);
|
palette_file = g_malloc(data_length);
|
||||||
gimp_get_data ("file_cel_save:data", palette_file);
|
gimp_get_data ("file_cel_save:data", palette_file);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
palette_file = g_strdup("*.kcf");
|
palette_file = g_strdup("*.kcf");
|
||||||
data_length = strlen(palette_file) + 1;
|
data_length = strlen(palette_file) + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (run_mode == GIMP_RUN_NONINTERACTIVE)
|
if (run_mode == GIMP_RUN_NONINTERACTIVE)
|
||||||
{
|
{
|
||||||
palette_file = param[3].data.d_string;
|
palette_file = param[3].data.d_string;
|
||||||
data_length = strlen(palette_file) + 1;
|
data_length = strlen(palette_file) + 1;
|
||||||
}
|
}
|
||||||
else if (run_mode == GIMP_RUN_INTERACTIVE)
|
else if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||||
{
|
{
|
||||||
/* Let user choose KCF palette (cancel ignores) */
|
/* Let user choose KCF palette (cancel ignores) */
|
||||||
palette_dialog (_("Load KISS Palette"));
|
palette_dialog (_("Load KISS Palette"));
|
||||||
gimp_set_data ("file_cel_save:length", &data_length, sizeof (size_t));
|
gimp_set_data ("file_cel_save:length", &data_length, sizeof (size_t));
|
||||||
gimp_set_data ("file_cel_save:data", palette_file, data_length);
|
gimp_set_data ("file_cel_save:data", palette_file, data_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
image = load_image (param[1].data.d_string, param[2].data.d_string);
|
image = load_image (param[1].data.d_string, param[2].data.d_string);
|
||||||
|
|
||||||
if (image != -1)
|
if (image != -1)
|
||||||
{
|
{
|
||||||
*nreturn_vals = 2;
|
*nreturn_vals = 2;
|
||||||
values[1].type = GIMP_PDB_IMAGE;
|
values[1].type = GIMP_PDB_IMAGE;
|
||||||
values[1].data.d_image = image;
|
values[1].data.d_image = image;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_EXECUTION_ERROR;
|
status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp (name, "file_cel_save") == 0)
|
else if (strcmp (name, "file_cel_save") == 0)
|
||||||
{
|
{
|
||||||
if (! save_image (param[3].data.d_string, param[4].data.d_string,
|
if (! save_image (param[3].data.d_string, param[4].data.d_string,
|
||||||
param[1].data.d_int32, param[2].data.d_int32))
|
param[1].data.d_int32, param[2].data.d_int32))
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_EXECUTION_ERROR;
|
status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gimp_set_data ("file_cel_save:length", &data_length, sizeof (size_t));
|
gimp_set_data ("file_cel_save:length", &data_length, sizeof (size_t));
|
||||||
gimp_set_data ("file_cel_save:data", palette_file, data_length);
|
gimp_set_data ("file_cel_save:data", palette_file, data_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -225,7 +225,7 @@ run (const gchar *name,
|
||||||
|
|
||||||
static gint32
|
static gint32
|
||||||
load_image (const gchar *file,
|
load_image (const gchar *file,
|
||||||
const gchar *brief)
|
const gchar *brief)
|
||||||
{
|
{
|
||||||
FILE *fp; /* Read file pointer */
|
FILE *fp; /* Read file pointer */
|
||||||
gchar *progress; /* Title for progress display */
|
gchar *progress; /* Title for progress display */
|
||||||
|
@ -294,7 +294,7 @@ load_image (const gchar *file,
|
||||||
/* Create an indexed-alpha layer to hold the image... */
|
/* Create an indexed-alpha layer to hold the image... */
|
||||||
|
|
||||||
layer = gimp_layer_new (image, _("Background"), width, height,
|
layer = gimp_layer_new (image, _("Background"), width, height,
|
||||||
GIMP_INDEXEDA_IMAGE, 100, GIMP_NORMAL_MODE);
|
GIMP_INDEXEDA_IMAGE, 100, GIMP_NORMAL_MODE);
|
||||||
gimp_image_add_layer (image, layer, 0);
|
gimp_image_add_layer (image, layer, 0);
|
||||||
gimp_layer_set_offsets (layer, offx, offy);
|
gimp_layer_set_offsets (layer, offx, offy);
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ load_image (const gchar *file,
|
||||||
drawable = gimp_drawable_get (layer);
|
drawable = gimp_drawable_get (layer);
|
||||||
|
|
||||||
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width,
|
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width,
|
||||||
drawable->height, TRUE, FALSE);
|
drawable->height, TRUE, FALSE);
|
||||||
|
|
||||||
/* Read the image in and give it to the GIMP a line at a time */
|
/* Read the image in and give it to the GIMP a line at a time */
|
||||||
|
|
||||||
|
@ -313,55 +313,55 @@ load_image (const gchar *file,
|
||||||
for (i = 0; i < height && !feof(fp); ++i)
|
for (i = 0; i < height && !feof(fp); ++i)
|
||||||
{
|
{
|
||||||
switch (colours)
|
switch (colours)
|
||||||
{
|
{
|
||||||
case 16:
|
case 16:
|
||||||
fread (buffer, (width+1)/2, 1, fp);
|
fread (buffer, (width+1)/2, 1, fp);
|
||||||
for (j = 0, k = 0; j < width*2; j+= 4, ++k)
|
for (j = 0, k = 0; j < width*2; j+= 4, ++k)
|
||||||
{
|
{
|
||||||
if (buffer[k] / 16 == 0)
|
if (buffer[k] / 16 == 0)
|
||||||
{
|
{
|
||||||
line[j]= 16;
|
line[j]= 16;
|
||||||
line[j+1]= 0;
|
line[j+1]= 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
line[j]= (buffer[k] / 16) - 1;
|
line[j]= (buffer[k] / 16) - 1;
|
||||||
line[j+1]= 255;
|
line[j+1]= 255;
|
||||||
}
|
}
|
||||||
if (buffer[k] % 16 == 0)
|
if (buffer[k] % 16 == 0)
|
||||||
{
|
{
|
||||||
line[j+2]= 16;
|
line[j+2]= 16;
|
||||||
line[j+3]= 0;
|
line[j+3]= 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
line[j+2]= (buffer[k] % 16) - 1;
|
line[j+2]= (buffer[k] % 16) - 1;
|
||||||
line[j+3]= 255;
|
line[j+3]= 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 256:
|
case 256:
|
||||||
fread (buffer, width, 1, fp);
|
fread (buffer, width, 1, fp);
|
||||||
for (j = 0, k = 0; j < width*2; j+= 2, ++k)
|
for (j = 0, k = 0; j < width*2; j+= 2, ++k)
|
||||||
{
|
{
|
||||||
if (buffer[k] == 0)
|
if (buffer[k] == 0)
|
||||||
{
|
{
|
||||||
line[j]= 255;
|
line[j]= 255;
|
||||||
line[j+1]= 0;
|
line[j+1]= 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
line[j]= buffer[k] - 1;
|
line[j]= buffer[k] - 1;
|
||||||
line[j+1]= 255;
|
line[j+1]= 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_message (_("Unsupported number of colors (%d)"), colours);
|
g_message (_("Unsupported number of colors (%d)"), colours);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_pixel_rgn_set_rect (&pixel_rgn, line, 0, i, drawable->width, 1);
|
gimp_pixel_rgn_set_rect (&pixel_rgn, line, 0, i, drawable->width, 1);
|
||||||
gimp_progress_update ((float) i / (float) height);
|
gimp_progress_update ((float) i / (float) height);
|
||||||
|
@ -394,9 +394,9 @@ load_image (const gchar *file,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i= 0; i < colours; ++i)
|
for (i= 0; i < colours; ++i)
|
||||||
{
|
{
|
||||||
palette[i*3] = palette[i*3+1] = palette[i*3+2]= i * 256 / colours;
|
palette[i*3] = palette[i*3+1] = palette[i*3+2]= i * 256 / colours;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_image_set_cmap (image, palette + 3, colours - 1);
|
gimp_image_set_cmap (image, palette + 3, colours - 1);
|
||||||
|
@ -415,11 +415,11 @@ load_image (const gchar *file,
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
load_palette (FILE *fp,
|
load_palette (FILE *fp,
|
||||||
guchar palette[])
|
guchar palette[])
|
||||||
{
|
{
|
||||||
guchar header[32]; /* File header */
|
guchar header[32]; /* File header */
|
||||||
guchar buffer[2];
|
guchar buffer[2];
|
||||||
int i, bpp, colours= 0;
|
int i, bpp, colours= 0;
|
||||||
|
|
||||||
fread (header, 4, 1, fp);
|
fread (header, 4, 1, fp);
|
||||||
if (!strncmp(header, "KiSS", 4))
|
if (!strncmp(header, "KiSS", 4))
|
||||||
|
@ -428,31 +428,31 @@ load_palette (FILE *fp,
|
||||||
bpp = header[5];
|
bpp = header[5];
|
||||||
colours = header[8] + header[9] * 256;
|
colours = header[8] + header[9] * 256;
|
||||||
if (bpp == 12)
|
if (bpp == 12)
|
||||||
{
|
{
|
||||||
for (i= 0; i < colours; ++i)
|
for (i= 0; i < colours; ++i)
|
||||||
{
|
{
|
||||||
fread (buffer, 1, 2, fp);
|
fread (buffer, 1, 2, fp);
|
||||||
palette[i*3]= buffer[0] & 0xf0;
|
palette[i*3]= buffer[0] & 0xf0;
|
||||||
palette[i*3+1]= (buffer[1] & 0x0f) * 16;
|
palette[i*3+1]= (buffer[1] & 0x0f) * 16;
|
||||||
palette[i*3+2]= (buffer[0] & 0x0f) * 16;
|
palette[i*3+2]= (buffer[0] & 0x0f) * 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fread (palette, colours, 3, fp);
|
fread (palette, colours, 3, fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
colours = 16; bpp = 12;
|
colours = 16; bpp = 12;
|
||||||
fseek (fp, 0, SEEK_SET);
|
fseek (fp, 0, SEEK_SET);
|
||||||
for (i= 0; i < colours; ++i)
|
for (i= 0; i < colours; ++i)
|
||||||
{
|
{
|
||||||
fread (buffer, 1, 2, fp);
|
fread (buffer, 1, 2, fp);
|
||||||
palette[i*3] = buffer[0] & 0xf0;
|
palette[i*3] = buffer[0] & 0xf0;
|
||||||
palette[i*3+1] = (buffer[1] & 0x0f) * 16;
|
palette[i*3+1] = (buffer[1] & 0x0f) * 16;
|
||||||
palette[i*3+2] = (buffer[0] & 0x0f) * 16;
|
palette[i*3+2] = (buffer[0] & 0x0f) * 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return colours;
|
return colours;
|
||||||
|
@ -460,9 +460,9 @@ load_palette (FILE *fp,
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
save_image (const gchar *file,
|
save_image (const gchar *file,
|
||||||
const gchar *brief,
|
const gchar *brief,
|
||||||
gint32 image,
|
gint32 image,
|
||||||
gint32 layer)
|
gint32 layer)
|
||||||
{
|
{
|
||||||
FILE *fp; /* Write file pointer */
|
FILE *fp; /* Write file pointer */
|
||||||
char *progress; /* Title for progress display */
|
char *progress; /* Title for progress display */
|
||||||
|
@ -533,7 +533,7 @@ save_image (const gchar *file,
|
||||||
|
|
||||||
/* Arrange for memory etc. */
|
/* Arrange for memory etc. */
|
||||||
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width,
|
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width,
|
||||||
drawable->height, TRUE, FALSE);
|
drawable->height, TRUE, FALSE);
|
||||||
buffer = g_new (guchar, drawable->width);
|
buffer = g_new (guchar, drawable->width);
|
||||||
line = g_new (guchar, (drawable->width+1) * 2);
|
line = g_new (guchar, (drawable->width+1) * 2);
|
||||||
|
|
||||||
|
@ -544,32 +544,32 @@ save_image (const gchar *file,
|
||||||
memset (buffer, 0, drawable->width);
|
memset (buffer, 0, drawable->width);
|
||||||
|
|
||||||
if (colours > 16)
|
if (colours > 16)
|
||||||
{
|
{
|
||||||
for (j = 0, k = 0; j < drawable->width*2; j+= 2, ++k)
|
for (j = 0, k = 0; j < drawable->width*2; j+= 2, ++k)
|
||||||
{
|
{
|
||||||
if (line[j+1] > 127)
|
if (line[j+1] > 127)
|
||||||
{
|
{
|
||||||
buffer[k]= line[j] + 1;
|
buffer[k]= line[j] + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fwrite (buffer, drawable->width, 1, fp);
|
fwrite (buffer, drawable->width, 1, fp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (j = 0, k = 0; j < drawable->width*2; j+= 4, ++k)
|
for (j = 0, k = 0; j < drawable->width*2; j+= 4, ++k)
|
||||||
{
|
{
|
||||||
buffer[k] = 0;
|
buffer[k] = 0;
|
||||||
if (line[j+1] > 127)
|
if (line[j+1] > 127)
|
||||||
{
|
{
|
||||||
buffer[k] += (line[j] + 1)<< 4;
|
buffer[k] += (line[j] + 1)<< 4;
|
||||||
}
|
}
|
||||||
if (line[j+3] > 127)
|
if (line[j+3] > 127)
|
||||||
{
|
{
|
||||||
buffer[k] += (line[j+2] + 1);
|
buffer[k] += (line[j+2] + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fwrite (buffer, (drawable->width+1)/2, 1, fp);
|
fwrite (buffer, (drawable->width+1)/2, 1, fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_progress_update ((float) i / (float) drawable->height);
|
gimp_progress_update ((float) i / (float) drawable->height);
|
||||||
}
|
}
|
||||||
|
@ -594,7 +594,7 @@ palette_dialog (const gchar *title)
|
||||||
gtk_file_selection_set_filename (GTK_FILE_SELECTION (dialog), palette_file);
|
gtk_file_selection_set_filename (GTK_FILE_SELECTION (dialog), palette_file);
|
||||||
|
|
||||||
gimp_help_connect (dialog, gimp_standard_help_func,
|
gimp_help_connect (dialog, gimp_standard_help_func,
|
||||||
"filters/cel.html", NULL);
|
"filters/cel.html", NULL);
|
||||||
|
|
||||||
gtk_widget_show (dialog);
|
gtk_widget_show (dialog);
|
||||||
|
|
||||||
|
|
|
@ -76,21 +76,21 @@ query (void)
|
||||||
};
|
};
|
||||||
|
|
||||||
gimp_install_procedure ("file_aa_save",
|
gimp_install_procedure ("file_aa_save",
|
||||||
"Saves grayscale image in various text formats",
|
"Saves grayscale image in various text formats",
|
||||||
"This plug-in uses aalib to save grayscale image "
|
"This plug-in uses aalib to save grayscale image "
|
||||||
"as ascii art into a variety of text formats",
|
"as ascii art into a variety of text formats",
|
||||||
"Tim Newsome <nuisance@cmu.edu>",
|
"Tim Newsome <nuisance@cmu.edu>",
|
||||||
"Tim Newsome <nuisance@cmu.edu>",
|
"Tim Newsome <nuisance@cmu.edu>",
|
||||||
"1997",
|
"1997",
|
||||||
"<Save>/AA",
|
"<Save>/AA",
|
||||||
"RGB*, GRAY*",
|
"RGB*, GRAY*",
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (save_args), 0,
|
G_N_ELEMENTS (save_args), 0,
|
||||||
save_args, NULL);
|
save_args, NULL);
|
||||||
|
|
||||||
gimp_register_save_handler ("file_aa_save",
|
gimp_register_save_handler ("file_aa_save",
|
||||||
"ansi,txt,text",
|
"ansi,txt,text",
|
||||||
"");
|
"");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -149,14 +149,14 @@ run (const gchar *name,
|
||||||
case GIMP_RUN_WITH_LAST_VALS:
|
case GIMP_RUN_WITH_LAST_VALS:
|
||||||
gimp_ui_init ("aa", FALSE);
|
gimp_ui_init ("aa", FALSE);
|
||||||
export = gimp_export_image (&image_ID, &drawable_ID, "AA",
|
export = gimp_export_image (&image_ID, &drawable_ID, "AA",
|
||||||
(GIMP_EXPORT_CAN_HANDLE_RGB |
|
(GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||||
GIMP_EXPORT_CAN_HANDLE_ALPHA ));
|
GIMP_EXPORT_CAN_HANDLE_ALPHA ));
|
||||||
if (export == GIMP_EXPORT_CANCEL)
|
if (export == GIMP_EXPORT_CANCEL)
|
||||||
{
|
{
|
||||||
values[0].data.d_status = GIMP_PDB_CANCEL;
|
values[0].data.d_status = GIMP_PDB_CANCEL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -171,47 +171,47 @@ run (const gchar *name,
|
||||||
if (status == GIMP_PDB_SUCCESS)
|
if (status == GIMP_PDB_SUCCESS)
|
||||||
{
|
{
|
||||||
switch (run_mode)
|
switch (run_mode)
|
||||||
{
|
{
|
||||||
case GIMP_RUN_INTERACTIVE:
|
case GIMP_RUN_INTERACTIVE:
|
||||||
gimp_get_data ("file_aa_save", &output_type);
|
gimp_get_data ("file_aa_save", &output_type);
|
||||||
output_type = type_dialog (output_type);
|
output_type = type_dialog (output_type);
|
||||||
if (output_type < 0)
|
if (output_type < 0)
|
||||||
status = GIMP_PDB_CANCEL;
|
status = GIMP_PDB_CANCEL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_NONINTERACTIVE:
|
case GIMP_RUN_NONINTERACTIVE:
|
||||||
/* Make sure all the arguments are there! */
|
/* Make sure all the arguments are there! */
|
||||||
if (nparams != 6)
|
if (nparams != 6)
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output_type = get_type_from_string (param[5].data.d_string);
|
output_type = get_type_from_string (param[5].data.d_string);
|
||||||
if (output_type < 0)
|
if (output_type < 0)
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_WITH_LAST_VALS:
|
case GIMP_RUN_WITH_LAST_VALS:
|
||||||
gimp_get_data ("file_aa_save", &output_type);
|
gimp_get_data ("file_aa_save", &output_type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == GIMP_PDB_SUCCESS)
|
if (status == GIMP_PDB_SUCCESS)
|
||||||
{
|
{
|
||||||
if (save_aa (drawable_ID, param[3].data.d_string, output_type))
|
if (save_aa (drawable_ID, param[3].data.d_string, output_type))
|
||||||
{
|
{
|
||||||
gimp_set_data ("file_aa_save", &output_type, sizeof (output_type));
|
gimp_set_data ("file_aa_save", &output_type, sizeof (output_type));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_EXECUTION_ERROR;
|
status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (export == GIMP_EXPORT_EXPORT)
|
if (export == GIMP_EXPORT_EXPORT)
|
||||||
|
@ -253,7 +253,7 @@ save_aa (gint32 drawable_ID,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp2aa (gint32 drawable_ID,
|
gimp2aa (gint32 drawable_ID,
|
||||||
aa_context *context)
|
aa_context *context)
|
||||||
{
|
{
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
GimpPixelRgn pixel_rgn;
|
GimpPixelRgn pixel_rgn;
|
||||||
|
@ -321,7 +321,7 @@ gimp2aa (gint32 drawable_ID,
|
||||||
renderparams->dither = AA_FLOYD_S;
|
renderparams->dither = AA_FLOYD_S;
|
||||||
|
|
||||||
aa_render (context, renderparams, 0, 0,
|
aa_render (context, renderparams, 0, 0,
|
||||||
aa_scrwidth (context), aa_scrheight (context));
|
aa_scrwidth (context), aa_scrheight (context));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -340,12 +340,12 @@ type_dialog (gint selected)
|
||||||
/* Create the actual window. */
|
/* Create the actual window. */
|
||||||
dlg = gimp_dialog_new (_("Save as Text"), "aa",
|
dlg = gimp_dialog_new (_("Save as Text"), "aa",
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
gimp_standard_help_func, "filters/aa.html",
|
gimp_standard_help_func, "filters/aa.html",
|
||||||
|
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* file save type */
|
/* file save type */
|
||||||
frame = gtk_frame_new (_("Data Formatting"));
|
frame = gtk_frame_new (_("Data Formatting"));
|
||||||
|
@ -363,20 +363,20 @@ type_dialog (gint selected)
|
||||||
|
|
||||||
while (*p != NULL)
|
while (*p != NULL)
|
||||||
{
|
{
|
||||||
toggle = gtk_radio_button_new_with_label (group, (*p)->formatname);
|
toggle = gtk_radio_button_new_with_label (group, (*p)->formatname);
|
||||||
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
|
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
|
||||||
gtk_box_pack_start (GTK_BOX (toggle_vbox), toggle, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (toggle_vbox), toggle, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (toggle);
|
gtk_widget_show (toggle);
|
||||||
|
|
||||||
g_signal_connect (toggle, "toggled",
|
g_signal_connect (toggle, "toggled",
|
||||||
G_CALLBACK (type_dialog_toggle_update),
|
G_CALLBACK (type_dialog_toggle_update),
|
||||||
(gpointer) (*p)->formatname);
|
(gpointer) (*p)->formatname);
|
||||||
|
|
||||||
if (current == selected)
|
if (current == selected)
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), TRUE);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), TRUE);
|
||||||
|
|
||||||
p++;
|
p++;
|
||||||
current++;
|
current++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ type_dialog (gint selected)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
type_dialog_toggle_update (GtkWidget *widget,
|
type_dialog_toggle_update (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
selected_type = get_type_from_string ((const gchar *) data);
|
selected_type = get_type_from_string ((const gchar *) data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
#define PLUG_IN_NAME "plug_in_align_layers"
|
#define PLUG_IN_NAME "plug_in_align_layers"
|
||||||
#define SHORT_NAME "align_layers"
|
#define SHORT_NAME "align_layers"
|
||||||
#define SCALE_WIDTH 150
|
#define SCALE_WIDTH 150
|
||||||
|
|
||||||
|
@ -69,17 +69,17 @@ enum
|
||||||
V_BASE_BOTTOM
|
V_BASE_BOTTOM
|
||||||
};
|
};
|
||||||
|
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (const gchar *name,
|
static void run (const gchar *name,
|
||||||
gint nparams,
|
gint nparams,
|
||||||
const GimpParam *param,
|
const GimpParam *param,
|
||||||
gint *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GimpParam **return_vals);
|
GimpParam **return_vals);
|
||||||
|
|
||||||
static GimpPDBStatusType align_layers (gint32 image_id);
|
static GimpPDBStatusType align_layers (gint32 image_id);
|
||||||
static void align_layers_get_align_offsets (gint32 drawable_id,
|
static void align_layers_get_align_offsets (gint32 drawable_id,
|
||||||
gint *x,
|
gint *x,
|
||||||
gint *y);
|
gint *y);
|
||||||
|
|
||||||
static gint align_layers_dialog (void);
|
static gint align_layers_dialog (void);
|
||||||
|
|
||||||
|
@ -95,13 +95,13 @@ GimpPlugInInfo PLUG_IN_INFO =
|
||||||
/* dialog variables */
|
/* dialog variables */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
gint h_style;
|
gint h_style;
|
||||||
gint h_base;
|
gint h_base;
|
||||||
gint v_style;
|
gint v_style;
|
||||||
gint v_base;
|
gint v_base;
|
||||||
gint ignore_bottom;
|
gboolean ignore_bottom;
|
||||||
gint base_is_bottom_layer;
|
gboolean base_is_bottom_layer;
|
||||||
gint grid_size;
|
gint grid_size;
|
||||||
} ValueType;
|
} ValueType;
|
||||||
|
|
||||||
static ValueType VALS =
|
static ValueType VALS =
|
||||||
|
@ -131,16 +131,16 @@ query (void)
|
||||||
};
|
};
|
||||||
|
|
||||||
gimp_install_procedure (PLUG_IN_NAME,
|
gimp_install_procedure (PLUG_IN_NAME,
|
||||||
"Align visible layers",
|
"Align visible layers",
|
||||||
"Align visible layers",
|
"Align visible layers",
|
||||||
"Shuji Narazaki <narazaki@InetQ.or.jp>",
|
"Shuji Narazaki <narazaki@InetQ.or.jp>",
|
||||||
"Shuji Narazaki",
|
"Shuji Narazaki",
|
||||||
"1997",
|
"1997",
|
||||||
N_("<Image>/Layer/Align _Visible Layers..."),
|
N_("<Image>/Layer/Align _Visible Layers..."),
|
||||||
"RGB*,GRAY*",
|
"RGB*,GRAY*",
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (args), 0,
|
G_N_ELEMENTS (args), 0,
|
||||||
args, NULL);
|
args, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -171,13 +171,13 @@ run (const gchar *name,
|
||||||
case GIMP_RUN_INTERACTIVE:
|
case GIMP_RUN_INTERACTIVE:
|
||||||
gimp_image_get_layers (image_id, &layer_num);
|
gimp_image_get_layers (image_id, &layer_num);
|
||||||
if (layer_num < 2)
|
if (layer_num < 2)
|
||||||
{
|
{
|
||||||
g_message (_("There are not enough layers to align."));
|
g_message (_("There are not enough layers to align."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gimp_get_data (PLUG_IN_NAME, &VALS);
|
gimp_get_data (PLUG_IN_NAME, &VALS);
|
||||||
if (! align_layers_dialog ())
|
if (! align_layers_dialog ())
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_NONINTERACTIVE:
|
case GIMP_RUN_NONINTERACTIVE:
|
||||||
|
@ -202,21 +202,21 @@ run (const gchar *name,
|
||||||
static GimpPDBStatusType
|
static GimpPDBStatusType
|
||||||
align_layers (gint32 image_id)
|
align_layers (gint32 image_id)
|
||||||
{
|
{
|
||||||
gint layer_num = 0;
|
gint layer_num = 0;
|
||||||
gint visible_layer_num = 0;
|
gint visible_layer_num = 0;
|
||||||
gint *layers = NULL;
|
gint *layers = NULL;
|
||||||
gint index;
|
gint index;
|
||||||
gint vindex;
|
gint vindex;
|
||||||
gint step_x = 0;
|
gint step_x = 0;
|
||||||
gint step_y = 0;
|
gint step_y = 0;
|
||||||
gint x = 0;
|
gint x = 0;
|
||||||
gint y = 0;
|
gint y = 0;
|
||||||
gint orig_x = 0;
|
gint orig_x = 0;
|
||||||
gint orig_y = 0;
|
gint orig_y = 0;
|
||||||
gint offset_x = 0;
|
gint offset_x = 0;
|
||||||
gint offset_y = 0;
|
gint offset_y = 0;
|
||||||
gint base_x = 0;
|
gint base_x = 0;
|
||||||
gint base_y = 0;
|
gint base_y = 0;
|
||||||
gint bg_index = 0;
|
gint bg_index = 0;
|
||||||
|
|
||||||
layers = gimp_image_get_layers (image_id, &layer_num);
|
layers = gimp_image_get_layers (image_id, &layer_num);
|
||||||
|
@ -225,63 +225,63 @@ align_layers (gint32 image_id)
|
||||||
for (index = 0; index < layer_num; index++)
|
for (index = 0; index < layer_num; index++)
|
||||||
{
|
{
|
||||||
if (gimp_drawable_get_visible (layers[index]))
|
if (gimp_drawable_get_visible (layers[index]))
|
||||||
visible_layer_num++;
|
visible_layer_num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VALS.ignore_bottom)
|
if (VALS.ignore_bottom)
|
||||||
{
|
{
|
||||||
layer_num--;
|
layer_num--;
|
||||||
if (gimp_drawable_get_visible (layers[bg_index]))
|
if (gimp_drawable_get_visible (layers[bg_index]))
|
||||||
visible_layer_num--;
|
visible_layer_num--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < visible_layer_num)
|
if (0 < visible_layer_num)
|
||||||
{
|
{
|
||||||
gint min_x = G_MAXINT;
|
gint min_x = G_MAXINT;
|
||||||
gint min_y = G_MAXINT;
|
gint min_y = G_MAXINT;
|
||||||
gint max_x = G_MININT;
|
gint max_x = G_MININT;
|
||||||
gint max_y = G_MININT;
|
gint max_y = G_MININT;
|
||||||
|
|
||||||
/* 0 is the top layer */
|
/* 0 is the top layer */
|
||||||
for (index = 0; index < layer_num; index++)
|
for (index = 0; index < layer_num; index++)
|
||||||
{
|
{
|
||||||
if (gimp_drawable_get_visible (layers[index]))
|
if (gimp_drawable_get_visible (layers[index]))
|
||||||
{
|
{
|
||||||
gimp_drawable_offsets (layers[index], &orig_x, &orig_y);
|
gimp_drawable_offsets (layers[index], &orig_x, &orig_y);
|
||||||
align_layers_get_align_offsets (layers[index], &offset_x,
|
align_layers_get_align_offsets (layers[index], &offset_x,
|
||||||
&offset_y);
|
&offset_y);
|
||||||
orig_x += offset_x;
|
orig_x += offset_x;
|
||||||
orig_y += offset_y;
|
orig_y += offset_y;
|
||||||
|
|
||||||
if ( orig_x < min_x ) min_x = orig_x;
|
if ( orig_x < min_x ) min_x = orig_x;
|
||||||
if ( max_x < orig_x ) max_x = orig_x;
|
if ( max_x < orig_x ) max_x = orig_x;
|
||||||
if ( orig_y < min_y ) min_y = orig_y;
|
if ( orig_y < min_y ) min_y = orig_y;
|
||||||
if ( max_y < orig_y ) max_y = orig_y;
|
if ( max_y < orig_y ) max_y = orig_y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VALS.base_is_bottom_layer)
|
if (VALS.base_is_bottom_layer)
|
||||||
{
|
{
|
||||||
gimp_drawable_offsets (layers[bg_index], &orig_x, &orig_y);
|
gimp_drawable_offsets (layers[bg_index], &orig_x, &orig_y);
|
||||||
align_layers_get_align_offsets (layers[bg_index], &offset_x,
|
align_layers_get_align_offsets (layers[bg_index], &offset_x,
|
||||||
&offset_y);
|
&offset_y);
|
||||||
orig_x += offset_x;
|
orig_x += offset_x;
|
||||||
orig_y += offset_y;
|
orig_y += offset_y;
|
||||||
base_x = min_x = orig_x;
|
base_x = min_x = orig_x;
|
||||||
base_y = min_y = orig_y;
|
base_y = min_y = orig_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visible_layer_num > 1)
|
if (visible_layer_num > 1)
|
||||||
{
|
{
|
||||||
step_x = (max_x - min_x) / (visible_layer_num - 1);
|
step_x = (max_x - min_x) / (visible_layer_num - 1);
|
||||||
step_y = (max_y - min_y) / (visible_layer_num - 1);
|
step_y = (max_y - min_y) / (visible_layer_num - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (VALS.h_style == LEFT2RIGHT) || (VALS.h_style == RIGHT2LEFT))
|
if ( (VALS.h_style == LEFT2RIGHT) || (VALS.h_style == RIGHT2LEFT))
|
||||||
base_x = min_x;
|
base_x = min_x;
|
||||||
|
|
||||||
if ( (VALS.v_style == TOP2BOTTOM) || (VALS.v_style == BOTTOM2TOP))
|
if ( (VALS.v_style == TOP2BOTTOM) || (VALS.v_style == BOTTOM2TOP))
|
||||||
base_y = min_y;
|
base_y = min_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_image_undo_group_start (image_id);
|
gimp_image_undo_group_start (image_id);
|
||||||
|
@ -289,53 +289,53 @@ align_layers (gint32 image_id)
|
||||||
for (vindex = -1, index = 0; index < layer_num; index++)
|
for (vindex = -1, index = 0; index < layer_num; index++)
|
||||||
{
|
{
|
||||||
if (gimp_drawable_get_visible (layers[index]))
|
if (gimp_drawable_get_visible (layers[index]))
|
||||||
vindex++;
|
vindex++;
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
gimp_drawable_offsets (layers[index], &orig_x, &orig_y);
|
gimp_drawable_offsets (layers[index], &orig_x, &orig_y);
|
||||||
align_layers_get_align_offsets (layers[index], &offset_x, &offset_y);
|
align_layers_get_align_offsets (layers[index], &offset_x, &offset_y);
|
||||||
|
|
||||||
switch (VALS.h_style)
|
switch (VALS.h_style)
|
||||||
{
|
{
|
||||||
case H_NONE:
|
case H_NONE:
|
||||||
x = orig_x;
|
x = orig_x;
|
||||||
break;
|
break;
|
||||||
case H_COLLECT:
|
case H_COLLECT:
|
||||||
x = base_x - offset_x;
|
x = base_x - offset_x;
|
||||||
break;
|
break;
|
||||||
case LEFT2RIGHT:
|
case LEFT2RIGHT:
|
||||||
x = (base_x + vindex * step_x) - offset_x;
|
x = (base_x + vindex * step_x) - offset_x;
|
||||||
break;
|
break;
|
||||||
case RIGHT2LEFT:
|
case RIGHT2LEFT:
|
||||||
x = (base_x + (visible_layer_num - vindex - 1) * step_x) - offset_x;
|
x = (base_x + (visible_layer_num - vindex - 1) * step_x) - offset_x;
|
||||||
break;
|
break;
|
||||||
case SNAP2HGRID:
|
case SNAP2HGRID:
|
||||||
x = VALS.grid_size
|
x = VALS.grid_size
|
||||||
* (int) ((orig_x + offset_x + VALS.grid_size /2) / VALS.grid_size)
|
* (int) ((orig_x + offset_x + VALS.grid_size /2) / VALS.grid_size)
|
||||||
- offset_x;
|
- offset_x;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (VALS.v_style)
|
switch (VALS.v_style)
|
||||||
{
|
{
|
||||||
case V_NONE:
|
case V_NONE:
|
||||||
y = orig_y;
|
y = orig_y;
|
||||||
break;
|
break;
|
||||||
case V_COLLECT:
|
case V_COLLECT:
|
||||||
y = base_y - offset_y;
|
y = base_y - offset_y;
|
||||||
break;
|
break;
|
||||||
case TOP2BOTTOM:
|
case TOP2BOTTOM:
|
||||||
y = (base_y + vindex * step_y) - offset_y;
|
y = (base_y + vindex * step_y) - offset_y;
|
||||||
break;
|
break;
|
||||||
case BOTTOM2TOP:
|
case BOTTOM2TOP:
|
||||||
y = (base_y + (visible_layer_num - vindex - 1) * step_y) - offset_y;
|
y = (base_y + (visible_layer_num - vindex - 1) * step_y) - offset_y;
|
||||||
break;
|
break;
|
||||||
case SNAP2VGRID:
|
case SNAP2VGRID:
|
||||||
y = VALS.grid_size
|
y = VALS.grid_size
|
||||||
* (int) ((orig_y + offset_y + VALS.grid_size / 2) / VALS.grid_size)
|
* (int) ((orig_y + offset_y + VALS.grid_size / 2) / VALS.grid_size)
|
||||||
- offset_y;
|
- offset_y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gimp_layer_set_offsets (layers[index], x, y);
|
gimp_layer_set_offsets (layers[index], x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,11 +345,11 @@ align_layers (gint32 image_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
align_layers_get_align_offsets (gint32 drawable_id,
|
align_layers_get_align_offsets (gint32 drawable_id,
|
||||||
gint *x,
|
gint *x,
|
||||||
gint *y)
|
gint *y)
|
||||||
{
|
{
|
||||||
GimpDrawable *layer = gimp_drawable_get (drawable_id);
|
GimpDrawable *layer = gimp_drawable_get (drawable_id);
|
||||||
|
|
||||||
switch (VALS.h_base)
|
switch (VALS.h_base)
|
||||||
{
|
{
|
||||||
|
@ -399,12 +399,12 @@ align_layers_dialog (void)
|
||||||
|
|
||||||
dlg = gimp_dialog_new (_("Align Visible Layers"), SHORT_NAME,
|
dlg = gimp_dialog_new (_("Align Visible Layers"), SHORT_NAME,
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
gimp_standard_help_func, "filters/align_layers.html",
|
gimp_standard_help_func, "filters/align_layers.html",
|
||||||
|
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
frame = gtk_frame_new (_("Parameter Settings"));
|
frame = gtk_frame_new (_("Parameter Settings"));
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
||||||
|
@ -420,59 +420,59 @@ align_layers_dialog (void)
|
||||||
|
|
||||||
optionmenu =
|
optionmenu =
|
||||||
gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
|
gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
|
||||||
&VALS.h_style, VALS.h_style,
|
&VALS.h_style, VALS.h_style,
|
||||||
|
|
||||||
_("None"), H_NONE, NULL,
|
_("None"), H_NONE, NULL,
|
||||||
_("Collect"), H_COLLECT, NULL,
|
_("Collect"), H_COLLECT, NULL,
|
||||||
_("Fill (left to right)"), LEFT2RIGHT, NULL,
|
_("Fill (left to right)"), LEFT2RIGHT, NULL,
|
||||||
_("Fill (right to left)"), RIGHT2LEFT, NULL,
|
_("Fill (right to left)"), RIGHT2LEFT, NULL,
|
||||||
_("Snap to Grid"), SNAP2HGRID, NULL,
|
_("Snap to Grid"), SNAP2HGRID, NULL,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||||
_("_Horizontal Style:"), 1.0, 0.5,
|
_("_Horizontal Style:"), 1.0, 0.5,
|
||||||
optionmenu, 1, FALSE);
|
optionmenu, 1, FALSE);
|
||||||
|
|
||||||
optionmenu =
|
optionmenu =
|
||||||
gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
|
gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
|
||||||
&VALS.h_base, VALS.h_base,
|
&VALS.h_base, VALS.h_base,
|
||||||
|
|
||||||
_("Left Edge"), H_BASE_LEFT, NULL,
|
_("Left Edge"), H_BASE_LEFT, NULL,
|
||||||
_("Center"), H_BASE_CENTER, NULL,
|
_("Center"), H_BASE_CENTER, NULL,
|
||||||
_("Right Edge"), H_BASE_RIGHT, NULL,
|
_("Right Edge"), H_BASE_RIGHT, NULL,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||||
_("Ho_rizontal Base:"), 1.0, 0.5,
|
_("Ho_rizontal Base:"), 1.0, 0.5,
|
||||||
optionmenu, 1, FALSE);
|
optionmenu, 1, FALSE);
|
||||||
|
|
||||||
optionmenu =
|
optionmenu =
|
||||||
gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
|
gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
|
||||||
&VALS.v_style, VALS.v_style,
|
&VALS.v_style, VALS.v_style,
|
||||||
|
|
||||||
_("None"), V_NONE, NULL,
|
_("None"), V_NONE, NULL,
|
||||||
_("Collect"), V_COLLECT, NULL,
|
_("Collect"), V_COLLECT, NULL,
|
||||||
_("Fill (top to bottom)"), TOP2BOTTOM, NULL,
|
_("Fill (top to bottom)"), TOP2BOTTOM, NULL,
|
||||||
_("Fill (bottom to top)"), BOTTOM2TOP, NULL,
|
_("Fill (bottom to top)"), BOTTOM2TOP, NULL,
|
||||||
_("Snap to Grid"), SNAP2VGRID, NULL,
|
_("Snap to Grid"), SNAP2VGRID, NULL,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
||||||
_("_Vertical Style:"), 1.0, 0.5,
|
_("_Vertical Style:"), 1.0, 0.5,
|
||||||
optionmenu, 1, FALSE);
|
optionmenu, 1, FALSE);
|
||||||
|
|
||||||
optionmenu =
|
optionmenu =
|
||||||
gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
|
gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
|
||||||
&VALS.v_base, VALS.v_base,
|
&VALS.v_base, VALS.v_base,
|
||||||
|
|
||||||
_("Top Edge"), V_BASE_TOP, NULL,
|
_("Top Edge"), V_BASE_TOP, NULL,
|
||||||
_("Center"), V_BASE_CENTER, NULL,
|
_("Center"), V_BASE_CENTER, NULL,
|
||||||
_("Bottom Edge"), V_BASE_BOTTOM, NULL,
|
_("Bottom Edge"), V_BASE_BOTTOM, NULL,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 3,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 3,
|
||||||
_("Ver_tical Base:"), 1.0, 0.5,
|
_("Ver_tical Base:"), 1.0, 0.5,
|
||||||
optionmenu, 1, FALSE);
|
optionmenu, 1, FALSE);
|
||||||
|
|
||||||
toggle = gtk_check_button_new_with_mnemonic
|
toggle = gtk_check_button_new_with_mnemonic
|
||||||
(_("_Ignore the Bottom Layer even if Visible"));
|
(_("_Ignore the Bottom Layer even if Visible"));
|
||||||
|
@ -487,7 +487,7 @@ align_layers_dialog (void)
|
||||||
toggle = gtk_check_button_new_with_mnemonic
|
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),
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||||
VALS.base_is_bottom_layer);
|
VALS.base_is_bottom_layer);
|
||||||
gtk_table_attach_defaults (GTK_TABLE (table), toggle, 0, 2, 5, 6);
|
gtk_table_attach_defaults (GTK_TABLE (table), toggle, 0, 2, 5, 6);
|
||||||
gtk_widget_show (toggle);
|
gtk_widget_show (toggle);
|
||||||
|
|
||||||
|
@ -496,10 +496,10 @@ align_layers_dialog (void)
|
||||||
&VALS.base_is_bottom_layer);
|
&VALS.base_is_bottom_layer);
|
||||||
|
|
||||||
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 6,
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 6,
|
||||||
_("_Grid Size:"), SCALE_WIDTH, 0,
|
_("_Grid Size:"), SCALE_WIDTH, 0,
|
||||||
VALS.grid_size, 0, 200, 1, 10, 0,
|
VALS.grid_size, 0, 200, 1, 10, 0,
|
||||||
TRUE, 0, 0,
|
TRUE, 0, 0,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
g_signal_connect (adj, "value_changed",
|
g_signal_connect (adj, "value_changed",
|
||||||
G_CALLBACK (gimp_int_adjustment_update),
|
G_CALLBACK (gimp_int_adjustment_update),
|
||||||
&VALS.grid_size);
|
&VALS.grid_size);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -63,10 +63,10 @@
|
||||||
*/
|
*/
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (const gchar *name,
|
static void run (const gchar *name,
|
||||||
gint nparams,
|
gint nparams,
|
||||||
const GimpParam *param,
|
const GimpParam *param,
|
||||||
gint *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GimpParam **return_vals);
|
GimpParam **return_vals);
|
||||||
|
|
||||||
static void drawlens (GimpDrawable *drawable);
|
static void drawlens (GimpDrawable *drawable);
|
||||||
|
|
||||||
|
@ -114,16 +114,16 @@ query (void)
|
||||||
};
|
};
|
||||||
|
|
||||||
gimp_install_procedure ("plug_in_applylens",
|
gimp_install_procedure ("plug_in_applylens",
|
||||||
"Apply a lens effect",
|
"Apply a lens effect",
|
||||||
"This plug-in uses Snell's law to draw an ellipsoid lens over the image",
|
"This plug-in uses Snell's law to draw an ellipsoid lens over the image",
|
||||||
"Morten Eriksen",
|
"Morten Eriksen",
|
||||||
"Morten Eriksen",
|
"Morten Eriksen",
|
||||||
"1997",
|
"1997",
|
||||||
N_("<Image>/Filters/Glass Effects/Apply _Lens..."),
|
N_("<Image>/Filters/Glass Effects/Apply _Lens..."),
|
||||||
"RGB*, GRAY*, INDEXED*",
|
"RGB*, GRAY*, INDEXED*",
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (args), 0,
|
G_N_ELEMENTS (args), 0,
|
||||||
args, NULL);
|
args, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -155,23 +155,23 @@ run (const gchar *name,
|
||||||
case GIMP_RUN_INTERACTIVE:
|
case GIMP_RUN_INTERACTIVE:
|
||||||
gimp_get_data ("plug_in_applylens", &lvals);
|
gimp_get_data ("plug_in_applylens", &lvals);
|
||||||
if(!lens_dialog (drawable))
|
if(!lens_dialog (drawable))
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_NONINTERACTIVE:
|
case GIMP_RUN_NONINTERACTIVE:
|
||||||
if (nparams != 7)
|
if (nparams != 7)
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
|
|
||||||
if (status == GIMP_PDB_SUCCESS)
|
if (status == GIMP_PDB_SUCCESS)
|
||||||
{
|
{
|
||||||
lvals.refraction = param[3].data.d_float;
|
lvals.refraction = param[3].data.d_float;
|
||||||
lvals.keep_surr = param[4].data.d_int32;
|
lvals.keep_surr = param[4].data.d_int32;
|
||||||
lvals.use_bkgr = param[5].data.d_int32;
|
lvals.use_bkgr = param[5].data.d_int32;
|
||||||
lvals.set_transparent = param[6].data.d_int32;
|
lvals.set_transparent = param[6].data.d_int32;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == GIMP_PDB_SUCCESS && (lvals.refraction < 1.0))
|
if (status == GIMP_PDB_SUCCESS && (lvals.refraction < 1.0))
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_WITH_LAST_VALS:
|
case GIMP_RUN_WITH_LAST_VALS:
|
||||||
|
@ -201,12 +201,12 @@ run (const gchar *name,
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
find_projected_pos (gfloat a2,
|
find_projected_pos (gfloat a2,
|
||||||
gfloat b2,
|
gfloat b2,
|
||||||
gfloat c2,
|
gfloat c2,
|
||||||
gfloat x,
|
gfloat x,
|
||||||
gfloat y,
|
gfloat y,
|
||||||
gfloat *projx,
|
gfloat *projx,
|
||||||
gfloat *projy)
|
gfloat *projy)
|
||||||
{
|
{
|
||||||
gfloat n[3];
|
gfloat n[3];
|
||||||
gfloat nxangle, nyangle, theta1, theta2;
|
gfloat nxangle, nyangle, theta1, theta2;
|
||||||
|
@ -250,7 +250,7 @@ drawlens (GimpDrawable *drawable)
|
||||||
|
|
||||||
gimp_palette_get_background (&background);
|
gimp_palette_get_background (&background);
|
||||||
gimp_rgb_get_uchar (&background,
|
gimp_rgb_get_uchar (&background,
|
||||||
&bgr_red, &bgr_green, &bgr_blue);
|
&bgr_red, &bgr_green, &bgr_blue);
|
||||||
|
|
||||||
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
||||||
regionwidth = x2 - x1;
|
regionwidth = x2 - x1;
|
||||||
|
@ -280,65 +280,65 @@ drawlens (GimpDrawable *drawable)
|
||||||
dx = (gfloat) col - a + 0.5;
|
dx = (gfloat) col - a + 0.5;
|
||||||
xsqr = dx * dx;
|
xsqr = dx * dx;
|
||||||
for (row = 0; row < regionheight; row++)
|
for (row = 0; row < regionheight; row++)
|
||||||
{
|
{
|
||||||
pixelpos = (col + row * regionwidth) * bytes;
|
pixelpos = (col + row * regionwidth) * bytes;
|
||||||
dy = -((gfloat) row - b) - 0.5;
|
dy = -((gfloat) row - b) - 0.5;
|
||||||
ysqr = dy * dy;
|
ysqr = dy * dy;
|
||||||
if (ysqr < (bsqr - (bsqr * xsqr) / asqr))
|
if (ysqr < (bsqr - (bsqr * xsqr) / asqr))
|
||||||
{
|
{
|
||||||
find_projected_pos (asqr, bsqr, csqr, dx, dy, &x, &y);
|
find_projected_pos (asqr, bsqr, csqr, dx, dy, &x, &y);
|
||||||
y = -y;
|
y = -y;
|
||||||
pos = ((gint) (y + b) * regionwidth + (gint) (x + a)) * bytes;
|
pos = ((gint) (y + b) * regionwidth + (gint) (x + a)) * bytes;
|
||||||
|
|
||||||
for (i = 0; i < bytes; i++)
|
for (i = 0; i < bytes; i++)
|
||||||
{
|
{
|
||||||
dest[pixelpos + i] = src[pos + i];
|
dest[pixelpos + i] = src[pos + i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (lvals.keep_surr)
|
if (lvals.keep_surr)
|
||||||
{
|
{
|
||||||
for (i = 0; i < bytes; i++)
|
for (i = 0; i < bytes; i++)
|
||||||
{
|
{
|
||||||
dest[pixelpos + i] = src[pixelpos + i];
|
dest[pixelpos + i] = src[pixelpos + i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (lvals.set_transparent)
|
if (lvals.set_transparent)
|
||||||
alphaval = 0;
|
alphaval = 0;
|
||||||
else
|
else
|
||||||
alphaval = 255;
|
alphaval = 255;
|
||||||
|
|
||||||
switch (drawtype)
|
switch (drawtype)
|
||||||
{
|
{
|
||||||
case GIMP_INDEXEDA_IMAGE:
|
case GIMP_INDEXEDA_IMAGE:
|
||||||
dest[pixelpos + 1] = alphaval;
|
dest[pixelpos + 1] = alphaval;
|
||||||
case GIMP_INDEXED_IMAGE:
|
case GIMP_INDEXED_IMAGE:
|
||||||
dest[pixelpos + 0] = 0;
|
dest[pixelpos + 0] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RGBA_IMAGE:
|
case GIMP_RGBA_IMAGE:
|
||||||
dest[pixelpos + 3] = alphaval;
|
dest[pixelpos + 3] = alphaval;
|
||||||
case GIMP_RGB_IMAGE:
|
case GIMP_RGB_IMAGE:
|
||||||
dest[pixelpos + 0] = bgr_red;
|
dest[pixelpos + 0] = bgr_red;
|
||||||
dest[pixelpos + 1] = bgr_green;
|
dest[pixelpos + 1] = bgr_green;
|
||||||
dest[pixelpos + 2] = bgr_blue;
|
dest[pixelpos + 2] = bgr_blue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_GRAYA_IMAGE:
|
case GIMP_GRAYA_IMAGE:
|
||||||
dest[pixelpos + 1] = alphaval;
|
dest[pixelpos + 1] = alphaval;
|
||||||
case GIMP_GRAY_IMAGE:
|
case GIMP_GRAY_IMAGE:
|
||||||
dest[pixelpos+0] = bgr_red;
|
dest[pixelpos+0] = bgr_red;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((gint) (regionwidth-col) % 5) == 0)
|
if (((gint) (regionwidth-col) % 5) == 0)
|
||||||
gimp_progress_update ((gdouble) col / (gdouble) regionwidth);
|
gimp_progress_update ((gdouble) col / (gdouble) regionwidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_pixel_rgn_set_rect (&destPR, dest, x1, y1, regionwidth, regionheight);
|
gimp_pixel_rgn_set_rect (&destPR, dest, x1, y1, regionwidth, regionheight);
|
||||||
|
@ -368,12 +368,12 @@ lens_dialog (GimpDrawable *drawable)
|
||||||
|
|
||||||
dlg = gimp_dialog_new (_("Lens Effect"), "apply_lens",
|
dlg = gimp_dialog_new (_("Lens Effect"), "apply_lens",
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
gimp_standard_help_func, "filters/apply_lens.html",
|
gimp_standard_help_func, "filters/apply_lens.html",
|
||||||
|
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
frame = gtk_frame_new (_("Parameter Settings"));
|
frame = gtk_frame_new (_("Parameter Settings"));
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
||||||
|
@ -414,7 +414,7 @@ lens_dialog (GimpDrawable *drawable)
|
||||||
(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_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||||
lvals.set_transparent);
|
lvals.set_transparent);
|
||||||
gtk_widget_show (toggle);
|
gtk_widget_show (toggle);
|
||||||
|
|
||||||
g_signal_connect (toggle, "toggled",
|
g_signal_connect (toggle, "toggled",
|
||||||
|
@ -434,7 +434,7 @@ lens_dialog (GimpDrawable *drawable)
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
spinbutton = gimp_spin_button_new (&adj, lvals.refraction,
|
spinbutton = gimp_spin_button_new (&adj, lvals.refraction,
|
||||||
1.0, 100.0, 0.1, 1.0, 0, 1, 2);
|
1.0, 100.0, 0.1, 1.0, 0, 1, 2);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (spinbutton);
|
gtk_widget_show (spinbutton);
|
||||||
|
|
||||||
|
|
|
@ -24,31 +24,31 @@
|
||||||
/* Declare local functions. */
|
/* Declare local functions. */
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (const gchar *name,
|
static void run (const gchar *name,
|
||||||
gint nparams,
|
gint nparams,
|
||||||
const GimpParam *param,
|
const GimpParam *param,
|
||||||
gint *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GimpParam **return_vals);
|
GimpParam **return_vals);
|
||||||
|
|
||||||
static gint colors_equal (guchar *col1,
|
static gint colors_equal (guchar *col1,
|
||||||
guchar *col2,
|
guchar *col2,
|
||||||
gint bytes);
|
gint bytes);
|
||||||
static gint guess_bgcolor (GimpPixelRgn *pr,
|
static gint guess_bgcolor (GimpPixelRgn *pr,
|
||||||
gint width,
|
gint width,
|
||||||
gint height,
|
gint height,
|
||||||
gint bytes,
|
gint bytes,
|
||||||
guchar *color);
|
guchar *color);
|
||||||
|
|
||||||
static void doit (GimpDrawable *drawable,
|
static void doit (GimpDrawable *drawable,
|
||||||
gint32 image_id,
|
gint32 image_id,
|
||||||
gboolean show_progress);
|
gboolean show_progress);
|
||||||
|
|
||||||
|
|
||||||
GimpPlugInInfo PLUG_IN_INFO =
|
GimpPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
NULL, /* init_proc */
|
NULL, /* init_proc */
|
||||||
NULL, /* quit_proc */
|
NULL, /* quit_proc */
|
||||||
query, /* query_proc */
|
query, /* query_proc */
|
||||||
run, /* run_proc */
|
run, /* run_proc */
|
||||||
};
|
};
|
||||||
|
|
||||||
static gint bytes;
|
static gint bytes;
|
||||||
|
@ -67,16 +67,16 @@ query (void)
|
||||||
};
|
};
|
||||||
|
|
||||||
gimp_install_procedure ("plug_in_autocrop",
|
gimp_install_procedure ("plug_in_autocrop",
|
||||||
"Automagically crops a picture.",
|
"Automagically crops a picture.",
|
||||||
"",
|
"",
|
||||||
"Tim Newsome",
|
"Tim Newsome",
|
||||||
"Tim Newsome",
|
"Tim Newsome",
|
||||||
"1997",
|
"1997",
|
||||||
N_("<Image>/Image/Transform/_Autocrop"),
|
N_("<Image>/Image/Transform/_Autocrop"),
|
||||||
"RGB*, GRAY*, INDEXED*",
|
"RGB*, GRAY*, INDEXED*",
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (args), 0,
|
G_N_ELEMENTS (args), 0,
|
||||||
args, NULL);
|
args, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -171,9 +171,9 @@ doit (GimpDrawable *drawable,
|
||||||
{
|
{
|
||||||
gimp_pixel_rgn_get_row (&srcPR, buffer, 0, y, width);
|
gimp_pixel_rgn_get_row (&srcPR, buffer, 0, y, width);
|
||||||
for (x = 0; x < width && !abort; x++)
|
for (x = 0; x < width && !abort; x++)
|
||||||
{
|
{
|
||||||
abort = !colors_equal (color, buffer + x * bytes, bytes);
|
abort = !colors_equal (color, buffer + x * bytes, bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (y == height && !abort)
|
if (y == height && !abort)
|
||||||
{
|
{
|
||||||
|
@ -194,9 +194,9 @@ doit (GimpDrawable *drawable,
|
||||||
{
|
{
|
||||||
gimp_pixel_rgn_get_row (&srcPR, buffer, 0, y, width);
|
gimp_pixel_rgn_get_row (&srcPR, buffer, 0, y, width);
|
||||||
for (x = 0; x < width && !abort; x++)
|
for (x = 0; x < width && !abort; x++)
|
||||||
{
|
{
|
||||||
abort = !colors_equal (color, buffer + x * bytes, bytes);
|
abort = !colors_equal (color, buffer + x * bytes, bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nh = y - ny + 2;
|
nh = y - ny + 2;
|
||||||
|
|
||||||
|
@ -209,9 +209,9 @@ doit (GimpDrawable *drawable,
|
||||||
{
|
{
|
||||||
gimp_pixel_rgn_get_col (&srcPR, buffer, x, ny, nh);
|
gimp_pixel_rgn_get_col (&srcPR, buffer, x, ny, nh);
|
||||||
for (y = 0; y < nh && !abort; y++)
|
for (y = 0; y < nh && !abort; y++)
|
||||||
{
|
{
|
||||||
abort = !colors_equal (color, buffer + y * bytes, bytes);
|
abort = !colors_equal (color, buffer + y * bytes, bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x--;
|
x--;
|
||||||
nx = x;
|
nx = x;
|
||||||
|
@ -226,9 +226,9 @@ doit (GimpDrawable *drawable,
|
||||||
{
|
{
|
||||||
gimp_pixel_rgn_get_col (&srcPR, buffer, x, ny, nh);
|
gimp_pixel_rgn_get_col (&srcPR, buffer, x, ny, nh);
|
||||||
for (y = 0; y < nh && !abort; y++)
|
for (y = 0; y < nh && !abort; y++)
|
||||||
{
|
{
|
||||||
abort = !colors_equal (color, buffer + y * bytes, bytes);
|
abort = !colors_equal (color, buffer + y * bytes, bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nw = x - nx + 2;
|
nw = x - nx + 2;
|
||||||
|
|
||||||
|
@ -245,10 +245,10 @@ doit (GimpDrawable *drawable,
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
guess_bgcolor (GimpPixelRgn *pr,
|
guess_bgcolor (GimpPixelRgn *pr,
|
||||||
gint width,
|
gint width,
|
||||||
gint height,
|
gint height,
|
||||||
gint bytes,
|
gint bytes,
|
||||||
guchar *color)
|
guchar *color)
|
||||||
{
|
{
|
||||||
guchar tl[4], tr[4], bl[4], br[4];
|
guchar tl[4], tr[4], bl[4], br[4];
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ guess_bgcolor (GimpPixelRgn *pr,
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
else if (colors_equal (tl, tr, bytes) || colors_equal (tl, bl, bytes) ||
|
else if (colors_equal (tl, tr, bytes) || colors_equal (tl, bl, bytes) ||
|
||||||
colors_equal (tl, br, bytes))
|
colors_equal (tl, br, bytes))
|
||||||
{
|
{
|
||||||
memcpy (color, tl, bytes);
|
memcpy (color, tl, bytes);
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -302,35 +302,35 @@ guess_bgcolor (GimpPixelRgn *pr,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (bytes--)
|
while (bytes--)
|
||||||
{
|
{
|
||||||
color[bytes] = (tl[bytes] + tr[bytes] + bl[bytes] + br[bytes]) / 4;
|
color[bytes] = (tl[bytes] + tr[bytes] + bl[bytes] + br[bytes]) / 4;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
colors_equal (guchar *col1,
|
colors_equal (guchar *col1,
|
||||||
guchar *col2,
|
guchar *col2,
|
||||||
gint bytes)
|
gint bytes)
|
||||||
{
|
{
|
||||||
gint equal = 1;
|
gint equal = 1;
|
||||||
gint b;
|
gint b;
|
||||||
|
|
||||||
if ((bytes == 2 || bytes == 4) && /* HACK! */
|
if ((bytes == 2 || bytes == 4) && /* HACK! */
|
||||||
col1[bytes-1] == 0 &&
|
col1[bytes-1] == 0 &&
|
||||||
col2[bytes-1] == 0)
|
col2[bytes-1] == 0)
|
||||||
{
|
{
|
||||||
return 1; /* handle zero alpha */
|
return 1; /* handle zero alpha */
|
||||||
}
|
}
|
||||||
|
|
||||||
for (b = 0; b < bytes; b++)
|
for (b = 0; b < bytes; b++)
|
||||||
{
|
{
|
||||||
if (col1[b] != col2[b])
|
if (col1[b] != col2[b])
|
||||||
{
|
{
|
||||||
equal = 0;
|
equal = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return equal;
|
return equal;
|
||||||
|
|
|
@ -427,11 +427,11 @@ blindsapply (guchar *srow,
|
||||||
gint bpp,
|
gint bpp,
|
||||||
guchar *bg)
|
guchar *bg)
|
||||||
{
|
{
|
||||||
guchar *src;
|
guchar *src;
|
||||||
guchar *dst;
|
guchar *dst;
|
||||||
gint i,j,k;
|
gint i,j,k;
|
||||||
gdouble ang;
|
gdouble ang;
|
||||||
gint available;
|
gint available;
|
||||||
|
|
||||||
/* Make the row 'shrink' around points along its length */
|
/* Make the row 'shrink' around points along its length */
|
||||||
/* The bvals.numsegs determins how many segments to slip it in to */
|
/* The bvals.numsegs determins how many segments to slip it in to */
|
||||||
|
@ -686,11 +686,11 @@ apply_blinds (void)
|
||||||
* this act as a transfomation matrix for the
|
* this act as a transfomation matrix for the
|
||||||
* rows. Make row 0 invalid so we can find it again!
|
* rows. Make row 0 invalid so we can find it again!
|
||||||
*/
|
*/
|
||||||
int i;
|
int i;
|
||||||
gint *sr = g_new (gint, sel_height * 4);
|
gint *sr = g_new (gint, sel_height * 4);
|
||||||
gint *dr = g_new (gint, sel_height * 4);
|
gint *dr = g_new (gint, sel_height * 4);
|
||||||
guchar *dst = g_new (guchar, STEP * 4);
|
guchar *dst = g_new (guchar, STEP * 4);
|
||||||
guchar dummybg[4];
|
guchar dummybg[4];
|
||||||
|
|
||||||
memset (dummybg, 0, 4);
|
memset (dummybg, 0, 4);
|
||||||
memset (dr, 0, sel_height * 4); /* all dr rows are background rows */
|
memset (dr, 0, sel_height * 4); /* all dr rows are background rows */
|
||||||
|
@ -709,7 +709,7 @@ apply_blinds (void)
|
||||||
/* Fill in with background color ? */
|
/* Fill in with background color ? */
|
||||||
for (i = 0 ; i < STEP ; i++)
|
for (i = 0 ; i < STEP ; i++)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
guchar *bgdst;
|
guchar *bgdst;
|
||||||
bgdst = &dst[i * src_rgn.bpp];
|
bgdst = &dst[i * src_rgn.bpp];
|
||||||
|
|
||||||
|
@ -721,8 +721,8 @@ apply_blinds (void)
|
||||||
|
|
||||||
for (x = 0; x < sel_width; x += STEP)
|
for (x = 0; x < sel_width; x += STEP)
|
||||||
{
|
{
|
||||||
int rr;
|
int rr;
|
||||||
int step;
|
int step;
|
||||||
guchar *p;
|
guchar *p;
|
||||||
|
|
||||||
if((x + STEP) > sel_width)
|
if((x + STEP) > sel_width)
|
||||||
|
|
|
@ -116,10 +116,10 @@ static BlurVals pivals =
|
||||||
|
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (const gchar *name,
|
static void run (const gchar *name,
|
||||||
gint nparams,
|
gint nparams,
|
||||||
const GimpParam *param,
|
const GimpParam *param,
|
||||||
gint *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GimpParam **return_vals);
|
GimpParam **return_vals);
|
||||||
|
|
||||||
GimpPlugInInfo PLUG_IN_INFO =
|
GimpPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
|
@ -132,10 +132,10 @@ GimpPlugInInfo PLUG_IN_INFO =
|
||||||
static void blur (GimpDrawable *drawable);
|
static void blur (GimpDrawable *drawable);
|
||||||
|
|
||||||
static inline void blur_prepare_row (GimpPixelRgn *pixel_rgn,
|
static inline void blur_prepare_row (GimpPixelRgn *pixel_rgn,
|
||||||
guchar *data,
|
guchar *data,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint w);
|
gint w);
|
||||||
|
|
||||||
static gint blur_dialog (void);
|
static gint blur_dialog (void);
|
||||||
|
|
||||||
|
@ -179,28 +179,28 @@ query (void)
|
||||||
const gchar *copyright_date = "1995-1998";
|
const gchar *copyright_date = "1995-1998";
|
||||||
|
|
||||||
gimp_install_procedure ("plug_in_blur_randomize",
|
gimp_install_procedure ("plug_in_blur_randomize",
|
||||||
(gchar *) blurb,
|
(gchar *) blurb,
|
||||||
(gchar *) help,
|
(gchar *) help,
|
||||||
(gchar *) author,
|
(gchar *) author,
|
||||||
(gchar *) copyrights,
|
(gchar *) copyrights,
|
||||||
(gchar *) copyright_date,
|
(gchar *) copyright_date,
|
||||||
N_("<Image>/Filters/Blur/_Blur..."),
|
N_("<Image>/Filters/Blur/_Blur..."),
|
||||||
"RGB*, GRAY*",
|
"RGB*, GRAY*",
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (args), 0,
|
G_N_ELEMENTS (args), 0,
|
||||||
args, NULL);
|
args, NULL);
|
||||||
|
|
||||||
gimp_install_procedure (PLUG_IN_NAME,
|
gimp_install_procedure (PLUG_IN_NAME,
|
||||||
(gchar *) blurb,
|
(gchar *) blurb,
|
||||||
(gchar *) help,
|
(gchar *) help,
|
||||||
(gchar *) author,
|
(gchar *) author,
|
||||||
(gchar *) copyrights,
|
(gchar *) copyrights,
|
||||||
(gchar *) copyright_date,
|
(gchar *) copyright_date,
|
||||||
NULL,
|
NULL,
|
||||||
"RGB*, GRAY*",
|
"RGB*, GRAY*",
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (args_ni), 0,
|
G_N_ELEMENTS (args_ni), 0,
|
||||||
args_ni, NULL);
|
args_ni, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
|
@ -244,90 +244,90 @@ run (const gchar *name,
|
||||||
gimp_drawable_is_gray (drawable->drawable_id))
|
gimp_drawable_is_gray (drawable->drawable_id))
|
||||||
{
|
{
|
||||||
switch (run_mode)
|
switch (run_mode)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If we're running interactively, pop up the dialog box.
|
* If we're running interactively, pop up the dialog box.
|
||||||
*/
|
*/
|
||||||
case GIMP_RUN_INTERACTIVE:
|
case GIMP_RUN_INTERACTIVE:
|
||||||
gimp_get_data (PLUG_IN_NAME, &pivals);
|
gimp_get_data (PLUG_IN_NAME, &pivals);
|
||||||
if (!blur_dialog ()) /* return on Cancel */
|
if (!blur_dialog ()) /* return on Cancel */
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we're not interactive (probably scripting), we
|
* If we're not interactive (probably scripting), we
|
||||||
* get the parameters from the param[] array, since
|
* get the parameters from the param[] array, since
|
||||||
* we don't use the dialog box. Make sure all
|
* we don't use the dialog box. Make sure all
|
||||||
* parameters have legitimate values.
|
* parameters have legitimate values.
|
||||||
*/
|
*/
|
||||||
case GIMP_RUN_NONINTERACTIVE:
|
case GIMP_RUN_NONINTERACTIVE:
|
||||||
if ((strcmp (name, "plug_in_blur_randomize") == 0) &&
|
if ((strcmp (name, "plug_in_blur_randomize") == 0) &&
|
||||||
(nparams == 7))
|
(nparams == 7))
|
||||||
{
|
{
|
||||||
pivals.blur_pct = (gdouble) param[3].data.d_float;
|
pivals.blur_pct = (gdouble) param[3].data.d_float;
|
||||||
pivals.blur_pct = (gdouble) MIN (100.0, pivals.blur_pct);
|
pivals.blur_pct = (gdouble) MIN (100.0, pivals.blur_pct);
|
||||||
pivals.blur_pct = (gdouble) MAX (1.0, pivals.blur_pct);
|
pivals.blur_pct = (gdouble) MAX (1.0, pivals.blur_pct);
|
||||||
pivals.blur_rcount = (gdouble) param[4].data.d_float;
|
pivals.blur_rcount = (gdouble) param[4].data.d_float;
|
||||||
pivals.blur_rcount = (gdouble) MIN (100.0,pivals.blur_rcount);
|
pivals.blur_rcount = (gdouble) MIN (100.0,pivals.blur_rcount);
|
||||||
pivals.blur_rcount = (gdouble) MAX (1.0, pivals.blur_rcount);
|
pivals.blur_rcount = (gdouble) MAX (1.0, pivals.blur_rcount);
|
||||||
pivals.blur_randomize = (gboolean) param[5].data.d_int32;
|
pivals.blur_randomize = (gboolean) param[5].data.d_int32;
|
||||||
pivals.blur_seed = (gint) param[6].data.d_int32;
|
pivals.blur_seed = (gint) param[6].data.d_int32;
|
||||||
}
|
}
|
||||||
else if ((strcmp (name, PLUG_IN_NAME) == 0) &&
|
else if ((strcmp (name, PLUG_IN_NAME) == 0) &&
|
||||||
(nparams == 3))
|
(nparams == 3))
|
||||||
{
|
{
|
||||||
pivals.blur_pct = (gdouble) 100.0;
|
pivals.blur_pct = (gdouble) 100.0;
|
||||||
pivals.blur_rcount = (gdouble) 1.0;
|
pivals.blur_rcount = (gdouble) 1.0;
|
||||||
pivals.blur_randomize = FALSE;
|
pivals.blur_randomize = FALSE;
|
||||||
pivals.blur_seed = g_random_int ();
|
pivals.blur_seed = g_random_int ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we're running with the last set of values, get those values.
|
* If we're running with the last set of values, get those values.
|
||||||
*/
|
*/
|
||||||
case GIMP_RUN_WITH_LAST_VALS:
|
case GIMP_RUN_WITH_LAST_VALS:
|
||||||
gimp_get_data (PLUG_IN_NAME, &pivals);
|
gimp_get_data (PLUG_IN_NAME, &pivals);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hopefully we never get here!
|
* Hopefully we never get here!
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == GIMP_PDB_SUCCESS)
|
if (status == GIMP_PDB_SUCCESS)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* JUST DO IT!
|
* JUST DO IT!
|
||||||
*/
|
*/
|
||||||
gimp_progress_init (_("Blurring..."));
|
gimp_progress_init (_("Blurring..."));
|
||||||
gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width ()
|
gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width ()
|
||||||
+ 1));
|
+ 1));
|
||||||
/*
|
/*
|
||||||
* Initialize the rand() function seed
|
* Initialize the rand() function seed
|
||||||
*/
|
*/
|
||||||
g_random_set_seed (pivals.blur_seed);
|
g_random_set_seed (pivals.blur_seed);
|
||||||
|
|
||||||
blur (drawable);
|
blur (drawable);
|
||||||
/*
|
/*
|
||||||
* If we ran interactively (even repeating) update the display.
|
* If we ran interactively (even repeating) update the display.
|
||||||
*/
|
*/
|
||||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||||
{
|
{
|
||||||
gimp_displays_flush ();
|
gimp_displays_flush ();
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* If we use the dialog popup, set the data for future use.
|
* If we use the dialog popup, set the data for future use.
|
||||||
*/
|
*/
|
||||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||||
{
|
{
|
||||||
gimp_set_data (PLUG_IN_NAME, &pivals, sizeof (BlurVals));
|
gimp_set_data (PLUG_IN_NAME, &pivals, sizeof (BlurVals));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -359,10 +359,10 @@ run (const gchar *name,
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
blur_prepare_row (GimpPixelRgn *pixel_rgn,
|
blur_prepare_row (GimpPixelRgn *pixel_rgn,
|
||||||
guchar *data,
|
guchar *data,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint w)
|
gint w)
|
||||||
{
|
{
|
||||||
int b;
|
int b;
|
||||||
|
|
||||||
|
@ -455,97 +455,97 @@ blur (GimpDrawable *drawable)
|
||||||
* loop through the rows, applying the selected convolution
|
* loop through the rows, applying the selected convolution
|
||||||
*/
|
*/
|
||||||
for (row = y1; row < y2; row++)
|
for (row = y1; row < y2; row++)
|
||||||
{
|
{
|
||||||
/* prepare the next row */
|
/* prepare the next row */
|
||||||
blur_prepare_row (sp, nr, x1, row + 1, (x2 - x1));
|
blur_prepare_row (sp, nr, x1, row + 1, (x2 - x1));
|
||||||
|
|
||||||
d = dest;
|
d = dest;
|
||||||
ind = 0;
|
ind = 0;
|
||||||
for (col = 0; col < (x2 - x1) * bytes; col++)
|
for (col = 0; col < (x2 - x1) * bytes; col++)
|
||||||
{
|
{
|
||||||
if (g_random_int_range (0, 100) <= (gint) pivals.blur_pct)
|
if (g_random_int_range (0, 100) <= (gint) pivals.blur_pct)
|
||||||
{
|
{
|
||||||
ind++;
|
ind++;
|
||||||
if (ind == bytes || !has_alpha)
|
if (ind == bytes || !has_alpha)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If no alpha channel,
|
* If no alpha channel,
|
||||||
* or if there is one and this is it...
|
* or if there is one and this is it...
|
||||||
*/
|
*/
|
||||||
*d++ = ((gint) pr[col - bytes] + (gint) pr[col] +
|
*d++ = ((gint) pr[col - bytes] + (gint) pr[col] +
|
||||||
(gint) pr[col + bytes] +
|
(gint) pr[col + bytes] +
|
||||||
(gint) cr[col - bytes] + (gint) cr[col] +
|
(gint) cr[col - bytes] + (gint) cr[col] +
|
||||||
(gint) cr[col + bytes] +
|
(gint) cr[col + bytes] +
|
||||||
(gint) nr[col - bytes] + (gint) nr[col] +
|
(gint) nr[col - bytes] + (gint) nr[col] +
|
||||||
(gint) nr[col + bytes]) / 9;
|
(gint) nr[col + bytes]) / 9;
|
||||||
ind = 0;
|
ind = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* otherwise we have an alpha channel,
|
* otherwise we have an alpha channel,
|
||||||
* but this is a color channel
|
* but this is a color channel
|
||||||
*/
|
*/
|
||||||
*d++ = ((gint)
|
*d++ = ((gint)
|
||||||
(((gdouble) (pr[col - bytes] * pr[col - ind])
|
(((gdouble) (pr[col - bytes] * pr[col - ind])
|
||||||
+ (gdouble) (pr[col] * pr[col + bytes - ind])
|
+ (gdouble) (pr[col] * pr[col + bytes - ind])
|
||||||
+ (gdouble) (pr[col + bytes] * pr[col + 2*bytes - ind])
|
+ (gdouble) (pr[col + bytes] * pr[col + 2*bytes - ind])
|
||||||
+ (gdouble) (cr[col - bytes] * cr[col - ind])
|
+ (gdouble) (cr[col - bytes] * cr[col - ind])
|
||||||
+ (gdouble) (cr[col] * cr[col + bytes - ind])
|
+ (gdouble) (cr[col] * cr[col + bytes - ind])
|
||||||
+ (gdouble) (cr[col + bytes] * cr[col + 2*bytes - ind])
|
+ (gdouble) (cr[col + bytes] * cr[col + 2*bytes - ind])
|
||||||
+ (gdouble) (nr[col - bytes] * nr[col - ind])
|
+ (gdouble) (nr[col - bytes] * nr[col - ind])
|
||||||
+ (gdouble) (nr[col] * nr[col + bytes - ind])
|
+ (gdouble) (nr[col] * nr[col + bytes - ind])
|
||||||
+ (gdouble) (nr[col + bytes] * nr[col + 2*bytes - ind]))
|
+ (gdouble) (nr[col + bytes] * nr[col + 2*bytes - ind]))
|
||||||
/ ((gdouble) pr[col - ind]
|
/ ((gdouble) pr[col - ind]
|
||||||
+ (gdouble) pr[col + bytes - ind]
|
+ (gdouble) pr[col + bytes - ind]
|
||||||
+ (gdouble) pr[col + 2*bytes - ind]
|
+ (gdouble) pr[col + 2*bytes - ind]
|
||||||
+ (gdouble) cr[col - ind]
|
+ (gdouble) cr[col - ind]
|
||||||
+ (gdouble) cr[col + bytes - ind]
|
+ (gdouble) cr[col + bytes - ind]
|
||||||
+ (gdouble) cr[col + 2*bytes - ind]
|
+ (gdouble) cr[col + 2*bytes - ind]
|
||||||
+ (gdouble) nr[col - ind]
|
+ (gdouble) nr[col - ind]
|
||||||
+ (gdouble) nr[col + bytes - ind]
|
+ (gdouble) nr[col + bytes - ind]
|
||||||
+ (gdouble) nr[col + 2*bytes - ind])));
|
+ (gdouble) nr[col + 2*bytes - ind])));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Otherwise, this pixel was not selected for randomization,
|
* Otherwise, this pixel was not selected for randomization,
|
||||||
* so use the current value.
|
* so use the current value.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*d++ = (gint) cr[col];
|
*d++ = (gint) cr[col];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Save the modified row, shuffle the row pointers, and every
|
* Save the modified row, shuffle the row pointers, and every
|
||||||
* so often, update the progress meter.
|
* so often, update the progress meter.
|
||||||
*/
|
*/
|
||||||
gimp_pixel_rgn_set_row (dp, dest, x1, row, (x2 - x1));
|
gimp_pixel_rgn_set_row (dp, dest, x1, row, (x2 - x1));
|
||||||
|
|
||||||
tmp = pr;
|
tmp = pr;
|
||||||
pr = cr;
|
pr = cr;
|
||||||
cr = nr;
|
cr = nr;
|
||||||
nr = tmp;
|
nr = tmp;
|
||||||
|
|
||||||
if (PROG_UPDATE_TIME)
|
if (PROG_UPDATE_TIME)
|
||||||
gimp_progress_update ((double) row / (double) (y2 - y1));
|
gimp_progress_update ((double) row / (double) (y2 - y1));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* if we have more cycles to perform, swap the src and dest Pixel Regions
|
* if we have more cycles to perform, swap the src and dest Pixel Regions
|
||||||
*/
|
*/
|
||||||
if (cnt < repeat_count)
|
if (cnt < repeat_count)
|
||||||
{
|
{
|
||||||
if (tp != NULL)
|
if (tp != NULL)
|
||||||
{
|
{
|
||||||
tp = dp;
|
tp = dp;
|
||||||
dp = sp;
|
dp = sp;
|
||||||
sp = tp;
|
sp = tp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tp = &srcPR;
|
tp = &srcPR;
|
||||||
sp = &destPR;
|
sp = &destPR;
|
||||||
dp = &destPR2;
|
dp = &destPR2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -584,12 +584,12 @@ blur_dialog (void)
|
||||||
|
|
||||||
dlg = gimp_dialog_new (_("Blur"), "blur",
|
dlg = gimp_dialog_new (_("Blur"), "blur",
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
gimp_standard_help_func, "filters/blur.html",
|
gimp_standard_help_func, "filters/blur.html",
|
||||||
|
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parameter settings
|
* Parameter settings
|
||||||
|
@ -611,19 +611,19 @@ blur_dialog (void)
|
||||||
/* Random Seed */
|
/* Random Seed */
|
||||||
seed_hbox = gimp_random_seed_new (&pivals.blur_seed, &pivals.blur_randomize);
|
seed_hbox = gimp_random_seed_new (&pivals.blur_seed, &pivals.blur_randomize);
|
||||||
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||||
_("_Random Seed:"), 1.0, 0.5,
|
_("_Random Seed:"), 1.0, 0.5,
|
||||||
seed_hbox, 1, TRUE);
|
seed_hbox, 1, TRUE);
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label),
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label),
|
||||||
GIMP_RANDOM_SEED_SPINBUTTON (seed_hbox));
|
GIMP_RANDOM_SEED_SPINBUTTON (seed_hbox));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Randomization percentage label & scale (1 to 100)
|
* Randomization percentage label & scale (1 to 100)
|
||||||
*/
|
*/
|
||||||
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
||||||
_("R_andomization %:"), SCALE_WIDTH, 0,
|
_("R_andomization %:"), SCALE_WIDTH, 0,
|
||||||
pivals.blur_pct, 1.0, 100.0, 1.0, 10.0, 0,
|
pivals.blur_pct, 1.0, 100.0, 1.0, 10.0, 0,
|
||||||
TRUE, 0, 0,
|
TRUE, 0, 0,
|
||||||
_("Percentage of pixels to be filtered"), NULL);
|
_("Percentage of pixels to be filtered"), NULL);
|
||||||
g_signal_connect (adj, "value_changed",
|
g_signal_connect (adj, "value_changed",
|
||||||
G_CALLBACK (gimp_double_adjustment_update),
|
G_CALLBACK (gimp_double_adjustment_update),
|
||||||
&pivals.blur_pct);
|
&pivals.blur_pct);
|
||||||
|
@ -632,10 +632,10 @@ blur_dialog (void)
|
||||||
* Repeat count label & scale (1 to 100)
|
* Repeat count label & scale (1 to 100)
|
||||||
*/
|
*/
|
||||||
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
|
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
|
||||||
_("R_epeat:"), SCALE_WIDTH, 0,
|
_("R_epeat:"), SCALE_WIDTH, 0,
|
||||||
pivals.blur_rcount, 1.0, 100.0, 1.0, 10.0, 0,
|
pivals.blur_rcount, 1.0, 100.0, 1.0, 10.0, 0,
|
||||||
TRUE, 0, 0,
|
TRUE, 0, 0,
|
||||||
_("Number of times to apply filter"), NULL);
|
_("Number of times to apply filter"), NULL);
|
||||||
g_signal_connect (adj, "value_changed",
|
g_signal_connect (adj, "value_changed",
|
||||||
G_CALLBACK (gimp_double_adjustment_update),
|
G_CALLBACK (gimp_double_adjustment_update),
|
||||||
&pivals.blur_rcount);
|
&pivals.blur_rcount);
|
||||||
|
|
|
@ -33,20 +33,20 @@
|
||||||
*/
|
*/
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (const gchar *name,
|
static void run (const gchar *name,
|
||||||
gint nparams,
|
gint nparams,
|
||||||
const GimpParam *param,
|
const GimpParam *param,
|
||||||
gint *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GimpParam **return_vals);
|
GimpParam **return_vals);
|
||||||
|
|
||||||
static void borderaverage (GimpDrawable *drawable,
|
static void borderaverage (GimpDrawable *drawable,
|
||||||
GimpRGB *result);
|
GimpRGB *result);
|
||||||
|
|
||||||
static gint borderaverage_dialog (void);
|
static gint borderaverage_dialog (void);
|
||||||
|
|
||||||
static void add_new_color (gint bytes,
|
static void add_new_color (gint bytes,
|
||||||
guchar *buffer,
|
guchar *buffer,
|
||||||
gint *cube,
|
gint *cube,
|
||||||
gint bucket_expo);
|
gint bucket_expo);
|
||||||
|
|
||||||
|
|
||||||
GimpPlugInInfo PLUG_IN_INFO =
|
GimpPlugInInfo PLUG_IN_INFO =
|
||||||
|
@ -91,17 +91,17 @@ query (void)
|
||||||
};
|
};
|
||||||
|
|
||||||
gimp_install_procedure ("plug_in_borderaverage",
|
gimp_install_procedure ("plug_in_borderaverage",
|
||||||
"Borderaverage",
|
"Borderaverage",
|
||||||
"",
|
"",
|
||||||
"Philipp Klaus",
|
"Philipp Klaus",
|
||||||
"Internet Access AG",
|
"Internet Access AG",
|
||||||
"1998",
|
"1998",
|
||||||
N_("<Image>/Filters/Colors/_Border Average..."),
|
N_("<Image>/Filters/Colors/_Border Average..."),
|
||||||
"RGB*",
|
"RGB*",
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (args),
|
G_N_ELEMENTS (args),
|
||||||
G_N_ELEMENTS (return_vals),
|
G_N_ELEMENTS (return_vals),
|
||||||
args, return_vals);
|
args, return_vals);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -121,7 +121,7 @@ run (const gchar *name,
|
||||||
|
|
||||||
run_mode = param[0].data.d_int32;
|
run_mode = param[0].data.d_int32;
|
||||||
|
|
||||||
/* Get the specified drawable */
|
/* Get the specified drawable */
|
||||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||||
|
|
||||||
switch (run_mode)
|
switch (run_mode)
|
||||||
|
@ -131,17 +131,17 @@ run (const gchar *name,
|
||||||
borderaverage_thickness = borderaverage_data.thickness;
|
borderaverage_thickness = borderaverage_data.thickness;
|
||||||
borderaverage_bucket_exponent = borderaverage_data.bucket_exponent;
|
borderaverage_bucket_exponent = borderaverage_data.bucket_exponent;
|
||||||
if (! borderaverage_dialog ())
|
if (! borderaverage_dialog ())
|
||||||
status = GIMP_PDB_EXECUTION_ERROR;
|
status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_NONINTERACTIVE:
|
case GIMP_RUN_NONINTERACTIVE:
|
||||||
if (nparams != 5)
|
if (nparams != 5)
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
if (status == GIMP_PDB_SUCCESS)
|
if (status == GIMP_PDB_SUCCESS)
|
||||||
{
|
{
|
||||||
borderaverage_thickness = param[3].data.d_int32;
|
borderaverage_thickness = param[3].data.d_int32;
|
||||||
borderaverage_bucket_exponent = param[4].data.d_int32;
|
borderaverage_bucket_exponent = param[4].data.d_int32;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_WITH_LAST_VALS:
|
case GIMP_RUN_WITH_LAST_VALS:
|
||||||
|
@ -158,26 +158,26 @@ run (const gchar *name,
|
||||||
{
|
{
|
||||||
/* Make sure that the drawable is RGB color */
|
/* Make sure that the drawable is RGB color */
|
||||||
if (gimp_drawable_is_rgb (drawable->drawable_id))
|
if (gimp_drawable_is_rgb (drawable->drawable_id))
|
||||||
{
|
{
|
||||||
gimp_progress_init ( _("Border Average..."));
|
gimp_progress_init ( _("Border Average..."));
|
||||||
borderaverage (drawable, &result_color);
|
borderaverage (drawable, &result_color);
|
||||||
|
|
||||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||||
{
|
{
|
||||||
gimp_palette_set_foreground (&result_color);
|
gimp_palette_set_foreground (&result_color);
|
||||||
}
|
}
|
||||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||||
{
|
{
|
||||||
borderaverage_data.thickness = borderaverage_thickness;
|
borderaverage_data.thickness = borderaverage_thickness;
|
||||||
borderaverage_data.bucket_exponent = borderaverage_bucket_exponent;
|
borderaverage_data.bucket_exponent = borderaverage_bucket_exponent;
|
||||||
gimp_set_data ("plug_in_borderaverage",
|
gimp_set_data ("plug_in_borderaverage",
|
||||||
&borderaverage_data, sizeof (borderaverage_data));
|
&borderaverage_data, sizeof (borderaverage_data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_EXECUTION_ERROR;
|
status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*nreturn_vals = 3;
|
*nreturn_vals = 3;
|
||||||
*return_vals = values;
|
*return_vals = values;
|
||||||
|
@ -193,7 +193,7 @@ run (const gchar *name,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
borderaverage (GimpDrawable *drawable,
|
borderaverage (GimpDrawable *drawable,
|
||||||
GimpRGB *result)
|
GimpRGB *result)
|
||||||
{
|
{
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
|
@ -218,12 +218,12 @@ borderaverage (GimpDrawable *drawable,
|
||||||
for (i = 0; i < bucket_num; i++)
|
for (i = 0; i < bucket_num; i++)
|
||||||
{
|
{
|
||||||
for (j = 0; j < bucket_num; j++)
|
for (j = 0; j < bucket_num; j++)
|
||||||
{
|
{
|
||||||
for (k = 0; k < bucket_num; k++)
|
for (k = 0; k < bucket_num; k++)
|
||||||
{
|
{
|
||||||
cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] = 0;
|
cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the input area. This is the bounding box of the selection in
|
/* Get the input area. This is the bounding box of the selection in
|
||||||
|
@ -255,31 +255,31 @@ borderaverage (GimpDrawable *drawable,
|
||||||
gimp_pixel_rgn_get_row (&myPR, buffer, x1, row, (x2-x1));
|
gimp_pixel_rgn_get_row (&myPR, buffer, x1, row, (x2-x1));
|
||||||
|
|
||||||
if (row < y1 + borderaverage_thickness ||
|
if (row < y1 + borderaverage_thickness ||
|
||||||
row >= y2 - borderaverage_thickness)
|
row >= y2 - borderaverage_thickness)
|
||||||
{
|
{
|
||||||
/* add the whole row */
|
/* add the whole row */
|
||||||
for (col = 0; col < ((x2 - x1) * bytes); col += bytes)
|
for (col = 0; col < ((x2 - x1) * bytes); col += bytes)
|
||||||
{
|
{
|
||||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* add the left border */
|
/* add the left border */
|
||||||
for (col = 0; col < (borderaverage_thickness * bytes); col += bytes)
|
for (col = 0; col < (borderaverage_thickness * bytes); col += bytes)
|
||||||
{
|
{
|
||||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||||
}
|
}
|
||||||
/* add the right border */
|
/* add the right border */
|
||||||
for (col = ((x2 - x1 - borderaverage_thickness) * bytes);
|
for (col = ((x2 - x1 - borderaverage_thickness) * bytes);
|
||||||
col < ((x2 - x1) * bytes); col += bytes)
|
col < ((x2 - x1) * bytes); col += bytes)
|
||||||
{
|
{
|
||||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((row % 5) == 0)
|
if ((row % 5) == 0)
|
||||||
gimp_progress_update ((double) row / (double) (y2 - y1));
|
gimp_progress_update ((double) row / (double) (y2 - y1));
|
||||||
}
|
}
|
||||||
|
|
||||||
max = 0; r = 0; g = 0; b = 0;
|
max = 0; r = 0; g = 0; b = 0;
|
||||||
|
@ -288,20 +288,20 @@ borderaverage (GimpDrawable *drawable,
|
||||||
for (i = 0; i < bucket_num; i++)
|
for (i = 0; i < bucket_num; i++)
|
||||||
{
|
{
|
||||||
for (j = 0; j < bucket_num; j++)
|
for (j = 0; j < bucket_num; j++)
|
||||||
{
|
{
|
||||||
for (k = 0; k < bucket_num; k++)
|
for (k = 0; k < bucket_num; k++)
|
||||||
{
|
{
|
||||||
if (cube[(i << (bucket_rexpo << 1)) +
|
if (cube[(i << (bucket_rexpo << 1)) +
|
||||||
(j << bucket_rexpo) + k] > max)
|
(j << bucket_rexpo) + k] > max)
|
||||||
{
|
{
|
||||||
max = cube[(i << (bucket_rexpo << 1)) +
|
max = cube[(i << (bucket_rexpo << 1)) +
|
||||||
(j << bucket_rexpo) + k];
|
(j << bucket_rexpo) + k];
|
||||||
r = (i<<bucket_expo) + (1<<(bucket_expo - 1));
|
r = (i<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||||
g = (j<<bucket_expo) + (1<<(bucket_expo - 1));
|
g = (j<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||||
b = (k<<bucket_expo) + (1<<(bucket_expo - 1));
|
b = (k<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return the color */
|
/* return the color */
|
||||||
|
@ -313,12 +313,12 @@ borderaverage (GimpDrawable *drawable,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_new_color (gint bytes,
|
add_new_color (gint bytes,
|
||||||
guchar *buffer,
|
guchar *buffer,
|
||||||
gint *cube,
|
gint *cube,
|
||||||
gint bucket_expo)
|
gint bucket_expo)
|
||||||
{
|
{
|
||||||
guchar r, g, b;
|
guchar r, g, b;
|
||||||
gint bucket_rexpo;
|
gint bucket_rexpo;
|
||||||
|
|
||||||
bucket_rexpo = 8 - bucket_expo;
|
bucket_rexpo = 8 - bucket_expo;
|
||||||
r = buffer[0] >>bucket_expo;
|
r = buffer[0] >>bucket_expo;
|
||||||
|
@ -358,12 +358,12 @@ borderaverage_dialog (void)
|
||||||
|
|
||||||
dlg = gimp_dialog_new (_("Borderaverage"), "borderaverage",
|
dlg = gimp_dialog_new (_("Borderaverage"), "borderaverage",
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
gimp_standard_help_func, "filters/borderaverage.html",
|
gimp_standard_help_func, "filters/borderaverage.html",
|
||||||
|
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
vbox = gtk_vbox_new (FALSE, 4);
|
vbox = gtk_vbox_new (FALSE, 4);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
||||||
|
@ -384,7 +384,7 @@ borderaverage_dialog (void)
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
spinbutton = gimp_spin_button_new (&adj, borderaverage_thickness,
|
spinbutton = gimp_spin_button_new (&adj, borderaverage_thickness,
|
||||||
0, 256, 1, 5, 0, 0, 0);
|
0, 256, 1, 5, 0, 0, 0);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (spinbutton);
|
gtk_widget_show (spinbutton);
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
||||||
|
@ -407,20 +407,20 @@ borderaverage_dialog (void)
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
menu = gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
|
menu = gimp_int_option_menu_new (FALSE, G_CALLBACK (gimp_menu_item_update),
|
||||||
&borderaverage_bucket_exponent,
|
&borderaverage_bucket_exponent,
|
||||||
borderaverage_bucket_exponent,
|
borderaverage_bucket_exponent,
|
||||||
|
|
||||||
_("1 (nonsense?)"), 0, NULL,
|
_("1 (nonsense?)"), 0, NULL,
|
||||||
"2", 1, NULL,
|
"2", 1, NULL,
|
||||||
"4", 2, NULL,
|
"4", 2, NULL,
|
||||||
"8", 3, NULL,
|
"8", 3, NULL,
|
||||||
"16", 4, NULL,
|
"16", 4, NULL,
|
||||||
"32", 5, NULL,
|
"32", 5, NULL,
|
||||||
"64", 6, NULL,
|
"64", 6, NULL,
|
||||||
"128", 7, NULL,
|
"128", 7, NULL,
|
||||||
_("256 (nonsense?)"), 8, NULL,
|
_("256 (nonsense?)"), 8, NULL,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (menu);
|
gtk_widget_show (menu);
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), menu);
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), menu);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -55,18 +55,18 @@
|
||||||
|
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (const gchar *name,
|
static void run (const gchar *name,
|
||||||
gint nparams,
|
gint nparams,
|
||||||
const GimpParam *param,
|
const GimpParam *param,
|
||||||
gint *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GimpParam **return_vals);
|
GimpParam **return_vals);
|
||||||
|
|
||||||
static gint32 load_image (const gchar *filename,
|
static gint32 load_image (const gchar *filename,
|
||||||
gint32 run_mode,
|
gint32 run_mode,
|
||||||
GimpPDBStatusType *status /* return value */);
|
GimpPDBStatusType *status /* return value */);
|
||||||
static GimpPDBStatusType save_image (const gchar *filename,
|
static GimpPDBStatusType save_image (const gchar *filename,
|
||||||
gint32 image_ID,
|
gint32 image_ID,
|
||||||
gint32 drawable_ID,
|
gint32 drawable_ID,
|
||||||
gint32 run_mode);
|
gint32 run_mode);
|
||||||
|
|
||||||
static gboolean valid_file (const gchar *filename);
|
static gboolean valid_file (const gchar *filename);
|
||||||
static const gchar * find_extension (const gchar *filename);
|
static const gchar * find_extension (const gchar *filename);
|
||||||
|
@ -111,7 +111,7 @@ query (void)
|
||||||
"Daniel Risacher, Spencer Kimball and Peter Mattis",
|
"Daniel Risacher, Spencer Kimball and Peter Mattis",
|
||||||
"1995-1997",
|
"1995-1997",
|
||||||
"<Load>/bzip2",
|
"<Load>/bzip2",
|
||||||
NULL,
|
NULL,
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (load_args),
|
G_N_ELEMENTS (load_args),
|
||||||
G_N_ELEMENTS (load_return_vals),
|
G_N_ELEMENTS (load_return_vals),
|
||||||
|
@ -124,18 +124,18 @@ query (void)
|
||||||
"Daniel Risacher, Spencer Kimball and Peter Mattis",
|
"Daniel Risacher, Spencer Kimball and Peter Mattis",
|
||||||
"1995-1997",
|
"1995-1997",
|
||||||
"<Save>/bzip2",
|
"<Save>/bzip2",
|
||||||
"RGB*, GRAY*, INDEXED*",
|
"RGB*, GRAY*, INDEXED*",
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (save_args), 0,
|
G_N_ELEMENTS (save_args), 0,
|
||||||
save_args, NULL);
|
save_args, NULL);
|
||||||
|
|
||||||
gimp_register_magic_load_handler ("file_bz2_load",
|
gimp_register_magic_load_handler ("file_bz2_load",
|
||||||
"xcf.bz2,bz2,xcfbz2",
|
"xcf.bz2,bz2,xcfbz2",
|
||||||
"",
|
"",
|
||||||
"0,string,BZh");
|
"0,string,BZh");
|
||||||
gimp_register_save_handler ("file_bz2_save",
|
gimp_register_save_handler ("file_bz2_save",
|
||||||
"xcf.bz2,bz2,xcfbz2",
|
"xcf.bz2,bz2,xcfbz2",
|
||||||
"");
|
"");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -162,42 +162,42 @@ run (const gchar *name,
|
||||||
if (strcmp (name, "file_bz2_load") == 0)
|
if (strcmp (name, "file_bz2_load") == 0)
|
||||||
{
|
{
|
||||||
image_ID = load_image (param[1].data.d_string,
|
image_ID = load_image (param[1].data.d_string,
|
||||||
param[0].data.d_int32,
|
param[0].data.d_int32,
|
||||||
&status);
|
&status);
|
||||||
|
|
||||||
if (image_ID != -1 &&
|
if (image_ID != -1 &&
|
||||||
status == GIMP_PDB_SUCCESS)
|
status == GIMP_PDB_SUCCESS)
|
||||||
{
|
{
|
||||||
*nreturn_vals = 2;
|
*nreturn_vals = 2;
|
||||||
values[1].type = GIMP_PDB_IMAGE;
|
values[1].type = GIMP_PDB_IMAGE;
|
||||||
values[1].data.d_image = image_ID;
|
values[1].data.d_image = image_ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp (name, "file_bz2_save") == 0)
|
else if (strcmp (name, "file_bz2_save") == 0)
|
||||||
{
|
{
|
||||||
switch (run_mode)
|
switch (run_mode)
|
||||||
{
|
{
|
||||||
case GIMP_RUN_INTERACTIVE:
|
case GIMP_RUN_INTERACTIVE:
|
||||||
break;
|
break;
|
||||||
case GIMP_RUN_NONINTERACTIVE:
|
case GIMP_RUN_NONINTERACTIVE:
|
||||||
/* Make sure all the arguments are there! */
|
/* Make sure all the arguments are there! */
|
||||||
if (nparams != 4)
|
if (nparams != 4)
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
break;
|
break;
|
||||||
case GIMP_RUN_WITH_LAST_VALS:
|
case GIMP_RUN_WITH_LAST_VALS:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == GIMP_PDB_SUCCESS)
|
if (status == GIMP_PDB_SUCCESS)
|
||||||
{
|
{
|
||||||
status = save_image (param[3].data.d_string,
|
status = save_image (param[3].data.d_string,
|
||||||
param[1].data.d_int32,
|
param[1].data.d_int32,
|
||||||
param[2].data.d_int32,
|
param[2].data.d_int32,
|
||||||
param[0].data.d_int32);
|
param[0].data.d_int32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -210,12 +210,12 @@ run (const gchar *name,
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
static gint
|
static gint
|
||||||
spawn_bz (gchar *filename,
|
spawn_bz (gchar *filename,
|
||||||
gchar *tmpname,
|
gchar *tmpname,
|
||||||
gchar *parms,
|
gchar *parms,
|
||||||
gint *pid)
|
gint *pid)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
gint tfd;
|
gint tfd;
|
||||||
|
|
||||||
if (!(f = fopen (filename,"wb")))
|
if (!(f = fopen (filename,"wb")))
|
||||||
{
|
{
|
||||||
|
@ -249,9 +249,9 @@ spawn_bz (gchar *filename,
|
||||||
|
|
||||||
static GimpPDBStatusType
|
static GimpPDBStatusType
|
||||||
save_image (const gchar *filename,
|
save_image (const gchar *filename,
|
||||||
gint32 image_ID,
|
gint32 image_ID,
|
||||||
gint32 drawable_ID,
|
gint32 drawable_ID,
|
||||||
gint32 run_mode)
|
gint32 run_mode)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
const gchar *ext;
|
const gchar *ext;
|
||||||
|
@ -270,10 +270,10 @@ save_image (const gchar *filename,
|
||||||
tmpname = gimp_temp_name (ext + 1);
|
tmpname = gimp_temp_name (ext + 1);
|
||||||
|
|
||||||
if (! (gimp_file_save (run_mode,
|
if (! (gimp_file_save (run_mode,
|
||||||
image_ID,
|
image_ID,
|
||||||
drawable_ID,
|
drawable_ID,
|
||||||
tmpname,
|
tmpname,
|
||||||
tmpname) && valid_file (tmpname)) )
|
tmpname) && valid_file (tmpname)) )
|
||||||
{
|
{
|
||||||
unlink (tmpname);
|
unlink (tmpname);
|
||||||
g_free (tmpname);
|
g_free (tmpname);
|
||||||
|
@ -291,15 +291,15 @@ save_image (const gchar *filename,
|
||||||
else if (pid == 0)
|
else if (pid == 0)
|
||||||
{
|
{
|
||||||
if (!(f = fopen (filename, "w")))
|
if (!(f = fopen (filename, "w")))
|
||||||
{
|
{
|
||||||
g_message ("fopen() failed: %s", g_strerror (errno));
|
g_message ("fopen() failed: %s", g_strerror (errno));
|
||||||
g_free (tmpname);
|
g_free (tmpname);
|
||||||
_exit(127);
|
_exit(127);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make stdout for this process be the output file */
|
/* make stdout for this process be the output file */
|
||||||
if (-1 == dup2 (fileno (f), fileno (stdout)))
|
if (-1 == dup2 (fileno (f), fileno (stdout)))
|
||||||
g_message ("dup2() failed: %s", g_strerror (errno));
|
g_message ("dup2() failed: %s", g_strerror (errno));
|
||||||
|
|
||||||
/* and bzip2 into it */
|
/* and bzip2 into it */
|
||||||
execlp ("bzip2", "bzip2", "-cf", tmpname, NULL);
|
execlp ("bzip2", "bzip2", "-cf", tmpname, NULL);
|
||||||
|
@ -319,13 +319,13 @@ save_image (const gchar *filename,
|
||||||
wpid = waitpid (pid, &process_status, 0);
|
wpid = waitpid (pid, &process_status, 0);
|
||||||
|
|
||||||
if ((wpid < 0)
|
if ((wpid < 0)
|
||||||
|| !WIFEXITED (process_status)
|
|| !WIFEXITED (process_status)
|
||||||
|| (WEXITSTATUS (process_status) != 0))
|
|| (WEXITSTATUS (process_status) != 0))
|
||||||
{
|
{
|
||||||
g_message ("bzip2 exited abnormally on file '%s'", tmpname);
|
g_message ("bzip2 exited abnormally on file '%s'", tmpname);
|
||||||
g_free (tmpname);
|
g_free (tmpname);
|
||||||
return GIMP_PDB_EXECUTION_ERROR;
|
return GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink (tmpname);
|
unlink (tmpname);
|
||||||
|
@ -336,8 +336,8 @@ save_image (const gchar *filename,
|
||||||
|
|
||||||
static gint32
|
static gint32
|
||||||
load_image (const gchar *filename,
|
load_image (const gchar *filename,
|
||||||
gint32 run_mode,
|
gint32 run_mode,
|
||||||
GimpPDBStatusType *status /* return value */)
|
GimpPDBStatusType *status /* return value */)
|
||||||
{
|
{
|
||||||
gint32 image_ID;
|
gint32 image_ID;
|
||||||
const gchar *ext;
|
const gchar *ext;
|
||||||
|
@ -369,15 +369,15 @@ load_image (const gchar *filename,
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
if (!(f = fopen (tmpname,"w")))
|
if (!(f = fopen (tmpname,"w")))
|
||||||
{
|
{
|
||||||
g_message ("fopen() failed: %s", g_strerror (errno));
|
g_message ("fopen() failed: %s", g_strerror (errno));
|
||||||
g_free (tmpname);
|
g_free (tmpname);
|
||||||
_exit (127);
|
_exit (127);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make stdout for this child process be the temp file */
|
/* make stdout for this child process be the temp file */
|
||||||
if (-1 == dup2 (fileno (f), fileno (stdout)))
|
if (-1 == dup2 (fileno (f), fileno (stdout)))
|
||||||
g_message ("dup2() failed: %s", g_strerror (errno));
|
g_message ("dup2() failed: %s", g_strerror (errno));
|
||||||
|
|
||||||
/* and unzip into it */
|
/* and unzip into it */
|
||||||
execlp ("bzip2", "bzip2", "-cfd", filename, NULL);
|
execlp ("bzip2", "bzip2", "-cfd", filename, NULL);
|
||||||
|
@ -398,14 +398,14 @@ load_image (const gchar *filename,
|
||||||
wpid = waitpid (pid, &process_status, 0);
|
wpid = waitpid (pid, &process_status, 0);
|
||||||
|
|
||||||
if ((wpid < 0)
|
if ((wpid < 0)
|
||||||
|| !WIFEXITED (process_status)
|
|| !WIFEXITED (process_status)
|
||||||
|| (WEXITSTATUS (process_status) != 0))
|
|| (WEXITSTATUS (process_status) != 0))
|
||||||
{
|
{
|
||||||
g_message ("bzip2 exited abnormally on file '%s'", filename);
|
g_message ("bzip2 exited abnormally on file '%s'", filename);
|
||||||
g_free (tmpname);
|
g_free (tmpname);
|
||||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now that we un-bzip2ed it, load the temp file */
|
/* now that we un-bzip2ed it, load the temp file */
|
||||||
|
@ -455,22 +455,22 @@ find_extension (const gchar* filename)
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
if (!ext || ext[1] == '\0' || strchr (ext, '/'))
|
if (!ext || ext[1] == '\0' || strchr (ext, '/'))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (0 == g_ascii_strcasecmp (ext, ".xcfbz2"))
|
if (0 == g_ascii_strcasecmp (ext, ".xcfbz2"))
|
||||||
{
|
{
|
||||||
return ".xcf"; /* we've found it */
|
return ".xcf"; /* we've found it */
|
||||||
}
|
}
|
||||||
if (0 != g_ascii_strcasecmp (ext, ".bz2"))
|
if (0 != g_ascii_strcasecmp (ext, ".bz2"))
|
||||||
{
|
{
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* we found ".bz2" so strip it, loop back, and look again */
|
/* we found ".bz2" so strip it, loop back, and look again */
|
||||||
*ext = '\0';
|
*ext = '\0';
|
||||||
ext = strrchr (filename_copy, '.');
|
ext = strrchr (filename_copy, '.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,23 +73,23 @@ query (void)
|
||||||
};
|
};
|
||||||
|
|
||||||
gimp_install_procedure ("plug_in_c_astretch",
|
gimp_install_procedure ("plug_in_c_astretch",
|
||||||
"Automatically stretch the contrast of the "
|
"Automatically stretch the contrast of the "
|
||||||
"specified drawable to cover all possible ranges.",
|
"specified drawable to cover all possible ranges.",
|
||||||
"This simple plug-in does an automatic contrast "
|
"This simple plug-in does an automatic contrast "
|
||||||
"stretch. For each channel in the image, it finds "
|
"stretch. For each channel in the image, it finds "
|
||||||
"the minimum and maximum values... it uses those "
|
"the minimum and maximum values... it uses those "
|
||||||
"values to stretch the individual histograms to the "
|
"values to stretch the individual histograms to the "
|
||||||
"full contrast range. For some images it may do "
|
"full contrast range. For some images it may do "
|
||||||
"just what you want; for others it may not work "
|
"just what you want; for others it may not work "
|
||||||
"that well.",
|
"that well.",
|
||||||
"Federico Mena Quintero",
|
"Federico Mena Quintero",
|
||||||
"Federico Mena Quintero",
|
"Federico Mena Quintero",
|
||||||
"1996",
|
"1996",
|
||||||
N_("<Image>/Layer/Colors/Auto/_Stretch Contrast"),
|
N_("<Image>/Layer/Colors/Auto/_Stretch Contrast"),
|
||||||
"RGB*, GRAY*, INDEXED*",
|
"RGB*, GRAY*, INDEXED*",
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (args), 0,
|
G_N_ELEMENTS (args), 0,
|
||||||
args, NULL);
|
args, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -122,14 +122,14 @@ run (const gchar *name,
|
||||||
c_astretch (drawable);
|
c_astretch (drawable);
|
||||||
|
|
||||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||||
gimp_displays_flush ();
|
gimp_displays_flush ();
|
||||||
}
|
}
|
||||||
else if (gimp_drawable_is_indexed (drawable->drawable_id))
|
else if (gimp_drawable_is_indexed (drawable->drawable_id))
|
||||||
{
|
{
|
||||||
indexed_c_astretch (image_ID);
|
indexed_c_astretch (image_ID);
|
||||||
|
|
||||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||||
gimp_displays_flush ();
|
gimp_displays_flush ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -150,8 +150,8 @@ static void
|
||||||
indexed_c_astretch (gint32 image_ID)
|
indexed_c_astretch (gint32 image_ID)
|
||||||
{
|
{
|
||||||
guchar *cmap;
|
guchar *cmap;
|
||||||
gint ncols,i;
|
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);
|
cmap = gimp_image_get_cmap (image_ID, &ncols);
|
||||||
|
|
||||||
|
@ -174,22 +174,22 @@ indexed_c_astretch (gint32 image_ID)
|
||||||
for (i=0;i<ncols;i++)
|
for (i=0;i<ncols;i++)
|
||||||
{
|
{
|
||||||
if (rhi!=rlo)
|
if (rhi!=rlo)
|
||||||
cmap[i*3 +0] = (255 * (cmap[i*3 +0] - rlo)) / (rhi-rlo);
|
cmap[i*3 +0] = (255 * (cmap[i*3 +0] - rlo)) / (rhi-rlo);
|
||||||
if (ghi!=glo)
|
if (ghi!=glo)
|
||||||
cmap[i*3 +1] = (255 * (cmap[i*3 +1] - glo)) / (ghi-glo);
|
cmap[i*3 +1] = (255 * (cmap[i*3 +1] - glo)) / (ghi-glo);
|
||||||
if (rhi!=rlo)
|
if (rhi!=rlo)
|
||||||
cmap[i*3 +2] = (255 * (cmap[i*3 +2] - blo)) / (bhi-blo);
|
cmap[i*3 +2] = (255 * (cmap[i*3 +2] - blo)) / (bhi-blo);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_image_set_cmap (image_ID, cmap, ncols);
|
gimp_image_set_cmap (image_ID, cmap, ncols);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gint alpha;
|
gint alpha;
|
||||||
guchar lut[256][3];
|
guchar lut[256][3];
|
||||||
guchar min[3];
|
guchar min[3];
|
||||||
guchar max[3];
|
guchar max[3];
|
||||||
gboolean has_alpha;
|
gboolean has_alpha;
|
||||||
} AutoStretchParam_t;
|
} AutoStretchParam_t;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -197,18 +197,18 @@ find_min_max (const guchar *src,
|
||||||
gint bpp,
|
gint bpp,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
AutoStretchParam_t *param = (AutoStretchParam_t*) data;
|
AutoStretchParam_t *param = data;
|
||||||
gint b;
|
gint b;
|
||||||
|
|
||||||
for (b = 0; b < param->alpha; b++)
|
for (b = 0; b < param->alpha; b++)
|
||||||
{
|
{
|
||||||
if (!param->has_alpha || src[param->alpha])
|
if (!param->has_alpha || src[param->alpha])
|
||||||
{
|
{
|
||||||
if (src[b] < param->min[b])
|
if (src[b] < param->min[b])
|
||||||
param->min[b] = src[b];
|
param->min[b] = src[b];
|
||||||
if (src[b] > param->max[b])
|
if (src[b] > param->max[b])
|
||||||
param->max[b] = src[b];
|
param->max[b] = src[b];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,8 +218,8 @@ c_astretch_func (const guchar *src,
|
||||||
gint bpp,
|
gint bpp,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
AutoStretchParam_t *param = (AutoStretchParam_t*) data;
|
AutoStretchParam_t *param = data;
|
||||||
gint b;
|
gint b;
|
||||||
|
|
||||||
for (b = 0; b < param->alpha; b++)
|
for (b = 0; b < param->alpha; b++)
|
||||||
dest[b] = param->lut[src[b]][b];
|
dest[b] = param->lut[src[b]][b];
|
||||||
|
@ -232,7 +232,7 @@ static void
|
||||||
c_astretch (GimpDrawable *drawable)
|
c_astretch (GimpDrawable *drawable)
|
||||||
{
|
{
|
||||||
AutoStretchParam_t param;
|
AutoStretchParam_t param;
|
||||||
gint b;
|
gint b;
|
||||||
|
|
||||||
param.has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
|
param.has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
|
||||||
param.alpha = (param.has_alpha) ? drawable->bpp - 1 : drawable->bpp;
|
param.alpha = (param.has_alpha) ? drawable->bpp - 1 : drawable->bpp;
|
||||||
|
@ -250,10 +250,10 @@ c_astretch (GimpDrawable *drawable)
|
||||||
gint x;
|
gint x;
|
||||||
|
|
||||||
if (range != 0)
|
if (range != 0)
|
||||||
for (x = param.min[b]; x <= param.max[b]; x++)
|
for (x = param.min[b]; x <= param.max[b]; x++)
|
||||||
param.lut[x][b] = 255 * (x - param.min[b]) / range;
|
param.lut[x][b] = 255 * (x - param.min[b]) / range;
|
||||||
else
|
else
|
||||||
param.lut[param.min[b]][b] = param.min[b];
|
param.lut[param.min[b]][b] = param.min[b];
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_rgn_iterate2 (drawable, run_mode, c_astretch_func, ¶m);
|
gimp_rgn_iterate2 (drawable, run_mode, c_astretch_func, ¶m);
|
||||||
|
|
|
@ -100,11 +100,11 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
gint bpp;
|
gint bpp;
|
||||||
gdouble scale;
|
gdouble scale;
|
||||||
guchar *bits;
|
guchar *bits;
|
||||||
} mwPreview;
|
} mwPreview;
|
||||||
|
|
||||||
#define PREVIEW_SIZE 200
|
#define PREVIEW_SIZE 200
|
||||||
|
@ -521,7 +521,7 @@ cm_dialog (void)
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|
||||||
red_value = green_value = blue_value = 0.0;
|
red_value = green_value = blue_value = 0.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -535,7 +535,7 @@ cm_dialog (void)
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
hbox = gtk_hbox_new (FALSE, 6);
|
hbox = gtk_hbox_new (FALSE, 6);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
|
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
|
||||||
|
@ -1043,7 +1043,7 @@ cm_load_file_callback (GtkWidget *widget,
|
||||||
|
|
||||||
g_signal_connect (filesel, "response",
|
g_signal_connect (filesel, "response",
|
||||||
G_CALLBACK (cm_load_file_response_callback),
|
G_CALLBACK (cm_load_file_response_callback),
|
||||||
mix);
|
mix);
|
||||||
g_signal_connect (filesel, "delete_event",
|
g_signal_connect (filesel, "delete_event",
|
||||||
G_CALLBACK (gtk_true),
|
G_CALLBACK (gtk_true),
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -1075,12 +1075,12 @@ cm_load_file_response_callback (GtkFileSelection *fs,
|
||||||
fp = fopen (mix->filename, "r");
|
fp = fopen (mix->filename, "r");
|
||||||
|
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
gchar buf[3][CM_LINE_SIZE];
|
gchar buf[3][CM_LINE_SIZE];
|
||||||
|
|
||||||
buf[0][0] = '\0';
|
buf[0][0] = '\0';
|
||||||
buf[1][0] = '\0';
|
buf[1][0] = '\0';
|
||||||
buf[2][0] = '\0';
|
buf[2][0] = '\0';
|
||||||
|
|
||||||
fgets (buf[0], CM_LINE_SIZE - 1, fp);
|
fgets (buf[0], CM_LINE_SIZE - 1, fp);
|
||||||
|
|
||||||
|
@ -1180,7 +1180,7 @@ cm_save_file_callback (GtkWidget *widget,
|
||||||
|
|
||||||
g_signal_connect (filesel, "response",
|
g_signal_connect (filesel, "response",
|
||||||
G_CALLBACK (cm_save_file_response_callback),
|
G_CALLBACK (cm_save_file_response_callback),
|
||||||
mix);
|
mix);
|
||||||
g_signal_connect (filesel, "delete_event",
|
g_signal_connect (filesel, "delete_event",
|
||||||
G_CALLBACK (gtk_true),
|
G_CALLBACK (gtk_true),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -61,10 +61,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
@ -647,9 +645,7 @@ nova_center_preview_expose (GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
printf("Before\n");
|
|
||||||
nova_center_draw ((NovaCenter*) data, ALL);
|
nova_center_draw ((NovaCenter*) data, ALL);
|
||||||
printf("After\n");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue