plug-ins, operation: Remove uses of GimpHSL
GimpOperationHueSaturation did not do conversions since the source was already HSL, so its GimpHSL object was replaced with a float array. Van-Gogh plug-in's RGB -> HSL conversion was replaced with an HSL float Babl format with gegl_buffer_sample ().
This commit is contained in:
@ -206,7 +206,7 @@ gimp_operation_hue_saturation_process (GeglOperation *operation,
|
||||
|
||||
while (samples--)
|
||||
{
|
||||
GimpHSL hsl;
|
||||
gfloat hsl[4];
|
||||
gfloat h;
|
||||
gint hue_counter;
|
||||
gint hue = 0;
|
||||
@ -215,11 +215,9 @@ gimp_operation_hue_saturation_process (GeglOperation *operation,
|
||||
gfloat primary_intensity = 0.0f;
|
||||
gfloat secondary_intensity = 0.0f;
|
||||
|
||||
hsl.h = src[0];
|
||||
hsl.s = src[1];
|
||||
hsl.l = src[2];
|
||||
hsl.a = src[3];
|
||||
h = hsl.h * 6.0f;
|
||||
for (gint i = 0; i < 4; i++)
|
||||
hsl[i] = src[i];
|
||||
h = hsl[0] * 6.0f;
|
||||
|
||||
for (hue_counter = 0; hue_counter < 7; hue_counter++)
|
||||
{
|
||||
@ -266,32 +264,31 @@ gimp_operation_hue_saturation_process (GeglOperation *operation,
|
||||
|
||||
if (use_secondary_hue)
|
||||
{
|
||||
hsl.h = map_hue_overlap (config, hue, secondary_hue, hsl.h,
|
||||
primary_intensity, secondary_intensity);
|
||||
hsl[0] = map_hue_overlap (config, hue, secondary_hue, hsl[0],
|
||||
primary_intensity, secondary_intensity);
|
||||
|
||||
hsl.s = (map_saturation (config, hue, hsl.s) * primary_intensity +
|
||||
map_saturation (config, secondary_hue, hsl.s) * secondary_intensity);
|
||||
hsl[1] = (map_saturation (config, hue, hsl[1]) * primary_intensity +
|
||||
map_saturation (config, secondary_hue, hsl[1]) * secondary_intensity);
|
||||
|
||||
hsl.l = (map_lightness (config, hue, hsl.l) * primary_intensity +
|
||||
map_lightness (config, secondary_hue, hsl.l) * secondary_intensity);
|
||||
hsl[2] = (map_lightness (config, hue, hsl[2]) * primary_intensity +
|
||||
map_lightness (config, secondary_hue, hsl[2]) * secondary_intensity);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hsl.s <= 0.0)
|
||||
if (hsl[1] <= 0.0)
|
||||
{
|
||||
hsl.l = map_lightness_achromatic (config, hsl.l);
|
||||
hsl[2] = map_lightness_achromatic (config, hsl[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
hsl.h = map_hue (config, hue, hsl.h);
|
||||
hsl.l = map_lightness (config, hue, hsl.l);
|
||||
hsl.s = map_saturation (config, hue, hsl.s);
|
||||
hsl[0] = map_hue (config, hue, hsl[0]);
|
||||
hsl[2] = map_lightness (config, hue, hsl[2]);
|
||||
hsl[1] = map_saturation (config, hue, hsl[1]);
|
||||
}
|
||||
}
|
||||
|
||||
dest[0] = hsl.h;
|
||||
dest[1] = hsl.s;
|
||||
dest[2] = hsl.l;
|
||||
for (gint i = 0; i < 3; i++)
|
||||
dest[i] = hsl[i];
|
||||
dest[3] = src[3];
|
||||
|
||||
src += 4;
|
||||
|
@ -640,12 +640,11 @@ rgb_to_hsl (GimpDrawable *drawable,
|
||||
LICEffectChannel effect_channel)
|
||||
{
|
||||
GeglBuffer *buffer;
|
||||
guchar *themap, data[4];
|
||||
guchar *themap;
|
||||
gfloat data[3];
|
||||
gint x, y;
|
||||
gint height_max;
|
||||
gint width_max;
|
||||
GimpRGB color;
|
||||
GimpHSL color_hsl;
|
||||
gdouble val = 0.0;
|
||||
gint64 maxc, index = 0;
|
||||
GRand *gr;
|
||||
@ -665,25 +664,20 @@ rgb_to_hsl (GimpDrawable *drawable,
|
||||
{
|
||||
for (x = 0; x < width_max; x++)
|
||||
{
|
||||
data[3] = 255;
|
||||
|
||||
gegl_buffer_sample (buffer, x, y, NULL,
|
||||
data, babl_format ("R'G'B'A u8"),
|
||||
data, babl_format ("HSL float"),
|
||||
GEGL_SAMPLER_NEAREST, GEGL_ABYSS_NONE);
|
||||
|
||||
gimp_rgba_set_uchar (&color, data[0], data[1], data[2], data[3]);
|
||||
gimp_rgb_to_hsl (&color, &color_hsl);
|
||||
|
||||
switch (effect_channel)
|
||||
{
|
||||
case LIC_HUE:
|
||||
val = color_hsl.h * 255;
|
||||
val = data[0] * 255;
|
||||
break;
|
||||
case LIC_SATURATION:
|
||||
val = color_hsl.s * 255;
|
||||
val = data[1] * 255;
|
||||
break;
|
||||
case LIC_BRIGHTNESS:
|
||||
val = color_hsl.l * 255;
|
||||
val = data[2] * 255;
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user