mirror of https://github.com/GNOME/gimp.git
app/core/core-enums.h more enum cleanup (ConvertPaletteType and
2002-03-18 Sven Neumann <sven@gimp.org> * app/core/core-enums.h * app/core/core-types.h: more enum cleanup (ConvertPaletteType and ConvertDitherType this time). * app/core/gimpimage-convert.[ch] * app/gui/convert-dialog.c * tools/pdbgen/pdb/convert.pdb: changed accordingly. * app/pdb/convert_cmds.c * libgimp/gimpconvert_pdb.c * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
This commit is contained in:
parent
6a7cc3061e
commit
f85c711c55
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2002-03-18 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/core-enums.h
|
||||
* app/core/core-types.h: more enum cleanup (ConvertPaletteType and
|
||||
ConvertDitherType this time).
|
||||
|
||||
* app/core/gimpimage-convert.[ch]
|
||||
* app/gui/convert-dialog.c
|
||||
* tools/pdbgen/pdb/convert.pdb: changed accordingly.
|
||||
|
||||
* app/pdb/convert_cmds.c
|
||||
* libgimp/gimpconvert_pdb.c
|
||||
* libgimp/gimpenums.h
|
||||
* plug-ins/script-fu/script-fu-constants.c
|
||||
* tools/pdbgen/enums.pl: regenerated.
|
||||
|
||||
2002-03-18 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/core-enums.h
|
||||
|
|
|
@ -163,6 +163,24 @@ typedef enum /*< skip >*/
|
|||
GIMP_PATTERN_BUCKET_FILL
|
||||
} GimpBucketFillMode;
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
GIMP_MAKE_PALETTE,
|
||||
GIMP_REUSE_PALETTE,
|
||||
GIMP_WEB_PALETTE,
|
||||
GIMP_MONO_PALETTE,
|
||||
GIMP_CUSTOM_PALETTE
|
||||
} GimpConvertPaletteType;
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
GIMP_NO_DITHER,
|
||||
GIMP_FS_DITHER,
|
||||
GIMP_FSLOWBLEED_DITHER,
|
||||
GIMP_FIXED_DITHER,
|
||||
GIMP_NODESTRUCT_DITHER /* NEVER USE NODESTRUCT_DITHER EXPLICITLY */
|
||||
} GimpConvertDitherType;
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
GIMP_FOREGROUND_FILL,
|
||||
|
@ -183,9 +201,9 @@ typedef enum /*< pdb-skip >*/ /*< skip >*/
|
|||
|
||||
typedef enum /*< pdb-skip >*/ /*< skip >*/
|
||||
{
|
||||
GIMP_GRAD_RGB = 0, /* normal RGB */
|
||||
GIMP_GRAD_RGB, /* normal RGB */
|
||||
GIMP_GRAD_HSV_CCW, /* counterclockwise hue */
|
||||
GIMP_GRAD_HSV_CW /* clockwise hue */
|
||||
GIMP_GRAD_HSV_CW /* clockwise hue */
|
||||
} GimpGradientSegmentColor;
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
|
|
|
@ -73,24 +73,6 @@ typedef enum
|
|||
FLATTEN_IMAGE
|
||||
} MergeType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MAKE_PALETTE = 0,
|
||||
REUSE_PALETTE = 1,
|
||||
WEB_PALETTE = 2,
|
||||
MONO_PALETTE = 3,
|
||||
CUSTOM_PALETTE = 4
|
||||
} ConvertPaletteType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NO_DITHER = 0,
|
||||
FS_DITHER = 1,
|
||||
FSLOWBLEED_DITHER = 2,
|
||||
FIXED_DITHER = 3,
|
||||
|
||||
NODESTRUCT_DITHER = 4 /* NEVER USE NODESTRUCT_DITHER EXPLICITLY */
|
||||
} ConvertDitherType;
|
||||
|
||||
typedef enum /*< pdb-skip >*/ /*< skip >*/
|
||||
{
|
||||
|
|
|
@ -513,11 +513,18 @@ typedef struct
|
|||
|
||||
static void zero_histogram_gray (CFHistogram);
|
||||
static void zero_histogram_rgb (CFHistogram);
|
||||
static void generate_histogram_gray (CFHistogram, GimpLayer *, int alpha_dither);
|
||||
static void generate_histogram_rgb (CFHistogram, GimpLayer *, int col_limit, int alpha_dither);
|
||||
static void generate_histogram_gray (CFHistogram,
|
||||
GimpLayer *,
|
||||
int alpha_dither);
|
||||
static void generate_histogram_rgb (CFHistogram,
|
||||
GimpLayer *,
|
||||
int col_limit,
|
||||
int alpha_dither);
|
||||
|
||||
static QuantizeObj* initialize_median_cut (int, int, ConvertDitherType,
|
||||
ConvertPaletteType, int);
|
||||
static QuantizeObj* initialize_median_cut (int, int,
|
||||
GimpConvertDitherType,
|
||||
GimpConvertPaletteType,
|
||||
int);
|
||||
|
||||
static void
|
||||
compute_color_lin8 (QuantizeObj *quantobj,
|
||||
|
@ -705,17 +712,17 @@ remap_indexed_layer (GimpLayer *layer,
|
|||
|
||||
|
||||
void
|
||||
gimp_image_convert (GimpImage *gimage,
|
||||
GimpImageBaseType new_type,
|
||||
gimp_image_convert (GimpImage *gimage,
|
||||
GimpImageBaseType new_type,
|
||||
/* The following three params used only for
|
||||
* new_type == GIMP_INDEXED
|
||||
*/
|
||||
gint num_cols,
|
||||
ConvertDitherType dither,
|
||||
gint alpha_dither,
|
||||
gint remdups,
|
||||
ConvertPaletteType palette_type,
|
||||
GimpPalette *custom_palette)
|
||||
gint num_cols,
|
||||
GimpConvertDitherType dither,
|
||||
gint alpha_dither,
|
||||
gint remove_dups,
|
||||
GimpConvertPaletteType palette_type,
|
||||
GimpPalette *custom_palette)
|
||||
{
|
||||
QuantizeObj *quantobj;
|
||||
GimpLayer *layer;
|
||||
|
@ -728,7 +735,7 @@ gimp_image_convert (GimpImage *gimage,
|
|||
g_return_if_fail (gimage != NULL);
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
|
||||
quantobj = NULL;
|
||||
quantobj = NULL;
|
||||
|
||||
theCustomPalette = custom_palette;
|
||||
|
||||
|
@ -760,14 +767,19 @@ gimp_image_convert (GimpImage *gimage,
|
|||
|
||||
/* fprintf(stderr, " TO INDEXED(%d) ", num_cols); */
|
||||
|
||||
/* don't dither if the input is grayscale and we are simply mapping every color */
|
||||
if (old_type == GIMP_GRAY && num_cols == 256 && palette_type == MAKE_PALETTE)
|
||||
dither = NO_DITHER;
|
||||
/* don't dither if the input is grayscale and we are simply
|
||||
mapping every color */
|
||||
if (old_type == GIMP_GRAY &&
|
||||
num_cols == 256 &&
|
||||
palette_type == GIMP_MAKE_PALETTE)
|
||||
{
|
||||
dither = GIMP_NO_DITHER;
|
||||
}
|
||||
|
||||
quantobj = initialize_median_cut (old_type, num_cols, dither,
|
||||
palette_type, alpha_dither);
|
||||
|
||||
if (palette_type == MAKE_PALETTE)
|
||||
if (palette_type == GIMP_MAKE_PALETTE)
|
||||
{
|
||||
if (old_type == GIMP_GRAY)
|
||||
zero_histogram_gray (quantobj->histogram);
|
||||
|
@ -789,9 +801,11 @@ gimp_image_convert (GimpImage *gimage,
|
|||
layer = (GimpLayer *) list->data;
|
||||
|
||||
if (old_type == GIMP_GRAY)
|
||||
generate_histogram_gray (quantobj->histogram, layer, alpha_dither);
|
||||
generate_histogram_gray (quantobj->histogram,
|
||||
layer, alpha_dither);
|
||||
else
|
||||
generate_histogram_rgb (quantobj->histogram, layer, num_cols, alpha_dither);
|
||||
generate_histogram_rgb (quantobj->histogram,
|
||||
layer, num_cols, alpha_dither);
|
||||
/*
|
||||
* Note: generate_histogram_rgb may set needs_quantize if
|
||||
* the image contains more colours than the limit specified
|
||||
|
@ -800,25 +814,26 @@ gimp_image_convert (GimpImage *gimage,
|
|||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(old_type == GIMP_RGB) &&
|
||||
(!needs_quantize) &&
|
||||
(palette_type == MAKE_PALETTE)
|
||||
)
|
||||
{
|
||||
/* If this is an RGB image, and the user wanted a custom-built
|
||||
* generated palette, and this image has no more colours than
|
||||
* the user asked for, we don't need the first pass (quantization).
|
||||
*
|
||||
* There's also no point in dithering, since there's no error to
|
||||
* spread. So we destroy the old quantobj and make a new one
|
||||
* with the remapping function set to a special LUT-based
|
||||
* no-dither remapper.
|
||||
*/
|
||||
|
||||
if (
|
||||
(old_type == GIMP_RGB) &&
|
||||
(!needs_quantize) &&
|
||||
(palette_type == GIMP_MAKE_PALETTE)
|
||||
)
|
||||
{
|
||||
/* If this is an RGB image, and the user wanted a custom-built
|
||||
* generated palette, and this image has no more colours than
|
||||
* the user asked for, we don't need the first pass (quantization).
|
||||
*
|
||||
* There's also no point in dithering, since there's no error to
|
||||
* spread. So we destroy the old quantobj and make a new one
|
||||
* with the remapping function set to a special LUT-based
|
||||
* no-dither remapper.
|
||||
*/
|
||||
|
||||
quantobj->delete_func (quantobj);
|
||||
quantobj = initialize_median_cut (old_type, num_cols,
|
||||
NODESTRUCT_DITHER, palette_type,
|
||||
GIMP_NODESTRUCT_DITHER,
|
||||
palette_type,
|
||||
alpha_dither);
|
||||
/* We can skip the first pass (palette creation) */
|
||||
|
||||
|
@ -924,8 +939,9 @@ gimp_image_convert (GimpImage *gimage,
|
|||
g_free (gimage->cmap);
|
||||
gimage->cmap = (unsigned char *) g_malloc (COLORMAP_SIZE);
|
||||
|
||||
if (remdups &&
|
||||
((palette_type == WEB_PALETTE) || (palette_type == CUSTOM_PALETTE)))
|
||||
if (remove_dups &&
|
||||
((palette_type == GIMP_WEB_PALETTE) ||
|
||||
(palette_type == GIMP_CUSTOM_PALETTE)))
|
||||
{
|
||||
int i,j;
|
||||
unsigned char old_palette [256 * 3];
|
||||
|
@ -945,7 +961,8 @@ gimp_image_convert (GimpImage *gimage,
|
|||
#if 1
|
||||
/* Generate a remapping table */
|
||||
make_remap_table (old_palette, new_palette,
|
||||
quantobj->index_used_count, remap_table, &num_entries);
|
||||
quantobj->index_used_count,
|
||||
remap_table, &num_entries);
|
||||
|
||||
/* Convert all layers */
|
||||
for (list = GIMP_LIST (gimage->layers)->list;
|
||||
|
@ -1168,7 +1185,9 @@ gimp_drawable_convert_grayscale (GimpDrawable *drawable,
|
|||
for (col = 0; col < srcPR.w; col++)
|
||||
{
|
||||
offset = *s++ * 3;
|
||||
val = INTENSITY (cmap[offset+0], cmap[offset+1], cmap[offset+2]);
|
||||
val = INTENSITY (cmap[offset+0],
|
||||
cmap[offset+1],
|
||||
cmap[offset+2]);
|
||||
*d++ = (guchar) val;
|
||||
if (has_alpha)
|
||||
*d++ = *s++;
|
||||
|
@ -1202,8 +1221,8 @@ zero_histogram_gray (CFHistogram histogram)
|
|||
static void
|
||||
zero_histogram_rgb (CFHistogram histogram)
|
||||
{
|
||||
memset(histogram, 0,
|
||||
HIST_R_ELEMS * HIST_G_ELEMS * HIST_B_ELEMS * sizeof(ColorFreq));
|
||||
memset (histogram, 0,
|
||||
HIST_R_ELEMS * HIST_G_ELEMS * HIST_B_ELEMS * sizeof(ColorFreq));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1220,7 +1239,11 @@ generate_histogram_gray (CFHistogram histogram,
|
|||
|
||||
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
|
||||
|
||||
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
|
||||
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles,
|
||||
0, 0,
|
||||
GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height,
|
||||
FALSE);
|
||||
|
||||
for (pr = pixel_regions_register (1, &srcPR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
|
@ -1291,10 +1314,10 @@ generate_histogram_rgb (CFHistogram histogram,
|
|||
)
|
||||
|| (!has_alpha))
|
||||
{
|
||||
colfreq = HIST_RGB(histogram,
|
||||
data[RED_PIX],
|
||||
data[GREEN_PIX],
|
||||
data[BLUE_PIX]);
|
||||
colfreq = HIST_RGB (histogram,
|
||||
data[RED_PIX],
|
||||
data[GREEN_PIX],
|
||||
data[BLUE_PIX]);
|
||||
(*colfreq)++;
|
||||
}
|
||||
|
||||
|
@ -1320,10 +1343,10 @@ generate_histogram_rgb (CFHistogram histogram,
|
|||
)
|
||||
|| (!has_alpha))
|
||||
{
|
||||
colfreq = HIST_RGB(histogram,
|
||||
data[RED_PIX],
|
||||
data[GREEN_PIX],
|
||||
data[BLUE_PIX]);
|
||||
colfreq = HIST_RGB (histogram,
|
||||
data[RED_PIX],
|
||||
data[GREEN_PIX],
|
||||
data[BLUE_PIX]);
|
||||
(*colfreq)++;
|
||||
}
|
||||
data += srcPR.bytes;
|
||||
|
@ -1343,10 +1366,10 @@ generate_histogram_rgb (CFHistogram histogram,
|
|||
((data[ALPHA_PIX] << 6) > (255 * DM[col&DM_WIDTHMASK][row&DM_HEIGHTMASK])) :
|
||||
(data[ALPHA_PIX] > 127))) || (!has_alpha))
|
||||
{
|
||||
colfreq = HIST_RGB(histogram,
|
||||
data[RED_PIX],
|
||||
data[GREEN_PIX],
|
||||
data[BLUE_PIX]);
|
||||
colfreq = HIST_RGB (histogram,
|
||||
data[RED_PIX],
|
||||
data[GREEN_PIX],
|
||||
data[BLUE_PIX]);
|
||||
(*colfreq)++;
|
||||
|
||||
if (!needs_quantize)
|
||||
|
@ -3868,8 +3891,8 @@ delete_median_cut (QuantizeObj *quantobj)
|
|||
static QuantizeObj*
|
||||
initialize_median_cut (int type,
|
||||
int num_colors,
|
||||
ConvertDitherType dither_type,
|
||||
ConvertPaletteType palette_type,
|
||||
GimpConvertDitherType dither_type,
|
||||
GimpConvertPaletteType palette_type,
|
||||
int want_alpha_dither)
|
||||
{
|
||||
QuantizeObj * quantobj;
|
||||
|
@ -3877,7 +3900,7 @@ initialize_median_cut (int type,
|
|||
/* Initialize the data structures */
|
||||
quantobj = g_malloc (sizeof (QuantizeObj));
|
||||
|
||||
if (type == GIMP_GRAY && palette_type == MAKE_PALETTE)
|
||||
if (type == GIMP_GRAY && palette_type == GIMP_MAKE_PALETTE)
|
||||
quantobj->histogram = g_malloc (sizeof (ColorFreq) * 256);
|
||||
else
|
||||
quantobj->histogram = g_malloc (sizeof (ColorFreq) *
|
||||
|
@ -3893,42 +3916,44 @@ initialize_median_cut (int type,
|
|||
case GIMP_GRAY:
|
||||
switch (palette_type)
|
||||
{
|
||||
case MAKE_PALETTE:
|
||||
case GIMP_MAKE_PALETTE:
|
||||
quantobj->first_pass = median_cut_pass1_gray;
|
||||
break;
|
||||
case WEB_PALETTE:
|
||||
case GIMP_WEB_PALETTE:
|
||||
quantobj->first_pass = webpal_pass1;
|
||||
break;
|
||||
case CUSTOM_PALETTE:
|
||||
case GIMP_CUSTOM_PALETTE:
|
||||
quantobj->first_pass = custompal_pass1;
|
||||
needs_quantize=TRUE;
|
||||
break;
|
||||
case MONO_PALETTE:
|
||||
case GIMP_MONO_PALETTE:
|
||||
default:
|
||||
quantobj->first_pass = monopal_pass1;
|
||||
}
|
||||
if (palette_type == WEB_PALETTE ||
|
||||
palette_type == MONO_PALETTE || palette_type == CUSTOM_PALETTE)
|
||||
|
||||
if (palette_type == GIMP_WEB_PALETTE ||
|
||||
palette_type == GIMP_MONO_PALETTE ||
|
||||
palette_type == GIMP_CUSTOM_PALETTE)
|
||||
switch (dither_type)
|
||||
{
|
||||
case NODESTRUCT_DITHER:
|
||||
case GIMP_NODESTRUCT_DITHER:
|
||||
default:
|
||||
g_warning("Uh-oh, bad dither type, W1");
|
||||
case NO_DITHER:
|
||||
case GIMP_NO_DITHER:
|
||||
quantobj->second_pass_init = median_cut_pass2_rgb_init;
|
||||
quantobj->second_pass = median_cut_pass2_no_dither_rgb;
|
||||
break;
|
||||
case FS_DITHER:
|
||||
case GIMP_FS_DITHER:
|
||||
quantobj->error_freedom = 0;
|
||||
quantobj->second_pass_init = median_cut_pass2_rgb_init;
|
||||
quantobj->second_pass = median_cut_pass2_fs_dither_rgb;
|
||||
break;
|
||||
case FSLOWBLEED_DITHER:
|
||||
case GIMP_FSLOWBLEED_DITHER:
|
||||
quantobj->error_freedom = 1;
|
||||
quantobj->second_pass_init = median_cut_pass2_rgb_init;
|
||||
quantobj->second_pass = median_cut_pass2_fs_dither_rgb;
|
||||
break;
|
||||
case FIXED_DITHER:
|
||||
case GIMP_FIXED_DITHER:
|
||||
quantobj->second_pass_init = median_cut_pass2_rgb_init;
|
||||
quantobj->second_pass = median_cut_pass2_fixed_dither_rgb;
|
||||
break;
|
||||
|
@ -3936,24 +3961,24 @@ initialize_median_cut (int type,
|
|||
else
|
||||
switch (dither_type)
|
||||
{
|
||||
case NODESTRUCT_DITHER:
|
||||
case GIMP_NODESTRUCT_DITHER:
|
||||
default:
|
||||
g_warning("Uh-oh, bad dither type, W2");
|
||||
case NO_DITHER:
|
||||
case GIMP_NO_DITHER:
|
||||
quantobj->second_pass_init = median_cut_pass2_gray_init;
|
||||
quantobj->second_pass = median_cut_pass2_no_dither_gray;
|
||||
break;
|
||||
case FS_DITHER:
|
||||
case GIMP_FS_DITHER:
|
||||
quantobj->error_freedom = 0;
|
||||
quantobj->second_pass_init = median_cut_pass2_gray_init;
|
||||
quantobj->second_pass = median_cut_pass2_fs_dither_gray;
|
||||
break;
|
||||
case FSLOWBLEED_DITHER:
|
||||
case GIMP_FSLOWBLEED_DITHER:
|
||||
quantobj->error_freedom = 1;
|
||||
quantobj->second_pass_init = median_cut_pass2_gray_init;
|
||||
quantobj->second_pass = median_cut_pass2_fs_dither_gray;
|
||||
break;
|
||||
case FIXED_DITHER:
|
||||
case GIMP_FIXED_DITHER:
|
||||
quantobj->second_pass_init = median_cut_pass2_gray_init;
|
||||
quantobj->second_pass = median_cut_pass2_fixed_dither_gray;
|
||||
break;
|
||||
|
@ -3962,48 +3987,49 @@ initialize_median_cut (int type,
|
|||
case GIMP_RGB:
|
||||
switch (palette_type)
|
||||
{
|
||||
case MAKE_PALETTE:
|
||||
case GIMP_MAKE_PALETTE:
|
||||
quantobj->first_pass = median_cut_pass1_rgb;
|
||||
break;
|
||||
case WEB_PALETTE:
|
||||
case GIMP_WEB_PALETTE:
|
||||
quantobj->first_pass = webpal_pass1;
|
||||
needs_quantize=TRUE;
|
||||
break;
|
||||
case CUSTOM_PALETTE:
|
||||
case GIMP_CUSTOM_PALETTE:
|
||||
quantobj->first_pass = custompal_pass1;
|
||||
needs_quantize=TRUE;
|
||||
break;
|
||||
case MONO_PALETTE:
|
||||
case GIMP_MONO_PALETTE:
|
||||
default:
|
||||
quantobj->first_pass = monopal_pass1;
|
||||
}
|
||||
switch (dither_type)
|
||||
{
|
||||
case NO_DITHER:
|
||||
case GIMP_NO_DITHER:
|
||||
quantobj->second_pass_init = median_cut_pass2_rgb_init;
|
||||
quantobj->second_pass = median_cut_pass2_no_dither_rgb;
|
||||
break;
|
||||
case FS_DITHER:
|
||||
case GIMP_FS_DITHER:
|
||||
quantobj->error_freedom = 0;
|
||||
quantobj->second_pass_init = median_cut_pass2_rgb_init;
|
||||
quantobj->second_pass = median_cut_pass2_fs_dither_rgb;
|
||||
break;
|
||||
case FSLOWBLEED_DITHER:
|
||||
case GIMP_FSLOWBLEED_DITHER:
|
||||
quantobj->error_freedom = 1;
|
||||
quantobj->second_pass_init = median_cut_pass2_rgb_init;
|
||||
quantobj->second_pass = median_cut_pass2_fs_dither_rgb;
|
||||
break;
|
||||
case NODESTRUCT_DITHER:
|
||||
case GIMP_NODESTRUCT_DITHER:
|
||||
quantobj->second_pass_init = NULL;
|
||||
quantobj->second_pass = median_cut_pass2_nodestruct_dither_rgb;
|
||||
break;
|
||||
case FIXED_DITHER:
|
||||
case GIMP_FIXED_DITHER:
|
||||
quantobj->second_pass_init = median_cut_pass2_rgb_init;
|
||||
quantobj->second_pass = median_cut_pass2_fixed_dither_rgb;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
quantobj->delete_func = delete_median_cut;
|
||||
|
||||
return quantobj;
|
||||
|
|
|
@ -23,17 +23,17 @@
|
|||
#define MAXNUMCOLORS 256
|
||||
|
||||
|
||||
void gimp_image_convert (GimpImage *gimage,
|
||||
GimpImageBaseType new_type,
|
||||
/* The following params used only for
|
||||
* new_type == GIMP_INDEXED
|
||||
*/
|
||||
gint num_cols,
|
||||
ConvertDitherType dither,
|
||||
gint alpha_dither,
|
||||
gint remdups,
|
||||
ConvertPaletteType palette_type,
|
||||
GimpPalette *custom_palette);
|
||||
void gimp_image_convert (GimpImage *gimage,
|
||||
GimpImageBaseType new_type,
|
||||
/* The following params used only for
|
||||
* new_type == GIMP_INDEXED
|
||||
*/
|
||||
gint num_cols,
|
||||
GimpConvertDitherType dither,
|
||||
gint alpha_dither,
|
||||
gint remove_dups,
|
||||
GimpConvertPaletteType palette_type,
|
||||
GimpPalette *custom_palette);
|
||||
|
||||
void gimp_drawable_convert_rgb (GimpDrawable *drawable,
|
||||
TileManager *new_tiles,
|
||||
|
|
|
@ -501,32 +501,32 @@ static void
|
|||
indexed_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
IndexedDialog *dialog;
|
||||
ConvertPaletteType palette_type;
|
||||
ConvertDitherType dither_type;
|
||||
GimpTool *active_tool;
|
||||
IndexedDialog *dialog;
|
||||
GimpConvertPaletteType palette_type;
|
||||
GimpConvertDitherType dither_type;
|
||||
GimpTool *active_tool;
|
||||
|
||||
dialog = (IndexedDialog *) data;
|
||||
|
||||
if (dialog->webpal_flag)
|
||||
palette_type = WEB_PALETTE;
|
||||
palette_type = GIMP_WEB_PALETTE;
|
||||
else if (dialog->custompal_flag)
|
||||
palette_type = CUSTOM_PALETTE;
|
||||
palette_type = GIMP_CUSTOM_PALETTE;
|
||||
else if (dialog->monopal_flag)
|
||||
palette_type = MONO_PALETTE;
|
||||
palette_type = GIMP_MONO_PALETTE;
|
||||
else if (dialog->makepal_flag)
|
||||
palette_type = MAKE_PALETTE;
|
||||
palette_type = GIMP_MAKE_PALETTE;
|
||||
else
|
||||
palette_type = REUSE_PALETTE;
|
||||
palette_type = GIMP_REUSE_PALETTE;
|
||||
|
||||
if (dialog->nodither_flag)
|
||||
dither_type = NO_DITHER;
|
||||
dither_type = GIMP_NO_DITHER;
|
||||
else if (dialog->fsdither_flag)
|
||||
dither_type = FS_DITHER;
|
||||
dither_type = GIMP_FS_DITHER;
|
||||
else if (dialog->fslowbleeddither_flag)
|
||||
dither_type = FSLOWBLEED_DITHER;
|
||||
dither_type = GIMP_FSLOWBLEED_DITHER;
|
||||
else
|
||||
dither_type = FIXED_DITHER;
|
||||
dither_type = GIMP_FIXED_DITHER;
|
||||
|
||||
/* Close the dialogs when open because they're useless for indexed
|
||||
* images and could crash the GIMP when used nevertheless
|
||||
|
|
|
@ -501,32 +501,32 @@ static void
|
|||
indexed_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
IndexedDialog *dialog;
|
||||
ConvertPaletteType palette_type;
|
||||
ConvertDitherType dither_type;
|
||||
GimpTool *active_tool;
|
||||
IndexedDialog *dialog;
|
||||
GimpConvertPaletteType palette_type;
|
||||
GimpConvertDitherType dither_type;
|
||||
GimpTool *active_tool;
|
||||
|
||||
dialog = (IndexedDialog *) data;
|
||||
|
||||
if (dialog->webpal_flag)
|
||||
palette_type = WEB_PALETTE;
|
||||
palette_type = GIMP_WEB_PALETTE;
|
||||
else if (dialog->custompal_flag)
|
||||
palette_type = CUSTOM_PALETTE;
|
||||
palette_type = GIMP_CUSTOM_PALETTE;
|
||||
else if (dialog->monopal_flag)
|
||||
palette_type = MONO_PALETTE;
|
||||
palette_type = GIMP_MONO_PALETTE;
|
||||
else if (dialog->makepal_flag)
|
||||
palette_type = MAKE_PALETTE;
|
||||
palette_type = GIMP_MAKE_PALETTE;
|
||||
else
|
||||
palette_type = REUSE_PALETTE;
|
||||
palette_type = GIMP_REUSE_PALETTE;
|
||||
|
||||
if (dialog->nodither_flag)
|
||||
dither_type = NO_DITHER;
|
||||
dither_type = GIMP_NO_DITHER;
|
||||
else if (dialog->fsdither_flag)
|
||||
dither_type = FS_DITHER;
|
||||
dither_type = GIMP_FS_DITHER;
|
||||
else if (dialog->fslowbleeddither_flag)
|
||||
dither_type = FSLOWBLEED_DITHER;
|
||||
dither_type = GIMP_FSLOWBLEED_DITHER;
|
||||
else
|
||||
dither_type = FIXED_DITHER;
|
||||
dither_type = GIMP_FIXED_DITHER;
|
||||
|
||||
/* Close the dialogs when open because they're useless for indexed
|
||||
* images and could crash the GIMP when used nevertheless
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "pdb-types.h"
|
||||
#include "procedural_db.h"
|
||||
|
||||
#include "core/core-types.h"
|
||||
#include "core/core-enums.h"
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpdatafactory.h"
|
||||
|
@ -152,7 +152,7 @@ convert_indexed_invoker (Gimp *gimp,
|
|||
success = FALSE;
|
||||
|
||||
dither_type = args[1].value.pdb_int;
|
||||
if (dither_type < NO_DITHER || dither_type > NODESTRUCT_DITHER)
|
||||
if (dither_type < GIMP_NO_DITHER || dither_type > GIMP_NODESTRUCT_DITHER)
|
||||
success = FALSE;
|
||||
|
||||
palette_type = args[2].value.pdb_int;
|
||||
|
@ -175,10 +175,10 @@ convert_indexed_invoker (Gimp *gimp,
|
|||
{
|
||||
switch (dither_type)
|
||||
{
|
||||
case NO_DITHER:
|
||||
case FS_DITHER:
|
||||
case FSLOWBLEED_DITHER:
|
||||
case FIXED_DITHER:
|
||||
case GIMP_NO_DITHER:
|
||||
case GIMP_FS_DITHER:
|
||||
case GIMP_FSLOWBLEED_DITHER:
|
||||
case GIMP_FIXED_DITHER:
|
||||
break;
|
||||
default:
|
||||
success = FALSE;
|
||||
|
@ -187,17 +187,17 @@ convert_indexed_invoker (Gimp *gimp,
|
|||
|
||||
switch (palette_type)
|
||||
{
|
||||
case MAKE_PALETTE:
|
||||
case GIMP_MAKE_PALETTE:
|
||||
if (num_cols < 1 || num_cols > MAXNUMCOLORS)
|
||||
success = FALSE;
|
||||
break;
|
||||
|
||||
case REUSE_PALETTE:
|
||||
case WEB_PALETTE:
|
||||
case MONO_PALETTE:
|
||||
case GIMP_REUSE_PALETTE:
|
||||
case GIMP_WEB_PALETTE:
|
||||
case GIMP_MONO_PALETTE:
|
||||
break;
|
||||
|
||||
case CUSTOM_PALETTE:
|
||||
case GIMP_CUSTOM_PALETTE:
|
||||
if (! gimp->palette_factory->container->num_children)
|
||||
gimp_data_factory_data_init (gimp->palette_factory, FALSE);
|
||||
|
||||
|
@ -238,12 +238,12 @@ static ProcArg convert_indexed_inargs[] =
|
|||
{
|
||||
GIMP_PDB_INT32,
|
||||
"palette_type",
|
||||
"The type of palette to use: { MAKE_PALETTE (0), REUSE_PALETTE (1), WEB_PALETTE (2), MONO_PALETTE (3), CUSTOM_PALETTE (4) }"
|
||||
"The type of palette to use: { GIMP_MAKE_PALETTE (0), GIMP_REUSE_PALETTE (1), GIMP_WEB_PALETTE (2), GIMP_MONO_PALETTE (3), GIMP_CUSTOM_PALETTE (4) }"
|
||||
},
|
||||
{
|
||||
GIMP_PDB_INT32,
|
||||
"num_cols",
|
||||
"the number of colors to quantize to, ignored unless (palette_type == MAKE_PALETTE)"
|
||||
"the number of colors to quantize to, ignored unless (palette_type == GIMP_MAKE_PALETTE)"
|
||||
},
|
||||
{
|
||||
GIMP_PDB_INT32,
|
||||
|
@ -253,12 +253,12 @@ static ProcArg convert_indexed_inargs[] =
|
|||
{
|
||||
GIMP_PDB_INT32,
|
||||
"remove_unused",
|
||||
"remove unused or duplicate colour entries from final palette, ignored if (palette_type == MAKE_PALETTE)"
|
||||
"remove unused or duplicate colour entries from final palette, ignored if (palette_type == GIMP_MAKE_PALETTE)"
|
||||
},
|
||||
{
|
||||
GIMP_PDB_STRING,
|
||||
"palette",
|
||||
"The name of the custom palette to use, ignored unless (palette_type == CUSTOM_PALETTE)"
|
||||
"The name of the custom palette to use, ignored unless (palette_type == GIMP_CUSTOM_PALETTE)"
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -91,10 +91,10 @@ gimp_convert_grayscale (gint32 image_ID)
|
|||
* @image_ID: The image.
|
||||
* @dither_type: dither type (0=none, 1=fs, 2=fs/low-bleed 3=fixed).
|
||||
* @palette_type: The type of palette to use.
|
||||
* @num_cols: the number of colors to quantize to, ignored unless (palette_type == MAKE_PALETTE).
|
||||
* @num_cols: the number of colors to quantize to, ignored unless (palette_type == GIMP_MAKE_PALETTE).
|
||||
* @alpha_dither: dither transparency to fake partial opacity.
|
||||
* @remove_unused: remove unused or duplicate colour entries from final palette, ignored if (palette_type == MAKE_PALETTE).
|
||||
* @palette: The name of the custom palette to use, ignored unless (palette_type == CUSTOM_PALETTE).
|
||||
* @remove_unused: remove unused or duplicate colour entries from final palette, ignored if (palette_type == GIMP_MAKE_PALETTE).
|
||||
* @palette: The name of the custom palette to use, ignored unless (palette_type == GIMP_CUSTOM_PALETTE).
|
||||
*
|
||||
* Convert specified image to and Indexed image
|
||||
*
|
||||
|
|
|
@ -45,24 +45,6 @@ typedef enum
|
|||
GIMP_PATTERN_CLONE
|
||||
} GimpCloneType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_NO_DITHER,
|
||||
GIMP_FS_DITHER,
|
||||
GIMP_FSLOWBLEED_DITHER,
|
||||
GIMP_FIXED_DITHER,
|
||||
GIMP_NODESTRUCT_DITHER
|
||||
} GimpConvertDitherType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_MAKE_PALETTE,
|
||||
GIMP_REUSE_PALETTE,
|
||||
GIMP_WEB_PALETTE,
|
||||
GIMP_MONO_PALETTE,
|
||||
GIMP_CUSTOM_PALETTE
|
||||
} GimpConvertPaletteType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_BLUR_CONVOLVE,
|
||||
|
@ -121,6 +103,24 @@ typedef enum
|
|||
GIMP_ALPHA_CHANNEL
|
||||
} GimpChannelType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_NO_DITHER,
|
||||
GIMP_FS_DITHER,
|
||||
GIMP_FSLOWBLEED_DITHER,
|
||||
GIMP_FIXED_DITHER,
|
||||
GIMP_NODESTRUCT_DITHER
|
||||
} GimpConvertDitherType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_MAKE_PALETTE,
|
||||
GIMP_REUSE_PALETTE,
|
||||
GIMP_WEB_PALETTE,
|
||||
GIMP_MONO_PALETTE,
|
||||
GIMP_CUSTOM_PALETTE
|
||||
} GimpConvertPaletteType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_NORMAL_CONVOL,
|
||||
|
|
|
@ -35,18 +35,6 @@ init_generated_constants (void)
|
|||
setvar (cintern ("IMAGE-CLONE"), flocons (0), NIL);
|
||||
setvar (cintern ("PATTERN-CLONE"), flocons (1), NIL);
|
||||
|
||||
setvar (cintern ("NO-DITHER"), flocons (0), NIL);
|
||||
setvar (cintern ("FS-DITHER"), flocons (1), NIL);
|
||||
setvar (cintern ("FSLOWBLEED-DITHER"), flocons (2), NIL);
|
||||
setvar (cintern ("FIXED-DITHER"), flocons (3), NIL);
|
||||
setvar (cintern ("NODESTRUCT-DITHER"), flocons (4), NIL);
|
||||
|
||||
setvar (cintern ("MAKE-PALETTE"), flocons (0), NIL);
|
||||
setvar (cintern ("REUSE-PALETTE"), flocons (1), NIL);
|
||||
setvar (cintern ("WEB-PALETTE"), flocons (2), NIL);
|
||||
setvar (cintern ("MONO-PALETTE"), flocons (3), NIL);
|
||||
setvar (cintern ("CUSTOM-PALETTE"), flocons (4), NIL);
|
||||
|
||||
setvar (cintern ("BLUR-CONVOLVE"), flocons (0), NIL);
|
||||
setvar (cintern ("SHARPEN-CONVOLVE"), flocons (1), NIL);
|
||||
setvar (cintern ("CUSTOM-CONVOLVE"), flocons (2), NIL);
|
||||
|
@ -84,6 +72,18 @@ init_generated_constants (void)
|
|||
setvar (cintern ("INDEXED-CHANNEL"), flocons (4), NIL);
|
||||
setvar (cintern ("ALPHA-CHANNEL"), flocons (5), NIL);
|
||||
|
||||
setvar (cintern ("NO-DITHER"), flocons (0), NIL);
|
||||
setvar (cintern ("FS-DITHER"), flocons (1), NIL);
|
||||
setvar (cintern ("FSLOWBLEED-DITHER"), flocons (2), NIL);
|
||||
setvar (cintern ("FIXED-DITHER"), flocons (3), NIL);
|
||||
setvar (cintern ("NODESTRUCT-DITHER"), flocons (4), NIL);
|
||||
|
||||
setvar (cintern ("MAKE-PALETTE"), flocons (0), NIL);
|
||||
setvar (cintern ("REUSE-PALETTE"), flocons (1), NIL);
|
||||
setvar (cintern ("WEB-PALETTE"), flocons (2), NIL);
|
||||
setvar (cintern ("MONO-PALETTE"), flocons (3), NIL);
|
||||
setvar (cintern ("CUSTOM-PALETTE"), flocons (4), NIL);
|
||||
|
||||
setvar (cintern ("NORMAL-CONVOL"), flocons (0), NIL);
|
||||
setvar (cintern ("ABSOLUTE-CONVOL"), flocons (1), NIL);
|
||||
setvar (cintern ("NEGATIVE-CONVOL"), flocons (2), NIL);
|
||||
|
|
|
@ -196,28 +196,6 @@ package Gimp::CodeGen::enums;
|
|||
CLIP_TO_BOTTOM_LAYER => '2',
|
||||
FLATTEN_IMAGE => '3' }
|
||||
},
|
||||
ConvertPaletteType =>
|
||||
{ contig => 1,
|
||||
header => 'core/core-types.h',
|
||||
symbols => [ qw(MAKE_PALETTE REUSE_PALETTE WEB_PALETTE
|
||||
MONO_PALETTE CUSTOM_PALETTE) ],
|
||||
mapping => { MAKE_PALETTE => '0',
|
||||
REUSE_PALETTE => '1',
|
||||
WEB_PALETTE => '2',
|
||||
MONO_PALETTE => '3',
|
||||
CUSTOM_PALETTE => '4' }
|
||||
},
|
||||
ConvertDitherType =>
|
||||
{ contig => 1,
|
||||
header => 'core/core-types.h',
|
||||
symbols => [ qw(NO_DITHER FS_DITHER FSLOWBLEED_DITHER FIXED_DITHER
|
||||
NODESTRUCT_DITHER) ],
|
||||
mapping => { NO_DITHER => '0',
|
||||
FS_DITHER => '1',
|
||||
FSLOWBLEED_DITHER => '2',
|
||||
FIXED_DITHER => '3',
|
||||
NODESTRUCT_DITHER => '4' }
|
||||
},
|
||||
GimpImageBaseType =>
|
||||
{ contig => 1,
|
||||
header => 'core/core-enums.h',
|
||||
|
@ -287,6 +265,30 @@ package Gimp::CodeGen::enums;
|
|||
GIMP_BG_BUCKET_FILL => '1',
|
||||
GIMP_PATTERN_BUCKET_FILL => '2' }
|
||||
},
|
||||
GimpConvertPaletteType =>
|
||||
{ contig => 1,
|
||||
header => 'core/core-enums.h',
|
||||
symbols => [ qw(GIMP_MAKE_PALETTE GIMP_REUSE_PALETTE
|
||||
GIMP_WEB_PALETTE GIMP_MONO_PALETTE
|
||||
GIMP_CUSTOM_PALETTE) ],
|
||||
mapping => { GIMP_MAKE_PALETTE => '0',
|
||||
GIMP_REUSE_PALETTE => '1',
|
||||
GIMP_WEB_PALETTE => '2',
|
||||
GIMP_MONO_PALETTE => '3',
|
||||
GIMP_CUSTOM_PALETTE => '4' }
|
||||
},
|
||||
GimpConvertDitherType =>
|
||||
{ contig => 1,
|
||||
header => 'core/core-enums.h',
|
||||
symbols => [ qw(GIMP_NO_DITHER GIMP_FS_DITHER
|
||||
GIMP_FSLOWBLEED_DITHER GIMP_FIXED_DITHER
|
||||
GIMP_NODESTRUCT_DITHER) ],
|
||||
mapping => { GIMP_NO_DITHER => '0',
|
||||
GIMP_FS_DITHER => '1',
|
||||
GIMP_FSLOWBLEED_DITHER => '2',
|
||||
GIMP_FIXED_DITHER => '3',
|
||||
GIMP_NODESTRUCT_DITHER => '4' }
|
||||
},
|
||||
GimpFillType =>
|
||||
{ contig => 1,
|
||||
header => 'core/core-enums.h',
|
||||
|
|
|
@ -84,21 +84,21 @@ HELP
|
|||
|
||||
@inargs = (
|
||||
&std_image_arg,
|
||||
{ name => 'dither_type', type => 'enum ConvertDitherType',
|
||||
{ name => 'dither_type', type => 'enum GimpConvertDitherType',
|
||||
desc => 'dither type (0=none, 1=fs, 2=fs/low-bleed 3=fixed)' },
|
||||
{ name => 'palette_type', type => 'enum ConvertPaletteType',
|
||||
{ name => 'palette_type', type => 'enum GimpConvertPaletteType',
|
||||
desc => 'The type of palette to use: { %%desc%% }', no_success => 1 },
|
||||
{ name => 'num_cols', type => 'int32',
|
||||
desc => 'the number of colors to quantize to, ignored unless
|
||||
(palette_type == MAKE_PALETTE)' },
|
||||
(palette_type == GIMP_MAKE_PALETTE)' },
|
||||
{ name => 'alpha_dither', type => 'boolean',
|
||||
desc => 'dither transparency to fake partial opacity' },
|
||||
{ name => 'remove_unused', type => 'boolean',
|
||||
desc => 'remove unused or duplicate colour entries from final
|
||||
palette, ignored if (palette_type == MAKE_PALETTE)' },
|
||||
palette, ignored if (palette_type == GIMP_MAKE_PALETTE)' },
|
||||
{ name => 'palette', type => 'string',
|
||||
desc => 'The name of the custom palette to use, ignored unless
|
||||
(palette_type == CUSTOM_PALETTE)',
|
||||
(palette_type == GIMP_CUSTOM_PALETTE)',
|
||||
alias => 'palette_name' }
|
||||
);
|
||||
|
||||
|
@ -111,10 +111,10 @@ HELP
|
|||
{
|
||||
switch (dither_type)
|
||||
{
|
||||
case NO_DITHER:
|
||||
case FS_DITHER:
|
||||
case FSLOWBLEED_DITHER:
|
||||
case FIXED_DITHER:
|
||||
case GIMP_NO_DITHER:
|
||||
case GIMP_FS_DITHER:
|
||||
case GIMP_FSLOWBLEED_DITHER:
|
||||
case GIMP_FIXED_DITHER:
|
||||
break;
|
||||
default:
|
||||
success = FALSE;
|
||||
|
@ -123,17 +123,17 @@ HELP
|
|||
|
||||
switch (palette_type)
|
||||
{
|
||||
case MAKE_PALETTE:
|
||||
case GIMP_MAKE_PALETTE:
|
||||
if (num_cols < 1 || num_cols > MAXNUMCOLORS)
|
||||
success = FALSE;
|
||||
break;
|
||||
|
||||
case REUSE_PALETTE:
|
||||
case WEB_PALETTE:
|
||||
case MONO_PALETTE:
|
||||
case GIMP_REUSE_PALETTE:
|
||||
case GIMP_WEB_PALETTE:
|
||||
case GIMP_MONO_PALETTE:
|
||||
break;
|
||||
|
||||
case CUSTOM_PALETTE:
|
||||
case GIMP_CUSTOM_PALETTE:
|
||||
if (! gimp->palette_factory->container->num_children)
|
||||
gimp_data_factory_data_init (gimp->palette_factory, FALSE);
|
||||
|
||||
|
|
Loading…
Reference in New Issue