gimp/app/pdb/convert_cmds.c

274 lines
7.3 KiB
C
Raw Normal View History

/* The GIMP -- an image manipulation program
* Copyright (C) 1995-2000 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl. */
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
#include "config.h"
Win32 portability changes: * config.h.win32, README.win32: Small changes. * tools/pdbgen/pdb/*.pdb: Include <string.h>. * app/*_cmds.c: Autogenerated files reflect above changes. * libgimp/makefile.msc app/makefile.msc: Various updates, including new object files. Gtk+ directory now should be called gtk+ (not gtk-plus). Use win32-specific gdk subdir. Glib directory now should be called just glib. * libgimp/gimp.def: Updates. * libgimp/gimpfeatures.h.win32: Made current with gimpfeatures.h.in. * libgimp/gimpfileselection.c: Define S_ISDIR and S_ISREG if necessary. * tools/pdbgen/pdb/fileops.pdb: Must have a statement (even an empty one) after a label. * app/fileops_cmds.c: Autogenerated file reflects above changes. * app/crop.c: Include <string.h>. * app/{app_procs,batch,fileops,datafiles,errorconsole,general, plug_in,temp_buf,tile_swap}.c: Test NATIVE_WIN32, not _MSC_VER. (NATIVE_WIN32 means we are using the Microsoft C runtime, even if we might be compiling with gcc.) * app/fileops.c: Don't include <process.h> here. * app/fileops.h: Do include <process.h> here. * app/gimpparasite.c: Include config.h, guard inclusion of <unistd.h>. (Is the inclusion of unistd.h in source files all over the place really necessary?) * app/ink.c: MSC doesn't handle conversion from unsigned __int64 to double, so cast to signed. * app/lut_funcs.c: Include config.h, and define rint() if necessary. * app/pixel_processor.c: Include config.h without "..", like in all the other places. Include <string.h> * app/text_tool.c: Guard the "POINTS" identifier that clashes with <windows.h>, sigh.
1999-05-05 05:32:17 +08:00
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
#include <gtk/gtk.h>
#include "apptypes.h"
#include "procedural_db.h"
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
#include "context_manager.h"
#include "core/gimpcontainer.h"
#include "core/gimpdatafactory.h"
#include "core/gimpimage-convert.h"
#include "core/gimpimage.h"
#include "core/gimppalette.h"
static ProcRecord convert_rgb_proc;
static ProcRecord convert_grayscale_proc;
static ProcRecord convert_indexed_proc;
void
register_convert_procs (void)
{
procedural_db_register (&convert_rgb_proc);
procedural_db_register (&convert_grayscale_proc);
procedural_db_register (&convert_indexed_proc);
}
static Argument *
convert_rgb_invoker (Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage;
gimage = gimp_image_get_by_ID (args[0].value.pdb_int);
if (gimage == NULL)
success = FALSE;
if (success)
if ((success = (gimp_image_base_type (gimage) != RGB)))
gimp_image_convert ((void *) gimage, RGB, 0, 0, 0, 1, 0, NULL);
return procedural_db_return_args (&convert_rgb_proc, success);
}
static ProcArg convert_rgb_inargs[] =
{
{
PDB_IMAGE,
"image",
"The image"
}
};
static ProcRecord convert_rgb_proc =
{
"gimp_convert_rgb",
"Convert specified image to RGB color",
"This procedure converts the specified image to RGB color. This process requires an image of type GRAY or INDEXED. No image content is lost in this process aside from the colormap for an indexed image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
PDB_INTERNAL,
1,
convert_rgb_inargs,
0,
NULL,
{ { convert_rgb_invoker } }
};
static Argument *
convert_grayscale_invoker (Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage;
gimage = gimp_image_get_by_ID (args[0].value.pdb_int);
if (gimage == NULL)
success = FALSE;
if (success)
if ((success = (gimp_image_base_type (gimage) != GRAY)))
gimp_image_convert ((void *) gimage, GRAY, 0, 0, 0, 1, 0, NULL);
return procedural_db_return_args (&convert_grayscale_proc, success);
}
static ProcArg convert_grayscale_inargs[] =
{
{
PDB_IMAGE,
"image",
"The image"
}
};
static ProcRecord convert_grayscale_proc =
{
"gimp_convert_grayscale",
"Convert specified image to grayscale (256 intensity levels)",
"This procedure converts the specified image to grayscale with 8 bits per pixel (256 intensity levels). This process requires an image of type RGB or INDEXED.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
PDB_INTERNAL,
1,
convert_grayscale_inargs,
0,
NULL,
{ { convert_grayscale_invoker } }
};
static Argument *
convert_indexed_invoker (Argument *args)
{
gboolean success = TRUE;
GimpImage *gimage;
gint32 dither_type;
gint32 palette_type;
gint32 num_cols;
gboolean alpha_dither;
gboolean remove_unused;
gchar *palette_name;
gimage = gimp_image_get_by_ID (args[0].value.pdb_int);
if (gimage == NULL)
success = FALSE;
dither_type = args[1].value.pdb_int;
if (dither_type < NO_DITHER || dither_type > NODESTRUCT_DITHER)
success = FALSE;
palette_type = args[2].value.pdb_int;
num_cols = args[3].value.pdb_int;
alpha_dither = args[4].value.pdb_int ? TRUE : FALSE;
remove_unused = args[5].value.pdb_int ? TRUE : FALSE;
palette_name = (gchar *) args[6].value.pdb_pointer;
if (palette_name == NULL)
success = FALSE;
if (success)
{
GimpPalette *palette = NULL;
if ((success = (gimp_image_base_type (gimage) != INDEXED)))
{
switch (dither_type)
{
case NO_DITHER:
case FS_DITHER:
case FSLOWBLEED_DITHER:
case FIXED_DITHER:
break;
default:
success = FALSE;
break;
}
switch (palette_type)
{
case MAKE_PALETTE:
if (num_cols < 1 || num_cols > MAXNUMCOLORS)
success = FALSE;
break;
case REUSE_PALETTE:
case WEB_PALETTE:
case MONO_PALETTE:
break;
case CUSTOM_PALETTE:
gimprc.in user_install user_install.bat app/gimprc.[ch] removed the 2001-02-13 Michael Natterer <mitch@gimp.org> * gimprc.in * user_install * user_install.bat * app/gimprc.[ch] * app/preferences_dialog.c: removed the "brush_vbr_path" variable, because all data types will be editable and saveable soon. * app/Makefile.am * app/apptypes.h * app/gimpdatafactory.[ch]: new object which holds a data list and knows how to create, edit, duplicate etc. the items in it. Will completely replace the brushes.[ch], patterns.[ch], ... files soon. * po/POTFILES.in * app/gimpdatacontainerview.[ch]: removed. * app/gimpdatafactoryview.[ch]: added. A view on the GimpDataFactory with a GUI for creating, editing, deleting etc. items (mostly unimplemented). * app/context_manager.[ch]: replaced the global data lists by global data factories. * app/brush_select.c * app/brushes.[ch] * app/commands.c * app/convert.c * app/devices.c * app/gimpbrush.[ch] * app/gimpbrushgenerated.c * app/gimpcontext.c * app/gimpdata.[ch] * app/gimpdatalist.[ch] * app/gimpdnd.c * app/gimpgradient.[ch] * app/gimppalette.[ch] * app/gimppattern.[ch] * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/indicator_area.c * app/palette.c * app/palette_import.c * app/palette_select.c * app/palettes.[ch] * app/pattern_select.c * app/patterns.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-14 03:53:07 +08:00
if (! global_palette_factory->container->num_children)
2001-02-14 09:42:12 +08:00
gimp_data_factory_data_init (global_palette_factory, FALSE);
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
palette = (GimpPalette *)
gimprc.in user_install user_install.bat app/gimprc.[ch] removed the 2001-02-13 Michael Natterer <mitch@gimp.org> * gimprc.in * user_install * user_install.bat * app/gimprc.[ch] * app/preferences_dialog.c: removed the "brush_vbr_path" variable, because all data types will be editable and saveable soon. * app/Makefile.am * app/apptypes.h * app/gimpdatafactory.[ch]: new object which holds a data list and knows how to create, edit, duplicate etc. the items in it. Will completely replace the brushes.[ch], patterns.[ch], ... files soon. * po/POTFILES.in * app/gimpdatacontainerview.[ch]: removed. * app/gimpdatafactoryview.[ch]: added. A view on the GimpDataFactory with a GUI for creating, editing, deleting etc. items (mostly unimplemented). * app/context_manager.[ch]: replaced the global data lists by global data factories. * app/brush_select.c * app/brushes.[ch] * app/commands.c * app/convert.c * app/devices.c * app/gimpbrush.[ch] * app/gimpbrushgenerated.c * app/gimpcontext.c * app/gimpdata.[ch] * app/gimpdatalist.[ch] * app/gimpdnd.c * app/gimpgradient.[ch] * app/gimppalette.[ch] * app/gimppattern.[ch] * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/indicator_area.c * app/palette.c * app/palette_import.c * app/palette_select.c * app/palettes.[ch] * app/pattern_select.c * app/patterns.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-14 03:53:07 +08:00
gimp_container_get_child_by_name (global_palette_factory->container,
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
palette_name);
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
if (palette == NULL)
success = FALSE;
break;
default:
success = FALSE;
}
}
if (success)
gimp_image_convert ((void *) gimage, INDEXED, num_cols, dither_type,
alpha_dither, remove_unused, palette_type, palette);
}
return procedural_db_return_args (&convert_indexed_proc, success);
}
static ProcArg convert_indexed_inargs[] =
{
{
PDB_IMAGE,
"image",
"The image"
},
{
PDB_INT32,
"dither_type",
"dither type (0=none, 1=fs, 2=fs/low-bleed 3=fixed)"
},
{
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) }"
},
{
PDB_INT32,
"num_cols",
"the number of colors to quantize to, ignored unless (palette_type == MAKE_PALETTE)"
},
{
PDB_INT32,
"alpha_dither",
"dither transparency to fake partial opacity"
},
{
PDB_INT32,
"remove_unused",
"remove unused or duplicate colour entries from final palette, ignored if (palette_type == MAKE_PALETTE)"
},
{
PDB_STRING,
"palette",
"The name of the custom palette to use, ignored unless (palette_type == CUSTOM_PALETTE)"
}
};
static ProcRecord convert_indexed_proc =
{
"gimp_convert_indexed",
"Convert specified image to and Indexed image",
"This procedure converts the specified image to 'indexed' color. This process requires an image of type GRAY or RGB. The 'palette_type' specifies what kind of palette to use, A type of '0' means to use an optimal palette of 'num_cols' generated from the colors in the image. A type of '1' means to re-use the previous palette (not currently implemented). A type of '2' means to use the so-called WWW-optimized palette. Type '3' means to use only black and white colors. A type of '4' means to use a palette from the gimp palettes directories. The 'dither type' specifies what kind of dithering to use. '0' means no dithering, '1' means standard Floyd-Steinberg error diffusion, '2' means Floyd-Steinberg error diffusion with reduced bleeding, '3' means dithering based on pixel location ('Fixed' dithering).",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
PDB_INTERNAL,
7,
convert_indexed_inargs,
0,
NULL,
{ { convert_indexed_invoker } }
};