mirror of https://github.com/GNOME/gimp.git
app, libgimpbase: allow to select colors by CIE L, C, and H
Add the additional enum values to enum GimpSelectCriterion, and the few needed lines to gimppickable-contiguous-region.c. It's horribly slow, but works.
This commit is contained in:
parent
db4e120b8b
commit
3f420614ff
|
@ -285,6 +285,12 @@ choose_format (GeglBuffer *buffer,
|
||||||
format = babl_format ("HSVA float");
|
format = babl_format ("HSVA float");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GIMP_SELECT_CRITERION_LCH_L:
|
||||||
|
case GIMP_SELECT_CRITERION_LCH_C:
|
||||||
|
case GIMP_SELECT_CRITERION_LCH_H:
|
||||||
|
format = babl_format ("CIE LCH(ab) alpha float");
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_return_val_if_reached (NULL);
|
g_return_val_if_reached (NULL);
|
||||||
break;
|
break;
|
||||||
|
@ -362,6 +368,19 @@ pixel_difference (const gfloat *col1,
|
||||||
case GIMP_SELECT_CRITERION_V:
|
case GIMP_SELECT_CRITERION_V:
|
||||||
max = fabs (col1[2] - col2[2]);
|
max = fabs (col1[2] - col2[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GIMP_SELECT_CRITERION_LCH_L:
|
||||||
|
max = fabs (col1[0] - col2[0]) / 100.0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_SELECT_CRITERION_LCH_C:
|
||||||
|
max = fabs (col1[1] - col2[1]) / 100.0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_SELECT_CRITERION_LCH_H:
|
||||||
|
max = fabs (col1[2] - col2[2]) / 360.0;
|
||||||
|
max = MIN (max, 1.0 - max);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1581,6 +1581,9 @@ gimp_select_criterion_get_type (void)
|
||||||
{ GIMP_SELECT_CRITERION_S, "GIMP_SELECT_CRITERION_S", "s" },
|
{ GIMP_SELECT_CRITERION_S, "GIMP_SELECT_CRITERION_S", "s" },
|
||||||
{ GIMP_SELECT_CRITERION_V, "GIMP_SELECT_CRITERION_V", "v" },
|
{ GIMP_SELECT_CRITERION_V, "GIMP_SELECT_CRITERION_V", "v" },
|
||||||
{ GIMP_SELECT_CRITERION_A, "GIMP_SELECT_CRITERION_A", "a" },
|
{ GIMP_SELECT_CRITERION_A, "GIMP_SELECT_CRITERION_A", "a" },
|
||||||
|
{ GIMP_SELECT_CRITERION_LCH_L, "GIMP_SELECT_CRITERION_LCH_L", "lch-l" },
|
||||||
|
{ GIMP_SELECT_CRITERION_LCH_C, "GIMP_SELECT_CRITERION_LCH_C", "lch-c" },
|
||||||
|
{ GIMP_SELECT_CRITERION_LCH_H, "GIMP_SELECT_CRITERION_LCH_H", "lch-h" },
|
||||||
{ 0, NULL, NULL }
|
{ 0, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1594,6 +1597,9 @@ gimp_select_criterion_get_type (void)
|
||||||
{ GIMP_SELECT_CRITERION_S, NC_("select-criterion", "Saturation"), NULL },
|
{ GIMP_SELECT_CRITERION_S, NC_("select-criterion", "Saturation"), NULL },
|
||||||
{ GIMP_SELECT_CRITERION_V, NC_("select-criterion", "Value"), NULL },
|
{ GIMP_SELECT_CRITERION_V, NC_("select-criterion", "Value"), NULL },
|
||||||
{ GIMP_SELECT_CRITERION_A, NC_("select-criterion", "Alpha"), NULL },
|
{ GIMP_SELECT_CRITERION_A, NC_("select-criterion", "Alpha"), NULL },
|
||||||
|
{ GIMP_SELECT_CRITERION_LCH_L, NC_("select-criterion", "LCH Lightness"), NULL },
|
||||||
|
{ GIMP_SELECT_CRITERION_LCH_C, NC_("select-criterion", "LCH Chroma"), NULL },
|
||||||
|
{ GIMP_SELECT_CRITERION_LCH_H, NC_("select-criterion", "LCH Hue"), NULL },
|
||||||
{ 0, NULL, NULL }
|
{ 0, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -743,7 +743,10 @@ typedef enum
|
||||||
GIMP_SELECT_CRITERION_H, /*< desc="Hue" >*/
|
GIMP_SELECT_CRITERION_H, /*< desc="Hue" >*/
|
||||||
GIMP_SELECT_CRITERION_S, /*< desc="Saturation" >*/
|
GIMP_SELECT_CRITERION_S, /*< desc="Saturation" >*/
|
||||||
GIMP_SELECT_CRITERION_V, /*< desc="Value" >*/
|
GIMP_SELECT_CRITERION_V, /*< desc="Value" >*/
|
||||||
GIMP_SELECT_CRITERION_A /*< desc="Alpha" >*/
|
GIMP_SELECT_CRITERION_A, /*< desc="Alpha" >*/
|
||||||
|
GIMP_SELECT_CRITERION_LCH_L, /*< desc="LCH Lightness" >*/
|
||||||
|
GIMP_SELECT_CRITERION_LCH_C, /*< desc="LCH Chroma" >*/
|
||||||
|
GIMP_SELECT_CRITERION_LCH_H, /*< desc="LCH Hue" >*/
|
||||||
} GimpSelectCriterion;
|
} GimpSelectCriterion;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -522,7 +522,10 @@ package Gimp::CodeGen::enums;
|
||||||
GIMP_SELECT_CRITERION_R GIMP_SELECT_CRITERION_G
|
GIMP_SELECT_CRITERION_R GIMP_SELECT_CRITERION_G
|
||||||
GIMP_SELECT_CRITERION_B GIMP_SELECT_CRITERION_H
|
GIMP_SELECT_CRITERION_B GIMP_SELECT_CRITERION_H
|
||||||
GIMP_SELECT_CRITERION_S GIMP_SELECT_CRITERION_V
|
GIMP_SELECT_CRITERION_S GIMP_SELECT_CRITERION_V
|
||||||
GIMP_SELECT_CRITERION_A) ],
|
GIMP_SELECT_CRITERION_A
|
||||||
|
GIMP_SELECT_CRITERION_LCH_L
|
||||||
|
GIMP_SELECT_CRITERION_LCH_C
|
||||||
|
GIMP_SELECT_CRITERION_LCH_H) ],
|
||||||
mapping => { GIMP_SELECT_CRITERION_COMPOSITE => '0',
|
mapping => { GIMP_SELECT_CRITERION_COMPOSITE => '0',
|
||||||
GIMP_SELECT_CRITERION_R => '1',
|
GIMP_SELECT_CRITERION_R => '1',
|
||||||
GIMP_SELECT_CRITERION_G => '2',
|
GIMP_SELECT_CRITERION_G => '2',
|
||||||
|
@ -530,7 +533,10 @@ package Gimp::CodeGen::enums;
|
||||||
GIMP_SELECT_CRITERION_H => '4',
|
GIMP_SELECT_CRITERION_H => '4',
|
||||||
GIMP_SELECT_CRITERION_S => '5',
|
GIMP_SELECT_CRITERION_S => '5',
|
||||||
GIMP_SELECT_CRITERION_V => '6',
|
GIMP_SELECT_CRITERION_V => '6',
|
||||||
GIMP_SELECT_CRITERION_A => '7' }
|
GIMP_SELECT_CRITERION_A => '7',
|
||||||
|
GIMP_SELECT_CRITERION_LCH_L => '8',
|
||||||
|
GIMP_SELECT_CRITERION_LCH_C => '9',
|
||||||
|
GIMP_SELECT_CRITERION_LCH_H => '10' }
|
||||||
},
|
},
|
||||||
GimpSizeType =>
|
GimpSizeType =>
|
||||||
{ contig => 1,
|
{ contig => 1,
|
||||||
|
|
Loading…
Reference in New Issue