Bug 765180 - Hard-coded NTSC parameters in babl/GEGL/GIMP

Port GimpColorWheel to GIMP_RGB_LUMINANCE().
This commit is contained in:
Michael Natterer 2016-04-17 17:51:14 +01:00
parent 30b73125f8
commit f7fc87884e

View file

@ -30,9 +30,12 @@
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <libgimpcolor/gimpcolor.h>
#include <libgimpmath/gimpmath.h>
#include "gimpcolorwheel.h"
@ -347,8 +350,6 @@ gimp_color_wheel_size_allocate (GtkWidget *widget,
/* Utility functions */
#define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)
/* Converts from HSV to RGB */
static void
hsv_to_rgb (gdouble *h,
@ -875,7 +876,7 @@ paint_ring (GimpColorWheel *wheel,
b = 1.0;
hsv_to_rgb (&r, &g, &b);
if (INTENSITY (r, g, b) > 0.5)
if (GIMP_RGB_LUMINANCE (r, g, b) > 0.5)
cairo_set_source_rgb (source_cr, 0., 0., 0.);
else
cairo_set_source_rgb (source_cr, 1., 1., 1.);
@ -1099,7 +1100,7 @@ paint_triangle (GimpColorWheel *wheel,
b = priv->v;
hsv_to_rgb (&r, &g, &b);
if (INTENSITY (r, g, b) > 0.5)
if (GIMP_RGB_LUMINANCE (r, g, b) > 0.5)
{
detail = "colorwheel_light";
cairo_set_source_rgb (cr, 0., 0., 0.);