From 1a901e0bb9d2389fba32a955d879a358b6f4e96d Mon Sep 17 00:00:00 2001 From: Jehan Date: Mon, 11 Dec 2023 14:04:46 +0900 Subject: [PATCH] libgimpcolor: get the proper alpha variant of a palette format. --- libgimpcolor/gimpcolor.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libgimpcolor/gimpcolor.c b/libgimpcolor/gimpcolor.c index d3e6399dc2..65e8c39c93 100644 --- a/libgimpcolor/gimpcolor.c +++ b/libgimpcolor/gimpcolor.c @@ -341,6 +341,18 @@ gimp_babl_format_get_with_alpha (const Babl *format) /* Assuming we use Babl formats with same type for all components. */ type = babl_get_name (babl_format_get_type (format, 0)); + if (babl_format_is_palette (format)) + { + gchar *alpha_palette = g_strdup (model); + + alpha_palette[0] = '\\'; + babl_new_palette_with_space (alpha_palette, babl_format_get_space (format), + NULL, &new_format); + g_free (alpha_palette); + + return new_format; + } + if (g_strcmp0 (model, "Y") == 0) new_model = "YA"; else if (g_strcmp0 (model, "RGB") == 0)