mirror of https://github.com/GNOME/gimp.git
app: add new enum GimpLayerModeGroup { LINEAR, PERCEPTUAL, LEGACY }
and a new function gimp_layer_mode_get_group() which will be used for the soon-to-appear GimpLayerModeComboBox.
This commit is contained in:
parent
59471adfee
commit
5dbf9cd4f4
|
@ -461,6 +461,37 @@ gimp_layer_mode_get_type (void)
|
|||
return type;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_layer_mode_group_get_type (void)
|
||||
{
|
||||
static const GEnumValue values[] =
|
||||
{
|
||||
{ GIMP_LAYER_MODE_GROUP_LINEAR, "GIMP_LAYER_MODE_GROUP_LINEAR", "linear" },
|
||||
{ GIMP_LAYER_MODE_GROUP_PERCEPTUAL, "GIMP_LAYER_MODE_GROUP_PERCEPTUAL", "perceptual" },
|
||||
{ GIMP_LAYER_MODE_GROUP_LEGACY, "GIMP_LAYER_MODE_GROUP_LEGACY", "legacy" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static const GimpEnumDesc descs[] =
|
||||
{
|
||||
{ GIMP_LAYER_MODE_GROUP_LINEAR, NC_("layer-mode-group", "Linear light"), NULL },
|
||||
{ GIMP_LAYER_MODE_GROUP_PERCEPTUAL, NC_("layer-mode-group", "Perceptual"), NULL },
|
||||
{ GIMP_LAYER_MODE_GROUP_LEGACY, NC_("layer-mode-group", "Legacy"), NULL },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (! type))
|
||||
{
|
||||
type = g_enum_register_static ("GimpLayerModeGroup", values);
|
||||
gimp_type_set_translation_context (type, "layer-mode-group");
|
||||
gimp_enum_set_value_descriptions (type, descs);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_matting_engine_get_type (void)
|
||||
{
|
||||
|
|
|
@ -240,6 +240,18 @@ typedef enum
|
|||
} GimpLayerMode;
|
||||
|
||||
|
||||
#define GIMP_TYPE_LAYER_MODE_GROUP (gimp_layer_mode_group_get_type ())
|
||||
|
||||
GType gimp_layer_mode_group_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum /*< pdb-skip >*/
|
||||
{
|
||||
GIMP_LAYER_MODE_GROUP_LINEAR, /*< desc="Linear light" >*/
|
||||
GIMP_LAYER_MODE_GROUP_PERCEPTUAL, /*< desc="Perceptual" >*/
|
||||
GIMP_LAYER_MODE_GROUP_LEGACY, /*< desc="Legacy" >*/
|
||||
} GimpLayerModeGroup;
|
||||
|
||||
|
||||
#define GIMP_TYPE_MATTING_ENGINE (gimp_matting_engine_get_type ())
|
||||
|
||||
GType gimp_matting_engine_get_type (void) G_GNUC_CONST;
|
||||
|
|
|
@ -98,6 +98,7 @@ gimp_layer_mode_is_linear (GimpLayerMode mode)
|
|||
|
||||
case GIMP_LAYER_MODE_COLOR_ERASE:
|
||||
return FALSE;
|
||||
|
||||
case GIMP_LAYER_MODE_OVERLAY:
|
||||
return TRUE;
|
||||
|
||||
|
@ -159,11 +160,7 @@ gimp_layer_mode_is_linear (GimpLayerMode mode)
|
|||
return TRUE;
|
||||
|
||||
case GIMP_LAYER_MODE_ERASE:
|
||||
return TRUE;
|
||||
|
||||
case GIMP_LAYER_MODE_REPLACE:
|
||||
return TRUE;
|
||||
|
||||
case GIMP_LAYER_MODE_ANTI_ERASE:
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -171,6 +168,22 @@ gimp_layer_mode_is_linear (GimpLayerMode mode)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GimpLayerModeGroup
|
||||
gimp_layer_mode_get_group (GimpLayerMode mode)
|
||||
{
|
||||
if (gimp_layer_mode_is_legacy (mode))
|
||||
{
|
||||
return GIMP_LAYER_MODE_GROUP_LEGACY;
|
||||
}
|
||||
else if (gimp_layer_mode_get_blend_space (mode) ==
|
||||
GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL)
|
||||
{
|
||||
return GIMP_LAYER_MODE_GROUP_PERCEPTUAL;
|
||||
}
|
||||
|
||||
return GIMP_LAYER_MODE_GROUP_LINEAR;
|
||||
}
|
||||
|
||||
GimpLayerColorSpace
|
||||
gimp_layer_mode_get_blend_space (GimpLayerMode mode)
|
||||
{
|
||||
|
@ -270,11 +283,7 @@ gimp_layer_mode_get_blend_space (GimpLayerMode mode)
|
|||
return GIMP_LAYER_COLOR_SPACE_RGB_LINEAR;
|
||||
|
||||
case GIMP_LAYER_MODE_ERASE:
|
||||
return GIMP_LAYER_COLOR_SPACE_RGB_LINEAR;
|
||||
|
||||
case GIMP_LAYER_MODE_REPLACE:
|
||||
return GIMP_LAYER_COLOR_SPACE_RGB_LINEAR;
|
||||
|
||||
case GIMP_LAYER_MODE_ANTI_ERASE:
|
||||
return GIMP_LAYER_COLOR_SPACE_RGB_LINEAR;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
gboolean gimp_layer_mode_is_legacy (GimpLayerMode mode);
|
||||
gboolean gimp_layer_mode_is_linear (GimpLayerMode mode);
|
||||
|
||||
GimpLayerModeGroup gimp_layer_mode_get_group (GimpLayerMode mode);
|
||||
|
||||
GimpLayerColorSpace gimp_layer_mode_get_blend_space (GimpLayerMode mode);
|
||||
GimpLayerColorSpace gimp_layer_mode_get_composite_space (GimpLayerMode mode);
|
||||
GimpLayerCompositeMode gimp_layer_mode_get_composite_mode (GimpLayerMode mode);
|
||||
|
|
Loading…
Reference in New Issue