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


C++ GIMP_DATA函数代码示例

本文整理汇总了C++中GIMP_DATA函数的典型用法代码示例。如果您正苦于以下问题:C++ GIMP_DATA函数的具体用法?C++ GIMP_DATA怎么用?C++ GIMP_DATA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GIMP_DATA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gimp_curves_config_new_spline

GObject *
gimp_curves_config_new_spline (gint32         channel,
                               const gdouble *points,
                               gint           n_points)
{
  GimpCurvesConfig *config;
  GimpCurve        *curve;
  gint              i;

  g_return_val_if_fail (channel >= GIMP_HISTOGRAM_VALUE &&
                        channel <= GIMP_HISTOGRAM_ALPHA, NULL);
  g_return_val_if_fail (points != NULL, NULL);
  g_return_val_if_fail (n_points >= 2 && n_points <= 1024, NULL);

  config = g_object_new (GIMP_TYPE_CURVES_CONFIG, NULL);

  curve = config->curve[channel];

  gimp_data_freeze (GIMP_DATA (curve));

  gimp_curve_set_curve_type (curve, GIMP_CURVE_SMOOTH);
  gimp_curve_set_n_samples (curve, n_points);

  /*  unset the last point  */
  gimp_curve_set_point (curve, curve->n_points - 1, -1.0, -1.0);

  for (i = 0; i < n_points; i++)
    gimp_curve_set_point (curve, i,
                          (gdouble) points[i * 2],
                          (gdouble) points[i * 2 + 1]);

  gimp_data_thaw (GIMP_DATA (curve));

  return G_OBJECT (config);
}
开发者ID:frne,项目名称:gimp,代码行数:35,代码来源:gimpcurvesconfig.c

示例2: palette_delete_invoker

static GimpValueArray *
palette_delete_invoker (GimpProcedure         *procedure,
                        Gimp                  *gimp,
                        GimpContext           *context,
                        GimpProgress          *progress,
                        const GimpValueArray  *args,
                        GError               **error)
{
  gboolean success = TRUE;
  const gchar *name;

  name = g_value_get_string (gimp_value_array_index (args, 0));

  if (success)
    {
      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);

      if (palette && gimp_data_is_deletable (GIMP_DATA (palette)))
        success = gimp_data_factory_data_delete (gimp->palette_factory,
                                                 GIMP_DATA (palette),
                                                 TRUE, error);
      else
        success = FALSE;
    }

  return gimp_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:28,代码来源:palette-cmds.c

示例3: gimp_curves_config_new_explicit

GObject *
gimp_curves_config_new_explicit (gint32         channel,
                                 const gdouble *samples,
                                 gint           n_samples)
{
  GimpCurvesConfig *config;
  GimpCurve        *curve;
  gint              i;

  g_return_val_if_fail (channel >= GIMP_HISTOGRAM_VALUE &&
                        channel <= GIMP_HISTOGRAM_ALPHA, NULL);
  g_return_val_if_fail (samples != NULL, NULL);
  g_return_val_if_fail (n_samples >= 2 && n_samples <= 4096, NULL);

  config = g_object_new (GIMP_TYPE_CURVES_CONFIG, NULL);

  curve = config->curve[channel];

  gimp_data_freeze (GIMP_DATA (curve));

  gimp_curve_set_curve_type (curve, GIMP_CURVE_FREE);
  gimp_curve_set_n_samples (curve, n_samples);

  for (i = 0; i < n_samples; i++)
    gimp_curve_set_curve (curve,
                          (gdouble) i / (gdouble) (n_samples - 1),
                          (gdouble) samples[i]);

  gimp_data_thaw (GIMP_DATA (curve));

  return G_OBJECT (config);
}
开发者ID:frne,项目名称:gimp,代码行数:32,代码来源:gimpcurvesconfig.c

示例4: gradient_editor_load_right_cmd_callback

