removed "add_alpha" parameter from gimp_item_duplicate() and
2008-01-08 Sven Neumann <sven@gimp.org> * app/core/gimpitem.[ch]: removed "add_alpha" parameter from gimp_item_duplicate() and gimp_item_convert(). This is a relict from the time when only the bottom layer was allowed to have no alpha channel. * app/actions/channels-commands.c * app/actions/layers-commands.c * app/actions/vectors-commands.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-merge.c * app/core/gimpimage-quick-mask.c * app/core/gimplayer.c * app/core/gimplayermask.c * app/core/gimpselection.c * app/display/gimpdisplayshell-dnd.c * app/file/file-open.c * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c * app/text/gimptextlayer.c * app/vectors/gimpvectors.c * app/vectors/gimpvectorsmodundo.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb: changed accordingly. svn path=/trunk/; revision=24570
This commit is contained in:

committed by
Sven Neumann

parent
ef5cda6abf
commit
4aa7e67c67
32
ChangeLog
32
ChangeLog
@ -1,3 +1,35 @@
|
|||||||
|
2008-01-08 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/core/gimpitem.[ch]: removed "add_alpha" parameter from
|
||||||
|
gimp_item_duplicate() and gimp_item_convert(). This is a relict
|
||||||
|
from the time when only the bottom layer was allowed to have no
|
||||||
|
alpha channel.
|
||||||
|
|
||||||
|
* app/actions/channels-commands.c
|
||||||
|
* app/actions/layers-commands.c
|
||||||
|
* app/actions/vectors-commands.c
|
||||||
|
* app/core/gimpchannel.c
|
||||||
|
* app/core/gimpdrawable.c
|
||||||
|
* app/core/gimpimage-duplicate.c
|
||||||
|
* app/core/gimpimage-merge.c
|
||||||
|
* app/core/gimpimage-quick-mask.c
|
||||||
|
* app/core/gimplayer.c
|
||||||
|
* app/core/gimplayermask.c
|
||||||
|
* app/core/gimpselection.c
|
||||||
|
* app/display/gimpdisplayshell-dnd.c
|
||||||
|
* app/file/file-open.c
|
||||||
|
* app/pdb/channel_cmds.c
|
||||||
|
* app/pdb/layer_cmds.c
|
||||||
|
* app/text/gimptextlayer.c
|
||||||
|
* app/vectors/gimpvectors.c
|
||||||
|
* app/vectors/gimpvectorsmodundo.c
|
||||||
|
* app/widgets/gimpchanneltreeview.c
|
||||||
|
* app/widgets/gimpitemtreeview.c
|
||||||
|
* app/widgets/gimplayertreeview.c
|
||||||
|
* app/widgets/gimptoolbox-dnd.c
|
||||||
|
* tools/pdbgen/pdb/channel.pdb
|
||||||
|
* tools/pdbgen/pdb/layer.pdb: changed accordingly.
|
||||||
|
|
||||||
2008-01-08 Sven Neumann <sven@gimp.org>
|
2008-01-08 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/file/file-open.c (file_open_layers): moved code to a utility
|
* app/file/file-open.c (file_open_layers): moved code to a utility
|
||||||
|
@ -259,8 +259,7 @@ channels_duplicate_cmd_callback (GtkAction *action,
|
|||||||
|
|
||||||
new_channel =
|
new_channel =
|
||||||
GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
|
GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
|
||||||
G_TYPE_FROM_INSTANCE (channel),
|
G_TYPE_FROM_INSTANCE (channel)));
|
||||||
TRUE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_image_add_channel (image, new_channel, -1);
|
gimp_image_add_channel (image, new_channel, -1);
|
||||||
@ -339,8 +338,7 @@ channels_new_channel_response (GtkWidget *widget,
|
|||||||
|
|
||||||
new_channel =
|
new_channel =
|
||||||
GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (selection),
|
GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (selection),
|
||||||
GIMP_TYPE_CHANNEL,
|
GIMP_TYPE_CHANNEL));
|
||||||
FALSE));
|
|
||||||
|
|
||||||
gimp_object_set_name (GIMP_OBJECT (new_channel), channel_name);
|
gimp_object_set_name (GIMP_OBJECT (new_channel), channel_name);
|
||||||
gimp_channel_set_color (new_channel, &channel_color, FALSE);
|
gimp_channel_set_color (new_channel, &channel_color, FALSE);
|
||||||
|
@ -414,10 +414,8 @@ layers_duplicate_cmd_callback (GtkAction *action,
|
|||||||
GimpLayer *new_layer;
|
GimpLayer *new_layer;
|
||||||
return_if_no_layer (image, layer, data);
|
return_if_no_layer (image, layer, data);
|
||||||
|
|
||||||
new_layer =
|
new_layer = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
|
||||||
GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
|
G_TYPE_FROM_INSTANCE (layer)));
|
||||||
G_TYPE_FROM_INSTANCE (layer),
|
|
||||||
TRUE));
|
|
||||||
gimp_image_add_layer (image, new_layer, -1);
|
gimp_image_add_layer (image, new_layer, -1);
|
||||||
|
|
||||||
gimp_image_flush (image);
|
gimp_image_flush (image);
|
||||||
|
@ -249,10 +249,8 @@ vectors_duplicate_cmd_callback (GtkAction *action,
|
|||||||
GimpVectors *new_vectors;
|
GimpVectors *new_vectors;
|
||||||
return_if_no_vectors (image, vectors, data);
|
return_if_no_vectors (image, vectors, data);
|
||||||
|
|
||||||
new_vectors =
|
new_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
|
||||||
GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
|
G_TYPE_FROM_INSTANCE (vectors)));
|
||||||
G_TYPE_FROM_INSTANCE (vectors),
|
|
||||||
TRUE));
|
|
||||||
gimp_image_add_vectors (image, new_vectors, -1);
|
gimp_image_add_vectors (image, new_vectors, -1);
|
||||||
gimp_image_flush (image);
|
gimp_image_flush (image);
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,7 @@ static gchar * gimp_channel_get_description (GimpViewable *viewable,
|
|||||||
|
|
||||||
static gboolean gimp_channel_is_attached (GimpItem *item);
|
static gboolean gimp_channel_is_attached (GimpItem *item);
|
||||||
static GimpItem * gimp_channel_duplicate (GimpItem *item,
|
static GimpItem * gimp_channel_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type);
|
||||||
gboolean add_alpha);
|
|
||||||
static void gimp_channel_convert (GimpItem *item,
|
static void gimp_channel_convert (GimpItem *item,
|
||||||
GimpImage *dest_image);
|
GimpImage *dest_image);
|
||||||
static void gimp_channel_translate (GimpItem *item,
|
static void gimp_channel_translate (GimpItem *item,
|
||||||
@ -376,18 +375,13 @@ gimp_channel_is_attached (GimpItem *item)
|
|||||||
|
|
||||||
static GimpItem *
|
static GimpItem *
|
||||||
gimp_channel_duplicate (GimpItem *item,
|
gimp_channel_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type)
|
||||||
gboolean add_alpha)
|
|
||||||
{
|
{
|
||||||
GimpItem *new_item;
|
GimpItem *new_item;
|
||||||
|
|
||||||
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
|
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
|
||||||
|
|
||||||
if (g_type_is_a (new_type, GIMP_TYPE_CHANNEL))
|
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
|
||||||
add_alpha = FALSE;
|
|
||||||
|
|
||||||
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type,
|
|
||||||
add_alpha);
|
|
||||||
|
|
||||||
if (GIMP_IS_CHANNEL (new_item))
|
if (GIMP_IS_CHANNEL (new_item))
|
||||||
{
|
{
|
||||||
|
@ -75,8 +75,7 @@ static gboolean gimp_drawable_get_size (GimpViewable *viewable,
|
|||||||
static void gimp_drawable_invalidate_preview (GimpViewable *viewable);
|
static void gimp_drawable_invalidate_preview (GimpViewable *viewable);
|
||||||
|
|
||||||
static GimpItem * gimp_drawable_duplicate (GimpItem *item,
|
static GimpItem * gimp_drawable_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type);
|
||||||
gboolean add_alpha);
|
|
||||||
static void gimp_drawable_translate (GimpItem *item,
|
static void gimp_drawable_translate (GimpItem *item,
|
||||||
gint offset_x,
|
gint offset_x,
|
||||||
gint offset_y,
|
gint offset_y,
|
||||||
@ -307,36 +306,28 @@ gimp_drawable_invalidate_preview (GimpViewable *viewable)
|
|||||||
|
|
||||||
static GimpItem *
|
static GimpItem *
|
||||||
gimp_drawable_duplicate (GimpItem *item,
|
gimp_drawable_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type)
|
||||||
gboolean add_alpha)
|
|
||||||
{
|
{
|
||||||
GimpItem *new_item;
|
GimpItem *new_item;
|
||||||
|
|
||||||
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
|
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
|
||||||
|
|
||||||
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type,
|
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
|
||||||
add_alpha);
|
|
||||||
|
|
||||||
if (GIMP_IS_DRAWABLE (new_item))
|
if (GIMP_IS_DRAWABLE (new_item))
|
||||||
{
|
{
|
||||||
GimpDrawable *drawable = GIMP_DRAWABLE (item);
|
GimpDrawable *drawable = GIMP_DRAWABLE (item);
|
||||||
GimpDrawable *new_drawable = GIMP_DRAWABLE (new_item);
|
GimpDrawable *new_drawable = GIMP_DRAWABLE (new_item);
|
||||||
GimpImageType new_image_type;
|
|
||||||
PixelRegion srcPR;
|
PixelRegion srcPR;
|
||||||
PixelRegion destPR;
|
PixelRegion destPR;
|
||||||
|
|
||||||
if (add_alpha)
|
|
||||||
new_image_type = gimp_drawable_type_with_alpha (drawable);
|
|
||||||
else
|
|
||||||
new_image_type = gimp_drawable_type (drawable);
|
|
||||||
|
|
||||||
gimp_drawable_configure (new_drawable,
|
gimp_drawable_configure (new_drawable,
|
||||||
gimp_item_get_image (item),
|
gimp_item_get_image (item),
|
||||||
item->offset_x,
|
item->offset_x,
|
||||||
item->offset_y,
|
item->offset_y,
|
||||||
gimp_item_width (item),
|
gimp_item_width (item),
|
||||||
gimp_item_height (item),
|
gimp_item_height (item),
|
||||||
new_image_type,
|
gimp_drawable_type (drawable),
|
||||||
GIMP_OBJECT (new_drawable)->name);
|
GIMP_OBJECT (new_drawable)->name);
|
||||||
|
|
||||||
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
|
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
|
||||||
@ -350,10 +341,7 @@ gimp_drawable_duplicate (GimpItem *item,
|
|||||||
gimp_item_height (new_item),
|
gimp_item_height (new_item),
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
if (new_image_type == drawable->type)
|
|
||||||
copy_region (&srcPR, &destPR);
|
copy_region (&srcPR, &destPR);
|
||||||
else
|
|
||||||
add_alpha_region (&srcPR, &destPR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new_item;
|
return new_item;
|
||||||
|
@ -114,8 +114,7 @@ gimp_image_duplicate (GimpImage *image)
|
|||||||
|
|
||||||
new_layer = GIMP_LAYER (gimp_item_convert (GIMP_ITEM (layer),
|
new_layer = GIMP_LAYER (gimp_item_convert (GIMP_ITEM (layer),
|
||||||
new_image,
|
new_image,
|
||||||
G_TYPE_FROM_INSTANCE (layer),
|
G_TYPE_FROM_INSTANCE (layer)));
|
||||||
FALSE));
|
|
||||||
|
|
||||||
/* Make sure the copied layer doesn't say: "<old layer> copy" */
|
/* Make sure the copied layer doesn't say: "<old layer> copy" */
|
||||||
gimp_object_set_name (GIMP_OBJECT (new_layer),
|
gimp_object_set_name (GIMP_OBJECT (new_layer),
|
||||||
@ -149,11 +148,9 @@ gimp_image_duplicate (GimpImage *image)
|
|||||||
GimpChannel *channel = list->data;
|
GimpChannel *channel = list->data;
|
||||||
GimpChannel *new_channel;
|
GimpChannel *new_channel;
|
||||||
|
|
||||||
new_channel =
|
new_channel = GIMP_CHANNEL (gimp_item_convert (GIMP_ITEM (channel),
|
||||||
GIMP_CHANNEL (gimp_item_convert (GIMP_ITEM (channel),
|
|
||||||
new_image,
|
new_image,
|
||||||
G_TYPE_FROM_INSTANCE (channel),
|
G_TYPE_FROM_INSTANCE (channel)));
|
||||||
FALSE));
|
|
||||||
|
|
||||||
/* Make sure the copied channel doesn't say: "<old channel> copy" */
|
/* Make sure the copied channel doesn't say: "<old channel> copy" */
|
||||||
gimp_object_set_name (GIMP_OBJECT (new_channel),
|
gimp_object_set_name (GIMP_OBJECT (new_channel),
|
||||||
@ -176,11 +173,9 @@ gimp_image_duplicate (GimpImage *image)
|
|||||||
GimpVectors *vectors = list->data;
|
GimpVectors *vectors = list->data;
|
||||||
GimpVectors *new_vectors;
|
GimpVectors *new_vectors;
|
||||||
|
|
||||||
new_vectors =
|
new_vectors = GIMP_VECTORS (gimp_item_convert (GIMP_ITEM (vectors),
|
||||||
GIMP_VECTORS (gimp_item_convert (GIMP_ITEM (vectors),
|
|
||||||
new_image,
|
new_image,
|
||||||
G_TYPE_FROM_INSTANCE (vectors),
|
G_TYPE_FROM_INSTANCE (vectors)));
|
||||||
FALSE));
|
|
||||||
|
|
||||||
/* Make sure the copied vectors doesn't say: "<old vectors> copy" */
|
/* Make sure the copied vectors doesn't say: "<old vectors> copy" */
|
||||||
gimp_object_set_name (GIMP_OBJECT (new_vectors),
|
gimp_object_set_name (GIMP_OBJECT (new_vectors),
|
||||||
|
@ -257,10 +257,8 @@ gimp_image_merge_visible_vectors (GimpImage *image,
|
|||||||
vectors = GIMP_VECTORS (cur_item->data);
|
vectors = GIMP_VECTORS (cur_item->data);
|
||||||
|
|
||||||
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
|
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
|
||||||
target_vectors = GIMP_VECTORS (
|
target_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
|
||||||
gimp_item_duplicate (GIMP_ITEM (vectors),
|
GIMP_TYPE_VECTORS));
|
||||||
GIMP_TYPE_VECTORS,
|
|
||||||
FALSE));
|
|
||||||
pos = gimp_image_get_vectors_index (image, vectors);
|
pos = gimp_image_get_vectors_index (image, vectors);
|
||||||
gimp_image_remove_vectors (image, vectors);
|
gimp_image_remove_vectors (image, vectors);
|
||||||
cur_item = cur_item->next;
|
cur_item = cur_item->next;
|
||||||
|
@ -104,8 +104,7 @@ gimp_image_set_quick_mask_state (GimpImage *image,
|
|||||||
/* if selection */
|
/* if selection */
|
||||||
|
|
||||||
mask = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (selection),
|
mask = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (selection),
|
||||||
GIMP_TYPE_CHANNEL,
|
GIMP_TYPE_CHANNEL));
|
||||||
FALSE));
|
|
||||||
|
|
||||||
/* Clear the selection */
|
/* Clear the selection */
|
||||||
gimp_channel_clear (selection, NULL, TRUE);
|
gimp_channel_clear (selection, NULL, TRUE);
|
||||||
|
@ -78,8 +78,7 @@ static gint64 gimp_item_get_memsize (GimpObject *object,
|
|||||||
gint64 *gui_size);
|
gint64 *gui_size);
|
||||||
|
|
||||||
static GimpItem * gimp_item_real_duplicate (GimpItem *item,
|
static GimpItem * gimp_item_real_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type);
|
||||||
gboolean add_alpha);
|
|
||||||
static void gimp_item_real_convert (GimpItem *item,
|
static void gimp_item_real_convert (GimpItem *item,
|
||||||
GimpImage *dest_image);
|
GimpImage *dest_image);
|
||||||
static gboolean gimp_item_real_rename (GimpItem *item,
|
static gboolean gimp_item_real_rename (GimpItem *item,
|
||||||
@ -289,8 +288,7 @@ gimp_item_get_memsize (GimpObject *object,
|
|||||||
|
|
||||||
static GimpItem *
|
static GimpItem *
|
||||||
gimp_item_real_duplicate (GimpItem *item,
|
gimp_item_real_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type)
|
||||||
gboolean add_alpha)
|
|
||||||
{
|
{
|
||||||
GimpItem *new_item;
|
GimpItem *new_item;
|
||||||
gchar *new_name;
|
gchar *new_name;
|
||||||
@ -527,20 +525,18 @@ gimp_item_is_attached (GimpItem *item)
|
|||||||
* gimp_item_duplicate:
|
* gimp_item_duplicate:
|
||||||
* @item: The #GimpItem to duplicate.
|
* @item: The #GimpItem to duplicate.
|
||||||
* @new_type: The type to make the new item.
|
* @new_type: The type to make the new item.
|
||||||
* @add_alpha: #TRUE if an alpha channel should be added to the new item.
|
|
||||||
*
|
*
|
||||||
* Returns: the newly created item.
|
* Returns: the newly created item.
|
||||||
*/
|
*/
|
||||||
GimpItem *
|
GimpItem *
|
||||||
gimp_item_duplicate (GimpItem *item,
|
gimp_item_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type)
|
||||||
gboolean add_alpha)
|
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (item->image), NULL);
|
g_return_val_if_fail (GIMP_IS_IMAGE (item->image), NULL);
|
||||||
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_ITEM), NULL);
|
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_ITEM), NULL);
|
||||||
|
|
||||||
return GIMP_ITEM_GET_CLASS (item)->duplicate (item, new_type, add_alpha);
|
return GIMP_ITEM_GET_CLASS (item)->duplicate (item, new_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -548,15 +544,13 @@ gimp_item_duplicate (GimpItem *item,
|
|||||||
* @item: The #GimpItem to convert.
|
* @item: The #GimpItem to convert.
|
||||||
* @dest_image: The #GimpImage in which to place the converted item.
|
* @dest_image: The #GimpImage in which to place the converted item.
|
||||||
* @new_type: The type to convert the item to.
|
* @new_type: The type to convert the item to.
|
||||||
* @add_alpha: #TRUE if an alpha channel should be added to the converted item.
|
|
||||||
*
|
*
|
||||||
* Returns: the new item that results from the conversion.
|
* Returns: the new item that results from the conversion.
|
||||||
*/
|
*/
|
||||||
GimpItem *
|
GimpItem *
|
||||||
gimp_item_convert (GimpItem *item,
|
gimp_item_convert (GimpItem *item,
|
||||||
GimpImage *dest_image,
|
GimpImage *dest_image,
|
||||||
GType new_type,
|
GType new_type)
|
||||||
gboolean add_alpha)
|
|
||||||
{
|
{
|
||||||
GimpItem *new_item;
|
GimpItem *new_item;
|
||||||
|
|
||||||
@ -565,7 +559,7 @@ gimp_item_convert (GimpItem *item,
|
|||||||
g_return_val_if_fail (GIMP_IS_IMAGE (dest_image), NULL);
|
g_return_val_if_fail (GIMP_IS_IMAGE (dest_image), NULL);
|
||||||
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_ITEM), NULL);
|
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_ITEM), NULL);
|
||||||
|
|
||||||
new_item = gimp_item_duplicate (item, new_type, add_alpha);
|
new_item = gimp_item_duplicate (item, new_type);
|
||||||
|
|
||||||
if (new_item)
|
if (new_item)
|
||||||
GIMP_ITEM_GET_CLASS (new_item)->convert (new_item, dest_image);
|
GIMP_ITEM_GET_CLASS (new_item)->convert (new_item, dest_image);
|
||||||
|
@ -65,8 +65,7 @@ struct _GimpItemClass
|
|||||||
/* virtual functions */
|
/* virtual functions */
|
||||||
gboolean (* is_attached) (GimpItem *item);
|
gboolean (* is_attached) (GimpItem *item);
|
||||||
GimpItem * (* duplicate) (GimpItem *item,
|
GimpItem * (* duplicate) (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type);
|
||||||
gboolean add_alpha);
|
|
||||||
void (* convert) (GimpItem *item,
|
void (* convert) (GimpItem *item,
|
||||||
GimpImage *dest_image);
|
GimpImage *dest_image);
|
||||||
gboolean (* rename) (GimpItem *item,
|
gboolean (* rename) (GimpItem *item,
|
||||||
@ -142,12 +141,10 @@ void gimp_item_configure (GimpItem *item,
|
|||||||
gint height,
|
gint height,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
GimpItem * gimp_item_duplicate (GimpItem *item,
|
GimpItem * gimp_item_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type);
|
||||||
gboolean add_alpha);
|
|
||||||
GimpItem * gimp_item_convert (GimpItem *item,
|
GimpItem * gimp_item_convert (GimpItem *item,
|
||||||
GimpImage *dest_image,
|
GimpImage *dest_image,
|
||||||
GType new_type,
|
GType new_type);
|
||||||
gboolean add_alpha);
|
|
||||||
|
|
||||||
gboolean gimp_item_rename (GimpItem *item,
|
gboolean gimp_item_rename (GimpItem *item,
|
||||||
const gchar *new_name,
|
const gchar *new_name,
|
||||||
|
@ -93,8 +93,7 @@ static gchar * gimp_layer_get_description (GimpViewable *viewable,
|
|||||||
static void gimp_layer_removed (GimpItem *item);
|
static void gimp_layer_removed (GimpItem *item);
|
||||||
static gboolean gimp_layer_is_attached (GimpItem *item);
|
static gboolean gimp_layer_is_attached (GimpItem *item);
|
||||||
static GimpItem * gimp_layer_duplicate (GimpItem *item,
|
static GimpItem * gimp_layer_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type);
|
||||||
gboolean add_alpha);
|
|
||||||
static void gimp_layer_convert (GimpItem *item,
|
static void gimp_layer_convert (GimpItem *item,
|
||||||
GimpImage *dest_image);
|
GimpImage *dest_image);
|
||||||
static gboolean gimp_layer_rename (GimpItem *item,
|
static gboolean gimp_layer_rename (GimpItem *item,
|
||||||
@ -512,15 +511,13 @@ gimp_layer_is_attached (GimpItem *item)
|
|||||||
|
|
||||||
static GimpItem *
|
static GimpItem *
|
||||||
gimp_layer_duplicate (GimpItem *item,
|
gimp_layer_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type)
|
||||||
gboolean add_alpha)
|
|
||||||
{
|
{
|
||||||
GimpItem *new_item;
|
GimpItem *new_item;
|
||||||
|
|
||||||
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
|
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
|
||||||
|
|
||||||
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type,
|
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
|
||||||
add_alpha);
|
|
||||||
|
|
||||||
if (GIMP_IS_LAYER (new_item))
|
if (GIMP_IS_LAYER (new_item))
|
||||||
{
|
{
|
||||||
@ -537,11 +534,11 @@ gimp_layer_duplicate (GimpItem *item,
|
|||||||
/* duplicate the layer mask if necessary */
|
/* duplicate the layer mask if necessary */
|
||||||
if (layer->mask)
|
if (layer->mask)
|
||||||
{
|
{
|
||||||
GimpItem *new_mask =
|
GimpItem *mask;
|
||||||
gimp_item_duplicate (GIMP_ITEM (layer->mask),
|
|
||||||
G_TYPE_FROM_INSTANCE (layer->mask),
|
mask = gimp_item_duplicate (GIMP_ITEM (layer->mask),
|
||||||
FALSE);
|
G_TYPE_FROM_INSTANCE (layer->mask));
|
||||||
gimp_layer_add_mask (new_layer, GIMP_LAYER_MASK (new_mask), FALSE);
|
gimp_layer_add_mask (new_layer, GIMP_LAYER_MASK (mask), FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,8 +47,7 @@ enum
|
|||||||
|
|
||||||
static gboolean gimp_layer_mask_is_attached (GimpItem *item);
|
static gboolean gimp_layer_mask_is_attached (GimpItem *item);
|
||||||
static GimpItem * gimp_layer_mask_duplicate (GimpItem *item,
|
static GimpItem * gimp_layer_mask_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type);
|
||||||
gboolean add_alpha);
|
|
||||||
static gboolean gimp_layer_mask_rename (GimpItem *item,
|
static gboolean gimp_layer_mask_rename (GimpItem *item,
|
||||||
const gchar *new_name,
|
const gchar *new_name,
|
||||||
const gchar *undo_desc,
|
const gchar *undo_desc,
|
||||||
@ -129,15 +128,13 @@ gimp_layer_mask_is_attached (GimpItem *item)
|
|||||||
|
|
||||||
static GimpItem *
|
static GimpItem *
|
||||||
gimp_layer_mask_duplicate (GimpItem *item,
|
gimp_layer_mask_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type)
|
||||||
gboolean add_alpha)
|
|
||||||
{
|
{
|
||||||
GimpItem *new_item;
|
GimpItem *new_item;
|
||||||
|
|
||||||
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
|
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
|
||||||
|
|
||||||
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type,
|
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
|
||||||
add_alpha);
|
|
||||||
|
|
||||||
if (GIMP_IS_LAYER_MASK (new_item))
|
if (GIMP_IS_LAYER_MASK (new_item))
|
||||||
{
|
{
|
||||||
|
@ -582,8 +582,7 @@ gimp_selection_save (GimpChannel *selection)
|
|||||||
image = gimp_item_get_image (GIMP_ITEM (selection));
|
image = gimp_item_get_image (GIMP_ITEM (selection));
|
||||||
|
|
||||||
new_channel = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (selection),
|
new_channel = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (selection),
|
||||||
GIMP_TYPE_CHANNEL,
|
GIMP_TYPE_CHANNEL));
|
||||||
FALSE));
|
|
||||||
|
|
||||||
/* saved selections are not visible by default */
|
/* saved selections are not visible by default */
|
||||||
gimp_item_set_visible (GIMP_ITEM (new_channel), FALSE, FALSE);
|
gimp_item_set_visible (GIMP_ITEM (new_channel), FALSE, FALSE);
|
||||||
|
@ -195,7 +195,7 @@ gimp_display_shell_drop_drawable (GtkWidget *widget,
|
|||||||
else
|
else
|
||||||
new_type = GIMP_TYPE_LAYER;
|
new_type = GIMP_TYPE_LAYER;
|
||||||
|
|
||||||
new_item = gimp_item_convert (GIMP_ITEM (viewable), image, new_type, TRUE);
|
new_item = gimp_item_convert (GIMP_ITEM (viewable), image, new_type);
|
||||||
|
|
||||||
if (new_item)
|
if (new_item)
|
||||||
{
|
{
|
||||||
@ -243,8 +243,8 @@ gimp_display_shell_drop_vectors (GtkWidget *widget,
|
|||||||
if (image->gimp->busy)
|
if (image->gimp->busy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
new_item = gimp_item_convert (GIMP_ITEM (viewable), image,
|
new_item = gimp_item_convert (GIMP_ITEM (viewable),
|
||||||
G_TYPE_FROM_INSTANCE (viewable), TRUE);
|
image, G_TYPE_FROM_INSTANCE (viewable));
|
||||||
|
|
||||||
if (new_item)
|
if (new_item)
|
||||||
{
|
{
|
||||||
@ -472,9 +472,8 @@ gimp_display_shell_drop_component (GtkWidget *widget,
|
|||||||
|
|
||||||
channel = gimp_channel_new_from_component (image, component, NULL, NULL);
|
channel = gimp_channel_new_from_component (image, component, NULL, NULL);
|
||||||
|
|
||||||
new_item = gimp_item_convert (GIMP_ITEM (channel), dest_image,
|
new_item = gimp_item_convert (GIMP_ITEM (channel),
|
||||||
GIMP_TYPE_LAYER, TRUE);
|
dest_image, GIMP_TYPE_LAYER);
|
||||||
|
|
||||||
g_object_unref (channel);
|
g_object_unref (channel);
|
||||||
|
|
||||||
if (new_item)
|
if (new_item)
|
||||||
|
@ -571,8 +571,7 @@ file_open_convert_items (GimpImage *dest_image,
|
|||||||
GimpItem *src = list->data;
|
GimpItem *src = list->data;
|
||||||
GimpItem *item;
|
GimpItem *item;
|
||||||
|
|
||||||
item = gimp_item_convert (src, dest_image,
|
item = gimp_item_convert (src, dest_image, G_TYPE_FROM_INSTANCE (src));
|
||||||
G_TYPE_FROM_INSTANCE (src), TRUE);
|
|
||||||
|
|
||||||
if (g_list_length (items) == 1)
|
if (g_list_length (items) == 1)
|
||||||
{
|
{
|
||||||
|
@ -140,7 +140,7 @@ channel_copy_invoker (GimpProcedure *procedure,
|
|||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
|
channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
|
||||||
G_TYPE_FROM_INSTANCE (channel), FALSE));
|
G_TYPE_FROM_INSTANCE (channel)));
|
||||||
|
|
||||||
if (! channel_copy)
|
if (! channel_copy)
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
|
@ -115,9 +115,9 @@ layer_new_from_drawable_invoker (GimpProcedure *procedure,
|
|||||||
new_type = GIMP_TYPE_LAYER;
|
new_type = GIMP_TYPE_LAYER;
|
||||||
|
|
||||||
if (dest_image == gimp_item_get_image (GIMP_ITEM (drawable)))
|
if (dest_image == gimp_item_get_image (GIMP_ITEM (drawable)))
|
||||||
new_item = gimp_item_duplicate (GIMP_ITEM (drawable), new_type, TRUE);
|
new_item = gimp_item_duplicate (GIMP_ITEM (drawable), new_type);
|
||||||
else
|
else
|
||||||
new_item = gimp_item_convert (GIMP_ITEM (drawable), dest_image, new_type, TRUE);
|
new_item = gimp_item_convert (GIMP_ITEM (drawable), dest_image, new_type);
|
||||||
|
|
||||||
if (new_item)
|
if (new_item)
|
||||||
layer_copy = GIMP_LAYER (new_item);
|
layer_copy = GIMP_LAYER (new_item);
|
||||||
@ -153,11 +153,17 @@ layer_copy_invoker (GimpProcedure *procedure,
|
|||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
layer_copy = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
|
layer_copy = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
|
||||||
G_TYPE_FROM_INSTANCE (layer),
|
G_TYPE_FROM_INSTANCE (layer)));
|
||||||
add_alpha));
|
if (layer_copy)
|
||||||
if (! layer_copy)
|
{
|
||||||
|
if (add_alpha)
|
||||||
|
gimp_layer_add_alpha (layer_copy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return_vals = gimp_procedure_get_return_values (procedure, success);
|
return_vals = gimp_procedure_get_return_values (procedure, success);
|
||||||
|
|
||||||
|
@ -75,8 +75,7 @@ static gint64 gimp_text_layer_get_memsize (GimpObject *object,
|
|||||||
gint64 *gui_size);
|
gint64 *gui_size);
|
||||||
|
|
||||||
static GimpItem * gimp_text_layer_duplicate (GimpItem *item,
|
static GimpItem * gimp_text_layer_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type);
|
||||||
gboolean add_alpha);
|
|
||||||
static gboolean gimp_text_layer_rename (GimpItem *item,
|
static gboolean gimp_text_layer_rename (GimpItem *item,
|
||||||
const gchar *new_name,
|
const gchar *new_name,
|
||||||
const gchar *undo_desc,
|
const gchar *undo_desc,
|
||||||
@ -239,16 +238,13 @@ gimp_text_layer_get_memsize (GimpObject *object,
|
|||||||
|
|
||||||
static GimpItem *
|
static GimpItem *
|
||||||
gimp_text_layer_duplicate (GimpItem *item,
|
gimp_text_layer_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type)
|
||||||
gboolean add_alpha)
|
|
||||||
{
|
{
|
||||||
GimpItem *new_item;
|
GimpItem *new_item;
|
||||||
|
|
||||||
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
|
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
|
||||||
|
|
||||||
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item,
|
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
|
||||||
new_type,
|
|
||||||
add_alpha);
|
|
||||||
|
|
||||||
if (GIMP_IS_TEXT_LAYER (new_item))
|
if (GIMP_IS_TEXT_LAYER (new_item))
|
||||||
{
|
{
|
||||||
|
@ -65,8 +65,7 @@ static gint64 gimp_vectors_get_memsize (GimpObject *object,
|
|||||||
|
|
||||||
static gboolean gimp_vectors_is_attached (GimpItem *item);
|
static gboolean gimp_vectors_is_attached (GimpItem *item);
|
||||||
static GimpItem * gimp_vectors_duplicate (GimpItem *item,
|
static GimpItem * gimp_vectors_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type);
|
||||||
gboolean add_alpha);
|
|
||||||
static void gimp_vectors_convert (GimpItem *item,
|
static void gimp_vectors_convert (GimpItem *item,
|
||||||
GimpImage *dest_image);
|
GimpImage *dest_image);
|
||||||
static void gimp_vectors_translate (GimpItem *item,
|
static void gimp_vectors_translate (GimpItem *item,
|
||||||
@ -271,15 +270,13 @@ gimp_vectors_is_attached (GimpItem *item)
|
|||||||
|
|
||||||
static GimpItem *
|
static GimpItem *
|
||||||
gimp_vectors_duplicate (GimpItem *item,
|
gimp_vectors_duplicate (GimpItem *item,
|
||||||
GType new_type,
|
GType new_type)
|
||||||
gboolean add_alpha)
|
|
||||||
{
|
{
|
||||||
GimpItem *new_item;
|
GimpItem *new_item;
|
||||||
|
|
||||||
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_VECTORS), NULL);
|
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_VECTORS), NULL);
|
||||||
|
|
||||||
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type,
|
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
|
||||||
add_alpha);
|
|
||||||
|
|
||||||
if (GIMP_IS_VECTORS (new_item))
|
if (GIMP_IS_VECTORS (new_item))
|
||||||
{
|
{
|
||||||
|
@ -84,8 +84,7 @@ gimp_vectors_mod_undo_constructor (GType type,
|
|||||||
|
|
||||||
vectors_mod_undo->vectors =
|
vectors_mod_undo->vectors =
|
||||||
GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
|
GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
|
||||||
G_TYPE_FROM_INSTANCE (vectors),
|
G_TYPE_FROM_INSTANCE (vectors)));
|
||||||
FALSE));
|
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
@ -119,8 +118,7 @@ gimp_vectors_mod_undo_pop (GimpUndo *undo,
|
|||||||
|
|
||||||
vectors_mod_undo->vectors =
|
vectors_mod_undo->vectors =
|
||||||
GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
|
GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
|
||||||
G_TYPE_FROM_INSTANCE (vectors),
|
G_TYPE_FROM_INSTANCE (vectors)));
|
||||||
FALSE));
|
|
||||||
|
|
||||||
gimp_vectors_freeze (vectors);
|
gimp_vectors_freeze (vectors);
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ gimp_channel_tree_view_drop_viewable (GimpContainerTreeView *tree_view,
|
|||||||
|
|
||||||
new_item = gimp_item_convert (GIMP_ITEM (src_viewable),
|
new_item = gimp_item_convert (GIMP_ITEM (src_viewable),
|
||||||
item_view->image,
|
item_view->image,
|
||||||
item_view_class->item_type, FALSE);
|
item_view_class->item_type);
|
||||||
|
|
||||||
gimp_item_set_linked (new_item, FALSE, FALSE);
|
gimp_item_set_linked (new_item, FALSE, FALSE);
|
||||||
|
|
||||||
|
@ -736,7 +736,7 @@ gimp_item_tree_view_drop_viewable (GimpContainerTreeView *tree_view,
|
|||||||
dest_index++;
|
dest_index++;
|
||||||
|
|
||||||
new_item = gimp_item_convert (GIMP_ITEM (src_viewable),
|
new_item = gimp_item_convert (GIMP_ITEM (src_viewable),
|
||||||
item_view->image, item_type, TRUE);
|
item_view->image, item_type);
|
||||||
|
|
||||||
gimp_item_set_linked (new_item, FALSE, FALSE);
|
gimp_item_set_linked (new_item, FALSE, FALSE);
|
||||||
|
|
||||||
|
@ -764,7 +764,7 @@ gimp_layer_tree_view_drop_component (GimpContainerTreeView *tree_view,
|
|||||||
channel = gimp_channel_new_from_component (src_image, component, NULL, NULL);
|
channel = gimp_channel_new_from_component (src_image, component, NULL, NULL);
|
||||||
|
|
||||||
new_item = gimp_item_convert (GIMP_ITEM (channel), item_view->image,
|
new_item = gimp_item_convert (GIMP_ITEM (channel), item_view->image,
|
||||||
GIMP_TYPE_LAYER, TRUE);
|
GIMP_TYPE_LAYER);
|
||||||
|
|
||||||
g_object_unref (channel);
|
g_object_unref (channel);
|
||||||
|
|
||||||
|
@ -212,8 +212,8 @@ gimp_toolbox_drop_drawable (GtkWidget *widget,
|
|||||||
else
|
else
|
||||||
new_type = GIMP_TYPE_LAYER;
|
new_type = GIMP_TYPE_LAYER;
|
||||||
|
|
||||||
new_layer = GIMP_LAYER (gimp_item_convert (GIMP_ITEM (drawable), new_image,
|
new_layer = GIMP_LAYER (gimp_item_convert (GIMP_ITEM (drawable),
|
||||||
new_type, FALSE));
|
new_image, new_type));
|
||||||
|
|
||||||
gimp_object_set_name (GIMP_OBJECT (new_layer),
|
gimp_object_set_name (GIMP_OBJECT (new_layer),
|
||||||
gimp_object_get_name (GIMP_OBJECT (drawable)));
|
gimp_object_get_name (GIMP_OBJECT (drawable)));
|
||||||
@ -303,9 +303,8 @@ gimp_toolbox_drop_component (GtkWidget *widget,
|
|||||||
|
|
||||||
channel = gimp_channel_new_from_component (image, component, NULL, NULL);
|
channel = gimp_channel_new_from_component (image, component, NULL, NULL);
|
||||||
|
|
||||||
new_layer = GIMP_LAYER (gimp_item_convert (GIMP_ITEM (channel), new_image,
|
new_layer = GIMP_LAYER (gimp_item_convert (GIMP_ITEM (channel),
|
||||||
GIMP_TYPE_LAYER, FALSE));
|
new_image, GIMP_TYPE_LAYER));
|
||||||
|
|
||||||
g_object_unref (channel);
|
g_object_unref (channel);
|
||||||
|
|
||||||
gimp_enum_get_value (GIMP_TYPE_CHANNEL_TYPE, component,
|
gimp_enum_get_value (GIMP_TYPE_CHANNEL_TYPE, component,
|
||||||
|
@ -90,7 +90,7 @@ HELP
|
|||||||
code => <<'CODE'
|
code => <<'CODE'
|
||||||
{
|
{
|
||||||
channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
|
channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
|
||||||
G_TYPE_FROM_INSTANCE (channel), FALSE));
|
G_TYPE_FROM_INSTANCE (channel)));
|
||||||
|
|
||||||
if (! channel_copy)
|
if (! channel_copy)
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
|
@ -94,11 +94,17 @@ HELP
|
|||||||
code => <<'CODE'
|
code => <<'CODE'
|
||||||
{
|
{
|
||||||
layer_copy = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
|
layer_copy = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
|
||||||
G_TYPE_FROM_INSTANCE (layer),
|
G_TYPE_FROM_INSTANCE (layer)));
|
||||||
add_alpha));
|
if (layer_copy)
|
||||||
if (! layer_copy)
|
{
|
||||||
|
if (add_alpha)
|
||||||
|
gimp_layer_add_alpha (layer_copy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
CODE
|
CODE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -588,9 +594,9 @@ HELP
|
|||||||
new_type = GIMP_TYPE_LAYER;
|
new_type = GIMP_TYPE_LAYER;
|
||||||
|
|
||||||
if (dest_image == gimp_item_get_image (GIMP_ITEM (drawable)))
|
if (dest_image == gimp_item_get_image (GIMP_ITEM (drawable)))
|
||||||
new_item = gimp_item_duplicate (GIMP_ITEM (drawable), new_type, TRUE);
|
new_item = gimp_item_duplicate (GIMP_ITEM (drawable), new_type);
|
||||||
else
|
else
|
||||||
new_item = gimp_item_convert (GIMP_ITEM (drawable), dest_image, new_type, TRUE);
|
new_item = gimp_item_convert (GIMP_ITEM (drawable), dest_image, new_type);
|
||||||
|
|
||||||
if (new_item)
|
if (new_item)
|
||||||
layer_copy = GIMP_LAYER (new_item);
|
layer_copy = GIMP_LAYER (new_item);
|
||||||
|
Reference in New Issue
Block a user