本文整理汇总了C++中GIMP_IS_CHANNEL函数的典型用法代码示例。如果您正苦于以下问题:C++ GIMP_IS_CHANNEL函数的具体用法?C++ GIMP_IS_CHANNEL怎么用?C++ GIMP_IS_CHANNEL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GIMP_IS_CHANNEL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gimp_image_undo_push_channel_remove
GimpUndo *
gimp_image_undo_push_channel_remove (GimpImage *image,
const gchar *undo_desc,
GimpChannel *channel,
GimpChannel *prev_parent,
gint prev_position,
GimpChannel *prev_channel)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)), NULL);
g_return_val_if_fail (prev_parent == NULL || GIMP_IS_CHANNEL (prev_parent),
NULL);
g_return_val_if_fail (prev_channel == NULL || GIMP_IS_CHANNEL (prev_channel),
NULL);
return gimp_image_undo_push (image, GIMP_TYPE_CHANNEL_UNDO,
GIMP_UNDO_CHANNEL_REMOVE, undo_desc,
GIMP_DIRTY_IMAGE_STRUCTURE,
"item", channel,
"prev-parent", prev_parent,
"prev-position", prev_position,
"prev-channel", prev_channel,
NULL);
}
示例2: gimp_channel_combine_mask
void
gimp_channel_combine_mask (GimpChannel *mask,
GimpChannel *add_on,
GimpChannelOps op,
gint off_x,
gint off_y)
{
PixelRegion srcPR, destPR;
gint x, y, w, h;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
g_return_if_fail (GIMP_IS_CHANNEL (add_on));
if (! gimp_rectangle_intersect (off_x, off_y,
gimp_item_get_width (GIMP_ITEM (add_on)),
gimp_item_get_height (GIMP_ITEM (add_on)),
0, 0,
gimp_item_get_width (GIMP_ITEM (mask)),
gimp_item_get_height (GIMP_ITEM (mask)),
&x, &y, &w, &h))
return;
pixel_region_init (&srcPR, gimp_drawable_get_tiles (GIMP_DRAWABLE (add_on)),
x - off_x, y - off_y, w, h, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
x, y, w, h, TRUE);
switch (op)
{
case GIMP_CHANNEL_OP_ADD:
case GIMP_CHANNEL_OP_REPLACE:
pixel_regions_process_parallel ((PixelProcessorFunc)
gimp_channel_combine_sub_region_add,
NULL, 2, &srcPR, &destPR);
break;
case GIMP_CHANNEL_OP_SUBTRACT:
pixel_regions_process_parallel ((PixelProcessorFunc)
gimp_channel_combine_sub_region_sub,
NULL, 2, &srcPR, &destPR);
break;
case GIMP_CHANNEL_OP_INTERSECT:
pixel_regions_process_parallel ((PixelProcessorFunc)
gimp_channel_combine_sub_region_intersect,
NULL, 2, &srcPR, &destPR);
break;
default:
g_warning ("%s: unknown operation type", G_STRFUNC);
break;
}
mask->bounds_known = FALSE;
gimp_drawable_update (GIMP_DRAWABLE (mask), x, y, w, h);
}
示例3: gimp_channel_select_channel
void
gimp_channel_select_channel (GimpChannel *channel,
const gchar *undo_desc,
GimpChannel *add_on,
gint offset_x,
gint offset_y,
GimpChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
g_return_if_fail (undo_desc != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (add_on));
gimp_channel_push_undo (channel, undo_desc);
/* if applicable, replace the current selection */
if (op == GIMP_CHANNEL_OP_REPLACE)
gimp_channel_clear (channel, NULL, FALSE);
if (feather || op == GIMP_CHANNEL_OP_INTERSECT)
{
GimpItem *item = GIMP_ITEM (channel);
GimpChannel *add_on2;
add_on2 = gimp_channel_new_mask (gimp_item_get_image (item),
gimp_item_width (item),
gimp_item_height (item));
gimp_channel_combine_mask (add_on2, add_on, GIMP_CHANNEL_OP_ADD,
offset_x, offset_y);
if (feather)
gimp_channel_feather (add_on2,
feather_radius_x,
feather_radius_y,
FALSE /* no undo */);
gimp_channel_combine_mask (channel, add_on2, op, 0, 0);
g_object_unref (add_on2);
}
else
{
gimp_channel_combine_mask (channel, add_on, op, offset_x, offset_y);
}
}
示例4: gimp_channel_undo_constructed
static void
gimp_channel_undo_constructed (GObject *object)
{
G_OBJECT_CLASS (parent_class)->constructed (object);
g_assert (GIMP_IS_CHANNEL (GIMP_ITEM_UNDO (object)->item));
}
示例5: gimp_drawable_transform_get_effective_clip
GimpTransformResize
gimp_drawable_transform_get_effective_clip (GimpDrawable *drawable,
GeglBuffer *orig_buffer,
GimpTransformResize clip_result)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), clip_result);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)),
clip_result);
g_return_val_if_fail (orig_buffer == NULL || GEGL_IS_BUFFER (orig_buffer),
clip_result);
/* Always clip unfloated buffers since they must keep their size */
if (GIMP_IS_CHANNEL (drawable))
{
if (orig_buffer)
{
if (! babl_format_has_alpha (gegl_buffer_get_format (orig_buffer)))
clip_result = GIMP_TRANSFORM_RESIZE_CLIP;
}
else
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
if (gimp_channel_is_empty (gimp_image_get_mask (image)))
clip_result = GIMP_TRANSFORM_RESIZE_CLIP;
}
}
return clip_result;
}
示例6: 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));
}
}
示例7: gimp_channel_select_polygon
void
gimp_channel_select_polygon (GimpChannel *channel,
const gchar *undo_desc,
gint n_points,
GimpVector2 *points,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y,
gboolean push_undo)
{
GimpScanConvert *scan_convert;
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
g_return_if_fail (undo_desc != NULL);
scan_convert = gimp_scan_convert_new ();
gimp_scan_convert_add_polyline (scan_convert, n_points, points, TRUE);
gimp_channel_select_scan_convert (channel, undo_desc, scan_convert, 0, 0,
op, antialias, feather,
feather_radius_x, feather_radius_y,
push_undo);
gimp_scan_convert_free (scan_convert);
}
示例8: gimp_channel_select_vectors
void
gimp_channel_select_vectors (GimpChannel *channel,
const gchar *undo_desc,
GimpVectors *vectors,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y,
gboolean push_undo)
{
const GimpBezierDesc *bezier;
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
g_return_if_fail (undo_desc != NULL);
g_return_if_fail (GIMP_IS_VECTORS (vectors));
bezier = gimp_vectors_get_bezier (vectors);
if (bezier && bezier->num_data > 4)
{
GimpScanConvert *scan_convert;
scan_convert = gimp_scan_convert_new ();
gimp_scan_convert_add_bezier (scan_convert, bezier);
gimp_channel_select_scan_convert (channel, undo_desc, scan_convert, 0, 0,
op, antialias, feather,
feather_radius_x, feather_radius_y,
push_undo);
gimp_scan_convert_free (scan_convert);
}
}
示例9: gimp_mask_undo_constructed
static void
gimp_mask_undo_constructed (GObject *object)
{
GimpMaskUndo *mask_undo = GIMP_MASK_UNDO (object);
GimpChannel *channel;
GimpDrawable *drawable;
gint x1, y1, x2, y2;
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
g_assert (GIMP_IS_CHANNEL (GIMP_ITEM_UNDO (object)->item));
channel = GIMP_CHANNEL (GIMP_ITEM_UNDO (object)->item);
drawable = GIMP_DRAWABLE (channel);
if (gimp_channel_bounds (channel, &x1, &y1, &x2, &y2))
{
mask_undo->buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
x2 - x1, y2 - y1),
gimp_drawable_get_format (drawable));
gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
GEGL_RECTANGLE (x1, y1, x2 - x1, y2 - y1),
mask_undo->buffer,
GEGL_RECTANGLE (0, 0, 0, 0));
mask_undo->x = x1;
mask_undo->y = y1;
}
mask_undo->format = gimp_drawable_get_format (drawable);
}
示例10: gimp_channel_combine_buffer
void
gimp_channel_combine_buffer (GimpChannel *mask,
GeglBuffer *add_on_buffer,
GimpChannelOps op,
gint off_x,
gint off_y)
{
GeglBuffer *buffer;
gint x, y, w, h;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
g_return_if_fail (GEGL_IS_BUFFER (add_on_buffer));
buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
if (! gimp_gegl_mask_combine_buffer (buffer, add_on_buffer,
op, off_x, off_y))
return;
gimp_rectangle_intersect (off_x, off_y,
gegl_buffer_get_width (add_on_buffer),
gegl_buffer_get_height (add_on_buffer),
0, 0,
gimp_item_get_width (GIMP_ITEM (mask)),
gimp_item_get_height (GIMP_ITEM (mask)),
&x, &y, &w, &h);
mask->bounds_known = FALSE;
gimp_drawable_update (GIMP_DRAWABLE (mask), x, y, w, h);
}
示例11: gimp_channel_select_round_rect
void
gimp_channel_select_round_rect (GimpChannel *channel,
gint x,
gint y,
gint w,
gint h,
gdouble corner_radius_x,
gdouble corner_radius_y,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y,
gboolean push_undo)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
if (push_undo)
gimp_channel_push_undo (channel, C_("undo-type", "Rounded Rectangle Select"));
/* if applicable, replace the current selection */
if (op == GIMP_CHANNEL_OP_REPLACE)
gimp_channel_clear (channel, NULL, FALSE);
/* if feathering for rect, make a new mask with the
* rectangle and feather that with the old mask
*/
if (feather || op == GIMP_CHANNEL_OP_INTERSECT)
{
GimpItem *item = GIMP_ITEM (channel);
GeglBuffer *add_on;
add_on = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
gimp_item_get_width (item),
gimp_item_get_height (item)),
babl_format ("Y float"));
gimp_gegl_mask_combine_ellipse_rect (add_on, GIMP_CHANNEL_OP_ADD,
x, y, w, h,
corner_radius_x, corner_radius_y,
antialias);
if (feather)
gimp_gegl_apply_feather (add_on, NULL, NULL, add_on, NULL,
feather_radius_x,
feather_radius_y);
gimp_channel_combine_buffer (channel, add_on, op, 0, 0);
g_object_unref (add_on);
}
else
{
gimp_channel_combine_ellipse_rect (channel, op, x, y, w, h,
corner_radius_x, corner_radius_y,
antialias);
}
}
示例12: gimp_channel_select_round_rect
void
gimp_channel_select_round_rect (GimpChannel *channel,
gint x,
gint y,
gint w,
gint h,
gdouble corner_radius_x,
gdouble corner_radius_y,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y,
gboolean push_undo)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
if (push_undo)
gimp_channel_push_undo (channel, Q_("command|Rounded Rectangle Select"));
/* if applicable, replace the current selection */
if (op == GIMP_CHANNEL_OP_REPLACE)
gimp_channel_clear (channel, NULL, FALSE);
/* if feathering for rect, make a new mask with the
* rectangle and feather that with the old mask
*/
if (feather || op == GIMP_CHANNEL_OP_INTERSECT)
{
GimpItem *item = GIMP_ITEM (channel);
GimpChannel *add_on;
add_on = gimp_channel_new_mask (gimp_item_get_image (item),
gimp_item_width (item),
gimp_item_height (item));
gimp_channel_combine_ellipse_rect (add_on, GIMP_CHANNEL_OP_ADD,
x, y, w, h,
corner_radius_x, corner_radius_y,
antialias);
if (feather)
gimp_channel_feather (add_on,
feather_radius_x,
feather_radius_y,
FALSE /* no undo */);
gimp_channel_combine_mask (channel, add_on, op, 0, 0);
g_object_unref (add_on);
}
else
{
gimp_channel_combine_ellipse_rect (channel, op, x, y, w, h,
corner_radius_x, corner_radius_y,
antialias);
}
}
示例13: 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;
}
示例14: 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);
}
示例15: gimp_image_undo_push_channel_add
GimpUndo *
gimp_image_undo_push_channel_add (GimpImage *image,
const gchar *undo_desc,
GimpChannel *channel,
GimpChannel *prev_channel)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (channel)), NULL);
g_return_val_if_fail (prev_channel == NULL || GIMP_IS_CHANNEL (prev_channel),
NULL);
return gimp_image_undo_push (image, GIMP_TYPE_CHANNEL_UNDO,
GIMP_UNDO_CHANNEL_ADD, undo_desc,
GIMP_DIRTY_IMAGE_STRUCTURE,
"item", channel,
"prev-channel", prev_channel,
NULL);
}