void
gradient_editor_load_right_cmd_callback (GtkAction *action,
                                         gint       value,
                                         gpointer   data)
{
  GimpGradientEditor  *editor      = GIMP_GRADIENT_EDITOR (data);
  GimpDataEditor      *data_editor = GIMP_DATA_EDITOR (data);
  GimpGradient        *gradient;
  GimpGradientSegment *seg;
  GimpRGB              color;
  GimpGradientColor    color_type = GIMP_GRADIENT_COLOR_FIXED;

  gradient = GIMP_GRADIENT (data_editor->data);

  switch (value)
    {
    case GRADIENT_EDITOR_COLOR_NEIGHBOR_ENDPOINT:
      if (editor->control_sel_r->next != NULL)
        seg = editor->control_sel_r->next;
      else
        seg = gimp_gradient_segment_get_first (editor->control_sel_r);

      color      = seg->left_color;
      color_type = seg->left_color_type;
      break;

    case GRADIENT_EDITOR_COLOR_OTHER_ENDPOINT:
      color      = editor->control_sel_l->left_color;
      color_type = editor->control_sel_l->left_color_type;
      break;

    case GRADIENT_EDITOR_COLOR_FOREGROUND:
      gimp_context_get_foreground (data_editor->context, &color);
      break;

    case GRADIENT_EDITOR_COLOR_BACKGROUND:
      gimp_context_get_background (data_editor->context, &color);
      break;

    default: /* Load a color */
      color = editor->saved_colors[value - GRADIENT_EDITOR_COLOR_FIRST_CUSTOM];
      break;
    }

  gimp_data_freeze (GIMP_DATA (gradient));

  gimp_gradient_segment_range_blend (gradient,
                                     editor->control_sel_l,
                                     editor->control_sel_r,
                                     &editor->control_sel_l->left_color,
                                     &color,
                                     TRUE, TRUE);
  gimp_gradient_segment_set_right_color_type (gradient,
                                              editor->control_sel_l,
                                              color_type);

  gimp_data_thaw (GIMP_DATA (gradient));
}
开发者ID:MichaelMure,项目名称:Gimp-Cage-Tool,代码行数:58,代码来源:gradient-editor-commands.c

示例5: gimp_brush_editor_update_brush

static void
gimp_brush_editor_update_brush (GtkAdjustment   *adjustment,
                                GimpBrushEditor *editor)
{
  GimpBrushGenerated *brush;
  gdouble             radius;
  gint                spikes;
  gdouble             hardness;
  gdouble             ratio;
  gdouble             angle;
  gdouble             spacing;

  if (! GIMP_IS_BRUSH_GENERATED (GIMP_DATA_EDITOR (editor)->data))
    return;

  brush = GIMP_BRUSH_GENERATED (GIMP_DATA_EDITOR (editor)->data);

  radius   = gtk_adjustment_get_value (editor->radius_data);
  spikes   = ROUND (gtk_adjustment_get_value (editor->spikes_data));
  hardness = gtk_adjustment_get_value (editor->hardness_data);
  ratio    = gtk_adjustment_get_value (editor->aspect_ratio_data);
  angle    = gtk_adjustment_get_value (editor->angle_data);
  spacing  = gtk_adjustment_get_value (editor->spacing_data);

  if (radius   != gimp_brush_generated_get_radius       (brush) ||
      spikes   != gimp_brush_generated_get_spikes       (brush) ||
      hardness != gimp_brush_generated_get_hardness     (brush) ||
      ratio    != gimp_brush_generated_get_aspect_ratio (brush) ||
      angle    != gimp_brush_generated_get_angle        (brush) ||
      spacing  != gimp_brush_get_spacing                (GIMP_BRUSH (brush)))
    {
      g_signal_handlers_block_by_func (brush,
                                       gimp_brush_editor_notify_brush,
                                       editor);

      gimp_data_freeze (GIMP_DATA (brush));
      g_object_freeze_notify (G_OBJECT (brush));

      gimp_brush_generated_set_radius       (brush, radius);
      gimp_brush_generated_set_spikes       (brush, spikes);
      gimp_brush_generated_set_hardness     (brush, hardness);
      gimp_brush_generated_set_aspect_ratio (brush, ratio);
      gimp_brush_generated_set_angle        (brush, angle);
      gimp_brush_set_spacing                (GIMP_BRUSH (brush), spacing);

      g_object_thaw_notify (G_OBJECT (brush));
      gimp_data_thaw (GIMP_DATA (brush));

      g_signal_handlers_unblock_by_func (brush,
                                         gimp_brush_editor_notify_brush,
                                         editor);
    }
}
开发者ID:jdburton,项目名称:gimp-osx,代码行数:53,代码来源:gimpbrusheditor.c

示例6: palette_is_editable_invoker

static GimpValueArray *
palette_is_editable_invoker (GimpProcedure         *procedure,
                             Gimp                  *gimp,
                             GimpContext           *context,
                             GimpProgress          *progress,
                             const GimpValueArray  *args,
                             GError               **error)
{
  gboolean success = TRUE;
  GimpValueArray *return_vals;
  const gchar *name;
  gboolean editable = FALSE;

  name = g_value_get_string (gimp_value_array_index (args, 0));

  if (success)
    {
      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);

      if (palette)
        editable = gimp_data_is_writable (GIMP_DATA (palette));
      else
        success = FALSE;
    }

  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_boolean (gimp_value_array_index (return_vals, 1), editable);

  return return_vals;
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:33,代码来源:palette-cmds.c

