Esempio n. 1
0
static GimpValueArray *
selection_combine_invoker (GimpProcedure         *procedure,
                           Gimp                  *gimp,
                           GimpContext           *context,
                           GimpProgress          *progress,
                           const GimpValueArray  *args,
                           GError               **error)
{
  gboolean success = TRUE;
  GimpChannel *channel;
  gint32 operation;

  channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);
  operation = g_value_get_enum (gimp_value_array_index (args, 1));

  if (success)
    {
      if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), NULL, 0, error))
        gimp_item_to_selection (GIMP_ITEM (channel),
                                operation,
                                TRUE, FALSE, 0.0, 0.0);
      else
        success = FALSE;
    }

  return gimp_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}
Esempio n. 2
0
static GimpValueArray *
selection_layer_alpha_invoker (GimpProcedure         *procedure,
                               Gimp                  *gimp,
                               GimpContext           *context,
                               GimpProgress          *progress,
                               const GimpValueArray  *args,
                               GError               **error)
{
  gboolean success = TRUE;
  GimpLayer *layer;

  layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);

  if (success)
    {
      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, 0, error))
        gimp_item_to_selection (GIMP_ITEM (layer),
                                GIMP_CHANNEL_OP_REPLACE,
                                TRUE, FALSE, 0.0, 0.0);
      else
        success = FALSE;
    }

  return gimp_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}
Esempio n. 3
0
void
vectors_to_selection_cmd_callback (GtkAction *action,
                                   gint       value,
                                   gpointer   data)
{
  GimpImage   *image;
  GimpVectors *vectors;
  return_if_no_vectors (image, vectors, data);

  gimp_item_to_selection (GIMP_ITEM (vectors),
                          (GimpChannelOps) value,
                          TRUE, FALSE, 0, 0);
  gimp_image_flush (image);
}
Esempio n. 4
0
static GimpValueArray *
image_select_item_invoker (GimpProcedure         *procedure,
                           Gimp                  *gimp,
                           GimpContext           *context,
                           GimpProgress          *progress,
                           const GimpValueArray  *args,
                           GError               **error)
{
  gboolean success = TRUE;
  GimpImage *image;
  gint32 operation;
  GimpItem *item;

  image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
  operation = g_value_get_enum (gimp_value_array_index (args, 1));
  item = gimp_value_get_item (gimp_value_array_index (args, 2), gimp);

  if (success)
    {
      if (gimp_pdb_item_is_attached (item, image, 0, error))
        {
          GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);

          gimp_item_to_selection (item, operation,
                                  pdb_context->antialias,
                                  pdb_context->feather,
                                  pdb_context->feather_radius_x,
                                  pdb_context->feather_radius_y);
        }
      else
        success = FALSE;
    }

  return gimp_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}