app: gimp_layer_mask_new() uses GeglColor.

This commit is contained in:
Jehan 2023-12-22 16:08:53 +09:00
parent cf213d1051
commit 3ec13730c5
4 changed files with 13 additions and 14 deletions

View File

@ -1992,7 +1992,7 @@ gimp_layer_create_mask (GimpLayer *layer,
GimpLayerMask *mask;
GimpImage *image;
gchar *mask_name;
GimpRGB black = { 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE };
GeglColor *black = gegl_color_new ("black");
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
g_return_val_if_fail (add_mask_type != GIMP_ADD_MASK_CHANNEL ||
@ -2008,9 +2008,10 @@ gimp_layer_create_mask (GimpLayer *layer,
mask = gimp_layer_mask_new (image,
gimp_item_get_width (item),
gimp_item_get_height (item),
mask_name, &black);
mask_name, black);
g_free (mask_name);
g_object_unref (black);
switch (add_mask_type)
{

View File

@ -243,19 +243,18 @@ gimp_layer_mask_convert_type (GimpDrawable *drawable,
}
GimpLayerMask *
gimp_layer_mask_new (GimpImage *image,
gint width,
gint height,
const gchar *name,
const GimpRGB *rgb)
gimp_layer_mask_new (GimpImage *image,
gint width,
gint height,
const gchar *name,
GeglColor *color)
{
GimpLayerMask *layer_mask;
GeglColor *color;
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 (rgb != NULL, NULL);
g_return_val_if_fail (GEGL_IS_COLOR (color), NULL);
layer_mask =
GIMP_LAYER_MASK (gimp_drawable_new (GIMP_TYPE_LAYER_MASK,
@ -264,8 +263,6 @@ gimp_layer_mask_new (GimpImage *image,
gimp_image_get_mask_format (image)));
/* set the layer_mask color and opacity */
color = gegl_color_new (NULL);
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), rgb);
gimp_channel_set_color (GIMP_CHANNEL (layer_mask), color, FALSE);
gimp_channel_set_show_masked (GIMP_CHANNEL (layer_mask), TRUE);

View File

@ -51,7 +51,7 @@ GimpLayerMask * gimp_layer_mask_new (GimpImage *image,
gint width,
gint height,
const gchar *name,
const GimpRGB *color);
GeglColor *color);
void gimp_layer_mask_set_layer (GimpLayerMask *layer_mask,
GimpLayer *layer);

View File

@ -3458,7 +3458,7 @@ xcf_load_layer_mask (XcfInfo *info,
gint height;
gboolean is_fs_drawable;
gchar *name;
GimpRGB color = { 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE };
GeglColor *color = gegl_color_new ("black");
goffset cur_offset;
/* check and see if this is the drawable the floating selection
@ -3481,7 +3481,8 @@ xcf_load_layer_mask (XcfInfo *info,
width, height, name);
/* create a new layer mask */
layer_mask = gimp_layer_mask_new (image, width, height, name, &color);
layer_mask = gimp_layer_mask_new (image, width, height, name, color);
g_object_unref (color);
g_free (name);
if (! layer_mask)
return NULL;