gimp/app/core/gimpchannel.c

2013 lines
69 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
1997-11-25 06:05:25 +08:00
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
1997-11-25 06:05:25 +08:00
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
1997-11-25 06:05:25 +08:00
* (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, see <https://www.gnu.org/licenses/>.
1997-11-25 06:05:25 +08:00
*/
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc 1999-09-01 Tor Lillqvist <tml@iki.fi> * app/appenv.h * libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc from app/appenv.h here, so plug-ins can use them, too. Remove some commented-out old stuff in appenv.h. * libgimp/gimp.h: Include gimpmath.h. * libgimp/gimp.c (gimp_main): Win32: Don't install signal handlers, we can't do anything useful in the handler ourselves anyway (it would be nice to print out a backtrace, but that seems pretty hard to do, even if not impossible). Let Windows inform the user about the crash. If the plug-in was compiled with MSVC, and the user also has it, she is offered a chance to start the debugger automatically anyway. * app/*several*.c: Include gimpmath.h for G_PI etc. Don't include <math.h>, as gimpmath.h includes it. * plug-ins/*/*many*.c: Include config.h. Don't include <math.h>. Remove all the duplicated definitions of G_PI and rint(). Use RINT() instead of rint(). * app/app_procs.[ch]: app_exit() takes a gboolean. * app/batch.c * app/commands.c * app/interface.c: Call app_exit() with FALSE or TRUE. * app/main.c (on_error): Call gimp_fatal_error. (main): Don't install any signal handler on Win32 here, either. * app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format the message and call MessageBox with it. g_on_error_query doesn't do anything useful on Win32, and printf'ing a message to stdout or stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
#include "config.h"
1997-11-25 06:05:25 +08:00
#include <string.h>
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc 1999-09-01 Tor Lillqvist <tml@iki.fi> * app/appenv.h * libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc from app/appenv.h here, so plug-ins can use them, too. Remove some commented-out old stuff in appenv.h. * libgimp/gimp.h: Include gimpmath.h. * libgimp/gimp.c (gimp_main): Win32: Don't install signal handlers, we can't do anything useful in the handler ourselves anyway (it would be nice to print out a backtrace, but that seems pretty hard to do, even if not impossible). Let Windows inform the user about the crash. If the plug-in was compiled with MSVC, and the user also has it, she is offered a chance to start the debugger automatically anyway. * app/*several*.c: Include gimpmath.h for G_PI etc. Don't include <math.h>, as gimpmath.h includes it. * plug-ins/*/*many*.c: Include config.h. Don't include <math.h>. Remove all the duplicated definitions of G_PI and rint(). Use RINT() instead of rint(). * app/app_procs.[ch]: app_exit() takes a gboolean. * app/batch.c * app/commands.c * app/interface.c: Call app_exit() with FALSE or TRUE. * app/main.c (on_error): Call gimp_fatal_error. (main): Don't install any signal handler on Win32 here, either. * app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format the message and call MessageBox with it. g_on_error_query doesn't do anything useful on Win32, and printf'ing a message to stdout or stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
#include <cairo.h>
#include <gegl.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpcolor/gimpcolor.h"
#include "core-types.h"
added new virtual function GimpItem::stroke(). 2003-09-01 Michael Natterer <mitch@gimp.org> * app/core/gimpitem.[ch]: added new virtual function GimpItem::stroke(). * app/core/gimpchannel.c * app/vectors/gimpvectors.c: implement GimpItem::stroke(). * app/core/gimpimage-mask.[ch] (gimp_image_mask_stroke): changed signature to match gimp_item_stroke() (the selection mask *really* should be a GimpChannel subclass). Removed global variable "gboolean gimp_image_mask_stroking"... * app/core/gimpimage.[ch]: ...and added "gboolean mask_stroking" to the GimpImage struct. * app/gui/vectors-commands.[ch]: removed vectors_stroke_vectors(). * app/widgets/widgets-types.h: removed GimpStrokeItemFunc typedef. * app/widgets/gimpvectorstreeview.[ch]: removed "stroke_item_func" member and use gimp_item_stroke() instead. * app/gui/dialogs-constructors.c (dialogs_vectors_list_view_new) * app/gui/edit-commands.c (edit_stroke_cmd_callback) * app/gui/vectors-commands. (vectors_stroke_cmd_callback) * app/widgets/gimpselectioneditor.c (gimp_selection_editor_stroke_clicked) * tools/pdbgen/pdb/edit.pdb (gimp_edit_stroke): changed accordingly. * app/pdb/edit_cmds.c: regenerated. Note that there is no GUI for "stroke channel", although it would be utterly cool to have one, since currently slelection stroking cannot be masked by a selection (because we stroke the selection). Anyway, if anyone has an idea how to trigger "stroke channel" with another drawable active (the one to stroke to), please let me know...
2003-09-02 01:56:44 +08:00
#include "paint/gimppaintcore-stroke.h"
#include "paint/gimppaintoptions.h"
added new virtual function GimpItem::stroke(). 2003-09-01 Michael Natterer <mitch@gimp.org> * app/core/gimpitem.[ch]: added new virtual function GimpItem::stroke(). * app/core/gimpchannel.c * app/vectors/gimpvectors.c: implement GimpItem::stroke(). * app/core/gimpimage-mask.[ch] (gimp_image_mask_stroke): changed signature to match gimp_item_stroke() (the selection mask *really* should be a GimpChannel subclass). Removed global variable "gboolean gimp_image_mask_stroking"... * app/core/gimpimage.[ch]: ...and added "gboolean mask_stroking" to the GimpImage struct. * app/gui/vectors-commands.[ch]: removed vectors_stroke_vectors(). * app/widgets/widgets-types.h: removed GimpStrokeItemFunc typedef. * app/widgets/gimpvectorstreeview.[ch]: removed "stroke_item_func" member and use gimp_item_stroke() instead. * app/gui/dialogs-constructors.c (dialogs_vectors_list_view_new) * app/gui/edit-commands.c (edit_stroke_cmd_callback) * app/gui/vectors-commands. (vectors_stroke_cmd_callback) * app/widgets/gimpselectioneditor.c (gimp_selection_editor_stroke_clicked) * tools/pdbgen/pdb/edit.pdb (gimp_edit_stroke): changed accordingly. * app/pdb/edit_cmds.c: regenerated. Note that there is no GUI for "stroke channel", although it would be utterly cool to have one, since currently slelection stroking cannot be masked by a selection (because we stroke the selection). Anyway, if anyone has an idea how to trigger "stroke channel" with another drawable active (the one to stroke to), please let me know...
2003-09-02 01:56:44 +08:00
Initial space invasion commit in GIMP All babl formats now have a space equivalent to a color profile, determining the format's primaries and TRCs. This commit makes GIMP aware of this. libgimp: - enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA as deprecated aliases, add PERCEPTUAL values so we now have LINEAR, NON_LINEAR and PERCPTUAL for each encoding, matching the babl encoding variants RGB, R'G'B' and R~G~B~. - gimp_color_transform_can_gegl_copy() now returns TRUE if both profiles can return a babl space, increasing the amount of fast babl color conversions significantly. - TODO: no solution yet for getting libgimp drawable proxy buffers in the right format with space. plug-ins: - follow the GimpPrecision change. - TODO: everything else unchanged and partly broken or sub-optimal, like setting a new image's color profile too late. app: - add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as replacement for all "linear" booleans. - change gimp-babl functions to take babl spaces and GimpTRCType parameters and support all sorts of new perceptual ~ formats. - a lot of places changed in the early days of goat invasion didn't take advantage of gimp-babl utility functions and constructed formats manually. They all needed revisiting and many now use much simpler code calling gimp-babl API. - change gimp_babl_format_get_color_profile() to really extract a newly allocated color profile from the format, and add gimp_babl_get_builtin_color_profile() which does the same as gimp_babl_format_get_color_profile() did before. Visited all callers to decide whether they are looking for the format's actual profile, or for one of the builtin profiles, simplifying code that only needs builtin profiles. - drawables have a new get_space_api(), get_linear() is now get_trc(). - images now have a "layer space" and an API to get it, gimp_image_get_layer_format() returns formats in that space. - an image's layer space is created from the image's color profile, change gimpimage-color-profile to deal with that correctly - change many babl_format() calls to babl_format_with_space() and take the space from passed formats or drawables - add function gimp_layer_fix_format_space() which replaces the layer's buffer with one that has the image's layer format, but doesn't change pixel values - use gimp_layer_fix_format_space() to make sure layers loaded from XCF and created by plug-ins have the right space when added to the image, because it's impossible to always assign the right space upon layer creation - "assign color profile" and "discard color profile" now require use of gimp_layer_fix_format_space() too because the profile is now embedded in all formats via the space. Add gimp_image_assign_color_profile() which does all that and call it instead of a simple gimp_image_set_color_profile(), also from the PDB set-color-profile functions, which are essentially "assign" and "discard" calls. - generally, make sure a new image's color profile is set before adding layers to it, gimp_image_set_color_profile() is more than before considered know-what-you-are-doing API. - take special precaution in all places that call gimp_drawable_convert_type(), we now must pass a new_profile from all callers that convert layers within the same image (such as image_convert_type, image_convert_precision), because the layer's new space can't be determined from the image's layer format during the call. - change all "linear" properties to "trc", in all config objects like for levels and curves, in the histogram, in the widgets. This results in some GUI that now has three choices instead of two. TODO: we might want to reduce that back to two later. - keep "linear" boolean properties around as compat if needed for file pasring, but always convert the parsed parsed boolean to GimpTRCType. - TODO: the image's "enable color management" switch is currently broken, will fix that in another commit.
2018-07-21 20:23:01 +08:00
#include "gegl/gimp-babl.h"
#include "gegl/gimp-gegl-apply-operation.h"
#include "gegl/gimp-gegl-loops.h"
#include "gegl/gimp-gegl-mask.h"
#include "gegl/gimp-gegl-nodes.h"
#include "gimp.h"
app/widgets/Makefile.am new file defining the available help topics. Work 2003-08-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/gimphelp-ids.h: new file defining the available help topics. Work in progress and totally unusable for matching to the help system. Stay tuned... * app/gui/about-dialog.c * app/gui/brushes-menu.c * app/gui/buffers-menu.c * app/gui/channels-commands.[ch] * app/gui/channels-menu.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradients-commands.c * app/gui/gradients-menu.c * app/gui/image-menu.c * app/gui/layers-commands.[ch] * app/gui/layers-menu.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palettes-menu.c * app/gui/patterns-menu.c * app/gui/resize-dialog.c * app/gui/select-commands.c * app/gui/templates-menu.c * app/gui/tips-dialog.c * app/gui/toolbox-menu.c * app/gui/vectors-commands.[ch] * app/gui/vectors-menu.c: replaced literal HTML file paths by help IDs from gimphelp-ids.h. Renamed some menu callbacks to be consistent with similar ones. This is just an intermediate commit and not finished. While browsing all the menus, I noticed that our "x to selection" functions are not consistent at all. They should all offer the REPLACE,ADD,SUBTRACT,INTERSECT options: * app/core/gimpchannel.[ch]: added new function gimp_channel_new_from_alpha(). Removed gimp_channel_layer_alpha() and gimp_channel_layer_mask(). * app/core/gimpimage-mask.[ch]: added gimp_image_mask_select_alpha() and gimp_image_mask_select_component() which offer the full set of operation, feather and feather_radius parameters as the other selection functions. * app/core/gimpimage-mask-select.[ch]: removed gimp_image_mask_layer_alpha() and gimp_image_mask_layer_mask(). * app/gui/channels-commands.c (channels_channel_to_selection): use gimp_image_mask_select_component() instead of implementing it here. * app/gui/image-menu.c * app/gui/layers-commands.[ch]: offer the full choice of REPLACE,ADD,SUBTRACT,INTERSECT with "Alpha to Selection" and "Mask to Selection". * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/selection_cmds.c: regenerated.
2003-08-21 23:54:47 +08:00
#include "gimp-utils.h"
#include "gimpboundary.h"
#include "gimpcontainer.h"
#include "gimperror.h"
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
#include "gimpimage.h"
#include "gimpimage-quick-mask.h"
#include "gimpimage-undo.h"
Moved the undo step implementations to the core and pass around lots of 2003-02-14 Michael Natterer <mitch@gimp.org> Moved the undo step implementations to the core and pass around lots of "const gchar *undo_desc". Fixes bug #104367. * app/Makefile.am * app/undo.[ch]: removed... * app/core/Makefile.am * app/core/gimpimage-undo-push.[ch]: ...and added here. * app/paint/Makefile.am * app/tools/Makefile.am * app/paint/gimppaintcore-undo.[ch] * app/tools/gimptransformtool-undo.[ch]: new files for the paint and transform undos. * app/core/gimppaintinfo.[ch]: added a blurb. * app/paint/gimpairbrush.c * app/paint/gimpclone.c * app/paint/gimpconvolve.c * app/paint/gimpdodgeburn.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/paint/gimppaintcore.c * app/paint/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint-types.h * app/paint/paint.c: pass the blurb when registering the core. * app/core/gimpdrawable.[ch] * app/core/gimpimage.[ch] * app/core/gimpimage-mask-select.[ch] * app/core/gimpimage-mask.[ch] * app/core/gimpimagemap.[ch] * app/core/gimplayer-floating-sel.[ch]: added "undo_desc" parameters to all undo pushing helper functions. * app/undo_history.c * app/core/gimpchannel.c * app/core/gimpdrawable-blend.c * app/core/gimpdrawable-bucket-fill.c * app/core/gimpdrawable-desaturate.c * app/core/gimpdrawable-equalize.c * app/core/gimpdrawable-invert.c * app/core/gimpdrawable-offset.c * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-convert.c * app/core/gimpimage-crop.c * app/core/gimpimage-guides.c * app/core/gimpimage-merge.c * app/core/gimpimage-qmask.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage-undo.c * app/core/gimpitem.c * app/core/gimplayer.c * app/core/gimplayermask.c * app/display/gimpdisplayshell-dnd.c * app/file/file-open.c * app/file/file-save.c * app/gui/channels-commands.c * app/gui/file-commands.c * app/gui/file-open-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/paths-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/text/gimptext-compat.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpimagemaptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimptexttool.c * app/tools/gimptransformtool.c * app/widgets/gimpchannellistview.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpselectioneditor.c * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/guides.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/selection_tools.pdb: changed accordingly: pass "undo_desc" strings, changed includes or simply removed inclusion of "undo.h". Some random cleanups. * tools/pdbgen/pdb/guides.pdb: cleaned up a lot. Fixed gimp_image_find_next_guide() to not return guides with position < 0 (and made it shorter and readable). * app/pdb/color_cmds.c * app/pdb/drawable_cmds.c * app/pdb/guides_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c * app/pdb/selection_tools_cmds.c: regenerated.
2003-02-14 22:14:29 +08:00
#include "gimpimage-undo-push.h"
#include "gimpchannel.h"
#include "gimpchannel-select.h"
#include "gimpcontext.h"
#include "gimpdrawable-fill.h"
#include "gimpdrawable-stroke.h"
#include "gimpmarshal.h"
added new virtual function GimpItem::stroke(). 2003-09-01 Michael Natterer <mitch@gimp.org> * app/core/gimpitem.[ch]: added new virtual function GimpItem::stroke(). * app/core/gimpchannel.c * app/vectors/gimpvectors.c: implement GimpItem::stroke(). * app/core/gimpimage-mask.[ch] (gimp_image_mask_stroke): changed signature to match gimp_item_stroke() (the selection mask *really* should be a GimpChannel subclass). Removed global variable "gboolean gimp_image_mask_stroking"... * app/core/gimpimage.[ch]: ...and added "gboolean mask_stroking" to the GimpImage struct. * app/gui/vectors-commands.[ch]: removed vectors_stroke_vectors(). * app/widgets/widgets-types.h: removed GimpStrokeItemFunc typedef. * app/widgets/gimpvectorstreeview.[ch]: removed "stroke_item_func" member and use gimp_item_stroke() instead. * app/gui/dialogs-constructors.c (dialogs_vectors_list_view_new) * app/gui/edit-commands.c (edit_stroke_cmd_callback) * app/gui/vectors-commands. (vectors_stroke_cmd_callback) * app/widgets/gimpselectioneditor.c (gimp_selection_editor_stroke_clicked) * tools/pdbgen/pdb/edit.pdb (gimp_edit_stroke): changed accordingly. * app/pdb/edit_cmds.c: regenerated. Note that there is no GUI for "stroke channel", although it would be utterly cool to have one, since currently slelection stroking cannot be masked by a selection (because we stroke the selection). Anyway, if anyone has an idea how to trigger "stroke channel" with another drawable active (the one to stroke to), please let me know...
2003-09-02 01:56:44 +08:00
#include "gimppaintinfo.h"
#include "gimppickable.h"
#include "gimpstrokeoptions.h"
app/Makefile.am removed. 2001-07-08 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/drawable.[ch]: removed. * app/core/gimpdrawable.[ch]: added the functions here. Made an end to the myth that FG/BG and the undo system (!!!) are not really part of the core. * app/disp_callbacks.c * app/floating_sel.c * app/image_map.c * app/qmask.c * app/undo.c * app/core/gimpchannel.c * app/core/gimpdrawable-desaturate.c * app/core/gimpdrawable-equalize.c * app/core/gimpdrawable-invert.c * app/core/gimpdrawable-offset.c * app/core/gimpedit.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimpimage-new.c * app/core/gimpimage.[ch] * app/core/gimplayer.c * app/core/gimplayermask.c * app/gui/channels-commands.c * app/gui/gui.c * app/gui/layers-commands.c * app/tools/gimpairbrushtool.c * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimplevelstool.c * app/tools/gimppainttool.c * app/tools/gimpposterizetool.c * app/tools/gimpscaletool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c * app/tools/tool_manager.c * app/widgets/gimpchannellistitem.c * app/widgets/gimpchannellistview.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/parasite_cmds.c * app/pdb/selection_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/tools_cmds.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb: changed accordingly. Misc small fixes and cleanups.
2001-07-08 06:49:01 +08:00
#include "gimp-intl.h"
enum
{
COLOR_CHANGED,
LAST_SIGNAL
};
static void gimp_channel_pickable_iface_init (GimpPickableInterface *iface);
static void gimp_channel_finalize (GObject *object);
static gint64 gimp_channel_get_memsize (GimpObject *object,
gint64 *gui_size);
static gchar * gimp_channel_get_description (GimpViewable *viewable,
gchar **tooltip);
static GeglNode * gimp_channel_get_node (GimpFilter *filter);
static gboolean gimp_channel_is_attached (GimpItem *item);
static GimpItemTree * gimp_channel_get_tree (GimpItem *item);
static gboolean gimp_channel_bounds (GimpItem *item,
gdouble *x,
gdouble *y,
gdouble *width,
gdouble *height);
static GimpItem * gimp_channel_duplicate (GimpItem *item,
GType new_type);
static void gimp_channel_convert (GimpItem *item,
GimpImage *dest_image,
GType old_type);
static void gimp_channel_translate (GimpItem *item,
gdouble off_x,
gdouble off_y,
gboolean push_undo);
static void gimp_channel_scale (GimpItem *item,
gint new_width,
gint new_height,
gint new_offset_x,
gint new_offset_y,
GimpInterpolationType interp_type,
GimpProgress *progress);
static void gimp_channel_resize (GimpItem *item,
GimpContext *context,
GimpFillType fill_type,
gint new_width,
gint new_height,
gint offset_x,
gint offset_y);
static void gimp_channel_flip (GimpItem *item,
GimpContext *context,
GimpOrientationType flip_type,
gdouble axis,
gboolean flip_result);
static void gimp_channel_rotate (GimpItem *item,
GimpContext *context,
GimpRotationType flip_type,
gdouble center_x,
gdouble center_y,
gboolean flip_result);
static void gimp_channel_transform (GimpItem *item,
GimpContext *context,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
GimpTransformResize clip_result,
GimpProgress *progress);
static gboolean gimp_channel_fill (GimpItem *item,
GimpDrawable *drawable,
GimpFillOptions *fill_options,
gboolean push_undo,
GimpProgress *progress,
GError **error);
static gboolean gimp_channel_stroke (GimpItem *item,
GimpDrawable *drawable,
GimpStrokeOptions *stroke_options,
gboolean push_undo,
GimpProgress *progress,
GError **error);
static void gimp_channel_to_selection (GimpItem *item,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
static void gimp_channel_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpColorProfile *dest_profile,
GeglDitherMethod layer_dither_type,
GeglDitherMethod mask_dither_type,
gboolean push_undo,
GimpProgress *progress);
static void gimp_channel_invalidate_boundary (GimpDrawable *drawable);
static void gimp_channel_get_active_components (GimpDrawable *drawable,
gboolean *active);
static GimpComponentMask
gimp_channel_get_active_mask (GimpDrawable *drawable);
static void gimp_channel_set_buffer (GimpDrawable *drawable,
gboolean push_undo,
const gchar *undo_desc,
GeglBuffer *buffer,
gint offset_x,
gint offset_y);
static gdouble gimp_channel_get_opacity_at (GimpPickable *pickable,
gint x,
gint y);
static gboolean gimp_channel_real_boundary (GimpChannel *channel,
const GimpBoundSeg **segs_in,
const GimpBoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
static gboolean gimp_channel_real_is_empty (GimpChannel *channel);
static void gimp_channel_real_feather (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
gboolean push_undo);
static void gimp_channel_real_sharpen (GimpChannel *channel,
gboolean push_undo);
static void gimp_channel_real_clear (GimpChannel *channel,
const gchar *undo_desc,
gboolean push_undo);
static void gimp_channel_real_all (GimpChannel *channel,
gboolean push_undo);
static void gimp_channel_real_invert (GimpChannel *channel,
gboolean push_undo);
static void gimp_channel_real_border (GimpChannel *channel,
gint radius_x,
gint radius_y,
GimpChannelBorderStyle style,
gboolean edge_lock,
gboolean push_undo);
static void gimp_channel_real_grow (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean push_undo);
static void gimp_channel_real_shrink (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean edge_lock,
gboolean push_undo);
2016-01-26 07:11:51 +08:00
static void gimp_channel_real_flood (GimpChannel *channel,
gboolean push_undo);
static void gimp_channel_buffer_changed (GeglBuffer *buffer,
const GeglRectangle *rect,
GimpChannel *channel);
G_DEFINE_TYPE_WITH_CODE (GimpChannel, gimp_channel, GIMP_TYPE_DRAWABLE,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_PICKABLE,
gimp_channel_pickable_iface_init))
#define parent_class gimp_channel_parent_class
static guint channel_signals[LAST_SIGNAL] = { 0 };
static void
gimp_channel_class_init (GimpChannelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
GimpFilterClass *filter_class = GIMP_FILTER_CLASS (klass);
GimpItemClass *item_class = GIMP_ITEM_CLASS (klass);
GimpDrawableClass *drawable_class = GIMP_DRAWABLE_CLASS (klass);
channel_signals[COLOR_CHANGED] =
g_signal_new ("color-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpChannelClass, color_changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->finalize = gimp_channel_finalize;
gimp_object_class->get_memsize = gimp_channel_get_memsize;
viewable_class->get_description = gimp_channel_get_description;
viewable_class->default_icon_name = "gimp-channel";
filter_class->get_node = gimp_channel_get_node;
item_class->is_attached = gimp_channel_is_attached;
item_class->get_tree = gimp_channel_get_tree;
item_class->bounds = gimp_channel_bounds;
item_class->duplicate = gimp_channel_duplicate;
item_class->convert = gimp_channel_convert;
item_class->translate = gimp_channel_translate;
item_class->scale = gimp_channel_scale;
item_class->resize = gimp_channel_resize;
item_class->flip = gimp_channel_flip;
item_class->rotate = gimp_channel_rotate;
item_class->transform = gimp_channel_transform;
item_class->fill = gimp_channel_fill;
item_class->stroke = gimp_channel_stroke;
item_class->to_selection = gimp_channel_to_selection;
item_class->default_name = _("Channel");
item_class->rename_desc = C_("undo-type", "Rename Channel");
item_class->translate_desc = C_("undo-type", "Move Channel");
item_class->scale_desc = C_("undo-type", "Scale Channel");
item_class->resize_desc = C_("undo-type", "Resize Channel");
item_class->flip_desc = C_("undo-type", "Flip Channel");
item_class->rotate_desc = C_("undo-type", "Rotate Channel");
item_class->transform_desc = C_("undo-type", "Transform Channel");
item_class->fill_desc = C_("undo-type", "Fill Channel");
item_class->stroke_desc = C_("undo-type", "Stroke Channel");
item_class->to_selection_desc = C_("undo-type", "Channel to Selection");
item_class->reorder_desc = C_("undo-type", "Reorder Channel");
item_class->raise_desc = C_("undo-type", "Raise Channel");
item_class->raise_to_top_desc = C_("undo-type", "Raise Channel to Top");
item_class->lower_desc = C_("undo-type", "Lower Channel");
item_class->lower_to_bottom_desc = C_("undo-type", "Lower Channel to Bottom");
item_class->raise_failed = _("Channel cannot be raised higher.");
item_class->lower_failed = _("Channel cannot be lowered more.");
drawable_class->convert_type = gimp_channel_convert_type;
drawable_class->invalidate_boundary = gimp_channel_invalidate_boundary;
drawable_class->get_active_components = gimp_channel_get_active_components;
drawable_class->get_active_mask = gimp_channel_get_active_mask;
drawable_class->set_buffer = gimp_channel_set_buffer;
klass->boundary = gimp_channel_real_boundary;
klass->is_empty = gimp_channel_real_is_empty;
klass->feather = gimp_channel_real_feather;
klass->sharpen = gimp_channel_real_sharpen;
klass->clear = gimp_channel_real_clear;
klass->all = gimp_channel_real_all;
klass->invert = gimp_channel_real_invert;
klass->border = gimp_channel_real_border;
klass->grow = gimp_channel_real_grow;
klass->shrink = gimp_channel_real_shrink;
klass->flood = gimp_channel_real_flood;
klass->feather_desc = C_("undo-type", "Feather Channel");
klass->sharpen_desc = C_("undo-type", "Sharpen Channel");
klass->clear_desc = C_("undo-type", "Clear Channel");
klass->all_desc = C_("undo-type", "Fill Channel");
klass->invert_desc = C_("undo-type", "Invert Channel");
klass->border_desc = C_("undo-type", "Border Channel");
klass->grow_desc = C_("undo-type", "Grow Channel");
klass->shrink_desc = C_("undo-type", "Shrink Channel");
klass->flood_desc = C_("undo-type", "Flood Channel");
}
static void
gimp_channel_init (GimpChannel *channel)
{
gimp_rgba_set (&channel->color, 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE);
channel->show_masked = FALSE;
/* Selection mask variables */
Move away from creating all item_factories statically in menus_init() but 2003-01-10 Michael Natterer <mitch@gimp.org> Move away from creating all item_factories statically in menus_init() but create a new one for each place where one is needed: * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpmenufactory.[ch]: new factory which creates and configures the GimpItemFactories it knows about on-the-fly. * app/widgets/gimpitemfactory.[ch]: added gimp_item_factory_update() which calls the "update_func". Added "gboolean update_on_popup" so item_factories can be configured to require manual updates (used for the <Image> factory). * app/gui/menus.[ch]: create a "global_menu_factory" and register all menus we have with it. Added various setup functions which do stuff like adding the "Open Recent" menu or reorder plug-in menu entries. Removed the debugging stuff... * app/gui/Makefile.am * app/gui/debug-commands.[ch]: ...and added it here. * app/gui/gui.c: create the <Toolbox>, the popup-<Image> and the <Paths> factories here because they are still global. * app/gui/plug-in-menus.[ch]: changed the "image_factory" parameters to "item_factory" and create/update the entries for the passed item_factory only. Makes the whole stuff much more straightforward. * app/plug-in/plug-ins.c: don't call plug_in_make_menu(). * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added "menu_factory" and "popup_factory" parameters to gimp_display_new() and gimp_display_shell_new(). Create the menubar_factory and the qmask_factory dynamically. Pass the shell, not a Gimp to the QMask callbacks. Changed gimp_display_shell_set_menu_sensitivity() to gimp_display_shell_menu_update() and don't call it directly (it's a GimpItemFactory update_func now). Call gimp_item_factory_update() on the resp. factories instead. * app/gui/qmask-commands.c * app/display/gimpdisplayshell-callbacks.c * app/tools/gimpimagemaptool.c: changed accordingly. * app/widgets/gimpbrusheditor.c * app/widgets/gimpbrushfactoryview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpdataeditor.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdialogfactory.[ch] * app/widgets/gimpdock.c * app/widgets/gimpdockbook.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimpimageview.[ch] * app/widgets/gimpitemlistview.[ch] * app/widgets/gimppaletteeditor.[ch]: pass around lots of GimpMenuFactory pointers and menu_identifiers so all views can create their item_factories themselves. Unref the factories when they are no longer needed because they belong to the views now. * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/dialogs.c * app/gui/brush-select.c * app/gui/gradient-select.c * app/gui/palette-select.c * app/gui/pattern-select.c: changed accordingly. * app/gui/file-dialog-utils.[ch] (file_dialog_new): require menu_factory and menu_identifier parameters. * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.[ch]: removed file_*_dialog_menu_init() (they went to menus.c as setup_funcs). Added file_*_dialog_set_type() and moved the <Load> and <Save> factory callbacks to file-commands.c * app/gui/file-commands.[ch]: changed accordingly. * app/gui/view-commands.c: changed the statusbar, menubar, rulers and guides callbacks to do their job only if the setting has actually changed. Don't update whole item factories afterwards. Instead, just change the state of the items that actually need update. Unrelated: * app/core/gimpchannel.c (gimp_channel_init): set "bounds_known" and friends to FALSE since we don't know that the new channel will be empty (fixes QMask and probably other stuff). * app/gui/image-commands.c * app/gui/vectors-commands.c: cleanup.
2003-01-11 01:55:53 +08:00
channel->boundary_known = FALSE;
channel->segs_in = NULL;
channel->segs_out = NULL;
channel->num_segs_in = 0;
channel->num_segs_out = 0;
Move away from creating all item_factories statically in menus_init() but 2003-01-10 Michael Natterer <mitch@gimp.org> Move away from creating all item_factories statically in menus_init() but create a new one for each place where one is needed: * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpmenufactory.[ch]: new factory which creates and configures the GimpItemFactories it knows about on-the-fly. * app/widgets/gimpitemfactory.[ch]: added gimp_item_factory_update() which calls the "update_func". Added "gboolean update_on_popup" so item_factories can be configured to require manual updates (used for the <Image> factory). * app/gui/menus.[ch]: create a "global_menu_factory" and register all menus we have with it. Added various setup functions which do stuff like adding the "Open Recent" menu or reorder plug-in menu entries. Removed the debugging stuff... * app/gui/Makefile.am * app/gui/debug-commands.[ch]: ...and added it here. * app/gui/gui.c: create the <Toolbox>, the popup-<Image> and the <Paths> factories here because they are still global. * app/gui/plug-in-menus.[ch]: changed the "image_factory" parameters to "item_factory" and create/update the entries for the passed item_factory only. Makes the whole stuff much more straightforward. * app/plug-in/plug-ins.c: don't call plug_in_make_menu(). * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch]: added "menu_factory" and "popup_factory" parameters to gimp_display_new() and gimp_display_shell_new(). Create the menubar_factory and the qmask_factory dynamically. Pass the shell, not a Gimp to the QMask callbacks. Changed gimp_display_shell_set_menu_sensitivity() to gimp_display_shell_menu_update() and don't call it directly (it's a GimpItemFactory update_func now). Call gimp_item_factory_update() on the resp. factories instead. * app/gui/qmask-commands.c * app/display/gimpdisplayshell-callbacks.c * app/tools/gimpimagemaptool.c: changed accordingly. * app/widgets/gimpbrusheditor.c * app/widgets/gimpbrushfactoryview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpdataeditor.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdialogfactory.[ch] * app/widgets/gimpdock.c * app/widgets/gimpdockbook.[ch] * app/widgets/gimpdocumentview.[ch] * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimpimageview.[ch] * app/widgets/gimpitemlistview.[ch] * app/widgets/gimppaletteeditor.[ch]: pass around lots of GimpMenuFactory pointers and menu_identifiers so all views can create their item_factories themselves. Unref the factories when they are no longer needed because they belong to the views now. * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/dialogs.c * app/gui/brush-select.c * app/gui/gradient-select.c * app/gui/palette-select.c * app/gui/pattern-select.c: changed accordingly. * app/gui/file-dialog-utils.[ch] (file_dialog_new): require menu_factory and menu_identifier parameters. * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.[ch]: removed file_*_dialog_menu_init() (they went to menus.c as setup_funcs). Added file_*_dialog_set_type() and moved the <Load> and <Save> factory callbacks to file-commands.c * app/gui/file-commands.[ch]: changed accordingly. * app/gui/view-commands.c: changed the statusbar, menubar, rulers and guides callbacks to do their job only if the setting has actually changed. Don't update whole item factories afterwards. Instead, just change the state of the items that actually need update. Unrelated: * app/core/gimpchannel.c (gimp_channel_init): set "bounds_known" and friends to FALSE since we don't know that the new channel will be empty (fixes QMask and probably other stuff). * app/gui/image-commands.c * app/gui/vectors-commands.c: cleanup.
2003-01-11 01:55:53 +08:00
channel->empty = FALSE;
channel->bounds_known = FALSE;
channel->x1 = 0;
channel->y1 = 0;
channel->x2 = 0;
channel->y2 = 0;
}
1997-11-25 06:05:25 +08:00
static void
gimp_channel_pickable_iface_init (GimpPickableInterface *iface)
{
iface->get_opacity_at = gimp_channel_get_opacity_at;
}
static void
gimp_channel_finalize (GObject *object)
{
GimpChannel *channel = GIMP_CHANNEL (object);
if (channel->segs_in)
{
g_free (channel->segs_in);
channel->segs_in = NULL;
}
if (channel->segs_out)
{
g_free (channel->segs_out);
channel->segs_out = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
1997-11-25 06:05:25 +08:00
static gint64
changed GimpObject::get_memsize() to return a second value named 2003-08-25 Michael Natterer <mitch@gimp.org> * app/core/gimpobject.[ch]: changed GimpObject::get_memsize() to return a second value named "gui_size", where the primary return value is the "constant" actual size (as long as no operation is performed on the object), and the second "gui_size" return value is the size of temporary stuff like preview caches or boundary segments (which may change asynchronously, even if the object is on the undo stack). * app/core/gimp.c * app/core/gimpbrush.c * app/core/gimpbrushpipe.c * app/core/gimpbuffer.c * app/core/gimpchannel.c * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdata.c * app/core/gimpdatafactory.c * app/core/gimpdrawable.c * app/core/gimpgradient.c * app/core/gimpimage-undo.c * app/core/gimpimage.c * app/core/gimpitem.c * app/core/gimplayer.c * app/core/gimplist.c * app/core/gimppalette.c * app/core/gimpparasitelist.c * app/core/gimppattern.c * app/core/gimpundo.c * app/core/gimpundostack.c * app/core/gimpviewable.c * app/text/gimptextlayer.c * app/vectors/gimpstroke.c * app/vectors/gimpvectors.c: changed get_memsize() implementations accordingly. * app/display/gimpdisplayshell-title.c * app/gui/debug-commands.c * app/widgets/gimppreview.c: changed callers accordingly. * app/core/gimpimage-undo-push.c: changed layer, channel, vectors and layer_mask undo steps to add/subtract the size of the resp. objects whenever they take/drop ownership of them. Ignore the objects' "gui_size" to get identical sizes on adding/subtracting. Fixes bug #120429.
2003-08-25 18:49:33 +08:00
gimp_channel_get_memsize (GimpObject *object,
gint64 *gui_size)
{
GimpChannel *channel = GIMP_CHANNEL (object);
*gui_size += channel->num_segs_in * sizeof (GimpBoundSeg);
*gui_size += channel->num_segs_out * sizeof (GimpBoundSeg);
changed GimpObject::get_memsize() to return a second value named 2003-08-25 Michael Natterer <mitch@gimp.org> * app/core/gimpobject.[ch]: changed GimpObject::get_memsize() to return a second value named "gui_size", where the primary return value is the "constant" actual size (as long as no operation is performed on the object), and the second "gui_size" return value is the size of temporary stuff like preview caches or boundary segments (which may change asynchronously, even if the object is on the undo stack). * app/core/gimp.c * app/core/gimpbrush.c * app/core/gimpbrushpipe.c * app/core/gimpbuffer.c * app/core/gimpchannel.c * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdata.c * app/core/gimpdatafactory.c * app/core/gimpdrawable.c * app/core/gimpgradient.c * app/core/gimpimage-undo.c * app/core/gimpimage.c * app/core/gimpitem.c * app/core/gimplayer.c * app/core/gimplist.c * app/core/gimppalette.c * app/core/gimpparasitelist.c * app/core/gimppattern.c * app/core/gimpundo.c * app/core/gimpundostack.c * app/core/gimpviewable.c * app/text/gimptextlayer.c * app/vectors/gimpstroke.c * app/vectors/gimpvectors.c: changed get_memsize() implementations accordingly. * app/display/gimpdisplayshell-title.c * app/gui/debug-commands.c * app/widgets/gimppreview.c: changed callers accordingly. * app/core/gimpimage-undo-push.c: changed layer, channel, vectors and layer_mask undo steps to add/subtract the size of the resp. objects whenever they take/drop ownership of them. Ignore the objects' "gui_size" to get identical sizes on adding/subtracting. Fixes bug #120429.
2003-08-25 18:49:33 +08:00
return GIMP_OBJECT_CLASS (parent_class)->get_memsize (object, gui_size);
}
static gchar *
gimp_channel_get_description (GimpViewable *viewable,
gchar **tooltip)
{
if (! strcmp (GIMP_IMAGE_QUICK_MASK_NAME,
gimp_object_get_name (viewable)))
{
return g_strdup (_("Quick Mask"));
}
return GIMP_VIEWABLE_CLASS (parent_class)->get_description (viewable,
tooltip);
}
static GeglNode *
gimp_channel_get_node (GimpFilter *filter)
{
GimpDrawable *drawable = GIMP_DRAWABLE (filter);
GimpChannel *channel = GIMP_CHANNEL (filter);
GeglNode *node;
GeglNode *source;
GeglNode *mode_node;
const Babl *color_format;
node = GIMP_FILTER_CLASS (parent_class)->get_node (filter);
source = gimp_drawable_get_source_node (drawable);
gegl_node_add_child (node, source);
g_warn_if_fail (channel->color_node == NULL);
Initial space invasion commit in GIMP All babl formats now have a space equivalent to a color profile, determining the format's primaries and TRCs. This commit makes GIMP aware of this. libgimp: - enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA as deprecated aliases, add PERCEPTUAL values so we now have LINEAR, NON_LINEAR and PERCPTUAL for each encoding, matching the babl encoding variants RGB, R'G'B' and R~G~B~. - gimp_color_transform_can_gegl_copy() now returns TRUE if both profiles can return a babl space, increasing the amount of fast babl color conversions significantly. - TODO: no solution yet for getting libgimp drawable proxy buffers in the right format with space. plug-ins: - follow the GimpPrecision change. - TODO: everything else unchanged and partly broken or sub-optimal, like setting a new image's color profile too late. app: - add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as replacement for all "linear" booleans. - change gimp-babl functions to take babl spaces and GimpTRCType parameters and support all sorts of new perceptual ~ formats. - a lot of places changed in the early days of goat invasion didn't take advantage of gimp-babl utility functions and constructed formats manually. They all needed revisiting and many now use much simpler code calling gimp-babl API. - change gimp_babl_format_get_color_profile() to really extract a newly allocated color profile from the format, and add gimp_babl_get_builtin_color_profile() which does the same as gimp_babl_format_get_color_profile() did before. Visited all callers to decide whether they are looking for the format's actual profile, or for one of the builtin profiles, simplifying code that only needs builtin profiles. - drawables have a new get_space_api(), get_linear() is now get_trc(). - images now have a "layer space" and an API to get it, gimp_image_get_layer_format() returns formats in that space. - an image's layer space is created from the image's color profile, change gimpimage-color-profile to deal with that correctly - change many babl_format() calls to babl_format_with_space() and take the space from passed formats or drawables - add function gimp_layer_fix_format_space() which replaces the layer's buffer with one that has the image's layer format, but doesn't change pixel values - use gimp_layer_fix_format_space() to make sure layers loaded from XCF and created by plug-ins have the right space when added to the image, because it's impossible to always assign the right space upon layer creation - "assign color profile" and "discard color profile" now require use of gimp_layer_fix_format_space() too because the profile is now embedded in all formats via the space. Add gimp_image_assign_color_profile() which does all that and call it instead of a simple gimp_image_set_color_profile(), also from the PDB set-color-profile functions, which are essentially "assign" and "discard" calls. - generally, make sure a new image's color profile is set before adding layers to it, gimp_image_set_color_profile() is more than before considered know-what-you-are-doing API. - take special precaution in all places that call gimp_drawable_convert_type(), we now must pass a new_profile from all callers that convert layers within the same image (such as image_convert_type, image_convert_precision), because the layer's new space can't be determined from the image's layer format during the call. - change all "linear" properties to "trc", in all config objects like for levels and curves, in the histogram, in the widgets. This results in some GUI that now has three choices instead of two. TODO: we might want to reduce that back to two later. - keep "linear" boolean properties around as compat if needed for file pasring, but always convert the parsed parsed boolean to GimpTRCType. - TODO: the image's "enable color management" switch is currently broken, will fix that in another commit.
2018-07-21 20:23:01 +08:00
color_format =
gimp_babl_format (GIMP_RGB,
gimp_babl_precision (GIMP_COMPONENT_TYPE_FLOAT,
gimp_drawable_get_trc (drawable)),
TRUE, NULL);
channel->color_node = gegl_node_new_child (node,
"operation", "gegl:color",
"format", color_format,
NULL);
gimp_gegl_node_set_color (channel->color_node,
&channel->color);
g_warn_if_fail (channel->mask_node == NULL);
channel->mask_node = gegl_node_new_child (node,
"operation", "gegl:opacity",
NULL);
gegl_node_connect_to (channel->color_node, "output",
channel->mask_node, "input");
g_warn_if_fail (channel->invert_node == NULL);
channel->invert_node = gegl_node_new_child (node,
"operation", "gegl:invert-linear",
NULL);
if (channel->show_masked)
{
gegl_node_connect_to (source, "output",
channel->invert_node, "input");
gegl_node_connect_to (channel->invert_node, "output",
channel->mask_node, "aux");
}
else
{
gegl_node_connect_to (source, "output",
channel->mask_node, "aux");
}
mode_node = gimp_drawable_get_mode_node (drawable);
gegl_node_connect_to (channel->mask_node, "output",
mode_node, "aux");
return node;
}
static gboolean
gimp_channel_is_attached (GimpItem *item)
{
GimpImage *image = gimp_item_get_image (item);
return (GIMP_IS_IMAGE (image) &&
gimp_container_have (gimp_image_get_channels (image),
GIMP_OBJECT (item)));
}
static GimpItemTree *
gimp_channel_get_tree (GimpItem *item)
{
if (gimp_item_is_attached (item))
{
GimpImage *image = gimp_item_get_image (item);
return gimp_image_get_channel_tree (image);
}
return NULL;
}
static gboolean
gimp_channel_bounds (GimpItem *item,
gdouble *x,
gdouble *y,
gdouble *width,
gdouble *height)
{
GimpChannel *channel = GIMP_CHANNEL (item);
if (! channel->bounds_known)
{
GeglBuffer *buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
channel->empty = ! gimp_gegl_mask_bounds (buffer,
&channel->x1,
&channel->y1,
&channel->x2,
&channel->y2);
channel->bounds_known = TRUE;
}
*x = channel->x1;
*y = channel->y1;
*width = channel->x2 - channel->x1;
*height = channel->y2 - channel->y1;
return ! channel->empty;
}
static GimpItem *
gimp_channel_duplicate (GimpItem *item,
GType new_type)
{
GimpItem *new_item;
g_return_val_if_fail (g_type_is_a (new_type, GIMP_TYPE_DRAWABLE), NULL);
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
if (GIMP_IS_CHANNEL (new_item))
{
GimpChannel *channel = GIMP_CHANNEL (item);
GimpChannel *new_channel = GIMP_CHANNEL (new_item);
new_channel->color = channel->color;
new_channel->show_masked = channel->show_masked;
/* selection mask variables */
new_channel->bounds_known = channel->bounds_known;
new_channel->empty = channel->empty;
new_channel->x1 = channel->x1;
new_channel->y1 = channel->y1;
new_channel->x2 = channel->x2;
new_channel->y2 = channel->y2;
if (new_type == GIMP_TYPE_CHANNEL)
{
/* 8-bit channel hack: make sure pixels between all sorts
* of channels of an image is always copied without any
* gamma conversion
*/
GimpDrawable *new_drawable = GIMP_DRAWABLE (new_item);
GimpImage *image = gimp_item_get_image (item);
const Babl *format = gimp_image_get_channel_format (image);
if (format != gimp_drawable_get_format (new_drawable))
{
GeglBuffer *new_buffer;
new_buffer =
gegl_buffer_new (GEGL_RECTANGLE (0, 0,
gimp_item_get_width (new_item),
gimp_item_get_height (new_item)),
format);
gegl_buffer_set_format (new_buffer,
gimp_drawable_get_format (new_drawable));
gimp_gegl_buffer_copy (gimp_drawable_get_buffer (new_drawable),
NULL, GEGL_ABYSS_NONE,
new_buffer, NULL);
gegl_buffer_set_format (new_buffer, NULL);
gimp_drawable_set_buffer (new_drawable, FALSE, NULL, new_buffer);
g_object_unref (new_buffer);
}
}
}
return new_item;
}
static void
gimp_channel_convert (GimpItem *item,
GimpImage *dest_image,
GType old_type)
{
GimpChannel *channel = GIMP_CHANNEL (item);
GimpDrawable *drawable = GIMP_DRAWABLE (item);
if (! gimp_drawable_is_gray (drawable))
{
gimp_drawable_convert_type (drawable, dest_image,
GIMP_GRAY,
gimp_image_get_precision (dest_image),
gimp_drawable_has_alpha (drawable),
NULL,
GEGL_DITHER_NONE, GEGL_DITHER_NONE,
FALSE, NULL);
}
if (gimp_drawable_has_alpha (drawable))
{
GeglBuffer *new_buffer;
const Babl *format;
GimpRGB background;
format = gimp_drawable_get_format_without_alpha (drawable);
new_buffer =
gegl_buffer_new (GEGL_RECTANGLE (0, 0,
gimp_item_get_width (item),
gimp_item_get_height (item)),
format);
gimp_rgba_set (&background, 0.0, 0.0, 0.0, 0.0);
gimp_gegl_apply_flatten (gimp_drawable_get_buffer (drawable),
NULL, NULL,
new_buffer, &background,
GIMP_LAYER_COLOR_SPACE_RGB_LINEAR);
gimp_drawable_set_buffer_full (drawable, FALSE, NULL,
new_buffer,
gimp_item_get_offset_x (item),
gimp_item_get_offset_y (item));
g_object_unref (new_buffer);
}
if (G_TYPE_FROM_INSTANCE (channel) == GIMP_TYPE_CHANNEL)
{
gint width = gimp_image_get_width (dest_image);
gint height = gimp_image_get_height (dest_image);
gimp_item_set_offset (item, 0, 0);
if (gimp_item_get_width (item) != width ||
gimp_item_get_height (item) != height)
{
gimp_item_resize (item, gimp_get_user_context (dest_image->gimp),
GIMP_FILL_TRANSPARENT,
width, height, 0, 0);
}
}
GIMP_ITEM_CLASS (parent_class)->convert (item, dest_image, old_type);
}
static void
gimp_channel_translate (GimpItem *item,
gdouble off_x,
gdouble off_y,
gboolean push_undo)
{
GimpChannel *channel = GIMP_CHANNEL (item);
gint x, y, width, height;
gimp_item_bounds (GIMP_ITEM (channel), &x, &y, &width, &height);
/* update the old area */
gimp_drawable_update (GIMP_DRAWABLE (item), x, y, width, height);
if (push_undo)
gimp_channel_push_undo (channel, NULL);
To optimize duplicate and/or wrong image updates away, introduced new 2003-09-06 Michael Natterer <mitch@gimp.org> To optimize duplicate and/or wrong image updates away, introduced new policy that a child object must never explicitly update or invalidate its parent object (just like the GUI is not updated explicitly by the core): * app/core/gimpdrawable.[ch]: added new signal GimpDrawable::update(). Never update or invalidate the image when the drawable is updated or invalidated. (gimp_drawable_set_visible): don't gimp_drawable_update() the drawable since its pixels have not changed. * app/core/gimpimage.[ch]: connect to the "add" and "remove" signals of the layers and channels containers. Also connect to the "update" and "visibility_changed" signals of all drawables in these containers (optimizes away updates issued by drawables which are not yet added to the image and updates of the selection mask). Also, don't propagate updates to the image if the emitting drawable is invisible (optimizes away updates issued by invisible drawables). (gimp_image_add_layer,channel) (gimp_image_remove_layer,channel): don't update the image since that's done by our "add" and "remove" handlers now. (gimp_image_position_layer,channel): update just the image, not the drawable since its pixels have not changed. (gimp_image_real_colormap_changed) (gimp_image_set_component_visible): always call gimp_image_update() *and* gimp_viewable_invalidate_preview() to get everything updated, since update and invalidate of images are not connected. * app/core/gimpimage-undo-push.c (undo_pop_layer,channel): don't update the drawable since (a) its pixels don't change and (b) the image updates itself upon adding/removing now. (undo_pop_layer_mod): replaced gimp_image_update() by gimp_drawable_update() (just for consistency with other similar functions). * app/core/gimplayer.c: connect to "update" of the layer mask and issue updates on the layer if the mask update has any effect on the projection. (gimp_layer_create_mask): don't set the mask's offsets here since they may be different when we later add the mask to the layer. * app/core/gimplayermask.c (gimp_layer_mask_set_layer): set the mask offsets here instead. * app/core/gimpchannel.c (gimp_channel_translate): update the channel even if push_undo == FALSE. * app/paint/gimppaintcore.c (gimp_paint_core_finish) * app/tools/gimpinktool.c (ink_finish): invalidate both the drawable and the image preview since invalidating the drawable doesn't invalidate the image any more. * app/text/gimptextlayer.c (gimp_text_layer_render_now): also update the new extents of the text layer, not only the old one. (gimp_text_layer_render_layout): don't update the drawable since gimp_drawable_fill() already updated it.
2003-09-07 04:06:53 +08:00
if (gimp_rectangle_intersect (x + SIGNED_ROUND (off_x),
y + SIGNED_ROUND (off_y),
width, height,
0, 0,
gimp_item_get_width (GIMP_ITEM (channel)),
gimp_item_get_height (GIMP_ITEM (channel)),
&x, &y, &width, &height))
{
/* copy the portion of the mask we will keep to a temporary
* buffer
*/
GeglBuffer *tmp_buffer =
gegl_buffer_new (GEGL_RECTANGLE (0, 0, width, height),
gimp_drawable_get_format (GIMP_DRAWABLE (channel)));
gimp_gegl_buffer_copy (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
GEGL_RECTANGLE (x - SIGNED_ROUND (off_x),
y - SIGNED_ROUND (off_y),
width, height),
GEGL_ABYSS_NONE,
tmp_buffer,
GEGL_RECTANGLE (0, 0, 0, 0));
/* clear the mask */
gegl_buffer_clear (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL);
/* copy the temp mask back to the mask */
gimp_gegl_buffer_copy (tmp_buffer, NULL, GEGL_ABYSS_NONE,
gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
GEGL_RECTANGLE (x, y, 0, 0));
/* free the temporary mask */
g_object_unref (tmp_buffer);
channel->x1 = x;
channel->y1 = y;
channel->x2 = x + width;
channel->y2 = y + height;
}
else
{
/* clear the mask */
gegl_buffer_clear (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL);
channel->empty = TRUE;
channel->x1 = 0;
channel->y1 = 0;
channel->x2 = gimp_item_get_width (GIMP_ITEM (channel));
channel->y2 = gimp_item_get_height (GIMP_ITEM (channel));
}
To optimize duplicate and/or wrong image updates away, introduced new 2003-09-06 Michael Natterer <mitch@gimp.org> To optimize duplicate and/or wrong image updates away, introduced new policy that a child object must never explicitly update or invalidate its parent object (just like the GUI is not updated explicitly by the core): * app/core/gimpdrawable.[ch]: added new signal GimpDrawable::update(). Never update or invalidate the image when the drawable is updated or invalidated. (gimp_drawable_set_visible): don't gimp_drawable_update() the drawable since its pixels have not changed. * app/core/gimpimage.[ch]: connect to the "add" and "remove" signals of the layers and channels containers. Also connect to the "update" and "visibility_changed" signals of all drawables in these containers (optimizes away updates issued by drawables which are not yet added to the image and updates of the selection mask). Also, don't propagate updates to the image if the emitting drawable is invisible (optimizes away updates issued by invisible drawables). (gimp_image_add_layer,channel) (gimp_image_remove_layer,channel): don't update the image since that's done by our "add" and "remove" handlers now. (gimp_image_position_layer,channel): update just the image, not the drawable since its pixels have not changed. (gimp_image_real_colormap_changed) (gimp_image_set_component_visible): always call gimp_image_update() *and* gimp_viewable_invalidate_preview() to get everything updated, since update and invalidate of images are not connected. * app/core/gimpimage-undo-push.c (undo_pop_layer,channel): don't update the drawable since (a) its pixels don't change and (b) the image updates itself upon adding/removing now. (undo_pop_layer_mod): replaced gimp_image_update() by gimp_drawable_update() (just for consistency with other similar functions). * app/core/gimplayer.c: connect to "update" of the layer mask and issue updates on the layer if the mask update has any effect on the projection. (gimp_layer_create_mask): don't set the mask's offsets here since they may be different when we later add the mask to the layer. * app/core/gimplayermask.c (gimp_layer_mask_set_layer): set the mask offsets here instead. * app/core/gimpchannel.c (gimp_channel_translate): update the channel even if push_undo == FALSE. * app/paint/gimppaintcore.c (gimp_paint_core_finish) * app/tools/gimpinktool.c (ink_finish): invalidate both the drawable and the image preview since invalidating the drawable doesn't invalidate the image any more. * app/text/gimptextlayer.c (gimp_text_layer_render_now): also update the new extents of the text layer, not only the old one. (gimp_text_layer_render_layout): don't update the drawable since gimp_drawable_fill() already updated it.
2003-09-07 04:06:53 +08:00
/* update the new area */
gimp_drawable_update (GIMP_DRAWABLE (item),
channel->x1, channel->y1,
channel->x2 - channel->x1,
channel->y2 - channel->y1);
}
static void
gimp_channel_scale (GimpItem *item,
gint new_width,
gint new_height,
gint new_offset_x,
gint new_offset_y,
GimpInterpolationType interpolation_type,
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
GimpProgress *progress)
{
GimpChannel *channel = GIMP_CHANNEL (item);
if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
{
new_offset_x = 0;
new_offset_y = 0;
}
/* don't waste CPU cycles scaling an empty channel */
if (channel->bounds_known && channel->empty)
{
GimpDrawable *drawable = GIMP_DRAWABLE (item);
GeglBuffer *new_buffer;
new_buffer =
gegl_buffer_new (GEGL_RECTANGLE (0, 0, new_width, new_height),
gimp_drawable_get_format (drawable));
gimp_drawable_set_buffer_full (drawable,
gimp_item_is_attached (item), NULL,
new_buffer,
new_offset_x, new_offset_y);
g_object_unref (new_buffer);
gimp_channel_clear (GIMP_CHANNEL (item), NULL, FALSE);
}
else
{
GIMP_ITEM_CLASS (parent_class)->scale (item, new_width, new_height,
new_offset_x, new_offset_y,
interpolation_type, progress);
}
}
static void
gimp_channel_resize (GimpItem *item,
GimpContext *context,
GimpFillType fill_type,
gint new_width,
gint new_height,
gint offset_x,
gint offset_y)
{
GIMP_ITEM_CLASS (parent_class)->resize (item, context, GIMP_FILL_TRANSPARENT,
new_width, new_height,
offset_x, offset_y);
if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
{
gimp_item_set_offset (item, 0, 0);
}
}
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
static void
gimp_channel_flip (GimpItem *item,
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
GimpContext *context,
GimpOrientationType flip_type,
gdouble axis,
gboolean clip_result)
{
if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
clip_result = TRUE;
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
GIMP_ITEM_CLASS (parent_class)->flip (item, context, flip_type, axis,
clip_result);
}
static void
gimp_channel_rotate (GimpItem *item,
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
GimpContext *context,
GimpRotationType rotate_type,
gdouble center_x,
gdouble center_y,
gboolean clip_result)
{
/* don't default to clip_result == TRUE here */
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
GIMP_ITEM_CLASS (parent_class)->rotate (item, context,
rotate_type, center_x, center_y,
clip_result);
}
static void
gimp_channel_transform (GimpItem *item,
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
GimpContext *context,
const GimpMatrix3 *matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
GimpTransformResize clip_result,
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated.
2004-08-11 02:47:21 +08:00
GimpProgress *progress)
{
if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
clip_result = TRUE;
Get rid of the "current_context" which was in fact just a bunch of global 2004-04-15 Michael Natterer <mitch@gimp.org> Get rid of the "current_context" which was in fact just a bunch of global variables. Instead, pass the needed context all the way from the GUI and the PDB to the core. This is a prerequisite for macro recording and generally helps separating the various subsystems from each other. Work in progress... * app/core/gimp.[ch]: removed member "current_context" and gimp_[get|set]_current_context(). * app/core/gimp-edit.[ch] * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-bucket-fill.[ch] * app/core/gimpdrawable-offset.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-merge.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage.[ch] * app/core/gimpimagefile.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimplayer.[ch] * app/core/gimpselection.[ch] * app/core/gimptemplate.[ch] * app/file/file-open.[ch] * app/file/file-save.[ch] * app/pdb/procedural_db.[ch] * app/text/gimptext-compat.[ch] * app/text/gimptextlayer-transform.[ch] * app/gui/brush-select.[ch] * app/gui/font-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: added tons of "GimpContext *context" parameters and use the passed context instead of gimp_get_current_context(). * app/app_procs.c * app/batch.c * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/text/gimptextlayer.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimptransformtool.c * app/vectors/gimpvectors.c * app/gui/convert-dialog.c * app/gui/drawable-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/offset-dialog.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c * app/widgets/gimphelp.c * app/widgets/gimpthumbbox.c: pass gimp_get_user_context() or GIMP_CONTEXT(tool_options) or whatever is the right context to the changed core functions. * tools/pdbgen/app.pl: pass "GimpContext *context" to all generated PDB invokers. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/transform_tools.pdb: pass the new context parameter to the changed core functions. * app/pdb/*_cmds.c: regenerated.
2004-04-15 07:37:34 +08:00
GIMP_ITEM_CLASS (parent_class)->transform (item, context, matrix, direction,
interpolation_type,
clip_result,
progress);
}
static gboolean
gimp_channel_fill (GimpItem *item,
GimpDrawable *drawable,
GimpFillOptions *fill_options,
gboolean push_undo,
GimpProgress *progress,
GError **error)
{
GimpChannel *channel = GIMP_CHANNEL (item);
const GimpBoundSeg *segs_in;
const GimpBoundSeg *segs_out;
gint n_segs_in;
gint n_segs_out;
gint offset_x, offset_y;
if (! gimp_channel_boundary (channel, &segs_in, &segs_out,
&n_segs_in, &n_segs_out,
0, 0, 0, 0))
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("Cannot fill empty channel."));
return FALSE;
}
gimp_item_get_offset (item, &offset_x, &offset_y);
gimp_drawable_fill_boundary (drawable,
fill_options,
segs_in, n_segs_in,
offset_x, offset_y,
push_undo);
return TRUE;
}
added new virtual function GimpItem::stroke(). 2003-09-01 Michael Natterer <mitch@gimp.org> * app/core/gimpitem.[ch]: added new virtual function GimpItem::stroke(). * app/core/gimpchannel.c * app/vectors/gimpvectors.c: implement GimpItem::stroke(). * app/core/gimpimage-mask.[ch] (gimp_image_mask_stroke): changed signature to match gimp_item_stroke() (the selection mask *really* should be a GimpChannel subclass). Removed global variable "gboolean gimp_image_mask_stroking"... * app/core/gimpimage.[ch]: ...and added "gboolean mask_stroking" to the GimpImage struct. * app/gui/vectors-commands.[ch]: removed vectors_stroke_vectors(). * app/widgets/widgets-types.h: removed GimpStrokeItemFunc typedef. * app/widgets/gimpvectorstreeview.[ch]: removed "stroke_item_func" member and use gimp_item_stroke() instead. * app/gui/dialogs-constructors.c (dialogs_vectors_list_view_new) * app/gui/edit-commands.c (edit_stroke_cmd_callback) * app/gui/vectors-commands. (vectors_stroke_cmd_callback) * app/widgets/gimpselectioneditor.c (gimp_selection_editor_stroke_clicked) * tools/pdbgen/pdb/edit.pdb (gimp_edit_stroke): changed accordingly. * app/pdb/edit_cmds.c: regenerated. Note that there is no GUI for "stroke channel", although it would be utterly cool to have one, since currently slelection stroking cannot be masked by a selection (because we stroke the selection). Anyway, if anyone has an idea how to trigger "stroke channel" with another drawable active (the one to stroke to), please let me know...
2003-09-02 01:56:44 +08:00
static gboolean
gimp_channel_stroke (GimpItem *item,
GimpDrawable *drawable,
GimpStrokeOptions *stroke_options,
gboolean push_undo,
GimpProgress *progress,
GError **error)
added new virtual function GimpItem::stroke(). 2003-09-01 Michael Natterer <mitch@gimp.org> * app/core/gimpitem.[ch]: added new virtual function GimpItem::stroke(). * app/core/gimpchannel.c * app/vectors/gimpvectors.c: implement GimpItem::stroke(). * app/core/gimpimage-mask.[ch] (gimp_image_mask_stroke): changed signature to match gimp_item_stroke() (the selection mask *really* should be a GimpChannel subclass). Removed global variable "gboolean gimp_image_mask_stroking"... * app/core/gimpimage.[ch]: ...and added "gboolean mask_stroking" to the GimpImage struct. * app/gui/vectors-commands.[ch]: removed vectors_stroke_vectors(). * app/widgets/widgets-types.h: removed GimpStrokeItemFunc typedef. * app/widgets/gimpvectorstreeview.[ch]: removed "stroke_item_func" member and use gimp_item_stroke() instead. * app/gui/dialogs-constructors.c (dialogs_vectors_list_view_new) * app/gui/edit-commands.c (edit_stroke_cmd_callback) * app/gui/vectors-commands. (vectors_stroke_cmd_callback) * app/widgets/gimpselectioneditor.c (gimp_selection_editor_stroke_clicked) * tools/pdbgen/pdb/edit.pdb (gimp_edit_stroke): changed accordingly. * app/pdb/edit_cmds.c: regenerated. Note that there is no GUI for "stroke channel", although it would be utterly cool to have one, since currently slelection stroking cannot be masked by a selection (because we stroke the selection). Anyway, if anyone has an idea how to trigger "stroke channel" with another drawable active (the one to stroke to), please let me know...
2003-09-02 01:56:44 +08:00
{
GimpChannel *channel = GIMP_CHANNEL (item);
const GimpBoundSeg *segs_in;
const GimpBoundSeg *segs_out;
gint n_segs_in;
gint n_segs_out;
gboolean retval = FALSE;
gint offset_x, offset_y;
added new virtual function GimpItem::stroke(). 2003-09-01 Michael Natterer <mitch@gimp.org> * app/core/gimpitem.[ch]: added new virtual function GimpItem::stroke(). * app/core/gimpchannel.c * app/vectors/gimpvectors.c: implement GimpItem::stroke(). * app/core/gimpimage-mask.[ch] (gimp_image_mask_stroke): changed signature to match gimp_item_stroke() (the selection mask *really* should be a GimpChannel subclass). Removed global variable "gboolean gimp_image_mask_stroking"... * app/core/gimpimage.[ch]: ...and added "gboolean mask_stroking" to the GimpImage struct. * app/gui/vectors-commands.[ch]: removed vectors_stroke_vectors(). * app/widgets/widgets-types.h: removed GimpStrokeItemFunc typedef. * app/widgets/gimpvectorstreeview.[ch]: removed "stroke_item_func" member and use gimp_item_stroke() instead. * app/gui/dialogs-constructors.c (dialogs_vectors_list_view_new) * app/gui/edit-commands.c (edit_stroke_cmd_callback) * app/gui/vectors-commands. (vectors_stroke_cmd_callback) * app/widgets/gimpselectioneditor.c (gimp_selection_editor_stroke_clicked) * tools/pdbgen/pdb/edit.pdb (gimp_edit_stroke): changed accordingly. * app/pdb/edit_cmds.c: regenerated. Note that there is no GUI for "stroke channel", although it would be utterly cool to have one, since currently slelection stroking cannot be masked by a selection (because we stroke the selection). Anyway, if anyone has an idea how to trigger "stroke channel" with another drawable active (the one to stroke to), please let me know...
2003-09-02 01:56:44 +08:00
if (! gimp_channel_boundary (channel, &segs_in, &segs_out,
&n_segs_in, &n_segs_out,
added new virtual function GimpItem::stroke(). 2003-09-01 Michael Natterer <mitch@gimp.org> * app/core/gimpitem.[ch]: added new virtual function GimpItem::stroke(). * app/core/gimpchannel.c * app/vectors/gimpvectors.c: implement GimpItem::stroke(). * app/core/gimpimage-mask.[ch] (gimp_image_mask_stroke): changed signature to match gimp_item_stroke() (the selection mask *really* should be a GimpChannel subclass). Removed global variable "gboolean gimp_image_mask_stroking"... * app/core/gimpimage.[ch]: ...and added "gboolean mask_stroking" to the GimpImage struct. * app/gui/vectors-commands.[ch]: removed vectors_stroke_vectors(). * app/widgets/widgets-types.h: removed GimpStrokeItemFunc typedef. * app/widgets/gimpvectorstreeview.[ch]: removed "stroke_item_func" member and use gimp_item_stroke() instead. * app/gui/dialogs-constructors.c (dialogs_vectors_list_view_new) * app/gui/edit-commands.c (edit_stroke_cmd_callback) * app/gui/vectors-commands. (vectors_stroke_cmd_callback) * app/widgets/gimpselectioneditor.c (gimp_selection_editor_stroke_clicked) * tools/pdbgen/pdb/edit.pdb (gimp_edit_stroke): changed accordingly. * app/pdb/edit_cmds.c: regenerated. Note that there is no GUI for "stroke channel", although it would be utterly cool to have one, since currently slelection stroking cannot be masked by a selection (because we stroke the selection). Anyway, if anyone has an idea how to trigger "stroke channel" with another drawable active (the one to stroke to), please let me know...
2003-09-02 01:56:44 +08:00
0, 0, 0, 0))
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("Cannot stroke empty channel."));
added new virtual function GimpItem::stroke(). 2003-09-01 Michael Natterer <mitch@gimp.org> * app/core/gimpitem.[ch]: added new virtual function GimpItem::stroke(). * app/core/gimpchannel.c * app/vectors/gimpvectors.c: implement GimpItem::stroke(). * app/core/gimpimage-mask.[ch] (gimp_image_mask_stroke): changed signature to match gimp_item_stroke() (the selection mask *really* should be a GimpChannel subclass). Removed global variable "gboolean gimp_image_mask_stroking"... * app/core/gimpimage.[ch]: ...and added "gboolean mask_stroking" to the GimpImage struct. * app/gui/vectors-commands.[ch]: removed vectors_stroke_vectors(). * app/widgets/widgets-types.h: removed GimpStrokeItemFunc typedef. * app/widgets/gimpvectorstreeview.[ch]: removed "stroke_item_func" member and use gimp_item_stroke() instead. * app/gui/dialogs-constructors.c (dialogs_vectors_list_view_new) * app/gui/edit-commands.c (edit_stroke_cmd_callback) * app/gui/vectors-commands. (vectors_stroke_cmd_callback) * app/widgets/gimpselectioneditor.c (gimp_selection_editor_stroke_clicked) * tools/pdbgen/pdb/edit.pdb (gimp_edit_stroke): changed accordingly. * app/pdb/edit_cmds.c: regenerated. Note that there is no GUI for "stroke channel", although it would be utterly cool to have one, since currently slelection stroking cannot be masked by a selection (because we stroke the selection). Anyway, if anyone has an idea how to trigger "stroke channel" with another drawable active (the one to stroke to), please let me know...
2003-09-02 01:56:44 +08:00
return FALSE;
}
gimp_item_get_offset (item, &offset_x, &offset_y);
switch (gimp_stroke_options_get_method (stroke_options))
{
case GIMP_STROKE_LINE:
gimp_drawable_stroke_boundary (drawable,
stroke_options,
segs_in, n_segs_in,
offset_x, offset_y,
push_undo);
retval = TRUE;
break;
case GIMP_STROKE_PAINT_METHOD:
{
GimpPaintInfo *paint_info;
GimpPaintCore *core;
GimpPaintOptions *paint_options;
gboolean emulate_dynamics;
paint_info = gimp_context_get_paint_info (GIMP_CONTEXT (stroke_options));
core = g_object_new (paint_info->paint_type, NULL);
paint_options = gimp_stroke_options_get_paint_options (stroke_options);
emulate_dynamics = gimp_stroke_options_get_emulate_dynamics (stroke_options);
retval = gimp_paint_core_stroke_boundary (core, drawable,
paint_options,
emulate_dynamics,
segs_in, n_segs_in,
offset_x, offset_y,
push_undo, error);
added new virtual function GimpItem::stroke(). 2003-09-01 Michael Natterer <mitch@gimp.org> * app/core/gimpitem.[ch]: added new virtual function GimpItem::stroke(). * app/core/gimpchannel.c * app/vectors/gimpvectors.c: implement GimpItem::stroke(). * app/core/gimpimage-mask.[ch] (gimp_image_mask_stroke): changed signature to match gimp_item_stroke() (the selection mask *really* should be a GimpChannel subclass). Removed global variable "gboolean gimp_image_mask_stroking"... * app/core/gimpimage.[ch]: ...and added "gboolean mask_stroking" to the GimpImage struct. * app/gui/vectors-commands.[ch]: removed vectors_stroke_vectors(). * app/widgets/widgets-types.h: removed GimpStrokeItemFunc typedef. * app/widgets/gimpvectorstreeview.[ch]: removed "stroke_item_func" member and use gimp_item_stroke() instead. * app/gui/dialogs-constructors.c (dialogs_vectors_list_view_new) * app/gui/edit-commands.c (edit_stroke_cmd_callback) * app/gui/vectors-commands. (vectors_stroke_cmd_callback) * app/widgets/gimpselectioneditor.c (gimp_selection_editor_stroke_clicked) * tools/pdbgen/pdb/edit.pdb (gimp_edit_stroke): changed accordingly. * app/pdb/edit_cmds.c: regenerated. Note that there is no GUI for "stroke channel", although it would be utterly cool to have one, since currently slelection stroking cannot be masked by a selection (because we stroke the selection). Anyway, if anyone has an idea how to trigger "stroke channel" with another drawable active (the one to stroke to), please let me know...
2003-09-02 01:56:44 +08:00
g_object_unref (core);
}
break;
default:
g_return_val_if_reached (FALSE);
}
added new virtual function GimpItem::stroke(). 2003-09-01 Michael Natterer <mitch@gimp.org> * app/core/gimpitem.[ch]: added new virtual function GimpItem::stroke(). * app/core/gimpchannel.c * app/vectors/gimpvectors.c: implement GimpItem::stroke(). * app/core/gimpimage-mask.[ch] (gimp_image_mask_stroke): changed signature to match gimp_item_stroke() (the selection mask *really* should be a GimpChannel subclass). Removed global variable "gboolean gimp_image_mask_stroking"... * app/core/gimpimage.[ch]: ...and added "gboolean mask_stroking" to the GimpImage struct. * app/gui/vectors-commands.[ch]: removed vectors_stroke_vectors(). * app/widgets/widgets-types.h: removed GimpStrokeItemFunc typedef. * app/widgets/gimpvectorstreeview.[ch]: removed "stroke_item_func" member and use gimp_item_stroke() instead. * app/gui/dialogs-constructors.c (dialogs_vectors_list_view_new) * app/gui/edit-commands.c (edit_stroke_cmd_callback) * app/gui/vectors-commands. (vectors_stroke_cmd_callback) * app/widgets/gimpselectioneditor.c (gimp_selection_editor_stroke_clicked) * tools/pdbgen/pdb/edit.pdb (gimp_edit_stroke): changed accordingly. * app/pdb/edit_cmds.c: regenerated. Note that there is no GUI for "stroke channel", although it would be utterly cool to have one, since currently slelection stroking cannot be masked by a selection (because we stroke the selection). Anyway, if anyone has an idea how to trigger "stroke channel" with another drawable active (the one to stroke to), please let me know...
2003-09-02 01:56:44 +08:00
return retval;
}
static void
gimp_channel_to_selection (GimpItem *item,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GimpChannel *channel = GIMP_CHANNEL (item);
GimpImage *image = gimp_item_get_image (item);
gint off_x, off_y;
gimp_item_get_offset (item, &off_x, &off_y);
gimp_channel_select_channel (gimp_image_get_mask (image),
GIMP_ITEM_GET_CLASS (item)->to_selection_desc,
channel, off_x, off_y,
op,
feather, feather_radius_x, feather_radius_x);
}
static void
gimp_channel_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpColorProfile *dest_profile,
GeglDitherMethod layer_dither_type,
GeglDitherMethod mask_dither_type,
gboolean push_undo,
GimpProgress *progress)
{
GeglBuffer *dest_buffer;
dest_buffer =
gegl_buffer_new (GEGL_RECTANGLE (0, 0,
gimp_item_get_width (GIMP_ITEM (drawable)),
gimp_item_get_height (GIMP_ITEM (drawable))),
new_format);
if (mask_dither_type == GEGL_DITHER_NONE)
{
gimp_gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
GEGL_ABYSS_NONE,
dest_buffer, NULL);
}
else
{
gint bits;
bits = (babl_format_get_bytes_per_pixel (new_format) * 8 /
babl_format_get_n_components (new_format));
gimp_gegl_apply_dither (gimp_drawable_get_buffer (drawable),
NULL, NULL,
dest_buffer, 1 << bits, mask_dither_type);
}
gimp_drawable_set_buffer (drawable, push_undo, NULL, dest_buffer);
g_object_unref (dest_buffer);
}
static void
gimp_channel_invalidate_boundary (GimpDrawable *drawable)
{
GimpChannel *channel = GIMP_CHANNEL (drawable);
channel->boundary_known = FALSE;
channel->bounds_known = FALSE;
}
static void
gimp_channel_get_active_components (GimpDrawable *drawable,
gboolean *active)
{
/* Make sure that the alpha channel is not valid. */
active[GRAY] = TRUE;
active[ALPHA_G] = FALSE;
}
static GimpComponentMask
gimp_channel_get_active_mask (GimpDrawable *drawable)
{
/* Return all, because that skips the component mask op when painting */
return GIMP_COMPONENT_MASK_ALL;
}
static void
gimp_channel_set_buffer (GimpDrawable *drawable,
gboolean push_undo,
const gchar *undo_desc,
GeglBuffer *buffer,
gint offset_x,
gint offset_y)
{
GimpChannel *channel = GIMP_CHANNEL (drawable);
GeglBuffer *old_buffer = gimp_drawable_get_buffer (drawable);
if (old_buffer)
{
g_signal_handlers_disconnect_by_func (old_buffer,
gimp_channel_buffer_changed,
channel);
}
GIMP_DRAWABLE_CLASS (parent_class)->set_buffer (drawable,
push_undo, undo_desc,
buffer,
offset_x, offset_y);
gegl_buffer_signal_connect (buffer, "changed",
G_CALLBACK (gimp_channel_buffer_changed),
channel);
if (gimp_filter_peek_node (GIMP_FILTER (channel)))
{
Initial space invasion commit in GIMP All babl formats now have a space equivalent to a color profile, determining the format's primaries and TRCs. This commit makes GIMP aware of this. libgimp: - enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA as deprecated aliases, add PERCEPTUAL values so we now have LINEAR, NON_LINEAR and PERCPTUAL for each encoding, matching the babl encoding variants RGB, R'G'B' and R~G~B~. - gimp_color_transform_can_gegl_copy() now returns TRUE if both profiles can return a babl space, increasing the amount of fast babl color conversions significantly. - TODO: no solution yet for getting libgimp drawable proxy buffers in the right format with space. plug-ins: - follow the GimpPrecision change. - TODO: everything else unchanged and partly broken or sub-optimal, like setting a new image's color profile too late. app: - add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as replacement for all "linear" booleans. - change gimp-babl functions to take babl spaces and GimpTRCType parameters and support all sorts of new perceptual ~ formats. - a lot of places changed in the early days of goat invasion didn't take advantage of gimp-babl utility functions and constructed formats manually. They all needed revisiting and many now use much simpler code calling gimp-babl API. - change gimp_babl_format_get_color_profile() to really extract a newly allocated color profile from the format, and add gimp_babl_get_builtin_color_profile() which does the same as gimp_babl_format_get_color_profile() did before. Visited all callers to decide whether they are looking for the format's actual profile, or for one of the builtin profiles, simplifying code that only needs builtin profiles. - drawables have a new get_space_api(), get_linear() is now get_trc(). - images now have a "layer space" and an API to get it, gimp_image_get_layer_format() returns formats in that space. - an image's layer space is created from the image's color profile, change gimpimage-color-profile to deal with that correctly - change many babl_format() calls to babl_format_with_space() and take the space from passed formats or drawables - add function gimp_layer_fix_format_space() which replaces the layer's buffer with one that has the image's layer format, but doesn't change pixel values - use gimp_layer_fix_format_space() to make sure layers loaded from XCF and created by plug-ins have the right space when added to the image, because it's impossible to always assign the right space upon layer creation - "assign color profile" and "discard color profile" now require use of gimp_layer_fix_format_space() too because the profile is now embedded in all formats via the space. Add gimp_image_assign_color_profile() which does all that and call it instead of a simple gimp_image_set_color_profile(), also from the PDB set-color-profile functions, which are essentially "assign" and "discard" calls. - generally, make sure a new image's color profile is set before adding layers to it, gimp_image_set_color_profile() is more than before considered know-what-you-are-doing API. - take special precaution in all places that call gimp_drawable_convert_type(), we now must pass a new_profile from all callers that convert layers within the same image (such as image_convert_type, image_convert_precision), because the layer's new space can't be determined from the image's layer format during the call. - change all "linear" properties to "trc", in all config objects like for levels and curves, in the histogram, in the widgets. This results in some GUI that now has three choices instead of two. TODO: we might want to reduce that back to two later. - keep "linear" boolean properties around as compat if needed for file pasring, but always convert the parsed parsed boolean to GimpTRCType. - TODO: the image's "enable color management" switch is currently broken, will fix that in another commit.
2018-07-21 20:23:01 +08:00
const Babl *color_format =
gimp_babl_format (GIMP_RGB,
gimp_babl_precision (GIMP_COMPONENT_TYPE_FLOAT,
gimp_drawable_get_trc (drawable)),
TRUE, NULL);
gegl_node_set (channel->color_node,
"format", color_format,
NULL);
}
}
static gdouble
gimp_channel_get_opacity_at (GimpPickable *pickable,
gint x,
gint y)
{
GimpChannel *channel = GIMP_CHANNEL (pickable);
gdouble value = GIMP_OPACITY_TRANSPARENT;
if (x >= 0 && x < gimp_item_get_width (GIMP_ITEM (channel)) &&
y >= 0 && y < gimp_item_get_height (GIMP_ITEM (channel)))
{
if (! channel->bounds_known ||
(! channel->empty &&
x >= channel->x1 &&
x < channel->x2 &&
y >= channel->y1 &&
y < channel->y2))
{
gegl_buffer_sample (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
x, y, NULL, &value, babl_format ("Y double"),
GEGL_SAMPLER_NEAREST, GEGL_ABYSS_NONE);
}
}
return value;
}
static gboolean
gimp_channel_real_boundary (GimpChannel *channel,
const GimpBoundSeg **segs_in,
const GimpBoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2)
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
{
if (! channel->boundary_known)
{
gint x3, y3, x4, y4;
/* free the out of date boundary segments */
g_free (channel->segs_in);
g_free (channel->segs_out);
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
if (gimp_item_bounds (GIMP_ITEM (channel), &x3, &y3, &x4, &y4))
{
GeglBuffer *buffer;
GeglRectangle rect = { x3, y3, x4, y4 };
x4 += x3;
y4 += y3;
buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
channel->segs_out = gimp_boundary_find (buffer, &rect,
babl_format ("Y float"),
GIMP_BOUNDARY_IGNORE_BOUNDS,
x1, y1, x2, y2,
GIMP_BOUNDARY_HALF_WAY,
&channel->num_segs_out);
x1 = MAX (x1, x3);
y1 = MAX (y1, y3);
x2 = MIN (x2, x4);
y2 = MIN (y2, y4);
if (x2 > x1 && y2 > y1)
{
channel->segs_in = gimp_boundary_find (buffer, NULL,
babl_format ("Y float"),
GIMP_BOUNDARY_WITHIN_BOUNDS,
x1, y1, x2, y2,
GIMP_BOUNDARY_HALF_WAY,
&channel->num_segs_in);
}
else
{
channel->segs_in = NULL;
channel->num_segs_in = 0;
}
}
else
{
channel->segs_in = NULL;
channel->segs_out = NULL;
channel->num_segs_in = 0;
channel->num_segs_out = 0;
}
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
channel->boundary_known = TRUE;
}
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
*segs_in = channel->segs_in;
*segs_out = channel->segs_out;
*num_segs_in = channel->num_segs_in;
*num_segs_out = channel->num_segs_out;
return (! channel->empty);
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
}
static gboolean
gimp_channel_real_is_empty (GimpChannel *channel)
{
GeglBuffer *buffer;
app/widgets/Makefile.am new file defining the available help topics. Work 2003-08-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/gimphelp-ids.h: new file defining the available help topics. Work in progress and totally unusable for matching to the help system. Stay tuned... * app/gui/about-dialog.c * app/gui/brushes-menu.c * app/gui/buffers-menu.c * app/gui/channels-commands.[ch] * app/gui/channels-menu.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradients-commands.c * app/gui/gradients-menu.c * app/gui/image-menu.c * app/gui/layers-commands.[ch] * app/gui/layers-menu.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palettes-menu.c * app/gui/patterns-menu.c * app/gui/resize-dialog.c * app/gui/select-commands.c * app/gui/templates-menu.c * app/gui/tips-dialog.c * app/gui/toolbox-menu.c * app/gui/vectors-commands.[ch] * app/gui/vectors-menu.c: replaced literal HTML file paths by help IDs from gimphelp-ids.h. Renamed some menu callbacks to be consistent with similar ones. This is just an intermediate commit and not finished. While browsing all the menus, I noticed that our "x to selection" functions are not consistent at all. They should all offer the REPLACE,ADD,SUBTRACT,INTERSECT options: * app/core/gimpchannel.[ch]: added new function gimp_channel_new_from_alpha(). Removed gimp_channel_layer_alpha() and gimp_channel_layer_mask(). * app/core/gimpimage-mask.[ch]: added gimp_image_mask_select_alpha() and gimp_image_mask_select_component() which offer the full set of operation, feather and feather_radius parameters as the other selection functions. * app/core/gimpimage-mask-select.[ch]: removed gimp_image_mask_layer_alpha() and gimp_image_mask_layer_mask(). * app/gui/channels-commands.c (channels_channel_to_selection): use gimp_image_mask_select_component() instead of implementing it here. * app/gui/image-menu.c * app/gui/layers-commands.[ch]: offer the full choice of REPLACE,ADD,SUBTRACT,INTERSECT with "Alpha to Selection" and "Mask to Selection". * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/selection_cmds.c: regenerated.
2003-08-21 23:54:47 +08:00
if (channel->bounds_known)
return channel->empty;
app/widgets/Makefile.am new file defining the available help topics. Work 2003-08-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/gimphelp-ids.h: new file defining the available help topics. Work in progress and totally unusable for matching to the help system. Stay tuned... * app/gui/about-dialog.c * app/gui/brushes-menu.c * app/gui/buffers-menu.c * app/gui/channels-commands.[ch] * app/gui/channels-menu.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradients-commands.c * app/gui/gradients-menu.c * app/gui/image-menu.c * app/gui/layers-commands.[ch] * app/gui/layers-menu.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palettes-menu.c * app/gui/patterns-menu.c * app/gui/resize-dialog.c * app/gui/select-commands.c * app/gui/templates-menu.c * app/gui/tips-dialog.c * app/gui/toolbox-menu.c * app/gui/vectors-commands.[ch] * app/gui/vectors-menu.c: replaced literal HTML file paths by help IDs from gimphelp-ids.h. Renamed some menu callbacks to be consistent with similar ones. This is just an intermediate commit and not finished. While browsing all the menus, I noticed that our "x to selection" functions are not consistent at all. They should all offer the REPLACE,ADD,SUBTRACT,INTERSECT options: * app/core/gimpchannel.[ch]: added new function gimp_channel_new_from_alpha(). Removed gimp_channel_layer_alpha() and gimp_channel_layer_mask(). * app/core/gimpimage-mask.[ch]: added gimp_image_mask_select_alpha() and gimp_image_mask_select_component() which offer the full set of operation, feather and feather_radius parameters as the other selection functions. * app/core/gimpimage-mask-select.[ch]: removed gimp_image_mask_layer_alpha() and gimp_image_mask_layer_mask(). * app/gui/channels-commands.c (channels_channel_to_selection): use gimp_image_mask_select_component() instead of implementing it here. * app/gui/image-menu.c * app/gui/layers-commands.[ch]: offer the full choice of REPLACE,ADD,SUBTRACT,INTERSECT with "Alpha to Selection" and "Mask to Selection". * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/selection_cmds.c: regenerated.
2003-08-21 23:54:47 +08:00
buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
app/widgets/Makefile.am new file defining the available help topics. Work 2003-08-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/gimphelp-ids.h: new file defining the available help topics. Work in progress and totally unusable for matching to the help system. Stay tuned... * app/gui/about-dialog.c * app/gui/brushes-menu.c * app/gui/buffers-menu.c * app/gui/channels-commands.[ch] * app/gui/channels-menu.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradients-commands.c * app/gui/gradients-menu.c * app/gui/image-menu.c * app/gui/layers-commands.[ch] * app/gui/layers-menu.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palettes-menu.c * app/gui/patterns-menu.c * app/gui/resize-dialog.c * app/gui/select-commands.c * app/gui/templates-menu.c * app/gui/tips-dialog.c * app/gui/toolbox-menu.c * app/gui/vectors-commands.[ch] * app/gui/vectors-menu.c: replaced literal HTML file paths by help IDs from gimphelp-ids.h. Renamed some menu callbacks to be consistent with similar ones. This is just an intermediate commit and not finished. While browsing all the menus, I noticed that our "x to selection" functions are not consistent at all. They should all offer the REPLACE,ADD,SUBTRACT,INTERSECT options: * app/core/gimpchannel.[ch]: added new function gimp_channel_new_from_alpha(). Removed gimp_channel_layer_alpha() and gimp_channel_layer_mask(). * app/core/gimpimage-mask.[ch]: added gimp_image_mask_select_alpha() and gimp_image_mask_select_component() which offer the full set of operation, feather and feather_radius parameters as the other selection functions. * app/core/gimpimage-mask-select.[ch]: removed gimp_image_mask_layer_alpha() and gimp_image_mask_layer_mask(). * app/gui/channels-commands.c (channels_channel_to_selection): use gimp_image_mask_select_component() instead of implementing it here. * app/gui/image-menu.c * app/gui/layers-commands.[ch]: offer the full choice of REPLACE,ADD,SUBTRACT,INTERSECT with "Alpha to Selection" and "Mask to Selection". * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/selection_cmds.c: regenerated.
2003-08-21 23:54:47 +08:00
if (! gimp_gegl_mask_is_empty (buffer))
return FALSE;
app/widgets/Makefile.am new file defining the available help topics. Work 2003-08-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/gimphelp-ids.h: new file defining the available help topics. Work in progress and totally unusable for matching to the help system. Stay tuned... * app/gui/about-dialog.c * app/gui/brushes-menu.c * app/gui/buffers-menu.c * app/gui/channels-commands.[ch] * app/gui/channels-menu.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradients-commands.c * app/gui/gradients-menu.c * app/gui/image-menu.c * app/gui/layers-commands.[ch] * app/gui/layers-menu.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palettes-menu.c * app/gui/patterns-menu.c * app/gui/resize-dialog.c * app/gui/select-commands.c * app/gui/templates-menu.c * app/gui/tips-dialog.c * app/gui/toolbox-menu.c * app/gui/vectors-commands.[ch] * app/gui/vectors-menu.c: replaced literal HTML file paths by help IDs from gimphelp-ids.h. Renamed some menu callbacks to be consistent with similar ones. This is just an intermediate commit and not finished. While browsing all the menus, I noticed that our "x to selection" functions are not consistent at all. They should all offer the REPLACE,ADD,SUBTRACT,INTERSECT options: * app/core/gimpchannel.[ch]: added new function gimp_channel_new_from_alpha(). Removed gimp_channel_layer_alpha() and gimp_channel_layer_mask(). * app/core/gimpimage-mask.[ch]: added gimp_image_mask_select_alpha() and gimp_image_mask_select_component() which offer the full set of operation, feather and feather_radius parameters as the other selection functions. * app/core/gimpimage-mask-select.[ch]: removed gimp_image_mask_layer_alpha() and gimp_image_mask_layer_mask(). * app/gui/channels-commands.c (channels_channel_to_selection): use gimp_image_mask_select_component() instead of implementing it here. * app/gui/image-menu.c * app/gui/layers-commands.[ch]: offer the full choice of REPLACE,ADD,SUBTRACT,INTERSECT with "Alpha to Selection" and "Mask to Selection". * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/selection_cmds.c: regenerated.
2003-08-21 23:54:47 +08:00
/* The mask is empty, meaning we can set the bounds as known */
if (channel->segs_in)
g_free (channel->segs_in);
if (channel->segs_out)
g_free (channel->segs_out);
channel->empty = TRUE;
channel->segs_in = NULL;
channel->segs_out = NULL;
channel->num_segs_in = 0;
channel->num_segs_out = 0;
channel->bounds_known = TRUE;
channel->boundary_known = TRUE;
channel->x1 = 0;
channel->y1 = 0;
channel->x2 = gimp_item_get_width (GIMP_ITEM (channel));
channel->y2 = gimp_item_get_height (GIMP_ITEM (channel));
return TRUE;
app/widgets/Makefile.am new file defining the available help topics. Work 2003-08-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/gimphelp-ids.h: new file defining the available help topics. Work in progress and totally unusable for matching to the help system. Stay tuned... * app/gui/about-dialog.c * app/gui/brushes-menu.c * app/gui/buffers-menu.c * app/gui/channels-commands.[ch] * app/gui/channels-menu.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradients-commands.c * app/gui/gradients-menu.c * app/gui/image-menu.c * app/gui/layers-commands.[ch] * app/gui/layers-menu.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palettes-menu.c * app/gui/patterns-menu.c * app/gui/resize-dialog.c * app/gui/select-commands.c * app/gui/templates-menu.c * app/gui/tips-dialog.c * app/gui/toolbox-menu.c * app/gui/vectors-commands.[ch] * app/gui/vectors-menu.c: replaced literal HTML file paths by help IDs from gimphelp-ids.h. Renamed some menu callbacks to be consistent with similar ones. This is just an intermediate commit and not finished. While browsing all the menus, I noticed that our "x to selection" functions are not consistent at all. They should all offer the REPLACE,ADD,SUBTRACT,INTERSECT options: * app/core/gimpchannel.[ch]: added new function gimp_channel_new_from_alpha(). Removed gimp_channel_layer_alpha() and gimp_channel_layer_mask(). * app/core/gimpimage-mask.[ch]: added gimp_image_mask_select_alpha() and gimp_image_mask_select_component() which offer the full set of operation, feather and feather_radius parameters as the other selection functions. * app/core/gimpimage-mask-select.[ch]: removed gimp_image_mask_layer_alpha() and gimp_image_mask_layer_mask(). * app/gui/channels-commands.c (channels_channel_to_selection): use gimp_image_mask_select_component() instead of implementing it here. * app/gui/image-menu.c * app/gui/layers-commands.[ch]: offer the full choice of REPLACE,ADD,SUBTRACT,INTERSECT with "Alpha to Selection" and "Mask to Selection". * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/selection_cmds.c: regenerated.
2003-08-21 23:54:47 +08:00
}
static void
gimp_channel_real_feather (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
gboolean push_undo)
{
gint x1, y1, x2, y2;
if (radius_x <= 0.0 && radius_y <= 0.0)
return;
if (! gimp_item_bounds (GIMP_ITEM (channel), &x1, &y1, &x2, &y2))
return;
x2 += x1;
y2 += y1;
if (gimp_channel_is_empty (channel))
return;
x1 = MAX (0, x1 - ceil (radius_x));
y1 = MAX (0, y1 - ceil (radius_y));
x2 = MIN (gimp_item_get_width (GIMP_ITEM (channel)), x2 + ceil (radius_x));
y2 = MIN (gimp_item_get_height (GIMP_ITEM (channel)), y2 + ceil (radius_y));
if (push_undo)
gimp_channel_push_undo (channel,
GIMP_CHANNEL_GET_CLASS (channel)->feather_desc);
gimp_gegl_apply_feather (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL, NULL,
gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
GEGL_RECTANGLE (x1, y1, x2 - x1, y2 - y1),
radius_x,
radius_y);
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
gimp_channel_real_sharpen (GimpChannel *channel,
gboolean push_undo)
{
GimpDrawable *drawable = GIMP_DRAWABLE (channel);
if (push_undo)
gimp_channel_push_undo (channel,
GIMP_CHANNEL_GET_CLASS (channel)->sharpen_desc);
gimp_gegl_apply_threshold (gimp_drawable_get_buffer (drawable),
NULL, NULL,
gimp_drawable_get_buffer (drawable),
0.5);
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
gimp_channel_real_clear (GimpChannel *channel,
const gchar *undo_desc,
gboolean push_undo)
{
if (push_undo)
{
if (! undo_desc)
undo_desc = GIMP_CHANNEL_GET_CLASS (channel)->clear_desc;
gimp_channel_push_undo (channel, undo_desc);
}
if (channel->bounds_known && ! channel->empty)
{
gegl_buffer_clear (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
GEGL_RECTANGLE (channel->x1, channel->y1,
channel->x2 - channel->x1,
channel->y2 - channel->y1));
}
else
{
gegl_buffer_clear (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL);
}
/* we know the bounds */
channel->bounds_known = TRUE;
channel->empty = TRUE;
channel->x1 = 0;
channel->y1 = 0;
channel->x2 = gimp_item_get_width (GIMP_ITEM (channel));
channel->y2 = gimp_item_get_height (GIMP_ITEM (channel));
Treat changes to the selection like changes to any other drawable: 2003-10-06 Michael Natterer <mitch@gimp.org> Treat changes to the selection like changes to any other drawable: * app/core/gimpchannel.c * app/core/gimpchannel-combine.c: call gimp_drawable_update() after changing the channel. * app/core/gimpimage.[ch]: added struct GimpImageFlushAccumulator with one member "gboolean mask_changed". Connect to "update" of the selection and set accum.mask_changed to TRUE in the callback. Added default implementation for GimpImage::flush() and emit "mask_changed" there. Unrelated: * app/core/gimpimage.h: removed GimpGuide struct... * app/core/gimpimage-guides.h: ...and added it here. * app/core/gimpimage-undo-push.c (undo_pop_mask) (undo_pop_channel_mod): don't distinguish between selection and non-selection channels and just call gimp_drawable_update(). * app/core/gimpundo.h * app/core/gimpimage-undo.c: removed "gboolean mask_changed" from the GimpUndoAccumulator struct since we don't have to care about that signal explicitly any more. * app/display/gimpdisplay-foreach.[ch]: removed gimp_displays_flush(). * tools/pdbgen/pdb/display.pdb (displays_flush_invoker): call gimp_image_flush() on all images so the flush accumulator is honored. This generalization enables the removal of more special purpose code which was needed to treat the selection different: * app/core/gimpimage-mask-select.[ch]: removed... * app/core/gimpchannel-select.[ch]: ...and added under a new name because it's not selection specific any more. * app/core/gimpimage-mask.[ch]: removed... * app/core/gimpselection.[ch]: ...added the two remaining functions here. Removed all calls to gimp_image_mask_changed(). * app/core/Makefile.am * app/core/gimp-edit.c * app/core/gimpdrawable-transform.c * app/core/gimpimage-scale.c * app/core/gimpimage-snap.c * app/display/gimpdisplayshell.c * app/gui/channels-commands.c * app/gui/layers-commands.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimprectselecttool.c * app/tools/gimptransformtool.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimpselectioneditor.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-save.c * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/selection_tools.pdb: changed accordingly. * app/core/gimpdrawable-bucket-fill.c * app/core/gimpimage-colormap.c * app/core/gimplayer-floating-sel.c * app/core/gimplayer.c * app/gui/image-menu.c * app/paint/gimppaintcore.c * app/tools/gimpcroptool.c * app/tools/gimpinkoptions.c * app/tools/gimpvectortool.c: removed useless and/or obsolete #includes. * app/pdb/display_cmds.c * app/pdb/paths_cmds.c * app/pdb/selection_cmds.c * app/pdb/selection_tools_cmds.c: regenerated.
2003-10-06 20:17:11 +08:00
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
gimp_channel_real_all (GimpChannel *channel,
gboolean push_undo)
{
GeglColor *color;
if (push_undo)
gimp_channel_push_undo (channel,
GIMP_CHANNEL_GET_CLASS (channel)->all_desc);
/* clear the channel */
color = gegl_color_new ("#fff");
gegl_buffer_set_color (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL, color);
g_object_unref (color);
/* we know the bounds */
channel->bounds_known = TRUE;
channel->empty = FALSE;
channel->x1 = 0;
channel->y1 = 0;
channel->x2 = gimp_item_get_width (GIMP_ITEM (channel));
channel->y2 = gimp_item_get_height (GIMP_ITEM (channel));
Treat changes to the selection like changes to any other drawable: 2003-10-06 Michael Natterer <mitch@gimp.org> Treat changes to the selection like changes to any other drawable: * app/core/gimpchannel.c * app/core/gimpchannel-combine.c: call gimp_drawable_update() after changing the channel. * app/core/gimpimage.[ch]: added struct GimpImageFlushAccumulator with one member "gboolean mask_changed". Connect to "update" of the selection and set accum.mask_changed to TRUE in the callback. Added default implementation for GimpImage::flush() and emit "mask_changed" there. Unrelated: * app/core/gimpimage.h: removed GimpGuide struct... * app/core/gimpimage-guides.h: ...and added it here. * app/core/gimpimage-undo-push.c (undo_pop_mask) (undo_pop_channel_mod): don't distinguish between selection and non-selection channels and just call gimp_drawable_update(). * app/core/gimpundo.h * app/core/gimpimage-undo.c: removed "gboolean mask_changed" from the GimpUndoAccumulator struct since we don't have to care about that signal explicitly any more. * app/display/gimpdisplay-foreach.[ch]: removed gimp_displays_flush(). * tools/pdbgen/pdb/display.pdb (displays_flush_invoker): call gimp_image_flush() on all images so the flush accumulator is honored. This generalization enables the removal of more special purpose code which was needed to treat the selection different: * app/core/gimpimage-mask-select.[ch]: removed... * app/core/gimpchannel-select.[ch]: ...and added under a new name because it's not selection specific any more. * app/core/gimpimage-mask.[ch]: removed... * app/core/gimpselection.[ch]: ...added the two remaining functions here. Removed all calls to gimp_image_mask_changed(). * app/core/Makefile.am * app/core/gimp-edit.c * app/core/gimpdrawable-transform.c * app/core/gimpimage-scale.c * app/core/gimpimage-snap.c * app/display/gimpdisplayshell.c * app/gui/channels-commands.c * app/gui/layers-commands.c * app/gui/select-commands.c * app/gui/vectors-commands.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool.c * app/tools/gimpfreeselecttool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpiscissorstool.c * app/tools/gimprectselecttool.c * app/tools/gimptransformtool.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimpselectioneditor.c * app/widgets/gimpvectorstreeview.c * app/xcf/xcf-save.c * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/selection_tools.pdb: changed accordingly. * app/core/gimpdrawable-bucket-fill.c * app/core/gimpimage-colormap.c * app/core/gimplayer-floating-sel.c * app/core/gimplayer.c * app/gui/image-menu.c * app/paint/gimppaintcore.c * app/tools/gimpcroptool.c * app/tools/gimpinkoptions.c * app/tools/gimpvectortool.c: removed useless and/or obsolete #includes. * app/pdb/display_cmds.c * app/pdb/paths_cmds.c * app/pdb/selection_cmds.c * app/pdb/selection_tools_cmds.c: regenerated.
2003-10-06 20:17:11 +08:00
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
gimp_channel_real_invert (GimpChannel *channel,
gboolean push_undo)
{
GimpDrawable *drawable = GIMP_DRAWABLE (channel);
if (push_undo)
gimp_channel_push_undo (channel,
GIMP_CHANNEL_GET_CLASS (channel)->invert_desc);
if (channel->bounds_known && channel->empty)
{
gimp_channel_all (channel, FALSE);
}
else
{
gimp_gegl_apply_invert_linear (gimp_drawable_get_buffer (drawable),
NULL, NULL,
gimp_drawable_get_buffer (drawable));
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
}
static void
gimp_channel_real_border (GimpChannel *channel,
gint radius_x,
gint radius_y,
GimpChannelBorderStyle style,
gboolean edge_lock,
gboolean push_undo)
{
gint x1, y1, x2, y2;
if (radius_x == 0 && radius_y == 0)
{
/* The relevant GEGL operations require radius_x and radius_y to be > 0.
* When both are 0 (currently can only be achieved by the user through
* PDB), the effect should be to clear the channel.
*/
gimp_channel_clear (channel,
GIMP_CHANNEL_GET_CLASS (channel)->border_desc,
push_undo);
return;
}
else if (radius_x <= 0 || radius_y <= 0)
{
/* FIXME: Implement the case where only one of radius_x and radius_y is 0.
* Currently, should never happen.
*/
g_return_if_reached();
}
if (! gimp_item_bounds (GIMP_ITEM (channel), &x1, &y1, &x2, &y2))
return;
x2 += x1;
y2 += y1;
if (gimp_channel_is_empty (channel))
return;
if (x1 - radius_x < 0)
x1 = 0;
else
x1 -= radius_x;
if (x2 + radius_x > gimp_item_get_width (GIMP_ITEM (channel)))
x2 = gimp_item_get_width (GIMP_ITEM (channel));
else
x2 += radius_x;
if (y1 - radius_y < 0)
y1 = 0;
else
y1 -= radius_y;
if (y2 + radius_y > gimp_item_get_height (GIMP_ITEM (channel)))
y2 = gimp_item_get_height (GIMP_ITEM (channel));
else
y2 += radius_y;
if (push_undo)
gimp_channel_push_undo (channel,
GIMP_CHANNEL_GET_CLASS (channel)->border_desc);
gimp_gegl_apply_border (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL, NULL,
gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
GEGL_RECTANGLE (x1, y1, x2 - x1, y2 - y1),
radius_x, radius_y, style, edge_lock);
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
gimp_channel_real_grow (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean push_undo)
{
gint x1, y1, x2, y2;
if (radius_x == 0 && radius_y == 0)
return;
if (radius_x <= 0 && radius_y <= 0)
{
gimp_channel_shrink (channel, -radius_x, -radius_y, FALSE, push_undo);
return;
}
if (radius_x < 0 || radius_y < 0)
return;
if (! gimp_item_bounds (GIMP_ITEM (channel), &x1, &y1, &x2, &y2))
return;
x2 += x1;
y2 += y1;
if (gimp_channel_is_empty (channel))
return;
if (x1 - radius_x > 0)
x1 = x1 - radius_x;
else
x1 = 0;
if (y1 - radius_y > 0)
y1 = y1 - radius_y;
else
y1 = 0;
if (x2 + radius_x < gimp_item_get_width (GIMP_ITEM (channel)))
x2 = x2 + radius_x;
else
x2 = gimp_item_get_width (GIMP_ITEM (channel));
if (y2 + radius_y < gimp_item_get_height (GIMP_ITEM (channel)))
y2 = y2 + radius_y;
else
y2 = gimp_item_get_height (GIMP_ITEM (channel));
if (push_undo)
gimp_channel_push_undo (channel,
GIMP_CHANNEL_GET_CLASS (channel)->grow_desc);
gimp_gegl_apply_grow (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL, NULL,
gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
GEGL_RECTANGLE (x1, y1, x2 - x1, y2 - y1),
radius_x, radius_y);
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
gimp_channel_real_shrink (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean edge_lock,
gboolean push_undo)
{
gint x1, y1, x2, y2;
if (radius_x == 0 && radius_y == 0)
return;
if (radius_x <= 0 && radius_y <= 0)
{
gimp_channel_grow (channel, -radius_x, -radius_y, push_undo);
return;
}
if (radius_x < 0 || radius_y < 0)
return;
if (! gimp_item_bounds (GIMP_ITEM (channel), &x1, &y1, &x2, &y2))
return;
x2 += x1;
y2 += y1;
if (gimp_channel_is_empty (channel))
return;
if (x1 > 0)
x1--;
if (y1 > 0)
y1--;
if (x2 < gimp_item_get_width (GIMP_ITEM (channel)))
x2++;
if (y2 < gimp_item_get_height (GIMP_ITEM (channel)))
y2++;
if (push_undo)
gimp_channel_push_undo (channel,
GIMP_CHANNEL_GET_CLASS (channel)->shrink_desc);
gimp_gegl_apply_shrink (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL, NULL,
gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
GEGL_RECTANGLE (x1, y1, x2 - x1, y2 - y1),
radius_x, radius_y, edge_lock);
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
}
static void
gimp_channel_real_flood (GimpChannel *channel,
gboolean push_undo)
{
gint x, y, width, height;
if (! gimp_item_bounds (GIMP_ITEM (channel), &x, &y, &width, &height))
return;
if (gimp_channel_is_empty (channel))
return;
if (push_undo)
gimp_channel_push_undo (channel,
GIMP_CHANNEL_GET_CLASS (channel)->flood_desc);
gimp_gegl_apply_flood (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL, NULL,
gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
GEGL_RECTANGLE (x, y, width, height));
gimp_drawable_update (GIMP_DRAWABLE (channel), x, y, width, height);
}
static void
gimp_channel_buffer_changed (GeglBuffer *buffer,
const GeglRectangle *rect,
GimpChannel *channel)
{
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (channel));
}
/* public functions */
GimpChannel *
gimp_channel_new (GimpImage *image,
gint width,
gint height,
const gchar *name,
const GimpRGB *color)
{
GimpChannel *channel;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
channel =
GIMP_CHANNEL (gimp_drawable_new (GIMP_TYPE_CHANNEL,
image, name,
0, 0, width, height,
gimp_image_get_channel_format (image)));
if (color)
channel->color = *color;
channel->show_masked = TRUE;
/* selection mask variables */
channel->x2 = width;
channel->y2 = height;
return channel;
}
GimpChannel *
gimp_channel_new_from_buffer (GimpImage *image,
GeglBuffer *buffer,
const gchar *name,
const GimpRGB *color)
{
GimpChannel *channel;
GeglBuffer *dest;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
channel = gimp_channel_new (image,
gegl_buffer_get_width (buffer),
gegl_buffer_get_height (buffer),
name, color);
dest = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
gimp_gegl_buffer_copy (buffer, NULL, GEGL_ABYSS_NONE, dest, NULL);
return channel;
}
GimpChannel *
gimp_channel_new_from_alpha (GimpImage *image,
GimpDrawable *drawable,
const gchar *name,
const GimpRGB *color)
{
GimpChannel *channel;
GeglBuffer *dest_buffer;
gint width;
gint height;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_drawable_has_alpha (drawable), NULL);
width = gimp_item_get_width (GIMP_ITEM (drawable));
height = gimp_item_get_height (GIMP_ITEM (drawable));
channel = gimp_channel_new (image, width, height, name, color);
gimp_channel_clear (channel, NULL, FALSE);
dest_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
gegl_buffer_set_format (dest_buffer,
gimp_drawable_get_component_format (drawable,
GIMP_CHANNEL_ALPHA));
gimp_gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
GEGL_ABYSS_NONE,
dest_buffer, NULL);
gegl_buffer_set_format (dest_buffer, NULL);
return channel;
}
GimpChannel *
gimp_channel_new_from_component (GimpImage *image,
GimpChannelType type,
const gchar *name,
const GimpRGB *color)
{
GimpChannel *channel;
GeglBuffer *src_buffer;
GeglBuffer *dest_buffer;
gint width;
gint height;
const Babl *format;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
format = gimp_image_get_component_format (image, type);
g_return_val_if_fail (format != NULL, NULL);
gimp_pickable_flush (GIMP_PICKABLE (image));
src_buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (image));
width = gegl_buffer_get_width (src_buffer);
height = gegl_buffer_get_height (src_buffer);
channel = gimp_channel_new (image, width, height, name, color);
dest_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
gegl_buffer_set_format (dest_buffer, format);
gimp_gegl_buffer_copy (src_buffer, NULL, GEGL_ABYSS_NONE, dest_buffer, NULL);
gegl_buffer_set_format (dest_buffer, NULL);
return channel;
}
GimpChannel *
gimp_channel_get_parent (GimpChannel *channel)
{
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
return GIMP_CHANNEL (gimp_viewable_get_parent (GIMP_VIEWABLE (channel)));
}
void
gimp_channel_set_color (GimpChannel *channel,
const GimpRGB *color,
gboolean push_undo)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (color != NULL);
app/Makefile.am removed. 2001-07-08 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/drawable.[ch]: removed. * app/core/gimpdrawable.[ch]: added the functions here. Made an end to the myth that FG/BG and the undo system (!!!) are not really part of the core. * app/disp_callbacks.c * app/floating_sel.c * app/image_map.c * app/qmask.c * app/undo.c * app/core/gimpchannel.c * app/core/gimpdrawable-desaturate.c * app/core/gimpdrawable-equalize.c * app/core/gimpdrawable-invert.c * app/core/gimpdrawable-offset.c * app/core/gimpedit.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimpimage-new.c * app/core/gimpimage.[ch] * app/core/gimplayer.c * app/core/gimplayermask.c * app/gui/channels-commands.c * app/gui/gui.c * app/gui/layers-commands.c * app/tools/gimpairbrushtool.c * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimplevelstool.c * app/tools/gimppainttool.c * app/tools/gimpposterizetool.c * app/tools/gimpscaletool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c * app/tools/tool_manager.c * app/widgets/gimpchannellistitem.c * app/widgets/gimpchannellistview.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/parasite_cmds.c * app/pdb/selection_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/tools_cmds.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb: changed accordingly. Misc small fixes and cleanups.
2001-07-08 06:49:01 +08:00
if (gimp_rgba_distance (&channel->color, color) > 0.0001)
{
if (push_undo && gimp_item_is_attached (GIMP_ITEM (channel)))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (channel));
gimp_image_undo_push_channel_color (image, C_("undo-type", "Set Channel Color"),
channel);
}
app/Makefile.am removed. 2001-07-08 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/drawable.[ch]: removed. * app/core/gimpdrawable.[ch]: added the functions here. Made an end to the myth that FG/BG and the undo system (!!!) are not really part of the core. * app/disp_callbacks.c * app/floating_sel.c * app/image_map.c * app/qmask.c * app/undo.c * app/core/gimpchannel.c * app/core/gimpdrawable-desaturate.c * app/core/gimpdrawable-equalize.c * app/core/gimpdrawable-invert.c * app/core/gimpdrawable-offset.c * app/core/gimpedit.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimpimage-new.c * app/core/gimpimage.[ch] * app/core/gimplayer.c * app/core/gimplayermask.c * app/gui/channels-commands.c * app/gui/gui.c * app/gui/layers-commands.c * app/tools/gimpairbrushtool.c * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimplevelstool.c * app/tools/gimppainttool.c * app/tools/gimpposterizetool.c * app/tools/gimpscaletool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c * app/tools/tool_manager.c * app/widgets/gimpchannellistitem.c * app/widgets/gimpchannellistview.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/parasite_cmds.c * app/pdb/selection_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/tools_cmds.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb: changed accordingly. Misc small fixes and cleanups.
2001-07-08 06:49:01 +08:00
channel->color = *color;
if (gimp_filter_peek_node (GIMP_FILTER (channel)))
{
gimp_gegl_node_set_color (channel->color_node,
&channel->color);
}
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
g_signal_emit (channel, channel_signals[COLOR_CHANGED], 0);
app/Makefile.am removed. 2001-07-08 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/drawable.[ch]: removed. * app/core/gimpdrawable.[ch]: added the functions here. Made an end to the myth that FG/BG and the undo system (!!!) are not really part of the core. * app/disp_callbacks.c * app/floating_sel.c * app/image_map.c * app/qmask.c * app/undo.c * app/core/gimpchannel.c * app/core/gimpdrawable-desaturate.c * app/core/gimpdrawable-equalize.c * app/core/gimpdrawable-invert.c * app/core/gimpdrawable-offset.c * app/core/gimpedit.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimpimage-new.c * app/core/gimpimage.[ch] * app/core/gimplayer.c * app/core/gimplayermask.c * app/gui/channels-commands.c * app/gui/gui.c * app/gui/layers-commands.c * app/tools/gimpairbrushtool.c * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimplevelstool.c * app/tools/gimppainttool.c * app/tools/gimpposterizetool.c * app/tools/gimpscaletool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c * app/tools/tool_manager.c * app/widgets/gimpchannellistitem.c * app/widgets/gimpchannellistview.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/parasite_cmds.c * app/pdb/selection_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/tools_cmds.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb: changed accordingly. Misc small fixes and cleanups.
2001-07-08 06:49:01 +08:00
}
}
void
gimp_channel_get_color (GimpChannel *channel,
GimpRGB *color)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (color != NULL);
*color = channel->color;
}
gdouble
gimp_channel_get_opacity (GimpChannel *channel)
{
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), GIMP_OPACITY_TRANSPARENT);
return channel->color.a;
}
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
void
gimp_channel_set_opacity (GimpChannel *channel,
gdouble opacity,
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes 2003-03-17 Michael Natterer <mitch@gimp.org> Made drawable/layer properties (visibility, opacity etc.) undoable (fixes bug #73893). * app/core/core-enums.[ch]: added undo types/groups for visibility, mode, opacity, linked and preserve_trans. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a ref'ed GimpItem pointer so (1) this doesn't need to be done by all undo steps related to an item and (2) the item the undo step is for can be determined from outside the undo system. * app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item() which returns a new GimpItemUndo. * app/core/gimpimage-undo-push.[ch]: use it for all item related undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable and GimpVectors pointers from the private undo structs. Added undo push functions for the new undo types added above. * app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added "gboolean push_undo" parameter. * app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode, _preserve_trans, _linked): added "gboolean push_undo" parameters. * app/core/gimpimage-mask.c * app/core/gimpimage-merge.c * app/core/gimplayer-floating-sel.c * app/tools/gimpmovetool.c * app/xcf/xcf-load.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c: changed accordingly. * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to the foo_accessors() functions. Removed $func from foo_accesors() because we don't manipulate items without using getters/setters any longer. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c: regenerated. * app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal which carries an additional "GdkModifierType state" parameter as in GimpCellRendererViewable . * app/widgets/gimpcontainertreeview.c: emit "clicked" from the toggle renderer, not "toggled" so the callbacks get the modifier state. * app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive visible by <shift>+click" feature as in 1.2. * app/widgets/gimplayertreeview.c: compress layer opacity undos by looking at the top of the undo stack and not pushing an undo if there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active layer.
2003-03-18 02:02:41 +08:00
gboolean push_undo)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
opacity = CLAMP (opacity, GIMP_OPACITY_TRANSPARENT, GIMP_OPACITY_OPAQUE);
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes 2003-03-17 Michael Natterer <mitch@gimp.org> Made drawable/layer properties (visibility, opacity etc.) undoable (fixes bug #73893). * app/core/core-enums.[ch]: added undo types/groups for visibility, mode, opacity, linked and preserve_trans. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a ref'ed GimpItem pointer so (1) this doesn't need to be done by all undo steps related to an item and (2) the item the undo step is for can be determined from outside the undo system. * app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item() which returns a new GimpItemUndo. * app/core/gimpimage-undo-push.[ch]: use it for all item related undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable and GimpVectors pointers from the private undo structs. Added undo push functions for the new undo types added above. * app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added "gboolean push_undo" parameter. * app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode, _preserve_trans, _linked): added "gboolean push_undo" parameters. * app/core/gimpimage-mask.c * app/core/gimpimage-merge.c * app/core/gimplayer-floating-sel.c * app/tools/gimpmovetool.c * app/xcf/xcf-load.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c: changed accordingly. * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to the foo_accessors() functions. Removed $func from foo_accesors() because we don't manipulate items without using getters/setters any longer. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c: regenerated. * app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal which carries an additional "GdkModifierType state" parameter as in GimpCellRendererViewable . * app/widgets/gimpcontainertreeview.c: emit "clicked" from the toggle renderer, not "toggled" so the callbacks get the modifier state. * app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive visible by <shift>+click" feature as in 1.2. * app/widgets/gimplayertreeview.c: compress layer opacity undos by looking at the top of the undo stack and not pushing an undo if there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active layer.
2003-03-18 02:02:41 +08:00
if (channel->color.a != opacity)
{
if (push_undo && gimp_item_is_attached (GIMP_ITEM (channel)))
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes 2003-03-17 Michael Natterer <mitch@gimp.org> Made drawable/layer properties (visibility, opacity etc.) undoable (fixes bug #73893). * app/core/core-enums.[ch]: added undo types/groups for visibility, mode, opacity, linked and preserve_trans. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a ref'ed GimpItem pointer so (1) this doesn't need to be done by all undo steps related to an item and (2) the item the undo step is for can be determined from outside the undo system. * app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item() which returns a new GimpItemUndo. * app/core/gimpimage-undo-push.[ch]: use it for all item related undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable and GimpVectors pointers from the private undo structs. Added undo push functions for the new undo types added above. * app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added "gboolean push_undo" parameter. * app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode, _preserve_trans, _linked): added "gboolean push_undo" parameters. * app/core/gimpimage-mask.c * app/core/gimpimage-merge.c * app/core/gimplayer-floating-sel.c * app/tools/gimpmovetool.c * app/xcf/xcf-load.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c: changed accordingly. * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to the foo_accessors() functions. Removed $func from foo_accesors() because we don't manipulate items without using getters/setters any longer. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c: regenerated. * app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal which carries an additional "GdkModifierType state" parameter as in GimpCellRendererViewable . * app/widgets/gimpcontainertreeview.c: emit "clicked" from the toggle renderer, not "toggled" so the callbacks get the modifier state. * app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive visible by <shift>+click" feature as in 1.2. * app/widgets/gimplayertreeview.c: compress layer opacity undos by looking at the top of the undo stack and not pushing an undo if there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active layer.
2003-03-18 02:02:41 +08:00
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (channel));
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes 2003-03-17 Michael Natterer <mitch@gimp.org> Made drawable/layer properties (visibility, opacity etc.) undoable (fixes bug #73893). * app/core/core-enums.[ch]: added undo types/groups for visibility, mode, opacity, linked and preserve_trans. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a ref'ed GimpItem pointer so (1) this doesn't need to be done by all undo steps related to an item and (2) the item the undo step is for can be determined from outside the undo system. * app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item() which returns a new GimpItemUndo. * app/core/gimpimage-undo-push.[ch]: use it for all item related undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable and GimpVectors pointers from the private undo structs. Added undo push functions for the new undo types added above. * app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added "gboolean push_undo" parameter. * app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode, _preserve_trans, _linked): added "gboolean push_undo" parameters. * app/core/gimpimage-mask.c * app/core/gimpimage-merge.c * app/core/gimplayer-floating-sel.c * app/tools/gimpmovetool.c * app/xcf/xcf-load.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c: changed accordingly. * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to the foo_accessors() functions. Removed $func from foo_accesors() because we don't manipulate items without using getters/setters any longer. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c: regenerated. * app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal which carries an additional "GdkModifierType state" parameter as in GimpCellRendererViewable . * app/widgets/gimpcontainertreeview.c: emit "clicked" from the toggle renderer, not "toggled" so the callbacks get the modifier state. * app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive visible by <shift>+click" feature as in 1.2. * app/widgets/gimplayertreeview.c: compress layer opacity undos by looking at the top of the undo stack and not pushing an undo if there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active layer.
2003-03-18 02:02:41 +08:00
gimp_image_undo_push_channel_color (image, C_("undo-type", "Set Channel Opacity"),
channel);
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes 2003-03-17 Michael Natterer <mitch@gimp.org> Made drawable/layer properties (visibility, opacity etc.) undoable (fixes bug #73893). * app/core/core-enums.[ch]: added undo types/groups for visibility, mode, opacity, linked and preserve_trans. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a ref'ed GimpItem pointer so (1) this doesn't need to be done by all undo steps related to an item and (2) the item the undo step is for can be determined from outside the undo system. * app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item() which returns a new GimpItemUndo. * app/core/gimpimage-undo-push.[ch]: use it for all item related undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable and GimpVectors pointers from the private undo structs. Added undo push functions for the new undo types added above. * app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added "gboolean push_undo" parameter. * app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode, _preserve_trans, _linked): added "gboolean push_undo" parameters. * app/core/gimpimage-mask.c * app/core/gimpimage-merge.c * app/core/gimplayer-floating-sel.c * app/tools/gimpmovetool.c * app/xcf/xcf-load.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c: changed accordingly. * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to the foo_accessors() functions. Removed $func from foo_accesors() because we don't manipulate items without using getters/setters any longer. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c: regenerated. * app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal which carries an additional "GdkModifierType state" parameter as in GimpCellRendererViewable . * app/widgets/gimpcontainertreeview.c: emit "clicked" from the toggle renderer, not "toggled" so the callbacks get the modifier state. * app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive visible by <shift>+click" feature as in 1.2. * app/widgets/gimplayertreeview.c: compress layer opacity undos by looking at the top of the undo stack and not pushing an undo if there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active layer.
2003-03-18 02:02:41 +08:00
}
channel->color.a = opacity;
if (gimp_filter_peek_node (GIMP_FILTER (channel)))
{
gimp_gegl_node_set_color (channel->color_node,
&channel->color);
}
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
g_signal_emit (channel, channel_signals[COLOR_CHANGED], 0);
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes 2003-03-17 Michael Natterer <mitch@gimp.org> Made drawable/layer properties (visibility, opacity etc.) undoable (fixes bug #73893). * app/core/core-enums.[ch]: added undo types/groups for visibility, mode, opacity, linked and preserve_trans. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a ref'ed GimpItem pointer so (1) this doesn't need to be done by all undo steps related to an item and (2) the item the undo step is for can be determined from outside the undo system. * app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item() which returns a new GimpItemUndo. * app/core/gimpimage-undo-push.[ch]: use it for all item related undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable and GimpVectors pointers from the private undo structs. Added undo push functions for the new undo types added above. * app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added "gboolean push_undo" parameter. * app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode, _preserve_trans, _linked): added "gboolean push_undo" parameters. * app/core/gimpimage-mask.c * app/core/gimpimage-merge.c * app/core/gimplayer-floating-sel.c * app/tools/gimpmovetool.c * app/xcf/xcf-load.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c: changed accordingly. * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to the foo_accessors() functions. Removed $func from foo_accesors() because we don't manipulate items without using getters/setters any longer. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c: regenerated. * app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal which carries an additional "GdkModifierType state" parameter as in GimpCellRendererViewable . * app/widgets/gimpcontainertreeview.c: emit "clicked" from the toggle renderer, not "toggled" so the callbacks get the modifier state. * app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive visible by <shift>+click" feature as in 1.2. * app/widgets/gimplayertreeview.c: compress layer opacity undos by looking at the top of the undo stack and not pushing an undo if there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active layer.
2003-03-18 02:02:41 +08:00
}
}
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
gboolean
gimp_channel_get_show_masked (GimpChannel *channel)
{
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
return channel->show_masked;
}
void
gimp_channel_set_show_masked (GimpChannel *channel,
gboolean show_masked)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
if (show_masked != channel->show_masked)
{
channel->show_masked = show_masked ? TRUE : FALSE;
if (channel->invert_node)
{
GeglNode *source;
source = gimp_drawable_get_source_node (GIMP_DRAWABLE (channel));
if (channel->show_masked)
{
gegl_node_connect_to (source, "output",
channel->invert_node, "input");
gegl_node_connect_to (channel->invert_node, "output",
channel->mask_node, "aux");
}
else
{
gegl_node_disconnect (channel->invert_node, "input");
gegl_node_connect_to (source, "output",
channel->mask_node, "aux");
}
}
gimp_drawable_update (GIMP_DRAWABLE (channel), 0, 0, -1, -1);
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
}
}
void
gimp_channel_push_undo (GimpChannel *channel,
const gchar *undo_desc)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
gimp_image_undo_push_mask (gimp_item_get_image (GIMP_ITEM (channel)),
undo_desc, channel);
}
/******************************/
/* selection mask functions */
/******************************/
1997-11-25 06:05:25 +08:00
GimpChannel *
gimp_channel_new_mask (GimpImage *image,
gint width,
gint height)
1997-11-25 06:05:25 +08:00
{
GimpChannel *channel;
1997-11-25 06:05:25 +08:00
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
channel =
GIMP_CHANNEL (gimp_drawable_new (GIMP_TYPE_CHANNEL,
image, _("Selection Mask"),
0, 0, width, height,
gimp_image_get_mask_format (image)));
channel->show_masked = TRUE;
channel->x2 = width;
channel->y2 = height;
1997-11-25 06:05:25 +08:00
gegl_buffer_clear (gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
NULL);
build color_cmds, lut_funcs, and pixel_processor feedback in the splash * app/Makefile.am: build color_cmds, lut_funcs, and pixel_processor * app/app_procs.c: feedback in the splash screen when loading parasites. * app/boundary.c: Optimized find_empty_segs. * app/brightness_contrast.[ch] * app/levels.[ch] * app/posterize.[ch]: moved pdb and lut calculation code. These files now contain only GUI functions. * app/channel.c: Optimized channel_bounds (fewer compares, better use of registers). Use color_region instead of channel_*_segment in channel_combine_rect. Optimized channel_combine_ellipse by skipping pixels inside of the ellipse. Use pixel_region_process_parallel in channel_combine_mask. Use a GimpLut in channel_invert, and channel_sharpen. * app/invert.c * app/equalize.c: moved the lut functions to lut_funcs.c * app/gimpdrawable.c, app/gimpdrawableP.h * app/gimpimage.c, app/gimpimageP.h: removed unused gimpmatrix variables/includes. * app/gimplut.[ch]: added new function gimp_lut_process_inline that operates on a single PixelRegion. * app/gimpparasite.[ch]: new functions to save/load parasiterc * app/parasitelist.[ch]: new functions to save/load ParasiteLists in/from files. * libgimp/parasite.[ch]: new functions to load/save parasites. * app/internal_procs.c: get some procs from new location in color_cmds.h. * app/pixel_region.[ch]: moved pixel_regions_process_parallel related functions to a new file. * app/color_cmds.[ch]: new files for PDB definitions/implementations of color correction functions. * app/lut_funcs.[ch]: new files to hold lut creation functions. * app/pixel_processor.[ch]: new files that contain the pixel_regions_process_parallel routines. Added some new capabilities that are currently unused.
1999-04-09 14:00:11 +08:00
return channel;
1997-11-25 06:05:25 +08:00
}
gboolean
gimp_channel_boundary (GimpChannel *channel,
const GimpBoundSeg **segs_in,
const GimpBoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2)
1997-11-25 06:05:25 +08:00
{
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
g_return_val_if_fail (segs_in != NULL, FALSE);
g_return_val_if_fail (segs_out != NULL, FALSE);
g_return_val_if_fail (num_segs_in != NULL, FALSE);
g_return_val_if_fail (num_segs_out != NULL, FALSE);
1997-11-25 06:05:25 +08:00
return GIMP_CHANNEL_GET_CLASS (channel)->boundary (channel,
segs_in, segs_out,
num_segs_in, num_segs_out,
x1, y1,
x2, y2);
}
gboolean
gimp_channel_is_empty (GimpChannel *channel)
{
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
return GIMP_CHANNEL_GET_CLASS (channel)->is_empty (channel);
}
1997-11-25 06:05:25 +08:00
void
gimp_channel_feather (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
General cleanup of the selection tools and their PDB wrappers: 2001-10-22 Michael Natterer <mitch@gimp.org> General cleanup of the selection tools and their PDB wrappers: * app/core/Makefile.am * app/core/gimpimage-contiguous-region.[ch] * app/core/gimpimage-mask-select.[ch]: new files providing a clean, uniform API for the selection functionalities. Changed order of parameters to be consistent, removed code duplication. The region returned by the "by_color" function is not really contiguous but the API is so similar to "by_seed" and it's used in the same context so it's fair enough to put them together. Also, I'm not sure if the two is_pixel_sufficiently_different() I've optimized away were meant to do *exactly* the same. Added a comment there to remember the former difference. * app/core/gimpchannel.[ch] (gimp_channel_feather): removed the "output" channel parameter and made it optionally push an undo (like the other channel operations do). * app/core/gimpimage-mask.c: call gimp_channel_feather() with "push_undo == TRUE", removed some useless comments. * app/tools/gimpbycolorselecttool.[ch] * app/tools/gimpellipseselecttool.[ch] * app/tools/gimpfreeselecttool.[ch] * app/tools/gimpfuzzyselecttool.[ch] * app/tools/gimprectselecttool.[ch]: removed all the actual selection functionality and call the new gimp_image_mask_select_*() and gimp_image_contiguous_region_*() functions instead. * app/tools/gimpbezierselecttool.c * app/tools/gimpiscissorstool.c: use new function gimp_image_mask_select_channel() instead of doing the same manually. * app/tools/gimpbucketfilltool.c: find_contiguous_region() -> gimp_image_contiguous_region_by_seed(). * tools/pdbgen/Makefile.am * tools/pdbgen/groups.pl * tools/pdbgen/pdb/selection_tools.pdb: added new group "Selection Tools" which depends only on "core/" stuff (not on "tools/" any more, brrrr). * tools/pdbgen/pdb/text_tool.pdb: don't include "appenv.h" * tools/pdbgen/pdb/tools.pdb: removed the selection tools. * app/pdb/Makefile.am * app/pdb/selection_tools_cmds.c: new file. * app/pdb/internal_procs.c * app/pdb/text_tool_cmds.c * app/pdb/tools_cmds.c: regenerated. * libgimp/Makefile.am * libgimp/gimp_pdb.h * libgimp/gimpselectiontools_pdb.[ch]: new files. * libgimp/gimptools_pdb.[ch]: regenerated Misc cleanups: * app/app_procs.c: call splash_create() with "no_splash_image" as parameter. * app/display/gimpdisplay-render.c * app/display/gximage.c: don't include "appenv.h". * app/gui/gui.c: call session_restore() only if "restore_session" is TRUE. * app/gui/session.c: don't "if(restore_session)" here and don't include "appenv.h" * app/gui/splash.[ch]: added "gboolean show_image" parameter to splash_create(), don't include "appenv.h" * app/tools/gimppainttool.[ch]: added a "GimpGradient" parameter to gimp_paint_tool_get_color_from_gradient(). * app/tools/gimppaintbrushtool.c: pass the gradient. * app/tools/gimpselectiontool.c * app/tools/gimptransformtool.c * app/tools/tool_manager.c: s/GDisplay/GimpDisplay/. * app/widgets/gimpcontainergridview.[ch]: removed the "white_style" class variable and don't fiddle around with colors and styles... * themes/Default/gtkrc: ...do the same here with a simple rc style.
2001-10-22 20:13:44 +08:00
gboolean push_undo)
1997-11-25 06:05:25 +08:00
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
1997-11-25 06:05:25 +08:00
if (! gimp_item_is_attached (GIMP_ITEM (channel)))
push_undo = FALSE;
GIMP_CHANNEL_GET_CLASS (channel)->feather (channel, radius_x, radius_y,
push_undo);
1997-11-25 06:05:25 +08:00
}
void
gimp_channel_sharpen (GimpChannel *channel,
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
gboolean push_undo)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
if (! gimp_item_is_attached (GIMP_ITEM (channel)))
push_undo = FALSE;
GIMP_CHANNEL_GET_CLASS (channel)->sharpen (channel, push_undo);
}
1997-11-25 06:05:25 +08:00
void
gimp_channel_clear (GimpChannel *channel,
const gchar *undo_desc,
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
gboolean push_undo)
1997-11-25 06:05:25 +08:00
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
1997-11-25 06:05:25 +08:00
if (! gimp_item_is_attached (GIMP_ITEM (channel)))
push_undo = FALSE;
GIMP_CHANNEL_GET_CLASS (channel)->clear (channel, undo_desc, push_undo);
1997-11-25 06:05:25 +08:00
}
void
gimp_channel_all (GimpChannel *channel,
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
gboolean push_undo)
1997-11-25 06:05:25 +08:00
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
1997-11-25 06:05:25 +08:00
if (! gimp_item_is_attached (GIMP_ITEM (channel)))
push_undo = FALSE;
GIMP_CHANNEL_GET_CLASS (channel)->all (channel, push_undo);
1997-11-25 06:05:25 +08:00
}
void
gimp_channel_invert (GimpChannel *channel,
gboolean push_undo)
1997-11-25 06:05:25 +08:00
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
if (! gimp_item_is_attached (GIMP_ITEM (channel)))
push_undo = FALSE;
GIMP_CHANNEL_GET_CLASS (channel)->invert (channel, push_undo);
1997-11-25 06:05:25 +08:00
}
void
gimp_channel_border (GimpChannel *channel,
gint radius_x,
gint radius_y,
GimpChannelBorderStyle style,
gboolean edge_lock,
gboolean push_undo)
1997-11-25 06:05:25 +08:00
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
1997-11-25 06:05:25 +08:00
if (! gimp_item_is_attached (GIMP_ITEM (channel)))
push_undo = FALSE;
GIMP_CHANNEL_GET_CLASS (channel)->border (channel,
radius_x, radius_y, style, edge_lock,
push_undo);
1997-11-25 06:05:25 +08:00
}
void
gimp_channel_grow (GimpChannel *channel,
gint radius_x,
gint radius_y,
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
gboolean push_undo)
1997-11-25 06:05:25 +08:00
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
if (! gimp_item_is_attached (GIMP_ITEM (channel)))
push_undo = FALSE;
GIMP_CHANNEL_GET_CLASS (channel)->grow (channel, radius_x, radius_y,
push_undo);
1997-11-25 06:05:25 +08:00
}
void
gimp_channel_shrink (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean edge_lock,
Make sure the selection (gimpimage-mask.c) functionality is really built 2002-08-20 Michael Natterer <mitch@gimp.org> Make sure the selection (gimpimage-mask.c) functionality is really built *on top* of the GimpChannel functionality: * app/undo.[ch]: renamed undo_push_image_mask() to undo_push_mask() and generalized it's API to take a GimpChannel param so undos can be pushed for channels which are not the image's selection. Simplified the API and added code which copies the region of interest instead of leaving this to callers. * app/undo_types.h: s/IMAGE_MASK_UNDO/MASK_UNDO/ * app/undo_history.c: changed accordingly. * app/core/gimpchannel.[ch]: don't #include "gimpimage-mask.h". Changed gimp_channel_push_undo() to really push a channel undo, not a selection undo. Added "gboolean push_undo" params to all functions which are called from gimpimage-mask.c. Various cleanups and optimizations. Added /*< proxy-foo >*/ stuff to the header so we export just the struct itself to libgimpproxy. Added accessors gimp_channel_[get|set]_show_masked(). * app/core/gimpimage-mask.[ch]: renamed gimp_image_mask_undo() to gimp_image_mask_push_undo(). Call it before calling GimpChannel functions which modify the mask, also call all GimpChannel functions with push_undo = FALSE. Emit gimp_image_mask_changed() after each operation instead of calling it in gimp_image_mask_invalidate(). Removed gimp_image_mask_none() because it is the same as gimp_image_mask_clear(). General cleanup. * app/core/gimpimage-mask-select.c * app/core/gimpimage-qmask.c: changed accordingly. * app/core/gimpedit.c: call gimp_image_mask_clear(), not gimp_channel_clear (gimp_image_get_mask()). * app/core/gimpimage-crop.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c: call gimp_image_mask_changed() * app/gui/channels-commands.c * app/gui/select-commands.c * app/tools/gimptexttool.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/selection.pdb: follow GimpChannel and gimp_image_mask* API changes. * app/pdb/channel_cmds.c * app/pdb/selection_cmds.c * libgimpproxy/gimpchannel.h: regenerated. Unrelated: * app/core/gimpimage.c: call gimp_drawable_push_undo() instead of undo_push_image() directly.
2002-08-20 18:22:23 +08:00
gboolean push_undo)
1997-11-25 06:05:25 +08:00
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
1997-11-25 06:05:25 +08:00
if (! gimp_item_is_attached (GIMP_ITEM (channel)))
push_undo = FALSE;
GIMP_CHANNEL_GET_CLASS (channel)->shrink (channel, radius_x, radius_y,
edge_lock, push_undo);
1997-11-25 06:05:25 +08:00
}
void
gimp_channel_flood (GimpChannel *channel,
gboolean push_undo)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
if (! gimp_item_is_attached (GIMP_ITEM (channel)))
push_undo = FALSE;
GIMP_CHANNEL_GET_CLASS (channel)->flood (channel, push_undo);
}