Commit ed1ab140 authored by Michael Natterer's avatar Michael Natterer 😴

app, pdb, libgimp: rename values of enum GimpConvertDitherType

being exported to libgimp, and having a non-exported value, this is a
horrible mess like with GimpLayerMode, but at least the cruft value
names are deprecated now.
parent 86e101e3
......@@ -80,7 +80,8 @@ static gboolean app_exit_after_callback (Gimp *gimp,
gboolean kill_it,
GMainLoop **loop);
GType gimp_layer_mode_effects_get_type (void); /* compat cruft */
GType gimp_convert_dither_type_compat_get_type (void); /* compat cruft */
GType gimp_layer_mode_effects_get_type (void); /* compat cruft */
/* local variables */
......@@ -118,6 +119,8 @@ app_libs_init (GOptionContext *context,
/* keep compat enum code in sync with tools/pdbgen/enumcode.pl */
quark = g_quark_from_static_string ("gimp-compat-enum");
g_type_set_qdata (GIMP_TYPE_CONVERT_DITHER_TYPE, quark,
(gpointer) gimp_convert_dither_type_compat_get_type ());
g_type_set_qdata (GIMP_TYPE_LAYER_MODE, quark,
(gpointer) gimp_layer_mode_effects_get_type ());
}
......
......@@ -248,7 +248,7 @@ gimp_dialog_config_class_init (GimpDialogConfigClass *klass)
"Default dither type for indexed conversion",
IMAGE_CONVERT_INDEXED_DITHER_TYPE_BLURB,
GIMP_TYPE_CONVERT_DITHER_TYPE,
GIMP_NO_DITHER,
GIMP_CONVERT_DITHER_NONE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class,
......
......@@ -77,19 +77,19 @@ gimp_convert_dither_type_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_NO_DITHER, "GIMP_NO_DITHER", "no-dither" },
{ GIMP_FS_DITHER, "GIMP_FS_DITHER", "fs-dither" },
{ GIMP_FSLOWBLEED_DITHER, "GIMP_FSLOWBLEED_DITHER", "fslowbleed-dither" },
{ GIMP_FIXED_DITHER, "GIMP_FIXED_DITHER", "fixed-dither" },
{ GIMP_CONVERT_DITHER_NONE, "GIMP_CONVERT_DITHER_NONE", "none" },
{ GIMP_CONVERT_DITHER_FS, "GIMP_CONVERT_DITHER_FS", "fs" },
{ GIMP_CONVERT_DITHER_FS_LOWBLEED, "GIMP_CONVERT_DITHER_FS_LOWBLEED", "fs-lowbleed" },
{ GIMP_CONVERT_DITHER_FIXED, "GIMP_CONVERT_DITHER_FIXED", "fixed" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_NO_DITHER, NC_("convert-dither-type", "None"), NULL },
{ GIMP_FS_DITHER, NC_("convert-dither-type", "Floyd-Steinberg (normal)"), NULL },
{ GIMP_FSLOWBLEED_DITHER, NC_("convert-dither-type", "Floyd-Steinberg (reduced color bleeding)"), NULL },
{ GIMP_FIXED_DITHER, NC_("convert-dither-type", "Positioned"), NULL },
{ GIMP_CONVERT_DITHER_NONE, NC_("convert-dither-type", "None"), NULL },
{ GIMP_CONVERT_DITHER_FS, NC_("convert-dither-type", "Floyd-Steinberg (normal)"), NULL },
{ GIMP_CONVERT_DITHER_FS_LOWBLEED, NC_("convert-dither-type", "Floyd-Steinberg (reduced color bleeding)"), NULL },
{ GIMP_CONVERT_DITHER_FIXED, NC_("convert-dither-type", "Positioned"), NULL },
{ 0, NULL, NULL }
};
......
......@@ -71,11 +71,11 @@ GType gimp_convert_dither_type_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_NO_DITHER, /*< desc="None" >*/
GIMP_FS_DITHER, /*< desc="Floyd-Steinberg (normal)" >*/
GIMP_FSLOWBLEED_DITHER, /*< desc="Floyd-Steinberg (reduced color bleeding)" >*/
GIMP_FIXED_DITHER, /*< desc="Positioned" >*/
GIMP_NODESTRUCT_DITHER /*< pdb-skip, skip >*/
GIMP_CONVERT_DITHER_NONE, /*< desc="None" >*/
GIMP_CONVERT_DITHER_FS, /*< desc="Floyd-Steinberg (normal)" >*/
GIMP_CONVERT_DITHER_FS_LOWBLEED, /*< desc="Floyd-Steinberg (reduced color bleeding)" >*/
GIMP_CONVERT_DITHER_FIXED, /*< desc="Positioned" >*/
GIMP_CONVERT_DITHER_NODESTRUCT /*< pdb-skip, skip >*/
} GimpConvertDitherType;
......@@ -157,8 +157,8 @@ GType gimp_matting_engine_get_type (void) G_GNUC_CONST;
typedef enum /*< pdb-skip >*/
{
GIMP_MATTING_ENGINE_GLOBAL, /*< desc="Matting Global" >*/
GIMP_MATTING_ENGINE_LEVIN, /*< desc="Matting Levin" >*/
GIMP_MATTING_ENGINE_GLOBAL, /*< desc="Matting Global" >*/
GIMP_MATTING_ENGINE_LEVIN, /*< desc="Matting Levin" >*/
} GimpMattingEngine;
......
......@@ -832,7 +832,7 @@ gimp_image_convert_indexed (GimpImage *image,
max_colors == 256 &&
palette_type == GIMP_MAKE_PALETTE)
{
dither_type = GIMP_NO_DITHER;
dither_type = GIMP_CONVERT_DITHER_NONE;
}
quantobj = initialize_median_cut (old_type, max_colors, dither_type,
......@@ -902,7 +902,7 @@ gimp_image_convert_indexed (GimpImage *image,
quantobj->delete_func (quantobj);
quantobj = initialize_median_cut (old_type, max_colors,
GIMP_NODESTRUCT_DITHER,
GIMP_CONVERT_DITHER_NODESTRUCT,
palette_type,
custom_palette,
dither_alpha,
......@@ -4369,24 +4369,24 @@ initialize_median_cut (GimpImageBaseType type,
{
switch (dither_type)
{
case GIMP_NODESTRUCT_DITHER:
case GIMP_CONVERT_DITHER_NODESTRUCT:
default:
g_warning("Uh-oh, bad dither type, W1");
case GIMP_NO_DITHER:
case GIMP_CONVERT_DITHER_NONE:
quantobj->second_pass_init = median_cut_pass2_rgb_init;
quantobj->second_pass = median_cut_pass2_no_dither_rgb;
break;
case GIMP_FS_DITHER:
case GIMP_CONVERT_DITHER_FS:
quantobj->error_freedom = 0;
quantobj->second_pass_init = median_cut_pass2_rgb_init;
quantobj->second_pass = median_cut_pass2_fs_dither_rgb;
break;
case GIMP_FSLOWBLEED_DITHER:
case GIMP_CONVERT_DITHER_FS_LOWBLEED:
quantobj->error_freedom = 1;
quantobj->second_pass_init = median_cut_pass2_rgb_init;
quantobj->second_pass = median_cut_pass2_fs_dither_rgb;
break;
case GIMP_FIXED_DITHER:
case GIMP_CONVERT_DITHER_FIXED:
quantobj->second_pass_init = median_cut_pass2_rgb_init;
quantobj->second_pass = median_cut_pass2_fixed_dither_rgb;
break;
......@@ -4396,24 +4396,24 @@ initialize_median_cut (GimpImageBaseType type,
{
switch (dither_type)
{
case GIMP_NODESTRUCT_DITHER:
case GIMP_CONVERT_DITHER_NODESTRUCT:
default:
g_warning("Uh-oh, bad dither type, W2");
case GIMP_NO_DITHER:
case GIMP_CONVERT_DITHER_NONE:
quantobj->second_pass_init = median_cut_pass2_gray_init;
quantobj->second_pass = median_cut_pass2_no_dither_gray;
break;
case GIMP_FS_DITHER:
case GIMP_CONVERT_DITHER_FS:
quantobj->error_freedom = 0;
quantobj->second_pass_init = median_cut_pass2_gray_init;
quantobj->second_pass = median_cut_pass2_fs_dither_gray;
break;
case GIMP_FSLOWBLEED_DITHER:
case GIMP_CONVERT_DITHER_FS_LOWBLEED:
quantobj->error_freedom = 1;
quantobj->second_pass_init = median_cut_pass2_gray_init;
quantobj->second_pass = median_cut_pass2_fs_dither_gray;
break;
case GIMP_FIXED_DITHER:
case GIMP_CONVERT_DITHER_FIXED:
quantobj->second_pass_init = median_cut_pass2_gray_init;
quantobj->second_pass = median_cut_pass2_fixed_dither_gray;
break;
......@@ -4442,25 +4442,25 @@ initialize_median_cut (GimpImageBaseType type,
switch (dither_type)
{
case GIMP_NO_DITHER:
case GIMP_CONVERT_DITHER_NONE:
quantobj->second_pass_init = median_cut_pass2_rgb_init;
quantobj->second_pass = median_cut_pass2_no_dither_rgb;
break;
case GIMP_FS_DITHER:
case GIMP_CONVERT_DITHER_FS:
quantobj->error_freedom = 0;
quantobj->second_pass_init = median_cut_pass2_rgb_init;
quantobj->second_pass = median_cut_pass2_fs_dither_rgb;
break;
case GIMP_FSLOWBLEED_DITHER:
case GIMP_CONVERT_DITHER_FS_LOWBLEED:
quantobj->error_freedom = 1;
quantobj->second_pass_init = median_cut_pass2_rgb_init;
quantobj->second_pass = median_cut_pass2_fs_dither_rgb;
break;
case GIMP_NODESTRUCT_DITHER:
case GIMP_CONVERT_DITHER_NODESTRUCT:
quantobj->second_pass_init = NULL;
quantobj->second_pass = median_cut_pass2_nodestruct_dither_rgb;
break;
case GIMP_FIXED_DITHER:
case GIMP_CONVERT_DITHER_FIXED:
quantobj->second_pass_init = median_cut_pass2_rgb_init;
quantobj->second_pass = median_cut_pass2_fixed_dither_rgb;
break;
......
......@@ -336,7 +336,7 @@ register_image_convert_procs (GimpPDB *pdb)
"dither type",
"The dither type to use",
GIMP_TYPE_CONVERT_DITHER_TYPE,
GIMP_NO_DITHER,
GIMP_CONVERT_DITHER_NONE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_enum ("palette-type",
......
......@@ -135,7 +135,8 @@ static const gchar * const type_names[] =
static gboolean enums_initialized = FALSE;
GType gimp_layer_mode_effects_get_type (void);
GType gimp_convert_dither_type_compat_get_type (void);
GType gimp_layer_mode_effects_get_type (void);
/**
* gimp_enums_init:
......@@ -168,6 +169,8 @@ gimp_enums_init (void)
/* keep compat enum code in sync with app/app.c (app_libs_init) */
quark = g_quark_from_static_string ("gimp-compat-enum");
g_type_set_qdata (GIMP_TYPE_CONVERT_DITHER_TYPE, quark,
(gpointer) gimp_convert_dither_type_compat_get_type ());
g_type_set_qdata (GIMP_TYPE_LAYER_MODE, quark,
(gpointer) gimp_layer_mode_effects_get_type ());
......
......@@ -41,10 +41,10 @@ GType gimp_convert_dither_type_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_NO_DITHER,
GIMP_FS_DITHER,
GIMP_FSLOWBLEED_DITHER,
GIMP_FIXED_DITHER
GIMP_CONVERT_DITHER_NONE,
GIMP_CONVERT_DITHER_FS,
GIMP_CONVERT_DITHER_FS_LOWBLEED,
GIMP_CONVERT_DITHER_FIXED
} GimpConvertDitherType;
......
......@@ -191,10 +191,10 @@ export_convert_indexed (gint32 image_ID,
/* check alpha */
g_free (gimp_image_get_layers (image_ID, &nlayers));
if (nlayers > 1 || gimp_drawable_has_alpha (*drawable_ID))
gimp_image_convert_indexed (image_ID, GIMP_NO_DITHER,
gimp_image_convert_indexed (image_ID, GIMP_CONVERT_DITHER_NONE,
GIMP_MAKE_PALETTE, 255, FALSE, FALSE, "");
else
gimp_image_convert_indexed (image_ID, GIMP_NO_DITHER,
gimp_image_convert_indexed (image_ID, GIMP_CONVERT_DITHER_NONE,
GIMP_MAKE_PALETTE, 256, FALSE, FALSE, "");
}
......@@ -205,7 +205,7 @@ export_convert_bitmap (gint32 image_ID,
if (gimp_image_base_type (image_ID) == GIMP_INDEXED)
gimp_image_convert_rgb (image_ID);
gimp_image_convert_indexed (image_ID, GIMP_FS_DITHER,
gimp_image_convert_indexed (image_ID, GIMP_CONVERT_DITHER_FS,
GIMP_MAKE_PALETTE, 2, FALSE, FALSE, "");
}
......
......@@ -70,6 +70,11 @@ typedef GimpLayerMode GimpLayerModeEffects;
#define GIMP_GRAIN_MERGE_MODE GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY
#define GIMP_COLOR_ERASE_MODE GIMP_LAYER_MODE_COLOR_ERASE
#define GIMP_NO_DITHER GIMP_CONVERT_DITHER_NONE
#define GIMP_FS_DITHER GIMP_CONVERT_DITHER_FS
#define GIMP_FSLOWBLEED_DITHER GIMP_CONVERT_DITHER_FS_LOWBLEED
#define GIMP_FIXED_DITHER GIMP_CONVERT_DITHER_FIXED
#endif /* ! GIMP_DISABLE_DEPRECATED */
G_END_DECLS
......
......@@ -182,6 +182,40 @@ gimp_clone_type_compat_get_type (void)
return type;
}
GType
gimp_convert_dither_type_compat_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_NO_DITHER, "GIMP_NO_DITHER", "no-dither" },
{ GIMP_FS_DITHER, "GIMP_FS_DITHER", "fs-dither" },
{ GIMP_FSLOWBLEED_DITHER, "GIMP_FSLOWBLEED_DITHER", "fslowbleed-dither" },
{ GIMP_FIXED_DITHER, "GIMP_FIXED_DITHER", "fixed-dither" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_NO_DITHER, "GIMP_NO_DITHER", NULL },
{ GIMP_FS_DITHER, "GIMP_FS_DITHER", NULL },
{ GIMP_FSLOWBLEED_DITHER, "GIMP_FSLOWBLEED_DITHER", NULL },
{ GIMP_FIXED_DITHER, "GIMP_FIXED_DITHER", NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpConvertDitherTypeCompat", values);
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
gimp_type_set_translation_context (type, "convert-dither-type-compat");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_convolve_type_compat_get_type (void)
{
......
......@@ -94,6 +94,19 @@ typedef enum
} GimpCloneTypeCompat;
#define GIMP_TYPE_CONVERT_DITHER_TYPE_COMPAT (gimp_convert_dither_type_compat_get_type ())
GType gimp_convert_dither_type_compat_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_NO_DITHER,
GIMP_FS_DITHER,
GIMP_FSLOWBLEED_DITHER,
GIMP_FIXED_DITHER
} GimpConvertDitherTypeCompat;
#define GIMP_TYPE_CONVOLVE_TYPE_COMPAT (gimp_convolve_type_compat_get_type ())
GType gimp_convolve_type_compat_get_type (void) G_GNUC_CONST;
......
......@@ -309,7 +309,8 @@ ico_dialog_update_icon_preview (GtkWidget *dialog,
gimp_image_convert_rgb (tmp_image);
gimp_image_convert_indexed (tmp_image,
GIMP_FS_DITHER, GIMP_MAKE_PALETTE,
GIMP_CONVERT_DITHER_FS,
GIMP_MAKE_PALETTE,
1 << bpp, TRUE, FALSE, "dummy");
cmap = gimp_image_get_colormap (tmp_image, &num_colors);
......@@ -346,7 +347,8 @@ ico_dialog_update_icon_preview (GtkWidget *dialog,
gimp_image_convert_rgb (tmp_image);
gimp_image_convert_indexed (tmp_image,
GIMP_FS_DITHER, GIMP_MAKE_PALETTE,
GIMP_CONVERT_DITHER_FS,
GIMP_MAKE_PALETTE,
(1 << bpp) - 1, TRUE, FALSE, "dummy");
}
......
......@@ -647,7 +647,8 @@ ico_image_get_reduced_buf (guint32 layer,
if (bpp <= 8)
{
gimp_image_convert_indexed (tmp_image,
GIMP_FS_DITHER, GIMP_MAKE_PALETTE,
GIMP_CONVERT_DITHER_FS,
GIMP_MAKE_PALETTE,
1 << bpp, TRUE, FALSE, "dummy");
cmap = gimp_image_get_colormap (tmp_image, num_colors);
......@@ -685,7 +686,8 @@ ico_image_get_reduced_buf (guint32 layer,
gimp_image_convert_rgb (tmp_image);
gimp_image_convert_indexed (tmp_image,
GIMP_FS_DITHER, GIMP_MAKE_PALETTE,
GIMP_CONVERT_DITHER_FS,
GIMP_MAKE_PALETTE,
(1<<bpp) - 1, TRUE, FALSE, "dummy");
g_free (cmap);
cmap = gimp_image_get_colormap (tmp_image, num_colors);
......
......@@ -162,7 +162,8 @@ print ENUMFILE <<CODE;
static gboolean enums_initialized = FALSE;
GType gimp_layer_mode_effects_get_type (void);
GType gimp_convert_dither_type_compat_get_type (void);
GType gimp_layer_mode_effects_get_type (void);
/**
* gimp_enums_init:
......@@ -195,6 +196,8 @@ gimp_enums_init (void)
/* keep compat enum code in sync with app/app.c (app_libs_init) */
quark = g_quark_from_static_string ("gimp-compat-enum");
g_type_set_qdata (GIMP_TYPE_CONVERT_DITHER_TYPE, quark,
(gpointer) gimp_convert_dither_type_compat_get_type ());
g_type_set_qdata (GIMP_TYPE_LAYER_MODE, quark,
(gpointer) gimp_layer_mode_effects_get_type ());
......
......@@ -807,12 +807,13 @@ package Gimp::CodeGen::enums;
GimpConvertDitherType =>
{ contig => 1,
header => 'core/core-enums.h',
symbols => [ qw(GIMP_NO_DITHER GIMP_FS_DITHER
GIMP_FSLOWBLEED_DITHER GIMP_FIXED_DITHER) ],
mapping => { GIMP_NO_DITHER => '0',
GIMP_FS_DITHER => '1',
GIMP_FSLOWBLEED_DITHER => '2',
GIMP_FIXED_DITHER => '3' }
symbols => [ qw(GIMP_CONVERT_DITHER_NONE GIMP_CONVERT_DITHER_FS
GIMP_CONVERT_DITHER_FS_LOWBLEED
GIMP_CONVERT_DITHER_FIXED) ],
mapping => { GIMP_CONVERT_DITHER_NONE => '0',
GIMP_CONVERT_DITHER_FS => '1',
GIMP_CONVERT_DITHER_FS_LOWBLEED => '2',
GIMP_CONVERT_DITHER_FIXED => '3' }
},
GimpHistogramChannel =>
{ 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