本文整理匯總了C++中GIMP_IS_LAYER函數的典型用法代碼示例。如果您正苦於以下問題:C++ GIMP_IS_LAYER函數的具體用法?C++ GIMP_IS_LAYER怎麽用?C++ GIMP_IS_LAYER使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GIMP_IS_LAYER函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: gimp_image_undo_push_layer_remove
GimpUndo *
gimp_image_undo_push_layer_remove (GimpImage *image,
const gchar *undo_desc,
GimpLayer *layer,
GimpLayer *prev_parent,
gint prev_position,
GimpLayer *prev_layer)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
g_return_val_if_fail (prev_parent == NULL || GIMP_IS_LAYER (prev_parent),
NULL);
g_return_val_if_fail (prev_layer == NULL || GIMP_IS_LAYER (prev_layer),
NULL);
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_UNDO,
GIMP_UNDO_LAYER_REMOVE, undo_desc,
GIMP_DIRTY_IMAGE_STRUCTURE,
"item", layer,
"prev-parent", prev_parent,
"prev-position", prev_position,
"prev-layer", prev_layer,
NULL);
}
示例2: gimp_layer_mask_prop_undo_constructed
static void
gimp_layer_mask_prop_undo_constructed (GObject *object)
{
GimpLayerMaskPropUndo *layer_mask_prop_undo;
GimpLayer *layer;
layer_mask_prop_undo = GIMP_LAYER_MASK_PROP_UNDO (object);
G_OBJECT_CLASS (parent_class)->constructed (object);
g_assert (GIMP_IS_LAYER (GIMP_ITEM_UNDO (object)->item));
layer = GIMP_LAYER (GIMP_ITEM_UNDO (object)->item);
switch (GIMP_UNDO (object)->undo_type)
{
case GIMP_UNDO_LAYER_MASK_APPLY:
layer_mask_prop_undo->apply = gimp_layer_get_apply_mask (layer);
break;
case GIMP_UNDO_LAYER_MASK_SHOW:
layer_mask_prop_undo->show = gimp_layer_get_show_mask (layer);
break;
default:
g_assert_not_reached ();
}
}
示例3: gimp_layer_prop_undo_constructed
static void
gimp_layer_prop_undo_constructed (GObject *object)
{
GimpLayerPropUndo *layer_prop_undo = GIMP_LAYER_PROP_UNDO (object);
GimpLayer *layer;
G_OBJECT_CLASS (parent_class)->constructed (object);
g_assert (GIMP_IS_LAYER (GIMP_ITEM_UNDO (object)->item));
layer = GIMP_LAYER (GIMP_ITEM_UNDO (object)->item);
switch (GIMP_UNDO (object)->undo_type)
{
case GIMP_UNDO_LAYER_MODE:
layer_prop_undo->mode = gimp_layer_get_mode (layer);
break;
case GIMP_UNDO_LAYER_OPACITY:
layer_prop_undo->opacity = gimp_layer_get_opacity (layer);
break;
case GIMP_UNDO_LAYER_LOCK_ALPHA:
layer_prop_undo->lock_alpha = gimp_layer_get_lock_alpha (layer);
break;
default:
g_assert_not_reached ();
}
}
示例4: floating_sel_remove
void
floating_sel_remove (GimpLayer *layer)
{
GimpImage *image;
g_return_if_fail (GIMP_IS_LAYER (layer));
g_return_if_fail (gimp_layer_is_floating_sel (layer));
image = gimp_item_get_image (GIMP_ITEM (layer->fs.drawable));
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_FS_REMOVE,
_("Remove Floating Selection"));
/* store the affected area from the drawable in the backing store */
floating_sel_relax (layer, TRUE);
/* Invalidate the preview of the obscured drawable. We do this here
* because it will not be done until the floating selection is removed,
* at which point the obscured drawable's preview will not be declared
* invalid.
*/
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer));
/* remove the layer from the image */
gimp_image_remove_layer (image, layer);
gimp_image_undo_group_end (image);
}
示例5: floating_sel_activate_drawable
void
floating_sel_activate_drawable (GimpLayer *layer)
{
GimpImage *image;
GimpDrawable *drawable;
g_return_if_fail (GIMP_IS_LAYER (layer));
g_return_if_fail (gimp_layer_is_floating_sel (layer));
image = gimp_item_get_image (GIMP_ITEM (layer));
drawable = gimp_layer_get_floating_sel_drawable (layer);
/* set the underlying drawable to active */
if (GIMP_IS_LAYER_MASK (drawable))
{
GimpLayerMask *mask = GIMP_LAYER_MASK (drawable);
gimp_image_set_active_layer (image, gimp_layer_mask_get_layer (mask));
}
else if (GIMP_IS_CHANNEL (drawable))
{
gimp_image_set_active_channel (image, GIMP_CHANNEL (drawable));
}
else
{
gimp_image_set_active_layer (image, GIMP_LAYER (drawable));
}
}
示例6: floating_sel_anchor
void
floating_sel_anchor (GimpLayer *layer)
{
GimpImage *image;
GimpDrawable *drawable;
GimpFilter *filter = NULL;
gint off_x, off_y;
gint dr_off_x, dr_off_y;
g_return_if_fail (GIMP_IS_LAYER (layer));
g_return_if_fail (gimp_layer_is_floating_sel (layer));
/* Don't let gimp_image_remove_layer free the layer while we still need it */
g_object_ref (layer);
image = gimp_item_get_image (GIMP_ITEM (layer));
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_FS_ANCHOR,
C_("undo-type", "Anchor Floating Selection"));
drawable = gimp_layer_get_floating_sel_drawable (layer);
gimp_item_get_offset (GIMP_ITEM (layer), &off_x, &off_y);
gimp_item_get_offset (GIMP_ITEM (drawable), &dr_off_x, &dr_off_y);
if (gimp_item_get_visible (GIMP_ITEM (layer)) &&
gimp_rectangle_intersect (off_x, off_y,
gimp_item_get_width (GIMP_ITEM (layer)),
gimp_item_get_height (GIMP_ITEM (layer)),
dr_off_x, dr_off_y,
gimp_item_get_width (GIMP_ITEM (drawable)),
gimp_item_get_height (GIMP_ITEM (drawable)),
NULL, NULL, NULL, NULL))
{
filter = gimp_drawable_get_floating_sel_filter (drawable);
g_object_ref (filter);
}
/* first remove the filter, then merge it, or we will get warnings
* about already connected nodes
*/
gimp_image_remove_layer (image, layer, TRUE, NULL);
if (filter)
{
gimp_drawable_merge_filter (drawable, filter, NULL, NULL);
g_object_unref (filter);
}
gimp_image_undo_group_end (image);
/* invalidate the boundaries */
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (gimp_image_get_mask (image)));
g_object_unref (layer);
}
示例7: gimp_display_shell_drop_drawable
static void
gimp_display_shell_drop_drawable (GtkWidget *widget,
gint x,
gint y,
GimpViewable *viewable,
gpointer data)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
GimpImage *image = gimp_display_get_image (shell->display);
GType new_type;
GimpItem *new_item;
GIMP_LOG (DND, NULL);
if (shell->display->gimp->busy)
return;
if (! image)
{
image = gimp_image_new_from_drawable (shell->display->gimp,
GIMP_DRAWABLE (viewable));
gimp_create_display (shell->display->gimp, image, GIMP_UNIT_PIXEL, 1.0,
G_OBJECT (gtk_widget_get_screen (widget)),
gimp_widget_get_monitor (widget));
g_object_unref (image);
return;
}
if (GIMP_IS_LAYER (viewable))
new_type = G_TYPE_FROM_INSTANCE (viewable);
else
new_type = GIMP_TYPE_LAYER;
new_item = gimp_item_convert (GIMP_ITEM (viewable), image, new_type);
if (new_item)
{
GimpLayer *new_layer = GIMP_LAYER (new_item);
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE,
_("Drop New Layer"));
gimp_display_shell_dnd_position_item (shell, image, new_item);
gimp_item_set_visible (new_item, TRUE, FALSE);
gimp_item_set_linked (new_item, FALSE, FALSE);
gimp_image_add_layer (image, new_layer,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
gimp_image_undo_group_end (image);
gimp_display_shell_dnd_flush (shell, image);
}
}
示例8: floating_sel_to_layer
void
floating_sel_to_layer (GimpLayer *layer)
{
GimpItem *item;
GimpImage *image;
g_return_if_fail (GIMP_IS_LAYER (layer));
g_return_if_fail (gimp_layer_is_floating_sel (layer));
item = GIMP_ITEM (layer);
if (! (image = gimp_item_get_image (item)))
return;
/* Check if the floating layer belongs to a channel... */
if (GIMP_IS_CHANNEL (layer->fs.drawable))
{
gimp_message (image->gimp, NULL, GIMP_MESSAGE_WARNING,
_("Cannot create a new layer from the floating selection "
"because it belongs to a layer mask or channel."));
return;
}
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_FS_TO_LAYER,
_("Floating Selection to Layer"));
/* restore the contents of the drawable */
floating_sel_restore (layer,
item->offset_x,
item->offset_y,
item->width,
item->height);
gimp_image_undo_push_fs_to_layer (image, NULL, layer);
/* clear the selection */
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (layer));
/* Set pointers */
layer->fs.drawable = NULL;
image->floating_sel = NULL;
gimp_item_set_visible (GIMP_ITEM (layer), TRUE, TRUE);
gimp_layer_set_lock_alpha (layer, FALSE, TRUE);
gimp_image_undo_group_end (image);
gimp_object_name_changed (GIMP_OBJECT (layer));
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
GIMP_ITEM (layer)->width,
GIMP_ITEM (layer)->height);
gimp_image_floating_selection_changed (image);
}
示例9: gimp_drawable_transform_paste
GimpDrawable *
gimp_drawable_transform_paste (GimpDrawable *drawable,
GeglBuffer *buffer,
GimpColorProfile *buffer_profile,
gint offset_x,
gint offset_y,
gboolean new_layer)
{
GimpImage *image;
GimpLayer *layer = NULL;
const gchar *undo_desc = NULL;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (buffer_profile), NULL);
image = gimp_item_get_image (GIMP_ITEM (drawable));
if (GIMP_IS_LAYER (drawable))
undo_desc = C_("undo-type", "Transform Layer");
else if (GIMP_IS_CHANNEL (drawable))
undo_desc = C_("undo-type", "Transform Channel");
else
return NULL;
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE, undo_desc);
if (new_layer)
{
layer =
gimp_layer_new_from_gegl_buffer (buffer, image,
gimp_drawable_get_format_with_alpha (drawable),
_("Transformation"),
GIMP_OPACITY_OPAQUE,
gimp_image_get_default_new_layer_mode (image),
buffer_profile);
gimp_item_set_offset (GIMP_ITEM (layer), offset_x, offset_y);
floating_sel_attach (layer, drawable);
drawable = GIMP_DRAWABLE (layer);
}
else
{
gimp_drawable_set_buffer_full (drawable, TRUE, NULL,
buffer,
offset_x, offset_y,
TRUE);
}
gimp_image_undo_group_end (image);
return drawable;
}
示例10: gimp_layer_mask_undo_constructed
static void
gimp_layer_mask_undo_constructed (GObject *object)
{
GimpLayerMaskUndo *layer_mask_undo = GIMP_LAYER_MASK_UNDO (object);
G_OBJECT_CLASS (parent_class)->constructed (object);
g_assert (GIMP_IS_LAYER (GIMP_ITEM_UNDO (object)->item));
g_assert (GIMP_IS_LAYER_MASK (layer_mask_undo->layer_mask));
}
示例11: gimp_image_undo_push_layer_add
GimpUndo *
gimp_image_undo_push_layer_add (GimpImage *image,
const gchar *undo_desc,
GimpLayer *layer,
GimpLayer *prev_layer)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
g_return_val_if_fail (prev_layer == NULL || GIMP_IS_LAYER (prev_layer),
NULL);
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_UNDO,
GIMP_UNDO_LAYER_ADD, undo_desc,
GIMP_DIRTY_IMAGE_STRUCTURE,
"item", layer,
"prev-layer", prev_layer,
NULL);
}
示例12: gimp_layer_mask_is_attached
static gboolean
gimp_layer_mask_is_attached (const GimpItem *item)
{
GimpLayerMask *mask = GIMP_LAYER_MASK (item);
GimpLayer *layer = gimp_layer_mask_get_layer (mask);
return (GIMP_IS_IMAGE (gimp_item_get_image (item)) &&
GIMP_IS_LAYER (layer) &&
gimp_layer_get_mask (layer) == mask &&
gimp_item_is_attached (GIMP_ITEM (layer)));
}
示例13: floating_sel_invalidate
void
floating_sel_invalidate (GimpLayer *layer)
{
g_return_if_fail (GIMP_IS_LAYER (layer));
g_return_if_fail (gimp_layer_is_floating_sel (layer));
/* Invalidate the attached-to drawable's preview */
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gimp_layer_get_floating_sel_drawable (layer)));
/* Invalidate the boundary */
layer->fs.boundary_known = FALSE;
}
示例14: gimp_text_layer_xcf_load_hack
gboolean
gimp_text_layer_xcf_load_hack (GimpLayer **layer)
{
const gchar *name;
GimpText *text = NULL;
const GimpParasite *parasite;
g_return_val_if_fail (layer != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_LAYER (*layer), FALSE);
name = gimp_text_parasite_name ();
parasite = gimp_item_parasite_find (GIMP_ITEM (*layer), name);
if (parasite)
{
GError *error = NULL;
text = gimp_text_from_parasite (parasite, &error);
if (error)
{
gimp_message (gimp_item_get_image (GIMP_ITEM (*layer))->gimp, NULL,
GIMP_MESSAGE_ERROR,
_("Problems parsing the text parasite for layer '%s':\n"
"%s\n\n"
"Some text properties may be wrong. "
"Unless you want to edit the text layer, "
"you don't need to worry about this."),
gimp_object_get_name (*layer),
error->message);
g_clear_error (&error);
}
}
else
{
name = gimp_text_gdyntext_parasite_name ();
parasite = gimp_item_parasite_find (GIMP_ITEM (*layer), name);
if (parasite)
text = gimp_text_from_gdyntext_parasite (parasite);
}
if (text)
{
*layer = gimp_text_layer_from_layer (*layer, text);
/* let the text layer knows what parasite was used to create it */
GIMP_TEXT_LAYER (*layer)->text_parasite = name;
}
return (text != NULL);
}
示例15: floating_sel_to_layer
gboolean
floating_sel_to_layer (GimpLayer *layer,
GError **error)
{
GimpItem *item;
GimpImage *image;
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
g_return_val_if_fail (gimp_layer_is_floating_sel (layer), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
item = GIMP_ITEM (layer);
image = gimp_item_get_image (item);
/* Check if the floating layer belongs to a channel */
if (GIMP_IS_CHANNEL (gimp_layer_get_floating_sel_drawable (layer)))
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("Cannot create a new layer from the floating "
"selection because it belongs to a layer mask "
"or channel."));
return FALSE;
}
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_FS_TO_LAYER,
C_("undo-type", "Floating Selection to Layer"));
gimp_image_undo_push_fs_to_layer (image, NULL, layer);
gimp_drawable_detach_floating_sel (gimp_layer_get_floating_sel_drawable (layer));
gimp_layer_set_floating_sel_drawable (layer, NULL);
gimp_item_set_visible (item, TRUE, TRUE);
gimp_layer_set_lock_alpha (layer, FALSE, TRUE);
gimp_image_undo_group_end (image);
/* When the floating selection is converted to/from a normal layer
* it does something resembling a name change, so emit the
* "name-changed" signal
*/
gimp_object_name_changed (GIMP_OBJECT (layer));
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
gimp_item_get_width (item),
gimp_item_get_height (item));
return TRUE;
}