mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 06:14:03 +00:00
Fix bug #134304, as far as it's fixable:
2005-06-10 Michael Natterer <mitch@gimp.org> Fix bug #134304, as far as it's fixable: * app/core/gimp-edit.c (gimp_edit_paste_as_new): handle pasting buffers without alpha. Also don't uselessly convert all buffers to RGB but create an image in the buffer's color space. (gimp_edit_extract): call gimp_selection_extract() with add_alpha = FALSE. * app/core/gimpselection.c (gimp_selection_extract): set add_alpha to TRUE if there is a selection, because the selection could have any shape.
This commit is contained in:
parent
529add3c72
commit
ef4b245610
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2005-06-10 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
Fix bug #134304, as far as it's fixable:
|
||||||
|
|
||||||
|
* app/core/gimp-edit.c (gimp_edit_paste_as_new): handle pasting
|
||||||
|
buffers without alpha. Also don't uselessly convert all buffers
|
||||||
|
to RGB but create an image in the buffer's color space.
|
||||||
|
|
||||||
|
(gimp_edit_extract): call gimp_selection_extract() with
|
||||||
|
add_alpha = FALSE.
|
||||||
|
|
||||||
|
* app/core/gimpselection.c (gimp_selection_extract): set add_alpha
|
||||||
|
to TRUE if there is a selection, because the selection could have
|
||||||
|
any shape.
|
||||||
|
|
||||||
2005-06-09 Sven Neumann <sven@gimp.org>
|
2005-06-09 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* configure.in: bumped version number to 2.3.2.
|
* configure.in: bumped version number to 2.3.2.
|
||||||
|
|
|
@ -170,9 +170,7 @@ gimp_edit_paste (GimpImage *gimage,
|
||||||
else
|
else
|
||||||
type = gimp_image_base_type_with_alpha (gimage);
|
type = gimp_image_base_type_with_alpha (gimage);
|
||||||
|
|
||||||
layer = gimp_layer_new_from_tiles (paste->tiles,
|
layer = gimp_layer_new_from_tiles (paste->tiles, gimage, type,
|
||||||
gimage,
|
|
||||||
type,
|
|
||||||
_("Pasted Layer"),
|
_("Pasted Layer"),
|
||||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
|
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
|
||||||
|
|
||||||
|
@ -271,18 +269,30 @@ gimp_edit_paste_as_new (Gimp *gimp,
|
||||||
GimpImage *invoke,
|
GimpImage *invoke,
|
||||||
GimpBuffer *paste)
|
GimpBuffer *paste)
|
||||||
{
|
{
|
||||||
GimpImage *gimage;
|
GimpImage *gimage;
|
||||||
GimpLayer *layer;
|
GimpLayer *layer;
|
||||||
|
GimpImageType type;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||||
g_return_val_if_fail (invoke == NULL || GIMP_IS_IMAGE (invoke), NULL);
|
g_return_val_if_fail (invoke == NULL || GIMP_IS_IMAGE (invoke), NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_BUFFER (paste), NULL);
|
g_return_val_if_fail (GIMP_IS_BUFFER (paste), NULL);
|
||||||
|
|
||||||
|
switch (tile_manager_bpp (paste->tiles))
|
||||||
|
{
|
||||||
|
case 1: type = GIMP_GRAY_IMAGE; break;
|
||||||
|
case 2: type = GIMP_GRAYA_IMAGE; break;
|
||||||
|
case 3: type = GIMP_RGB_IMAGE; break;
|
||||||
|
case 4: type = GIMP_RGBA_IMAGE; break;
|
||||||
|
default:
|
||||||
|
g_return_val_if_reached (NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* create a new image (always of type GIMP_RGB) */
|
/* create a new image (always of type GIMP_RGB) */
|
||||||
gimage = gimp_create_image (gimp,
|
gimage = gimp_create_image (gimp,
|
||||||
gimp_buffer_get_width (paste),
|
gimp_buffer_get_width (paste),
|
||||||
gimp_buffer_get_height (paste),
|
gimp_buffer_get_height (paste),
|
||||||
GIMP_RGB,
|
GIMP_IMAGE_TYPE_BASE_TYPE (type),
|
||||||
TRUE);
|
TRUE);
|
||||||
gimp_image_undo_disable (gimage);
|
gimp_image_undo_disable (gimage);
|
||||||
|
|
||||||
|
@ -294,9 +304,7 @@ gimp_edit_paste_as_new (Gimp *gimp,
|
||||||
gimp_image_get_unit (invoke));
|
gimp_image_get_unit (invoke));
|
||||||
}
|
}
|
||||||
|
|
||||||
layer = gimp_layer_new_from_tiles (paste->tiles,
|
layer = gimp_layer_new_from_tiles (paste->tiles, gimage, type,
|
||||||
gimage,
|
|
||||||
gimp_image_base_type_with_alpha (gimage),
|
|
||||||
_("Pasted Layer"),
|
_("Pasted Layer"),
|
||||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
|
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
|
||||||
|
|
||||||
|
@ -400,7 +408,7 @@ gimp_edit_extract (GimpImage *gimage,
|
||||||
|
|
||||||
/* Cut/copy the mask portion from the gimage */
|
/* Cut/copy the mask portion from the gimage */
|
||||||
tiles = gimp_selection_extract (gimp_image_get_mask (gimage),
|
tiles = gimp_selection_extract (gimp_image_get_mask (gimage),
|
||||||
drawable, context, cut_pixels, FALSE, TRUE);
|
drawable, context, cut_pixels, FALSE, FALSE);
|
||||||
|
|
||||||
if (cut_pixels)
|
if (cut_pixels)
|
||||||
gimp_image_undo_group_end (gimage);
|
gimp_image_undo_group_end (gimage);
|
||||||
|
|
|
@ -670,6 +670,12 @@ gimp_selection_extract (GimpChannel *selection,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If there is a selection, we must add alpha because the selection
|
||||||
|
* could have any shape.
|
||||||
|
*/
|
||||||
|
if (non_empty)
|
||||||
|
add_alpha = TRUE;
|
||||||
|
|
||||||
/* How many bytes in the temp buffer? */
|
/* How many bytes in the temp buffer? */
|
||||||
switch (GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable)))
|
switch (GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable)))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue