Commit 3349c37a authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

plug-ins/common/compose.c transfer the image resolution to newly created

2004-11-21  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/compose.c
	* plug-ins/common/decompose.c: transfer the image resolution to
	newly created images.
parent 5f03fc9d
2004-11-21 Sven Neumann <sven@gimp.org>
* plug-ins/common/compose.c
* plug-ins/common/decompose.c: transfer the image resolution to
newly created images.
2004-11-21 Sven Neumann <sven@gimp.org>
 
* plug-ins/gimpressionist/Brushes/snow1.pgm: reverted a change
......
......@@ -442,16 +442,16 @@ compose (const gchar *compose_type,
gint32 *compose_ID,
gboolean compose_by_drawable)
{
gint width, height, tile_height, scan_lines;
gint num_images, compose_idx, incr_src[MAX_COMPOSE_IMAGES];
gint i, j;
gint num_layers;
gint32 layer_ID_dst, image_ID_dst;
guchar *src[MAX_COMPOSE_IMAGES];
guchar *dst;
GimpImageType gdtype_dst;
GimpDrawable *drawable_src[MAX_COMPOSE_IMAGES], *drawable_dst;
GimpPixelRgn pixel_rgn_src[MAX_COMPOSE_IMAGES], pixel_rgn_dst;
gint width, height, tile_height, scan_lines;
gint num_images, compose_idx, incr_src[MAX_COMPOSE_IMAGES];
gint i, j;
gint num_layers;
gint32 layer_ID_dst, image_ID_dst;
guchar *src[MAX_COMPOSE_IMAGES];
guchar *dst;
GimpImageType gdtype_dst;
GimpDrawable *drawable_src[MAX_COMPOSE_IMAGES], *drawable_dst;
GimpPixelRgn pixel_rgn_src[MAX_COMPOSE_IMAGES], pixel_rgn_dst;
/* Search type of composing */
compose_idx = -1;
......@@ -461,7 +461,7 @@ compose (const gchar *compose_type,
compose_idx = j;
}
if (compose_idx < 0)
return (-1);
return -1;
num_images = compose_dsc[compose_idx].num_images;
tile_height = gimp_tile_height ();
......@@ -541,10 +541,20 @@ compose (const gchar *compose_type,
/* Create new image */
gdtype_dst = (compose_dsc[compose_idx].compose_fun == compose_rgba)
? GIMP_RGBA_IMAGE : GIMP_RGB_IMAGE;
image_ID_dst = create_new_image (compose_dsc[compose_idx].filename,
width, height, gdtype_dst,
&layer_ID_dst, &drawable_dst,
&pixel_rgn_dst);
if (! compose_by_drawable)
{
gdouble xres, yres;
gimp_image_get_resolution (compose_ID[0], &xres, &yres);
gimp_image_set_resolution (image_ID_dst, xres, yres);
}
dst = g_new (guchar, tile_height * width * drawable_dst->bpp);
/* Do the composition */
......@@ -608,8 +618,9 @@ create_new_image (const gchar *filename,
gitype = GIMP_RGB;
image_ID = gimp_image_new (width, height, gitype);
gimp_image_set_filename (image_ID, (gchar *) filename);
gimp_image_undo_disable (image_ID);
gimp_image_set_filename (image_ID, filename);
*layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
gdtype, 100, GIMP_NORMAL_MODE);
......
......@@ -63,6 +63,8 @@ static gint32 create_new_image (const gchar *filename,
guint width,
guint height,
GimpImageBaseType type,
gdouble xres,
gdouble yres,
gint32 *layer_ID,
GimpDrawable **drawable,
GimpPixelRgn *pixel_rgn);
......@@ -420,8 +422,9 @@ decompose (gint32 image_ID,
for (j = 0; j < num_images; j++)
{
/* Build a filename like <imagename>-<channel>.<extension> */
gchar *fname;
gchar *extension;
gchar *fname;
gchar *extension;
gdouble xres, yres;
fname = gimp_image_get_filename (image_ID);
......@@ -462,6 +465,8 @@ decompose (gint32 image_ID,
filename = g_strdup (gettext (extract[extract_idx].channel_name[j]));
}
gimp_image_get_resolution (image_ID, &xres, &yres);
if (decovals.as_layers)
{
layername = gettext (extract[extract_idx].channel_name[j]);
......@@ -469,6 +474,7 @@ decompose (gint32 image_ID,
if (j == 0)
image_ID_dst[j] = create_new_image (filename, layername,
width, height, GIMP_GRAY,
xres, yres,
layer_ID_dst + j,
drawable_dst + j,
pixel_rgn_dst + j);
......@@ -482,8 +488,10 @@ decompose (gint32 image_ID,
{
image_ID_dst[j] = create_new_image (filename, NULL,
width, height, GIMP_GRAY,
xres, yres,
layer_ID_dst + j,
drawable_dst + j, pixel_rgn_dst + j);
drawable_dst + j,
pixel_rgn_dst + j);
}
g_free (filename);
......@@ -535,6 +543,8 @@ create_new_image (const gchar *filename,
guint width,
guint height,
GimpImageBaseType type,
gdouble xres,
gdouble yres,
gint32 *layer_ID,
GimpDrawable **drawable,
GimpPixelRgn *pixel_rgn)
......@@ -542,8 +552,10 @@ create_new_image (const gchar *filename,
gint32 image_ID;
image_ID = gimp_image_new (width, height, type);
gimp_image_undo_disable (image_ID);
gimp_image_set_filename (image_ID, filename);
gimp_image_set_resolution (image_ID, xres, yres);
*layer_ID = create_new_layer (image_ID,
layername, width, height, type,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment