Commit c6563b67 authored by David Gowers's avatar David Gowers Committed by Michael Natterer

Bug 665187 - Fuzzy Select by Alpha

Implement 'Alpha' criterion for selection tools
parent ac1c6d78
......@@ -259,6 +259,7 @@ choose_format (GeglBuffer *buffer,
case GIMP_SELECT_CRITERION_R:
case GIMP_SELECT_CRITERION_G:
case GIMP_SELECT_CRITERION_B:
case GIMP_SELECT_CRITERION_A:
format = babl_format ("R'G'B'A float");
break;
......@@ -329,6 +330,10 @@ pixel_difference (const gfloat *col1,
max = fabs (col1[2] - col2[2]);
break;
case GIMP_SELECT_CRITERION_A:
max = fabs (col1[3] - col2[3]);
break;
case GIMP_SELECT_CRITERION_H:
{
/* wrap around candidates for the actual distance */
......
......@@ -1468,6 +1468,7 @@ gimp_select_criterion_get_type (void)
{ 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" },
{ 0, NULL, NULL }
};
......@@ -1480,6 +1481,7 @@ gimp_select_criterion_get_type (void)
{ GIMP_SELECT_CRITERION_H, NC_("select-criterion", "Hue"), NULL },
{ GIMP_SELECT_CRITERION_S, NC_("select-criterion", "Saturation"), NULL },
{ GIMP_SELECT_CRITERION_V, NC_("select-criterion", "Value"), NULL },
{ GIMP_SELECT_CRITERION_A, NC_("select-criterion", "Alpha"), NULL },
{ 0, NULL, NULL }
};
......
......@@ -667,7 +667,8 @@ typedef enum
GIMP_SELECT_CRITERION_B, /*< desc="Blue" >*/
GIMP_SELECT_CRITERION_H, /*< desc="Hue" >*/
GIMP_SELECT_CRITERION_S, /*< desc="Saturation" >*/
GIMP_SELECT_CRITERION_V /*< desc="Value" >*/
GIMP_SELECT_CRITERION_V, /*< desc="Value" >*/
GIMP_SELECT_CRITERION_A /*< desc="Alpha" >*/
} GimpSelectCriterion;
......
......@@ -482,14 +482,16 @@ package Gimp::CodeGen::enums;
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_S GIMP_SELECT_CRITERION_V
GIMP_SELECT_CRITERION_A) ],
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_V => '6',
GIMP_SELECT_CRITERION_A => '7' }
},
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