Commit 05896b4e authored by Michael Natterer's avatar Michael Natterer 😴

libgimpbase: rename and reorder the values of enum GimpSelectCriterion

parent 0141a284
Pipeline #131993 passed with stages
in 34 minutes and 47 seconds
......@@ -352,6 +352,7 @@ gimp_pickable_contiguous_region_by_line_art (GimpPickable *pickable,
FALSE, GIMP_SELECT_CRITERION_COMPOSITE,
FALSE, 0.0, FALSE,
x - 1, y - 1, &col);
if (x - 1 >= extent.x && x - 1 < extent.x + extent.width &&
y >= extent.y && y < (extent.y + extent.height))
find_contiguous_region (src_buffer, mask_buffer,
......@@ -359,6 +360,7 @@ gimp_pickable_contiguous_region_by_line_art (GimpPickable *pickable,
FALSE, GIMP_SELECT_CRITERION_COMPOSITE,
FALSE, 0.0, FALSE,
x - 1, y, &col);
if (x - 1 >= extent.x && x - 1 < extent.x + extent.width &&
y + 1 >= extent.y && y + 1 < (extent.y + extent.height))
find_contiguous_region (src_buffer, mask_buffer,
......@@ -366,6 +368,7 @@ gimp_pickable_contiguous_region_by_line_art (GimpPickable *pickable,
FALSE, GIMP_SELECT_CRITERION_COMPOSITE,
FALSE, 0.0, FALSE,
x - 1, y + 1, &col);
if (x >= extent.x && x < extent.x + extent.width &&
y - 1 >= extent.y && y - 1 < (extent.y + extent.height))
find_contiguous_region (src_buffer, mask_buffer,
......@@ -373,6 +376,7 @@ gimp_pickable_contiguous_region_by_line_art (GimpPickable *pickable,
FALSE, GIMP_SELECT_CRITERION_COMPOSITE,
FALSE, 0.0, FALSE,
x, y - 1, &col);
if (x >= extent.x && x < extent.x + extent.width &&
y + 1 >= extent.y && y + 1 < (extent.y + extent.height))
find_contiguous_region (src_buffer, mask_buffer,
......@@ -380,6 +384,7 @@ gimp_pickable_contiguous_region_by_line_art (GimpPickable *pickable,
FALSE, GIMP_SELECT_CRITERION_COMPOSITE,
FALSE, 0.0, FALSE,
x, y + 1, &col);
if (x + 1 >= extent.x && x + 1 < extent.x + extent.width &&
y - 1 >= extent.y && y - 1 < (extent.y + extent.height))
find_contiguous_region (src_buffer, mask_buffer,
......@@ -387,6 +392,7 @@ gimp_pickable_contiguous_region_by_line_art (GimpPickable *pickable,
FALSE, GIMP_SELECT_CRITERION_COMPOSITE,
FALSE, 0.0, FALSE,
x + 1, y - 1, &col);
if (x + 1 >= extent.x && x + 1 < extent.x + extent.width &&
y >= extent.y && y < (extent.y + extent.height))
find_contiguous_region (src_buffer, mask_buffer,
......@@ -394,6 +400,7 @@ gimp_pickable_contiguous_region_by_line_art (GimpPickable *pickable,
FALSE, GIMP_SELECT_CRITERION_COMPOSITE,
FALSE, 0.0, FALSE,
x + 1, y, &col);
if (x + 1 >= extent.x && x + 1 < extent.x + extent.width &&
y + 1 >= extent.y && y + 1 < (extent.y + extent.height))
find_contiguous_region (src_buffer, mask_buffer,
......@@ -401,6 +408,7 @@ gimp_pickable_contiguous_region_by_line_art (GimpPickable *pickable,
FALSE, GIMP_SELECT_CRITERION_COMPOSITE,
FALSE, 0.0, FALSE,
x + 1, y + 1, &col);
filled = TRUE;
}
}
......@@ -633,25 +641,25 @@ choose_format (GeglBuffer *buffer,
NULL);
break;
case GIMP_SELECT_CRITERION_R:
case GIMP_SELECT_CRITERION_G:
case GIMP_SELECT_CRITERION_B:
case GIMP_SELECT_CRITERION_A:
case GIMP_SELECT_CRITERION_RGB_RED:
case GIMP_SELECT_CRITERION_RGB_GREEN:
case GIMP_SELECT_CRITERION_RGB_BLUE:
case GIMP_SELECT_CRITERION_ALPHA:
format = babl_format ("R'G'B'A float");
break;
case GIMP_SELECT_CRITERION_H:
case GIMP_SELECT_CRITERION_S:
case GIMP_SELECT_CRITERION_V:
case GIMP_SELECT_CRITERION_HSV_HUE:
case GIMP_SELECT_CRITERION_HSV_SATURATION:
case GIMP_SELECT_CRITERION_HSV_VALUE:
format = babl_format ("HSVA float");
break;
case GIMP_SELECT_CRITERION_LCH_L:
case GIMP_SELECT_CRITERION_LCH_LIGHTNESS:
format = babl_format ("CIE L alpha float");
break;
case GIMP_SELECT_CRITERION_LCH_C:
case GIMP_SELECT_CRITERION_LCH_H:
case GIMP_SELECT_CRITERION_LCH_CHROMA:
case GIMP_SELECT_CRITERION_LCH_HUE:
format = babl_format ("CIE LCH(ab) alpha float");
break;
......@@ -704,23 +712,23 @@ pixel_difference (const gfloat *col1,
}
break;
case GIMP_SELECT_CRITERION_R:
case GIMP_SELECT_CRITERION_RGB_RED:
max = fabs (col1[0] - col2[0]);
break;
case GIMP_SELECT_CRITERION_G:
case GIMP_SELECT_CRITERION_RGB_GREEN:
max = fabs (col1[1] - col2[1]);
break;
case GIMP_SELECT_CRITERION_B:
case GIMP_SELECT_CRITERION_RGB_BLUE:
max = fabs (col1[2] - col2[2]);
break;
case GIMP_SELECT_CRITERION_A:
case GIMP_SELECT_CRITERION_ALPHA:
max = fabs (col1[3] - col2[3]);
break;
case GIMP_SELECT_CRITERION_H:
case GIMP_SELECT_CRITERION_HSV_HUE:
if (col1[1] > EPSILON)
{
if (col2[1] > EPSILON)
......@@ -748,23 +756,23 @@ pixel_difference (const gfloat *col1,
}
break;
case GIMP_SELECT_CRITERION_S:
case GIMP_SELECT_CRITERION_HSV_SATURATION:
max = fabs (col1[1] - col2[1]);
break;
case GIMP_SELECT_CRITERION_V:
case GIMP_SELECT_CRITERION_HSV_VALUE:
max = fabs (col1[2] - col2[2]);
break;
case GIMP_SELECT_CRITERION_LCH_L:
case GIMP_SELECT_CRITERION_LCH_LIGHTNESS:
max = fabs (col1[0] - col2[0]) / 100.0;
break;
case GIMP_SELECT_CRITERION_LCH_C:
case GIMP_SELECT_CRITERION_LCH_CHROMA:
max = fabs (col1[1] - col2[1]) / 100.0;
break;
case GIMP_SELECT_CRITERION_LCH_H:
case GIMP_SELECT_CRITERION_LCH_HUE:
if (col1[1] > 100.0 * EPSILON)
{
if (col2[1] > 100.0 * EPSILON)
......
......@@ -1518,32 +1518,32 @@ gimp_select_criterion_get_type (void)
static const GEnumValue values[] =
{
{ GIMP_SELECT_CRITERION_COMPOSITE, "GIMP_SELECT_CRITERION_COMPOSITE", "composite" },
{ GIMP_SELECT_CRITERION_R, "GIMP_SELECT_CRITERION_R", "r" },
{ GIMP_SELECT_CRITERION_G, "GIMP_SELECT_CRITERION_G", "g" },
{ GIMP_SELECT_CRITERION_B, "GIMP_SELECT_CRITERION_B", "b" },
{ GIMP_SELECT_CRITERION_H, "GIMP_SELECT_CRITERION_H", "h" },
{ GIMP_SELECT_CRITERION_S, "GIMP_SELECT_CRITERION_S", "s" },
{ GIMP_SELECT_CRITERION_V, "GIMP_SELECT_CRITERION_V", "v" },
{ 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" },
{ GIMP_SELECT_CRITERION_RGB_RED, "GIMP_SELECT_CRITERION_RGB_RED", "rgb-red" },
{ GIMP_SELECT_CRITERION_RGB_GREEN, "GIMP_SELECT_CRITERION_RGB_GREEN", "rgb-green" },
{ GIMP_SELECT_CRITERION_RGB_BLUE, "GIMP_SELECT_CRITERION_RGB_BLUE", "rgb-blue" },
{ GIMP_SELECT_CRITERION_HSV_HUE, "GIMP_SELECT_CRITERION_HSV_HUE", "hsv-hue" },
{ GIMP_SELECT_CRITERION_HSV_SATURATION, "GIMP_SELECT_CRITERION_HSV_SATURATION", "hsv-saturation" },
{ GIMP_SELECT_CRITERION_HSV_VALUE, "GIMP_SELECT_CRITERION_HSV_VALUE", "hsv-value" },
{ GIMP_SELECT_CRITERION_LCH_LIGHTNESS, "GIMP_SELECT_CRITERION_LCH_LIGHTNESS", "lch-lightness" },
{ GIMP_SELECT_CRITERION_LCH_CHROMA, "GIMP_SELECT_CRITERION_LCH_CHROMA", "lch-chroma" },
{ GIMP_SELECT_CRITERION_LCH_HUE, "GIMP_SELECT_CRITERION_LCH_HUE", "lch-hue" },
{ GIMP_SELECT_CRITERION_ALPHA, "GIMP_SELECT_CRITERION_ALPHA", "alpha" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_SELECT_CRITERION_COMPOSITE, NC_("select-criterion", "Composite"), NULL },
{ GIMP_SELECT_CRITERION_R, NC_("select-criterion", "Red"), NULL },
{ GIMP_SELECT_CRITERION_G, NC_("select-criterion", "Green"), NULL },
{ GIMP_SELECT_CRITERION_B, NC_("select-criterion", "Blue"), NULL },
{ GIMP_SELECT_CRITERION_H, NC_("select-criterion", "HSV Hue"), NULL },
{ GIMP_SELECT_CRITERION_S, NC_("select-criterion", "HSV Saturation"), NULL },
{ GIMP_SELECT_CRITERION_V, NC_("select-criterion", "HSV Value"), 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 },
{ GIMP_SELECT_CRITERION_RGB_RED, NC_("select-criterion", "Red"), NULL },
{ GIMP_SELECT_CRITERION_RGB_GREEN, NC_("select-criterion", "Green"), NULL },
{ GIMP_SELECT_CRITERION_RGB_BLUE, NC_("select-criterion", "Blue"), NULL },
{ GIMP_SELECT_CRITERION_HSV_HUE, NC_("select-criterion", "HSV Hue"), NULL },
{ GIMP_SELECT_CRITERION_HSV_SATURATION, NC_("select-criterion", "HSV Saturation"), NULL },
{ GIMP_SELECT_CRITERION_HSV_VALUE, NC_("select-criterion", "HSV Value"), NULL },
{ GIMP_SELECT_CRITERION_LCH_LIGHTNESS, NC_("select-criterion", "LCh Lightness"), NULL },
{ GIMP_SELECT_CRITERION_LCH_CHROMA, NC_("select-criterion", "LCh Chroma"), NULL },
{ GIMP_SELECT_CRITERION_LCH_HUE, NC_("select-criterion", "LCh Hue"), NULL },
{ GIMP_SELECT_CRITERION_ALPHA, NC_("select-criterion", "Alpha"), NULL },
{ 0, NULL, NULL }
};
......
......@@ -1029,17 +1029,17 @@ typedef enum
/**
* GimpSelectCriterion:
* @GIMP_SELECT_CRITERION_COMPOSITE: Composite
* @GIMP_SELECT_CRITERION_R: Red
* @GIMP_SELECT_CRITERION_G: Green
* @GIMP_SELECT_CRITERION_B: Blue
* @GIMP_SELECT_CRITERION_H: HSV Hue
* @GIMP_SELECT_CRITERION_S: HSV Saturation
* @GIMP_SELECT_CRITERION_V: HSV Value
* @GIMP_SELECT_CRITERION_A: Alpha
* @GIMP_SELECT_CRITERION_LCH_L: LCh Lightness
* @GIMP_SELECT_CRITERION_LCH_C: LCh Chroma
* @GIMP_SELECT_CRITERION_LCH_H: LCh Hue
* @GIMP_SELECT_CRITERION_COMPOSITE: Composite
* @GIMP_SELECT_CRITERION_RGB_RED: Red
* @GIMP_SELECT_CRITERION_RGB_GREEN: Green
* @GIMP_SELECT_CRITERION_RGB_BLUE: Blue
* @GIMP_SELECT_CRITERION_HSV_HUE: HSV Hue
* @GIMP_SELECT_CRITERION_HSV_SATURATION: HSV Saturation
* @GIMP_SELECT_CRITERION_HSV_VALUE: HSV Value
* @GIMP_SELECT_CRITERION_LCH_LIGHTNESS: LCh Lightness
* @GIMP_SELECT_CRITERION_LCH_CHROMA: LCh Chroma
* @GIMP_SELECT_CRITERION_LCH_HUE: LCh Hue
* @GIMP_SELECT_CRITERION_ALPHA: Alpha
*
* Criterions for color similarity.
**/
......@@ -1049,17 +1049,17 @@ GType gimp_select_criterion_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_SELECT_CRITERION_COMPOSITE, /*< desc="Composite" >*/
GIMP_SELECT_CRITERION_R, /*< desc="Red" >*/
GIMP_SELECT_CRITERION_G, /*< desc="Green" >*/
GIMP_SELECT_CRITERION_B, /*< desc="Blue" >*/
GIMP_SELECT_CRITERION_H, /*< desc="HSV Hue" >*/
GIMP_SELECT_CRITERION_S, /*< desc="HSV Saturation" >*/
GIMP_SELECT_CRITERION_V, /*< desc="HSV Value" >*/
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" >*/
GIMP_SELECT_CRITERION_COMPOSITE, /*< desc="Composite" >*/
GIMP_SELECT_CRITERION_RGB_RED, /*< desc="Red" >*/
GIMP_SELECT_CRITERION_RGB_GREEN, /*< desc="Green" >*/
GIMP_SELECT_CRITERION_RGB_BLUE, /*< desc="Blue" >*/
GIMP_SELECT_CRITERION_HSV_HUE, /*< desc="HSV Hue" >*/
GIMP_SELECT_CRITERION_HSV_SATURATION, /*< desc="HSV Saturation" >*/
GIMP_SELECT_CRITERION_HSV_VALUE, /*< desc="HSV Value" >*/
GIMP_SELECT_CRITERION_LCH_LIGHTNESS, /*< desc="LCh Lightness" >*/
GIMP_SELECT_CRITERION_LCH_CHROMA, /*< desc="LCh Chroma" >*/
GIMP_SELECT_CRITERION_LCH_HUE, /*< desc="LCh Hue" >*/
GIMP_SELECT_CRITERION_ALPHA, /*< desc="Alpha" >*/
} GimpSelectCriterion;
......
......@@ -539,23 +539,6 @@ gimp_prop_enum_combo_box_new (GObject *config,
GIMP_DESATURATE_AVERAGE,
GIMP_DESATURATE_VALUE);
}
else if (param_spec->value_type == GIMP_TYPE_SELECT_CRITERION)
{
/* ditto */
store = gimp_enum_store_new_with_values (param_spec->value_type,
12,
GIMP_SELECT_CRITERION_COMPOSITE,
GIMP_SELECT_CRITERION_R,
GIMP_SELECT_CRITERION_G,
GIMP_SELECT_CRITERION_B,
GIMP_SELECT_CRITERION_A,
GIMP_SELECT_CRITERION_H,
GIMP_SELECT_CRITERION_S,
GIMP_SELECT_CRITERION_V,
GIMP_SELECT_CRITERION_LCH_L,
GIMP_SELECT_CRITERION_LCH_C,
GIMP_SELECT_CRITERION_LCH_H);
}
if (store)
{
......
......@@ -506,24 +506,27 @@ package Gimp::CodeGen::enums;
{ contig => 1,
header => 'libgimpbase/gimpbaseenums.h',
symbols => [ qw(GIMP_SELECT_CRITERION_COMPOSITE
GIMP_SELECT_CRITERION_R GIMP_SELECT_CRITERION_G
GIMP_SELECT_CRITERION_B GIMP_SELECT_CRITERION_H
GIMP_SELECT_CRITERION_S GIMP_SELECT_CRITERION_V
GIMP_SELECT_CRITERION_A
GIMP_SELECT_CRITERION_LCH_L
GIMP_SELECT_CRITERION_LCH_C
GIMP_SELECT_CRITERION_LCH_H) ],
GIMP_SELECT_CRITERION_RGB_RED
GIMP_SELECT_CRITERION_RGB_GREEN
GIMP_SELECT_CRITERION_RGB_BLUE
GIMP_SELECT_CRITERION_HSV_HUE
GIMP_SELECT_CRITERION_HSV_SATURATION
GIMP_SELECT_CRITERION_HSV_VALUE
GIMP_SELECT_CRITERION_LCH_LIGHTNESS
GIMP_SELECT_CRITERION_LCH_CHROMA
GIMP_SELECT_CRITERION_LCH_HUE
GIMP_SELECT_CRITERION_ALPHA) ],
mapping => { GIMP_SELECT_CRITERION_COMPOSITE => '0',
GIMP_SELECT_CRITERION_R => '1',
GIMP_SELECT_CRITERION_G => '2',
GIMP_SELECT_CRITERION_B => '3',
GIMP_SELECT_CRITERION_H => '4',
GIMP_SELECT_CRITERION_S => '5',
GIMP_SELECT_CRITERION_V => '6',
GIMP_SELECT_CRITERION_A => '7',
GIMP_SELECT_CRITERION_LCH_L => '8',
GIMP_SELECT_CRITERION_LCH_C => '9',
GIMP_SELECT_CRITERION_LCH_H => '10' }
GIMP_SELECT_CRITERION_RGB_RED => '1',
GIMP_SELECT_CRITERION_RGB_GREEN => '2',
GIMP_SELECT_CRITERION_RGB_BLUE => '3',
GIMP_SELECT_CRITERION_HSV_HUE => '4',
GIMP_SELECT_CRITERION_HSV_SATURATION => '5',
GIMP_SELECT_CRITERION_HSV_VALUE => '6',
GIMP_SELECT_CRITERION_LCH_LIGHTNESS => '7',
GIMP_SELECT_CRITERION_LCH_CHROMA => '8',
GIMP_SELECT_CRITERION_LCH_HUE => '9',
GIMP_SELECT_CRITERION_ALPHA => '10' }
},
GimpSizeType =>
{ contig => 1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment