当前位置: 首页>>代码示例>>C++>>正文


C++ return_if_no_context函数代码示例

本文整理汇总了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);
}
开发者ID:Hboybowen,项目名称:gimp,代码行数:16,代码来源:context-commands.c

示例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);
}
开发者ID:gfraysse,项目名称:gimp,代码行数:47,代码来源:select-commands.c

示例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);
}
开发者ID:jdburton,项目名称:gimp-osx,代码行数:46,代码来源:vectors-commands.c

示例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);
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:45,代码来源:drawable-commands.c

示例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);
    }
}
开发者ID:Amerekanets,项目名称:gimp,代码行数:19,代码来源:tools-commands.c

示例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);
    }
}
开发者ID:Amerekanets,项目名称:gimp,代码行数:19,代码来源:tools-commands.c

示例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);
    }
}
开发者ID:Amerekanets,项目名称:gimp,代码行数:19,代码来源:tools-commands.c

示例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);
    }
}
开发者ID:Amerekanets,项目名称:gimp,代码行数:19,代码来源:tools-commands.c

示例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);
    }
}
开发者ID:Amerekanets,项目名称:gimp,代码行数:19,代码来源:tools-commands.c

示例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);
}
开发者ID:MichaelMure,项目名称:Gimp-Cage-Tool,代码行数:19,代码来源:context-commands.c

示例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);
    }
}
开发者ID:Distrotech,项目名称:gimp,代码行数:20,代码来源:tools-commands.c

示例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);
    }
}
开发者ID:Distrotech,项目名称:gimp,代码行数:20,代码来源:tools-commands.c

示例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);
    }
}
开发者ID:MichaelMure,项目名称:Gimp-Cage-Tool,代码行数:20,代码来源:context-commands.c

示例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);
    }
}
开发者ID:Distrotech,项目名称:gimp,代码行数:20,代码来源:tools-commands.c

示例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);
    }
}
开发者ID:Distrotech,项目名称:gimp,代码行数:20,代码来源:tools-commands.c


注:本文中的return_if_no_context函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。