mirror of https://github.com/GNOME/gimp.git
plug-ins: port film to GimpImage/GimpDrawable.
This commit is contained in:
parent
3e06295adf
commit
bbf90b3ba5
|
@ -1261,8 +1261,6 @@ file_xwd_LDADD = \
|
||||||
$(INTLLIBS) \
|
$(INTLLIBS) \
|
||||||
$(file_xwd_RC)
|
$(file_xwd_RC)
|
||||||
|
|
||||||
film_CPPFLAGS = $(AM_CPPFLAGS) -DGIMP_DEPRECATED_REPLACE_NEW_API
|
|
||||||
|
|
||||||
film_SOURCES = \
|
film_SOURCES = \
|
||||||
film.c
|
film.c
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ typedef struct
|
||||||
gint number_pos[2]; /* flags where to draw numbers (top/bottom) */
|
gint number_pos[2]; /* flags where to draw numbers (top/bottom) */
|
||||||
gint keep_height; /* flag if to keep max. image height */
|
gint keep_height; /* flag if to keep max. image height */
|
||||||
gint num_images; /* number of images */
|
gint num_images; /* number of images */
|
||||||
gint32 image[MAX_FILM_PICTURES]; /* list of image IDs */
|
GList *images; /* list of image IDs */
|
||||||
} FilmVals;
|
} FilmVals;
|
||||||
|
|
||||||
/* Data to use for the dialog */
|
/* Data to use for the dialog */
|
||||||
|
@ -98,20 +98,20 @@ static GimpProcedure * film_create_procedure (GimpPlugIn *plug_in,
|
||||||
|
|
||||||
static GimpValueArray * film_run (GimpProcedure *procedure,
|
static GimpValueArray * film_run (GimpProcedure *procedure,
|
||||||
GimpRunMode run_mode,
|
GimpRunMode run_mode,
|
||||||
gint32 image_id,
|
GimpImage *image,
|
||||||
gint32 drawable_id,
|
GimpDrawable *drawable,
|
||||||
const GimpValueArray *args,
|
const GimpValueArray *args,
|
||||||
gpointer run_data);
|
gpointer run_data);
|
||||||
|
|
||||||
static gint32 create_new_image (const gchar *filename,
|
static GimpImage * create_new_image (const gchar *filename,
|
||||||
guint width,
|
guint width,
|
||||||
guint height,
|
guint height,
|
||||||
GimpImageType gdtype,
|
GimpImageType gdtype,
|
||||||
gint32 *layer_ID);
|
GimpLayer **layer);
|
||||||
|
|
||||||
static gchar * compose_image_name (gint32 image_ID);
|
static gchar * compose_image_name (GimpImage *image);
|
||||||
|
|
||||||
static gint32 film (void);
|
static GimpImage * film (void);
|
||||||
|
|
||||||
static gboolean check_filmvals (void);
|
static gboolean check_filmvals (void);
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ static void set_pixels (gint numpix,
|
||||||
static guchar * create_hole_rgb (gint width,
|
static guchar * create_hole_rgb (gint width,
|
||||||
gint height);
|
gint height);
|
||||||
|
|
||||||
static void draw_number (gint32 layer_ID,
|
static void draw_number (GimpLayer *layer,
|
||||||
gint num,
|
gint num,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
|
@ -135,11 +135,10 @@ static void del_list_item_callback (GtkWidget *widget,
|
||||||
GtkTreeSelection *sel);
|
GtkTreeSelection *sel);
|
||||||
|
|
||||||
static GtkTreeModel * add_image_list (gboolean add_box_flag,
|
static GtkTreeModel * add_image_list (gboolean add_box_flag,
|
||||||
gint n,
|
GList *images,
|
||||||
gint32 *image_id,
|
|
||||||
GtkWidget *hbox);
|
GtkWidget *hbox);
|
||||||
|
|
||||||
static gboolean film_dialog (gint32 image_ID);
|
static gboolean film_dialog (GimpImage *image);
|
||||||
static void film_reset_callback (GtkWidget *widget,
|
static void film_reset_callback (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void film_font_select_callback (GimpFontSelectButton *button,
|
static void film_font_select_callback (GimpFontSelectButton *button,
|
||||||
|
@ -181,7 +180,7 @@ static FilmVals filmvals =
|
||||||
{ TRUE, TRUE }, /* Numbering on top and bottom */
|
{ TRUE, TRUE }, /* Numbering on top and bottom */
|
||||||
0, /* Don't keep max. image height */
|
0, /* Don't keep max. image height */
|
||||||
0, /* Number of images */
|
0, /* Number of images */
|
||||||
{ 0 } /* Input image list */
|
NULL /* Input image list */
|
||||||
};
|
};
|
||||||
|
|
||||||
static FilmInterface filmint =
|
static FilmInterface filmint =
|
||||||
|
@ -302,13 +301,15 @@ film_create_procedure (GimpPlugIn *plug_in,
|
||||||
static GimpValueArray *
|
static GimpValueArray *
|
||||||
film_run (GimpProcedure *procedure,
|
film_run (GimpProcedure *procedure,
|
||||||
GimpRunMode run_mode,
|
GimpRunMode run_mode,
|
||||||
gint32 image_id,
|
GimpImage *image,
|
||||||
gint32 drawable_id,
|
GimpDrawable *drawable,
|
||||||
const GimpValueArray *args,
|
const GimpValueArray *args,
|
||||||
gpointer run_data)
|
gpointer run_data)
|
||||||
{
|
{
|
||||||
GimpValueArray *return_vals = NULL;
|
GimpValueArray *return_vals = NULL;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
const gint32 *ids;
|
||||||
|
gint i;
|
||||||
|
|
||||||
INIT_I18N ();
|
INIT_I18N ();
|
||||||
gegl_init (NULL, NULL);
|
gegl_init (NULL, NULL);
|
||||||
|
@ -320,7 +321,7 @@ film_run (GimpProcedure *procedure,
|
||||||
gimp_get_data (PLUG_IN_PROC, &filmvals);
|
gimp_get_data (PLUG_IN_PROC, &filmvals);
|
||||||
|
|
||||||
/* First acquire information with a dialog */
|
/* First acquire information with a dialog */
|
||||||
if (! film_dialog (image_id))
|
if (! film_dialog (image))
|
||||||
return gimp_procedure_new_return_values (procedure, GIMP_PDB_CANCEL,
|
return gimp_procedure_new_return_values (procedure, GIMP_PDB_CANCEL,
|
||||||
NULL);
|
NULL);
|
||||||
break;
|
break;
|
||||||
|
@ -344,10 +345,15 @@ film_run (GimpProcedure *procedure,
|
||||||
GIMP_VALUES_GET_RGB (args, 4, &filmvals.number_color);
|
GIMP_VALUES_GET_RGB (args, 4, &filmvals.number_color);
|
||||||
filmvals.number_pos[0] = GIMP_VALUES_GET_INT (args, 5);
|
filmvals.number_pos[0] = GIMP_VALUES_GET_INT (args, 5);
|
||||||
filmvals.number_pos[1] = GIMP_VALUES_GET_INT (args, 6);
|
filmvals.number_pos[1] = GIMP_VALUES_GET_INT (args, 6);
|
||||||
|
|
||||||
filmvals.num_images = GIMP_VALUES_GET_INT (args, 7);
|
filmvals.num_images = GIMP_VALUES_GET_INT (args, 7);
|
||||||
memcpy (filmvals.image,
|
ids = GIMP_VALUES_GET_INT32_ARRAY (args, 8);
|
||||||
GIMP_VALUES_GET_INT32_ARRAY (args, 8),
|
filmvals.images = NULL;
|
||||||
filmvals.num_images * sizeof (gint32));
|
|
||||||
|
for (i = 0; i < filmvals.num_images; i++)
|
||||||
|
filmvals.images = g_list_prepend (filmvals.images,
|
||||||
|
gimp_image_get_by_id (ids[i]));
|
||||||
|
filmvals.images = g_list_reverse (filmvals.images);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_WITH_LAST_VALS:
|
case GIMP_RUN_WITH_LAST_VALS:
|
||||||
|
@ -364,13 +370,13 @@ film_run (GimpProcedure *procedure,
|
||||||
|
|
||||||
if (status == GIMP_PDB_SUCCESS)
|
if (status == GIMP_PDB_SUCCESS)
|
||||||
{
|
{
|
||||||
gint32 image_id;
|
GimpImage *image;
|
||||||
|
|
||||||
gimp_progress_init (_("Composing images"));
|
gimp_progress_init (_("Composing images"));
|
||||||
|
|
||||||
image_id = film ();
|
image = film ();
|
||||||
|
|
||||||
if (image_id < 1)
|
if (! image)
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_EXECUTION_ERROR;
|
status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -379,13 +385,13 @@ film_run (GimpProcedure *procedure,
|
||||||
return_vals = gimp_procedure_new_return_values (procedure, status,
|
return_vals = gimp_procedure_new_return_values (procedure, status,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
GIMP_VALUES_SET_IMAGE (return_vals, 1, image_id);
|
GIMP_VALUES_SET_IMAGE (return_vals, 1, image);
|
||||||
|
|
||||||
gimp_image_undo_enable (image_id);
|
gimp_image_undo_enable (image);
|
||||||
gimp_image_clean_all (image_id);
|
gimp_image_clean_all (image);
|
||||||
|
|
||||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||||
gimp_display_new (image_id);
|
gimp_display_new (image);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store data */
|
/* Store data */
|
||||||
|
@ -400,7 +406,7 @@ film_run (GimpProcedure *procedure,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compose a roll film image from several images */
|
/* Compose a roll film image from several images */
|
||||||
static gint32
|
static GimpImage *
|
||||||
film (void)
|
film (void)
|
||||||
{
|
{
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
@ -410,24 +416,30 @@ film (void)
|
||||||
gint picture_space, picture_x0, picture_y0;
|
gint picture_space, picture_x0, picture_y0;
|
||||||
gint hole_offset, hole_width, hole_height, hole_space, hole_x;
|
gint hole_offset, hole_width, hole_height, hole_space, hole_x;
|
||||||
gint number_height, num_images, num_pictures;
|
gint number_height, num_images, num_pictures;
|
||||||
gint j, k, picture_count;
|
gint picture_count;
|
||||||
gdouble f;
|
gdouble f;
|
||||||
gint num_layers;
|
GimpImage *image_dst;
|
||||||
gint32 *image_ID_src, image_ID_dst, layer_ID_src, layer_ID_dst;
|
GimpImage *image_tmp;
|
||||||
gint image_ID_tmp;
|
GimpLayer *layer_src;
|
||||||
gint32 *layers;
|
GimpLayer *layer_dst;
|
||||||
gint new_layer;
|
GimpLayer *new_layer;
|
||||||
gint floating_sel;
|
GimpLayer *floating_sel;
|
||||||
|
|
||||||
|
GList *images_src;
|
||||||
|
GList *layers;
|
||||||
|
GList *iter;
|
||||||
|
GList *iter2;
|
||||||
|
|
||||||
|
|
||||||
/* initialize */
|
/* initialize */
|
||||||
|
|
||||||
layers = NULL;
|
layers = NULL;
|
||||||
|
|
||||||
num_images = filmvals.num_images;
|
num_images = filmvals.num_images;
|
||||||
image_ID_src = filmvals.image;
|
images_src = filmvals.images;
|
||||||
|
|
||||||
if (num_images <= 0)
|
if (num_images <= 0)
|
||||||
return (-1);
|
return NULL;
|
||||||
|
|
||||||
gimp_context_push ();
|
gimp_context_push ();
|
||||||
gimp_context_set_foreground (&filmvals.number_color);
|
gimp_context_set_foreground (&filmvals.number_color);
|
||||||
|
@ -436,9 +448,9 @@ film (void)
|
||||||
if (filmvals.keep_height) /* Search maximum picture height */
|
if (filmvals.keep_height) /* Search maximum picture height */
|
||||||
{
|
{
|
||||||
picture_height = 0;
|
picture_height = 0;
|
||||||
for (j = 0; j < num_images; j++)
|
for (iter = images_src; iter; iter = iter->next)
|
||||||
{
|
{
|
||||||
height = gimp_image_height (image_ID_src[j]);
|
height = gimp_image_height (iter->data);
|
||||||
if (height > picture_height) picture_height = height;
|
if (height > picture_height) picture_height = height;
|
||||||
}
|
}
|
||||||
film_height = (int)(picture_height / filmvals.picture_height + 0.5);
|
film_height = (int)(picture_height / filmvals.picture_height + 0.5);
|
||||||
|
@ -458,18 +470,18 @@ film (void)
|
||||||
/* Calculate total film width */
|
/* Calculate total film width */
|
||||||
film_width = 0;
|
film_width = 0;
|
||||||
num_pictures = 0;
|
num_pictures = 0;
|
||||||
for (j = 0; j < num_images; j++)
|
for (iter = images_src; iter; iter = iter->next)
|
||||||
{
|
{
|
||||||
layers = gimp_image_get_layers (image_ID_src[j], &num_layers);
|
layers = gimp_image_get_layers (iter->data);
|
||||||
/* Get scaled image size */
|
/* Get scaled image size */
|
||||||
width = gimp_image_width (image_ID_src[j]);
|
width = gimp_image_width (iter->data);
|
||||||
height = gimp_image_height (image_ID_src[j]);
|
height = gimp_image_height (iter->data);
|
||||||
f = ((double)picture_height) / (double)height;
|
f = ((double)picture_height) / (double)height;
|
||||||
picture_width = width * f;
|
picture_width = width * f;
|
||||||
|
|
||||||
for (k = 0; k < num_layers; k++)
|
for (iter2 = layers; iter2; iter2 = iter2->next)
|
||||||
{
|
{
|
||||||
if (gimp_layer_is_floating_sel (layers[k]))
|
if (gimp_layer_is_floating_sel (iter2->data))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
film_width += (picture_space/2); /* Leading space */
|
film_width += (picture_space/2); /* Leading space */
|
||||||
|
@ -478,7 +490,7 @@ film (void)
|
||||||
num_pictures++;
|
num_pictures++;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (layers);
|
g_list_free (layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FILM_DEBUG
|
#ifdef FILM_DEBUG
|
||||||
|
@ -488,12 +500,12 @@ film (void)
|
||||||
g_printerr ("Number of pictures = %d\n", num_pictures);
|
g_printerr ("Number of pictures = %d\n", num_pictures);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
image_ID_dst = create_new_image (_("Untitled"),
|
image_dst = create_new_image (_("Untitled"),
|
||||||
(guint) film_width, (guint) film_height,
|
(guint) film_width, (guint) film_height,
|
||||||
GIMP_RGB_IMAGE, &layer_ID_dst);
|
GIMP_RGB_IMAGE, &layer_dst);
|
||||||
|
|
||||||
/* Fill film background */
|
/* Fill film background */
|
||||||
gimp_drawable_fill (layer_ID_dst, GIMP_FILL_BACKGROUND);
|
gimp_drawable_fill (GIMP_DRAWABLE (layer_dst), GIMP_FILL_BACKGROUND);
|
||||||
|
|
||||||
/* Draw all the holes */
|
/* Draw all the holes */
|
||||||
hole_offset = film_height * filmvals.hole_offset;
|
hole_offset = film_height * filmvals.hole_offset;
|
||||||
|
@ -510,7 +522,7 @@ film (void)
|
||||||
hole = create_hole_rgb (hole_width, hole_height);
|
hole = create_hole_rgb (hole_width, hole_height);
|
||||||
if (hole)
|
if (hole)
|
||||||
{
|
{
|
||||||
GeglBuffer *buffer = gimp_drawable_get_buffer (layer_ID_dst);
|
GeglBuffer *buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer_dst));
|
||||||
|
|
||||||
while (hole_x < film_width)
|
while (hole_x < film_width)
|
||||||
{
|
{
|
||||||
|
@ -540,30 +552,30 @@ film (void)
|
||||||
/* Compose all images and layers */
|
/* Compose all images and layers */
|
||||||
picture_x0 = 0;
|
picture_x0 = 0;
|
||||||
picture_count = 0;
|
picture_count = 0;
|
||||||
for (j = 0; j < num_images; j++)
|
for (iter = images_src; iter; iter = iter->next)
|
||||||
{
|
{
|
||||||
image_ID_tmp = gimp_image_duplicate (image_ID_src[j]);
|
image_tmp = gimp_image_duplicate (iter->data);
|
||||||
width = gimp_image_width (image_ID_tmp);
|
width = gimp_image_width (image_tmp);
|
||||||
height = gimp_image_height (image_ID_tmp);
|
height = gimp_image_height (image_tmp);
|
||||||
f = ((gdouble) picture_height) / (gdouble) height;
|
f = ((gdouble) picture_height) / (gdouble) height;
|
||||||
picture_width = width * f;
|
picture_width = width * f;
|
||||||
if (gimp_image_base_type (image_ID_tmp) != GIMP_RGB)
|
if (gimp_image_base_type (image_tmp) != GIMP_RGB)
|
||||||
gimp_image_convert_rgb (image_ID_tmp);
|
gimp_image_convert_rgb (image_tmp);
|
||||||
gimp_image_scale (image_ID_tmp, picture_width, picture_height);
|
gimp_image_scale (image_tmp, picture_width, picture_height);
|
||||||
|
|
||||||
layers = gimp_image_get_layers (image_ID_tmp, &num_layers);
|
layers = gimp_image_get_layers (image_tmp);
|
||||||
for (k = 0; k < num_layers; k++)
|
for (iter2 = layers; iter2; iter2 = iter2->next)
|
||||||
{
|
{
|
||||||
if (gimp_layer_is_floating_sel (layers[k]))
|
if (gimp_layer_is_floating_sel (iter2->data))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
picture_x0 += picture_space / 2;
|
picture_x0 += picture_space / 2;
|
||||||
|
|
||||||
layer_ID_src = layers[k];
|
layer_src = iter2->data;
|
||||||
gimp_layer_resize_to_image_size (layer_ID_src);
|
gimp_layer_resize_to_image_size (layer_src);
|
||||||
new_layer = gimp_layer_new_from_drawable (layer_ID_src,
|
new_layer = gimp_layer_new_from_drawable (GIMP_DRAWABLE (layer_src),
|
||||||
image_ID_dst);
|
image_dst);
|
||||||
gimp_image_insert_layer (image_ID_dst, new_layer, -1, -1);
|
gimp_image_insert_layer (image_dst, new_layer, NULL, -1);
|
||||||
gimp_layer_set_offsets (new_layer, picture_x0, picture_y0);
|
gimp_layer_set_offsets (new_layer, picture_x0, picture_y0);
|
||||||
|
|
||||||
/* Draw picture numbers */
|
/* Draw picture numbers */
|
||||||
|
@ -571,12 +583,12 @@ film (void)
|
||||||
(filmvals.number_pos[0] || filmvals.number_pos[1]))
|
(filmvals.number_pos[0] || filmvals.number_pos[1]))
|
||||||
{
|
{
|
||||||
if (filmvals.number_pos[0])
|
if (filmvals.number_pos[0])
|
||||||
draw_number (layer_ID_dst,
|
draw_number (layer_dst,
|
||||||
filmvals.number_start + picture_count,
|
filmvals.number_start + picture_count,
|
||||||
picture_x0 + picture_width/2,
|
picture_x0 + picture_width/2,
|
||||||
(hole_offset-number_height)/2, number_height);
|
(hole_offset-number_height)/2, number_height);
|
||||||
if (filmvals.number_pos[1])
|
if (filmvals.number_pos[1])
|
||||||
draw_number (layer_ID_dst,
|
draw_number (layer_dst,
|
||||||
filmvals.number_start + picture_count,
|
filmvals.number_start + picture_count,
|
||||||
picture_x0 + picture_width/2,
|
picture_x0 + picture_width/2,
|
||||||
film_height - (hole_offset + number_height)/2,
|
film_height - (hole_offset + number_height)/2,
|
||||||
|
@ -591,21 +603,21 @@ film (void)
|
||||||
picture_count++;
|
picture_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (layers);
|
g_list_free (layers);
|
||||||
gimp_image_delete (image_ID_tmp);
|
gimp_image_delete (image_tmp);
|
||||||
}
|
}
|
||||||
gimp_progress_update (1.0);
|
gimp_progress_update (1.0);
|
||||||
|
|
||||||
gimp_image_flatten (image_ID_dst);
|
gimp_image_flatten (image_dst);
|
||||||
|
|
||||||
/* Drawing text/numbers leaves us with a floating selection. Stop it */
|
/* Drawing text/numbers leaves us with a floating selection. Stop it */
|
||||||
floating_sel = gimp_image_get_floating_sel (image_ID_dst);
|
floating_sel = gimp_image_get_floating_sel (image_dst);
|
||||||
if (floating_sel != -1)
|
if (floating_sel)
|
||||||
gimp_floating_sel_anchor (floating_sel);
|
gimp_floating_sel_anchor (floating_sel);
|
||||||
|
|
||||||
gimp_context_pop ();
|
gimp_context_pop ();
|
||||||
|
|
||||||
return image_ID_dst;
|
return image_dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check filmvals. Unreasonable values are reset to a default. */
|
/* Check filmvals. Unreasonable values are reset to a default. */
|
||||||
|
@ -688,22 +700,22 @@ create_hole_rgb (gint width,
|
||||||
|
|
||||||
/* Draw the number of the picture onto the film */
|
/* Draw the number of the picture onto the film */
|
||||||
static void
|
static void
|
||||||
draw_number (gint32 layer_ID,
|
draw_number (GimpLayer *layer,
|
||||||
gint num,
|
gint num,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint height)
|
gint height)
|
||||||
{
|
{
|
||||||
gchar buf[32];
|
gchar buf[32];
|
||||||
gint k, delta, max_delta;
|
gint k, delta, max_delta;
|
||||||
gint32 image_ID;
|
GimpImage *image;
|
||||||
gint32 text_layer_ID;
|
GimpLayer *text_layer;
|
||||||
gint text_width, text_height, text_ascent, descent;
|
gint text_width, text_height, text_ascent, descent;
|
||||||
gchar *fontname = filmvals.number_font;
|
gchar *fontname = filmvals.number_font;
|
||||||
|
|
||||||
g_snprintf (buf, sizeof (buf), "%d", num);
|
g_snprintf (buf, sizeof (buf), "%d", num);
|
||||||
|
|
||||||
image_ID = gimp_item_get_image (layer_ID);
|
image = gimp_item_get_image (GIMP_ITEM (layer));
|
||||||
|
|
||||||
max_delta = height / 10;
|
max_delta = height / 10;
|
||||||
if (max_delta < 1)
|
if (max_delta < 1)
|
||||||
|
@ -733,25 +745,25 @@ draw_number (gint32 layer_ID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
text_layer_ID = gimp_text_fontname (image_ID, layer_ID,
|
text_layer = gimp_text_fontname (image, GIMP_DRAWABLE (layer),
|
||||||
x, y + descent / 2,
|
x, y + descent / 2,
|
||||||
buf, 1, FALSE,
|
buf, 1, FALSE,
|
||||||
height, GIMP_PIXELS,
|
height, GIMP_PIXELS,
|
||||||
fontname);
|
fontname);
|
||||||
|
|
||||||
if (text_layer_ID == -1)
|
if (! text_layer)
|
||||||
g_message ("draw_number: Error in drawing text\n");
|
g_message ("draw_number: Error in drawing text\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create an image. Sets layer_ID, drawable and rgn. Returns image_ID */
|
/* Create an image. Sets layer, drawable and rgn. Returns image */
|
||||||
static gint32
|
static GimpImage *
|
||||||
create_new_image (const gchar *filename,
|
create_new_image (const gchar *filename,
|
||||||
guint width,
|
guint width,
|
||||||
guint height,
|
guint height,
|
||||||
GimpImageType gdtype,
|
GimpImageType gdtype,
|
||||||
gint32 *layer_ID)
|
GimpLayer **layer)
|
||||||
{
|
{
|
||||||
gint32 image_ID;
|
GimpImage *image;
|
||||||
GimpImageBaseType gitype;
|
GimpImageBaseType gitype;
|
||||||
|
|
||||||
if ((gdtype == GIMP_GRAY_IMAGE) || (gdtype == GIMP_GRAYA_IMAGE))
|
if ((gdtype == GIMP_GRAY_IMAGE) || (gdtype == GIMP_GRAYA_IMAGE))
|
||||||
|
@ -761,30 +773,30 @@ create_new_image (const gchar *filename,
|
||||||
else
|
else
|
||||||
gitype = GIMP_RGB;
|
gitype = GIMP_RGB;
|
||||||
|
|
||||||
image_ID = gimp_image_new (width, height, gitype);
|
image = gimp_image_new (width, height, gitype);
|
||||||
gimp_image_set_filename (image_ID, filename);
|
gimp_image_set_filename (image, filename);
|
||||||
|
|
||||||
gimp_image_undo_disable (image_ID);
|
gimp_image_undo_disable (image);
|
||||||
*layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
|
*layer = gimp_layer_new (image, _("Background"), width, height,
|
||||||
gdtype,
|
gdtype,
|
||||||
100,
|
100,
|
||||||
gimp_image_get_default_new_layer_mode (image_ID));
|
gimp_image_get_default_new_layer_mode (image));
|
||||||
gimp_image_insert_layer (image_ID, *layer_ID, -1, 0);
|
gimp_image_insert_layer (image, *layer, NULL, 0);
|
||||||
|
|
||||||
return image_ID;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static gchar *
|
||||||
compose_image_name (gint32 image_ID)
|
compose_image_name (GimpImage *image)
|
||||||
{
|
{
|
||||||
gchar *image_name;
|
gchar *image_name;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
|
||||||
/* Compose a name of the basename and the image-ID */
|
/* Compose a name of the basename and the image-ID */
|
||||||
|
|
||||||
name = gimp_image_get_name (image_ID);
|
name = gimp_image_get_name (image);
|
||||||
|
|
||||||
image_name = g_strdup_printf ("%s-%d", name, image_ID);
|
image_name = g_strdup_printf ("%s-%d", name, gimp_image_get_id (image));
|
||||||
|
|
||||||
g_free (name);
|
g_free (name);
|
||||||
|
|
||||||
|
@ -807,11 +819,11 @@ add_list_item_callback (GtkWidget *widget,
|
||||||
|
|
||||||
if (gtk_tree_model_get_iter (model, &iter, list->data))
|
if (gtk_tree_model_get_iter (model, &iter, list->data))
|
||||||
{
|
{
|
||||||
gint32 image_ID;
|
GimpImage *image;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
|
||||||
gtk_tree_model_get (model, &iter,
|
gtk_tree_model_get (model, &iter,
|
||||||
0, &image_ID,
|
0, &image,
|
||||||
1, &name,
|
1, &name,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
|
@ -820,7 +832,7 @@ add_list_item_callback (GtkWidget *widget,
|
||||||
|
|
||||||
gtk_list_store_set (GTK_LIST_STORE (filmint.image_list_film),
|
gtk_list_store_set (GTK_LIST_STORE (filmint.image_list_film),
|
||||||
&iter,
|
&iter,
|
||||||
0, image_ID,
|
0, image,
|
||||||
1, name,
|
1, name,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
|
@ -874,8 +886,7 @@ del_list_item_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static GtkTreeModel *
|
static GtkTreeModel *
|
||||||
add_image_list (gboolean add_box_flag,
|
add_image_list (gboolean add_box_flag,
|
||||||
gint n,
|
GList *images,
|
||||||
gint32 *image_id,
|
|
||||||
GtkWidget *hbox)
|
GtkWidget *hbox)
|
||||||
{
|
{
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
|
@ -885,7 +896,7 @@ add_image_list (gboolean add_box_flag,
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GtkListStore *store;
|
GtkListStore *store;
|
||||||
GtkTreeSelection *sel;
|
GtkTreeSelection *sel;
|
||||||
gint i;
|
GList *list;
|
||||||
|
|
||||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
|
||||||
|
@ -926,17 +937,17 @@ add_image_list (gboolean add_box_flag,
|
||||||
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tv));
|
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tv));
|
||||||
gtk_tree_selection_set_mode (sel, GTK_SELECTION_MULTIPLE);
|
gtk_tree_selection_set_mode (sel, GTK_SELECTION_MULTIPLE);
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
for (list = images; list; list = list->next)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
|
|
||||||
name = compose_image_name (image_id[i]);
|
name = compose_image_name (list->data);
|
||||||
|
|
||||||
gtk_list_store_set (store, &iter,
|
gtk_list_store_set (store, &iter,
|
||||||
0, image_id[i],
|
0, gimp_image_get_id (list->data),
|
||||||
1, name,
|
1, name,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
|
@ -959,7 +970,7 @@ add_image_list (gboolean add_box_flag,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
create_selection_tab (GtkWidget *notebook,
|
create_selection_tab (GtkWidget *notebook,
|
||||||
gint32 image_ID)
|
GimpImage *image)
|
||||||
{
|
{
|
||||||
GimpColorConfig *config;
|
GimpColorConfig *config;
|
||||||
GtkSizeGroup *group;
|
GtkSizeGroup *group;
|
||||||
|
@ -974,8 +985,8 @@ create_selection_tab (GtkWidget *notebook,
|
||||||
GtkAdjustment *adj;
|
GtkAdjustment *adj;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GtkWidget *font_button;
|
GtkWidget *font_button;
|
||||||
gint32 *image_id_list;
|
GList *image_id_list;
|
||||||
gint nimages, j;
|
gint j;
|
||||||
|
|
||||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
|
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
|
||||||
|
@ -1140,11 +1151,14 @@ create_selection_tab (GtkWidget *notebook,
|
||||||
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
||||||
|
|
||||||
/* Get a list of all image names */
|
/* Get a list of all image names */
|
||||||
image_id_list = gimp_image_list (&nimages);
|
image_id_list = gimp_image_list ();
|
||||||
filmint.image_list_all = add_image_list (TRUE, nimages, image_id_list, hbox);
|
filmint.image_list_all = add_image_list (TRUE, image_id_list, hbox);
|
||||||
|
g_list_free (image_id_list);
|
||||||
|
|
||||||
/* Get a list of the images used for the film */
|
/* Get a list of the images used for the film */
|
||||||
filmint.image_list_film = add_image_list (FALSE, 1, &image_ID, hbox);
|
image_id_list = g_list_prepend (NULL, image);
|
||||||
|
filmint.image_list_film = add_image_list (FALSE, image_id_list, hbox);
|
||||||
|
g_list_free (image_id_list);
|
||||||
|
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
}
|
}
|
||||||
|
@ -1275,7 +1289,7 @@ create_advanced_tab (GtkWidget *notebook)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
film_dialog (gint32 image_ID)
|
film_dialog (GimpImage *image)
|
||||||
{
|
{
|
||||||
GtkWidget *dlg;
|
GtkWidget *dlg;
|
||||||
GtkWidget *main_vbox;
|
GtkWidget *main_vbox;
|
||||||
|
@ -1309,7 +1323,7 @@ film_dialog (gint32 image_ID)
|
||||||
notebook = gtk_notebook_new ();
|
notebook = gtk_notebook_new ();
|
||||||
gtk_box_pack_start (GTK_BOX (main_vbox), notebook, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (main_vbox), notebook, TRUE, TRUE, 0);
|
||||||
|
|
||||||
create_selection_tab (notebook, image_ID);
|
create_selection_tab (notebook, image);
|
||||||
create_advanced_tab (notebook);
|
create_advanced_tab (notebook);
|
||||||
|
|
||||||
gtk_widget_show (notebook);
|
gtk_widget_show (notebook);
|
||||||
|
@ -1330,14 +1344,15 @@ film_dialog (gint32 image_ID)
|
||||||
iter_valid = gtk_tree_model_iter_next (filmint.image_list_film,
|
iter_valid = gtk_tree_model_iter_next (filmint.image_list_film,
|
||||||
&iter))
|
&iter))
|
||||||
{
|
{
|
||||||
gint image_ID;
|
gint image_id;
|
||||||
|
|
||||||
gtk_tree_model_get (filmint.image_list_film, &iter,
|
gtk_tree_model_get (filmint.image_list_film, &iter,
|
||||||
0, &image_ID,
|
0, &image_id,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
if ((image_ID >= 0) && (num_images < MAX_FILM_PICTURES))
|
if ((image_id >= 0) && (num_images < MAX_FILM_PICTURES))
|
||||||
filmvals.image[num_images++] = image_ID;
|
filmvals.images = g_list_append (filmvals.images,
|
||||||
|
gimp_image_get_by_id (image_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
filmvals.num_images = num_images;
|
filmvals.num_images = num_images;
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
'file-xmc' => { ui => 1, gegl => 1, optional => 1, libs => 'XMC_LIBS', old_api => 1 },
|
'file-xmc' => { ui => 1, gegl => 1, optional => 1, libs => 'XMC_LIBS', old_api => 1 },
|
||||||
'file-xpm' => { ui => 1, gegl => 1, optional => 1, libs => 'XPM_LIBS', old_api => 1 },
|
'file-xpm' => { ui => 1, gegl => 1, optional => 1, libs => 'XPM_LIBS', old_api => 1 },
|
||||||
'file-xwd' => { ui => 1, gegl => 1, old_api => 1 },
|
'file-xwd' => { ui => 1, gegl => 1, old_api => 1 },
|
||||||
'film' => { ui => 1, gegl => 1, old_api => 1 },
|
'film' => { ui => 1, gegl => 1 },
|
||||||
'gradient-map' => { gegl => 1, old_api => 1 },
|
'gradient-map' => { gegl => 1, old_api => 1 },
|
||||||
'grid' => { ui => 1, gegl => 1 },
|
'grid' => { ui => 1, gegl => 1 },
|
||||||
'guillotine' => { old_api => 1 },
|
'guillotine' => { old_api => 1 },
|
||||||
|
|
Loading…
Reference in New Issue