app: remove "gboolean linear" from gimp_get_layer_mode_function()
and get rid of the two process_pixels() functions in the LCH modes, they always take linear now.
This commit is contained in:
@ -78,8 +78,7 @@
|
|||||||
|
|
||||||
|
|
||||||
GimpLayerModeFunc
|
GimpLayerModeFunc
|
||||||
gimp_get_layer_mode_function (GimpLayerMode paint_mode,
|
gimp_get_layer_mode_function (GimpLayerMode paint_mode)
|
||||||
gboolean linear_mode)
|
|
||||||
{
|
{
|
||||||
GimpLayerModeFunc func;
|
GimpLayerModeFunc func;
|
||||||
|
|
||||||
@ -267,27 +266,19 @@ gimp_get_layer_mode_function (GimpLayerMode paint_mode,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_LAYER_MODE_LCH_HUE:
|
case GIMP_LAYER_MODE_LCH_HUE:
|
||||||
func = linear_mode ?
|
func = gimp_operation_lch_hue_process_pixels;
|
||||||
gimp_operation_lch_hue_process_pixels_linear :
|
|
||||||
gimp_operation_lch_hue_process_pixels;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_LAYER_MODE_LCH_CHROMA:
|
case GIMP_LAYER_MODE_LCH_CHROMA:
|
||||||
func = linear_mode ?
|
func = gimp_operation_lch_chroma_process_pixels;
|
||||||
gimp_operation_lch_chroma_process_pixels_linear :
|
|
||||||
gimp_operation_lch_chroma_process_pixels;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_LAYER_MODE_LCH_COLOR:
|
case GIMP_LAYER_MODE_LCH_COLOR:
|
||||||
func = linear_mode ?
|
func = gimp_operation_lch_color_process_pixels;
|
||||||
gimp_operation_lch_color_process_pixels_linear :
|
|
||||||
gimp_operation_lch_color_process_pixels;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_LAYER_MODE_LCH_LIGHTNESS:
|
case GIMP_LAYER_MODE_LCH_LIGHTNESS:
|
||||||
func = linear_mode ?
|
func = gimp_operation_lch_lightness_process_pixels;
|
||||||
gimp_operation_lch_lightness_process_pixels_linear :
|
|
||||||
gimp_operation_lch_lightness_process_pixels;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_LAYER_MODE_ERASE:
|
case GIMP_LAYER_MODE_ERASE:
|
||||||
|
@ -22,8 +22,7 @@
|
|||||||
#define __GIMP_LAYER_MODE_FUNCTIONS_H__
|
#define __GIMP_LAYER_MODE_FUNCTIONS_H__
|
||||||
|
|
||||||
|
|
||||||
GimpLayerModeFunc gimp_get_layer_mode_function (GimpLayerMode paint_mode,
|
GimpLayerModeFunc gimp_get_layer_mode_function (GimpLayerMode paint_mode);
|
||||||
gboolean linear_mode);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_LAYER_MODE_FUNCTIONS_H__ */
|
#endif /* __GIMP_LAYER_MODE_FUNCTIONS_H__ */
|
||||||
|
@ -81,58 +81,17 @@ gimp_operation_lch_chroma_process (GeglOperation *operation,
|
|||||||
const GeglRectangle *roi,
|
const GeglRectangle *roi,
|
||||||
gint level)
|
gint level)
|
||||||
{
|
{
|
||||||
GimpOperationPointLayerMode *gimp_op = GIMP_OPERATION_POINT_LAYER_MODE (operation);
|
GimpOperationPointLayerMode *layer_mode = (gpointer) operation;
|
||||||
gfloat opacity = gimp_op->opacity;
|
|
||||||
gboolean linear = gimp_op->linear;
|
|
||||||
|
|
||||||
return (linear ? gimp_operation_lch_chroma_process_pixels_linear :
|
return gimp_operation_lch_chroma_process_pixels (in_buf, aux_buf, aux2_buf,
|
||||||
gimp_operation_lch_chroma_process_pixels)
|
out_buf,
|
||||||
(in_buf, aux_buf, aux2_buf,
|
layer_mode->opacity,
|
||||||
out_buf,
|
samples, roi, level,
|
||||||
opacity,
|
layer_mode->blend_trc,
|
||||||
samples, roi, level,
|
layer_mode->composite_trc,
|
||||||
gimp_op->blend_trc,
|
layer_mode->composite_mode);
|
||||||
gimp_op->composite_trc,
|
|
||||||
gimp_op->composite_mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
chroma_pre_process (const Babl *from_fish,
|
|
||||||
const Babl *to_fish,
|
|
||||||
const gfloat *in,
|
|
||||||
const gfloat *layer,
|
|
||||||
gfloat *out,
|
|
||||||
glong samples)
|
|
||||||
{
|
|
||||||
gfloat tmp[4 * samples], *layer_lab = tmp;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
babl_process (from_fish, in, out, samples);
|
|
||||||
babl_process (from_fish, layer, layer_lab, samples);
|
|
||||||
|
|
||||||
for (i = 0; i < samples; ++i)
|
|
||||||
{
|
|
||||||
gfloat A1 = out[4 * i + 1];
|
|
||||||
gfloat B1 = out[4 * i + 2];
|
|
||||||
gfloat c1 = hypotf (A1, B1);
|
|
||||||
|
|
||||||
if (c1 != 0)
|
|
||||||
{
|
|
||||||
gfloat A2 = layer_lab[4 * i + 1];
|
|
||||||
gfloat B2 = layer_lab[4 * i + 2];
|
|
||||||
gfloat c2 = hypotf (A2, B2);
|
|
||||||
gfloat A = c2 * A1 / c1;
|
|
||||||
gfloat B = c2 * B1 / c1;
|
|
||||||
|
|
||||||
out[4 * i + 1] = A;
|
|
||||||
out[4 * i + 2] = B;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
babl_process (to_fish, out, out, samples);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX: this and pre_process should be removed */
|
|
||||||
gboolean
|
gboolean
|
||||||
gimp_operation_lch_chroma_process_pixels (gfloat *in,
|
gimp_operation_lch_chroma_process_pixels (gfloat *in,
|
||||||
gfloat *layer,
|
gfloat *layer,
|
||||||
@ -145,33 +104,6 @@ gimp_operation_lch_chroma_process_pixels (gfloat *in,
|
|||||||
GimpLayerBlendTRC blend_trc,
|
GimpLayerBlendTRC blend_trc,
|
||||||
GimpLayerBlendTRC composite_trc,
|
GimpLayerBlendTRC composite_trc,
|
||||||
GimpLayerCompositeMode composite_mode)
|
GimpLayerCompositeMode composite_mode)
|
||||||
{
|
|
||||||
static const Babl *from_fish = NULL;
|
|
||||||
static const Babl *to_fish = NULL;
|
|
||||||
|
|
||||||
if (!from_fish)
|
|
||||||
from_fish = babl_fish ("R'G'B'A float", "CIE Lab alpha float");
|
|
||||||
if (!to_fish)
|
|
||||||
to_fish = babl_fish ("CIE Lab alpha float", "R'G'B'A float");
|
|
||||||
|
|
||||||
chroma_pre_process (from_fish, to_fish, in, layer, out, samples);
|
|
||||||
compfun_src_atop (in, layer, mask, opacity, out, samples);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gimp_operation_lch_chroma_process_pixels_linear (gfloat *in,
|
|
||||||
gfloat *layer,
|
|
||||||
gfloat *mask,
|
|
||||||
gfloat *out,
|
|
||||||
gfloat opacity,
|
|
||||||
glong samples,
|
|
||||||
const GeglRectangle *roi,
|
|
||||||
gint level,
|
|
||||||
GimpLayerBlendTRC blend_trc,
|
|
||||||
GimpLayerBlendTRC composite_trc,
|
|
||||||
GimpLayerCompositeMode composite_mode)
|
|
||||||
{
|
{
|
||||||
gimp_composite_blend (in, layer, mask, out, opacity, samples,
|
gimp_composite_blend (in, layer, mask, out, opacity, samples,
|
||||||
blend_trc, composite_trc, composite_mode,
|
blend_trc, composite_trc, composite_mode,
|
||||||
|
@ -49,31 +49,19 @@ struct _GimpOperationLchChromaClass
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gimp_operation_lch_chroma_get_type (void) G_GNUC_CONST;
|
GType gimp_operation_lch_chroma_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
gboolean gimp_operation_lch_chroma_process_pixels_linear (gfloat *in,
|
gboolean gimp_operation_lch_chroma_process_pixels (gfloat *in,
|
||||||
gfloat *layer,
|
gfloat *layer,
|
||||||
gfloat *mask,
|
gfloat *mask,
|
||||||
gfloat *out,
|
gfloat *out,
|
||||||
gfloat opacity,
|
gfloat opacity,
|
||||||
glong samples,
|
glong samples,
|
||||||
const GeglRectangle *roi,
|
const GeglRectangle *roi,
|
||||||
gint level,
|
gint level,
|
||||||
GimpLayerBlendTRC blend_trc,
|
GimpLayerBlendTRC blend_trc,
|
||||||
GimpLayerBlendTRC composite_trc,
|
GimpLayerBlendTRC composite_trc,
|
||||||
GimpLayerCompositeMode composite_mode);
|
GimpLayerCompositeMode composite_mode);
|
||||||
|
|
||||||
gboolean gimp_operation_lch_chroma_process_pixels (gfloat *in,
|
|
||||||
gfloat *layer,
|
|
||||||
gfloat *mask,
|
|
||||||
gfloat *out,
|
|
||||||
gfloat opacity,
|
|
||||||
glong samples,
|
|
||||||
const GeglRectangle *roi,
|
|
||||||
gint level,
|
|
||||||
GimpLayerBlendTRC blend_trc,
|
|
||||||
GimpLayerBlendTRC composite_trc,
|
|
||||||
GimpLayerCompositeMode composite_mode);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_OPERATION_LCH_CHROMA_H__ */
|
#endif /* __GIMP_OPERATION_LCH_CHROMA_H__ */
|
||||||
|
@ -81,46 +81,17 @@ gimp_operation_lch_color_process (GeglOperation *operation,
|
|||||||
const GeglRectangle *roi,
|
const GeglRectangle *roi,
|
||||||
gint level)
|
gint level)
|
||||||
{
|
{
|
||||||
GimpOperationPointLayerMode *gimp_op = GIMP_OPERATION_POINT_LAYER_MODE (operation);
|
GimpOperationPointLayerMode *layer_mode = (gpointer) operation;
|
||||||
|
|
||||||
return (gimp_op->linear ? gimp_operation_lch_color_process_pixels_linear :
|
return gimp_operation_lch_color_process_pixels (in_buf, aux_buf, aux2_buf,
|
||||||
gimp_operation_lch_color_process_pixels)
|
out_buf,
|
||||||
(in_buf, aux_buf, aux2_buf,
|
layer_mode->opacity,
|
||||||
out_buf,
|
samples, roi, level,
|
||||||
gimp_op->opacity,
|
layer_mode->blend_trc,
|
||||||
samples, roi, level,
|
layer_mode->composite_trc,
|
||||||
gimp_op->blend_trc,
|
layer_mode->composite_mode);
|
||||||
gimp_op->composite_trc,
|
|
||||||
gimp_op->composite_mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
color_pre_process (const Babl *from_fish_la,
|
|
||||||
const Babl *from_fish_laba,
|
|
||||||
const Babl *to_fish,
|
|
||||||
const gfloat *in,
|
|
||||||
const gfloat *layer,
|
|
||||||
gfloat *out,
|
|
||||||
glong samples)
|
|
||||||
{
|
|
||||||
gfloat tmp[4 * samples], *layer_lab = tmp;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
babl_process (from_fish_la, in, &out[2 * samples], samples);
|
|
||||||
babl_process (from_fish_laba, layer, layer_lab, samples);
|
|
||||||
|
|
||||||
for (i = 0; i < samples; ++i)
|
|
||||||
{
|
|
||||||
out[4 * i + 0] = out[2 * samples + 2 * i + 0];
|
|
||||||
out[4 * i + 1] = layer_lab[4 * i + 1];
|
|
||||||
out[4 * i + 2] = layer_lab[4 * i + 2];
|
|
||||||
out[4 * i + 3] = out[2 * samples + 2 * i + 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
babl_process (to_fish, out, out, samples);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX: should be removed along with the pre_process fun */
|
|
||||||
gboolean
|
gboolean
|
||||||
gimp_operation_lch_color_process_pixels (gfloat *in,
|
gimp_operation_lch_color_process_pixels (gfloat *in,
|
||||||
gfloat *layer,
|
gfloat *layer,
|
||||||
@ -133,37 +104,6 @@ gimp_operation_lch_color_process_pixels (gfloat *in,
|
|||||||
GimpLayerBlendTRC blend_trc,
|
GimpLayerBlendTRC blend_trc,
|
||||||
GimpLayerBlendTRC composite_trc,
|
GimpLayerBlendTRC composite_trc,
|
||||||
GimpLayerCompositeMode composite_mode)
|
GimpLayerCompositeMode composite_mode)
|
||||||
{
|
|
||||||
static const Babl *from_fish_laba = NULL;
|
|
||||||
static const Babl *from_fish_la = NULL;
|
|
||||||
static const Babl *to_fish = NULL;
|
|
||||||
|
|
||||||
if (!from_fish_laba)
|
|
||||||
from_fish_laba = babl_fish ("R'G'B'A float", "CIE Lab alpha float");
|
|
||||||
if (!from_fish_la)
|
|
||||||
from_fish_la = babl_fish ("R'G'B'A float", "CIE L alpha float");
|
|
||||||
if (!to_fish)
|
|
||||||
to_fish = babl_fish ("CIE Lab alpha float", "R'G'B'A float");
|
|
||||||
|
|
||||||
color_pre_process (from_fish_la, from_fish_laba, to_fish, in, layer, out, samples);
|
|
||||||
compfun_src_atop (in, layer, mask, opacity, out, samples);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gimp_operation_lch_color_process_pixels_linear (gfloat *in,
|
|
||||||
gfloat *layer,
|
|
||||||
gfloat *mask,
|
|
||||||
gfloat *out,
|
|
||||||
gfloat opacity,
|
|
||||||
glong samples,
|
|
||||||
const GeglRectangle *roi,
|
|
||||||
gint level,
|
|
||||||
GimpLayerBlendTRC blend_trc,
|
|
||||||
GimpLayerBlendTRC composite_trc,
|
|
||||||
GimpLayerCompositeMode composite_mode)
|
|
||||||
{
|
{
|
||||||
gimp_composite_blend (in, layer, mask, out, opacity, samples,
|
gimp_composite_blend (in, layer, mask, out, opacity, samples,
|
||||||
blend_trc, composite_trc, composite_mode,
|
blend_trc, composite_trc, composite_mode,
|
||||||
|
@ -49,31 +49,19 @@ struct _GimpOperationLchColorClass
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gimp_operation_lch_color_get_type (void) G_GNUC_CONST;
|
GType gimp_operation_lch_color_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
gboolean gimp_operation_lch_color_process_pixels_linear (gfloat *in,
|
gboolean gimp_operation_lch_color_process_pixels (gfloat *in,
|
||||||
gfloat *layer,
|
gfloat *layer,
|
||||||
gfloat *mask,
|
gfloat *mask,
|
||||||
gfloat *out,
|
gfloat *out,
|
||||||
gfloat opacity,
|
gfloat opacity,
|
||||||
glong samples,
|
glong samples,
|
||||||
const GeglRectangle *roi,
|
const GeglRectangle *roi,
|
||||||
gint level,
|
gint level,
|
||||||
GimpLayerBlendTRC blend_trc,
|
GimpLayerBlendTRC blend_trc,
|
||||||
GimpLayerBlendTRC composite_trc,
|
GimpLayerBlendTRC composite_trc,
|
||||||
GimpLayerCompositeMode composite_mode);
|
GimpLayerCompositeMode composite_mode);
|
||||||
|
|
||||||
gboolean gimp_operation_lch_color_process_pixels (gfloat *in,
|
|
||||||
gfloat *layer,
|
|
||||||
gfloat *mask,
|
|
||||||
gfloat *out,
|
|
||||||
gfloat opacity,
|
|
||||||
glong samples,
|
|
||||||
const GeglRectangle *roi,
|
|
||||||
gint level,
|
|
||||||
GimpLayerBlendTRC blend_trc,
|
|
||||||
GimpLayerBlendTRC composite_trc,
|
|
||||||
GimpLayerCompositeMode composite_mode);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_OPERATION_LCH_COLOR_H__ */
|
#endif /* __GIMP_OPERATION_LCH_COLOR_H__ */
|
||||||
|
@ -81,56 +81,17 @@ gimp_operation_lch_hue_process (GeglOperation *operation,
|
|||||||
const GeglRectangle *roi,
|
const GeglRectangle *roi,
|
||||||
gint level)
|
gint level)
|
||||||
{
|
{
|
||||||
GimpOperationPointLayerMode *layer_mode = (GimpOperationPointLayerMode*)operation;
|
GimpOperationPointLayerMode *layer_mode = (gpointer) operation;
|
||||||
|
|
||||||
return (layer_mode->linear ? gimp_operation_lch_hue_process_pixels_linear :
|
return gimp_operation_lch_hue_process_pixels (in_buf, aux_buf, aux2_buf,
|
||||||
gimp_operation_lch_hue_process_pixels)
|
out_buf,
|
||||||
(in_buf, aux_buf, aux2_buf,
|
layer_mode->opacity,
|
||||||
out_buf,
|
samples, roi, level,
|
||||||
layer_mode->opacity,
|
layer_mode->blend_trc,
|
||||||
samples, roi, level,
|
layer_mode->composite_trc,
|
||||||
layer_mode->blend_trc,
|
layer_mode->composite_mode);
|
||||||
layer_mode->composite_trc,
|
|
||||||
layer_mode->composite_mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
hue_pre_process (const Babl *from_fish,
|
|
||||||
const Babl *to_fish,
|
|
||||||
const gfloat *in,
|
|
||||||
const gfloat *layer,
|
|
||||||
gfloat *out,
|
|
||||||
glong samples)
|
|
||||||
{
|
|
||||||
gint i;
|
|
||||||
gfloat tmp[4 * samples], *layer_lab = tmp;
|
|
||||||
|
|
||||||
babl_process (from_fish, in, out, samples);
|
|
||||||
babl_process (from_fish, layer, layer_lab, samples);
|
|
||||||
|
|
||||||
for (i = 0; i < samples; ++i)
|
|
||||||
{
|
|
||||||
gfloat A2 = layer_lab[4 * i + 1];
|
|
||||||
gfloat B2 = layer_lab[4 * i + 2];
|
|
||||||
gfloat c2 = hypotf (A2, B2);
|
|
||||||
|
|
||||||
if (c2 > 0.1f)
|
|
||||||
{
|
|
||||||
gfloat A1 = out[4 * i + 1];
|
|
||||||
gfloat B1 = out[4 * i + 2];
|
|
||||||
gfloat c1 = hypotf (A1, B1);
|
|
||||||
gfloat A = c1 * A2 / c2;
|
|
||||||
gfloat B = c1 * B2 / c2;
|
|
||||||
|
|
||||||
out[4 * i + 1] = A;
|
|
||||||
out[4 * i + 2] = B;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
babl_process (to_fish, out, out, samples);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX: this should be removed along with _pre_process */
|
|
||||||
gboolean
|
gboolean
|
||||||
gimp_operation_lch_hue_process_pixels (gfloat *in,
|
gimp_operation_lch_hue_process_pixels (gfloat *in,
|
||||||
gfloat *layer,
|
gfloat *layer,
|
||||||
@ -143,34 +104,6 @@ gimp_operation_lch_hue_process_pixels (gfloat *in,
|
|||||||
GimpLayerBlendTRC blend_trc,
|
GimpLayerBlendTRC blend_trc,
|
||||||
GimpLayerBlendTRC composite_trc,
|
GimpLayerBlendTRC composite_trc,
|
||||||
GimpLayerCompositeMode composite_mode)
|
GimpLayerCompositeMode composite_mode)
|
||||||
{
|
|
||||||
static const Babl *from_fish = NULL;
|
|
||||||
static const Babl *to_fish = NULL;
|
|
||||||
|
|
||||||
if (!from_fish)
|
|
||||||
from_fish = babl_fish ("R'G'B'A float", "CIE Lab alpha float");
|
|
||||||
if (!to_fish)
|
|
||||||
to_fish = babl_fish ("CIE Lab alpha float", "R'G'B'A float");
|
|
||||||
|
|
||||||
hue_pre_process (from_fish, to_fish, in, layer, out, samples);
|
|
||||||
compfun_src_atop (in, layer, mask, opacity, out, samples);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gimp_operation_lch_hue_process_pixels_linear (gfloat *in,
|
|
||||||
gfloat *layer,
|
|
||||||
gfloat *mask,
|
|
||||||
gfloat *out,
|
|
||||||
gfloat opacity,
|
|
||||||
glong samples,
|
|
||||||
const GeglRectangle *roi,
|
|
||||||
gint level,
|
|
||||||
GimpLayerBlendTRC blend_trc,
|
|
||||||
GimpLayerBlendTRC composite_trc,
|
|
||||||
GimpLayerCompositeMode composite_mode)
|
|
||||||
{
|
{
|
||||||
gimp_composite_blend (in, layer, mask, out, opacity, samples,
|
gimp_composite_blend (in, layer, mask, out, opacity, samples,
|
||||||
blend_trc, composite_trc, composite_mode,
|
blend_trc, composite_trc, composite_mode,
|
||||||
|
@ -49,30 +49,18 @@ struct _GimpOperationLchHueClass
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gimp_operation_lch_hue_get_type (void) G_GNUC_CONST;
|
GType gimp_operation_lch_hue_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
gboolean gimp_operation_lch_hue_process_pixels_linear (gfloat *in,
|
gboolean gimp_operation_lch_hue_process_pixels (gfloat *in,
|
||||||
gfloat *layer,
|
gfloat *layer,
|
||||||
gfloat *mask,
|
gfloat *mask,
|
||||||
gfloat *out,
|
gfloat *out,
|
||||||
gfloat opacity,
|
gfloat opacity,
|
||||||
glong samples,
|
glong samples,
|
||||||
const GeglRectangle *roi,
|
const GeglRectangle *roi,
|
||||||
gint level,
|
gint level,
|
||||||
GimpLayerBlendTRC blend_trc,
|
GimpLayerBlendTRC blend_trc,
|
||||||
GimpLayerBlendTRC composite_trc,
|
GimpLayerBlendTRC composite_trc,
|
||||||
GimpLayerCompositeMode composite_mode);
|
GimpLayerCompositeMode composite_mode);
|
||||||
|
|
||||||
gboolean gimp_operation_lch_hue_process_pixels (gfloat *in,
|
|
||||||
gfloat *layer,
|
|
||||||
gfloat *mask,
|
|
||||||
gfloat *out,
|
|
||||||
gfloat opacity,
|
|
||||||
glong samples,
|
|
||||||
const GeglRectangle *roi,
|
|
||||||
gint level,
|
|
||||||
GimpLayerBlendTRC blend_trc,
|
|
||||||
GimpLayerBlendTRC composite_trc,
|
|
||||||
GimpLayerCompositeMode composite_mode);
|
|
||||||
|
|
||||||
#endif /* __GIMP_OPERATION_LCH_HUE_H__ */
|
#endif /* __GIMP_OPERATION_LCH_HUE_H__ */
|
||||||
|
@ -81,39 +81,17 @@ gimp_operation_lch_lightness_process (GeglOperation *operation,
|
|||||||
const GeglRectangle *roi,
|
const GeglRectangle *roi,
|
||||||
gint level)
|
gint level)
|
||||||
{
|
{
|
||||||
GimpOperationPointLayerMode *layer_mode = (GimpOperationPointLayerMode*)operation;
|
GimpOperationPointLayerMode *layer_mode = (gpointer) operation;
|
||||||
return (layer_mode->linear ? gimp_operation_lch_lightness_process_pixels_linear : gimp_operation_lch_lightness_process_pixels)
|
|
||||||
(in_buf, aux_buf, aux2_buf,
|
return gimp_operation_lch_lightness_process_pixels (in_buf, aux_buf, aux2_buf,
|
||||||
out_buf,
|
out_buf,
|
||||||
layer_mode->opacity,
|
layer_mode->opacity,
|
||||||
samples, roi, level,
|
samples, roi, level,
|
||||||
layer_mode->blend_trc,
|
layer_mode->blend_trc,
|
||||||
layer_mode->composite_trc,
|
layer_mode->composite_trc,
|
||||||
layer_mode->composite_mode);
|
layer_mode->composite_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
lightness_pre_process (const Babl *from_fish_la,
|
|
||||||
const Babl *from_fish_laba,
|
|
||||||
const Babl *to_fish,
|
|
||||||
const gfloat *in,
|
|
||||||
const gfloat *layer,
|
|
||||||
gfloat *out,
|
|
||||||
glong samples)
|
|
||||||
{
|
|
||||||
gfloat lightness_alpha[samples * 2];
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
babl_process (from_fish_laba, in, out, samples);
|
|
||||||
babl_process (from_fish_la, layer, lightness_alpha, samples);
|
|
||||||
|
|
||||||
for (i = 0; i < samples; ++i)
|
|
||||||
out[4 * i] = lightness_alpha[2 * i];
|
|
||||||
|
|
||||||
babl_process (to_fish, out, out, samples);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX: this should be remove along with _pre_process */
|
|
||||||
gboolean
|
gboolean
|
||||||
gimp_operation_lch_lightness_process_pixels (gfloat *in,
|
gimp_operation_lch_lightness_process_pixels (gfloat *in,
|
||||||
gfloat *layer,
|
gfloat *layer,
|
||||||
@ -126,38 +104,6 @@ gimp_operation_lch_lightness_process_pixels (gfloat *in,
|
|||||||
GimpLayerBlendTRC blend_trc,
|
GimpLayerBlendTRC blend_trc,
|
||||||
GimpLayerBlendTRC composite_trc,
|
GimpLayerBlendTRC composite_trc,
|
||||||
GimpLayerCompositeMode composite_mode)
|
GimpLayerCompositeMode composite_mode)
|
||||||
{
|
|
||||||
static const Babl *from_fish_laba = NULL;
|
|
||||||
static const Babl *from_fish_la = NULL;
|
|
||||||
static const Babl *to_fish = NULL;
|
|
||||||
|
|
||||||
if (!from_fish_laba)
|
|
||||||
from_fish_laba = babl_fish ("R'G'B'A float", "CIE Lab alpha float");
|
|
||||||
if (!from_fish_la)
|
|
||||||
from_fish_la = babl_fish ("R'G'B'A float", "CIE L alpha float");
|
|
||||||
if (!to_fish)
|
|
||||||
to_fish = babl_fish ("CIE Lab alpha float", "R'G'B'A float");
|
|
||||||
|
|
||||||
|
|
||||||
lightness_pre_process (from_fish_la, from_fish_laba, to_fish, in, layer, out, samples);
|
|
||||||
compfun_src_atop (in, layer, mask, opacity, out, samples);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gimp_operation_lch_lightness_process_pixels_linear (gfloat *in,
|
|
||||||
gfloat *layer,
|
|
||||||
gfloat *mask,
|
|
||||||
gfloat *out,
|
|
||||||
gfloat opacity,
|
|
||||||
glong samples,
|
|
||||||
const GeglRectangle *roi,
|
|
||||||
gint level,
|
|
||||||
GimpLayerBlendTRC blend_trc,
|
|
||||||
GimpLayerBlendTRC composite_trc,
|
|
||||||
GimpLayerCompositeMode composite_mode)
|
|
||||||
{
|
{
|
||||||
gimp_composite_blend (in, layer, mask, out, opacity, samples,
|
gimp_composite_blend (in, layer, mask, out, opacity, samples,
|
||||||
blend_trc, composite_trc, composite_mode,
|
blend_trc, composite_trc, composite_mode,
|
||||||
|
@ -49,31 +49,19 @@ struct _GimpOperationLchLightnessClass
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gimp_operation_lch_lightness_get_type (void) G_GNUC_CONST;
|
GType gimp_operation_lch_lightness_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
gboolean gimp_operation_lch_lightness_process_pixels_linear (gfloat *in,
|
gboolean gimp_operation_lch_lightness_process_pixels (gfloat *in,
|
||||||
gfloat *layer,
|
gfloat *layer,
|
||||||
gfloat *mask,
|
gfloat *mask,
|
||||||
gfloat *out,
|
gfloat *out,
|
||||||
gfloat opacity,
|
gfloat opacity,
|
||||||
glong samples,
|
glong samples,
|
||||||
const GeglRectangle *roi,
|
const GeglRectangle *roi,
|
||||||
gint level,
|
gint level,
|
||||||
GimpLayerBlendTRC blend_trc,
|
GimpLayerBlendTRC blend_trc,
|
||||||
GimpLayerBlendTRC composite_trc,
|
GimpLayerBlendTRC composite_trc,
|
||||||
GimpLayerCompositeMode composite_mode);
|
GimpLayerCompositeMode composite_mode);
|
||||||
|
|
||||||
gboolean gimp_operation_lch_lightness_process_pixels (gfloat *in,
|
|
||||||
gfloat *layer,
|
|
||||||
gfloat *mask,
|
|
||||||
gfloat *out,
|
|
||||||
gfloat opacity,
|
|
||||||
glong samples,
|
|
||||||
const GeglRectangle *roi,
|
|
||||||
gint level,
|
|
||||||
GimpLayerBlendTRC blend_trc,
|
|
||||||
GimpLayerBlendTRC composite_trc,
|
|
||||||
GimpLayerCompositeMode composite_mode);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_OPERATION_LCH_LIGHTNESS_H__ */
|
#endif /* __GIMP_OPERATION_LCH_LIGHTNESS_H__ */
|
||||||
|
@ -308,8 +308,7 @@ do_layer_blend (GeglBuffer *src_buffer,
|
|||||||
|
|
||||||
const guint paint_stride = gimp_temp_buf_get_width (paint_buf);
|
const guint paint_stride = gimp_temp_buf_get_width (paint_buf);
|
||||||
gfloat *paint_data = (gfloat *) gimp_temp_buf_get_data (paint_buf);
|
gfloat *paint_data = (gfloat *) gimp_temp_buf_get_data (paint_buf);
|
||||||
GimpLayerModeFunc apply_func = gimp_get_layer_mode_function (paint_mode,
|
GimpLayerModeFunc apply_func = gimp_get_layer_mode_function (paint_mode);
|
||||||
linear_mode);
|
|
||||||
|
|
||||||
if (linear_mode)
|
if (linear_mode)
|
||||||
iterator_format = babl_format ("RGBA float");
|
iterator_format = babl_format ("RGBA float");
|
||||||
|
Reference in New Issue
Block a user