gimp/app/core/gimpdrawable.c

1785 lines
63 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <cairo.h>
#include <gegl.h>
#include <gegl-plugin.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "core-types.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 "gegl/gimpapplicator.h"
#include "gegl/gimp-babl.h"
#include "gegl/gimp-gegl-apply-operation.h"
#include "gegl/gimp-gegl-utils.h"
#include "gimp-utils.h"
#include "gimpchannel.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 "gimpcontext.h"
#include "gimpdrawable-combine.h"
#include "gimpdrawable-filter.h"
#include "gimpdrawable-preview.h"
#include "gimpdrawable-private.h"
Move the shadow tiles from the image to the drawable. Fixes bug #100469. 2008-04-21 Michael Natterer <mitch@gimp.org> Move the shadow tiles from the image to the drawable. Fixes bug #100469. * app/core/Makefile.am * app/core/gimpdrawable-shadow.[ch]: new files implementing the shadow tiles. * app/core/gimpimage.[ch]: remove the shadow tile manager from the GimpImage struct. Remove gimp_image_get_shadow_tiles() and _free_shadow_tiles(). * app/core/gimpdrawable.[ch]: add the shadow tile manager here. Remove get_shadow_tiles() and merge_shadow(). Free the shadow tiles in finalize and when the drawable gets removed from the image. * app/core/gimpdrawable-brightness-contrast.c * app/core/gimpdrawable-color-balance.c * app/core/gimpdrawable-colorize.c * app/core/gimpdrawable-curves.c * app/core/gimpdrawable-desaturate.c * app/core/gimpdrawable-equalize.c * app/core/gimpdrawable-hue-saturation.c * app/core/gimpdrawable-invert.c * app/core/gimpdrawable-levels.c * app/core/gimpdrawable-operation.c * app/core/gimpdrawable-posterize.c * app/core/gimpdrawable-threshold.c * app/core/gimpimagemap.c: changed accordingly. Free the shadow tiles after using them. * app/plug-in/gimpplugin-cleanup.[ch]: add gimp_plug_in_cleanup_add_shadow() and _remove_shadow() which keep track of whether shadow tiles were created on behalf of a plug-in procedure. (gimp_plug_in_cleanup): free shadow tiles which were created but not destroyed by a plug-in procedure. * app/plug-in/gimpplugin-message.c (plug_in_handle_tile_request): call gimp_plug_in_cleanup_add_shadow() whenever a plug-in requests shadow tiles. * tools/pdbgen/pdb/drawable.pdb: use the new drawable shadow API. Add new procedure gimp-drawable-free-shadow. Call gimp_plug_in_cleaup_remove_shadow() when it gets called. * tools/pdbgen/pdb/image.pdb: deprecate gimp-image-free-shadow. Calling it has no effect any longer. * app/pdb/drawable-cmds.c * app/pdb/image-cmds.c * app/pdb/internal-procs.c * libgimp/gimpimage_pdb.[ch] * libgimp/gimpdrawable_pdb.[ch]: regenerated. svn path=/trunk/; revision=25510
2008-04-22 01:20:51 +08:00
#include "gimpdrawable-shadow.h"
#include "gimpdrawable-transform.h"
#include "gimpfilterstack.h"
#include "gimpimage.h"
#include "gimpimage-colormap.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 "gimplayer.h"
bumped version number to 1.3.1. Require Glib/GTK+-1.3.11 and Pango-0.22. 2001-11-23 Sven Neumann <sven@gimp.org> * configure.in: bumped version number to 1.3.1. Require Glib/GTK+-1.3.11 and Pango-0.22. Removed GDK_DISABLE_COMPAT_H and GTK_DISABLE_COMPAT_H from our default CFLAGS since they don't exist any longer. * RELEASE-TO-CVS.patch: removed since the glib/gtk+ API is supposed to be frozen now. * HACKING: removed reference to RELEASE-TO-CVS.patch * app/gui/menus.c * app/tools/gimptexttool.c: applied RELEASE-TO-CVS.patch to conform to the new GTK+/Pango API. * app/core/Makefile.am: generate marshallers with gimp_marshal prefix. * app/core/gimpmarshal.list: added all marshallers we use. * app/core/gimpmarshal.[ch]: regenerated. * app/[lots of .c files]: use gimp_marshal_* for all marshallers. * data/images/ * app/app_procs.c * app/gui/splash.c: * libgimpbase/Makefile.am * libgimpbase/gimpbase.h * libgimpbase/gimputils.[ch]: removed since they are no longer needed. * app/gimprc.c * plug-ins/common/ps.c * plug-ins/gdyntext/gdyntext.c * plug-ins/gdyntext/gdyntextcompat.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/script-fu/script-fu-scripts.c: use glib functions instead of gimp_strescape() and gimpstrcompress(). * cleaned up all header files: use G_BEGIN_DECLS/G_END_DECLS, declared all _get_type function as G_GNUC_CONST. * tools/pdbgen/enumcode.pl * tools/pdbgen/lib.pl: make them generate header files using G_BEGIN_DECLS/G_END_DECLS. * pixmaps/Makefile.am * pixmaps/wilber3.xpm: removed ... * data/images/tips_wilber.png: ... and added here as PNG * app/gui/tips-dialog.c: load the Wilber on demand using GdkPixbuf. * data/images/gimp_splash.ppm: removed ... * data/images/gimp_splash.png: ... and added as PNG * app/app_procs.c * app/gui/splash.[ch]: load the splash image using GdkPixbuf. * app/gui/about-dialog.c: sink the GtkPreview.
2001-11-23 07:46:13 +08:00
#include "gimpmarshal.h"
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
#include "gimppattern.h"
#include "gimppickable.h"
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
#include "gimpprogress.h"
#include "gimp-log.h"
#include "gimp-intl.h"
enum
{
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,
ALPHA_CHANGED,
LAST_SIGNAL
};
enum
{
PROP_0,
PROP_BUFFER
};
app/Makefile.am app/gimpunit.c removed... 2001-07-11 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimpunit.c * app/unitrc.h: removed... * app/core/Makefile.am * app/core/gimpunit.[ch]: ...re-added here. * app/core/gimp.[ch]: added the image and drawable hash tables, next_image_ID, next_guide_ID and next_drawable_ID, added a GimpCoreConfig pointer which is now initalized dynamically. * app/core/gimpcoreconfig.[ch]: don't provide a global core_config variable any more (need to access gimp->config now). * app/gdisplay.[ch] * app/core/gimpdrawable.[ch] * app/core/gimpimage.[ch]: removed all global variables from gimpimage.c and gimpdrawable.c, pass a Gimp* to all *_get_by_ID() functions. * tools/pdbgen/app.pl: pass Gimp* to all _get_by_ID() functions. * app/app_procs.c * app/file-open.c * app/file-save.c * app/gimprc.c * app/libgimp_glue.c * app/module_db.c * app/plug_in.c * app/undo.c * app/user_install.c * app/core/core-types.h * app/core/gimpcontext.c * app/core/gimpimage-crop.c * app/core/gimpimage-new.c * app/core/gimpparasite.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/info-window.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * app/widgets/gimpdnd.c * app/pdb/channel_cmds.c * app/pdb/color_cmds.c * app/pdb/convert_cmds.c * app/pdb/display_cmds.c * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * app/pdb/fileops_cmds.c * app/pdb/floating_sel_cmds.c * app/pdb/guides_cmds.c * app/pdb/image_cmds.c * app/pdb/layer_cmds.c * app/pdb/parasite_cmds.c * app/pdb/paths_cmds.c * app/pdb/selection_cmds.c * app/pdb/text_tool_cmds.c * app/pdb/tools_cmds.c * app/pdb/undo_cmds.c * app/pdb/unit_cmds.c * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/unit.pdb: changed accordingly.
2001-07-11 20:39:49 +08:00
/* local function prototypes */
static void gimp_drawable_pickable_iface_init (GimpPickableInterface *iface);
static void gimp_drawable_dispose (GObject *object);
static void gimp_drawable_finalize (GObject *object);
static void gimp_drawable_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_drawable_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static gint64 gimp_drawable_get_memsize (GimpObject *object,
gint64 *gui_size);
static gboolean gimp_drawable_get_size (GimpViewable *viewable,
gint *width,
gint *height);
static GeglNode * gimp_drawable_get_node (GimpFilter *filter);
Move the shadow tiles from the image to the drawable. Fixes bug #100469. 2008-04-21 Michael Natterer <mitch@gimp.org> Move the shadow tiles from the image to the drawable. Fixes bug #100469. * app/core/Makefile.am * app/core/gimpdrawable-shadow.[ch]: new files implementing the shadow tiles. * app/core/gimpimage.[ch]: remove the shadow tile manager from the GimpImage struct. Remove gimp_image_get_shadow_tiles() and _free_shadow_tiles(). * app/core/gimpdrawable.[ch]: add the shadow tile manager here. Remove get_shadow_tiles() and merge_shadow(). Free the shadow tiles in finalize and when the drawable gets removed from the image. * app/core/gimpdrawable-brightness-contrast.c * app/core/gimpdrawable-color-balance.c * app/core/gimpdrawable-colorize.c * app/core/gimpdrawable-curves.c * app/core/gimpdrawable-desaturate.c * app/core/gimpdrawable-equalize.c * app/core/gimpdrawable-hue-saturation.c * app/core/gimpdrawable-invert.c * app/core/gimpdrawable-levels.c * app/core/gimpdrawable-operation.c * app/core/gimpdrawable-posterize.c * app/core/gimpdrawable-threshold.c * app/core/gimpimagemap.c: changed accordingly. Free the shadow tiles after using them. * app/plug-in/gimpplugin-cleanup.[ch]: add gimp_plug_in_cleanup_add_shadow() and _remove_shadow() which keep track of whether shadow tiles were created on behalf of a plug-in procedure. (gimp_plug_in_cleanup): free shadow tiles which were created but not destroyed by a plug-in procedure. * app/plug-in/gimpplugin-message.c (plug_in_handle_tile_request): call gimp_plug_in_cleanup_add_shadow() whenever a plug-in requests shadow tiles. * tools/pdbgen/pdb/drawable.pdb: use the new drawable shadow API. Add new procedure gimp-drawable-free-shadow. Call gimp_plug_in_cleaup_remove_shadow() when it gets called. * tools/pdbgen/pdb/image.pdb: deprecate gimp-image-free-shadow. Calling it has no effect any longer. * app/pdb/drawable-cmds.c * app/pdb/image-cmds.c * app/pdb/internal-procs.c * libgimp/gimpimage_pdb.[ch] * libgimp/gimpdrawable_pdb.[ch]: regenerated. svn path=/trunk/; revision=25510
2008-04-22 01:20:51 +08:00
static void gimp_drawable_removed (GimpItem *item);
static void gimp_drawable_visibility_changed (GimpItem *item);
static GimpItem * gimp_drawable_duplicate (GimpItem *item,
GType new_type);
static void gimp_drawable_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_drawable_resize (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,
gint new_width,
gint new_height,
gint offset_x,
gint offset_y);
static void gimp_drawable_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);
static void gimp_drawable_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);
static void gimp_drawable_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);
static gboolean gimp_drawable_get_pixel_at (GimpPickable *pickable,
gint x,
gint y,
const Babl *format,
gpointer pixel);
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
static void gimp_drawable_real_update (GimpDrawable *drawable,
gint x,
gint y,
gint width,
gint height);
static gint64 gimp_drawable_real_estimate_memsize (const GimpDrawable *drawable,
gint width,
gint height);
static void gimp_drawable_real_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
gint layer_dither_type,
gint mask_dither_type,
gboolean push_undo);
static GeglBuffer * gimp_drawable_real_get_buffer (GimpDrawable *drawable);
static void gimp_drawable_real_set_buffer (GimpDrawable *drawable,
gboolean push_undo,
const gchar *undo_desc,
GeglBuffer *buffer,
gint offset_x,
gint offset_y);
added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types 2004-04-01 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch] (enum GimpUndoType): added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types GIMP_UNDO_GROUP_DRAWABLE and GIMP_UNDO_GROUP_DRAWABLE_MOD. * app/core/gimpimage-undo-push.[ch]: added new new function gimp_image_undo_push_text_layer_modified() which makes modifications of the text_layer's "modified" boolean undoable. * app/core/gimpdrawable.[ch]: added new virtual function GimpDrawable::push_undo() and moved the actual undo pushing into the default implementation gimp_drawable_real_push_undo(). * app/text/gimptextlayer.c (gimp_text_layer_push_undo): new function. Pushes the text_layer's modified state to the undo stack after upchaining and sets modified to TRUE. (gimp_text_layer_set_tiles): ditto. (gimp_lext_layer_apply_region) (gimp_text_layer_replace_region): removed because their default implementations already call gimp_drawable_push_undo(). (gimp_text_layer_swap_pixels): removed because swap_pixels() is used by undo only and doesn't need to care about the text_layer's modified state. (gimp_text_layer_render): don't set modified to FALSE here because we can't push an undo step here. (gimp_text_layer_set): push the modified state to the undo stack and set it to FALSE here. Also push the layer's tiles if the layer was modified. * app/tools/gimptexttool.c (gimp_text_tool_apply): push "modified" to the undo stack and set it to FALSE here, too. Fixes bug #137767.
2004-04-01 22:51:58 +08:00
static void gimp_drawable_real_push_undo (GimpDrawable *drawable,
const gchar *undo_desc,
GeglBuffer *buffer,
added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types 2004-04-01 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch] (enum GimpUndoType): added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types GIMP_UNDO_GROUP_DRAWABLE and GIMP_UNDO_GROUP_DRAWABLE_MOD. * app/core/gimpimage-undo-push.[ch]: added new new function gimp_image_undo_push_text_layer_modified() which makes modifications of the text_layer's "modified" boolean undoable. * app/core/gimpdrawable.[ch]: added new virtual function GimpDrawable::push_undo() and moved the actual undo pushing into the default implementation gimp_drawable_real_push_undo(). * app/text/gimptextlayer.c (gimp_text_layer_push_undo): new function. Pushes the text_layer's modified state to the undo stack after upchaining and sets modified to TRUE. (gimp_text_layer_set_tiles): ditto. (gimp_lext_layer_apply_region) (gimp_text_layer_replace_region): removed because their default implementations already call gimp_drawable_push_undo(). (gimp_text_layer_swap_pixels): removed because swap_pixels() is used by undo only and doesn't need to care about the text_layer's modified state. (gimp_text_layer_render): don't set modified to FALSE here because we can't push an undo step here. (gimp_text_layer_set): push the modified state to the undo stack and set it to FALSE here. Also push the layer's tiles if the layer was modified. * app/tools/gimptexttool.c (gimp_text_tool_apply): push "modified" to the undo stack and set it to FALSE here, too. Fixes bug #137767.
2004-04-01 22:51:58 +08:00
gint x,
gint y,
gint width,
gint height);
static void gimp_drawable_real_swap_pixels (GimpDrawable *drawable,
GeglBuffer *buffer,
gint x,
gint y);
static void gimp_drawable_sync_fs_filter (GimpDrawable *drawable,
gboolean detach_fs);
static void gimp_drawable_fs_notify (GimpLayer *fs,
const GParamSpec *pspec,
GimpDrawable *drawable);
static void gimp_drawable_fs_affect_changed (GimpImage *image,
GimpChannelType channel,
GimpDrawable *drawable);
static void gimp_drawable_fs_mask_changed (GimpImage *image,
GimpDrawable *drawable);
static void gimp_drawable_fs_update (GimpLayer *fs,
gint x,
gint y,
gint width,
gint height,
GimpDrawable *drawable);
G_DEFINE_TYPE_WITH_CODE (GimpDrawable, gimp_drawable, GIMP_TYPE_ITEM,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_PICKABLE,
gimp_drawable_pickable_iface_init))
#define parent_class gimp_drawable_parent_class
static guint gimp_drawable_signals[LAST_SIGNAL] = { 0 };
static void
gimp_drawable_class_init (GimpDrawableClass *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);
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
gimp_drawable_signals[UPDATE] =
g_signal_new ("update",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpDrawableClass, update),
NULL, NULL,
gimp_marshal_VOID__INT_INT_INT_INT,
G_TYPE_NONE, 4,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_INT);
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
gimp_drawable_signals[ALPHA_CHANGED] =
g_signal_new ("alpha-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpDrawableClass, alpha_changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->dispose = gimp_drawable_dispose;
object_class->finalize = gimp_drawable_finalize;
object_class->set_property = gimp_drawable_set_property;
object_class->get_property = gimp_drawable_get_property;
gimp_object_class->get_memsize = gimp_drawable_get_memsize;
viewable_class->get_size = gimp_drawable_get_size;
viewable_class->get_new_preview = gimp_drawable_get_new_preview;
filter_class->get_node = gimp_drawable_get_node;
Move the shadow tiles from the image to the drawable. Fixes bug #100469. 2008-04-21 Michael Natterer <mitch@gimp.org> Move the shadow tiles from the image to the drawable. Fixes bug #100469. * app/core/Makefile.am * app/core/gimpdrawable-shadow.[ch]: new files implementing the shadow tiles. * app/core/gimpimage.[ch]: remove the shadow tile manager from the GimpImage struct. Remove gimp_image_get_shadow_tiles() and _free_shadow_tiles(). * app/core/gimpdrawable.[ch]: add the shadow tile manager here. Remove get_shadow_tiles() and merge_shadow(). Free the shadow tiles in finalize and when the drawable gets removed from the image. * app/core/gimpdrawable-brightness-contrast.c * app/core/gimpdrawable-color-balance.c * app/core/gimpdrawable-colorize.c * app/core/gimpdrawable-curves.c * app/core/gimpdrawable-desaturate.c * app/core/gimpdrawable-equalize.c * app/core/gimpdrawable-hue-saturation.c * app/core/gimpdrawable-invert.c * app/core/gimpdrawable-levels.c * app/core/gimpdrawable-operation.c * app/core/gimpdrawable-posterize.c * app/core/gimpdrawable-threshold.c * app/core/gimpimagemap.c: changed accordingly. Free the shadow tiles after using them. * app/plug-in/gimpplugin-cleanup.[ch]: add gimp_plug_in_cleanup_add_shadow() and _remove_shadow() which keep track of whether shadow tiles were created on behalf of a plug-in procedure. (gimp_plug_in_cleanup): free shadow tiles which were created but not destroyed by a plug-in procedure. * app/plug-in/gimpplugin-message.c (plug_in_handle_tile_request): call gimp_plug_in_cleanup_add_shadow() whenever a plug-in requests shadow tiles. * tools/pdbgen/pdb/drawable.pdb: use the new drawable shadow API. Add new procedure gimp-drawable-free-shadow. Call gimp_plug_in_cleaup_remove_shadow() when it gets called. * tools/pdbgen/pdb/image.pdb: deprecate gimp-image-free-shadow. Calling it has no effect any longer. * app/pdb/drawable-cmds.c * app/pdb/image-cmds.c * app/pdb/internal-procs.c * libgimp/gimpimage_pdb.[ch] * libgimp/gimpdrawable_pdb.[ch]: regenerated. svn path=/trunk/; revision=25510
2008-04-22 01:20:51 +08:00
item_class->removed = gimp_drawable_removed;
item_class->visibility_changed = gimp_drawable_visibility_changed;
item_class->duplicate = gimp_drawable_duplicate;
item_class->scale = gimp_drawable_scale;
item_class->resize = gimp_drawable_resize;
item_class->flip = gimp_drawable_flip;
item_class->rotate = gimp_drawable_rotate;
item_class->transform = gimp_drawable_transform;
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
klass->update = gimp_drawable_real_update;
klass->alpha_changed = NULL;
klass->estimate_memsize = gimp_drawable_real_estimate_memsize;
klass->invalidate_boundary = NULL;
klass->get_active_components = NULL;
klass->get_active_mask = NULL;
klass->convert_type = gimp_drawable_real_convert_type;
klass->apply_buffer = gimp_drawable_real_apply_buffer;
klass->replace_buffer = gimp_drawable_real_replace_buffer;
klass->get_buffer = gimp_drawable_real_get_buffer;
klass->set_buffer = gimp_drawable_real_set_buffer;
added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types 2004-04-01 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch] (enum GimpUndoType): added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types GIMP_UNDO_GROUP_DRAWABLE and GIMP_UNDO_GROUP_DRAWABLE_MOD. * app/core/gimpimage-undo-push.[ch]: added new new function gimp_image_undo_push_text_layer_modified() which makes modifications of the text_layer's "modified" boolean undoable. * app/core/gimpdrawable.[ch]: added new virtual function GimpDrawable::push_undo() and moved the actual undo pushing into the default implementation gimp_drawable_real_push_undo(). * app/text/gimptextlayer.c (gimp_text_layer_push_undo): new function. Pushes the text_layer's modified state to the undo stack after upchaining and sets modified to TRUE. (gimp_text_layer_set_tiles): ditto. (gimp_lext_layer_apply_region) (gimp_text_layer_replace_region): removed because their default implementations already call gimp_drawable_push_undo(). (gimp_text_layer_swap_pixels): removed because swap_pixels() is used by undo only and doesn't need to care about the text_layer's modified state. (gimp_text_layer_render): don't set modified to FALSE here because we can't push an undo step here. (gimp_text_layer_set): push the modified state to the undo stack and set it to FALSE here. Also push the layer's tiles if the layer was modified. * app/tools/gimptexttool.c (gimp_text_tool_apply): push "modified" to the undo stack and set it to FALSE here, too. Fixes bug #137767.
2004-04-01 22:51:58 +08:00
klass->push_undo = gimp_drawable_real_push_undo;
klass->swap_pixels = gimp_drawable_real_swap_pixels;
g_object_class_override_property (object_class, PROP_BUFFER, "buffer");
g_type_class_add_private (klass, sizeof (GimpDrawablePrivate));
}
static void
gimp_drawable_init (GimpDrawable *drawable)
{
drawable->private = G_TYPE_INSTANCE_GET_PRIVATE (drawable,
GIMP_TYPE_DRAWABLE,
GimpDrawablePrivate);
drawable->private->filter_stack = gimp_filter_stack_new (GIMP_TYPE_FILTER);
}
/* sorry for the evil casts */
static void
gimp_drawable_pickable_iface_init (GimpPickableInterface *iface)
{
iface->get_image = (GimpImage * (*) (GimpPickable *pickable)) gimp_item_get_image;
iface->get_format = (const Babl * (*) (GimpPickable *pickable)) gimp_drawable_get_format;
iface->get_format_with_alpha = (const Babl * (*) (GimpPickable *pickable)) gimp_drawable_get_format_with_alpha;
iface->get_buffer = (GeglBuffer * (*) (GimpPickable *pickable)) gimp_drawable_get_buffer;
iface->get_pixel_at = gimp_drawable_get_pixel_at;
}
static void
gimp_drawable_dispose (GObject *object)
{
GimpDrawable *drawable = GIMP_DRAWABLE (object);
if (gimp_drawable_get_floating_sel (drawable))
gimp_drawable_detach_floating_sel (drawable);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gimp_drawable_finalize (GObject *object)
{
GimpDrawable *drawable = GIMP_DRAWABLE (object);
if (drawable->private->buffer)
{
g_object_unref (drawable->private->buffer);
drawable->private->buffer = NULL;
}
gimp_drawable_free_shadow_buffer (drawable);
if (drawable->private->source_node)
{
g_object_unref (drawable->private->source_node);
drawable->private->source_node = NULL;
}
if (drawable->private->filter_stack)
{
g_object_unref (drawable->private->filter_stack);
drawable->private->filter_stack = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_drawable_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id)
{
case PROP_BUFFER:
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_drawable_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpDrawable *drawable = GIMP_DRAWABLE (object);
switch (property_id)
{
case PROP_BUFFER:
g_value_set_object (value, drawable->private->buffer);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
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_drawable_get_memsize (GimpObject *object,
gint64 *gui_size)
{
GimpDrawable *drawable = GIMP_DRAWABLE (object);
gint64 memsize = 0;
memsize += gimp_gegl_buffer_get_memsize (gimp_drawable_get_buffer (drawable));
memsize += gimp_gegl_buffer_get_memsize (drawable->private->shadow);
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 memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);
}
static gboolean
gimp_drawable_get_size (GimpViewable *viewable,
gint *width,
gint *height)
{
GimpItem *item = GIMP_ITEM (viewable);
*width = gimp_item_get_width (item);
*height = gimp_item_get_height (item);
return TRUE;
}
static GeglNode *
gimp_drawable_get_node (GimpFilter *filter)
{
GimpDrawable *drawable = GIMP_DRAWABLE (filter);
GeglNode *node;
GeglNode *input;
GeglNode *output;
node = GIMP_FILTER_CLASS (parent_class)->get_node (filter);
g_warn_if_fail (drawable->private->mode_node == NULL);
drawable->private->mode_node =
gegl_node_new_child (node,
"operation", "gimp:normal-mode",
NULL);
input = gegl_node_get_input_proxy (node, "input");
output = gegl_node_get_output_proxy (node, "output");
if (gimp_item_get_visible (GIMP_ITEM (drawable)))
{
gegl_node_connect_to (input, "output",
drawable->private->mode_node, "input");
gegl_node_connect_to (drawable->private->mode_node, "output",
output, "input");
}
else
{
gegl_node_connect_to (input, "output",
output, "input");
}
return node;
}
Move the shadow tiles from the image to the drawable. Fixes bug #100469. 2008-04-21 Michael Natterer <mitch@gimp.org> Move the shadow tiles from the image to the drawable. Fixes bug #100469. * app/core/Makefile.am * app/core/gimpdrawable-shadow.[ch]: new files implementing the shadow tiles. * app/core/gimpimage.[ch]: remove the shadow tile manager from the GimpImage struct. Remove gimp_image_get_shadow_tiles() and _free_shadow_tiles(). * app/core/gimpdrawable.[ch]: add the shadow tile manager here. Remove get_shadow_tiles() and merge_shadow(). Free the shadow tiles in finalize and when the drawable gets removed from the image. * app/core/gimpdrawable-brightness-contrast.c * app/core/gimpdrawable-color-balance.c * app/core/gimpdrawable-colorize.c * app/core/gimpdrawable-curves.c * app/core/gimpdrawable-desaturate.c * app/core/gimpdrawable-equalize.c * app/core/gimpdrawable-hue-saturation.c * app/core/gimpdrawable-invert.c * app/core/gimpdrawable-levels.c * app/core/gimpdrawable-operation.c * app/core/gimpdrawable-posterize.c * app/core/gimpdrawable-threshold.c * app/core/gimpimagemap.c: changed accordingly. Free the shadow tiles after using them. * app/plug-in/gimpplugin-cleanup.[ch]: add gimp_plug_in_cleanup_add_shadow() and _remove_shadow() which keep track of whether shadow tiles were created on behalf of a plug-in procedure. (gimp_plug_in_cleanup): free shadow tiles which were created but not destroyed by a plug-in procedure. * app/plug-in/gimpplugin-message.c (plug_in_handle_tile_request): call gimp_plug_in_cleanup_add_shadow() whenever a plug-in requests shadow tiles. * tools/pdbgen/pdb/drawable.pdb: use the new drawable shadow API. Add new procedure gimp-drawable-free-shadow. Call gimp_plug_in_cleaup_remove_shadow() when it gets called. * tools/pdbgen/pdb/image.pdb: deprecate gimp-image-free-shadow. Calling it has no effect any longer. * app/pdb/drawable-cmds.c * app/pdb/image-cmds.c * app/pdb/internal-procs.c * libgimp/gimpimage_pdb.[ch] * libgimp/gimpdrawable_pdb.[ch]: regenerated. svn path=/trunk/; revision=25510
2008-04-22 01:20:51 +08:00
static void
gimp_drawable_removed (GimpItem *item)
{
GimpDrawable *drawable = GIMP_DRAWABLE (item);
gimp_drawable_free_shadow_buffer (drawable);
Move the shadow tiles from the image to the drawable. Fixes bug #100469. 2008-04-21 Michael Natterer <mitch@gimp.org> Move the shadow tiles from the image to the drawable. Fixes bug #100469. * app/core/Makefile.am * app/core/gimpdrawable-shadow.[ch]: new files implementing the shadow tiles. * app/core/gimpimage.[ch]: remove the shadow tile manager from the GimpImage struct. Remove gimp_image_get_shadow_tiles() and _free_shadow_tiles(). * app/core/gimpdrawable.[ch]: add the shadow tile manager here. Remove get_shadow_tiles() and merge_shadow(). Free the shadow tiles in finalize and when the drawable gets removed from the image. * app/core/gimpdrawable-brightness-contrast.c * app/core/gimpdrawable-color-balance.c * app/core/gimpdrawable-colorize.c * app/core/gimpdrawable-curves.c * app/core/gimpdrawable-desaturate.c * app/core/gimpdrawable-equalize.c * app/core/gimpdrawable-hue-saturation.c * app/core/gimpdrawable-invert.c * app/core/gimpdrawable-levels.c * app/core/gimpdrawable-operation.c * app/core/gimpdrawable-posterize.c * app/core/gimpdrawable-threshold.c * app/core/gimpimagemap.c: changed accordingly. Free the shadow tiles after using them. * app/plug-in/gimpplugin-cleanup.[ch]: add gimp_plug_in_cleanup_add_shadow() and _remove_shadow() which keep track of whether shadow tiles were created on behalf of a plug-in procedure. (gimp_plug_in_cleanup): free shadow tiles which were created but not destroyed by a plug-in procedure. * app/plug-in/gimpplugin-message.c (plug_in_handle_tile_request): call gimp_plug_in_cleanup_add_shadow() whenever a plug-in requests shadow tiles. * tools/pdbgen/pdb/drawable.pdb: use the new drawable shadow API. Add new procedure gimp-drawable-free-shadow. Call gimp_plug_in_cleaup_remove_shadow() when it gets called. * tools/pdbgen/pdb/image.pdb: deprecate gimp-image-free-shadow. Calling it has no effect any longer. * app/pdb/drawable-cmds.c * app/pdb/image-cmds.c * app/pdb/internal-procs.c * libgimp/gimpimage_pdb.[ch] * libgimp/gimpdrawable_pdb.[ch]: regenerated. svn path=/trunk/; revision=25510
2008-04-22 01:20:51 +08:00
if (GIMP_ITEM_CLASS (parent_class)->removed)
GIMP_ITEM_CLASS (parent_class)->removed (item);
}
static void
gimp_drawable_visibility_changed (GimpItem *item)
{
GimpDrawable *drawable = GIMP_DRAWABLE (item);
GeglNode *node;
/* don't use gimp_filter_get_node() because that would create
* the node.
*/
node = gimp_filter_peek_node (GIMP_FILTER (item));
if (node)
{
GeglNode *input = gegl_node_get_input_proxy (node, "input");
GeglNode *output = gegl_node_get_output_proxy (node, "output");
if (gimp_item_get_visible (item))
{
gegl_node_connect_to (input, "output",
drawable->private->mode_node, "input");
gegl_node_connect_to (drawable->private->mode_node, "output",
output, "input");
}
else
{
gegl_node_disconnect (drawable->private->mode_node, "input");
gegl_node_connect_to (input, "output",
output, "input");
}
/* FIXME: chain up again when above floating sel special case is gone */
return;
}
GIMP_ITEM_CLASS (parent_class)->visibility_changed (item);
}
static GimpItem *
gimp_drawable_duplicate (GimpItem *item,
GType new_type)
made gimp->global_buffer a GimpBuffer, not TileManager. 2001-12-13 Michael Natterer <mitch@gimp.org> * app/core/gimp.[ch]: made gimp->global_buffer a GimpBuffer, not TileManager. * app/core/gimpbuffer.[ch]: added a "gboolean copy_pixels" to gimp_buffer_new(). * app/core/gimpimage-new.c * app/core/gimpedit.[ch] * app/core/gimpimage-qmask.c * app/widgets/gimpbufferpreview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c: chaned accordingly, don't include "base/tile-manager.h". * app/core/gimpdrawable.[ch]: added gimp_drawable_copy(). * app/core/gimpchannel.[ch] * app/core/gimplayer.[ch] * app/core/gimplayermask.[ch]: use it in gimp_[channel|layer|layer_mask]_copy(), added "GType new_type" as paramater to all of them. * app/core/gimpimage-duplicate.c * app/gui/channels-commands.c * app/gui/edit-commands.c * app/gui/layers-commands.c * app/widgets/gimpchannellistview.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c: regenerated. * app/core/gimplayer.[ch]: removed the "layer_type" parameter from gimp_layer_new_from_tiles() because it always needed to be equal to gimp_image_base_type_with_alpha() of the passed image. * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-mask.c: cahanged accordingly. * app/core/gimpimage.[ch]: added some new GIMP_IMAGE_TYPE_FOO() marcos to get rid of magic values like "pixels = 3" all over the place. * app/core/gimplayer.[ch]: added gimp_layer_new_from_drawable() which creates a layer from an other image's drawable. * app/core/gimpimage-convert.[ch]: made the RGB and GRAY converters public to use them above, use the new GIMP_IMAGE_TYPE() macros. * app/display/gimpdisplayshell-dnd.c * app/gui/toolbox.c: removed tile manager stuff and use the new functions. * app/widgets/gimpdrawablelistview.[ch]: added a "convert_drawable_func" which is used to handle drops from other images. * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch]: implemented DND of layers between images using gimp_layer_new_from_drawable(). * app/gui/dialogs-constructors.c: changed accordingly.
2001-12-13 07:48:18 +08:00
{
GimpItem *new_item;
made gimp->global_buffer a GimpBuffer, not TileManager. 2001-12-13 Michael Natterer <mitch@gimp.org> * app/core/gimp.[ch]: made gimp->global_buffer a GimpBuffer, not TileManager. * app/core/gimpbuffer.[ch]: added a "gboolean copy_pixels" to gimp_buffer_new(). * app/core/gimpimage-new.c * app/core/gimpedit.[ch] * app/core/gimpimage-qmask.c * app/widgets/gimpbufferpreview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c: chaned accordingly, don't include "base/tile-manager.h". * app/core/gimpdrawable.[ch]: added gimp_drawable_copy(). * app/core/gimpchannel.[ch] * app/core/gimplayer.[ch] * app/core/gimplayermask.[ch]: use it in gimp_[channel|layer|layer_mask]_copy(), added "GType new_type" as paramater to all of them. * app/core/gimpimage-duplicate.c * app/gui/channels-commands.c * app/gui/edit-commands.c * app/gui/layers-commands.c * app/widgets/gimpchannellistview.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c: regenerated. * app/core/gimplayer.[ch]: removed the "layer_type" parameter from gimp_layer_new_from_tiles() because it always needed to be equal to gimp_image_base_type_with_alpha() of the passed image. * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-mask.c: cahanged accordingly. * app/core/gimpimage.[ch]: added some new GIMP_IMAGE_TYPE_FOO() marcos to get rid of magic values like "pixels = 3" all over the place. * app/core/gimplayer.[ch]: added gimp_layer_new_from_drawable() which creates a layer from an other image's drawable. * app/core/gimpimage-convert.[ch]: made the RGB and GRAY converters public to use them above, use the new GIMP_IMAGE_TYPE() macros. * app/display/gimpdisplayshell-dnd.c * app/gui/toolbox.c: removed tile manager stuff and use the new functions. * app/widgets/gimpdrawablelistview.[ch]: added a "convert_drawable_func" which is used to handle drops from other images. * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch]: implemented DND of layers between images using gimp_layer_new_from_drawable(). * app/gui/dialogs-constructors.c: changed accordingly.
2001-12-13 07:48:18 +08:00
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_DRAWABLE (new_item))
{
GimpDrawable *drawable = GIMP_DRAWABLE (item);
GimpDrawable *new_drawable = GIMP_DRAWABLE (new_item);
if (new_drawable->private->buffer)
g_object_unref (new_drawable->private->buffer);
new_drawable->private->buffer =
gegl_buffer_dup (gimp_drawable_get_buffer (drawable));
}
made gimp->global_buffer a GimpBuffer, not TileManager. 2001-12-13 Michael Natterer <mitch@gimp.org> * app/core/gimp.[ch]: made gimp->global_buffer a GimpBuffer, not TileManager. * app/core/gimpbuffer.[ch]: added a "gboolean copy_pixels" to gimp_buffer_new(). * app/core/gimpimage-new.c * app/core/gimpedit.[ch] * app/core/gimpimage-qmask.c * app/widgets/gimpbufferpreview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c: chaned accordingly, don't include "base/tile-manager.h". * app/core/gimpdrawable.[ch]: added gimp_drawable_copy(). * app/core/gimpchannel.[ch] * app/core/gimplayer.[ch] * app/core/gimplayermask.[ch]: use it in gimp_[channel|layer|layer_mask]_copy(), added "GType new_type" as paramater to all of them. * app/core/gimpimage-duplicate.c * app/gui/channels-commands.c * app/gui/edit-commands.c * app/gui/layers-commands.c * app/widgets/gimpchannellistview.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c: regenerated. * app/core/gimplayer.[ch]: removed the "layer_type" parameter from gimp_layer_new_from_tiles() because it always needed to be equal to gimp_image_base_type_with_alpha() of the passed image. * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-mask.c: cahanged accordingly. * app/core/gimpimage.[ch]: added some new GIMP_IMAGE_TYPE_FOO() marcos to get rid of magic values like "pixels = 3" all over the place. * app/core/gimplayer.[ch]: added gimp_layer_new_from_drawable() which creates a layer from an other image's drawable. * app/core/gimpimage-convert.[ch]: made the RGB and GRAY converters public to use them above, use the new GIMP_IMAGE_TYPE() macros. * app/display/gimpdisplayshell-dnd.c * app/gui/toolbox.c: removed tile manager stuff and use the new functions. * app/widgets/gimpdrawablelistview.[ch]: added a "convert_drawable_func" which is used to handle drops from other images. * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch]: implemented DND of layers between images using gimp_layer_new_from_drawable(). * app/gui/dialogs-constructors.c: changed accordingly.
2001-12-13 07:48:18 +08:00
return new_item;
}
static void
gimp_drawable_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)
{
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_gegl_apply_scale (gimp_drawable_get_buffer (drawable),
progress, C_("undo-type", "Scale"),
new_buffer,
interpolation_type,
((gdouble) new_width /
gimp_item_get_width (item)),
((gdouble) new_height /
gimp_item_get_height (item)));
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);
}
static void
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_drawable_resize (GimpItem *item,
GimpContext *context,
gint new_width,
gint new_height,
gint offset_x,
gint offset_y)
{
GimpDrawable *drawable = GIMP_DRAWABLE (item);
GeglBuffer *new_buffer;
gint new_offset_x;
gint new_offset_y;
gint copy_x, copy_y;
gint copy_width, copy_height;
gboolean intersect;
/* if the size doesn't change, this is a nop */
if (new_width == gimp_item_get_width (item) &&
new_height == gimp_item_get_height (item) &&
offset_x == 0 &&
offset_y == 0)
return;
new_offset_x = gimp_item_get_offset_x (item) - offset_x;
new_offset_y = gimp_item_get_offset_y (item) - offset_y;
intersect = gimp_rectangle_intersect (gimp_item_get_offset_x (item),
gimp_item_get_offset_y (item),
gimp_item_get_width (item),
gimp_item_get_height (item),
new_offset_x,
new_offset_y,
new_width,
new_height,
&copy_x,
&copy_y,
&copy_width,
&copy_height);
new_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
new_width, new_height),
gimp_drawable_get_format (drawable));
if (! intersect ||
copy_width != new_width ||
copy_height != new_height)
{
/* Clear the new tiles if needed */
GimpRGB bg;
GeglColor *col;
if (! gimp_drawable_has_alpha (drawable) && ! GIMP_IS_CHANNEL (drawable))
gimp_context_get_background (context, &bg);
else
gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
col = gimp_gegl_color_new (&bg);
gegl_buffer_set_color (new_buffer, NULL, col);
g_object_unref (col);
}
if (intersect && copy_width && copy_height)
{
/* Copy the pixels in the intersection */
gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
GEGL_RECTANGLE (copy_x - gimp_item_get_offset_x (item),
copy_y - gimp_item_get_offset_y (item),
copy_width,
copy_height),
new_buffer,
GEGL_RECTANGLE (copy_x - new_offset_x,
copy_y - new_offset_y, 0, 0));
}
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);
}
static void
gimp_drawable_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)
{
GimpDrawable *drawable = GIMP_DRAWABLE (item);
GeglBuffer *buffer;
gint off_x, off_y;
gint new_off_x, new_off_y;
gimp_item_get_offset (item, &off_x, &off_y);
buffer = gimp_drawable_transform_buffer_flip (drawable, context,
gimp_drawable_get_buffer (drawable),
off_x, off_y,
flip_type, axis,
clip_result,
&new_off_x, &new_off_y);
if (buffer)
2003-05-27 01:02:06 +08:00
{
gimp_drawable_transform_paste (drawable, buffer,
new_off_x, new_off_y, FALSE);
g_object_unref (buffer);
2003-05-27 01:02:06 +08:00
}
}
static void
gimp_drawable_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)
{
GimpDrawable *drawable = GIMP_DRAWABLE (item);
GeglBuffer *buffer;
gint off_x, off_y;
gint new_off_x, new_off_y;
gimp_item_get_offset (item, &off_x, &off_y);
buffer = gimp_drawable_transform_buffer_rotate (drawable, context,
gimp_drawable_get_buffer (drawable),
off_x, off_y,
rotate_type, center_x, center_y,
clip_result,
&new_off_x, &new_off_y);
if (buffer)
2003-05-27 01:02:06 +08:00
{
gimp_drawable_transform_paste (drawable, buffer,
new_off_x, new_off_y, FALSE);
g_object_unref (buffer);
2003-05-27 01:02:06 +08:00
}
}
static void
gimp_drawable_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)
{
GimpDrawable *drawable = GIMP_DRAWABLE (item);
GeglBuffer *buffer;
gint off_x, off_y;
gint new_off_x, new_off_y;
gimp_item_get_offset (item, &off_x, &off_y);
buffer = gimp_drawable_transform_buffer_affine (drawable, context,
gimp_drawable_get_buffer (drawable),
off_x, off_y,
matrix, direction,
interpolation_type,
clip_result,
&new_off_x, &new_off_y,
progress);
if (buffer)
2003-05-27 01:02:06 +08:00
{
gimp_drawable_transform_paste (drawable, buffer,
new_off_x, new_off_y, FALSE);
g_object_unref (buffer);
2003-05-27 01:02:06 +08:00
}
}
static gboolean
gimp_drawable_get_pixel_at (GimpPickable *pickable,
gint x,
gint y,
const Babl *format,
gpointer pixel)
{
GimpDrawable *drawable = GIMP_DRAWABLE (pickable);
/* do not make this a g_return_if_fail() */
if (x < 0 || x >= gimp_item_get_width (GIMP_ITEM (drawable)) ||
y < 0 || y >= gimp_item_get_height (GIMP_ITEM (drawable)))
return FALSE;
gegl_buffer_sample (gimp_drawable_get_buffer (drawable),
x, y, NULL, pixel, format,
2012-03-26 08:17:24 +08:00
GEGL_SAMPLER_NEAREST, GEGL_ABYSS_NONE);
return TRUE;
}
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
static void
gimp_drawable_real_update (GimpDrawable *drawable,
gint x,
gint y,
gint width,
gint height)
{
if (drawable->private->buffer_source_node)
{
GObject *operation = NULL;
g_object_get (drawable->private->buffer_source_node,
"gegl-operation", &operation,
NULL);
if (operation)
{
gegl_operation_invalidate (GEGL_OPERATION (operation),
GEGL_RECTANGLE (x,y,width,height), FALSE);
g_object_unref (operation);
}
}
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
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (drawable));
}
static gint64
gimp_drawable_real_estimate_memsize (const GimpDrawable *drawable,
gint width,
gint height)
{
const Babl *format = gimp_drawable_get_format (drawable);
return (gint64) babl_format_get_bytes_per_pixel (format) * width * height;
}
/* FIXME: this default impl is currently unused because no subclass
* chins up. the goal is to handle the almost identical subclass code
* here again.
*/
static void
gimp_drawable_real_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
gint layer_dither_type,
gint mask_dither_type,
gboolean push_undo)
{
GeglBuffer *dest_buffer;
const Babl *format;
format = gimp_image_get_format (dest_image,
new_base_type,
new_precision,
gimp_drawable_has_alpha (drawable));
dest_buffer =
gegl_buffer_new (GEGL_RECTANGLE (0, 0,
gimp_item_get_width (GIMP_ITEM (drawable)),
gimp_item_get_height (GIMP_ITEM (drawable))),
format);
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
dest_buffer, NULL);
gimp_drawable_set_buffer (drawable, push_undo, NULL, dest_buffer);
g_object_unref (dest_buffer);
}
static GeglBuffer *
gimp_drawable_real_get_buffer (GimpDrawable *drawable)
{
return drawable->private->buffer;
}
static void
gimp_drawable_real_set_buffer (GimpDrawable *drawable,
gboolean push_undo,
const gchar *undo_desc,
GeglBuffer *buffer,
gint offset_x,
gint offset_y)
{
GimpItem *item = GIMP_ITEM (drawable);
gboolean old_has_alpha;
old_has_alpha = gimp_drawable_has_alpha (drawable);
gimp_drawable_invalidate_boundary (drawable);
if (push_undo)
gimp_image_undo_push_drawable_mod (gimp_item_get_image (item), undo_desc,
drawable, FALSE);
/* ref new before unrefing old, they might be the same */
g_object_ref (buffer);
if (drawable->private->buffer)
g_object_unref (drawable->private->buffer);
drawable->private->buffer = buffer;
gimp_item_set_offset (item, offset_x, offset_y);
gimp_item_set_size (item,
gegl_buffer_get_width (buffer),
gegl_buffer_get_height (buffer));
if (old_has_alpha != gimp_drawable_has_alpha (drawable))
gimp_drawable_alpha_changed (drawable);
if (drawable->private->buffer_source_node)
gegl_node_set (drawable->private->buffer_source_node,
"buffer", gimp_drawable_get_buffer (drawable),
NULL);
g_object_notify (G_OBJECT (drawable), "buffer");
}
added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types 2004-04-01 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch] (enum GimpUndoType): added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types GIMP_UNDO_GROUP_DRAWABLE and GIMP_UNDO_GROUP_DRAWABLE_MOD. * app/core/gimpimage-undo-push.[ch]: added new new function gimp_image_undo_push_text_layer_modified() which makes modifications of the text_layer's "modified" boolean undoable. * app/core/gimpdrawable.[ch]: added new virtual function GimpDrawable::push_undo() and moved the actual undo pushing into the default implementation gimp_drawable_real_push_undo(). * app/text/gimptextlayer.c (gimp_text_layer_push_undo): new function. Pushes the text_layer's modified state to the undo stack after upchaining and sets modified to TRUE. (gimp_text_layer_set_tiles): ditto. (gimp_lext_layer_apply_region) (gimp_text_layer_replace_region): removed because their default implementations already call gimp_drawable_push_undo(). (gimp_text_layer_swap_pixels): removed because swap_pixels() is used by undo only and doesn't need to care about the text_layer's modified state. (gimp_text_layer_render): don't set modified to FALSE here because we can't push an undo step here. (gimp_text_layer_set): push the modified state to the undo stack and set it to FALSE here. Also push the layer's tiles if the layer was modified. * app/tools/gimptexttool.c (gimp_text_tool_apply): push "modified" to the undo stack and set it to FALSE here, too. Fixes bug #137767.
2004-04-01 22:51:58 +08:00
static void
gimp_drawable_real_push_undo (GimpDrawable *drawable,
const gchar *undo_desc,
GeglBuffer *buffer,
added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types 2004-04-01 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch] (enum GimpUndoType): added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types GIMP_UNDO_GROUP_DRAWABLE and GIMP_UNDO_GROUP_DRAWABLE_MOD. * app/core/gimpimage-undo-push.[ch]: added new new function gimp_image_undo_push_text_layer_modified() which makes modifications of the text_layer's "modified" boolean undoable. * app/core/gimpdrawable.[ch]: added new virtual function GimpDrawable::push_undo() and moved the actual undo pushing into the default implementation gimp_drawable_real_push_undo(). * app/text/gimptextlayer.c (gimp_text_layer_push_undo): new function. Pushes the text_layer's modified state to the undo stack after upchaining and sets modified to TRUE. (gimp_text_layer_set_tiles): ditto. (gimp_lext_layer_apply_region) (gimp_text_layer_replace_region): removed because their default implementations already call gimp_drawable_push_undo(). (gimp_text_layer_swap_pixels): removed because swap_pixels() is used by undo only and doesn't need to care about the text_layer's modified state. (gimp_text_layer_render): don't set modified to FALSE here because we can't push an undo step here. (gimp_text_layer_set): push the modified state to the undo stack and set it to FALSE here. Also push the layer's tiles if the layer was modified. * app/tools/gimptexttool.c (gimp_text_tool_apply): push "modified" to the undo stack and set it to FALSE here, too. Fixes bug #137767.
2004-04-01 22:51:58 +08:00
gint x,
gint y,
gint width,
gint height)
{
if (! buffer)
added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types 2004-04-01 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch] (enum GimpUndoType): added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types GIMP_UNDO_GROUP_DRAWABLE and GIMP_UNDO_GROUP_DRAWABLE_MOD. * app/core/gimpimage-undo-push.[ch]: added new new function gimp_image_undo_push_text_layer_modified() which makes modifications of the text_layer's "modified" boolean undoable. * app/core/gimpdrawable.[ch]: added new virtual function GimpDrawable::push_undo() and moved the actual undo pushing into the default implementation gimp_drawable_real_push_undo(). * app/text/gimptextlayer.c (gimp_text_layer_push_undo): new function. Pushes the text_layer's modified state to the undo stack after upchaining and sets modified to TRUE. (gimp_text_layer_set_tiles): ditto. (gimp_lext_layer_apply_region) (gimp_text_layer_replace_region): removed because their default implementations already call gimp_drawable_push_undo(). (gimp_text_layer_swap_pixels): removed because swap_pixels() is used by undo only and doesn't need to care about the text_layer's modified state. (gimp_text_layer_render): don't set modified to FALSE here because we can't push an undo step here. (gimp_text_layer_set): push the modified state to the undo stack and set it to FALSE here. Also push the layer's tiles if the layer was modified. * app/tools/gimptexttool.c (gimp_text_tool_apply): push "modified" to the undo stack and set it to FALSE here, too. Fixes bug #137767.
2004-04-01 22:51:58 +08:00
{
buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, width, height),
gimp_drawable_get_format (drawable));
gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
GEGL_RECTANGLE (x, y, width, height),
buffer,
GEGL_RECTANGLE (0, 0, 0, 0));
}
else
{
g_object_ref (buffer);
added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types 2004-04-01 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch] (enum GimpUndoType): added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types GIMP_UNDO_GROUP_DRAWABLE and GIMP_UNDO_GROUP_DRAWABLE_MOD. * app/core/gimpimage-undo-push.[ch]: added new new function gimp_image_undo_push_text_layer_modified() which makes modifications of the text_layer's "modified" boolean undoable. * app/core/gimpdrawable.[ch]: added new virtual function GimpDrawable::push_undo() and moved the actual undo pushing into the default implementation gimp_drawable_real_push_undo(). * app/text/gimptextlayer.c (gimp_text_layer_push_undo): new function. Pushes the text_layer's modified state to the undo stack after upchaining and sets modified to TRUE. (gimp_text_layer_set_tiles): ditto. (gimp_lext_layer_apply_region) (gimp_text_layer_replace_region): removed because their default implementations already call gimp_drawable_push_undo(). (gimp_text_layer_swap_pixels): removed because swap_pixels() is used by undo only and doesn't need to care about the text_layer's modified state. (gimp_text_layer_render): don't set modified to FALSE here because we can't push an undo step here. (gimp_text_layer_set): push the modified state to the undo stack and set it to FALSE here. Also push the layer's tiles if the layer was modified. * app/tools/gimptexttool.c (gimp_text_tool_apply): push "modified" to the undo stack and set it to FALSE here, too. Fixes bug #137767.
2004-04-01 22:51:58 +08:00
}
gimp_image_undo_push_drawable (gimp_item_get_image (GIMP_ITEM (drawable)),
undo_desc, drawable,
buffer, x, y);
added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types 2004-04-01 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch] (enum GimpUndoType): added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types GIMP_UNDO_GROUP_DRAWABLE and GIMP_UNDO_GROUP_DRAWABLE_MOD. * app/core/gimpimage-undo-push.[ch]: added new new function gimp_image_undo_push_text_layer_modified() which makes modifications of the text_layer's "modified" boolean undoable. * app/core/gimpdrawable.[ch]: added new virtual function GimpDrawable::push_undo() and moved the actual undo pushing into the default implementation gimp_drawable_real_push_undo(). * app/text/gimptextlayer.c (gimp_text_layer_push_undo): new function. Pushes the text_layer's modified state to the undo stack after upchaining and sets modified to TRUE. (gimp_text_layer_set_tiles): ditto. (gimp_lext_layer_apply_region) (gimp_text_layer_replace_region): removed because their default implementations already call gimp_drawable_push_undo(). (gimp_text_layer_swap_pixels): removed because swap_pixels() is used by undo only and doesn't need to care about the text_layer's modified state. (gimp_text_layer_render): don't set modified to FALSE here because we can't push an undo step here. (gimp_text_layer_set): push the modified state to the undo stack and set it to FALSE here. Also push the layer's tiles if the layer was modified. * app/tools/gimptexttool.c (gimp_text_tool_apply): push "modified" to the undo stack and set it to FALSE here, too. Fixes bug #137767.
2004-04-01 22:51:58 +08:00
g_object_unref (buffer);
added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types 2004-04-01 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch] (enum GimpUndoType): added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types GIMP_UNDO_GROUP_DRAWABLE and GIMP_UNDO_GROUP_DRAWABLE_MOD. * app/core/gimpimage-undo-push.[ch]: added new new function gimp_image_undo_push_text_layer_modified() which makes modifications of the text_layer's "modified" boolean undoable. * app/core/gimpdrawable.[ch]: added new virtual function GimpDrawable::push_undo() and moved the actual undo pushing into the default implementation gimp_drawable_real_push_undo(). * app/text/gimptextlayer.c (gimp_text_layer_push_undo): new function. Pushes the text_layer's modified state to the undo stack after upchaining and sets modified to TRUE. (gimp_text_layer_set_tiles): ditto. (gimp_lext_layer_apply_region) (gimp_text_layer_replace_region): removed because their default implementations already call gimp_drawable_push_undo(). (gimp_text_layer_swap_pixels): removed because swap_pixels() is used by undo only and doesn't need to care about the text_layer's modified state. (gimp_text_layer_render): don't set modified to FALSE here because we can't push an undo step here. (gimp_text_layer_set): push the modified state to the undo stack and set it to FALSE here. Also push the layer's tiles if the layer was modified. * app/tools/gimptexttool.c (gimp_text_tool_apply): push "modified" to the undo stack and set it to FALSE here, too. Fixes bug #137767.
2004-04-01 22:51:58 +08:00
}
static void
gimp_drawable_real_swap_pixels (GimpDrawable *drawable,
GeglBuffer *buffer,
gint x,
gint y)
{
GeglBuffer *tmp;
gint width = gegl_buffer_get_width (buffer);
gint height = gegl_buffer_get_height (buffer);
tmp = gegl_buffer_dup (buffer);
gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
GEGL_RECTANGLE (x, y, width, height),
buffer,
GEGL_RECTANGLE (0, 0, 0, 0));
gegl_buffer_copy (tmp,
GEGL_RECTANGLE (0, 0, width, height),
gimp_drawable_get_buffer (drawable),
GEGL_RECTANGLE (x, y, 0, 0));
g_object_unref (tmp);
gimp_drawable_update (drawable, x, y, width, height);
}
static void
gimp_drawable_sync_fs_filter (GimpDrawable *drawable,
gboolean detach_fs)
{
GimpDrawablePrivate *private = drawable->private;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpLayer *fs = gimp_drawable_get_floating_sel (drawable);
if (! private->source_node)
return;
if (fs && ! detach_fs)
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
gint off_x, off_y;
gint fs_off_x, fs_off_y;
if (! private->fs_filter)
{
GeglNode *node;
GeglNode *fs_source;
gboolean linear;
private->fs_filter = gimp_filter_new ("Floating Selection");
gimp_viewable_set_icon_name (GIMP_VIEWABLE (private->fs_filter),
"gimp-floating-selection");
node = gimp_filter_get_node (private->fs_filter);
fs_source = gimp_drawable_get_source_node (GIMP_DRAWABLE (fs));
linear = gimp_drawable_get_linear (GIMP_DRAWABLE (fs));
/* rip the fs' source node out of its graph */
if (fs->layer_offset_node)
{
gegl_node_disconnect (fs->layer_offset_node, "input");
gegl_node_remove_child (gimp_filter_get_node (GIMP_FILTER (fs)),
fs_source);
}
gegl_node_add_child (node, fs_source);
private->fs_applicator = gimp_applicator_new (node, linear);
private->fs_crop_node =
gegl_node_new_child (node,
"operation", "gegl:crop",
NULL);
gegl_node_connect_to (fs_source, "output",
private->fs_crop_node, "input");
gegl_node_connect_to (private->fs_crop_node, "output",
node, "aux");
gimp_drawable_add_filter (drawable, private->fs_filter);
g_signal_connect (fs, "notify",
G_CALLBACK (gimp_drawable_fs_notify),
drawable);
g_signal_connect (image, "component-active-changed",
G_CALLBACK (gimp_drawable_fs_affect_changed),
drawable);
g_signal_connect (image, "mask-changed",
G_CALLBACK (gimp_drawable_fs_mask_changed),
drawable);
}
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
gimp_item_get_offset (GIMP_ITEM (fs), &fs_off_x, &fs_off_y);
gegl_node_set (private->fs_crop_node,
"x", (gdouble) (off_x - fs_off_x),
"y", (gdouble) (off_y - fs_off_y),
"width", (gdouble) gimp_item_get_width (GIMP_ITEM (drawable)),
"height", (gdouble) gimp_item_get_height (GIMP_ITEM (drawable)),
NULL);
gimp_applicator_set_apply_offset (private->fs_applicator,
fs_off_x - off_x,
fs_off_y - off_y);
if (gimp_channel_is_empty (mask))
{
gimp_applicator_set_mask_buffer (private->fs_applicator, NULL);
}
else
{
GeglBuffer *buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
gimp_applicator_set_mask_buffer (private->fs_applicator, buffer);
gimp_applicator_set_mask_offset (private->fs_applicator,
-off_x, -off_y);
}
gimp_applicator_set_mode (private->fs_applicator,
gimp_layer_get_opacity (fs),
gimp_layer_get_mode (fs));
gimp_applicator_set_affect (private->fs_applicator,
gimp_drawable_get_active_mask (drawable));
}
else
{
if (private->fs_filter)
{
GeglNode *node;
GeglNode *fs_source;
g_signal_handlers_disconnect_by_func (fs,
gimp_drawable_fs_notify,
drawable);
g_signal_handlers_disconnect_by_func (image,
gimp_drawable_fs_affect_changed,
drawable);
g_signal_handlers_disconnect_by_func (image,
gimp_drawable_fs_mask_changed,
drawable);
gimp_drawable_remove_filter (drawable, private->fs_filter);
node = gimp_filter_get_node (private->fs_filter);
fs_source = gimp_drawable_get_source_node (GIMP_DRAWABLE (fs));
gegl_node_remove_child (node, fs_source);
/* plug the fs' source node back into its graph */
if (fs->layer_offset_node)
{
gegl_node_add_child (gimp_filter_get_node (GIMP_FILTER (fs)),
fs_source);
gegl_node_connect_to (fs_source, "output",
fs->layer_offset_node, "input");
}
g_object_unref (private->fs_filter);
private->fs_filter = NULL;
g_object_unref (private->fs_applicator);
private->fs_applicator = NULL;
private->fs_crop_node = NULL;
}
}
}
static void
gimp_drawable_fs_notify (GimpLayer *fs,
const GParamSpec *pspec,
GimpDrawable *drawable)
{
if (! strcmp (pspec->name, "offset-x") ||
! strcmp (pspec->name, "offset-y") ||
! strcmp (pspec->name, "visible") ||
! strcmp (pspec->name, "mode") ||
! strcmp (pspec->name, "opacity"))
{
gimp_drawable_sync_fs_filter (drawable, FALSE);
}
}
static void
gimp_drawable_fs_affect_changed (GimpImage *image,
GimpChannelType channel,
GimpDrawable *drawable)
{
GimpLayer *fs = gimp_drawable_get_floating_sel (drawable);
gimp_drawable_sync_fs_filter (drawable, FALSE);
gimp_drawable_update (GIMP_DRAWABLE (fs),
0, 0,
gimp_item_get_width (GIMP_ITEM (fs)),
gimp_item_get_height (GIMP_ITEM (fs)));
}
static void
gimp_drawable_fs_mask_changed (GimpImage *image,
GimpDrawable *drawable)
{
GimpLayer *fs = gimp_drawable_get_floating_sel (drawable);
gimp_drawable_sync_fs_filter (drawable, FALSE);
gimp_drawable_update (GIMP_DRAWABLE (fs),
0, 0,
gimp_item_get_width (GIMP_ITEM (fs)),
gimp_item_get_height (GIMP_ITEM (fs)));
}
static void
gimp_drawable_fs_update (GimpLayer *fs,
gint x,
gint y,
gint width,
gint height,
GimpDrawable *drawable)
{
gint fs_off_x, fs_off_y;
gint off_x, off_y;
gint dr_x, dr_y, dr_width, dr_height;
gimp_item_get_offset (GIMP_ITEM (fs), &fs_off_x, &fs_off_y);
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
if (gimp_rectangle_intersect (x + fs_off_x,
y + fs_off_y,
width,
height,
off_x,
off_y,
gimp_item_get_width (GIMP_ITEM (drawable)),
gimp_item_get_height (GIMP_ITEM (drawable)),
&dr_x,
&dr_y,
&dr_width,
&dr_height))
{
gimp_drawable_update (drawable,
dr_x - off_x, dr_y - off_y,
dr_width, dr_height);
}
}
/* public functions */
GimpDrawable *
gimp_drawable_new (GType type,
GimpImage *image,
const gchar *name,
gint offset_x,
gint offset_y,
gint width,
gint height,
const Babl *format)
{
GimpDrawable *drawable;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (g_type_is_a (type, GIMP_TYPE_DRAWABLE), NULL);
g_return_val_if_fail (width > 0 && height > 0, NULL);
g_return_val_if_fail (format != NULL, NULL);
drawable = GIMP_DRAWABLE (gimp_item_new (type,
image, name,
offset_x, offset_y,
width, height));
drawable->private->buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
width, height),
format);
return drawable;
}
gint64
gimp_drawable_estimate_memsize (const GimpDrawable *drawable,
gint width,
gint height)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), 0);
return GIMP_DRAWABLE_GET_CLASS (drawable)->estimate_memsize (drawable,
width, height);
}
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_drawable_update (GimpDrawable *drawable,
gint x,
gint y,
gint width,
gint height)
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
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_signal_emit (drawable, gimp_drawable_signals[UPDATE], 0,
x, y, width, height);
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_drawable_alpha_changed (GimpDrawable *drawable)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_signal_emit (drawable, gimp_drawable_signals[ALPHA_CHANGED], 0);
}
void
gimp_drawable_invalidate_boundary (GimpDrawable *drawable)
{
GimpDrawableClass *drawable_class;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
drawable_class = GIMP_DRAWABLE_GET_CLASS (drawable);
if (drawable_class->invalidate_boundary)
drawable_class->invalidate_boundary (drawable);
}
void
gimp_drawable_get_active_components (const GimpDrawable *drawable,
gboolean *active)
{
GimpDrawableClass *drawable_class;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (active != NULL);
drawable_class = GIMP_DRAWABLE_GET_CLASS (drawable);
if (drawable_class->get_active_components)
drawable_class->get_active_components (drawable, active);
}
GimpComponentMask
gimp_drawable_get_active_mask (const GimpDrawable *drawable)
{
GimpDrawableClass *drawable_class;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), 0);
drawable_class = GIMP_DRAWABLE_GET_CLASS (drawable);
if (drawable_class->get_active_mask)
return drawable_class->get_active_mask (drawable);
return 0;
}
void
gimp_drawable_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
gint layer_dither_type,
gint mask_dither_type,
gboolean push_undo)
{
const Babl *new_format;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (GIMP_IS_IMAGE (dest_image));
g_return_if_fail (new_base_type != gimp_drawable_get_base_type (drawable) ||
new_precision != gimp_drawable_get_precision (drawable));
if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
push_undo = FALSE;
new_format = gimp_image_get_format (dest_image,
new_base_type,
new_precision,
gimp_drawable_has_alpha (drawable));
GIMP_DRAWABLE_GET_CLASS (drawable)->convert_type (drawable, dest_image,
new_format,
new_base_type,
new_precision,
layer_dither_type,
mask_dither_type,
push_undo);
}
void
gimp_drawable_apply_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
GimpLayerModeEffects mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
g_return_if_fail (GEGL_IS_BUFFER (buffer));
g_return_if_fail (buffer_region != NULL);
g_return_if_fail (base_buffer == NULL || GEGL_IS_BUFFER (base_buffer));
GIMP_DRAWABLE_GET_CLASS (drawable)->apply_buffer (drawable, buffer,
buffer_region,
push_undo, undo_desc,
opacity, mode,
base_buffer,
base_x, base_y);
}
void
gimp_drawable_replace_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
GeglBuffer *mask,
const GeglRectangle *mask_region,
gint x,
gint y)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
g_return_if_fail (GEGL_IS_BUFFER (buffer));
g_return_if_fail (GEGL_IS_BUFFER (mask));
GIMP_DRAWABLE_GET_CLASS (drawable)->replace_buffer (drawable, buffer,
buffer_region,
push_undo, undo_desc,
opacity,
mask, mask_region,
x, y);
}
GeglBuffer *
gimp_drawable_get_buffer (GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
return GIMP_DRAWABLE_GET_CLASS (drawable)->get_buffer (drawable);
}
void
gimp_drawable_set_buffer (GimpDrawable *drawable,
gboolean push_undo,
const gchar *undo_desc,
GeglBuffer *buffer)
{
gint offset_x, offset_y;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (GEGL_IS_BUFFER (buffer));
if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
push_undo = FALSE;
gimp_item_get_offset (GIMP_ITEM (drawable), &offset_x, &offset_y);
gimp_drawable_set_buffer_full (drawable, push_undo, undo_desc, buffer,
offset_x, offset_y);
}
void
gimp_drawable_set_buffer_full (GimpDrawable *drawable,
gboolean push_undo,
const gchar *undo_desc,
GeglBuffer *buffer,
gint offset_x,
gint offset_y)
{
GimpItem *item;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (GEGL_IS_BUFFER (buffer));
item = GIMP_ITEM (drawable);
if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
push_undo = FALSE;
if (gimp_item_get_width (item) != gegl_buffer_get_width (buffer) ||
gimp_item_get_height (item) != gegl_buffer_get_height (buffer) ||
gimp_item_get_offset_x (item) != offset_x ||
gimp_item_get_offset_y (item) != offset_y)
{
gimp_drawable_update (drawable,
0, 0,
gimp_item_get_width (item),
gimp_item_get_height (item));
}
g_object_freeze_notify (G_OBJECT (drawable));
GIMP_DRAWABLE_GET_CLASS (drawable)->set_buffer (drawable,
push_undo, undo_desc,
buffer,
offset_x, offset_y);
g_object_thaw_notify (G_OBJECT (drawable));
gimp_drawable_update (drawable,
0, 0,
gimp_item_get_width (item),
gimp_item_get_height (item));
}
GeglNode *
gimp_drawable_get_source_node (GimpDrawable *drawable)
{
GeglNode *filter;
GeglNode *output;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
if (drawable->private->source_node)
return drawable->private->source_node;
drawable->private->source_node = gegl_node_new ();
drawable->private->buffer_source_node =
gegl_node_new_child (drawable->private->source_node,
"operation", "gegl:buffer-source",
"buffer", gimp_drawable_get_buffer (drawable),
NULL);
filter = gimp_filter_stack_get_graph (GIMP_FILTER_STACK (drawable->private->filter_stack));
gegl_node_add_child (drawable->private->source_node, filter);
gegl_node_connect_to (drawable->private->buffer_source_node, "output",
filter, "input");
output = gegl_node_get_output_proxy (drawable->private->source_node, "output");
gegl_node_connect_to (filter, "output",
output, "input");
gimp_drawable_sync_fs_filter (drawable, FALSE);
return drawable->private->source_node;
}
GeglNode *
gimp_drawable_get_mode_node (GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
if (! drawable->private->mode_node)
gimp_filter_get_node (GIMP_FILTER (drawable));
return drawable->private->mode_node;
}
void
gimp_drawable_swap_pixels (GimpDrawable *drawable,
GeglBuffer *buffer,
gint x,
gint y)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (GEGL_IS_BUFFER (buffer));
GIMP_DRAWABLE_GET_CLASS (drawable)->swap_pixels (drawable, buffer, x, y);
}
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
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
gimp_drawable_push_undo (GimpDrawable *drawable,
const gchar *undo_desc,
GeglBuffer *buffer,
gint x,
gint y,
gint width,
gint height)
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
{
GimpItem *item;
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
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (buffer == NULL || GEGL_IS_BUFFER (buffer));
item = GIMP_ITEM (drawable);
g_return_if_fail (gimp_item_is_attached (item));
if (! buffer &&
! gimp_rectangle_intersect (x, y,
width, height,
0, 0,
gimp_item_get_width (item),
gimp_item_get_height (item),
&x, &y, &width, &height))
{
g_warning ("%s: tried to push empty region", G_STRFUNC);
return;
}
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
added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types 2004-04-01 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch] (enum GimpUndoType): added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types GIMP_UNDO_GROUP_DRAWABLE and GIMP_UNDO_GROUP_DRAWABLE_MOD. * app/core/gimpimage-undo-push.[ch]: added new new function gimp_image_undo_push_text_layer_modified() which makes modifications of the text_layer's "modified" boolean undoable. * app/core/gimpdrawable.[ch]: added new virtual function GimpDrawable::push_undo() and moved the actual undo pushing into the default implementation gimp_drawable_real_push_undo(). * app/text/gimptextlayer.c (gimp_text_layer_push_undo): new function. Pushes the text_layer's modified state to the undo stack after upchaining and sets modified to TRUE. (gimp_text_layer_set_tiles): ditto. (gimp_lext_layer_apply_region) (gimp_text_layer_replace_region): removed because their default implementations already call gimp_drawable_push_undo(). (gimp_text_layer_swap_pixels): removed because swap_pixels() is used by undo only and doesn't need to care about the text_layer's modified state. (gimp_text_layer_render): don't set modified to FALSE here because we can't push an undo step here. (gimp_text_layer_set): push the modified state to the undo stack and set it to FALSE here. Also push the layer's tiles if the layer was modified. * app/tools/gimptexttool.c (gimp_text_tool_apply): push "modified" to the undo stack and set it to FALSE here, too. Fixes bug #137767.
2004-04-01 22:51:58 +08:00
GIMP_DRAWABLE_GET_CLASS (drawable)->push_undo (drawable, undo_desc,
buffer,
added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types 2004-04-01 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch] (enum GimpUndoType): added undo type GIMP_UNDO_TEXT_LAYER_MODIFIED and undo group types GIMP_UNDO_GROUP_DRAWABLE and GIMP_UNDO_GROUP_DRAWABLE_MOD. * app/core/gimpimage-undo-push.[ch]: added new new function gimp_image_undo_push_text_layer_modified() which makes modifications of the text_layer's "modified" boolean undoable. * app/core/gimpdrawable.[ch]: added new virtual function GimpDrawable::push_undo() and moved the actual undo pushing into the default implementation gimp_drawable_real_push_undo(). * app/text/gimptextlayer.c (gimp_text_layer_push_undo): new function. Pushes the text_layer's modified state to the undo stack after upchaining and sets modified to TRUE. (gimp_text_layer_set_tiles): ditto. (gimp_lext_layer_apply_region) (gimp_text_layer_replace_region): removed because their default implementations already call gimp_drawable_push_undo(). (gimp_text_layer_swap_pixels): removed because swap_pixels() is used by undo only and doesn't need to care about the text_layer's modified state. (gimp_text_layer_render): don't set modified to FALSE here because we can't push an undo step here. (gimp_text_layer_set): push the modified state to the undo stack and set it to FALSE here. Also push the layer's tiles if the layer was modified. * app/tools/gimptexttool.c (gimp_text_tool_apply): push "modified" to the undo stack and set it to FALSE here, too. Fixes bug #137767.
2004-04-01 22:51:58 +08:00
x, y, width, height);
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
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
gimp_drawable_fill (GimpDrawable *drawable,
const GimpRGB *color,
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
const GimpPattern *pattern)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
g_return_if_fail (color != NULL || pattern != NULL);
g_return_if_fail (pattern == NULL || GIMP_IS_PATTERN (pattern));
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
if (color)
{
GimpRGB c = *color;
GeglColor *col;
if (! gimp_drawable_has_alpha (drawable))
gimp_rgb_set_alpha (&c, 1.0);
col = gimp_gegl_color_new (&c);
gegl_buffer_set_color (gimp_drawable_get_buffer (drawable),
NULL, col);
g_object_unref (col);
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
}
else
{
GeglBuffer *src_buffer = gimp_pattern_create_buffer (pattern);
gegl_buffer_set_pattern (gimp_drawable_get_buffer (drawable),
NULL, src_buffer, 0, 0);
g_object_unref (src_buffer);
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
}
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
gimp_drawable_update (drawable,
0, 0,
gimp_item_get_width (GIMP_ITEM (drawable)),
gimp_item_get_height (GIMP_ITEM (drawable)));
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_drawable_fill_by_type (GimpDrawable *drawable,
GimpContext *context,
GimpFillType fill_type)
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
{
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
GimpRGB color;
GimpPattern *pattern = 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
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
switch (fill_type)
{
case GIMP_FOREGROUND_FILL:
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
gimp_context_get_foreground (context, &color);
break;
case GIMP_BACKGROUND_FILL:
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
gimp_context_get_background (context, &color);
break;
case GIMP_WHITE_FILL:
gimp_rgba_set (&color, 1.0, 1.0, 1.0, GIMP_OPACITY_OPAQUE);
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
break;
case GIMP_TRANSPARENT_FILL:
gimp_rgba_set (&color, 0.0, 0.0, 0.0, GIMP_OPACITY_TRANSPARENT);
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
break;
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
case GIMP_PATTERN_FILL:
pattern = gimp_context_get_pattern (context);
break;
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
default:
g_warning ("%s: unknown fill type %d", G_STRFUNC, fill_type);
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
return;
}
Enabled skipping enum values for either the PDB or GType registration 2004-01-06 Michael Natterer <mitch@gimp.org> Enabled skipping enum values for either the PDB or GType registration (don't always skip both targets): * tools/gimp-mkenums: skip enum values only if there is a literal "skip" (don't match "pdb-skip"). * tools/pdbgen/enumgen.pl: skip only "pdb-skip" values, not "skip" ones. * app/base/base-enums.h * app/core/core-enums.h * app/paint/paint-enums.h * libgimpbase/gimpbaseenums.h: use the right "pdb-skip"/"skip" combination to skip enum values. Changed comments accordingly. Cleaned up the fill functions: * app/core/core-enums.[ch]: added GIMP_PATTERN_FILL enum value to the GimpFillType enum. Don't export GIMP_NO_FILL to the PDB because it's completely useless to export a NOP. * app/core/gimp-edit.c (gimp_edit_fill, gimp_edit_fill_internal): handle pattern fill requests. * app/core/gimpdrawable.[ch] (gimp_drawable_fill): added GimpPattern parameter and fill with it if it's non-NULL. (gimp_drawable_fill_by_type): handle pattern fill and pass the current pattern to gimp_drawable_fill(). * app/text/gimptextlayer.c: changed accordingly. * app/gui/edit-commands.c * app/gui/image-menu.c: use gimp_edit_fill() instead of gimp_drawable_bucket_fill() for FG, BG and pattern filling. * libgimp/gimpcompat.h * plug-ins/script-fu/siod-wrapper.c: removed NO_IMAGE_FILL compat enum value. It should have never been exported to the PDB. * app/pdb/drawable_cmds.c * app/pdb/edit_cmds.c * libgimp/gimpenums.h * plug-ins/pygimp/gimpenums.py * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated.
2004-01-06 22:02:08 +08:00
gimp_drawable_fill (drawable, pattern ? NULL : &color, pattern);
}
const Babl *
gimp_drawable_get_format (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
return gegl_buffer_get_format (drawable->private->buffer);
}
const Babl *
gimp_drawable_get_format_with_alpha (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
return gimp_image_get_format (gimp_item_get_image (GIMP_ITEM (drawable)),
gimp_drawable_get_base_type (drawable),
gimp_drawable_get_precision (drawable),
TRUE);
}
const Babl *
gimp_drawable_get_format_without_alpha (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
return gimp_image_get_format (gimp_item_get_image (GIMP_ITEM (drawable)),
gimp_drawable_get_base_type (drawable),
gimp_drawable_get_precision (drawable),
FALSE);
}
gboolean
gimp_drawable_get_linear (const GimpDrawable *drawable)
{
2013-05-01 06:05:53 +08:00
const Babl *format;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
2013-05-01 06:05:53 +08:00
format = gegl_buffer_get_format (drawable->private->buffer);
return gimp_babl_format_get_linear (format);
}
gboolean
gimp_drawable_has_alpha (const GimpDrawable *drawable)
{
const Babl *format;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
format = gegl_buffer_get_format (drawable->private->buffer);
return babl_format_has_alpha (format);
}
Modified Files: ChangeLog app/Makefile.am app/channel.c app/channel.h Modified Files: ChangeLog app/Makefile.am app/channel.c app/channel.h app/channel_cmds.c app/channel_cmds.h app/drawable_cmds.c app/gimage_cmds.c app/gimpdrawable.c app/gimpdrawable.h app/gimpdrawableP.h app/gimpimage.c app/gimpimage.h app/gimpimageP.h app/internal_procs.c app/layer.c app/layer.h app/layer_cmds.c app/layer_cmds.h app/parasite_cmds.c app/perspective_tool.c app/plug_in.c app/procedural_db.c app/rotate_tool.c app/scale_tool.c app/shear_tool.c app/transform_core.c app/transform_core.h docs/parasites.txt libgimp/Makefile.am libgimp/gimp.c libgimp/gimp.h libgimp/gimpdrawable.c libgimp/gimpimage.c libgimp/gimpprotocol.c libgimp/gimpprotocol.h plug-ins/gif/gif.c plug-ins/script-fu/script-fu.c plug-ins/tiff/tiff.c Added Files: libgimp/gimpmatrix.c libgimp/gimpmatrix.h libgimp/parasite.c libgimp/parasite.h libgimp/parasiteF.h libgimp/parasiteP.h Removed Files: app/parasite.c app/parasite.h app/parasiteF.h app/parasiteP.h libgimp/gimpparasite.c libgimp/gimpparasite.h Tue Oct 13 19:24:03 1998 Jay Cox (jaycox@earthlink.net) * app/parasite.c * app/parasite.h * app/parasiteF.h * app/parasiteP.h : use a single name field instead of seperate creator/type fields. moved to libgimp/parasite* * libgimp/Makefile.am * libgimp/gimp.c * libgimp/gimp.h * libgimp/gimpdrawable.c * libgimp/gimpimage.c * libgimp/gimpprotocol.c * libgimp/gimpprotocol.h * app/Makefile.am * app/channel.c * app/channel.h * app/channel_cmds.c * app/channel_cmds.h * app/drawable_cmds.c * app/gimage_cmds.c * app/gimpdrawable.c * app/gimpdrawable.h * app/gimpdrawableP.h * app/gimpimage.c * app/gimpimage.h * app/gimpimageP.h * app/internal_procs.c * app/layer.c * app/layer.h * app/layer_cmds.c * app/layer_cmds.h * app/parasite_cmds.c * app/plug_in.c * app/procedural_db.c: Add tattoos to layers and drawables. Use new style parasites. * libgimp/gimpmatrix.c * libgimp/gimpmatrix.h: new files for matrix math. * app/perspective_tool.c * app/rotate_tool.c * app/scale_tool.c * app/shear_tool.c * app/transform_core.c * app/transform_core.h: use GimpMatrix instead of the old matrix code from transform_core. * ligimp/gimpparasite*: removed. now useing the same source for plug-ins and the core. * plug-ins/script-fu/script-fu.c * plug-ins/tiff/tiff.c * plug-ins/gif/gif.c: updated to use new style parasites.
1998-10-14 10:54:02 +08:00
GimpImageBaseType
2012-04-07 07:34:44 +08:00
gimp_drawable_get_base_type (const GimpDrawable *drawable)
{
const Babl *format;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
format = gegl_buffer_get_format (drawable->private->buffer);
return gimp_babl_format_get_base_type (format);
2012-04-07 07:34:44 +08:00
}
GimpComponentType
gimp_drawable_get_component_type (const GimpDrawable *drawable)
{
const Babl *format;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
format = gegl_buffer_get_format (drawable->private->buffer);
return gimp_babl_format_get_component_type (format);
}
GimpPrecision
gimp_drawable_get_precision (const GimpDrawable *drawable)
{
const Babl *format;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
format = gegl_buffer_get_format (drawable->private->buffer);
return gimp_babl_format_get_precision (format);
}
made gimp->global_buffer a GimpBuffer, not TileManager. 2001-12-13 Michael Natterer <mitch@gimp.org> * app/core/gimp.[ch]: made gimp->global_buffer a GimpBuffer, not TileManager. * app/core/gimpbuffer.[ch]: added a "gboolean copy_pixels" to gimp_buffer_new(). * app/core/gimpimage-new.c * app/core/gimpedit.[ch] * app/core/gimpimage-qmask.c * app/widgets/gimpbufferpreview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c: chaned accordingly, don't include "base/tile-manager.h". * app/core/gimpdrawable.[ch]: added gimp_drawable_copy(). * app/core/gimpchannel.[ch] * app/core/gimplayer.[ch] * app/core/gimplayermask.[ch]: use it in gimp_[channel|layer|layer_mask]_copy(), added "GType new_type" as paramater to all of them. * app/core/gimpimage-duplicate.c * app/gui/channels-commands.c * app/gui/edit-commands.c * app/gui/layers-commands.c * app/widgets/gimpchannellistview.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c: regenerated. * app/core/gimplayer.[ch]: removed the "layer_type" parameter from gimp_layer_new_from_tiles() because it always needed to be equal to gimp_image_base_type_with_alpha() of the passed image. * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-mask.c: cahanged accordingly. * app/core/gimpimage.[ch]: added some new GIMP_IMAGE_TYPE_FOO() marcos to get rid of magic values like "pixels = 3" all over the place. * app/core/gimplayer.[ch]: added gimp_layer_new_from_drawable() which creates a layer from an other image's drawable. * app/core/gimpimage-convert.[ch]: made the RGB and GRAY converters public to use them above, use the new GIMP_IMAGE_TYPE() macros. * app/display/gimpdisplayshell-dnd.c * app/gui/toolbox.c: removed tile manager stuff and use the new functions. * app/widgets/gimpdrawablelistview.[ch]: added a "convert_drawable_func" which is used to handle drops from other images. * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch]: implemented DND of layers between images using gimp_layer_new_from_drawable(). * app/gui/dialogs-constructors.c: changed accordingly.
2001-12-13 07:48:18 +08:00
gboolean
gimp_drawable_is_rgb (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
return (gimp_drawable_get_base_type (drawable) == GIMP_RGB);
made gimp->global_buffer a GimpBuffer, not TileManager. 2001-12-13 Michael Natterer <mitch@gimp.org> * app/core/gimp.[ch]: made gimp->global_buffer a GimpBuffer, not TileManager. * app/core/gimpbuffer.[ch]: added a "gboolean copy_pixels" to gimp_buffer_new(). * app/core/gimpimage-new.c * app/core/gimpedit.[ch] * app/core/gimpimage-qmask.c * app/widgets/gimpbufferpreview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c: chaned accordingly, don't include "base/tile-manager.h". * app/core/gimpdrawable.[ch]: added gimp_drawable_copy(). * app/core/gimpchannel.[ch] * app/core/gimplayer.[ch] * app/core/gimplayermask.[ch]: use it in gimp_[channel|layer|layer_mask]_copy(), added "GType new_type" as paramater to all of them. * app/core/gimpimage-duplicate.c * app/gui/channels-commands.c * app/gui/edit-commands.c * app/gui/layers-commands.c * app/widgets/gimpchannellistview.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c: regenerated. * app/core/gimplayer.[ch]: removed the "layer_type" parameter from gimp_layer_new_from_tiles() because it always needed to be equal to gimp_image_base_type_with_alpha() of the passed image. * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-mask.c: cahanged accordingly. * app/core/gimpimage.[ch]: added some new GIMP_IMAGE_TYPE_FOO() marcos to get rid of magic values like "pixels = 3" all over the place. * app/core/gimplayer.[ch]: added gimp_layer_new_from_drawable() which creates a layer from an other image's drawable. * app/core/gimpimage-convert.[ch]: made the RGB and GRAY converters public to use them above, use the new GIMP_IMAGE_TYPE() macros. * app/display/gimpdisplayshell-dnd.c * app/gui/toolbox.c: removed tile manager stuff and use the new functions. * app/widgets/gimpdrawablelistview.[ch]: added a "convert_drawable_func" which is used to handle drops from other images. * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch]: implemented DND of layers between images using gimp_layer_new_from_drawable(). * app/gui/dialogs-constructors.c: changed accordingly.
2001-12-13 07:48:18 +08:00
}
gboolean
gimp_drawable_is_gray (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
return (gimp_drawable_get_base_type (drawable) == GIMP_GRAY);
made gimp->global_buffer a GimpBuffer, not TileManager. 2001-12-13 Michael Natterer <mitch@gimp.org> * app/core/gimp.[ch]: made gimp->global_buffer a GimpBuffer, not TileManager. * app/core/gimpbuffer.[ch]: added a "gboolean copy_pixels" to gimp_buffer_new(). * app/core/gimpimage-new.c * app/core/gimpedit.[ch] * app/core/gimpimage-qmask.c * app/widgets/gimpbufferpreview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c: chaned accordingly, don't include "base/tile-manager.h". * app/core/gimpdrawable.[ch]: added gimp_drawable_copy(). * app/core/gimpchannel.[ch] * app/core/gimplayer.[ch] * app/core/gimplayermask.[ch]: use it in gimp_[channel|layer|layer_mask]_copy(), added "GType new_type" as paramater to all of them. * app/core/gimpimage-duplicate.c * app/gui/channels-commands.c * app/gui/edit-commands.c * app/gui/layers-commands.c * app/widgets/gimpchannellistview.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c: regenerated. * app/core/gimplayer.[ch]: removed the "layer_type" parameter from gimp_layer_new_from_tiles() because it always needed to be equal to gimp_image_base_type_with_alpha() of the passed image. * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-mask.c: cahanged accordingly. * app/core/gimpimage.[ch]: added some new GIMP_IMAGE_TYPE_FOO() marcos to get rid of magic values like "pixels = 3" all over the place. * app/core/gimplayer.[ch]: added gimp_layer_new_from_drawable() which creates a layer from an other image's drawable. * app/core/gimpimage-convert.[ch]: made the RGB and GRAY converters public to use them above, use the new GIMP_IMAGE_TYPE() macros. * app/display/gimpdisplayshell-dnd.c * app/gui/toolbox.c: removed tile manager stuff and use the new functions. * app/widgets/gimpdrawablelistview.[ch]: added a "convert_drawable_func" which is used to handle drops from other images. * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch]: implemented DND of layers between images using gimp_layer_new_from_drawable(). * app/gui/dialogs-constructors.c: changed accordingly.
2001-12-13 07:48:18 +08:00
}
gboolean
gimp_drawable_is_indexed (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
return (gimp_drawable_get_base_type (drawable) == GIMP_INDEXED);
made gimp->global_buffer a GimpBuffer, not TileManager. 2001-12-13 Michael Natterer <mitch@gimp.org> * app/core/gimp.[ch]: made gimp->global_buffer a GimpBuffer, not TileManager. * app/core/gimpbuffer.[ch]: added a "gboolean copy_pixels" to gimp_buffer_new(). * app/core/gimpimage-new.c * app/core/gimpedit.[ch] * app/core/gimpimage-qmask.c * app/widgets/gimpbufferpreview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c: chaned accordingly, don't include "base/tile-manager.h". * app/core/gimpdrawable.[ch]: added gimp_drawable_copy(). * app/core/gimpchannel.[ch] * app/core/gimplayer.[ch] * app/core/gimplayermask.[ch]: use it in gimp_[channel|layer|layer_mask]_copy(), added "GType new_type" as paramater to all of them. * app/core/gimpimage-duplicate.c * app/gui/channels-commands.c * app/gui/edit-commands.c * app/gui/layers-commands.c * app/widgets/gimpchannellistview.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c: regenerated. * app/core/gimplayer.[ch]: removed the "layer_type" parameter from gimp_layer_new_from_tiles() because it always needed to be equal to gimp_image_base_type_with_alpha() of the passed image. * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-mask.c: cahanged accordingly. * app/core/gimpimage.[ch]: added some new GIMP_IMAGE_TYPE_FOO() marcos to get rid of magic values like "pixels = 3" all over the place. * app/core/gimplayer.[ch]: added gimp_layer_new_from_drawable() which creates a layer from an other image's drawable. * app/core/gimpimage-convert.[ch]: made the RGB and GRAY converters public to use them above, use the new GIMP_IMAGE_TYPE() macros. * app/display/gimpdisplayshell-dnd.c * app/gui/toolbox.c: removed tile manager stuff and use the new functions. * app/widgets/gimpdrawablelistview.[ch]: added a "convert_drawable_func" which is used to handle drops from other images. * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch]: implemented DND of layers between images using gimp_layer_new_from_drawable(). * app/gui/dialogs-constructors.c: changed accordingly.
2001-12-13 07:48:18 +08:00
}
const guchar *
gimp_drawable_get_colormap (const GimpDrawable *drawable)
{
GimpImage *image;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
image = gimp_item_get_image (GIMP_ITEM (drawable));
return image ? gimp_image_get_colormap (image) : NULL;
}
GimpLayer *
gimp_drawable_get_floating_sel (const GimpDrawable *drawable)
made gimp->global_buffer a GimpBuffer, not TileManager. 2001-12-13 Michael Natterer <mitch@gimp.org> * app/core/gimp.[ch]: made gimp->global_buffer a GimpBuffer, not TileManager. * app/core/gimpbuffer.[ch]: added a "gboolean copy_pixels" to gimp_buffer_new(). * app/core/gimpimage-new.c * app/core/gimpedit.[ch] * app/core/gimpimage-qmask.c * app/widgets/gimpbufferpreview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c: chaned accordingly, don't include "base/tile-manager.h". * app/core/gimpdrawable.[ch]: added gimp_drawable_copy(). * app/core/gimpchannel.[ch] * app/core/gimplayer.[ch] * app/core/gimplayermask.[ch]: use it in gimp_[channel|layer|layer_mask]_copy(), added "GType new_type" as paramater to all of them. * app/core/gimpimage-duplicate.c * app/gui/channels-commands.c * app/gui/edit-commands.c * app/gui/layers-commands.c * app/widgets/gimpchannellistview.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c: regenerated. * app/core/gimplayer.[ch]: removed the "layer_type" parameter from gimp_layer_new_from_tiles() because it always needed to be equal to gimp_image_base_type_with_alpha() of the passed image. * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-mask.c: cahanged accordingly. * app/core/gimpimage.[ch]: added some new GIMP_IMAGE_TYPE_FOO() marcos to get rid of magic values like "pixels = 3" all over the place. * app/core/gimplayer.[ch]: added gimp_layer_new_from_drawable() which creates a layer from an other image's drawable. * app/core/gimpimage-convert.[ch]: made the RGB and GRAY converters public to use them above, use the new GIMP_IMAGE_TYPE() macros. * app/display/gimpdisplayshell-dnd.c * app/gui/toolbox.c: removed tile manager stuff and use the new functions. * app/widgets/gimpdrawablelistview.[ch]: added a "convert_drawable_func" which is used to handle drops from other images. * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch]: implemented DND of layers between images using gimp_layer_new_from_drawable(). * app/gui/dialogs-constructors.c: changed accordingly.
2001-12-13 07:48:18 +08:00
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
return drawable->private->floating_selection;
made gimp->global_buffer a GimpBuffer, not TileManager. 2001-12-13 Michael Natterer <mitch@gimp.org> * app/core/gimp.[ch]: made gimp->global_buffer a GimpBuffer, not TileManager. * app/core/gimpbuffer.[ch]: added a "gboolean copy_pixels" to gimp_buffer_new(). * app/core/gimpimage-new.c * app/core/gimpedit.[ch] * app/core/gimpimage-qmask.c * app/widgets/gimpbufferpreview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c: chaned accordingly, don't include "base/tile-manager.h". * app/core/gimpdrawable.[ch]: added gimp_drawable_copy(). * app/core/gimpchannel.[ch] * app/core/gimplayer.[ch] * app/core/gimplayermask.[ch]: use it in gimp_[channel|layer|layer_mask]_copy(), added "GType new_type" as paramater to all of them. * app/core/gimpimage-duplicate.c * app/gui/channels-commands.c * app/gui/edit-commands.c * app/gui/layers-commands.c * app/widgets/gimpchannellistview.c * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/channel_cmds.c * app/pdb/layer_cmds.c * app/pdb/selection_cmds.c: regenerated. * app/core/gimplayer.[ch]: removed the "layer_type" parameter from gimp_layer_new_from_tiles() because it always needed to be equal to gimp_image_base_type_with_alpha() of the passed image. * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage-mask.c: cahanged accordingly. * app/core/gimpimage.[ch]: added some new GIMP_IMAGE_TYPE_FOO() marcos to get rid of magic values like "pixels = 3" all over the place. * app/core/gimplayer.[ch]: added gimp_layer_new_from_drawable() which creates a layer from an other image's drawable. * app/core/gimpimage-convert.[ch]: made the RGB and GRAY converters public to use them above, use the new GIMP_IMAGE_TYPE() macros. * app/display/gimpdisplayshell-dnd.c * app/gui/toolbox.c: removed tile manager stuff and use the new functions. * app/widgets/gimpdrawablelistview.[ch]: added a "convert_drawable_func" which is used to handle drops from other images. * app/widgets/gimpdrawablelistitem.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch]: implemented DND of layers between images using gimp_layer_new_from_drawable(). * app/gui/dialogs-constructors.c: changed accordingly.
2001-12-13 07:48:18 +08:00
}
void
gimp_drawable_attach_floating_sel (GimpDrawable *drawable,
GimpLayer *fs)
{
GimpImage *image;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
g_return_if_fail (gimp_drawable_get_floating_sel (drawable) == NULL);
g_return_if_fail (GIMP_IS_LAYER (fs));
GIMP_LOG (FLOATING_SELECTION, "%s", G_STRFUNC);
image = gimp_item_get_image (GIMP_ITEM (drawable));
drawable->private->floating_selection = fs;
gimp_image_set_floating_selection (image, fs);
/* clear the selection */
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (fs));
gimp_drawable_sync_fs_filter (drawable, FALSE);
g_signal_connect (fs, "update",
G_CALLBACK (gimp_drawable_fs_update),
drawable);
gimp_drawable_fs_update (fs,
0, 0,
gimp_item_get_width (GIMP_ITEM (fs)),
gimp_item_get_height (GIMP_ITEM (fs)),
drawable);
}
void
gimp_drawable_detach_floating_sel (GimpDrawable *drawable)
{
GimpImage *image;
GimpLayer *fs;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_drawable_get_floating_sel (drawable) != NULL);
GIMP_LOG (FLOATING_SELECTION, "%s", G_STRFUNC);
image = gimp_item_get_image (GIMP_ITEM (drawable));
fs = drawable->private->floating_selection;
gimp_drawable_sync_fs_filter (drawable, TRUE);
g_signal_handlers_disconnect_by_func (fs,
gimp_drawable_fs_update,
drawable);
gimp_drawable_fs_update (fs,
0, 0,
gimp_item_get_width (GIMP_ITEM (fs)),
gimp_item_get_height (GIMP_ITEM (fs)),
drawable);
/* clear the selection */
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (fs));
gimp_image_set_floating_selection (image, NULL);
drawable->private->floating_selection = NULL;
}
GimpFilter *
gimp_drawable_get_floating_sel_filter (GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_drawable_get_floating_sel (drawable) != NULL, NULL);
/*
* Ensure that the graph is construced before the filter is used.
* Otherwise, we rely on the projection to cause the graph to be constructed,
* which fails for images that aren't displayed.
*/
gimp_filter_get_node (GIMP_FILTER (drawable));
return drawable->private->fs_filter;
}