mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-20 11:37:14 +00:00
app: add gimp_image_get_channel_format() and get_mask_format()
which for now return the same thing (Y' u8) and need to be used in more places before becoming useful.
This commit is contained in:
parent
e250c02bc7
commit
9bac5b8837
|
@ -1624,8 +1624,7 @@ gimp_channel_new (GimpImage *image,
|
|||
GIMP_CHANNEL (gimp_drawable_new (GIMP_TYPE_CHANNEL,
|
||||
image, name,
|
||||
0, 0, width, height,
|
||||
gimp_image_get_format (image,
|
||||
GIMP_GRAY_IMAGE)));
|
||||
gimp_image_get_channel_format (image)));
|
||||
|
||||
if (color)
|
||||
channel->color = *color;
|
||||
|
@ -1903,17 +1902,24 @@ gimp_channel_new_mask (GimpImage *image,
|
|||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GimpChannel *new_channel;
|
||||
GimpChannel *channel;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
|
||||
new_channel = gimp_channel_new (image, width, height,
|
||||
_("Selection Mask"), NULL);
|
||||
channel =
|
||||
GIMP_CHANNEL (gimp_drawable_new (GIMP_TYPE_CHANNEL,
|
||||
image, _("Selection Mask"),
|
||||
0, 0, width, height,
|
||||
gimp_image_get_mask_format (image)));
|
||||
|
||||
gegl_buffer_clear (gimp_drawable_get_buffer (GIMP_DRAWABLE (new_channel)),
|
||||
channel->show_masked = TRUE;
|
||||
channel->x2 = width;
|
||||
channel->y2 = height;
|
||||
|
||||
gegl_buffer_clear (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
|
||||
NULL);
|
||||
|
||||
return new_channel;
|
||||
return channel;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -1568,6 +1568,22 @@ gimp_image_get_layer_format (const GimpImage *image,
|
|||
g_return_val_if_reached (NULL);
|
||||
}
|
||||
|
||||
const Babl *
|
||||
gimp_image_get_channel_format (const GimpImage *image)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
|
||||
return babl_format ("Y' u8");
|
||||
}
|
||||
|
||||
const Babl *
|
||||
gimp_image_get_mask_format (const GimpImage *image)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
|
||||
return babl_format ("Y' u8");
|
||||
}
|
||||
|
||||
gint
|
||||
gimp_image_get_ID (const GimpImage *image)
|
||||
{
|
||||
|
|
|
@ -121,6 +121,8 @@ const Babl * gimp_image_get_format_without_alpha (const GimpImage *image,
|
|||
|
||||
const Babl * gimp_image_get_layer_format (const GimpImage *image,
|
||||
gboolean with_alpha);
|
||||
const Babl * gimp_image_get_channel_format (const GimpImage *image);
|
||||
const Babl * gimp_image_get_mask_format (const GimpImage *image);
|
||||
|
||||
gint gimp_image_get_ID (const GimpImage *image);
|
||||
GimpImage * gimp_image_get_by_ID (Gimp *gimp,
|
||||
|
|
|
@ -145,11 +145,11 @@ gimp_layer_mask_new (GimpImage *image,
|
|||
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_format (image,
|
||||
GIMP_GRAY_IMAGE)));
|
||||
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);
|
||||
|
|
|
@ -527,8 +527,7 @@ gimp_selection_new (GimpImage *image,
|
|||
channel = GIMP_CHANNEL (gimp_drawable_new (GIMP_TYPE_SELECTION,
|
||||
image, NULL,
|
||||
0, 0, width, height,
|
||||
gimp_image_get_format (image,
|
||||
GIMP_GRAY_IMAGE)));
|
||||
gimp_image_get_mask_format (image)));
|
||||
|
||||
gimp_channel_set_color (channel, &black, FALSE);
|
||||
gimp_channel_set_show_masked (channel, TRUE);
|
||||
|
|
Loading…
Reference in a new issue