gimp/plug-ins/common/compose.c

1703 lines
50 KiB
C
Raw Normal View History

1997-11-25 06:05:25 +08:00
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Compose plug-in (C) 1997,1999 Peter Kirchgessner
* e-mail: peter@kirchgessner.net, WWW: http://www.kirchgessner.net
1997-11-25 06:05:25 +08:00
*
* 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.
1997-11-25 06:05:25 +08:00
*/
/*
* This plug-in composes RGB-images from several types of channels
*/
/* Lab colorspace support originally written by Alexey Dyachenko,
* merged into the official plug-in by Sven Neumann.
*
* Support for channels empty or filled with a single mask value
* added by Sylvain FORET.
1997-11-25 06:05:25 +08:00
*/
#include "config.h"
1997-11-25 06:05:25 +08:00
#include <string.h>
2000-01-11 23:48:00 +08:00
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
configure.in removed tips files, AC_SUBST GIMP_PLUGINS and GIMP_MODULES so * configure.in * Makefile.am: removed tips files, AC_SUBST GIMP_PLUGINS and GIMP_MODULES so you can easily skip those parts of the build * acinclude.m4 * config.sub * config.guess * ltconfig * ltmain.sh: libtool 1.3.2 * app/fileops.c: shuffle #includes to avoid warning about MIN and MAX [ The following is a big i18n patch from David Monniaux <david.monniaux@ens.fr> ] * tips/gimp_conseils.fr.txt * tips/gimp_tips.txt * tips/Makefile.am * configure.in: moved tips to separate dir * po-plugins: new dir for plug-in translation files * configure.in: add po-plugins dir and POTFILES processing * app/boundary.c * app/brightness_contrast.c * app/by_color_select.c * app/color_balance.c * app/convert.c * app/curves.c * app/free_select.c * app/gdisplay.c * app/gimpimage.c * app/gimpunit.c * app/gradient.c * app/gradient_select.c * app/install.c * app/session.c: various i18n tweaks * app/tips_dialog.c: localize tips filename * libgimp/gimpunit.c * libgimp/gimpunitmenu.c: #include "config.h" * plug-ins/CEL * plug-ins/CML_explorer * plug-ins/Lighting * plug-ins/apply_lens * plug-ins/autostretch_hsv * plug-ins/blur * plug-ins/bmp * plug-ins/borderaverage * plug-ins/bumpmap * plug-ins/bz2 * plug-ins/checkerboard * plug-ins/colorify * plug-ins/compose * plug-ins/convmatrix * plug-ins/cubism * plug-ins/depthmerge * plug-ins/destripe * plug-ins/gif * plug-ins/gifload * plug-ins/jpeg * plug-ins/mail * plug-ins/oilify * plug-ins/png * plug-ins/print * plug-ins/ps * plug-ins/xbm * plug-ins/xpm * plug-ins/xwd: plug-in i18n stuff -Yosh
1999-05-30 00:35:47 +08:00
#include "libgimp/stdplugins-intl.h"
#define COMPOSE_PROC "plug-in-compose"
#define DRAWABLE_COMPOSE_PROC "plug-in-drawable-compose"
#define RECOMPOSE_PROC "plug-in-recompose"
#define PLUG_IN_BINARY "compose"
typedef struct
{
union
{
gint32 ID; /* Image ID of input images or drawable */
guchar val; /* Mask value to compose with */
} comp;
gboolean is_ID;
} ComposeInput;
1997-11-25 06:05:25 +08:00
/* Declare local functions
*/
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
1997-11-25 06:05:25 +08:00
static gint32 compose (const gchar *compose_type,
ComposeInput *inputs,
gboolean compose_by_drawable);
1997-11-25 06:05:25 +08:00
static gint32 create_new_image (const gchar *filename,
guint width,
guint height,
GimpImageType gdtype,
gint32 *layer_ID,
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
GimpDrawable **drawable,
GimpPixelRgn *pixel_rgn);
1997-11-25 06:05:25 +08:00
static void compose_rgb (guchar **src,
gint *incr, gint numpix, guchar *dst,
gboolean dst_has_alpha);
static void compose_rgba (guchar **src,
gint *incr, gint numpix, guchar *dst,
gboolean dst_has_alpha);
static void compose_hsv (guchar **src,
gint *incr, gint numpix, guchar *dst,
gboolean dst_has_alpha);
static void compose_cmy (guchar **src,
gint *incr, gint numpix, guchar *ds,
gboolean dst_has_alpha);
static void compose_cmyk (guchar **src,
gint *incr, gint numpix, guchar *dst,
gboolean dst_has_alpha);
static void compose_lab (guchar **src,
gint *incr, gint numpix, guchar *dst,
gboolean dst_has_alpha);
static void compose_ycbcr470 (guchar **src,
gint *incr, gint numpix, guchar *dst,
gboolean dst_has_alpha);
static void compose_ycbcr709 (guchar **src,
gint *incr, gint numpix, guchar *dst,
gboolean dst_has_alpha);
static void compose_ycbcr470f (guchar **src,
gint *incr, gint numpix, guchar *dst,
gboolean dst_has_alpha);
static void compose_ycbcr709f (guchar **src,
gint *incr, gint numpix, guchar *dst,
gboolean dst_has_alpha);
static gboolean compose_dialog (const gchar *compose_type,
gint32 drawable_ID);
static gboolean check_gray (gint32 image_id,
gint32 drawable_id,
gpointer data);
1997-11-25 06:05:25 +08:00
static void combo_callback (GimpIntComboBox *cbox,
gpointer data);
static void scale_callback (GtkAdjustment *adj,
ComposeInput *input);
static void check_response (GtkWidget *dlg,
gint response,
gpointer data);
1997-11-25 06:05:25 +08:00
static void compose_type_toggle_update (GtkWidget *widget,
gpointer data);
/* LAB colorspace constants */
const double Xn = 0.951;
const double Yn = 1.0;
const double Zn = 1.089;
1997-11-25 06:05:25 +08:00
/* Maximum number of images to compose */
#define MAX_COMPOSE_IMAGES 4
/* Description of a composition */
typedef struct
{
const gchar *compose_type; /* Type of composition ("RGB", "RGBA",...) */
gint num_images; /* Number of input images needed */
/* Channel names and stock ids for dialog */
const gchar *channel_name[MAX_COMPOSE_IMAGES];
const gchar *channel_icon[MAX_COMPOSE_IMAGES];
const gchar *filename; /* Name of new image */
/* Compose functon */
void (* compose_fun) (guchar **src,
gint *incr_src,
gint numpix,
guchar *dst,
gboolean dst_has_alpha);
1997-11-25 06:05:25 +08:00
} COMPOSE_DSC;
/* Array of available compositions. */
static COMPOSE_DSC compose_dsc[] =
{
{ N_("RGB"), 3,
{ N_("Red:"),
N_("Green:"),
N_("Blue:"),
NULL },
{ GIMP_STOCK_CHANNEL_RED,
GIMP_STOCK_CHANNEL_GREEN,
GIMP_STOCK_CHANNEL_BLUE,
NULL },
"rgb-compose", compose_rgb },
{ N_("RGBA"), 4,
{ N_("Red:"),
N_("Green:"),
N_("Blue:"),
N_("Alpha:") },
{ GIMP_STOCK_CHANNEL_RED,
GIMP_STOCK_CHANNEL_GREEN,
GIMP_STOCK_CHANNEL_BLUE,
GIMP_STOCK_CHANNEL_ALPHA },
"rgba-compose", compose_rgba },
{ N_("HSV"), 3,
{ N_("Hue:"),
N_("Saturation:"),
N_("Value:"),
NULL },
{ NULL, NULL, NULL, NULL },
"hsv-compose", compose_hsv },
{ N_("CMY"), 3,
{ N_("Cyan:"),
N_("Magenta:"),
N_("Yellow:"),
NULL },
{ NULL, NULL, NULL, NULL },
"cmy-compose", compose_cmy },
{ N_("CMYK"), 4,
{ N_("Cyan:"),
N_("Magenta:"),
N_("Yellow:"),
N_("Black:") },
{ NULL, NULL, NULL, NULL },
"cmyk-compose", compose_cmyk },
{ N_("LAB"), 3,
{ "L",
"A",
"B",
NULL },
{ NULL, NULL, NULL, NULL },
"lab-compose", compose_lab },
{ "YCbCr_ITU_R470", 3,
{ N_("Luma_y470:"),
N_("Blueness_cb470:"),
N_("Redness_cr470:"),
NULL },
{ NULL, NULL, NULL, NULL },
"ycbcr470-compose", compose_ycbcr470 },
{ "YCbCr_ITU_R709", 3,
{ N_("Luma_y709:"),
N_("Blueness_cb709:"),
N_("Redness_cr709:"),
NULL },
{ NULL, NULL, NULL, NULL },
"ycbcr709-compose", compose_ycbcr709 },
{ "YCbCr_ITU_R470_256", 3,
{ N_("Luma_y470f:"),
N_("Blueness_cb470f:"),
N_("Redness_cr470f:"),
NULL },
{ NULL, NULL, NULL, NULL },
"ycbcr470F-compose", compose_ycbcr470f },
{ "YCbCr_ITU_R709_256", 3,
{ N_("Luma_y709f:"),
N_("Blueness_cb709f:"),
N_("Redness_cr709f:"),
NULL },
{ NULL, NULL, NULL, NULL },
"ycbcr709F-compose", compose_ycbcr709f },
1997-11-25 06:05:25 +08:00
};
typedef struct
{
ComposeInput inputs[MAX_COMPOSE_IMAGES]; /* Image IDs or mask value of input */
gchar compose_type[32]; /* type of composition */
gboolean do_recompose;
gint32 source_layer_ID; /* for recomposing */
1997-11-25 06:05:25 +08:00
} ComposeVals;
/* Dialog structure */
typedef struct
{
gint width, height; /* Size of selected image */
GtkWidget *channel_label[MAX_COMPOSE_IMAGES]; /* The labels to change */
GtkWidget *channel_icon[MAX_COMPOSE_IMAGES]; /* The icons */
GtkWidget *channel_menu[MAX_COMPOSE_IMAGES]; /* The menus */
GtkWidget *color_scales[MAX_COMPOSE_IMAGES]; /* The values color scales */
GtkWidget *color_spins[MAX_COMPOSE_IMAGES]; /* The values spin buttons */
1997-11-25 06:05:25 +08:00
ComposeInput selected[MAX_COMPOSE_IMAGES]; /* Image Ids or mask values from menus */
gint compose_flag[G_N_ELEMENTS (compose_dsc)]; /* Toggle data of compose type */
1997-11-25 06:05:25 +08:00
} ComposeInterface;
GimpPlugInInfo PLUG_IN_INFO =
1997-11-25 06:05:25 +08:00
{
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
1997-11-25 06:05:25 +08:00
};
static ComposeVals composevals =
{
{{{ 0 }}}, /* Image IDs of images to compose or mask values */
"rgb", /* Type of composition */
FALSE, /* Do recompose */
-1 /* source layer ID */
1997-11-25 06:05:25 +08:00
};
static ComposeInterface composeint =
{
0, 0, /* width, height */
{ NULL }, /* Label Widgets */
{ NULL }, /* Icon Widgets */
{ NULL }, /* Menu Widgets */
{ NULL }, /* Color Scale Widgets */
{ NULL }, /* Color Spin Widgets */
{{{ 0 }}}, /* Image Ids or mask values from menus */
{ 0 } /* Compose type toggle flags */
1997-11-25 06:05:25 +08:00
};
static GimpRunMode run_mode;
1997-11-25 06:05:25 +08:00
MAIN ()
static void
query (void)
1997-11-25 06:05:25 +08:00
{
static GimpParamDef args[] =
1997-11-25 06:05:25 +08:00
{
{ GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image1", "First input image" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable (not used)" },
{ GIMP_PDB_IMAGE, "image2", "Second input image" },
{ GIMP_PDB_IMAGE, "image3", "Third input image" },
{ GIMP_PDB_IMAGE, "image4", "Fourth input image" },
{ GIMP_PDB_STRING, "compose-type", "What to compose: RGB, RGBA, HSV, CMY, CMYK" },
{ GIMP_PDB_INT8, "value1", "Mask value if image 1 is -1" },
{ GIMP_PDB_INT8, "value2", "Mask value if image 2 is -1" },
{ GIMP_PDB_INT8, "value3", "Mask value if image 3 is -1" },
{ GIMP_PDB_INT8, "value4", "Mask value if image 4 is -1" }
1997-11-25 06:05:25 +08:00
};
static GimpParamDef return_vals[] =
1997-11-25 06:05:25 +08:00
{
{ GIMP_PDB_IMAGE, "new_image", "Output image" }
1997-11-25 06:05:25 +08:00
};
static GimpParamDef drw_args[] =
{
{ GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image1", "First input image (not used)" },
{ GIMP_PDB_DRAWABLE, "drawable1", "First input drawable" },
{ GIMP_PDB_DRAWABLE, "drawable2", "Second input drawable" },
{ GIMP_PDB_DRAWABLE, "drawable3", "Third input drawable" },
{ GIMP_PDB_DRAWABLE, "drawable4", "Fourth input drawable" },
{ GIMP_PDB_STRING, "compose-type", "What to compose: RGB, RGBA, HSV, CMY, CMYK" },
{ GIMP_PDB_INT8, "value1", "Mask value if image 1 is -1" },
{ GIMP_PDB_INT8, "value2", "Mask value if image 2 is -1" },
{ GIMP_PDB_INT8, "value3", "Mask value if image 3 is -1" },
{ GIMP_PDB_INT8, "value4", "Mask value if image 4 is -1" }
};
static GimpParamDef drw_return_vals[] =
{
{ GIMP_PDB_IMAGE, "new_image", "Output image" }
};
static GimpParamDef recompose_args[] =
{
{ GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Image to recompose from" },
{ GIMP_PDB_DRAWABLE, "drawable", "Not used" },
};
gimp_install_procedure (COMPOSE_PROC,
2000-01-31 10:32:30 +08:00
"Compose an image from multiple gray images",
"This function creates a new image from "
"multiple gray images",
1997-11-25 06:05:25 +08:00
"Peter Kirchgessner",
"Peter Kirchgessner (peter@kirchgessner.net)",
1997-11-25 06:05:25 +08:00
"1997",
Changed plug-in menu registration again to allow passing just the menu 2004-05-07 Michael Natterer <mitch@gimp.org> Changed plug-in menu registration again to allow passing just the menu item's label (not the full path) in gimp_install_procedure() and only the path (excluding the item's label) in gimp_plugin_menu_register(). Matches the internal action system better and makes translating the menu paths much easier. (Of yourse it's still possible to use the old syntax for backward compatibility). * app/plug-in/plug-in-proc.[ch]: added "gchar *menu_label". * app/plug-in/plug-in-params.[ch]: added new functions plug_in_param_defs_check() and plug_in_proc_args_check() which check if a procedure's parameters match its menu location (e.g. <Image> needs RUN-MODE, IMAGE, DRAWABLE). * app/plug-in/plug-in-message.c (plug_in_handle_proc_install): if registering an old-style (full) menu_path, use plug_in_param_defs_check(), set proc_def->menu_label otherwise. * tools/pdbgen/pdb/plug_in.pdb (plugin_menu_register): use plug_in_proc_args_check() on the passed menu_path and make sugre old and new style menu registration are not mixed. * app/pdb/plug_in_cmds.c: regenerated. * app/plug-in/plug-in-rc.c: save/restore "menu_label". * app/actions/file-dialog-actions.c * app/actions/plug-in-actions.c * app/menus/plug-in-menus.c: changed action/menu creation accordingly. Some hacks needed to allow both old and new style menu_label/menu_paths. * app/plug-in/plug-in.c * app/widgets/gimpfiledialog.c * app/xcf/xcf.c: changed accordingly. * plug-ins/common/align_layers.c * plug-ins/common/animationplay.c * plug-ins/common/animoptimize.c * plug-ins/common/apply_lens.c * plug-ins/common/autocrop.c * plug-ins/common/autostretch_hsv.c * plug-ins/common/blinds.c * plug-ins/common/blur.c * plug-ins/common/borderaverage.c * plug-ins/common/bumpmap.c * plug-ins/common/c_astretch.c * plug-ins/common/ccanalyze.c * plug-ins/common/channel_mixer.c * plug-ins/common/checkerboard.c * plug-ins/common/color_enhance.c * plug-ins/common/colorify.c * plug-ins/common/colortoalpha.c * plug-ins/common/compose.c * plug-ins/common/convmatrix.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/decompose.c * plug-ins/common/deinterlace.c * plug-ins/common/depthmerge.c * plug-ins/common/destripe.c * plug-ins/common/diffraction.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/emboss.c * plug-ins/common/engrave.c * plug-ins/common/exchange.c * plug-ins/common/film.c * plug-ins/common/flarefx.c * plug-ins/common/fractaltrace.c * plug-ins/common/screenshot.c: ported the first few plug-ins to the new registration scheme.
2004-05-07 08:30:24 +08:00
N_("C_ompose..."),
"GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args),
G_N_ELEMENTS (return_vals),
1997-11-25 06:05:25 +08:00
args, return_vals);
gimp_plugin_menu_register (COMPOSE_PROC, "<Image>/Colors/Components");
Changed plug-in menu registration again to allow passing just the menu 2004-05-07 Michael Natterer <mitch@gimp.org> Changed plug-in menu registration again to allow passing just the menu item's label (not the full path) in gimp_install_procedure() and only the path (excluding the item's label) in gimp_plugin_menu_register(). Matches the internal action system better and makes translating the menu paths much easier. (Of yourse it's still possible to use the old syntax for backward compatibility). * app/plug-in/plug-in-proc.[ch]: added "gchar *menu_label". * app/plug-in/plug-in-params.[ch]: added new functions plug_in_param_defs_check() and plug_in_proc_args_check() which check if a procedure's parameters match its menu location (e.g. <Image> needs RUN-MODE, IMAGE, DRAWABLE). * app/plug-in/plug-in-message.c (plug_in_handle_proc_install): if registering an old-style (full) menu_path, use plug_in_param_defs_check(), set proc_def->menu_label otherwise. * tools/pdbgen/pdb/plug_in.pdb (plugin_menu_register): use plug_in_proc_args_check() on the passed menu_path and make sugre old and new style menu registration are not mixed. * app/pdb/plug_in_cmds.c: regenerated. * app/plug-in/plug-in-rc.c: save/restore "menu_label". * app/actions/file-dialog-actions.c * app/actions/plug-in-actions.c * app/menus/plug-in-menus.c: changed action/menu creation accordingly. Some hacks needed to allow both old and new style menu_label/menu_paths. * app/plug-in/plug-in.c * app/widgets/gimpfiledialog.c * app/xcf/xcf.c: changed accordingly. * plug-ins/common/align_layers.c * plug-ins/common/animationplay.c * plug-ins/common/animoptimize.c * plug-ins/common/apply_lens.c * plug-ins/common/autocrop.c * plug-ins/common/autostretch_hsv.c * plug-ins/common/blinds.c * plug-ins/common/blur.c * plug-ins/common/borderaverage.c * plug-ins/common/bumpmap.c * plug-ins/common/c_astretch.c * plug-ins/common/ccanalyze.c * plug-ins/common/channel_mixer.c * plug-ins/common/checkerboard.c * plug-ins/common/color_enhance.c * plug-ins/common/colorify.c * plug-ins/common/colortoalpha.c * plug-ins/common/compose.c * plug-ins/common/convmatrix.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/decompose.c * plug-ins/common/deinterlace.c * plug-ins/common/depthmerge.c * plug-ins/common/destripe.c * plug-ins/common/diffraction.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/emboss.c * plug-ins/common/engrave.c * plug-ins/common/exchange.c * plug-ins/common/film.c * plug-ins/common/flarefx.c * plug-ins/common/fractaltrace.c * plug-ins/common/screenshot.c: ported the first few plug-ins to the new registration scheme.
2004-05-07 08:30:24 +08:00
gimp_install_procedure (DRAWABLE_COMPOSE_PROC,
2000-01-31 10:32:30 +08:00
"Compose an image from multiple drawables of gray images",
"This function creates a new image from "
"multiple drawables of gray images",
"Peter Kirchgessner",
"Peter Kirchgessner (peter@kirchgessner.net)",
"1998",
NULL, /* It is not available in interactive mode */
"GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (drw_args),
G_N_ELEMENTS (drw_return_vals),
drw_args, drw_return_vals);
gimp_install_procedure (RECOMPOSE_PROC,
"Recompose a layer from multiple drawables of gray images",
"This function recombines the grayscale layers produced "
"by Decompose into a single RGB or RGBA layer, and "
"replaces the originally decomposed layer with the "
"result.",
"Bill Skaggs",
"Bill Skaggs",
"2004",
N_("R_ecompose"),
"GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (recompose_args), 0,
recompose_args, NULL);
gimp_plugin_menu_register (RECOMPOSE_PROC, "<Image>/Colors/Components");
1997-11-25 06:05:25 +08:00
}
1997-11-25 06:05:25 +08:00
static void
run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
1997-11-25 06:05:25 +08:00
{
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
static GimpParam values[2];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 image_ID;
gint32 drawable_ID = -1;
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
gint compose_by_drawable;
gint i;
1997-11-25 06:05:25 +08:00
INIT_I18N ();
configure.in removed tips files, AC_SUBST GIMP_PLUGINS and GIMP_MODULES so * configure.in * Makefile.am: removed tips files, AC_SUBST GIMP_PLUGINS and GIMP_MODULES so you can easily skip those parts of the build * acinclude.m4 * config.sub * config.guess * ltconfig * ltmain.sh: libtool 1.3.2 * app/fileops.c: shuffle #includes to avoid warning about MIN and MAX [ The following is a big i18n patch from David Monniaux <david.monniaux@ens.fr> ] * tips/gimp_conseils.fr.txt * tips/gimp_tips.txt * tips/Makefile.am * configure.in: moved tips to separate dir * po-plugins: new dir for plug-in translation files * configure.in: add po-plugins dir and POTFILES processing * app/boundary.c * app/brightness_contrast.c * app/by_color_select.c * app/color_balance.c * app/convert.c * app/curves.c * app/free_select.c * app/gdisplay.c * app/gimpimage.c * app/gimpunit.c * app/gradient.c * app/gradient_select.c * app/install.c * app/session.c: various i18n tweaks * app/tips_dialog.c: localize tips filename * libgimp/gimpunit.c * libgimp/gimpunitmenu.c: #include "config.h" * plug-ins/CEL * plug-ins/CML_explorer * plug-ins/Lighting * plug-ins/apply_lens * plug-ins/autostretch_hsv * plug-ins/blur * plug-ins/bmp * plug-ins/borderaverage * plug-ins/bumpmap * plug-ins/bz2 * plug-ins/checkerboard * plug-ins/colorify * plug-ins/compose * plug-ins/convmatrix * plug-ins/cubism * plug-ins/depthmerge * plug-ins/destripe * plug-ins/gif * plug-ins/gifload * plug-ins/jpeg * plug-ins/mail * plug-ins/oilify * plug-ins/png * plug-ins/print * plug-ins/ps * plug-ins/xbm * plug-ins/xpm * plug-ins/xwd: plug-in i18n stuff -Yosh
1999-05-30 00:35:47 +08:00
1997-11-25 06:05:25 +08:00
run_mode = param[0].data.d_int32;
compose_by_drawable = (strcmp (name, DRAWABLE_COMPOSE_PROC) == 0);
1997-11-25 06:05:25 +08:00
*nreturn_vals = 2;
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
*return_vals = values;
1997-11-25 06:05:25 +08:00
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
values[0].type = GIMP_PDB_STATUS;
1997-11-25 06:05:25 +08:00
values[0].data.d_status = status;
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
values[1].type = GIMP_PDB_IMAGE;
values[1].data.d_int32 = -1;
1997-11-25 06:05:25 +08:00
if (strcmp (name, RECOMPOSE_PROC) == 0)
1997-11-25 06:05:25 +08:00
{
gint nlayers;
gint nret;
GimpParasite *parasite = gimp_image_parasite_find (param[1].data.d_image,
"decompose-data");
if (! parasite)
{
g_message (_("You can only run 'Recompose' if the active image"
" was originally produced by 'Decompose'."));
return;
}
nret = sscanf (parasite->data, "source=%d type=%s %d %d %d %d",
&composevals.source_layer_ID,
composevals.compose_type,
&composevals.inputs[0].comp.ID,
&composevals.inputs[1].comp.ID,
&composevals.inputs[2].comp.ID,
&composevals.inputs[3].comp.ID);
for (i = 0; i < MAX_COMPOSE_IMAGES; i++)
composevals.inputs[i].is_ID = FALSE;
if (nret < 5)
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
{
g_message (_("Error scanning 'decompose-data' parasite: "
"too few layers found"));
return;
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
}
nlayers = nret - 2;
composevals.do_recompose = TRUE;
compose_by_drawable = TRUE;
1997-11-25 06:05:25 +08:00
}
else
{
composevals.do_recompose = FALSE;
1997-11-25 06:05:25 +08:00
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
/* Possibly retrieve data */
gimp_get_data (name , &composevals);
1997-11-25 06:05:25 +08:00
/* The dialog is now drawable based. Get a drawable-ID of the image */
if (strcmp (name, COMPOSE_PROC) == 0)
{
gint32 *layer_list;
gint nlayers;
layer_list = gimp_image_get_layers (param[1].data.d_int32, &nlayers);
if ((layer_list == NULL) || (nlayers <= 0))
{
g_message (_("Could not get layers for image %d"),
(gint) param[1].data.d_int32);
return;
}
drawable_ID = layer_list[0];
g_free (layer_list);
}
else
{
drawable_ID = param[2].data.d_int32;
}
compose_by_drawable = TRUE;
/* First acquire information with a dialog */
if (! compose_dialog (composevals.compose_type, drawable_ID))
return;
1997-11-25 06:05:25 +08:00
break;
case GIMP_RUN_NONINTERACTIVE:
/* Make sure all the arguments are there! */
if (nparams < 7)
{
status = GIMP_PDB_CALLING_ERROR;
}
else
{
composevals.inputs[0].comp.ID = (compose_by_drawable ?
param[2].data.d_int32 :
param[1].data.d_int32);
composevals.inputs[1].comp.ID = param[3].data.d_int32;
composevals.inputs[2].comp.ID = param[4].data.d_int32;
composevals.inputs[3].comp.ID = param[5].data.d_int32;
strncpy (composevals.compose_type, param[6].data.d_string,
sizeof (composevals.compose_type));
composevals.compose_type[sizeof (composevals.compose_type)-1] = '\0';
for (i = 0; i < MAX_COMPOSE_IMAGES; i++)
{
if (composevals.inputs[i].comp.ID == -1)
{
if (nparams < 8 + i)
{
status = GIMP_PDB_CALLING_ERROR;
break;
}
composevals.inputs[i].is_ID = FALSE;
composevals.inputs[i].comp.val = param[7 + i].data.d_int8;
}
else
composevals.inputs[i].is_ID = TRUE;
}
}
break;
case GIMP_RUN_WITH_LAST_VALS:
/* Possibly retrieve data */
gimp_get_data (name, &composevals);
break;
default:
break;
}
1997-11-25 06:05:25 +08:00
}
if (status == GIMP_PDB_SUCCESS)
1997-11-25 06:05:25 +08:00
{
gimp_progress_init (_("Composing..."));
1997-11-25 06:05:25 +08:00
image_ID = compose (composevals.compose_type,
composevals.inputs,
compose_by_drawable);
1997-11-25 06:05:25 +08:00
if (image_ID < 0)
{
status = GIMP_PDB_EXECUTION_ERROR;
}
1997-11-25 06:05:25 +08:00
else
{
values[1].data.d_int32 = image_ID;
if (composevals.do_recompose)
{
gimp_displays_flush ();
}
else
{
gimp_image_undo_enable (image_ID);
gimp_image_clean_all (image_ID);
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_display_new (image_ID);
}
}
1997-11-25 06:05:25 +08:00
/* Store data */
if (run_mode == GIMP_RUN_INTERACTIVE)
gimp_set_data (name, &composevals, sizeof (ComposeVals));
1997-11-25 06:05:25 +08:00
}
values[0].data.d_status = status;
}
/* Compose an image from several gray-images */
static gint32
compose (const gchar *compose_type,
ComposeInput *inputs,
gboolean compose_by_drawable)
{
gint width, height, tile_height, scan_lines;
gint num_images, compose_idx, incr_src[MAX_COMPOSE_IMAGES];
gint i, j;
gint num_layers;
gint32 layer_ID_dst, image_ID_dst;
guchar *src[MAX_COMPOSE_IMAGES];
guchar *dst;
gint first_ID;
GimpImageType gdtype_dst;
GimpDrawable *drawable_src[MAX_COMPOSE_IMAGES], *drawable_dst;
GimpPixelRgn pixel_rgn_src[MAX_COMPOSE_IMAGES], pixel_rgn_dst;
GimpPixelRgn pixel_rgn_dst_read;
1997-11-25 06:05:25 +08:00
/* Search type of composing */
compose_idx = -1;
for (j = 0; j < G_N_ELEMENTS (compose_dsc); j++)
{
added -DG_DISABLE_DEPRECATED and -DGDK_DISABLE_COMPAT_H. 2001-08-29 Michael Natterer <mitch@gimp.org> * configure.in: added -DG_DISABLE_DEPRECATED and -DGDK_DISABLE_COMPAT_H. * app/batch.c * app/file-utils.c * app/gdisplay.c * app/gdisplay_ops.c * app/gimprc.[ch] * app/module_db.c * app/nav_window.c * app/undo_history.c * app/core/gimpgradient.c * app/core/gimpimagefile.c * app/core/gimppalette.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/error-console-dialog.c * app/gui/file-commands.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/menus.c * app/gui/palette-import-dialog.c * app/tools/gimpbycolorselecttool.c * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpmenu.c * plug-ins/common/bz2.c * plug-ins/common/compose.c * plug-ins/common/csource.c * plug-ins/common/decompose.c * plug-ins/common/gz.c * plug-ins/common/uniteditor.c * plug-ins/common/wmf.c * plug-ins/common/xbm.c * plug-ins/rcm/rcm_dialog.c * plug-ins/script-fu/interp_slib.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gimprc.pdb * app/pdb/fileops_cmds.c * app/pdb/gimprc_cmds.c: removed deprecated stuff like g_basename(), g_dirname(), g_strup() and friends. Added some "const gchar *" declarations while I was on it. Added some G_N_ELEMENTS() macros instead of declaring a useless variable for the number of items. * app/widgets/gtkhwrapbox.[ch] * app/widgets/gtkvwrapbox.[ch] * app/widgets/gtkwrapbox.[ch]: replaced with the latest versions from GLE, ported by the master himself. * app/gui/toolbox.c: changed accordingly. * app/plug_in.c * libgimp/gimp.c * libgimpbase/gimpwire.[ch]: use evil hacks to get binary mode from the new GIOChannel implementation (upstream bugreport already posted).
2001-08-30 01:48:28 +08:00
if (g_ascii_strcasecmp (compose_type, compose_dsc[j].compose_type) == 0)
{
compose_idx = j;
break;
}
}
1997-11-25 06:05:25 +08:00
if (compose_idx < 0)
return -1;
1997-11-25 06:05:25 +08:00
num_images = compose_dsc[compose_idx].num_images;
/* Check that at least one image or one drawable is provided */
first_ID = -1;
for (i = 0; i < num_images; i++)
{
if (inputs[i].is_ID)
{
first_ID = i;
break;
}
}
if (-1 == first_ID)
{
g_message(_("At least one image is needed to compose"));
return -1;
}
1997-11-25 06:05:25 +08:00
tile_height = gimp_tile_height ();
/* Check image sizes */
if (compose_by_drawable)
1997-11-25 06:05:25 +08:00
{
if (0 == gimp_drawable_bpp (inputs[first_ID].comp.ID))
{
g_message (_("Specified layer %d not found"), inputs[first_ID].comp.ID);
return -1;
}
width = gimp_drawable_width (inputs[first_ID].comp.ID);
height = gimp_drawable_height (inputs[first_ID].comp.ID);
for (j = first_ID + 1; j < num_images; j++)
{
if (inputs[j].is_ID)
{
if (0 == gimp_drawable_bpp (inputs[j].comp.ID))
{
g_message (_("Specified layer %d not found"), inputs[j].comp.ID);
return -1;
}
if ((width != (gint)gimp_drawable_width (inputs[j].comp.ID)) ||
(height != (gint)gimp_drawable_height (inputs[j].comp.ID)))
{
g_message (_("Drawables have different size"));
return -1;
}
}
}
for (j = 0; j < num_images; j++)
{
if (inputs[j].is_ID)
drawable_src[j] = gimp_drawable_get (inputs[j].comp.ID);
else
drawable_src[j] = NULL;
}
1997-11-25 06:05:25 +08:00
}
else /* Compose by image ID */
1997-11-25 06:05:25 +08:00
{
width = gimp_image_width (inputs[first_ID].comp.ID);
height = gimp_image_height (inputs[first_ID].comp.ID);
for (j = first_ID + 1; j < num_images; j++)
{
if (inputs[j].is_ID)
{
if ((width != gimp_image_width (inputs[j].comp.ID)) ||
(height != gimp_image_height (inputs[j].comp.ID)))
{
g_message (_("Images have different size"));
return -1;
}
}
}
/* Get first layer/drawable for all input images */
for (j = 0; j < num_images; j++)
{
if (inputs[j].is_ID)
{
gint32 *g32;
/* Get first layer of image */
g32 = gimp_image_get_layers (inputs[j].comp.ID, &num_layers);
if ((g32 == NULL) || (num_layers <= 0))
{
g_message (_("Error in getting layer IDs"));
return -1;
}
/* Get drawable for layer */
drawable_src[j] = gimp_drawable_get (g32[0]);
g_free (g32);
}
}
}
/* Get pixel region for all input drawables */
for (j = 0; j < num_images; j++)
1997-11-25 06:05:25 +08:00
{
gsize s;
/* Check bytes per pixel */
if (inputs[j].is_ID)
{
incr_src[j] = drawable_src[j]->bpp;
if ((incr_src[j] != 1) && (incr_src[j] != 2))
{
g_message (_("Image is not a gray image (bpp=%d)"),
incr_src[j]);
return -1;
}
/* Get pixel region */
gimp_pixel_rgn_init (&(pixel_rgn_src[j]), drawable_src[j], 0, 0,
width, height, FALSE, FALSE);
}
else
{
incr_src[j] = 1;
}
/* Get memory for retrieving information */
s = tile_height * width * incr_src[j];
src[j] = g_new (guchar, s);
if (! inputs[j].is_ID)
memset (src[j], inputs[j].comp.val, s);
1997-11-25 06:05:25 +08:00
}
/* Unless recomposing, create new image */
if (composevals.do_recompose)
{
layer_ID_dst = composevals.source_layer_ID;
if (0 == gimp_drawable_bpp (layer_ID_dst))
{
g_message (_("Unable to recompose, source layer not found"));
return -1;
}
drawable_dst = gimp_drawable_get (layer_ID_dst);
gimp_pixel_rgn_init (&pixel_rgn_dst, drawable_dst, 0, 0,
drawable_dst->width,
drawable_dst->height,
TRUE, TRUE);
gimp_pixel_rgn_init (&pixel_rgn_dst_read, drawable_dst, 0, 0,
drawable_dst->width,
drawable_dst->height,
FALSE, FALSE);
image_ID_dst = gimp_drawable_get_image (layer_ID_dst);
}
else
{
gdtype_dst = ((compose_dsc[compose_idx].compose_fun == compose_rgba) ?
GIMP_RGBA_IMAGE : GIMP_RGB_IMAGE);
image_ID_dst = create_new_image (compose_dsc[compose_idx].filename,
width, height, gdtype_dst,
&layer_ID_dst, &drawable_dst,
&pixel_rgn_dst);
}
if (! compose_by_drawable)
{
gdouble xres, yres;
gimp_image_get_resolution (inputs[first_ID].comp.ID, &xres, &yres);
gimp_image_set_resolution (image_ID_dst, xres, yres);
}
dst = g_new (guchar, tile_height * width * drawable_dst->bpp);
1997-11-25 06:05:25 +08:00
/* Do the composition */
i = 0;
while (i < height)
{
scan_lines = (i+tile_height-1 < height) ? tile_height : (height-i);
/* Get source pixel regions */
for (j = 0; j < num_images; j++)
if (inputs[j].is_ID)
gimp_pixel_rgn_get_rect (&(pixel_rgn_src[j]), src[j], 0, i,
width, scan_lines);
if (composevals.do_recompose)
gimp_pixel_rgn_get_rect (&pixel_rgn_dst_read, dst, 0, i,
width, scan_lines);
/* Do the composition */
compose_dsc[compose_idx].compose_fun (src,
incr_src,
width * tile_height,
dst,
gimp_drawable_has_alpha (layer_ID_dst));
/* Set destination pixel region */
gimp_pixel_rgn_set_rect (&pixel_rgn_dst, dst, 0, i, width, scan_lines);
i += scan_lines;
gimp_progress_update ((gdouble) i / (gdouble) height);
}
1997-11-25 06:05:25 +08:00
for (j = 0; j < num_images; j++)
{
g_free (src[j]);
if (inputs[j].is_ID)
gimp_drawable_detach (drawable_src[j]);
}
1997-11-25 06:05:25 +08:00
g_free (dst);
1997-11-25 06:05:25 +08:00
gimp_drawable_detach (drawable_dst);
if (composevals.do_recompose)
gimp_drawable_merge_shadow (layer_ID_dst, TRUE);
gimp_drawable_update (layer_ID_dst, 0, 0,
gimp_drawable_width (layer_ID_dst),
gimp_drawable_height (layer_ID_dst));
1997-11-25 06:05:25 +08:00
return image_ID_dst;
}
/* Create an image. Sets layer_ID, drawable and rgn. Returns image_ID */
static gint32
create_new_image (const gchar *filename,
guint width,
guint height,
GimpImageType gdtype,
gint32 *layer_ID,
GimpDrawable **drawable,
GimpPixelRgn *pixel_rgn)
{
gint32 image_ID;
GimpImageBaseType gitype;
if ((gdtype == GIMP_GRAY_IMAGE) || (gdtype == GIMP_GRAYA_IMAGE))
gitype = GIMP_GRAY;
else if ((gdtype == GIMP_INDEXED_IMAGE) || (gdtype == GIMP_INDEXEDA_IMAGE))
gitype = GIMP_INDEXED;
else
gitype = GIMP_RGB;
image_ID = gimp_image_new (width, height, gitype);
gimp_image_undo_disable (image_ID);
gimp_image_set_filename (image_ID, filename);
*layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
gdtype, 100, GIMP_NORMAL_MODE);
gimp_image_add_layer (image_ID, *layer_ID, 0);
*drawable = gimp_drawable_get (*layer_ID);
gimp_pixel_rgn_init (pixel_rgn, *drawable, 0, 0, (*drawable)->width,
(*drawable)->height, TRUE, FALSE);
1997-11-25 06:05:25 +08:00
return image_ID;
1997-11-25 06:05:25 +08:00
}
static void
compose_rgb (guchar **src,
gint *incr_src,
gint numpix,
guchar *dst,
gboolean dst_has_alpha)
{
register const guchar *red_src = src[0];
register const guchar *green_src = src[1];
register const guchar *blue_src = src[2];
register guchar *rgb_dst = dst;
register gint count = numpix;
gint red_incr = incr_src[0];
gint green_incr = incr_src[1];
gint blue_incr = incr_src[2];
if ((red_incr == 1) && (green_incr == 1) && (blue_incr == 1))
{
while (count-- > 0)
{
*(rgb_dst++) = *(red_src++);
*(rgb_dst++) = *(green_src++);
*(rgb_dst++) = *(blue_src++);
if (dst_has_alpha)
rgb_dst++;
}
}
else
{
while (count-- > 0)
{
*(rgb_dst++) = *red_src; red_src += red_incr;
*(rgb_dst++) = *green_src; green_src += green_incr;
*(rgb_dst++) = *blue_src; blue_src += blue_incr;
if (dst_has_alpha)
rgb_dst++;
}
}
1997-11-25 06:05:25 +08:00
}
static void
compose_rgba (guchar **src,
gint *incr_src,
gint numpix,
guchar *dst,
gboolean dst_has_alpha)
{
register const guchar *red_src = src[0];
register const guchar *green_src = src[1];
register const guchar *blue_src = src[2];
register const guchar *alpha_src = src[3];
register guchar *rgb_dst = dst;
register gint count = numpix;
gint red_incr = incr_src[0];
gint green_incr = incr_src[1];
gint blue_incr = incr_src[2];
gint alpha_incr = incr_src[3];
if ((red_incr == 1) && (green_incr == 1) && (blue_incr == 1) &&
(alpha_incr == 1))
{
while (count-- > 0)
{
*(rgb_dst++) = *(red_src++);
*(rgb_dst++) = *(green_src++);
*(rgb_dst++) = *(blue_src++);
*(rgb_dst++) = *(alpha_src++);
}
}
else
{
while (count-- > 0)
{
*(rgb_dst++) = *red_src; red_src += red_incr;
*(rgb_dst++) = *green_src; green_src += green_incr;
*(rgb_dst++) = *blue_src; blue_src += blue_incr;
*(rgb_dst++) = *alpha_src; alpha_src += alpha_incr;
}
}
1997-11-25 06:05:25 +08:00
}
static void
compose_hsv (guchar **src,
gint *incr_src,
gint numpix,
guchar *dst,
gboolean dst_has_alpha)
{
register const guchar *hue_src = src[0];
register const guchar *sat_src = src[1];
register const guchar *val_src = src[2];
register guchar *rgb_dst = dst;
register gint count = numpix;
gint hue_incr = incr_src[0];
gint sat_incr = incr_src[1];
gint val_incr = incr_src[2];
while (count-- > 0)
{
gimp_hsv_to_rgb4 (rgb_dst, (gdouble) *hue_src / 255.0,
(gdouble) *sat_src / 255.0,
(gdouble) *val_src / 255.0);
rgb_dst += 3;
hue_src += hue_incr;
sat_src += sat_incr;
val_src += val_incr;
if (dst_has_alpha)
rgb_dst++;
}
1997-11-25 06:05:25 +08:00
}
static void
compose_cmy (guchar **src,
gint *incr_src,
gint numpix,
guchar *dst,
gboolean dst_has_alpha)
{
register const guchar *cyan_src = src[0];
register const guchar *magenta_src = src[1];
register const guchar *yellow_src = src[2];
register guchar *rgb_dst = dst;
register gint count = numpix;
gint cyan_incr = incr_src[0];
gint magenta_incr = incr_src[1];
gint yellow_incr = incr_src[2];
if ((cyan_incr == 1) && (magenta_incr == 1) && (yellow_incr == 1))
{
while (count-- > 0)
{
*(rgb_dst++) = 255 - *(cyan_src++);
*(rgb_dst++) = 255 - *(magenta_src++);
*(rgb_dst++) = 255 - *(yellow_src++);
if (dst_has_alpha)
rgb_dst++;
}
}
else
{
while (count-- > 0)
{
*(rgb_dst++) = 255 - *cyan_src;
*(rgb_dst++) = 255 - *magenta_src;
*(rgb_dst++) = 255 - *yellow_src;
cyan_src += cyan_incr;
magenta_src += magenta_incr;
yellow_src += yellow_incr;
if (dst_has_alpha)
rgb_dst++;
}
}
1997-11-25 06:05:25 +08:00
}
static void
compose_cmyk (guchar **src,
gint *incr_src,
gint numpix,
guchar *dst,
gboolean dst_has_alpha)
{
register const guchar *cyan_src = src[0];
register const guchar *magenta_src = src[1];
register const guchar *yellow_src = src[2];
register const guchar *black_src = src[3];
register guchar *rgb_dst = dst;
register gint count = numpix;
gint cyan, magenta, yellow, black;
gint cyan_incr = incr_src[0];
gint magenta_incr = incr_src[1];
gint yellow_incr = incr_src[2];
gint black_incr = incr_src[3];
while (count-- > 0)
{
black = (gint)*black_src;
if (black)
{
cyan = (gint) *cyan_src;
magenta = (gint) *magenta_src;
yellow = (gint) *yellow_src;
cyan += black; if (cyan > 255) cyan = 255;
magenta += black; if (magenta > 255) magenta = 255;
yellow += black; if (yellow > 255) yellow = 255;
*(rgb_dst++) = 255 - cyan;
*(rgb_dst++) = 255 - magenta;
*(rgb_dst++) = 255 - yellow;
}
else
{
*(rgb_dst++) = 255 - *cyan_src;
*(rgb_dst++) = 255 - *magenta_src;
*(rgb_dst++) = 255 - *yellow_src;
}
cyan_src += cyan_incr;
magenta_src += magenta_incr;
yellow_src += yellow_incr;
black_src += black_incr;
if (dst_has_alpha)
rgb_dst++;
}
1997-11-25 06:05:25 +08:00
}
static void
compose_lab (guchar **src,
gint *incr_src,
gint numpix,
guchar *dst,
gboolean dst_has_alpha)
{
register guchar *l_src = src[0];
register guchar *a_src = src[1];
register guchar *b_src = src[2];
register guchar *rgb_dst = dst;
register gint count = numpix;
gint l_incr = incr_src[0], a_incr = incr_src[1], b_incr = incr_src[2];
gdouble red, green, blue;
gdouble x, y, z;
gdouble l, a, b;
gdouble p, yyn;
gdouble ha, hb, sqyyn;
while (count-- > 0)
{
l = *l_src / 2.550;
a = ( *a_src - 128.0 ) / 1.27;
b = ( *b_src - 128.0 ) / 1.27;
p = (l + 16.) / 116.;
yyn = p*p*p;
if (yyn > 0.008856)
{
y = Yn * yyn;
ha = (p + a/500.);
x = Xn * ha*ha*ha;
hb = (p - b/200.);
z = Zn * hb*hb*hb;
}
else
{
y = Yn * l/903.3;
sqyyn = pow(l/903.3,1./3.);
ha = a/500./7.787 + sqyyn;
x = Xn * ha*ha*ha;
hb = sqyyn - b/200./7.787;
z = Zn * hb*hb*hb;
};
red = 3.063 * x - 1.393 * y - 0.476 * z;
green = -0.969 * x + 1.876 * y + 0.042 * z;
blue = 0.068 * x - 0.229 * y + 1.069 * z;
red = ( red > 0 ) ? red : 0;
green = ( green > 0 ) ? green : 0;
blue = ( blue > 0 ) ? blue : 0;
red = ( red < 1.0 ) ? red : 1.0;
green = ( green < 1.0 ) ? green : 1.0;
blue = ( blue < 1.0 ) ? blue : 1.0;
rgb_dst[0] = (guchar) ( red * 255.999 );
rgb_dst[1] = (guchar) ( green * 255.999 );
rgb_dst[2] = (guchar) ( blue * 255.999 );
rgb_dst += 3;
l_src += l_incr;
a_src += a_incr;
b_src += b_incr;
if (dst_has_alpha)
rgb_dst++;
}
}
/* these are here so the code is more readable and we can use
the standart values instead of some scaled and rounded fixpoint values */
#define FIX(a) ((int)((a)*256.0*256.0 + 0.5))
#define FIXY(a) ((int)((a)*256.0*256.0*255.0/219.0 + 0.5))
#define FIXC(a) ((int)((a)*256.0*256.0*255.0/224.0 + 0.5))
static void
compose_ycbcr470 (guchar **src,
gint *incr_src,
gint numpix,
guchar *dst,
gboolean dst_has_alpha)
{
register const guchar *y_src = src[0];
register const guchar *cb_src = src[1];
register const guchar *cr_src = src[2];
register guchar *rgb_dst = dst;
register gint count = numpix;
gint y_incr = incr_src[0];
gint cb_incr = incr_src[1];
gint cr_incr = incr_src[2];
while (count-- > 0)
{
int r,g,b,y,cb,cr;
y = *y_src - 16;
cb= *cb_src - 128;
cr= *cr_src - 128;
y_src += y_incr;
cb_src += cb_incr;
cr_src += cr_incr;
r = (FIXY(1.0)*y + FIXC(1.4022)*cr + FIX(0.5))>>16;
g = (FIXY(1.0)*y - FIXC(0.3456)*cb - FIXC(0.7145)*cr + FIX(0.5))>>16;
b = (FIXY(1.0)*y + FIXC(1.7710)*cb + FIX(0.5))>>16;
if(((unsigned)r) > 255) r = ((r>>10)&255)^255;
if(((unsigned)g) > 255) g = ((g>>10)&255)^255;
if(((unsigned)b) > 255) b = ((b>>10)&255)^255;
*(rgb_dst++) = r;
*(rgb_dst++) = g;
*(rgb_dst++) = b;
if (dst_has_alpha)
rgb_dst++;
}
}
static void
compose_ycbcr709 (guchar **src,
gint *incr_src,
gint numpix,
guchar *dst,
gboolean dst_has_alpha)
{
register const guchar *y_src = src[0];
register const guchar *cb_src = src[1];
register const guchar *cr_src = src[2];
register guchar *rgb_dst = dst;
register gint count = numpix;
gint y_incr = incr_src[0];
gint cb_incr = incr_src[1];
gint cr_incr = incr_src[2];
while (count-- > 0)
{
int r,g,b,y,cb,cr;
y = *y_src - 16;
cb= *cb_src - 128;
cr= *cr_src - 128;
y_src += y_incr;
cb_src += cb_incr;
cr_src += cr_incr;
r = (FIXY(1.0)*y + FIXC(1.5748)*cr + FIX(0.5))>>16;
g = (FIXY(1.0)*y - FIXC(0.1873)*cb - FIXC(0.4681)*cr + FIX(0.5))>>16;
b = (FIXY(1.0)*y + FIXC(1.8556)*cb + FIX(0.5))>>16;
if(((unsigned)r) > 255) r = ((r>>10)&255)^255;
if(((unsigned)g) > 255) g = ((g>>10)&255)^255;
if(((unsigned)b) > 255) b = ((b>>10)&255)^255;
*(rgb_dst++) = r;
*(rgb_dst++) = g;
*(rgb_dst++) = b;
if (dst_has_alpha)
rgb_dst++;
}
}
static void
compose_ycbcr470f (guchar **src,
gint *incr_src,
gint numpix,
guchar *dst,
gboolean dst_has_alpha)
{
register const guchar *y_src = src[0];
register const guchar *cb_src = src[1];
register const guchar *cr_src = src[2];
register guchar *rgb_dst = dst;
register gint count = numpix;
gint y_incr = incr_src[0];
gint cb_incr = incr_src[1];
gint cr_incr = incr_src[2];
while (count-- > 0)
{
int r,g,b,y,cb,cr;
y = *y_src;
cb= *cb_src - 128;
cr= *cr_src - 128;
y_src += y_incr;
cb_src += cb_incr;
cr_src += cr_incr;
r = (FIX(1.0)*y + FIX(1.4022)*cr + FIX(0.5))>>16;
g = (FIX(1.0)*y - FIX(0.3456)*cb - FIX(0.7145)*cr + FIX(0.5))>>16;
b = (FIX(1.0)*y + FIX(1.7710)*cb + FIX(0.5))>>16;
if(((unsigned)r) > 255) r = ((r>>10)&255)^255;
if(((unsigned)g) > 255) g = ((g>>10)&255)^255;
if(((unsigned)b) > 255) b = ((b>>10)&255)^255;
*(rgb_dst++) = r;
*(rgb_dst++) = g;
*(rgb_dst++) = b;
if (dst_has_alpha)
rgb_dst++;
}
}
static void
compose_ycbcr709f (guchar **src,
gint *incr_src,
gint numpix,
guchar *dst,
gboolean dst_has_alpha)
{
register const guchar *y_src = src[0];
register const guchar *cb_src = src[1];
register const guchar *cr_src = src[2];
register guchar *rgb_dst = dst;
register gint count = numpix;
gint y_incr = incr_src[0];
gint cb_incr = incr_src[1];
gint cr_incr = incr_src[2];
while (count-- > 0)
{
int r,g,b,y,cb,cr;
y = *y_src;
cb= *cb_src - 128;
cr= *cr_src - 128;
y_src += y_incr;
cb_src += cb_incr;
cr_src += cr_incr;
r = (FIX(1.0)*y + FIX(1.5748)*cr + FIX(0.5))>>16;
g = (FIX(1.0)*y - FIX(0.1873)*cb - FIX(0.4681)*cr + FIX(0.5))>>16;
b = (FIX(1.0)*y + FIX(1.8556)*cb + FIX(0.5))>>16;
if(((unsigned)r) > 255) r = ((r>>10)&255)^255;
if(((unsigned)g) > 255) g = ((g>>10)&255)^255;
if(((unsigned)b) > 255) b = ((b>>10)&255)^255;
*(rgb_dst++) = r;
*(rgb_dst++) = g;
*(rgb_dst++) = b;
if (dst_has_alpha)
rgb_dst++;
}
}
1997-11-25 06:05:25 +08:00
static gboolean
compose_dialog (const gchar *compose_type,
gint32 drawable_ID)
1997-11-25 06:05:25 +08:00
{
GtkWidget *dlg;
GtkWidget *toggle;
GtkWidget *left_frame, *right_frame;
GtkWidget *left_vbox, *right_vbox;
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *table;
GtkWidget *image;
GSList *group;
gint32 *layer_list;
gint nlayers;
gint j, compose_idx;
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
gboolean run;
1997-11-25 06:05:25 +08:00
/* Check default compose type */
compose_idx = -1;
for (j = 0; j < G_N_ELEMENTS (compose_dsc); j++)
{
added -DG_DISABLE_DEPRECATED and -DGDK_DISABLE_COMPAT_H. 2001-08-29 Michael Natterer <mitch@gimp.org> * configure.in: added -DG_DISABLE_DEPRECATED and -DGDK_DISABLE_COMPAT_H. * app/batch.c * app/file-utils.c * app/gdisplay.c * app/gdisplay_ops.c * app/gimprc.[ch] * app/module_db.c * app/nav_window.c * app/undo_history.c * app/core/gimpgradient.c * app/core/gimpimagefile.c * app/core/gimppalette.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/error-console-dialog.c * app/gui/file-commands.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/menus.c * app/gui/palette-import-dialog.c * app/tools/gimpbycolorselecttool.c * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpmenu.c * plug-ins/common/bz2.c * plug-ins/common/compose.c * plug-ins/common/csource.c * plug-ins/common/decompose.c * plug-ins/common/gz.c * plug-ins/common/uniteditor.c * plug-ins/common/wmf.c * plug-ins/common/xbm.c * plug-ins/rcm/rcm_dialog.c * plug-ins/script-fu/interp_slib.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gimprc.pdb * app/pdb/fileops_cmds.c * app/pdb/gimprc_cmds.c: removed deprecated stuff like g_basename(), g_dirname(), g_strup() and friends. Added some "const gchar *" declarations while I was on it. Added some G_N_ELEMENTS() macros instead of declaring a useless variable for the number of items. * app/widgets/gtkhwrapbox.[ch] * app/widgets/gtkvwrapbox.[ch] * app/widgets/gtkwrapbox.[ch]: replaced with the latest versions from GLE, ported by the master himself. * app/gui/toolbox.c: changed accordingly. * app/plug_in.c * libgimp/gimp.c * libgimpbase/gimpwire.[ch]: use evil hacks to get binary mode from the new GIOChannel implementation (upstream bugreport already posted).
2001-08-30 01:48:28 +08:00
if (g_ascii_strcasecmp (compose_type, compose_dsc[j].compose_type) == 0)
{
compose_idx = j;
break;
}
}
1997-11-25 06:05:25 +08:00
if (compose_idx < 0) compose_idx = 0;
/* Save original image width/height */
composeint.width = gimp_drawable_width (drawable_ID);
composeint.height = gimp_drawable_height (drawable_ID);
gimp_ui_init (PLUG_IN_BINARY, TRUE);
1997-11-25 06:05:25 +08:00
layer_list = gimp_image_get_layers (gimp_drawable_get_image (drawable_ID),
&nlayers);
dlg = gimp_dialog_new (_("Compose"), PLUG_IN_BINARY,
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
NULL, 0,
gimp_standard_help_func, COMPOSE_PROC,
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dlg),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
g_signal_connect (dlg, "response",
G_CALLBACK (check_response),
NULL);
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
gimp_window_set_transient (GTK_WINDOW (dlg));
1997-11-25 06:05:25 +08:00
/* parameter settings */
hbox = gtk_hbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dlg)->vbox), hbox);
1997-11-25 06:05:25 +08:00
gtk_widget_show (hbox);
/* The left frame keeps the compose type toggles */
left_frame = gimp_frame_new (_("Compose Channels"));
2000-01-11 23:48:00 +08:00
gtk_box_pack_start (GTK_BOX (hbox), left_frame, FALSE, FALSE, 0);
gtk_widget_show (left_frame);
1997-11-25 06:05:25 +08:00
left_vbox = gtk_vbox_new (FALSE, 6);
1997-11-25 06:05:25 +08:00
gtk_container_add (GTK_CONTAINER (left_frame), left_vbox);
gtk_widget_show (left_vbox);
1997-11-25 06:05:25 +08:00
/* The right frame keeps the selection menues for images. */
/* Because the labels within this frame will change when a toggle */
/* in the left frame is changed, fill in the right part first. */
/* Otherwise it can occur, that a non-existing label might be changed. */
right_frame = gimp_frame_new (_("Channel Representations"));
1997-11-25 06:05:25 +08:00
gtk_box_pack_start (GTK_BOX (hbox), right_frame, TRUE, TRUE, 0);
gtk_widget_show (right_frame);
1997-11-25 06:05:25 +08:00
right_vbox = gtk_vbox_new (FALSE, 6);
1997-11-25 06:05:25 +08:00
gtk_container_add (GTK_CONTAINER (right_frame), right_vbox);
gtk_widget_show (right_vbox);
1997-11-25 06:05:25 +08:00
table = gtk_table_new (MAX_COMPOSE_IMAGES, 6, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_box_pack_start (GTK_BOX (right_vbox), table, FALSE, FALSE, 0);
1997-11-25 06:05:25 +08:00
gtk_widget_show (table);
for (j = 0; j < MAX_COMPOSE_IMAGES; j++)
2000-01-11 23:48:00 +08:00
{
GtkWidget *combo;
GtkObject *scale;
GtkTreeIter iter;
GtkTreeModel *model;
GdkPixbuf *ico;
const gchar *text;
image = gtk_image_new_from_stock (compose_dsc[compose_idx].channel_icon[j],
GTK_ICON_SIZE_BUTTON);
composeint.channel_icon[j] = image;
gtk_table_attach (GTK_TABLE (table), image, 0, 1, j, j+1,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (image);
text = (compose_dsc[compose_idx].channel_name[j] ?
gettext (compose_dsc[compose_idx].channel_name[j]) : NULL);
composeint.channel_label[j] = label = gtk_label_new (text);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 1, 2, j, j+1,
2000-01-11 23:48:00 +08:00
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
1997-11-25 06:05:25 +08:00
if (nlayers >= compose_dsc[compose_idx].num_images)
composeint.selected[j].comp.ID = layer_list[nlayers - (j + 1)];
else
composeint.selected[j].comp.ID = drawable_ID;
composeint.selected[j].is_ID = TRUE;
combo = gimp_drawable_combo_box_new (check_gray, NULL);
ico = gtk_widget_render_icon (dlg,
GIMP_STOCK_CHANNEL_GRAY,
GTK_ICON_SIZE_BUTTON, NULL);
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
GIMP_INT_STORE_VALUE, -1,
GIMP_INT_STORE_LABEL, _("Mask value ..."),
GIMP_INT_STORE_PIXBUF, ico,
-1);
g_object_unref (ico);
gtk_table_attach (GTK_TABLE (table), combo, 2, 3, j, j+1,
2000-01-11 23:48:00 +08:00
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (combo);
2000-01-11 23:48:00 +08:00
composeint.channel_menu[j] = combo;
scale = gimp_color_scale_entry_new (GTK_TABLE (table), 3, j, NULL,
100, 60, 255., 0., 255., 1.0, 10., 0,
NULL, NULL);
composeint.color_scales[j] = g_object_get_data (G_OBJECT (scale), "scale");
composeint.color_spins[j] = g_object_get_data (G_OBJECT (scale), "spinbutton");
gtk_widget_set_sensitive (composeint.color_scales[j], FALSE);
gtk_widget_set_sensitive (composeint.color_spins[j], FALSE);
g_signal_connect (scale, "value-changed",
G_CALLBACK (scale_callback),
&composeint.selected[j]);
/* This has to be connected last otherwise it will emit before
* combo_callback has any scale and spinbutton to work with
*/
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
composeint.selected[j].comp.ID,
G_CALLBACK (combo_callback),
GINT_TO_POINTER (j));
2000-01-11 23:48:00 +08:00
}
g_free (layer_list);
1997-11-25 06:05:25 +08:00
/* Set sensitivity of last menu */
gtk_widget_set_sensitive (composeint.channel_menu[3],
compose_dsc[compose_idx].channel_name[3] != NULL);
1997-11-25 06:05:25 +08:00
/* Compose types */
group = NULL;
for (j = 0; j < G_N_ELEMENTS (compose_dsc); j++)
2000-01-11 23:48:00 +08:00
{
toggle = gtk_radio_button_new_with_label (group,
gettext (compose_dsc[j].compose_type));
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
gtk_box_pack_start (GTK_BOX (left_vbox), toggle, FALSE, FALSE, 0);
2000-01-11 23:48:00 +08:00
composeint.compose_flag[j] = (j == compose_idx);
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
gtk_widget_show (toggle);
g_signal_connect (toggle, "toggled",
G_CALLBACK (compose_type_toggle_update),
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
&(composeint.compose_flag[j]));
2000-01-11 23:48:00 +08:00
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
composeint.compose_flag[j]);
}
1997-11-25 06:05:25 +08:00
gtk_widget_show (dlg);
run = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK);
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
gtk_widget_destroy (dlg);
if (run)
{
gint j;
for (j = 0; j < MAX_COMPOSE_IMAGES; j++)
{
composevals.inputs[j].is_ID = composeint.selected[j].is_ID;
if (composevals.inputs[j].is_ID)
composevals.inputs[j].comp.ID = composeint.selected[j].comp.ID;
else
composevals.inputs[j].comp.val = composeint.selected[j].comp.val;
}
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
for (j = 0; j < G_N_ELEMENTS (compose_dsc); j++)
{
if (composeint.compose_flag[j])
{
strcpy (composevals.compose_type, compose_dsc[j].compose_type);
break;
}
}
}
1997-11-25 06:05:25 +08:00
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
return run;
1997-11-25 06:05:25 +08:00
}
/* Compose interface functions */
static gboolean
check_gray (gint32 image_id,
gint32 drawable_id,
1997-11-25 06:05:25 +08:00
gpointer data)
{
return ((gimp_image_base_type (image_id) == GIMP_GRAY) &&
(gimp_image_width (image_id) == composeint.width) &&
(gimp_image_height (image_id) == composeint.height));
1997-11-25 06:05:25 +08:00
}
static void
check_response (GtkWidget *dialog,
gint response,
gpointer data)
{
switch (response)
{
case GTK_RESPONSE_OK:
{
gint i;
gint nb = 0;
gboolean has_image = FALSE;
for (i = 0; i < G_N_ELEMENTS (compose_dsc); i++)
{
if (composeint.compose_flag[i])
{
nb = compose_dsc[i].num_images;
break;
}
}
for (i = 0; i < nb; i++)
{
if (composeint.selected[i].is_ID)
{
has_image = TRUE;
break;
}
}
if (! has_image)
{
GtkWidget *d;
g_signal_stop_emission_by_name (dialog, "response");
d = gtk_message_dialog_new (GTK_WINDOW (dialog),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
_("At least one image is needed to compose"));
gtk_dialog_run (GTK_DIALOG (d));
gtk_widget_destroy (d);
}
}
break;
default:
break;
}
}
static void
combo_callback (GimpIntComboBox *widget,
gpointer data)
{
gint id;
gint n;
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &id);
n = GPOINTER_TO_INT (data);
if (id == -1)
{
gtk_widget_set_sensitive (composeint.color_scales[n], TRUE);
gtk_widget_set_sensitive (composeint.color_spins[n], TRUE);
composeint.selected[n].is_ID = FALSE;
composeint.selected[n].comp.val =
gtk_range_get_value (GTK_RANGE (composeint.color_scales[n]));
}
else
{
gtk_widget_set_sensitive (composeint.color_scales[n], FALSE);
gtk_widget_set_sensitive (composeint.color_spins[n], FALSE);
composeint.selected[n].is_ID = TRUE;
composeint.selected[n].comp.ID = id;
}
}
static void
scale_callback (GtkAdjustment *adj,
ComposeInput *input)
{
input->comp.val = gtk_adjustment_get_value (adj);
}
1997-11-25 06:05:25 +08:00
static void
compose_type_toggle_update (GtkWidget *widget,
gpointer data)
{
gboolean *toggle_val;
gint compose_idx, j;
1997-11-25 06:05:25 +08:00
toggle_val = (gboolean *) data;
1997-11-25 06:05:25 +08:00
*toggle_val = GTK_TOGGLE_BUTTON (widget)->active;
if (*toggle_val)
{
const gchar *text;
gboolean combo4;
gboolean scale4;
*toggle_val = TRUE;
compose_idx = toggle_val - &(composeint.compose_flag[0]);
for (j = 0; j < MAX_COMPOSE_IMAGES; j++)
{
text = (compose_dsc[compose_idx].channel_name[j] ?
gettext (compose_dsc[compose_idx].channel_name[j]) : NULL);
gtk_label_set_text (GTK_LABEL (composeint.channel_label[j]), text);
gtk_image_set_from_stock (GTK_IMAGE (composeint.channel_icon[j]),
compose_dsc[compose_idx].channel_icon[j],
GTK_ICON_SIZE_BUTTON);
}
/* Set sensitivity of last menu */
combo4 = (compose_dsc[compose_idx].channel_name[3] != NULL);
gtk_widget_set_sensitive (composeint.channel_menu[3], combo4);
scale4 = combo4 && !composeint.selected[3].is_ID;
gtk_widget_set_sensitive (composeint.color_scales[3], scale4);
gtk_widget_set_sensitive (composeint.color_spins[3], scale4);
}
1997-11-25 06:05:25 +08:00
}