On Wednesday 21 July 2004 09:42 am, Sven Neumann wrote:
> Sure, the plug-in is far from perfect. There's some code in compose.c
> that tries to guess some useful default values for the layers it
> preselects. This code could certainly be improved. I am not sure
> though if it makes sense to attempt to guess the compose mode from the
> given layer names. It's probably more useful to remember the last used
> mode (which is what the plug-in does already).
For a start, I'm attaching a patch that makes "compose" use the layers in
reverse order (if the image has more than MIN_COMPOSE_LAYERS = 3 layers,
otherwise use old behavior). No attempt is currently made to guess the mode.
Markus.
*** oldcompose.c Wed Jul 21 17:34:11 2004
--- compose.c Wed Jul 21 21:18:52 2004
***************
*** 105,110 ****
--- 105,112 ----
/* Maximum number of images to compose */
#define MAX_COMPOSE_IMAGES 4
+ /* Minimum number of layers necessary to compose from layers */
+ #define MIN_COMPOSE_LAYERS 3
/* Description of a composition */
***************
*** 1069,1074 ****
--- 1071,1078 ----
GtkWidget *image;
GtkWidget *image_option_menu, *image_menu;
GSList *group;
+ gint32 *layer_list;
+ gint nlayers;
gint j, compose_idx;
gboolean run;
***************
*** 1087,1092 ****
--- 1091,1098 ----
gimp_ui_init ("compose", TRUE);
+ layer_list = gimp_image_get_layers (gimp_drawable_get_image (drawable_ID), &nlayers);
+
dlg = gimp_dialog_new (_("Compose"), "compose",
NULL, 0,
gimp_standard_help_func, "plug-in-compose",
***************
*** 1148,1154 ****
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
! composeint.select_ID[j] = drawable_ID;
composeint.channel_menu[j] = image_option_menu = gtk_option_menu_new ();
image_menu = gimp_drawable_menu_new (check_gray,
image_menu_callback,
--- 1154,1160 ----
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
! composeint.select_ID[j] = ((nlayers >= MIN_COMPOSE_LAYERS) ? layer_list[nlayers - (j + 1)] : drawable_ID);
composeint.channel_menu[j] = image_option_menu = gtk_option_menu_new ();
image_menu = gimp_drawable_menu_new (check_gray,
image_menu_callback,
***************
*** 1161,1166 ****
--- 1167,1173 ----
gtk_option_menu_set_menu (GTK_OPTION_MENU (image_option_menu),
image_menu);
}
+ g_free (layer_list);
/* Set sensitivity of last menu */
gtk_widget_set_sensitive (composeint.channel_menu[3],
_______________________________________________
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer