gimp/libgimp/gimpdrawable.c

481 lines
13 KiB
C
Raw Normal View History

Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpdrawable.c
*
* This library is free software: you can redistribute it and/or
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
*/
#include "config.h"
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
#define GIMP_DISABLE_DEPRECATION_WARNINGS
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
#include "gimp.h"
#include "gimptilebackendplugin.h"
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> Episode IV... * app/Makefile.am * app/message_cmds.c: new name * app/interface_cmds.c: removed * app/help_cmds.c: new name * app/gimphelp_cmds.c: removed * app/internal_procs.c * app/gimphelp_cmds.c * app/plug_in_cmds.c: moved gimp_plugin_help_register to plug_in_cmds.c, s/gimp_plugin_domain_add/gimp_plugin_domain_register/ * libgimp/Makefile.am * libgimp/gimp_pdb.h * libgimp/gimpfileops_pdb.[ch] * libgimp/gimpguides_pdb.[ch] * libgimp/gimpmessage_pdb.[ch] * libgimp/gimpprocedural_db_pdb.[ch] * libgimp/gimpplugin_pdb.[ch]: new files containing PDB wrappers moved out of libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdisplay_pdb.[ch] * libgimp/gimpdrawable_pdb.[ch] * libgimp/gimphelp_pdb.[ch] * libgimp/gimpimage_pdb.[ch] * libgimp/gimplayer_pdb.c * libgimp/gimpparasite_pdb.c * libgimp/gimpselection_pdb.c: various changes. * libgimp/gimpunit.c: new file * libgimp/gimpunit_pdb.[ch]: contains only PDB wrappers prefixed with "_" which are called from libgimp/gimpunit.c only. * libgimp/gimpunit.h: minor stuff * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_query_database gimp_query_images * libgimp/gimp.[ch]: removed all PDB wrappers. * tools/pdbgen/Makefile.am * tools/pdbgen/groups.pl: changed * tools/pdbgen/lib.pl: tried to fix libgimp autogeneration and fixed just a few comments. * tools/pdbgen/pdb/interface.pdb * tools/pdbgen/pdb/gimphelp.pdb: removed * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/message.pdb: new names * plug-ins/script-fu/script-fu.c * plug-ins/perl/Gimp/Lib.xs: s/gimp_plugin_domain_add/gimp_plugin_domain_register/ 2000-05-31 Michael Natterer <mitch@gimp.org> * POTFILES.in: s/gimpunit_pdb/gimpunit/
2000-05-31 21:24:14 +08:00
Changed the semantics of GIMP_EXTENSION and (to some extent) of 2003-06-19 Michael Natterer <mitch@gimp.org> Changed the semantics of GIMP_EXTENSION and (to some extent) of GIMP_PLUGIN: The old meaning of EXTENSION was "I live in the toolbox" and PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I am invoked interactively)". This is completely useless, since living in the toolbox means having "<Toolbox>" in the menu_path and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of what type of procedure we are. The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure, I am invoked, do my job and finish", while GIMP_EXTENSION means "I will install temporary procedures and I will keep running to keep them available". (A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the core that it's ready to run, or the core will block waiting for the message !!!). * configure.in: bumped version number to 1.3.16. * libgimpbase/gimpprotocol.h: increased protocol version number so old extensions will refuse to load. * app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but look at their parameters and pass them either RUN-MODE, or RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE. * app/pdb/procedural_db.c: cleaned up, better error reporting, replaced an impossible error message by g_return_if_fail() * app/plug-in/plug-in-message.c (plug_in_handle_proc_install): better error messages. * app/plug-in/plug-in-params.c: allocate parameter arrays using g_new0() so we don't have to worry about uninitialized stuff later. * app/plug-in/plug-in-run.c (plug_in_run): wait for gimp_extension_ack() installation confirmation for ALL extensions, not just for automatically started ones. * app/plug-in/plug-ins.c: cleanup. * libgimp/gimp.[ch]: cleaned up and API-documented massively. Made all magic values given in the GPConfig message static and added accessor functions for them. Added gimp_tile_width()/height(). Added new function gimp_extension_enable() which turns on asynchronous processing of temp_proc run requests without having to enter an endless gimp_extension_process() loop. Moved all private functions to the end of the file. Added tons of g_return_if_fail() all over the place. Call gimp_run_procedure2() from gimp_run_procedure() instead of duplicating the code. Indentation, spacing, stuff... * libgimp/gimptile.[ch]: removed gimp_tile_width()/height(). * libgimp/gimpdrawable.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: use the gimp_tile_width()/height() accessor functions. * libgimp/gimp.def: added gimp_extension_enable. * libgimp/gimpmenu.c: removed evil code which connected to _readchannel manually and use gimp_extension_enable() for watching temp_procs. * plug-ins/helpbrowser/helpbrowser.c: removed the same evil code here and call gimp_extension_enable(). Call gimp_extension_ack() to let the core know that the temp_proc is installed. * plug-ins/script-fu/script-fu.c: made all procedures except the permanently running "extension_script_fu" ordinary GIMP_PLUGIN procedures. * plug-ins/common/curve_bend.c * plug-ins/common/plugindetails.c * plug-ins/common/screenshot.c * plug-ins/common/uniteditor.c * plug-ins/common/winclipboard.c * plug-ins/dbbrowser/dbbrowser.c * plug-ins/gfli/gfli.c * plug-ins/twain/twain.c * plug-ins/webbrowser/webbrowser.c * plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN procedures and renamed them from "extension_*" to "plug_in_*". Random cleanups. * app/widgets/gimphelp.c * plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-20 01:12:00 +08:00
#define TILE_WIDTH gimp_tile_width()
#define TILE_HEIGHT gimp_tile_height()
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
/**
* gimp_drawable_get:
* @drawable_ID: the ID of the drawable
*
* This function creates a #GimpDrawable structure for the core
* drawable identified by @drawable_ID. The returned structure
* contains some basic information about the drawable and can also
* hold tile data for transfer to and from the core.
*
* Note that the name of this function is somewhat misleading, because
* it suggests that it simply returns a handle. This is not the case:
* if the function is called multiple times, it creates separate tile
* lists each time, which will usually produce undesired results.
*
* When a plug-in has finished working with a drawable, before exiting
* it should call gimp_drawable_detach() to make sure that all tile data is
* transferred back to the core.
*
* Return value: a new #GimpDrawable wrapper
**/
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
GimpDrawable *
gimp_drawable_get (gint32 drawable_ID)
{
GimpDrawable *drawable;
gint width;
gint height;
gint bpp;
width = gimp_drawable_width (drawable_ID);
height = gimp_drawable_height (drawable_ID);
bpp = gimp_drawable_bpp (drawable_ID);
g_return_val_if_fail (width > 0 && height > 0 && bpp > 0, NULL);
drawable = g_slice_new0 (GimpDrawable);
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
drawable->drawable_id = drawable_ID;
drawable->width = width;
drawable->height = height;
drawable->bpp = bpp;
drawable->ntile_rows = (height + TILE_HEIGHT - 1) / TILE_HEIGHT;
drawable->ntile_cols = (width + TILE_WIDTH - 1) / TILE_WIDTH;
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
return drawable;
}
/**
* gimp_drawable_detach:
* @drawable: The #GimpDrawable to detach from the core
*
* This function is called when a plug-in is finished working
* with a drawable. It forces all tile data held in the tile
* list of the #GimpDrawable to be transferred to the core, and
* then frees all associated memory. You must not access the
* @drawable after having called gimp_drawable_detach().
**/
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
void
gimp_drawable_detach (GimpDrawable *drawable)
{
g_return_if_fail (drawable != NULL);
gimp_drawable_flush (drawable);
if (drawable->tiles)
g_free (drawable->tiles);
if (drawable->shadow_tiles)
g_free (drawable->shadow_tiles);
g_slice_free (GimpDrawable, drawable);
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
}
/**
* gimp_drawable_flush:
* @drawable: The #GimpDrawable whose tile data is to be transferred
* to the core.
*
* This function causes all tile data in the tile list of @drawable to be
* transferred to the core. It is usually called in situations where a
* plug-in acts on a drawable, and then needs to read the results of its
* actions. Data transferred back from the core will not generally be valid
* unless gimp_drawable_flush() has been called beforehand.
**/
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
void
gimp_drawable_flush (GimpDrawable *drawable)
{
GimpTile *tiles;
gint n_tiles;
gint i;
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
g_return_if_fail (drawable != NULL);
if (drawable->tiles)
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
{
tiles = drawable->tiles;
n_tiles = drawable->ntile_rows * drawable->ntile_cols;
for (i = 0; i < n_tiles; i++)
if ((tiles[i].ref_count > 0) && tiles[i].dirty)
gimp_tile_flush (&tiles[i]);
}
if (drawable->shadow_tiles)
{
tiles = drawable->shadow_tiles;
n_tiles = drawable->ntile_rows * drawable->ntile_cols;
for (i = 0; i < n_tiles; i++)
if ((tiles[i].ref_count > 0) && tiles[i].dirty)
gimp_tile_flush (&tiles[i]);
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
}
/* nuke all references to this drawable from the cache */
_gimp_tile_cache_flush_drawable (drawable);
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
}
GimpTile *
gimp_drawable_get_tile (GimpDrawable *drawable,
gboolean shadow,
gint row,
gint col)
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
{
GimpTile *tiles;
guint right_tile;
guint bottom_tile;
gint n_tiles;
gint tile_num;
gint i, j, k;
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
g_return_val_if_fail (drawable != NULL, NULL);
if (shadow)
tiles = drawable->shadow_tiles;
else
tiles = drawable->tiles;
if (! tiles)
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
{
n_tiles = drawable->ntile_rows * drawable->ntile_cols;
tiles = g_new (GimpTile, n_tiles);
right_tile = (drawable->width -
((drawable->ntile_cols - 1) * TILE_WIDTH));
bottom_tile = (drawable->height -
((drawable->ntile_rows - 1) * TILE_HEIGHT));
for (i = 0, k = 0; i < drawable->ntile_rows; i++)
{
for (j = 0; j < drawable->ntile_cols; j++, k++)
{
tiles[k].bpp = drawable->bpp;
tiles[k].tile_num = k;
tiles[k].ref_count = 0;
tiles[k].dirty = FALSE;
tiles[k].shadow = shadow;
tiles[k].data = NULL;
tiles[k].drawable = drawable;
if (j == (drawable->ntile_cols - 1))
tiles[k].ewidth = right_tile;
else
tiles[k].ewidth = TILE_WIDTH;
if (i == (drawable->ntile_rows - 1))
tiles[k].eheight = bottom_tile;
else
tiles[k].eheight = TILE_HEIGHT;
}
}
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
if (shadow)
drawable->shadow_tiles = tiles;
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
else
drawable->tiles = tiles;
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
}
tile_num = row * drawable->ntile_cols + col;
return &tiles[tile_num];
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
}
GimpTile *
gimp_drawable_get_tile2 (GimpDrawable *drawable,
gboolean shadow,
gint x,
gint y)
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
{
gint row;
gint col;
g_return_val_if_fail (drawable != NULL, NULL);
Sven Neumann <sven@gimp.org> 2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> * libgimp/Makefile.am * libgimp/gimpchannel_pdb.h * libgimp/gimpdisplay_pdb.h * libgimp/gimpdrawable_pdb.h * libgimp/gimpgradient_pdb.h * libgimp/gimphelp_pdb.h * libgimp/gimpimage_pdb.h * libgimp/gimplayer_pdb.h * libgimp/gimpparasite_pdb.h * libgimp/gimpselection_pdb.h * libgimp/gimpunit_pdb.h * libgimp/gimpdrawable.[ch] * libgimp/gimphelp.c * libgimp/gimppixelrgn.h * libgimp/gimptile.h: new files * libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdrawable_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimpselection_pdb.c * libgimp/gimphelp_pdb.c * libgimp/gimpimage_pdb.c * libgimp/gimplayer_pdb.c * libgimp/gimpgradientmenu.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.[ch] * libgimp/gimppatternmenu.c * libgimp/gimppixelrgn.c * libgimp/gimptile.c: part III of the (final) libgimp cleanup Split gimp.h into a bunch of headers. More or less finished the task of moving PDB wrappers into separate files in preparation of the upcoming autogen-it-all-attack. * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_[channel|layer]_[width|height] gimp_layer_[bpp|type] gimp_channel_get_[image|layer]_ID * libgimp/gimptypes.h: new file: GPlugInInfo GTile GDrawable GPixelRgn GParamColor GParamRegion GParamData GParamDef GParam: s/G/Gimp/ * app/gimphelp_cmds.c * app/plug_in_cmds.c * tools/pdbgen/pdb/gimphelp.pdb * tools/pdbgen/pdb/plug_in.pdb: changed help texts.
2000-05-31 14:15:06 +08:00
col = x / TILE_WIDTH;
row = y / TILE_HEIGHT;
return gimp_drawable_get_tile (drawable, shadow, row, col);
}
Cleaned up the remaining libgimp API issues: 2004-03-12 Michael Natterer <mitch@gimp.org> Cleaned up the remaining libgimp API issues: * libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode): added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we can actually use the bg_color feature of the GimpPixelFetcher. (gimp_pixel_fetcher_new): added "gboolean shadow" parameter because it must not change while the GimpPixelFetcher exists. (gimp_pixel_fetcher_set_shadow): removed. (gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color" parameter and don't call gimp_palette_get_foreground(). (gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up the function. (gimp_get_bg_guchar) (gimp_get_fg_guchar): removed these functions... * libgimp/gimpdrawable.[ch]: ...and added gimp_drawable_get_color_uchar() instead. * libgimp/gimp.def * plug-ins/common/blinds.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/illusion.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/ripple.c * plug-ins/common/shift.c * plug-ins/common/spread.c * plug-ins/common/tileit.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly. (Didn't test the changed plug-ins because I wanted to get this API change into CVS as soon as possible)
2004-03-13 06:46:25 +08:00
void
gimp_drawable_get_color_uchar (gint32 drawable_ID,
const GimpRGB *color,
guchar *color_uchar)
{
g_return_if_fail (color != NULL);
g_return_if_fail (color_uchar != NULL);
switch (gimp_drawable_type (drawable_ID))
{
case GIMP_RGB_IMAGE:
gimp_rgb_get_uchar (color,
&color_uchar[0], &color_uchar[1], &color_uchar[2]);
color_uchar[3] = 255;
break;
case GIMP_RGBA_IMAGE:
gimp_rgba_get_uchar (color,
&color_uchar[0], &color_uchar[1], &color_uchar[2],
&color_uchar[3]);
break;
case GIMP_GRAY_IMAGE:
color_uchar[0] = gimp_rgb_luminance_uchar (color);
Cleaned up the remaining libgimp API issues: 2004-03-12 Michael Natterer <mitch@gimp.org> Cleaned up the remaining libgimp API issues: * libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode): added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we can actually use the bg_color feature of the GimpPixelFetcher. (gimp_pixel_fetcher_new): added "gboolean shadow" parameter because it must not change while the GimpPixelFetcher exists. (gimp_pixel_fetcher_set_shadow): removed. (gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color" parameter and don't call gimp_palette_get_foreground(). (gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up the function. (gimp_get_bg_guchar) (gimp_get_fg_guchar): removed these functions... * libgimp/gimpdrawable.[ch]: ...and added gimp_drawable_get_color_uchar() instead. * libgimp/gimp.def * plug-ins/common/blinds.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/illusion.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/ripple.c * plug-ins/common/shift.c * plug-ins/common/spread.c * plug-ins/common/tileit.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly. (Didn't test the changed plug-ins because I wanted to get this API change into CVS as soon as possible)
2004-03-13 06:46:25 +08:00
color_uchar[1] = 255;
break;
case GIMP_GRAYA_IMAGE:
color_uchar[0] = gimp_rgb_luminance_uchar (color);
Cleaned up the remaining libgimp API issues: 2004-03-12 Michael Natterer <mitch@gimp.org> Cleaned up the remaining libgimp API issues: * libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode): added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we can actually use the bg_color feature of the GimpPixelFetcher. (gimp_pixel_fetcher_new): added "gboolean shadow" parameter because it must not change while the GimpPixelFetcher exists. (gimp_pixel_fetcher_set_shadow): removed. (gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color" parameter and don't call gimp_palette_get_foreground(). (gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up the function. (gimp_get_bg_guchar) (gimp_get_fg_guchar): removed these functions... * libgimp/gimpdrawable.[ch]: ...and added gimp_drawable_get_color_uchar() instead. * libgimp/gimp.def * plug-ins/common/blinds.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/illusion.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/ripple.c * plug-ins/common/shift.c * plug-ins/common/spread.c * plug-ins/common/tileit.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly. (Didn't test the changed plug-ins because I wanted to get this API change into CVS as soon as possible)
2004-03-13 06:46:25 +08:00
gimp_rgba_get_uchar (color, NULL, NULL, NULL, &color_uchar[1]);
break;
default:
break;
}
}
guchar *
gimp_drawable_get_thumbnail_data (gint32 drawable_ID,
gint *width,
gint *height,
gint *bpp)
{
gint ret_width;
gint ret_height;
guchar *image_data;
gint data_size;
_gimp_drawable_thumbnail (drawable_ID,
*width,
*height,
&ret_width,
&ret_height,
bpp,
&data_size,
&image_data);
*width = ret_width;
*height = ret_height;
return image_data;
}
Makefile.am configure.in added new directory libgimpbase/ 2001-05-21 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool-1.4.in: added new directory libgimpbase/ * app/Makefile.am: link against the new lib. * app/appenums.h: removed the PDB enums which are in libgimpbase/gimpbasetypes.h now. They are all "Gimp" prefixed. * app/apptypes.h: #include "libgimpbase/gimpbasetypes.h" * app/[lots] * app/core/[of] * app/gui/[files] * app/tools/: changed includes and all PDB types. * app/pdb/*: regenerated. * libgimp/Makefile.am: don't build libgimpi.a uglyness any more. * libgimp/gimpenv.[ch] * libgimp/gimplimits.[hh] * libgimp/gimpparasite.[ch] * libgimp/gimpparasiteio.[ch] * libgimp/gimpprotocol.[ch] * libgimp/gimpsignal.[ch] * libgimp/gimpunit.h * libgimp/gimputils.[ch] * libgimp/gimpwire.[ch]: removed... * libgimpbase/*: ...and added here as new library. * libgimp/gimp.[ch] * libgimp/gimpdrawable.[ch] * libgimp/gimpenums.h * libgimp/gimpimage.[ch] * libgimp/gimptile.c * libgimp/gimptypes.h * libgimp/gimpunit.c: changed accordingly. Added the gimp_*_add_new_parasite to gimp.[ch], gimpdrawable.[ch] and gimpimage.[ch]. * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpsizeentry.c * libgimpwidgets/gimpunitmenu.c * libgimpwidgets/gimpwidgets.c * libgimpwidgets/gimpwidgetstypes.h: changed includes accordingly. * plug-ins/*/Makefile.am * plug-ins/common/mkgen.pl: link against libgimpbase. * tools/pdbgen/Makefile.am: scan libgimpbase/gimpbasetypes.h, so the enums are known to pdbgen... * tools/pdbgen/enumcode.pl: ...but don't write them out to libgimp/gimpenums.h * tools/pdbgen/app.pl: include libgimp/gimpbase.h in all *_cmds.c files. Added GIMP_ to the type names ganerated in app/. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/procedural_db.pdb * tools/pdbgen/pdb/unit.pdb: changed includes.
2001-05-21 21:58:46 +08:00
guchar *
gimp_drawable_get_sub_thumbnail_data (gint32 drawable_ID,
gint src_x,
gint src_y,
gint src_width,
gint src_height,
gint *dest_width,
gint *dest_height,
gint *bpp)
{
gint ret_width;
gint ret_height;
guchar *image_data;
gint data_size;
_gimp_drawable_sub_thumbnail (drawable_ID,
src_x, src_y,
src_width, src_height,
*dest_width,
*dest_height,
&ret_width,
&ret_height,
bpp,
&data_size,
&image_data);
*dest_width = ret_width;
*dest_height = ret_height;
return image_data;
}
/**
* gimp_drawable_get_buffer:
* @drawable_ID: the ID of the #GimpDrawable to get the buffer for.
*
* Returns a #GeglBuffer of a specified drawable. The buffer can be used
* like any other GEGL buffer. Its data will we synced back with the core
* drawable when the buffer gets destroyed, or when gegl_buffer_flush()
* is called.
*
* Return value: The #GeglBuffer.
*
* See Also: gimp_drawable_get_shadow_buffer()
*
* Since: 2.10
*/
GeglBuffer *
gimp_drawable_get_buffer (gint32 drawable_ID)
{
gimp_plugin_enable_precision ();
if (gimp_item_is_valid (drawable_ID))
{
GimpDrawable *drawable;
drawable = gimp_drawable_get (drawable_ID);
if (drawable)
{
GeglTileBackend *backend;
GeglBuffer *buffer;
backend = _gimp_tile_backend_plugin_new (drawable, FALSE);
buffer = gegl_buffer_new_for_backend (NULL, backend);
g_object_unref (backend);
return buffer;
}
}
return NULL;
}
/**
* gimp_drawable_get_shadow_buffer:
* @drawable_ID: the ID of the #GimpDrawable to get the buffer for.
*
* Returns a #GeglBuffer of a specified drawable's shadow tiles. The
* buffer can be used like any other GEGL buffer. Its data will we
* synced back with the core drawable's shadow tiles when the buffer
* gets destroyed, or when gegl_buffer_flush() is called.
*
* Return value: The #GeglBuffer.
*
* See Also: gimp_drawable_get_shadow_buffer()
*
* Since: 2.10
*/
GeglBuffer *
gimp_drawable_get_shadow_buffer (gint32 drawable_ID)
{
GimpDrawable *drawable;
gimp_plugin_enable_precision ();
drawable = gimp_drawable_get (drawable_ID);
if (drawable)
{
GeglTileBackend *backend;
GeglBuffer *buffer;
backend = _gimp_tile_backend_plugin_new (drawable, TRUE);
buffer = gegl_buffer_new_for_backend (NULL, backend);
g_object_unref (backend);
return buffer;
}
return NULL;
}
/**
* gimp_drawable_get_format:
* @drawable_ID: the ID of the #GimpDrawable to get the format for.
*
* Returns the #Babl format of the drawable.
*
* Return value: The #Babl format.
*
* Since: 2.10
*/
const Babl *
gimp_drawable_get_format (gint32 drawable_ID)
{
static GHashTable *palette_formats = NULL;
const Babl *format = NULL;
gchar *format_str = _gimp_drawable_get_format (drawable_ID);
Initial space invasion commit in GIMP All babl formats now have a space equivalent to a color profile, determining the format's primaries and TRCs. This commit makes GIMP aware of this. libgimp: - enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA as deprecated aliases, add PERCEPTUAL values so we now have LINEAR, NON_LINEAR and PERCPTUAL for each encoding, matching the babl encoding variants RGB, R'G'B' and R~G~B~. - gimp_color_transform_can_gegl_copy() now returns TRUE if both profiles can return a babl space, increasing the amount of fast babl color conversions significantly. - TODO: no solution yet for getting libgimp drawable proxy buffers in the right format with space. plug-ins: - follow the GimpPrecision change. - TODO: everything else unchanged and partly broken or sub-optimal, like setting a new image's color profile too late. app: - add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as replacement for all "linear" booleans. - change gimp-babl functions to take babl spaces and GimpTRCType parameters and support all sorts of new perceptual ~ formats. - a lot of places changed in the early days of goat invasion didn't take advantage of gimp-babl utility functions and constructed formats manually. They all needed revisiting and many now use much simpler code calling gimp-babl API. - change gimp_babl_format_get_color_profile() to really extract a newly allocated color profile from the format, and add gimp_babl_get_builtin_color_profile() which does the same as gimp_babl_format_get_color_profile() did before. Visited all callers to decide whether they are looking for the format's actual profile, or for one of the builtin profiles, simplifying code that only needs builtin profiles. - drawables have a new get_space_api(), get_linear() is now get_trc(). - images now have a "layer space" and an API to get it, gimp_image_get_layer_format() returns formats in that space. - an image's layer space is created from the image's color profile, change gimpimage-color-profile to deal with that correctly - change many babl_format() calls to babl_format_with_space() and take the space from passed formats or drawables - add function gimp_layer_fix_format_space() which replaces the layer's buffer with one that has the image's layer format, but doesn't change pixel values - use gimp_layer_fix_format_space() to make sure layers loaded from XCF and created by plug-ins have the right space when added to the image, because it's impossible to always assign the right space upon layer creation - "assign color profile" and "discard color profile" now require use of gimp_layer_fix_format_space() too because the profile is now embedded in all formats via the space. Add gimp_image_assign_color_profile() which does all that and call it instead of a simple gimp_image_set_color_profile(), also from the PDB set-color-profile functions, which are essentially "assign" and "discard" calls. - generally, make sure a new image's color profile is set before adding layers to it, gimp_image_set_color_profile() is more than before considered know-what-you-are-doing API. - take special precaution in all places that call gimp_drawable_convert_type(), we now must pass a new_profile from all callers that convert layers within the same image (such as image_convert_type, image_convert_precision), because the layer's new space can't be determined from the image's layer format during the call. - change all "linear" properties to "trc", in all config objects like for levels and curves, in the histogram, in the widgets. This results in some GUI that now has three choices instead of two. TODO: we might want to reduce that back to two later. - keep "linear" boolean properties around as compat if needed for file pasring, but always convert the parsed parsed boolean to GimpTRCType. - TODO: the image's "enable color management" switch is currently broken, will fix that in another commit.
2018-07-21 20:23:01 +08:00
/* EEK SPACE _gimp_drawable_get_format() only returns the encoding,
* needs to create the actual space from the image's profile
*/
if (format_str)
{
if (gimp_drawable_is_indexed (drawable_ID))
{
gint32 image_ID = gimp_item_get_image (drawable_ID);
guchar *colormap;
gint n_colors;
colormap = gimp_image_get_colormap (image_ID, &n_colors);
if (!palette_formats)
palette_formats = g_hash_table_new (g_str_hash, g_str_equal);
format = g_hash_table_lookup (palette_formats, format_str);
if (!format)
{
const Babl *palette;
const Babl *palette_alpha;
babl_new_palette (format_str, &palette, &palette_alpha);
g_hash_table_insert (palette_formats,
(gpointer) babl_get_name (palette),
(gpointer) palette);
g_hash_table_insert (palette_formats,
(gpointer) babl_get_name (palette_alpha),
(gpointer) palette_alpha);
if (gimp_drawable_has_alpha (drawable_ID))
format = palette_alpha;
else
format = palette;
}
if (colormap)
{
babl_palette_set_palette (format,
babl_format ("R'G'B' u8"),
colormap, n_colors);
g_free (colormap);
}
}
else
{
format = babl_format (format_str);
}
g_free (format_str);
}
return format;
}