本文整理汇总了C++中GIMP_DRAWABLE函数的典型用法代码示例。如果您正苦于以下问题:C++ GIMP_DRAWABLE函数的具体用法?C++ GIMP_DRAWABLE怎么用?C++ GIMP_DRAWABLE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GIMP_DRAWABLE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gimp_group_layer_undo_constructed
static void
gimp_group_layer_undo_constructed (GObject *object)
{
GimpGroupLayerUndo *group_layer_undo = GIMP_GROUP_LAYER_UNDO (object);
GimpGroupLayer *group;
G_OBJECT_CLASS (parent_class)->constructed (object);
g_assert (GIMP_IS_GROUP_LAYER (GIMP_ITEM_UNDO (object)->item));
group = GIMP_GROUP_LAYER (GIMP_ITEM_UNDO (object)->item);
switch (GIMP_UNDO (object)->undo_type)
{
case GIMP_UNDO_GROUP_LAYER_SUSPEND:
case GIMP_UNDO_GROUP_LAYER_RESUME:
break;
case GIMP_UNDO_GROUP_LAYER_CONVERT:
group_layer_undo->prev_type = gimp_drawable_get_base_type (GIMP_DRAWABLE (group));
group_layer_undo->prev_precision = gimp_drawable_get_precision (GIMP_DRAWABLE (group));
break;
default:
g_assert_not_reached ();
}
}
示例2: bfm_onionskin_rm
void
bfm_onionskin_rm (GDisplay *disp)
{
if (!bfm_check (disp) || !disp->bfm->onionskin_b)
return;
if(disp->bfm->cfm)
{
/*cfm_onionskin_rm (disp->bfm->cfm);*/
}
else
if(disp->bfm->sfm && disp->bfm->onionskin_b)
{
disp->bfm->sfm->old_offset_x = GIMP_DRAWABLE (disp->bfm->bg->active_layer)->offset_x;
disp->bfm->sfm->old_offset_y = GIMP_DRAWABLE (disp->bfm->bg->active_layer)->offset_y;
disp->bfm->sfm->old_ex = disp->bfm->sfm->ex;
disp->bfm->sfm->old_ey = disp->bfm->sfm->ey;
disp->bfm->sfm->old_opacity = disp->bfm->fg->active_layer->opacity;
disp->bfm->fg->active_layer->opacity = 1;
gimage_remove_layer (disp->bfm->fg, (disp->bfm->bg->active_layer));
GIMP_DRAWABLE (disp->bfm->bg->active_layer)->offset_x = 0;
GIMP_DRAWABLE (disp->bfm->bg->active_layer)->offset_y = 0;
GIMP_DRAWABLE(disp->bfm->bg->active_layer)->gimage_ID = disp->bfm->bg->ID;
disp->bfm->onionskin_b = 0;
sfm_onionskin_rm (disp);
}
}
示例3: 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);
}
示例4: 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);
}
示例5: gimp_group_layer_undo_pop
static void
gimp_group_layer_undo_pop (GimpUndo *undo,
GimpUndoMode undo_mode,
GimpUndoAccumulator *accum)
{
GimpGroupLayerUndo *group_layer_undo = GIMP_GROUP_LAYER_UNDO (undo);
GimpGroupLayer *group;
group = GIMP_GROUP_LAYER (GIMP_ITEM_UNDO (undo)->item);
GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
switch (undo->undo_type)
{
case GIMP_UNDO_GROUP_LAYER_SUSPEND:
case GIMP_UNDO_GROUP_LAYER_RESUME:
if ((undo_mode == GIMP_UNDO_MODE_UNDO &&
undo->undo_type == GIMP_UNDO_GROUP_LAYER_SUSPEND) ||
(undo_mode == GIMP_UNDO_MODE_REDO &&
undo->undo_type == GIMP_UNDO_GROUP_LAYER_RESUME))
{
/* resume group layer auto-resizing */
gimp_group_layer_resume_resize (group, FALSE);
}
else
{
/* suspend group layer auto-resizing */
gimp_group_layer_suspend_resize (group, FALSE);
}
break;
case GIMP_UNDO_GROUP_LAYER_CONVERT:
{
GimpImageBaseType type;
GimpPrecision precision;
type = gimp_drawable_get_base_type (GIMP_DRAWABLE (group));
precision = gimp_drawable_get_precision (GIMP_DRAWABLE (group));
gimp_drawable_convert_type (GIMP_DRAWABLE (group),
gimp_item_get_image (GIMP_ITEM (group)),
group_layer_undo->prev_type,
group_layer_undo->prev_precision,
0, 0, FALSE,
FALSE, NULL);
group_layer_undo->prev_type = type;
group_layer_undo->prev_precision = precision;
}
break;
default:
g_assert_not_reached ();
}
}
示例6: gimp_image_merge_layers_get_operation
static CombinationMode
gimp_image_merge_layers_get_operation (GimpLayer *dest,
GimpLayer *src)
{
GimpImageType type = gimp_drawable_type (GIMP_DRAWABLE (dest));
gint bytes = gimp_drawable_bytes (GIMP_DRAWABLE (src));
return gimp_image_get_combination_mode (type, bytes);
}
示例7: 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);
}
示例8: gimp_channel_combine_rect
void
gimp_channel_combine_rect (GimpChannel *mask,
GimpChannelOps op,
gint x,
gint y,
gint w,
gint h)
{
GeglBuffer *buffer;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
if (! gimp_gegl_mask_combine_rect (buffer, op, x, y, w, h))
return;
gimp_rectangle_intersect (x, y, w, h,
0, 0,
gimp_item_get_width (GIMP_ITEM (mask)),
gimp_item_get_height (GIMP_ITEM (mask)),
&x, &y, &w, &h);
/* Determine new boundary */
if (mask->bounds_known && (op == GIMP_CHANNEL_OP_ADD) && ! mask->empty)
{
if (x < mask->x1)
mask->x1 = x;
if (y < mask->y1)
mask->y1 = y;
if ((x + w) > mask->x2)
mask->x2 = (x + w);
if ((y + h) > mask->y2)
mask->y2 = (y + h);
}
else if (op == GIMP_CHANNEL_OP_REPLACE || mask->empty)
{
mask->empty = FALSE;
mask->x1 = x;
mask->y1 = y;
mask->x2 = x + w;
mask->y2 = y + h;
}
else
{
mask->bounds_known = FALSE;
}
mask->x1 = CLAMP (mask->x1, 0, gimp_item_get_width (GIMP_ITEM (mask)));
mask->y1 = CLAMP (mask->y1, 0, gimp_item_get_height (GIMP_ITEM (mask)));
mask->x2 = CLAMP (mask->x2, 0, gimp_item_get_width (GIMP_ITEM (mask)));
mask->y2 = CLAMP (mask->y2, 0, gimp_item_get_height (GIMP_ITEM (mask)));
gimp_drawable_update (GIMP_DRAWABLE (mask), x, y, w, h);
}
示例9: gimp_text_layer_render_layout
static void
gimp_text_layer_render_layout (GimpTextLayer *layer,
GimpTextLayout *layout)
{
GimpDrawable *drawable = GIMP_DRAWABLE (layer);
GimpItem *item = GIMP_ITEM (layer);
GeglBuffer *buffer;
cairo_t *cr;
cairo_surface_t *surface;
gint width;
gint height;
g_return_if_fail (gimp_drawable_has_alpha (drawable));
width = gimp_item_get_width (item);
height = gimp_item_get_height (item);
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
cr = cairo_create (surface);
gimp_text_layout_render (layout, cr, layer->text->base_dir, FALSE);
cairo_destroy (cr);
cairo_surface_flush (surface);
buffer = gimp_cairo_surface_create_buffer (surface);
gegl_buffer_copy (buffer, NULL,
gimp_drawable_get_buffer (drawable), NULL);
g_object_unref (buffer);
cairo_surface_destroy (surface);
gimp_drawable_update (drawable, 0, 0, width, height);
}
示例10: gimp_drawable_mod_undo_pop
static void
gimp_drawable_mod_undo_pop (GimpUndo *undo,
GimpUndoMode undo_mode,
GimpUndoAccumulator *accum)
{
GimpDrawableModUndo *drawable_mod_undo = GIMP_DRAWABLE_MOD_UNDO (undo);
GimpDrawable *drawable = GIMP_DRAWABLE (GIMP_ITEM_UNDO (undo)->item);
GeglBuffer *buffer;
gint offset_x;
gint offset_y;
GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
buffer = drawable_mod_undo->buffer;
offset_x = drawable_mod_undo->offset_x;
offset_y = drawable_mod_undo->offset_y;
drawable_mod_undo->buffer = g_object_ref (gimp_drawable_get_buffer (drawable));
gimp_item_get_offset (GIMP_ITEM (drawable),
&drawable_mod_undo->offset_x,
&drawable_mod_undo->offset_y);
gimp_drawable_set_buffer_full (drawable, FALSE, NULL,
buffer, offset_x, offset_y);
g_object_unref (buffer);
}
示例11: drawable_lock_position_cmd_callback
void
drawable_lock_position_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpDrawable *drawable;
gboolean locked;
return_if_no_drawable (image, drawable, data);
locked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (GIMP_IS_LAYER_MASK (drawable))
drawable =
GIMP_DRAWABLE (gimp_layer_mask_get_layer (GIMP_LAYER_MASK (drawable)));
if (locked != gimp_item_get_lock_position (GIMP_ITEM (drawable)))
{
GimpUndo *undo;
gboolean push_undo = TRUE;
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
GIMP_UNDO_ITEM_LOCK_POSITION);
if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (drawable))
push_undo = FALSE;
gimp_item_set_lock_position (GIMP_ITEM (drawable), locked, push_undo);
gimp_image_flush (image);
}
}
示例12: gimp_layer_mask_set_show
void
gimp_layer_mask_set_show (GimpLayerMask *layer_mask,
gboolean show,
gboolean push_undo)
{
g_return_if_fail (GIMP_IS_LAYER_MASK (layer_mask));
if (layer_mask->show_mask != show)
{
GimpImage *image = GIMP_ITEM (layer_mask)->image;
if (push_undo)
gimp_image_undo_push_layer_mask_show (image, _("Show Layer Mask"),
layer_mask);
layer_mask->show_mask = show ? TRUE : FALSE;
if (layer_mask->layer)
{
GimpDrawable *drawable = GIMP_DRAWABLE (layer_mask->layer);
gimp_drawable_update (drawable,
0, 0,
gimp_item_width (GIMP_ITEM (drawable)),
gimp_item_height (GIMP_ITEM (drawable)));
}
g_signal_emit (layer_mask, layer_mask_signals[SHOW_CHANGED], 0);
}
}
示例13: gimp_layer_mask_set_apply
void
gimp_layer_mask_set_apply (GimpLayerMask *layer_mask,
gboolean apply,
gboolean push_undo)
{
g_return_if_fail (GIMP_IS_LAYER_MASK (layer_mask));
if (layer_mask->apply_mask != apply)
{
GimpImage *image = GIMP_ITEM (layer_mask)->image;
if (push_undo)
gimp_image_undo_push_layer_mask_apply (image, _("Apply Layer Mask"),
layer_mask);
layer_mask->apply_mask = apply ? TRUE : FALSE;
if (layer_mask->layer)
{
GimpDrawable *drawable = GIMP_DRAWABLE (layer_mask->layer);
gimp_drawable_update (drawable,
0, 0,
gimp_item_width (GIMP_ITEM (drawable)),
gimp_item_height (GIMP_ITEM (drawable)));
}
g_signal_emit (layer_mask, layer_mask_signals[APPLY_CHANGED], 0);
}
}
示例14: gimp_layer_mask_new
GimpLayerMask *
gimp_layer_mask_new (GimpImage *image,
gint width,
gint height,
const gchar *name,
const GimpRGB *color)
{
GimpLayerMask *layer_mask;
layer_mask = g_object_new (GIMP_TYPE_LAYER_MASK, NULL);
gimp_drawable_configure (GIMP_DRAWABLE (layer_mask),
image,
0, 0, width, height,
GIMP_GRAY_IMAGE, name);
/* set the layer_mask color and opacity */
GIMP_CHANNEL (layer_mask)->color = *color;
GIMP_CHANNEL (layer_mask)->show_masked = TRUE;
/* selection mask variables */
GIMP_CHANNEL (layer_mask)->x2 = width;
GIMP_CHANNEL (layer_mask)->y2 = height;
return layer_mask;
}
示例15: gimp_drawable_tree_view_new_dropped
static void
gimp_drawable_tree_view_new_dropped (GimpItemTreeView *view,
gint x,
gint y,
const GimpRGB *color,
GimpPattern *pattern)
{
GimpItem *item;
gimp_image_undo_group_start (gimp_item_tree_view_get_image (view), GIMP_UNDO_GROUP_EDIT_PASTE,
_("New Layer"));
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->new_item (gimp_item_tree_view_get_image (view));
if (item)
{
gimp_edit_fill_full (gimp_item_get_image (item),
GIMP_DRAWABLE (item),
color, pattern,
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE,
pattern ?
C_("undo-type", "Drop pattern to layer") :
C_("undo-type", "Drop color to layer"));
}
gimp_image_undo_group_end (gimp_item_tree_view_get_image (view));
gimp_image_flush (gimp_item_tree_view_get_image (view));
}