示例7: palette_set_columns_invoker

static GValueArray *
palette_set_columns_invoker (GimpProcedure     *procedure,
                             Gimp              *gimp,
                             GimpContext       *context,
                             GimpProgress      *progress,
                             const GValueArray *args)
{
  gboolean success = TRUE;
  const gchar *name;
  gint32 columns;

  name = g_value_get_string (&args->values[0]);
  columns = g_value_get_int (&args->values[1]);

  if (success)
    {
      GimpPalette *palette = (GimpPalette *)
        gimp_container_get_child_by_name (gimp->palette_factory->container, name);

      if (palette && GIMP_DATA (palette)->writable)
        gimp_palette_set_columns (palette, columns);
      else
        success = FALSE;
    }

  return gimp_procedure_get_return_values (procedure, success);
}
开发者ID:Amerekanets,项目名称:gimp,代码行数:27,代码来源:palette_cmds.c

示例8: palette_is_editable_invoker

static GValueArray *
palette_is_editable_invoker (GimpProcedure     *procedure,
                             Gimp              *gimp,
                             GimpContext       *context,
                             GimpProgress      *progress,
                             const GValueArray *args)
{
  gboolean success = TRUE;
  GValueArray *return_vals;
  const gchar *name;
  gboolean editable = FALSE;

  name = g_value_get_string (&args->values[0]);

  if (success)
    {
      GimpPalette *palette = (GimpPalette *)
        gimp_container_get_child_by_name (gimp->palette_factory->container, name);

      if (palette)
        editable = GIMP_DATA (palette)->writable;
      else
        success = FALSE;
    }

  return_vals = gimp_procedure_get_return_values (procedure, success);

  if (success)
    g_value_set_boolean (&return_vals->values[1], editable);

  return return_vals;
}
开发者ID:Amerekanets,项目名称:gimp,代码行数:32,代码来源:palette_cmds.c

示例9: dynamics_actions_update

void
dynamics_actions_update (GimpActionGroup *group,
                         gpointer         user_data)
{
  GimpContext  *context  = action_data_get_context (user_data);
  GimpDynamics *dynamics = NULL;
  GimpData     *data     = NULL;
  const gchar  *filename = NULL;

  if (context)
    {
      dynamics = gimp_context_get_dynamics (context);

      if (dynamics)
        {
          data = GIMP_DATA (dynamics);

          filename = gimp_data_get_filename (data);
        }
    }

#define SET_SENSITIVE(action,condition) \
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)

  SET_SENSITIVE ("dynamics-edit",          dynamics);
  SET_SENSITIVE ("dynamics-duplicate",     dynamics && GIMP_DATA_GET_CLASS (data)->duplicate);
  SET_SENSITIVE ("dynamics-copy-location", dynamics && filename);
  SET_SENSITIVE ("dynamics-delete",        dynamics && gimp_data_is_deletable (data));

#undef SET_SENSITIVE
}
开发者ID:1ynx,项目名称:gimp,代码行数:31,代码来源:dynamics-actions.c

示例10: gimp_pdb_get_gradient

GimpGradient *
gimp_pdb_get_gradient (Gimp         *gimp,
                       const gchar  *name,
                       gboolean      writable,
                       GError      **error)
{
  GimpGradient *gradient;

  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
  g_return_val_if_fail (error == NULL || *error == NULL, NULL);

  if (! name || ! strlen (name))
    {
      g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
			   _("Invalid empty gradient name"));
      return NULL;
    }

  gradient = (GimpGradient *) gimp_pdb_get_data_factory_item (gimp->gradient_factory, name);

  if (! gradient)
    {
      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                   _("Gradient '%s' not found"), name);
    }
  else if (writable && ! gimp_data_is_writable (GIMP_DATA (gradient)))
    {
      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                   _("Gradient '%s' is not editable"), name);
      return NULL;
    }

  return gradient;
}
开发者ID:Distrotech,项目名称:gimp,代码行数:34,代码来源:gimppdb-utils.c

示例11: gimp_pdb_get_dynamics

