コード例 #1
0
ファイル: gimplayermask.c プロジェクト: bklynate/gimp
GimpLayerMask *
gimp_layer_mask_new (GimpImage     *image,
                     gint           width,
                     gint           height,
                     const gchar   *name,
                     const GimpRGB *color)
{
  GimpLayerMask *layer_mask;

  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
  g_return_val_if_fail (width > 0, NULL);
  g_return_val_if_fail (height > 0, NULL);
  g_return_val_if_fail (color != NULL, NULL);

  layer_mask =
    GIMP_LAYER_MASK (gimp_drawable_new (GIMP_TYPE_LAYER_MASK,
                                        image, name,
                                        0, 0, width, height,
                                        gimp_image_get_mask_format (image)));

  /*  set the layer_mask color and opacity  */
  gimp_channel_set_color (GIMP_CHANNEL (layer_mask), color, FALSE);
  gimp_channel_set_show_masked (GIMP_CHANNEL (layer_mask), TRUE);

  /*  selection mask variables  */
  GIMP_CHANNEL (layer_mask)->x2 = width;
  GIMP_CHANNEL (layer_mask)->y2 = height;

  return layer_mask;
}
コード例 #2
0
ファイル: channel_cmds.c プロジェクト: Amerekanets/gimp
static GValueArray *
channel_set_show_masked_invoker (GimpProcedure     *procedure,
                                 Gimp              *gimp,
                                 GimpContext       *context,
                                 GimpProgress      *progress,
                                 const GValueArray *args)
{
  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);
}
コード例 #3
0
ファイル: channel-cmds.c プロジェクト: ChristianBusch/gimp
static GimpValueArray *
channel_set_show_masked_invoker (GimpProcedure         *procedure,
                                 Gimp                  *gimp,
                                 GimpContext           *context,
                                 GimpProgress          *progress,
                                 const GimpValueArray  *args,
                                 GError               **error)
{
  gboolean success = TRUE;
  GimpChannel *channel;
  gboolean show_masked;

  channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);
  show_masked = g_value_get_boolean (gimp_value_array_index (args, 1));

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

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