예제 #1
0
static GimpValueArray *
channel_combine_masks_invoker (GimpProcedure         *procedure,
                               Gimp                  *gimp,
                               GimpContext           *context,
                               GimpProgress          *progress,
                               const GimpValueArray  *args,
                               GError               **error)
{
  gboolean success = TRUE;
  GimpChannel *channel1;
  GimpChannel *channel2;
  gint32 operation;
  gint32 offx;
  gint32 offy;

  channel1 = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);
  channel2 = gimp_value_get_channel (gimp_value_array_index (args, 1), gimp);
  operation = g_value_get_enum (gimp_value_array_index (args, 2));
  offx = g_value_get_int (gimp_value_array_index (args, 3));
  offy = g_value_get_int (gimp_value_array_index (args, 4));

  if (success)
    {
      gimp_channel_push_undo (channel1, _("Combine Masks"));
      gimp_channel_combine_mask (channel1, channel2, operation, offx, offy);
    }

  return gimp_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}
예제 #2
0
static GValueArray *
channel_combine_masks_invoker (GimpProcedure     *procedure,
                               Gimp              *gimp,
                               GimpContext       *context,
                               GimpProgress      *progress,
                               const GValueArray *args)
{
  gboolean success = TRUE;
  GimpChannel *channel1;
  GimpChannel *channel2;
  gint32 operation;
  gint32 offx;
  gint32 offy;

  channel1 = gimp_value_get_channel (&args->values[0], gimp);
  channel2 = gimp_value_get_channel (&args->values[1], gimp);
  operation = g_value_get_enum (&args->values[2]);
  offx = g_value_get_int (&args->values[3]);
  offy = g_value_get_int (&args->values[4]);

  if (success)
    {
      gimp_channel_push_undo (channel1, _("Combine Masks"));
      gimp_channel_combine_mask (channel1, channel2, operation, offx, offy);
    }

  return gimp_procedure_get_return_values (procedure, success);
}
예제 #3
0
static GValueArray *
channel_get_color_invoker (GimpProcedure     *procedure,
                           Gimp              *gimp,
                           GimpContext       *context,
                           GimpProgress      *progress,
                           const GValueArray *args)
{
  gboolean success = TRUE;
  GValueArray *return_vals;
  GimpChannel *channel;
  GimpRGB color = { 0.0, 0.0, 0.0, 1.0 };

  channel = gimp_value_get_channel (&args->values[0], gimp);

  if (success)
    {
      gimp_channel_get_color (channel, &color);
      gimp_rgb_set_alpha (&color, 1.0);
    }

  return_vals = gimp_procedure_get_return_values (procedure, success);

  if (success)
    gimp_value_set_rgb (&return_vals->values[1], &color);

  return return_vals;
}
예제 #4
0
static GValueArray *
channel_get_opacity_invoker (GimpProcedure     *procedure,
                             Gimp              *gimp,
                             GimpContext       *context,
                             GimpProgress      *progress,
                             const GValueArray *args)
{
  gboolean success = TRUE;
  GValueArray *return_vals;
  GimpChannel *channel;
  gdouble opacity = 0.0;

  channel = gimp_value_get_channel (&args->values[0], gimp);

  if (success)
    {
      opacity = gimp_channel_get_opacity (channel) * 100;
    }

  return_vals = gimp_procedure_get_return_values (procedure, success);

  if (success)
    g_value_set_double (&return_vals->values[1], opacity);

  return return_vals;
}
예제 #5
0
static GValueArray *
channel_get_show_masked_invoker (GimpProcedure     *procedure,
                                 Gimp              *gimp,
                                 GimpContext       *context,
                                 GimpProgress      *progress,
                                 const GValueArray *args)
{
  gboolean success = TRUE;
  GValueArray *return_vals;
  GimpChannel *channel;
  gboolean show_masked = FALSE;

  channel = gimp_value_get_channel (&args->values[0], gimp);

  if (success)
    {
      show_masked = gimp_channel_get_show_masked (channel);
    }

  return_vals = gimp_procedure_get_return_values (procedure, success);

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

  return return_vals;
}
예제 #6
0
static GValueArray *
channel_copy_invoker (GimpProcedure     *procedure,
                      Gimp              *gimp,
                      GimpContext       *context,
                      GimpProgress      *progress,
                      const GValueArray *args)
{
  gboolean success = TRUE;
  GValueArray *return_vals;
  GimpChannel *channel;
  GimpChannel *channel_copy = NULL;

  channel = gimp_value_get_channel (&args->values[0], gimp);

  if (success)
    {
      channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
                                   G_TYPE_FROM_INSTANCE (channel), FALSE));

      if (! channel_copy)
        success = FALSE;
    }

  return_vals = gimp_procedure_get_return_values (procedure, success);

  if (success)
    gimp_value_set_channel (&return_vals->values[1], channel_copy);

  return return_vals;
}
예제 #7
0
static GValueArray *
channel_set_color_invoker (GimpProcedure      *procedure,
                           Gimp               *gimp,
                           GimpContext        *context,
                           GimpProgress       *progress,
                           const GValueArray  *args,
                           GError            **error)
{
  gboolean success = TRUE;
  GimpChannel *channel;
  GimpRGB color;

  channel = gimp_value_get_channel (&args->values[0], gimp);
  gimp_value_get_rgb (&args->values[1], &color);

  if (success)
    {
      GimpRGB rgb_color = color;

      rgb_color.a = channel->color.a;
      gimp_channel_set_color (channel, &rgb_color, TRUE);
    }

  return gimp_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}