GimpDynamics *
gimp_pdb_get_dynamics (Gimp         *gimp,
                       const gchar  *name,
                       gboolean      writable,
                       GError      **error)
{
  GimpDynamics *dynamics;

  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
  g_return_val_if_fail (error == NULL || *error == NULL, NULL);

  if (! name || ! strlen (name))
    {
      g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
			   _("Invalid empty paint dynamics name"));
      return NULL;
    }

  dynamics = (GimpDynamics *) gimp_pdb_get_data_factory_item (gimp->dynamics_factory, name);

  if (! dynamics)
    {
      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                   _("Paint dynamics '%s' not found"), name);
    }
  else if (writable && ! gimp_data_is_writable (GIMP_DATA (dynamics)))
    {
      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                   _("Paint dynamics '%s' is not editable"), name);
      return NULL;
    }

  return dynamics;
}
开发者ID:Distrotech,项目名称:gimp,代码行数:34,代码来源:gimppdb-utils.c

示例12: gimp_pattern_new

GimpData *
gimp_pattern_new (GimpContext *context,
                  const gchar *name)
{
  GimpPattern *pattern;
  guchar      *data;
  gint         row, col;

  g_return_val_if_fail (name != NULL, NULL);
  g_return_val_if_fail (name[0] != '\n', NULL);

  pattern = g_object_new (GIMP_TYPE_PATTERN,
                          "name", name,
                          NULL);

  pattern->mask = gimp_temp_buf_new (32, 32, babl_format ("R'G'B' u8"));

  data = gimp_temp_buf_get_data (pattern->mask);

  for (row = 0; row < gimp_temp_buf_get_height (pattern->mask); row++)
    for (col = 0; col < gimp_temp_buf_get_width (pattern->mask); col++)
      {
        memset (data, (col % 2) && (row % 2) ? 255 : 0, 3);
        data += 3;
      }

  return GIMP_DATA (pattern);
}
开发者ID:Anstep,项目名称:gimp,代码行数:28,代码来源:gimppattern.c

示例13: gimp_pdb_get_palette

GimpPalette *
gimp_pdb_get_palette (Gimp         *gimp,
                      const gchar  *name,
                      gboolean      writable,
                      GError      **error)
{
  GimpPalette *palette;

  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
  g_return_val_if_fail (error == NULL || *error == NULL, NULL);

  if (! name || ! strlen (name))
    {
      g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
			   _("Invalid empty palette name"));
      return NULL;
    }

  palette = (GimpPalette *) gimp_pdb_get_data_factory_item (gimp->palette_factory, name);

  if (! palette)
    {
      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                   _("Palette '%s' not found"), name);
    }
  else if (writable && ! gimp_data_is_writable (GIMP_DATA (palette)))
    {
      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                   _("Palette '%s' is not editable"), name);
      return NULL;
    }

  return palette;
}
开发者ID:Distrotech,项目名称:gimp,代码行数:34,代码来源:gimppdb-utils.c

示例14: gimp_brush_generated_new

GimpData *
gimp_brush_generated_new (const gchar             *name,
                          GimpBrushGeneratedShape  shape,
                          gfloat                   radius,
                          gint                     spikes,
                          gfloat                   hardness,
                          gfloat                   aspect_ratio,
                          gfloat                   angle)
{
  GimpBrushGenerated *brush;

  g_return_val_if_fail (name != NULL, NULL);
  g_return_val_if_fail (*name != '\0', NULL);

  brush = g_object_new (GIMP_TYPE_BRUSH_GENERATED,
                        "name",         name,
                        "mime-type",    "application/x-gimp-brush-generated",
                        "spacing",      20.0,
                        "shape",        shape,
                        "radius",       radius,
                        "spikes",       spikes,
                        "hardness",     hardness,
                        "aspect-ratio", aspect_ratio,
                        "angle",        angle,
                        NULL);

  return GIMP_DATA (brush);
}
开发者ID:jdburton,项目名称:gimp-osx,代码行数:28,代码来源:gimpbrushgenerated.c

示例15: gimp_pdb_get_brush

GimpBrush *
gimp_pdb_get_brush (Gimp         *gimp,
                    const gchar  *name,
                    gboolean      writable,
                    GError      **error)
{
  GimpBrush *brush;

  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
  g_return_val_if_fail (error == NULL || *error == NULL, NULL);

  if (! name || ! strlen (name))
    {
      g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
			   _("Invalid empty brush name"));
      return NULL;
    }

  brush = (GimpBrush *) gimp_pdb_get_data_factory_item (gimp->brush_factory, name);

  if (! brush)
    {
      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                   _("Brush '%s' not found"), name);
    }
  else if (writable && ! gimp_data_is_writable (GIMP_DATA (brush)))
    {
      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
                   _("Brush '%s' is not editable"), name);
      return NULL;
    }

  return brush;
}
开发者ID:Distrotech,项目名称:gimp,代码行数:34,代码来源:gimppdb-utils.c


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