diff --git a/libgimpcolor/gimpcolor.def b/libgimpcolor/gimpcolor.def index 3a3d02ec1a..494c6bf218 100644 --- a/libgimpcolor/gimpcolor.def +++ b/libgimpcolor/gimpcolor.def @@ -82,8 +82,6 @@ EXPORTS gimp_rgb_composite gimp_rgb_get_type gimp_rgb_get_uchar - gimp_rgb_luminance - gimp_rgb_luminance_uchar gimp_rgb_max gimp_rgb_min gimp_rgb_multiply diff --git a/libgimpcolor/gimprgb.c b/libgimpcolor/gimprgb.c index abe8b6e2af..e5fed9a7a4 100644 --- a/libgimpcolor/gimprgb.c +++ b/libgimpcolor/gimprgb.c @@ -197,42 +197,6 @@ gimp_rgb_clamp (GimpRGB *rgb) rgb->a = CLAMP (rgb->a, 0.0, 1.0); } -/** - * gimp_rgb_luminance: - * @rgb: a #GimpRGB struct - * - * Returns: the luminous intensity of the range from 0.0 to 1.0. - * - * Since: 2.4 - **/ -gdouble -gimp_rgb_luminance (const GimpRGB *rgb) -{ - gdouble luminance; - - g_return_val_if_fail (rgb != NULL, 0.0); - - luminance = GIMP_RGB_LUMINANCE (rgb->r, rgb->g, rgb->b); - - return CLAMP (luminance, 0.0, 1.0); -} - -/** - * gimp_rgb_luminance_uchar: - * @rgb: a #GimpRGB struct - * - * Returns: the luminous intensity in the range from 0 to 255. - * - * Since: 2.4 - **/ -guchar -gimp_rgb_luminance_uchar (const GimpRGB *rgb) -{ - g_return_val_if_fail (rgb != NULL, 0); - - return ROUND (gimp_rgb_luminance (rgb) * 255.0); -} - void gimp_rgb_composite (GimpRGB *color1, const GimpRGB *color2, diff --git a/libgimpcolor/gimprgb.h b/libgimpcolor/gimprgb.h index ab502be195..0bf6eac995 100644 --- a/libgimpcolor/gimprgb.h +++ b/libgimpcolor/gimprgb.h @@ -78,9 +78,6 @@ gdouble gimp_rgb_max (const GimpRGB *rgb); gdouble gimp_rgb_min (const GimpRGB *rgb); void gimp_rgb_clamp (GimpRGB *rgb); -gdouble gimp_rgb_luminance (const GimpRGB *rgb); -guchar gimp_rgb_luminance_uchar (const GimpRGB *rgb); - void gimp_rgb_composite (GimpRGB *color1, const GimpRGB *color2, GimpRGBCompositeMode mode); diff --git a/plug-ins/common/checkerboard.c b/plug-ins/common/checkerboard.c index 52af2b1a3e..2ba3acd3f9 100644 --- a/plug-ins/common/checkerboard.c +++ b/plug-ins/common/checkerboard.c @@ -258,7 +258,10 @@ do_checkerboard_pattern (GObject *config, { CheckerboardParam_t param; GeglColor *color; - GimpRGB fg, bg; + guchar fg[4] = {0, 0, 0, 0}; + guchar bg[4] = {0, 0, 0, 0}; + guchar fg_lum[1] = {0}; + guchar bg_lum[1] = {0}; const Babl *format; gint bpp; gboolean mode = FALSE; @@ -271,38 +274,40 @@ do_checkerboard_pattern (GObject *config, NULL); color = gimp_context_get_background (); - gegl_color_get_pixel (color, babl_format_with_space ("R'G'B'A double", NULL), &bg); + gegl_color_get_pixel (color, babl_format_with_space ("R'G'B'A u8", NULL), bg); + gegl_color_get_pixel (color, babl_format_with_space ("Y' u8", NULL), bg_lum); g_object_unref (color); color = gimp_context_get_foreground (); - gegl_color_get_pixel (color, babl_format_with_space ("R'G'B'A double", NULL), &fg); + gegl_color_get_pixel (color, babl_format_with_space ("R'G'B'A u8", NULL), fg); + gegl_color_get_pixel (color, babl_format_with_space ("Y' u8", NULL), fg_lum); g_object_unref (color); if (gimp_drawable_is_gray (drawable)) { - param.bg[0] = gimp_rgb_luminance_uchar (&bg); - gimp_rgba_get_uchar (&bg, NULL, NULL, NULL, param.bg + 1); + param.bg[0] = bg_lum[0]; + param.bg[1] = bg[3]; - param.fg[0] = gimp_rgb_luminance_uchar (&fg); - gimp_rgba_get_uchar (&fg, NULL, NULL, NULL, param.fg + 3); - - if (gimp_drawable_has_alpha (drawable)) - format = babl_format ("R'G'B'A u8"); - else - format = babl_format ("R'G'B' u8"); - } - else - { - gimp_rgba_get_uchar (&bg, - param.bg, param.bg + 1, param.bg + 2, param.bg + 1); - - gimp_rgba_get_uchar (&fg, - param.fg, param.fg + 1, param.fg + 2, param.fg + 3); + param.fg[0] = fg_lum[0]; + param.fg[1] = fg[3]; if (gimp_drawable_has_alpha (drawable)) format = babl_format ("Y'A u8"); else format = babl_format ("Y' u8"); } + else + { + for (gint i = 0; i < 4; i++) + { + param.bg[i] = bg[i]; + param.fg[i] = fg[i]; + } + + if (gimp_drawable_has_alpha (drawable)) + format = babl_format ("R'G'B'A u8"); + else + format = babl_format ("R'G'B' u8"); + } bpp = babl_format_get_bytes_per_pixel (format); diff --git a/plug-ins/gradient-flare/gradient-flare.c b/plug-ins/gradient-flare/gradient-flare.c index 201667eb07..7bd436ad40 100644 --- a/plug-ins/gradient-flare/gradient-flare.c +++ b/plug-ins/gradient-flare/gradient-flare.c @@ -1258,7 +1258,9 @@ plugin_put_pixel_func (gint ix, } else { - dest[0] = gimp_rgb_luminance_uchar (color); + guchar rgb[3] = {color->r * 255, color->g * 255, color->b * 255}; + + dest[0] = GIMP_RGB_LUMINANCE (rgb[0], rgb[1], rgb[2]); } if (dinfo.has_alpha)