예제 #8
0
static GimpValueArray *
channel_get_color_invoker (GimpProcedure         *procedure,
                           Gimp                  *gimp,
                           GimpContext           *context,
                           GimpProgress          *progress,
                           const GimpValueArray  *args,
                           GError               **error)
{
  gboolean success = TRUE;
  GimpValueArray *return_vals;
  GimpChannel *channel;
  GimpRGB color = { 0.0, 0.0, 0.0, 1.0 };

  channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);

  if (success)
    {
      gimp_channel_get_color (channel, &color);
      gimp_rgb_set_alpha (&color, 1.0);
    }

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

  if (success)
    gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &color);

  return return_vals;
}
예제 #9
0
static GimpValueArray *
channel_get_opacity_invoker (GimpProcedure         *procedure,
                             Gimp                  *gimp,
                             GimpContext           *context,
                             GimpProgress          *progress,
                             const GimpValueArray  *args,
                             GError               **error)
{
  gboolean success = TRUE;
  GimpValueArray *return_vals;
  GimpChannel *channel;
  gdouble opacity = 0.0;

  channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);

  if (success)
    {
      opacity = gimp_channel_get_opacity (channel) * 100;
    }

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

  if (success)
    g_value_set_double (gimp_value_array_index (return_vals, 1), opacity);

  return return_vals;
}
예제 #10
0
static GimpValueArray *
channel_get_show_masked_invoker (GimpProcedure         *procedure,
                                 Gimp                  *gimp,
                                 GimpContext           *context,
                                 GimpProgress          *progress,
                                 const GimpValueArray  *args,
                                 GError               **error)
{
  gboolean success = TRUE;
  GimpValueArray *return_vals;
  GimpChannel *channel;
  gboolean show_masked = FALSE;

  channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);

  if (success)
    {
      show_masked = gimp_channel_get_show_masked (channel);
    }

  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), show_masked);

  return return_vals;
}
예제 #11
0
static GimpValueArray *
channel_copy_invoker (GimpProcedure         *procedure,
                      Gimp                  *gimp,
                      GimpContext           *context,
                      GimpProgress          *progress,
                      const GimpValueArray  *args,
                      GError               **error)
{
  gboolean success = TRUE;
  GimpValueArray *return_vals;
  GimpChannel *channel;
  GimpChannel *channel_copy = NULL;

  channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);

  if (success)
    {
      channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
                                   G_TYPE_FROM_INSTANCE (channel)));

      if (! channel_copy)
        success = FALSE;
    }

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

  if (success)
    gimp_value_set_channel (gimp_value_array_index (return_vals, 1), channel_copy);

  return return_vals;
}
예제 #12
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);
}
예제 #13
0
static GValueArray *
selection_combine_invoker (GimpProcedure      *procedure,
                           Gimp               *gimp,
                           GimpContext        *context,
                           GimpProgress       *progress,
                           const GValueArray  *args,
                           GError            **error)
{
  gboolean success = TRUE;
  GimpChannel *channel;
  gint32 operation;

  channel = gimp_value_get_channel (&args->values[0], gimp);
  operation = g_value_get_enum (&args->values[1]);

  if (success)
    {
      GimpImage *image;
      gint       off_x, off_y;

      image = gimp_item_get_image (GIMP_ITEM (channel));
      gimp_item_offsets (GIMP_ITEM (channel), &off_x, &off_y);

      gimp_channel_select_channel (gimp_image_get_mask (image),
                                   _("Channel to Selection"),
                                   channel,
                                   off_x, off_y,
                                   operation,
                                   FALSE, 0.0, 0.0);
    }

  return gimp_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}
예제 #14
0
static GValueArray *
channel_set_opacity_invoker (GimpProcedure     *procedure,
                             Gimp              *gimp,
                             GimpContext       *context,
                             GimpProgress      *progress,
                             const GValueArray *args)
{
  gboolean success = TRUE;
  GimpChannel *channel;
  gdouble opacity;

  channel = gimp_value_get_channel (&args->values[0], gimp);
  opacity = g_value_get_double (&args->values[1]);

  if (success)
    {
      gimp_channel_set_opacity (channel, opacity / 100.0, TRUE);
    }

  return gimp_procedure_get_return_values (procedure, success);
}
예제 #15
0
static GValueArray *
channel_set_show_masked_invoker (GimpProcedure      *procedure,
                                 Gimp               *gimp,
                                 GimpContext        *context,
                                 GimpProgress       *progress,
                                 const GValueArray  *args,
                                 GError            **error)
{
  gboolean success = TRUE;
  GimpChannel *channel;
  gboolean show_masked;

  channel = gimp_value_get_channel (&args->values[0], gimp);
  show_masked = g_value_get_boolean (&args->values[1]);

  if (success)
    {
      gimp_channel_set_show_masked (channel, show_masked);
    }

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