本文整理汇总了C++中return_if_no_context函数的典型用法代码示例。如果您正苦于以下问题:C++ return_if_no_context函数的具体用法?C++ return_if_no_context怎么用?C++ return_if_no_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了return_if_no_context函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: context_foreground_green_cmd_callback
void
context_foreground_green_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpRGB color;
return_if_no_context (context, data);
gimp_context_get_foreground (context, &color);
color.g = action_select_value ((GimpActionSelectType) value,
color.g,
0.0, 1.0, 1.0,
1.0 / 255.0, 0.01, 0.1, 0.0, FALSE);
gimp_context_set_foreground (context, &color);
}
示例2: select_stroke_last_vals_cmd_callback
void
select_stroke_last_vals_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpDrawable *drawable;
GimpContext *context;
GtkWidget *widget;
GimpStrokeOptions *options;
GError *error = NULL;
return_if_no_image (image, data);
return_if_no_context (context, data);
return_if_no_widget (widget, data);
drawable = gimp_image_get_active_drawable (image);
if (! drawable)
{
gimp_message_literal (image->gimp,
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to stroke to."));
return;
}
options = g_object_get_data (G_OBJECT (image->gimp), "saved-stroke-options");
if (options)
g_object_ref (options);
else
options = gimp_stroke_options_new (image->gimp, context, TRUE);
if (! gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
drawable, context, options, NULL,
TRUE, NULL, &error))
{
gimp_message_literal (image->gimp,
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
error->message);
g_clear_error (&error);
}
else
{
gimp_image_flush (image);
}
g_object_unref (options);
}
示例3: vectors_stroke_last_vals_cmd_callback
void
vectors_stroke_last_vals_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpVectors *vectors;
GimpDrawable *drawable;
GimpContext *context;
GtkWidget *widget;
GimpStrokeDesc *desc;
GError *error = NULL;
return_if_no_vectors (image, vectors, data);
return_if_no_context (context, data);
return_if_no_widget (widget, data);
drawable = gimp_image_get_active_drawable (image);
if (! drawable)
{
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("There is no active layer or channel to stroke to."));
return;
}
desc = g_object_get_data (G_OBJECT (image->gimp), "saved-stroke-desc");
if (desc)
g_object_ref (desc);
else
desc = gimp_stroke_desc_new (image->gimp, context);
if (! gimp_item_stroke (GIMP_ITEM (vectors), drawable, context, desc, FALSE,
NULL, &error))
{
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
"%s", error->message);
g_clear_error (&error);
}
else
{
gimp_image_flush (image);
}
g_object_unref (desc);
}
示例4: drawable_flip_cmd_callback
void
drawable_flip_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpImage *image;
GimpDrawable *drawable;
GimpItem *item;
GimpContext *context;
gint off_x, off_y;
gdouble axis = 0.0;
return_if_no_drawable (image, drawable, data);
return_if_no_context (context, data);
item = GIMP_ITEM (drawable);
gimp_item_get_offset (item, &off_x, &off_y);
switch ((GimpOrientationType) value)
{
case GIMP_ORIENTATION_HORIZONTAL:
axis = ((gdouble) off_x + (gdouble) gimp_item_get_width (item) / 2.0);
break;
case GIMP_ORIENTATION_VERTICAL:
axis = ((gdouble) off_y + (gdouble) gimp_item_get_height (item) / 2.0);
break;
default:
break;
}
if (gimp_item_get_linked (item))
{
gimp_item_linked_flip (item, context,
(GimpOrientationType) value, axis, FALSE);
}
else
{
gimp_item_flip (item, context,
(GimpOrientationType) value, axis, FALSE);
}
gimp_image_flush (image);
}
示例5: tools_fg_select_brush_size_cmd_callback
void
tools_fg_select_brush_size_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
return_if_no_context (context, data);
tool_info = gimp_context_get_tool (context);
if (tool_info && GIMP_IS_FOREGROUND_SELECT_OPTIONS (tool_info->tool_options))
{
action_select_property ((GimpActionSelectType) value,
G_OBJECT (tool_info->tool_options),
"stroke-width",
1.0, 4.0, 16.0, FALSE);
}
}
示例6: tools_ink_blob_angle_cmd_callback
void
tools_ink_blob_angle_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
return_if_no_context (context, data);
tool_info = gimp_context_get_tool (context);
if (tool_info && GIMP_IS_INK_OPTIONS (tool_info->tool_options))
{
action_select_property ((GimpActionSelectType) value,
G_OBJECT (tool_info->tool_options),
"blob-angle",
1.0, 1.0, 15.0, TRUE);
}
}
示例7: tools_paint_brush_scale_cmd_callback
void
tools_paint_brush_scale_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
return_if_no_context (context, data);
tool_info = gimp_context_get_tool (context);
if (tool_info && GIMP_IS_PAINT_OPTIONS (tool_info->tool_options))
{
action_select_property ((GimpActionSelectType) value,
G_OBJECT (tool_info->tool_options),
"brush-scale",
0.01, 0.1, 1.0, FALSE);
}
}
示例8: tools_color_average_radius_cmd_callback
void
tools_color_average_radius_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
return_if_no_context (context, data);
tool_info = gimp_context_get_tool (context);
if (tool_info && GIMP_IS_COLOR_OPTIONS (tool_info->tool_options))
{
action_select_property ((GimpActionSelectType) value,
G_OBJECT (tool_info->tool_options),
"average-radius",
1.0, 1.0, 10.0, FALSE);
}
}
示例9: tools_toggle_visibility_cmd_callback
void
tools_toggle_visibility_cmd_callback (GtkAction *action,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
return_if_no_context (context, data);
tool_info = gimp_context_get_tool (context);
if (tool_info)
{
gboolean active =
gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (active != tool_info->visible)
g_object_set (tool_info, "visible", active, NULL);
}
}
示例10: context_background_value_cmd_callback
void
context_background_value_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpRGB color;
GimpHSV hsv;
return_if_no_context (context, data);
gimp_context_get_background (context, &color);
gimp_rgb_to_hsv (&color, &hsv);
hsv.v = action_select_value ((GimpActionSelectType) value,
hsv.v,
0.0, 1.0, 1.0,
0.01, 0.01, 0.1, 0.0, FALSE);
gimp_hsv_to_rgb (&hsv, &color);
gimp_context_set_background (context, &color);
}
示例11: tools_paintbrush_aspect_ratio_cmd_callback
void
tools_paintbrush_aspect_ratio_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
return_if_no_context (context, data);
tool_info = gimp_context_get_tool (context);
if (tool_info && GIMP_IS_PAINT_OPTIONS (tool_info->tool_options))
{
action_select_property ((GimpActionSelectType) value,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"brush-aspect-ratio",
0.01, 0.1, 1.0, 0.1, TRUE);
}
}
示例12: tools_transform_preview_opacity_cmd_callback
void
tools_transform_preview_opacity_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
return_if_no_context (context, data);
tool_info = gimp_context_get_tool (context);
if (tool_info && GIMP_IS_TRANSFORM_OPTIONS (tool_info->tool_options))
{
action_select_property ((GimpActionSelectType) value,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"preview-opacity",
0.01, 0.1, 0.5, 0.1, FALSE);
}
}
示例13: context_brush_spacing_cmd_callback
void
context_brush_spacing_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpBrush *brush;
return_if_no_context (context, data);
brush = gimp_context_get_brush (context);
if (GIMP_IS_BRUSH (brush) && gimp_data_is_writable (GIMP_DATA (brush)))
{
action_select_property ((GimpActionSelectType) value,
action_data_get_display (data),
G_OBJECT (brush),
"spacing",
1.0, 5.0, 20.0, 0.1, FALSE);
}
}
示例14: tools_warp_effect_size_cmd_callback
void
tools_warp_effect_size_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
return_if_no_context (context, data);
tool_info = gimp_context_get_tool (context);
if (tool_info && GIMP_IS_WARP_OPTIONS (tool_info->tool_options))
{
action_select_property ((GimpActionSelectType) value,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"effect-size",
1.0, 4.0, 16.0, 0.1, FALSE);
}
}
示例15: tools_mybrush_radius_cmd_callback
void
tools_mybrush_radius_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
return_if_no_context (context, data);
tool_info = gimp_context_get_tool (context);
if (tool_info && GIMP_IS_MYBRUSH_OPTIONS (tool_info->tool_options))
{
action_select_property ((GimpActionSelectType) value,
action_data_get_display (data),
G_OBJECT (tool_info->tool_options),
"radius",
0.1, 0.1, 0.5, 1.0, FALSE);
}
}