summaryrefslogtreecommitdiffstats
path: root/libgimp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:30:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:30:19 +0000
commit5c1676dfe6d2f3c837a5e074117b45613fd29a72 (patch)
treecbffb45144febf451e54061db2b21395faf94bfe /libgimp
parentInitial commit. (diff)
downloadgimp-5c1676dfe6d2f3c837a5e074117b45613fd29a72.tar.xz
gimp-5c1676dfe6d2f3c837a5e074117b45613fd29a72.zip
Adding upstream version 2.10.34.upstream/2.10.34upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libgimp')
-rw-r--r--libgimp/COPYING165
-rw-r--r--libgimp/Makefile.am488
-rw-r--r--libgimp/Makefile.in1936
-rw-r--r--libgimp/gimp.c2588
-rw-r--r--libgimp/gimp.def939
-rw-r--r--libgimp/gimp.h372
-rw-r--r--libgimp/gimp_pdb.c263
-rw-r--r--libgimp/gimp_pdb.h46
-rw-r--r--libgimp/gimp_pdb_headers.h87
-rw-r--r--libgimp/gimpaspectpreview.c483
-rw-r--r--libgimp/gimpaspectpreview.h75
-rw-r--r--libgimp/gimpbrush_pdb.c864
-rw-r--r--libgimp/gimpbrush_pdb.h82
-rw-r--r--libgimp/gimpbrushes.c94
-rw-r--r--libgimp/gimpbrushes.h45
-rw-r--r--libgimp/gimpbrushes_pdb.c256
-rw-r--r--libgimp/gimpbrushes_pdb.h59
-rw-r--r--libgimp/gimpbrushmenu.c168
-rw-r--r--libgimp/gimpbrushmenu.h55
-rw-r--r--libgimp/gimpbrushselect.c240
-rw-r--r--libgimp/gimpbrushselect.h54
-rw-r--r--libgimp/gimpbrushselect_pdb.c149
-rw-r--r--libgimp/gimpbrushselect_pdb.h51
-rw-r--r--libgimp/gimpbrushselectbutton.c932
-rw-r--r--libgimp/gimpbrushselectbutton.h94
-rw-r--r--libgimp/gimpbuffer_pdb.c276
-rw-r--r--libgimp/gimpbuffer_pdb.h48
-rw-r--r--libgimp/gimpchannel.c61
-rw-r--r--libgimp/gimpchannel.h44
-rw-r--r--libgimp/gimpchannel_pdb.c396
-rw-r--r--libgimp/gimpchannel_pdb.h64
-rw-r--r--libgimp/gimpcolor_pdb.c611
-rw-r--r--libgimp/gimpcolor_pdb.h111
-rw-r--r--libgimp/gimpcontext_pdb.c3812
-rw-r--r--libgimp/gimpcontext_pdb.h161
-rw-r--r--libgimp/gimpdebug_pdb.c105
-rw-r--r--libgimp/gimpdebug_pdb.h41
-rw-r--r--libgimp/gimpdisplay_pdb.c237
-rw-r--r--libgimp/gimpdisplay_pdb.h46
-rw-r--r--libgimp/gimpdrawable.c822
-rw-r--r--libgimp/gimpdrawable.h142
-rw-r--r--libgimp/gimpdrawable_pdb.c1043
-rw-r--r--libgimp/gimpdrawable_pdb.h113
-rw-r--r--libgimp/gimpdrawablecolor_pdb.c780
-rw-r--r--libgimp/gimpdrawablecolor_pdb.h110
-rw-r--r--libgimp/gimpdrawableedit_pdb.c320
-rw-r--r--libgimp/gimpdrawableedit_pdb.h60
-rw-r--r--libgimp/gimpdrawablepreview.c757
-rw-r--r--libgimp/gimpdrawablepreview.h93
-rw-r--r--libgimp/gimpdrawabletransform_pdb.c917
-rw-r--r--libgimp/gimpdrawabletransform_pdb.h205
-rw-r--r--libgimp/gimpdynamics_pdb.c113
-rw-r--r--libgimp/gimpdynamics_pdb.h42
-rw-r--r--libgimp/gimpedit.c67
-rw-r--r--libgimp/gimpedit.h41
-rw-r--r--libgimp/gimpedit_pdb.c781
-rw-r--r--libgimp/gimpedit_pdb.h102
-rw-r--r--libgimp/gimpenums.c541
-rw-r--r--libgimp/gimpenums.c.tail205
-rw-r--r--libgimp/gimpenums.h170
-rw-r--r--libgimp/gimpexport.c1157
-rw-r--r--libgimp/gimpexport.h93
-rw-r--r--libgimp/gimpfileops_pdb.c550
-rw-r--r--libgimp/gimpfileops_pdb.h74
-rw-r--r--libgimp/gimpfloatingsel_pdb.c227
-rw-r--r--libgimp/gimpfloatingsel_pdb.h50
-rw-r--r--libgimp/gimpfontmenu.c142
-rw-r--r--libgimp/gimpfontmenu.h49
-rw-r--r--libgimp/gimpfonts_pdb.c109
-rw-r--r--libgimp/gimpfonts_pdb.h42
-rw-r--r--libgimp/gimpfontselect.c208
-rw-r--r--libgimp/gimpfontselect.h45
-rw-r--r--libgimp/gimpfontselect_pdb.c131
-rw-r--r--libgimp/gimpfontselect_pdb.h45
-rw-r--r--libgimp/gimpfontselectbutton.c471
-rw-r--r--libgimp/gimpfontselectbutton.h79
-rw-r--r--libgimp/gimpgimprc.c60
-rw-r--r--libgimp/gimpgimprc.h38
-rw-r--r--libgimp/gimpgimprc_pdb.c330
-rw-r--r--libgimp/gimpgimprc_pdb.h52
-rw-r--r--libgimp/gimpgradient_pdb.c1320
-rw-r--r--libgimp/gimpgradient_pdb.h139
-rw-r--r--libgimp/gimpgradientmenu.c148
-rw-r--r--libgimp/gimpgradientmenu.h49
-rw-r--r--libgimp/gimpgradients.c53
-rw-r--r--libgimp/gimpgradients.h39
-rw-r--r--libgimp/gimpgradients_pdb.c237
-rw-r--r--libgimp/gimpgradients_pdb.h55
-rw-r--r--libgimp/gimpgradientselect.c225
-rw-r--r--libgimp/gimpgradientselect.h48
-rw-r--r--libgimp/gimpgradientselect_pdb.c134
-rw-r--r--libgimp/gimpgradientselect_pdb.h46
-rw-r--r--libgimp/gimpgradientselectbutton.c628
-rw-r--r--libgimp/gimpgradientselectbutton.h81
-rw-r--r--libgimp/gimphelp_pdb.c72
-rw-r--r--libgimp/gimphelp_pdb.h41
-rw-r--r--libgimp/gimpimage.c520
-rw-r--r--libgimp/gimpimage.h116
-rw-r--r--libgimp/gimpimage_pdb.c3223
-rw-r--r--libgimp/gimpimage_pdb.h214
-rw-r--r--libgimp/gimpimagecolorprofile.c173
-rw-r--r--libgimp/gimpimagecolorprofile.h47
-rw-r--r--libgimp/gimpimagecolorprofile_pdb.c292
-rw-r--r--libgimp/gimpimagecolorprofile_pdb.h57
-rw-r--r--libgimp/gimpimagecombobox.c272
-rw-r--r--libgimp/gimpimagecombobox.h51
-rw-r--r--libgimp/gimpimageconvert_pdb.c233
-rw-r--r--libgimp/gimpimageconvert_pdb.h54
-rw-r--r--libgimp/gimpimagegrid_pdb.c408
-rw-r--r--libgimp/gimpimagegrid_pdb.h62
-rw-r--r--libgimp/gimpimageguides_pdb.c243
-rw-r--r--libgimp/gimpimageguides_pdb.h51
-rw-r--r--libgimp/gimpimagemetadata.c1204
-rw-r--r--libgimp/gimpimagemetadata.h61
-rw-r--r--libgimp/gimpimagesamplepoints_pdb.c192
-rw-r--r--libgimp/gimpimagesamplepoints_pdb.h49
-rw-r--r--libgimp/gimpimageselect_pdb.c417
-rw-r--r--libgimp/gimpimageselect_pdb.h75
-rw-r--r--libgimp/gimpimagetransform_pdb.c303
-rw-r--r--libgimp/gimpimagetransform_pdb.h62
-rw-r--r--libgimp/gimpimageundo_pdb.c276
-rw-r--r--libgimp/gimpimageundo_pdb.h46
-rw-r--r--libgimp/gimpitem_pdb.c1152
-rw-r--r--libgimp/gimpitem_pdb.h85
-rw-r--r--libgimp/gimpitemcombobox.c589
-rw-r--r--libgimp/gimpitemcombobox.h77
-rw-r--r--libgimp/gimpitemtransform_pdb.c697
-rw-r--r--libgimp/gimpitemtransform_pdb.h96
-rw-r--r--libgimp/gimplayer.c415
-rw-r--r--libgimp/gimplayer.h63
-rw-r--r--libgimp/gimplayer_pdb.c1354
-rw-r--r--libgimp/gimplayer_pdb.h115
-rw-r--r--libgimp/gimpmenu.c509
-rw-r--r--libgimp/gimpmenu.h68
-rw-r--r--libgimp/gimpmessage_pdb.c126
-rw-r--r--libgimp/gimpmessage_pdb.h42
-rw-r--r--libgimp/gimppainttools_pdb.c775
-rw-r--r--libgimp/gimppainttools_pdb.h109
-rw-r--r--libgimp/gimppalette.c130
-rw-r--r--libgimp/gimppalette.h47
-rw-r--r--libgimp/gimppalette_pdb.c591
-rw-r--r--libgimp/gimppalette_pdb.h70
-rw-r--r--libgimp/gimppalettemenu.c148
-rw-r--r--libgimp/gimppalettemenu.h49
-rw-r--r--libgimp/gimppalettes.c38
-rw-r--r--libgimp/gimppalettes.h37
-rw-r--r--libgimp/gimppalettes_pdb.c178
-rw-r--r--libgimp/gimppalettes_pdb.h49
-rw-r--r--libgimp/gimppaletteselect.c212
-rw-r--r--libgimp/gimppaletteselect.h45
-rw-r--r--libgimp/gimppaletteselect_pdb.c131
-rw-r--r--libgimp/gimppaletteselect_pdb.h45
-rw-r--r--libgimp/gimppaletteselectbutton.c488
-rw-r--r--libgimp/gimppaletteselectbutton.h79
-rw-r--r--libgimp/gimppaths_pdb.c560
-rw-r--r--libgimp/gimppaths_pdb.h99
-rw-r--r--libgimp/gimppattern_pdb.c147
-rw-r--r--libgimp/gimppattern_pdb.h49
-rw-r--r--libgimp/gimppatternmenu.c151
-rw-r--r--libgimp/gimppatternmenu.h49
-rw-r--r--libgimp/gimppatterns.c40
-rw-r--r--libgimp/gimppatterns.h37
-rw-r--r--libgimp/gimppatterns_pdb.c194
-rw-r--r--libgimp/gimppatterns_pdb.h52
-rw-r--r--libgimp/gimppatternselect.c230
-rw-r--r--libgimp/gimppatternselect.h49
-rw-r--r--libgimp/gimppatternselect_pdb.c131
-rw-r--r--libgimp/gimppatternselect_pdb.h45
-rw-r--r--libgimp/gimppatternselectbutton.c730
-rw-r--r--libgimp/gimppatternselectbutton.h83
-rw-r--r--libgimp/gimppixbuf.c302
-rw-r--r--libgimp/gimppixbuf.h70
-rw-r--r--libgimp/gimppixelfetcher.c334
-rw-r--r--libgimp/gimppixelfetcher.h76
-rw-r--r--libgimp/gimppixelrgn.c965
-rw-r--r--libgimp/gimppixelrgn.h122
-rw-r--r--libgimp/gimpplugin.c71
-rw-r--r--libgimp/gimpplugin.h44
-rw-r--r--libgimp/gimpplugin_pdb.c357
-rw-r--r--libgimp/gimpplugin_pdb.h55
-rw-r--r--libgimp/gimpprocbrowserdialog.c546
-rw-r--r--libgimp/gimpprocbrowserdialog.h82
-rw-r--r--libgimp/gimpproceduraldb.c173
-rw-r--r--libgimp/gimpproceduraldb.h53
-rw-r--r--libgimp/gimpproceduraldb_pdb.c501
-rw-r--r--libgimp/gimpproceduraldb_pdb.h77
-rw-r--r--libgimp/gimpprocview.c339
-rw-r--r--libgimp/gimpprocview.h50
-rw-r--r--libgimp/gimpprogress.c452
-rw-r--r--libgimp/gimpprogress.h94
-rw-r--r--libgimp/gimpprogress_pdb.c324
-rw-r--r--libgimp/gimpprogress_pdb.h49
-rw-r--r--libgimp/gimpprogressbar.c230
-rw-r--r--libgimp/gimpprogressbar.h69
-rw-r--r--libgimp/gimpregioniterator.c397
-rw-r--r--libgimp/gimpregioniterator.h95
-rw-r--r--libgimp/gimpselectbutton.c95
-rw-r--r--libgimp/gimpselectbutton.h76
-rw-r--r--libgimp/gimpselection.c66
-rw-r--r--libgimp/gimpselection.h45
-rw-r--r--libgimp/gimpselection_pdb.c650
-rw-r--r--libgimp/gimpselection_pdb.h76
-rw-r--r--libgimp/gimpselectiontools_pdb.c461
-rw-r--r--libgimp/gimpselectiontools_pdb.h123
-rw-r--r--libgimp/gimptextlayer_pdb.c1127
-rw-r--r--libgimp/gimptextlayer_pdb.h97
-rw-r--r--libgimp/gimptexttool_pdb.c324
-rw-r--r--libgimp/gimptexttool_pdb.h91
-rw-r--r--libgimp/gimptile.c433
-rw-r--r--libgimp/gimptile.h73
-rw-r--r--libgimp/gimptilebackendplugin.c313
-rw-r--r--libgimp/gimptilebackendplugin.h59
-rw-r--r--libgimp/gimptransformtools_pdb.c287
-rw-r--r--libgimp/gimptransformtools_pdb.h79
-rw-r--r--libgimp/gimptypes.h82
-rw-r--r--libgimp/gimpui.c505
-rw-r--r--libgimp/gimpui.def90
-rw-r--r--libgimp/gimpui.h72
-rw-r--r--libgimp/gimpuimarshal.c261
-rw-r--r--libgimp/gimpuimarshal.h48
-rw-r--r--libgimp/gimpuimarshal.list28
-rw-r--r--libgimp/gimpuitypes.h53
-rw-r--r--libgimp/gimpunit_pdb.c427
-rw-r--r--libgimp/gimpunit_pdb.h58
-rw-r--r--libgimp/gimpunitcache.c236
-rw-r--r--libgimp/gimpunitcache.h52
-rw-r--r--libgimp/gimpvectors.c271
-rw-r--r--libgimp/gimpvectors.h73
-rw-r--r--libgimp/gimpvectors_pdb.c1191
-rw-r--r--libgimp/gimpvectors_pdb.h151
-rw-r--r--libgimp/gimpzoompreview.c1013
-rw-r--r--libgimp/gimpzoompreview.h95
-rw-r--r--libgimp/libgimp-intl.h45
-rw-r--r--libgimp/stdplugins-intl.h42
234 files changed, 66440 insertions, 0 deletions
diff --git a/libgimp/COPYING b/libgimp/COPYING
new file mode 100644
index 0000000..804fcb1
--- /dev/null
+++ b/libgimp/COPYING
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/libgimp/Makefile.am b/libgimp/Makefile.am
new file mode 100644
index 0000000..6e0a9e2
--- /dev/null
+++ b/libgimp/Makefile.am
@@ -0,0 +1,488 @@
+## Process this file with automake to produce Makefile.in
+
+libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
+libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
+libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
+libgimpmodule = $(top_builddir)/libgimpmodule/libgimpmodule-$(GIMP_API_VERSION).la
+libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la
+libgimp = ./libgimp-$(GIMP_API_VERSION).la
+
+if PLATFORM_WIN32
+no_undefined = -no-undefined
+endif
+
+if PLATFORM_OSX
+xobjective_c = "-xobjective-c"
+xobjective_cxx = "-xobjective-c++"
+xnone = "-xnone"
+framework_cocoa = -framework Cocoa
+endif
+
+if OS_WIN32
+if HAVE_EXCHNDL
+exchndl = -lexchndl
+endif
+
+gimp_def = gimp.def
+gimpui_def = gimpui.def
+libgimp_export_symbols = -export-symbols $(srcdir)/gimp.def
+libgimpui_export_symbols = -export-symbols $(srcdir)/gimpui.def
+
+install-libtool-import-lib:
+ $(INSTALL) .libs/libgimp-$(GIMP_API_VERSION).dll.a $(DESTDIR)$(libdir)
+ $(INSTALL) .libs/libgimpui-$(GIMP_API_VERSION).dll.a $(DESTDIR)$(libdir)
+ $(INSTALL) $(srcdir)/gimp.def $(DESTDIR)$(libdir)
+ $(INSTALL) $(srcdir)/gimpui.def $(DESTDIR)$(libdir)
+
+uninstall-libtool-import-lib:
+ -rm $(DESTDIR)$(libdir)/libgimp-$(GIMP_API_VERSION).dll.a
+ -rm $(DESTDIR)$(libdir)/libgimpui-$(GIMP_API_VERSION).dll.a
+ -rm $(DESTDIR)$(libdir)/gimp.def
+ -rm $(DESTDIR)$(libdir)/gimpui.def
+else
+install-libtool-import-lib:
+uninstall-libtool-import-lib:
+endif
+
+if MS_LIB_AVAILABLE
+noinst_DATA = gimp-$(GIMP_API_VERSION).lib gimpui-$(GIMP_API_VERSION).lib
+
+install-ms-lib:
+ $(INSTALL) gimp-$(GIMP_API_VERSION).lib $(DESTDIR)$(libdir)
+ $(INSTALL) gimpui-$(GIMP_API_VERSION).lib $(DESTDIR)$(libdir)
+
+uninstall-ms-lib:
+ -rm $(DESTDIR)$(libdir)/gimp-$(GIMP_API_VERSION).lib
+ -rm $(DESTDIR)$(libdir)/gimpui-$(GIMP_API_VERSION).lib
+
+gimp-@GIMP_API_VERSION@.lib: gimp.def
+ lib -name:libgimp-$(GIMP_API_VERSION)-@LT_CURRENT_MINUS_AGE@.dll -def:gimp.def -out:$@
+
+gimpui-@GIMP_API_VERSION@.lib: gimpui.def
+ lib -name:libgimpui-$(GIMP_API_VERSION)-@LT_CURRENT_MINUS_AGE@.dll -def:gimpui.def -out:$@
+
+else
+install-ms-lib:
+uninstall-ms-lib:
+endif
+
+gimpincludedir = $(includedir)/gimp-$(GIMP_API_VERSION)/libgimp
+
+AM_CPPFLAGS = \
+ -DGIMPDIR=\""$(gimpdir)"\" \
+ -DGIMP_USER_VERSION=\"$(GIMP_USER_VERSION)\" \
+ -DG_LOG_DOMAIN=\"LibGimp\" \
+ -DGIMP_COMPILATION \
+ -I$(top_srcdir) \
+ $(GTK_CFLAGS) \
+ $(GEGL_CFLAGS) \
+ $(GEXIV2_CFLAGS) \
+ -I$(includedir)
+
+AM_CFLAGS = \
+ $(xobjective_c)
+
+AM_CXXFLAGS = \
+ $(xobjective_cxx)
+
+AM_LDFLAGS = \
+ $(xnone)
+
+lib_LTLIBRARIES = libgimp-@GIMP_API_VERSION@.la libgimpui-@GIMP_API_VERSION@.la
+
+PDB_WRAPPERS_C = \
+ gimp_pdb.c \
+ gimpbrush_pdb.c \
+ gimpbrushes_pdb.c \
+ gimpbrushselect_pdb.c \
+ gimpbuffer_pdb.c \
+ gimpchannel_pdb.c \
+ gimpcolor_pdb.c \
+ gimpcontext_pdb.c \
+ gimpdebug_pdb.c \
+ gimpdisplay_pdb.c \
+ gimpdrawable_pdb.c \
+ gimpdrawablecolor_pdb.c \
+ gimpdrawableedit_pdb.c \
+ gimpdrawabletransform_pdb.c \
+ gimpdynamics_pdb.c \
+ gimpedit_pdb.c \
+ gimpfileops_pdb.c \
+ gimpfloatingsel_pdb.c \
+ gimpfonts_pdb.c \
+ gimpfontselect_pdb.c \
+ gimpgimprc_pdb.c \
+ gimpgradient_pdb.c \
+ gimpgradients_pdb.c \
+ gimpgradientselect_pdb.c \
+ gimphelp_pdb.c \
+ gimpimage_pdb.c \
+ gimpimagecolorprofile_pdb.c \
+ gimpimageconvert_pdb.c \
+ gimpimagegrid_pdb.c \
+ gimpimageguides_pdb.c \
+ gimpimagesamplepoints_pdb.c \
+ gimpimageselect_pdb.c \
+ gimpimagetransform_pdb.c \
+ gimpimageundo_pdb.c \
+ gimpitem_pdb.c \
+ gimpitemtransform_pdb.c \
+ gimplayer_pdb.c \
+ gimpmessage_pdb.c \
+ gimppainttools_pdb.c \
+ gimppalette_pdb.c \
+ gimppalettes_pdb.c \
+ gimppaletteselect_pdb.c \
+ gimppaths_pdb.c \
+ gimppattern_pdb.c \
+ gimppatterns_pdb.c \
+ gimppatternselect_pdb.c \
+ gimpplugin_pdb.c \
+ gimpproceduraldb_pdb.c \
+ gimpprogress_pdb.c \
+ gimpselection_pdb.c \
+ gimpselectiontools_pdb.c \
+ gimptextlayer_pdb.c \
+ gimptexttool_pdb.c \
+ gimptransformtools_pdb.c \
+ gimpunit_pdb.c \
+ gimpvectors_pdb.c
+
+PDB_WRAPPERS_H = \
+ gimp_pdb_headers.h \
+ gimp_pdb.h \
+ gimpbrush_pdb.h \
+ gimpbrushes_pdb.h \
+ gimpbrushselect_pdb.h \
+ gimpbuffer_pdb.h \
+ gimpchannel_pdb.h \
+ gimpcolor_pdb.h \
+ gimpcontext_pdb.h \
+ gimpdebug_pdb.h \
+ gimpdisplay_pdb.h \
+ gimpdrawable_pdb.h \
+ gimpdrawablecolor_pdb.h \
+ gimpdrawableedit_pdb.h \
+ gimpdrawabletransform_pdb.h \
+ gimpdynamics_pdb.h \
+ gimpedit_pdb.h \
+ gimpfileops_pdb.h \
+ gimpfloatingsel_pdb.h \
+ gimpfonts_pdb.h \
+ gimpfontselect_pdb.h \
+ gimpgimprc_pdb.h \
+ gimpgradient_pdb.h \
+ gimpgradients_pdb.h \
+ gimpgradientselect_pdb.h \
+ gimphelp_pdb.h \
+ gimpimage_pdb.h \
+ gimpimagecolorprofile_pdb.h \
+ gimpimageconvert_pdb.h \
+ gimpimagegrid_pdb.h \
+ gimpimageguides_pdb.h \
+ gimpimagesamplepoints_pdb.h \
+ gimpimageselect_pdb.h \
+ gimpimagetransform_pdb.h \
+ gimpimageundo_pdb.h \
+ gimpitem_pdb.h \
+ gimpitemtransform_pdb.h \
+ gimplayer_pdb.h \
+ gimpmessage_pdb.h \
+ gimppainttools_pdb.h \
+ gimppalette_pdb.h \
+ gimppalettes_pdb.h \
+ gimppaletteselect_pdb.h \
+ gimppaths_pdb.h \
+ gimppattern_pdb.h \
+ gimppatterns_pdb.h \
+ gimppatternselect_pdb.h \
+ gimpplugin_pdb.h \
+ gimpproceduraldb_pdb.h \
+ gimpprogress_pdb.h \
+ gimpselection_pdb.h \
+ gimpselectiontools_pdb.h \
+ gimptextlayer_pdb.h \
+ gimptexttool_pdb.h \
+ gimptransformtools_pdb.h \
+ gimpunit_pdb.h \
+ gimpvectors_pdb.h
+
+libgimp_sources = \
+ gimp.c \
+ gimp.h \
+ gimptypes.h \
+ gimpenums.h \
+ ${PDB_WRAPPERS_C} \
+ ${PDB_WRAPPERS_H} \
+ gimpbrushes.c \
+ gimpbrushes.h \
+ gimpbrushselect.c \
+ gimpbrushselect.h \
+ gimpchannel.c \
+ gimpchannel.h \
+ gimpdrawable.c \
+ gimpdrawable.h \
+ gimpedit.c \
+ gimpedit.h \
+ gimpfontselect.c \
+ gimpfontselect.h \
+ gimpgimprc.c \
+ gimpgimprc.h \
+ gimpgradients.c \
+ gimpgradients.h \
+ gimpgradientselect.c \
+ gimpgradientselect.h \
+ gimpimage.c \
+ gimpimage.h \
+ gimpimagecolorprofile.c \
+ gimpimagecolorprofile.h \
+ gimplayer.c \
+ gimplayer.h \
+ gimppalette.c \
+ gimppalette.h \
+ gimppalettes.c \
+ gimppalettes.h \
+ gimppaletteselect.c \
+ gimppaletteselect.h \
+ gimppatterns.c \
+ gimppatterns.h \
+ gimppatternselect.c \
+ gimppatternselect.h \
+ gimppixbuf.c \
+ gimppixbuf.h \
+ gimppixelfetcher.c \
+ gimppixelfetcher.h \
+ gimppixelrgn.c \
+ gimppixelrgn.h \
+ gimpplugin.c \
+ gimpplugin.h \
+ gimpproceduraldb.c \
+ gimpproceduraldb.h \
+ gimpprogress.c \
+ gimpprogress.h \
+ gimpregioniterator.c \
+ gimpregioniterator.h \
+ gimpselection.c \
+ gimpselection.h \
+ gimptile.c \
+ gimptile.h \
+ gimptilebackendplugin.c \
+ gimptilebackendplugin.h \
+ gimpunitcache.c \
+ gimpunitcache.h \
+ gimpvectors.c \
+ gimpvectors.h \
+ stdplugins-intl.h \
+ libgimp-intl.h
+
+libgimp_built_sources = \
+ gimpenums.c
+
+libgimp_extra_sources = gimpenums.c.tail
+
+libgimp_@GIMP_API_VERSION@_la_SOURCES = \
+ $(libgimp_built_sources) \
+ $(libgimp_sources)
+
+libgimpui_sources = \
+ gimpui.c \
+ gimpui.h \
+ gimpuitypes.h \
+ gimpaspectpreview.c \
+ gimpaspectpreview.h \
+ gimpbrushmenu.c \
+ gimpbrushmenu.h \
+ gimpbrushselectbutton.c \
+ gimpbrushselectbutton.h \
+ gimpdrawablepreview.c \
+ gimpdrawablepreview.h \
+ gimpexport.c \
+ gimpexport.h \
+ gimpfontmenu.c \
+ gimpfontmenu.h \
+ gimpfontselectbutton.c \
+ gimpfontselectbutton.h \
+ gimpgradientmenu.c \
+ gimpgradientmenu.h \
+ gimpgradientselectbutton.c \
+ gimpgradientselectbutton.h \
+ gimpimagecombobox.c \
+ gimpimagecombobox.h \
+ gimpimagemetadata.c \
+ gimpimagemetadata.h \
+ gimpitemcombobox.c \
+ gimpitemcombobox.h \
+ gimpmenu.c \
+ gimpmenu.h \
+ gimppalettemenu.c \
+ gimppalettemenu.h \
+ gimppaletteselectbutton.c \
+ gimppaletteselectbutton.h \
+ gimppatternmenu.c \
+ gimppatternmenu.h \
+ gimppatternselectbutton.c \
+ gimppatternselectbutton.h \
+ gimpprocbrowserdialog.c \
+ gimpprocbrowserdialog.h \
+ gimpprocview.c \
+ gimpprocview.h \
+ gimpprogressbar.c \
+ gimpprogressbar.h \
+ gimpselectbutton.c \
+ gimpselectbutton.h \
+ gimpzoompreview.c \
+ gimpzoompreview.h
+
+libgimpui_built_sources = \
+ gimpuimarshal.c \
+ gimpuimarshal.h
+
+libgimpui_extra_sources = gimpuimarshal.list
+
+libgimpui_@GIMP_API_VERSION@_la_SOURCES = \
+ $(libgimpui_built_sources) \
+ $(libgimpui_sources)
+
+gimpinclude_HEADERS = \
+ gimp.h \
+ gimptypes.h \
+ gimpenums.h \
+ ${PDB_WRAPPERS_H} \
+ gimpbrushes.h \
+ gimpbrushselect.h \
+ gimpchannel.h \
+ gimpdrawable.h \
+ gimpedit.h \
+ gimpfontselect.h \
+ gimpgimprc.h \
+ gimpgradients.h \
+ gimpgradientselect.h \
+ gimpimage.h \
+ gimpimagecolorprofile.h \
+ gimplayer.h \
+ gimppalette.h \
+ gimppalettes.h \
+ gimppaletteselect.h \
+ gimppatterns.h \
+ gimppatternselect.h \
+ gimppixelfetcher.h \
+ gimppixelrgn.h \
+ gimpplugin.h \
+ gimpproceduraldb.h \
+ gimpprogress.h \
+ gimpregioniterator.h \
+ gimpselection.h \
+ gimptile.h \
+ gimpvectors.h \
+ \
+ gimpui.h \
+ gimpuitypes.h \
+ gimpaspectpreview.h \
+ gimpbrushmenu.h \
+ gimpbrushselectbutton.h \
+ gimpdrawablepreview.h \
+ gimpexport.h \
+ gimpfontmenu.h \
+ gimpfontselectbutton.h \
+ gimpgradientmenu.h \
+ gimpgradientselectbutton.h \
+ gimpimagecombobox.h \
+ gimpimagemetadata.h \
+ gimpitemcombobox.h \
+ gimpmenu.h \
+ gimppalettemenu.h \
+ gimppaletteselectbutton.h \
+ gimppatternmenu.h \
+ gimppatternselectbutton.h \
+ gimppixbuf.h \
+ gimpprocbrowserdialog.h \
+ gimpprocview.h \
+ gimpprogressbar.h \
+ gimpselectbutton.h \
+ gimpzoompreview.h
+
+libgimp_@GIMP_API_VERSION@_la_LDFLAGS = \
+ -version-info $(LT_VERSION_INFO) \
+ $(no_undefined) \
+ $(libgimp_export_symbols) \
+ $(framework_cocoa) \
+ $(xnone)
+
+EXTRA_libgimp_@GIMP_API_VERSION@_la_DEPENDENCIES = $(gimp_def)
+
+libgimp_@GIMP_API_VERSION@_la_LIBADD = \
+ $(libgimpconfig) \
+ $(libgimpcolor) \
+ $(libgimpbase) \
+ $(exchndl) \
+ $(CAIRO_LIBS) \
+ $(GEGL_LIBS) \
+ $(GDK_PIXBUF_LIBS) \
+ $(RT_LIBS)
+
+libgimpui_@GIMP_API_VERSION@_la_LDFLAGS = \
+ -version-info $(LT_VERSION_INFO) \
+ $(no_undefined) \
+ $(libgimpui_export_symbols) \
+ $(framework_cocoa) \
+ $(xnone)
+
+EXTRA_libgimpui_@GIMP_API_VERSION@_la_DEPENDENCIES = $(gimpui_def)
+
+libgimpui_@GIMP_API_VERSION@_la_LIBADD = \
+ $(libgimp) \
+ $(libgimpwidgets) \
+ $(libgimpcolor) \
+ $(libgimpbase) \
+ $(libgimpmodule) \
+ $(GEGL_LIBS) \
+ $(GTK_LIBS) \
+ $(GEXIV2_LIBS) \
+ $(RT_LIBS)
+
+BUILT_SOURCES = \
+ $(libgimp_built_sources) \
+ $(libgimpui_built_sources)
+
+EXTRA_DIST = \
+ COPYING \
+ gimp.def \
+ gimpui.def \
+ $(libgimp_extra_sources) \
+ $(libgimpui_extra_sources)
+
+install-data-local: install-ms-lib install-libtool-import-lib
+
+uninstall-local: uninstall-ms-lib uninstall-libtool-import-lib
+
+#
+# rules to generate built sources
+#
+# setup autogeneration dependencies
+gen_sources = xgen-cec xgen-umh xgen-umc
+CLEANFILES = $(gen_sources)
+
+gimpenums.c: $(srcdir)/gimpenums.h $(srcdir)/gimpenums.c.tail $(GIMP_MKENUMS) Makefile.am
+ $(AM_V_GEN) $(GIMP_MKENUMS) \
+ --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include <gegl.h>\n#undef GIMP_DISABLE_DEPRECATED\n#include \"libgimpbase/gimpbase.h\"\n#include \"libgimpbase/gimpbase-private.h\"\n#include \"libgimpconfig/gimpconfigenums.h\"\n#include \"gimpenums.h\"" \
+ --fprod "\n/* enumerations from \"@filename@\" */" \
+ --vhead "GType\n@enum_name@_get_type (void)\n{\n static const G@Type@Value values[] =\n {" \
+ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+ --vtail " { 0, NULL, NULL }\n };\n" \
+ --dhead " static const Gimp@Type@Desc descs[] =\n {" \
+ --dprod " { @VALUENAME@, @valuedesc@, @valuehelp@ },@if ('@valueabbrev@' ne 'NULL')@\n /* Translators: this is an abbreviated version of @valueudesc@.\n Keep it short. */\n { @VALUENAME@, @valueabbrev@, NULL },@endif@" \
+ --dtail " { 0, NULL, NULL }\n };\n\n static GType type = 0;\n\n if (G_UNLIKELY (! type))\n {\n type = g_@type@_register_static (\"@EnumName@\", values);\n gimp_type_set_translation_domain (type, GETTEXT_PACKAGE \"-libgimp\");\n gimp_type_set_translation_context (type, \"@enumnick@\");\n gimp_@type@_set_value_descriptions (type, descs);\n }\n\n return type;\n}\n" \
+ $< > xgen-cec \
+ && cat $(srcdir)/gimpenums.c.tail >> xgen-cec \
+ && cp xgen-cec $(@F) \
+ && rm -f xgen-cec
+
+gimpuimarshal.h: $(srcdir)/gimpuimarshal.list
+ $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_gimpui_marshal $(srcdir)/gimpuimarshal.list --header >> xgen-umh \
+ && (cmp -s xgen-umh $(@F) || cp xgen-umh $(@F)) \
+ && rm -f xgen-umh xgen-umh~
+
+gimpuimarshal.c: gimpuimarshal.h
+ $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_gimpui_marshal $(srcdir)/gimpuimarshal.list --header --body >> xgen-umc \
+ && cp xgen-umc $(@F) \
+ && rm -f xgen-umc xgen-umc~
diff --git a/libgimp/Makefile.in b/libgimp/Makefile.in
new file mode 100644
index 0000000..c34a1cf
--- /dev/null
+++ b/libgimp/Makefile.in
@@ -0,0 +1,1936 @@
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = libgimp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/m4macros/alsa.m4 \
+ $(top_srcdir)/m4macros/ax_compare_version.m4 \
+ $(top_srcdir)/m4macros/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4macros/ax_gcc_func_attribute.m4 \
+ $(top_srcdir)/m4macros/ax_prog_cc_for_build.m4 \
+ $(top_srcdir)/m4macros/ax_prog_perl_version.m4 \
+ $(top_srcdir)/m4macros/detectcflags.m4 \
+ $(top_srcdir)/m4macros/pythondev.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(gimpinclude_HEADERS) \
+ $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(gimpincludedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libgimp_@GIMP_API_VERSION@_la_DEPENDENCIES = $(libgimpconfig) \
+ $(libgimpcolor) $(libgimpbase) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am__objects_1 = gimpenums.lo
+am__objects_2 = gimp_pdb.lo gimpbrush_pdb.lo gimpbrushes_pdb.lo \
+ gimpbrushselect_pdb.lo gimpbuffer_pdb.lo gimpchannel_pdb.lo \
+ gimpcolor_pdb.lo gimpcontext_pdb.lo gimpdebug_pdb.lo \
+ gimpdisplay_pdb.lo gimpdrawable_pdb.lo \
+ gimpdrawablecolor_pdb.lo gimpdrawableedit_pdb.lo \
+ gimpdrawabletransform_pdb.lo gimpdynamics_pdb.lo \
+ gimpedit_pdb.lo gimpfileops_pdb.lo gimpfloatingsel_pdb.lo \
+ gimpfonts_pdb.lo gimpfontselect_pdb.lo gimpgimprc_pdb.lo \
+ gimpgradient_pdb.lo gimpgradients_pdb.lo \
+ gimpgradientselect_pdb.lo gimphelp_pdb.lo gimpimage_pdb.lo \
+ gimpimagecolorprofile_pdb.lo gimpimageconvert_pdb.lo \
+ gimpimagegrid_pdb.lo gimpimageguides_pdb.lo \
+ gimpimagesamplepoints_pdb.lo gimpimageselect_pdb.lo \
+ gimpimagetransform_pdb.lo gimpimageundo_pdb.lo gimpitem_pdb.lo \
+ gimpitemtransform_pdb.lo gimplayer_pdb.lo gimpmessage_pdb.lo \
+ gimppainttools_pdb.lo gimppalette_pdb.lo gimppalettes_pdb.lo \
+ gimppaletteselect_pdb.lo gimppaths_pdb.lo gimppattern_pdb.lo \
+ gimppatterns_pdb.lo gimppatternselect_pdb.lo gimpplugin_pdb.lo \
+ gimpproceduraldb_pdb.lo gimpprogress_pdb.lo \
+ gimpselection_pdb.lo gimpselectiontools_pdb.lo \
+ gimptextlayer_pdb.lo gimptexttool_pdb.lo \
+ gimptransformtools_pdb.lo gimpunit_pdb.lo gimpvectors_pdb.lo
+am__objects_3 =
+am__objects_4 = gimp.lo $(am__objects_2) $(am__objects_3) \
+ gimpbrushes.lo gimpbrushselect.lo gimpchannel.lo \
+ gimpdrawable.lo gimpedit.lo gimpfontselect.lo gimpgimprc.lo \
+ gimpgradients.lo gimpgradientselect.lo gimpimage.lo \
+ gimpimagecolorprofile.lo gimplayer.lo gimppalette.lo \
+ gimppalettes.lo gimppaletteselect.lo gimppatterns.lo \
+ gimppatternselect.lo gimppixbuf.lo gimppixelfetcher.lo \
+ gimppixelrgn.lo gimpplugin.lo gimpproceduraldb.lo \
+ gimpprogress.lo gimpregioniterator.lo gimpselection.lo \
+ gimptile.lo gimptilebackendplugin.lo gimpunitcache.lo \
+ gimpvectors.lo
+am_libgimp_@GIMP_API_VERSION@_la_OBJECTS = $(am__objects_1) \
+ $(am__objects_4)
+libgimp_@GIMP_API_VERSION@_la_OBJECTS = \
+ $(am_libgimp_@GIMP_API_VERSION@_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+libgimp_@GIMP_API_VERSION@_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) \
+ $(libgimp_@GIMP_API_VERSION@_la_LDFLAGS) $(LDFLAGS) -o $@
+libgimpui_@GIMP_API_VERSION@_la_DEPENDENCIES = $(libgimp) \
+ $(libgimpwidgets) $(libgimpcolor) $(libgimpbase) \
+ $(libgimpmodule) $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am__objects_5 = gimpuimarshal.lo
+am__objects_6 = gimpui.lo gimpaspectpreview.lo gimpbrushmenu.lo \
+ gimpbrushselectbutton.lo gimpdrawablepreview.lo gimpexport.lo \
+ gimpfontmenu.lo gimpfontselectbutton.lo gimpgradientmenu.lo \
+ gimpgradientselectbutton.lo gimpimagecombobox.lo \
+ gimpimagemetadata.lo gimpitemcombobox.lo gimpmenu.lo \
+ gimppalettemenu.lo gimppaletteselectbutton.lo \
+ gimppatternmenu.lo gimppatternselectbutton.lo \
+ gimpprocbrowserdialog.lo gimpprocview.lo gimpprogressbar.lo \
+ gimpselectbutton.lo gimpzoompreview.lo
+am_libgimpui_@GIMP_API_VERSION@_la_OBJECTS = $(am__objects_5) \
+ $(am__objects_6)
+libgimpui_@GIMP_API_VERSION@_la_OBJECTS = \
+ $(am_libgimpui_@GIMP_API_VERSION@_la_OBJECTS)
+libgimpui_@GIMP_API_VERSION@_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) \
+ $(libgimpui_@GIMP_API_VERSION@_la_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/gimp.Plo ./$(DEPDIR)/gimp_pdb.Plo \
+ ./$(DEPDIR)/gimpaspectpreview.Plo \
+ ./$(DEPDIR)/gimpbrush_pdb.Plo ./$(DEPDIR)/gimpbrushes.Plo \
+ ./$(DEPDIR)/gimpbrushes_pdb.Plo ./$(DEPDIR)/gimpbrushmenu.Plo \
+ ./$(DEPDIR)/gimpbrushselect.Plo \
+ ./$(DEPDIR)/gimpbrushselect_pdb.Plo \
+ ./$(DEPDIR)/gimpbrushselectbutton.Plo \
+ ./$(DEPDIR)/gimpbuffer_pdb.Plo ./$(DEPDIR)/gimpchannel.Plo \
+ ./$(DEPDIR)/gimpchannel_pdb.Plo ./$(DEPDIR)/gimpcolor_pdb.Plo \
+ ./$(DEPDIR)/gimpcontext_pdb.Plo ./$(DEPDIR)/gimpdebug_pdb.Plo \
+ ./$(DEPDIR)/gimpdisplay_pdb.Plo ./$(DEPDIR)/gimpdrawable.Plo \
+ ./$(DEPDIR)/gimpdrawable_pdb.Plo \
+ ./$(DEPDIR)/gimpdrawablecolor_pdb.Plo \
+ ./$(DEPDIR)/gimpdrawableedit_pdb.Plo \
+ ./$(DEPDIR)/gimpdrawablepreview.Plo \
+ ./$(DEPDIR)/gimpdrawabletransform_pdb.Plo \
+ ./$(DEPDIR)/gimpdynamics_pdb.Plo ./$(DEPDIR)/gimpedit.Plo \
+ ./$(DEPDIR)/gimpedit_pdb.Plo ./$(DEPDIR)/gimpenums.Plo \
+ ./$(DEPDIR)/gimpexport.Plo ./$(DEPDIR)/gimpfileops_pdb.Plo \
+ ./$(DEPDIR)/gimpfloatingsel_pdb.Plo \
+ ./$(DEPDIR)/gimpfontmenu.Plo ./$(DEPDIR)/gimpfonts_pdb.Plo \
+ ./$(DEPDIR)/gimpfontselect.Plo \
+ ./$(DEPDIR)/gimpfontselect_pdb.Plo \
+ ./$(DEPDIR)/gimpfontselectbutton.Plo \
+ ./$(DEPDIR)/gimpgimprc.Plo ./$(DEPDIR)/gimpgimprc_pdb.Plo \
+ ./$(DEPDIR)/gimpgradient_pdb.Plo \
+ ./$(DEPDIR)/gimpgradientmenu.Plo ./$(DEPDIR)/gimpgradients.Plo \
+ ./$(DEPDIR)/gimpgradients_pdb.Plo \
+ ./$(DEPDIR)/gimpgradientselect.Plo \
+ ./$(DEPDIR)/gimpgradientselect_pdb.Plo \
+ ./$(DEPDIR)/gimpgradientselectbutton.Plo \
+ ./$(DEPDIR)/gimphelp_pdb.Plo ./$(DEPDIR)/gimpimage.Plo \
+ ./$(DEPDIR)/gimpimage_pdb.Plo \
+ ./$(DEPDIR)/gimpimagecolorprofile.Plo \
+ ./$(DEPDIR)/gimpimagecolorprofile_pdb.Plo \
+ ./$(DEPDIR)/gimpimagecombobox.Plo \
+ ./$(DEPDIR)/gimpimageconvert_pdb.Plo \
+ ./$(DEPDIR)/gimpimagegrid_pdb.Plo \
+ ./$(DEPDIR)/gimpimageguides_pdb.Plo \
+ ./$(DEPDIR)/gimpimagemetadata.Plo \
+ ./$(DEPDIR)/gimpimagesamplepoints_pdb.Plo \
+ ./$(DEPDIR)/gimpimageselect_pdb.Plo \
+ ./$(DEPDIR)/gimpimagetransform_pdb.Plo \
+ ./$(DEPDIR)/gimpimageundo_pdb.Plo ./$(DEPDIR)/gimpitem_pdb.Plo \
+ ./$(DEPDIR)/gimpitemcombobox.Plo \
+ ./$(DEPDIR)/gimpitemtransform_pdb.Plo \
+ ./$(DEPDIR)/gimplayer.Plo ./$(DEPDIR)/gimplayer_pdb.Plo \
+ ./$(DEPDIR)/gimpmenu.Plo ./$(DEPDIR)/gimpmessage_pdb.Plo \
+ ./$(DEPDIR)/gimppainttools_pdb.Plo ./$(DEPDIR)/gimppalette.Plo \
+ ./$(DEPDIR)/gimppalette_pdb.Plo \
+ ./$(DEPDIR)/gimppalettemenu.Plo ./$(DEPDIR)/gimppalettes.Plo \
+ ./$(DEPDIR)/gimppalettes_pdb.Plo \
+ ./$(DEPDIR)/gimppaletteselect.Plo \
+ ./$(DEPDIR)/gimppaletteselect_pdb.Plo \
+ ./$(DEPDIR)/gimppaletteselectbutton.Plo \
+ ./$(DEPDIR)/gimppaths_pdb.Plo ./$(DEPDIR)/gimppattern_pdb.Plo \
+ ./$(DEPDIR)/gimppatternmenu.Plo ./$(DEPDIR)/gimppatterns.Plo \
+ ./$(DEPDIR)/gimppatterns_pdb.Plo \
+ ./$(DEPDIR)/gimppatternselect.Plo \
+ ./$(DEPDIR)/gimppatternselect_pdb.Plo \
+ ./$(DEPDIR)/gimppatternselectbutton.Plo \
+ ./$(DEPDIR)/gimppixbuf.Plo ./$(DEPDIR)/gimppixelfetcher.Plo \
+ ./$(DEPDIR)/gimppixelrgn.Plo ./$(DEPDIR)/gimpplugin.Plo \
+ ./$(DEPDIR)/gimpplugin_pdb.Plo \
+ ./$(DEPDIR)/gimpprocbrowserdialog.Plo \
+ ./$(DEPDIR)/gimpproceduraldb.Plo \
+ ./$(DEPDIR)/gimpproceduraldb_pdb.Plo \
+ ./$(DEPDIR)/gimpprocview.Plo ./$(DEPDIR)/gimpprogress.Plo \
+ ./$(DEPDIR)/gimpprogress_pdb.Plo \
+ ./$(DEPDIR)/gimpprogressbar.Plo \
+ ./$(DEPDIR)/gimpregioniterator.Plo \
+ ./$(DEPDIR)/gimpselectbutton.Plo ./$(DEPDIR)/gimpselection.Plo \
+ ./$(DEPDIR)/gimpselection_pdb.Plo \
+ ./$(DEPDIR)/gimpselectiontools_pdb.Plo \
+ ./$(DEPDIR)/gimptextlayer_pdb.Plo \
+ ./$(DEPDIR)/gimptexttool_pdb.Plo ./$(DEPDIR)/gimptile.Plo \
+ ./$(DEPDIR)/gimptilebackendplugin.Plo \
+ ./$(DEPDIR)/gimptransformtools_pdb.Plo ./$(DEPDIR)/gimpui.Plo \
+ ./$(DEPDIR)/gimpuimarshal.Plo ./$(DEPDIR)/gimpunit_pdb.Plo \
+ ./$(DEPDIR)/gimpunitcache.Plo ./$(DEPDIR)/gimpvectors.Plo \
+ ./$(DEPDIR)/gimpvectors_pdb.Plo \
+ ./$(DEPDIR)/gimpzoompreview.Plo
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libgimp_@GIMP_API_VERSION@_la_SOURCES) \
+ $(libgimpui_@GIMP_API_VERSION@_la_SOURCES)
+DIST_SOURCES = $(libgimp_@GIMP_API_VERSION@_la_SOURCES) \
+ $(libgimpui_@GIMP_API_VERSION@_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+DATA = $(noinst_DATA)
+HEADERS = $(gimpinclude_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp COPYING
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+AA_LIBS = @AA_LIBS@
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+ALL_LINGUAS = @ALL_LINGUAS@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+ALTIVEC_EXTRA_CFLAGS = @ALTIVEC_EXTRA_CFLAGS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APPSTREAM_UTIL = @APPSTREAM_UTIL@
+AR = @AR@
+AS = @AS@
+ATK_CFLAGS = @ATK_CFLAGS@
+ATK_LIBS = @ATK_LIBS@
+ATK_REQUIRED_VERSION = @ATK_REQUIRED_VERSION@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BABL_CFLAGS = @BABL_CFLAGS@
+BABL_LIBS = @BABL_LIBS@
+BABL_REQUIRED_VERSION = @BABL_REQUIRED_VERSION@
+BUG_REPORT_URL = @BUG_REPORT_URL@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+BUILD_OBJEXT = @BUILD_OBJEXT@
+BZIP2_LIBS = @BZIP2_LIBS@
+CAIRO_CFLAGS = @CAIRO_CFLAGS@
+CAIRO_LIBS = @CAIRO_LIBS@
+CAIRO_PDF_CFLAGS = @CAIRO_PDF_CFLAGS@
+CAIRO_PDF_LIBS = @CAIRO_PDF_LIBS@
+CAIRO_PDF_REQUIRED_VERSION = @CAIRO_PDF_REQUIRED_VERSION@
+CAIRO_REQUIRED_VERSION = @CAIRO_REQUIRED_VERSION@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DESKTOP_DATADIR = @DESKTOP_DATADIR@
+DESKTOP_FILE_VALIDATE = @DESKTOP_FILE_VALIDATE@
+DLLTOOL = @DLLTOOL@
+DOC_SHOOTER = @DOC_SHOOTER@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FILE_AA = @FILE_AA@
+FILE_EXR = @FILE_EXR@
+FILE_HEIF = @FILE_HEIF@
+FILE_JP2_LOAD = @FILE_JP2_LOAD@
+FILE_JPEGXL = @FILE_JPEGXL@
+FILE_MNG = @FILE_MNG@
+FILE_PDF_SAVE = @FILE_PDF_SAVE@
+FILE_PS = @FILE_PS@
+FILE_WMF = @FILE_WMF@
+FILE_XMC = @FILE_XMC@
+FILE_XPM = @FILE_XPM@
+FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
+FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
+FONTCONFIG_REQUIRED_VERSION = @FONTCONFIG_REQUIRED_VERSION@
+FREETYPE2_REQUIRED_VERSION = @FREETYPE2_REQUIRED_VERSION@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GDBUS_CODEGEN = @GDBUS_CODEGEN@
+GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@
+GDK_PIXBUF_CSOURCE = @GDK_PIXBUF_CSOURCE@
+GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@
+GDK_PIXBUF_REQUIRED_VERSION = @GDK_PIXBUF_REQUIRED_VERSION@
+GEGL = @GEGL@
+GEGL_CFLAGS = @GEGL_CFLAGS@
+GEGL_LIBS = @GEGL_LIBS@
+GEGL_MAJOR_MINOR_VERSION = @GEGL_MAJOR_MINOR_VERSION@
+GEGL_REQUIRED_VERSION = @GEGL_REQUIRED_VERSION@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GEXIV2_CFLAGS = @GEXIV2_CFLAGS@
+GEXIV2_LIBS = @GEXIV2_LIBS@
+GEXIV2_REQUIRED_VERSION = @GEXIV2_REQUIRED_VERSION@
+GIMP_API_VERSION = @GIMP_API_VERSION@
+GIMP_APP_VERSION = @GIMP_APP_VERSION@
+GIMP_BINARY_AGE = @GIMP_BINARY_AGE@
+GIMP_COMMAND = @GIMP_COMMAND@
+GIMP_DATA_VERSION = @GIMP_DATA_VERSION@
+GIMP_FULL_NAME = @GIMP_FULL_NAME@
+GIMP_INTERFACE_AGE = @GIMP_INTERFACE_AGE@
+GIMP_MAJOR_VERSION = @GIMP_MAJOR_VERSION@
+GIMP_MICRO_VERSION = @GIMP_MICRO_VERSION@
+GIMP_MINOR_VERSION = @GIMP_MINOR_VERSION@
+GIMP_MKENUMS = @GIMP_MKENUMS@
+GIMP_MODULES = @GIMP_MODULES@
+GIMP_PACKAGE_REVISION = @GIMP_PACKAGE_REVISION@
+GIMP_PKGCONFIG_VERSION = @GIMP_PKGCONFIG_VERSION@
+GIMP_PLUGINS = @GIMP_PLUGINS@
+GIMP_PLUGIN_VERSION = @GIMP_PLUGIN_VERSION@
+GIMP_REAL_VERSION = @GIMP_REAL_VERSION@
+GIMP_RELEASE = @GIMP_RELEASE@
+GIMP_SYSCONF_VERSION = @GIMP_SYSCONF_VERSION@
+GIMP_TOOL_VERSION = @GIMP_TOOL_VERSION@
+GIMP_UNSTABLE = @GIMP_UNSTABLE@
+GIMP_USER_VERSION = @GIMP_USER_VERSION@
+GIMP_VERSION = @GIMP_VERSION@
+GIO_CFLAGS = @GIO_CFLAGS@
+GIO_LIBS = @GIO_LIBS@
+GIO_UNIX_CFLAGS = @GIO_UNIX_CFLAGS@
+GIO_UNIX_LIBS = @GIO_UNIX_LIBS@
+GIO_WINDOWS_CFLAGS = @GIO_WINDOWS_CFLAGS@
+GIO_WINDOWS_LIBS = @GIO_WINDOWS_LIBS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GLIB_REQUIRED_VERSION = @GLIB_REQUIRED_VERSION@
+GMODULE_NO_EXPORT_CFLAGS = @GMODULE_NO_EXPORT_CFLAGS@
+GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+GREP = @GREP@
+GS_LIBS = @GS_LIBS@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
+GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
+GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GTK_MAC_INTEGRATION_CFLAGS = @GTK_MAC_INTEGRATION_CFLAGS@
+GTK_MAC_INTEGRATION_LIBS = @GTK_MAC_INTEGRATION_LIBS@
+GTK_REQUIRED_VERSION = @GTK_REQUIRED_VERSION@
+GTK_UPDATE_ICON_CACHE = @GTK_UPDATE_ICON_CACHE@
+GUDEV_CFLAGS = @GUDEV_CFLAGS@
+GUDEV_LIBS = @GUDEV_LIBS@
+HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@
+HARFBUZZ_LIBS = @HARFBUZZ_LIBS@
+HARFBUZZ_REQUIRED_VERSION = @HARFBUZZ_REQUIRED_VERSION@
+HAVE_CXX14 = @HAVE_CXX14@
+HAVE_FINITE = @HAVE_FINITE@
+HAVE_ISFINITE = @HAVE_ISFINITE@
+HAVE_VFORK = @HAVE_VFORK@
+HOST_GLIB_COMPILE_RESOURCES = @HOST_GLIB_COMPILE_RESOURCES@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_REQUIRED_VERSION = @INTLTOOL_REQUIRED_VERSION@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@
+INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@
+INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@
+INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+ISO_CODES_LOCALEDIR = @ISO_CODES_LOCALEDIR@
+ISO_CODES_LOCATION = @ISO_CODES_LOCATION@
+JPEG_LIBS = @JPEG_LIBS@
+JSON_GLIB_CFLAGS = @JSON_GLIB_CFLAGS@
+JSON_GLIB_LIBS = @JSON_GLIB_LIBS@
+JXL_CFLAGS = @JXL_CFLAGS@
+JXL_LIBS = @JXL_LIBS@
+JXL_THREADS_CFLAGS = @JXL_THREADS_CFLAGS@
+JXL_THREADS_LIBS = @JXL_THREADS_LIBS@
+LCMS_CFLAGS = @LCMS_CFLAGS@
+LCMS_LIBS = @LCMS_LIBS@
+LCMS_REQUIRED_VERSION = @LCMS_REQUIRED_VERSION@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
+LIBBACKTRACE_LIBS = @LIBBACKTRACE_LIBS@
+LIBHEIF_CFLAGS = @LIBHEIF_CFLAGS@
+LIBHEIF_LIBS = @LIBHEIF_LIBS@
+LIBHEIF_REQUIRED_VERSION = @LIBHEIF_REQUIRED_VERSION@
+LIBJXL_REQUIRED_VERSION = @LIBJXL_REQUIRED_VERSION@
+LIBLZMA_REQUIRED_VERSION = @LIBLZMA_REQUIRED_VERSION@
+LIBMYPAINT_CFLAGS = @LIBMYPAINT_CFLAGS@
+LIBMYPAINT_LIBS = @LIBMYPAINT_LIBS@
+LIBMYPAINT_REQUIRED_VERSION = @LIBMYPAINT_REQUIRED_VERSION@
+LIBOBJS = @LIBOBJS@
+LIBPNG_REQUIRED_VERSION = @LIBPNG_REQUIRED_VERSION@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@
+LIBUNWIND_LIBS = @LIBUNWIND_LIBS@
+LIBUNWIND_REQUIRED_VERSION = @LIBUNWIND_REQUIRED_VERSION@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+LT_VERSION_INFO = @LT_VERSION_INFO@
+LZMA_CFLAGS = @LZMA_CFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
+MAIL = @MAIL@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MIME_INFO_CFLAGS = @MIME_INFO_CFLAGS@
+MIME_INFO_LIBS = @MIME_INFO_LIBS@
+MIME_TYPES = @MIME_TYPES@
+MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MMX_EXTRA_CFLAGS = @MMX_EXTRA_CFLAGS@
+MNG_CFLAGS = @MNG_CFLAGS@
+MNG_LIBS = @MNG_LIBS@
+MSGFMT = @MSGFMT@
+MSGFMT_OPTS = @MSGFMT_OPTS@
+MSGMERGE = @MSGMERGE@
+MYPAINT_BRUSHES_CFLAGS = @MYPAINT_BRUSHES_CFLAGS@
+MYPAINT_BRUSHES_LIBS = @MYPAINT_BRUSHES_LIBS@
+NATIVE_GLIB_CFLAGS = @NATIVE_GLIB_CFLAGS@
+NATIVE_GLIB_LIBS = @NATIVE_GLIB_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
+OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENEXR_REQUIRED_VERSION = @OPENEXR_REQUIRED_VERSION@
+OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
+OPENJPEG_LIBS = @OPENJPEG_LIBS@
+OPENJPEG_REQUIRED_VERSION = @OPENJPEG_REQUIRED_VERSION@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOCAIRO_CFLAGS = @PANGOCAIRO_CFLAGS@
+PANGOCAIRO_LIBS = @PANGOCAIRO_LIBS@
+PANGOCAIRO_REQUIRED_VERSION = @PANGOCAIRO_REQUIRED_VERSION@
+PATHSEP = @PATHSEP@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_REQUIRED_VERSION = @PERL_REQUIRED_VERSION@
+PERL_VERSION = @PERL_VERSION@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PNG_CFLAGS = @PNG_CFLAGS@
+PNG_LIBS = @PNG_LIBS@
+POFILES = @POFILES@
+POPPLER_CFLAGS = @POPPLER_CFLAGS@
+POPPLER_DATA_CFLAGS = @POPPLER_DATA_CFLAGS@
+POPPLER_DATA_LIBS = @POPPLER_DATA_LIBS@
+POPPLER_DATA_REQUIRED_VERSION = @POPPLER_DATA_REQUIRED_VERSION@
+POPPLER_LIBS = @POPPLER_LIBS@
+POPPLER_REQUIRED_VERSION = @POPPLER_REQUIRED_VERSION@
+POSUB = @POSUB@
+PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
+PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
+PYBIN_PATH = @PYBIN_PATH@
+PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
+PYCAIRO_LIBS = @PYCAIRO_LIBS@
+PYGIMP_EXTRA_CFLAGS = @PYGIMP_EXTRA_CFLAGS@
+PYGTK_CFLAGS = @PYGTK_CFLAGS@
+PYGTK_CODEGEN = @PYGTK_CODEGEN@
+PYGTK_DEFSDIR = @PYGTK_DEFSDIR@
+PYGTK_LIBS = @PYGTK_LIBS@
+PYLINK_LIBS = @PYLINK_LIBS@
+PYTHON = @PYTHON@
+PYTHON2_REQUIRED_VERSION = @PYTHON2_REQUIRED_VERSION@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RSVG_REQUIRED_VERSION = @RSVG_REQUIRED_VERSION@
+RT_LIBS = @RT_LIBS@
+SCREENSHOT_LIBS = @SCREENSHOT_LIBS@
+SED = @SED@
+SENDMAIL = @SENDMAIL@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOCKET_LIBS = @SOCKET_LIBS@
+SSE2_EXTRA_CFLAGS = @SSE2_EXTRA_CFLAGS@
+SSE4_1_EXTRA_CFLAGS = @SSE4_1_EXTRA_CFLAGS@
+SSE_EXTRA_CFLAGS = @SSE_EXTRA_CFLAGS@
+STRIP = @STRIP@
+SVG_CFLAGS = @SVG_CFLAGS@
+SVG_LIBS = @SVG_LIBS@
+SYMPREFIX = @SYMPREFIX@
+TIFF_LIBS = @TIFF_LIBS@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WEBKIT_CFLAGS = @WEBKIT_CFLAGS@
+WEBKIT_LIBS = @WEBKIT_LIBS@
+WEBKIT_REQUIRED_VERSION = @WEBKIT_REQUIRED_VERSION@
+WEBPDEMUX_CFLAGS = @WEBPDEMUX_CFLAGS@
+WEBPDEMUX_LIBS = @WEBPDEMUX_LIBS@
+WEBPMUX_CFLAGS = @WEBPMUX_CFLAGS@
+WEBPMUX_LIBS = @WEBPMUX_LIBS@
+WEBP_CFLAGS = @WEBP_CFLAGS@
+WEBP_LIBS = @WEBP_LIBS@
+WEBP_REQUIRED_VERSION = @WEBP_REQUIRED_VERSION@
+WEB_PAGE = @WEB_PAGE@
+WIN32_LARGE_ADDRESS_AWARE = @WIN32_LARGE_ADDRESS_AWARE@
+WINDRES = @WINDRES@
+WMF_CFLAGS = @WMF_CFLAGS@
+WMF_CONFIG = @WMF_CONFIG@
+WMF_LIBS = @WMF_LIBS@
+WMF_REQUIRED_VERSION = @WMF_REQUIRED_VERSION@
+XDG_EMAIL = @XDG_EMAIL@
+XFIXES_CFLAGS = @XFIXES_CFLAGS@
+XFIXES_LIBS = @XFIXES_LIBS@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_REQUIRED_VERSION = @XGETTEXT_REQUIRED_VERSION@
+XMC_CFLAGS = @XMC_CFLAGS@
+XMC_LIBS = @XMC_LIBS@
+XMKMF = @XMKMF@
+XMLLINT = @XMLLINT@
+XMU_LIBS = @XMU_LIBS@
+XPM_LIBS = @XPM_LIBS@
+XSLTPROC = @XSLTPROC@
+XVFB_RUN = @XVFB_RUN@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+Z_LIBS = @Z_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gimpdatadir = @gimpdatadir@
+gimpdir = @gimpdir@
+gimplocaledir = @gimplocaledir@
+gimpplugindir = @gimpplugindir@
+gimpsysconfdir = @gimpsysconfdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+intltool__v_merge_options_ = @intltool__v_merge_options_@
+intltool__v_merge_options_0 = @intltool__v_merge_options_0@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+manpage_gimpdir = @manpage_gimpdir@
+mkdir_p = @mkdir_p@
+ms_librarian = @ms_librarian@
+mypaint_brushes_dir = @mypaint_brushes_dir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
+libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
+libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
+libgimpmodule = $(top_builddir)/libgimpmodule/libgimpmodule-$(GIMP_API_VERSION).la
+libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la
+libgimp = ./libgimp-$(GIMP_API_VERSION).la
+@PLATFORM_WIN32_TRUE@no_undefined = -no-undefined
+@PLATFORM_OSX_TRUE@xobjective_c = "-xobjective-c"
+@PLATFORM_OSX_TRUE@xobjective_cxx = "-xobjective-c++"
+@PLATFORM_OSX_TRUE@xnone = "-xnone"
+@PLATFORM_OSX_TRUE@framework_cocoa = -framework Cocoa
+@HAVE_EXCHNDL_TRUE@@OS_WIN32_TRUE@exchndl = -lexchndl
+@OS_WIN32_TRUE@gimp_def = gimp.def
+@OS_WIN32_TRUE@gimpui_def = gimpui.def
+@OS_WIN32_TRUE@libgimp_export_symbols = -export-symbols $(srcdir)/gimp.def
+@OS_WIN32_TRUE@libgimpui_export_symbols = -export-symbols $(srcdir)/gimpui.def
+@MS_LIB_AVAILABLE_TRUE@noinst_DATA = gimp-$(GIMP_API_VERSION).lib gimpui-$(GIMP_API_VERSION).lib
+gimpincludedir = $(includedir)/gimp-$(GIMP_API_VERSION)/libgimp
+AM_CPPFLAGS = \
+ -DGIMPDIR=\""$(gimpdir)"\" \
+ -DGIMP_USER_VERSION=\"$(GIMP_USER_VERSION)\" \
+ -DG_LOG_DOMAIN=\"LibGimp\" \
+ -DGIMP_COMPILATION \
+ -I$(top_srcdir) \
+ $(GTK_CFLAGS) \
+ $(GEGL_CFLAGS) \
+ $(GEXIV2_CFLAGS) \
+ -I$(includedir)
+
+AM_CFLAGS = \
+ $(xobjective_c)
+
+AM_CXXFLAGS = \
+ $(xobjective_cxx)
+
+AM_LDFLAGS = \
+ $(xnone)
+
+lib_LTLIBRARIES = libgimp-@GIMP_API_VERSION@.la libgimpui-@GIMP_API_VERSION@.la
+PDB_WRAPPERS_C = \
+ gimp_pdb.c \
+ gimpbrush_pdb.c \
+ gimpbrushes_pdb.c \
+ gimpbrushselect_pdb.c \
+ gimpbuffer_pdb.c \
+ gimpchannel_pdb.c \
+ gimpcolor_pdb.c \
+ gimpcontext_pdb.c \
+ gimpdebug_pdb.c \
+ gimpdisplay_pdb.c \
+ gimpdrawable_pdb.c \
+ gimpdrawablecolor_pdb.c \
+ gimpdrawableedit_pdb.c \
+ gimpdrawabletransform_pdb.c \
+ gimpdynamics_pdb.c \
+ gimpedit_pdb.c \
+ gimpfileops_pdb.c \
+ gimpfloatingsel_pdb.c \
+ gimpfonts_pdb.c \
+ gimpfontselect_pdb.c \
+ gimpgimprc_pdb.c \
+ gimpgradient_pdb.c \
+ gimpgradients_pdb.c \
+ gimpgradientselect_pdb.c \
+ gimphelp_pdb.c \
+ gimpimage_pdb.c \
+ gimpimagecolorprofile_pdb.c \
+ gimpimageconvert_pdb.c \
+ gimpimagegrid_pdb.c \
+ gimpimageguides_pdb.c \
+ gimpimagesamplepoints_pdb.c \
+ gimpimageselect_pdb.c \
+ gimpimagetransform_pdb.c \
+ gimpimageundo_pdb.c \
+ gimpitem_pdb.c \
+ gimpitemtransform_pdb.c \
+ gimplayer_pdb.c \
+ gimpmessage_pdb.c \
+ gimppainttools_pdb.c \
+ gimppalette_pdb.c \
+ gimppalettes_pdb.c \
+ gimppaletteselect_pdb.c \
+ gimppaths_pdb.c \
+ gimppattern_pdb.c \
+ gimppatterns_pdb.c \
+ gimppatternselect_pdb.c \
+ gimpplugin_pdb.c \
+ gimpproceduraldb_pdb.c \
+ gimpprogress_pdb.c \
+ gimpselection_pdb.c \
+ gimpselectiontools_pdb.c \
+ gimptextlayer_pdb.c \
+ gimptexttool_pdb.c \
+ gimptransformtools_pdb.c \
+ gimpunit_pdb.c \
+ gimpvectors_pdb.c
+
+PDB_WRAPPERS_H = \
+ gimp_pdb_headers.h \
+ gimp_pdb.h \
+ gimpbrush_pdb.h \
+ gimpbrushes_pdb.h \
+ gimpbrushselect_pdb.h \
+ gimpbuffer_pdb.h \
+ gimpchannel_pdb.h \
+ gimpcolor_pdb.h \
+ gimpcontext_pdb.h \
+ gimpdebug_pdb.h \
+ gimpdisplay_pdb.h \
+ gimpdrawable_pdb.h \
+ gimpdrawablecolor_pdb.h \
+ gimpdrawableedit_pdb.h \
+ gimpdrawabletransform_pdb.h \
+ gimpdynamics_pdb.h \
+ gimpedit_pdb.h \
+ gimpfileops_pdb.h \
+ gimpfloatingsel_pdb.h \
+ gimpfonts_pdb.h \
+ gimpfontselect_pdb.h \
+ gimpgimprc_pdb.h \
+ gimpgradient_pdb.h \
+ gimpgradients_pdb.h \
+ gimpgradientselect_pdb.h \
+ gimphelp_pdb.h \
+ gimpimage_pdb.h \
+ gimpimagecolorprofile_pdb.h \
+ gimpimageconvert_pdb.h \
+ gimpimagegrid_pdb.h \
+ gimpimageguides_pdb.h \
+ gimpimagesamplepoints_pdb.h \
+ gimpimageselect_pdb.h \
+ gimpimagetransform_pdb.h \
+ gimpimageundo_pdb.h \
+ gimpitem_pdb.h \
+ gimpitemtransform_pdb.h \
+ gimplayer_pdb.h \
+ gimpmessage_pdb.h \
+ gimppainttools_pdb.h \
+ gimppalette_pdb.h \
+ gimppalettes_pdb.h \
+ gimppaletteselect_pdb.h \
+ gimppaths_pdb.h \
+ gimppattern_pdb.h \
+ gimppatterns_pdb.h \
+ gimppatternselect_pdb.h \
+ gimpplugin_pdb.h \
+ gimpproceduraldb_pdb.h \
+ gimpprogress_pdb.h \
+ gimpselection_pdb.h \
+ gimpselectiontools_pdb.h \
+ gimptextlayer_pdb.h \
+ gimptexttool_pdb.h \
+ gimptransformtools_pdb.h \
+ gimpunit_pdb.h \
+ gimpvectors_pdb.h
+
+libgimp_sources = \
+ gimp.c \
+ gimp.h \
+ gimptypes.h \
+ gimpenums.h \
+ ${PDB_WRAPPERS_C} \
+ ${PDB_WRAPPERS_H} \
+ gimpbrushes.c \
+ gimpbrushes.h \
+ gimpbrushselect.c \
+ gimpbrushselect.h \
+ gimpchannel.c \
+ gimpchannel.h \
+ gimpdrawable.c \
+ gimpdrawable.h \
+ gimpedit.c \
+ gimpedit.h \
+ gimpfontselect.c \
+ gimpfontselect.h \
+ gimpgimprc.c \
+ gimpgimprc.h \
+ gimpgradients.c \
+ gimpgradients.h \
+ gimpgradientselect.c \
+ gimpgradientselect.h \
+ gimpimage.c \
+ gimpimage.h \
+ gimpimagecolorprofile.c \
+ gimpimagecolorprofile.h \
+ gimplayer.c \
+ gimplayer.h \
+ gimppalette.c \
+ gimppalette.h \
+ gimppalettes.c \
+ gimppalettes.h \
+ gimppaletteselect.c \
+ gimppaletteselect.h \
+ gimppatterns.c \
+ gimppatterns.h \
+ gimppatternselect.c \
+ gimppatternselect.h \
+ gimppixbuf.c \
+ gimppixbuf.h \
+ gimppixelfetcher.c \
+ gimppixelfetcher.h \
+ gimppixelrgn.c \
+ gimppixelrgn.h \
+ gimpplugin.c \
+ gimpplugin.h \
+ gimpproceduraldb.c \
+ gimpproceduraldb.h \
+ gimpprogress.c \
+ gimpprogress.h \
+ gimpregioniterator.c \
+ gimpregioniterator.h \
+ gimpselection.c \
+ gimpselection.h \
+ gimptile.c \
+ gimptile.h \
+ gimptilebackendplugin.c \
+ gimptilebackendplugin.h \
+ gimpunitcache.c \
+ gimpunitcache.h \
+ gimpvectors.c \
+ gimpvectors.h \
+ stdplugins-intl.h \
+ libgimp-intl.h
+
+libgimp_built_sources = \
+ gimpenums.c
+
+libgimp_extra_sources = gimpenums.c.tail
+libgimp_@GIMP_API_VERSION@_la_SOURCES = \
+ $(libgimp_built_sources) \
+ $(libgimp_sources)
+
+libgimpui_sources = \
+ gimpui.c \
+ gimpui.h \
+ gimpuitypes.h \
+ gimpaspectpreview.c \
+ gimpaspectpreview.h \
+ gimpbrushmenu.c \
+ gimpbrushmenu.h \
+ gimpbrushselectbutton.c \
+ gimpbrushselectbutton.h \
+ gimpdrawablepreview.c \
+ gimpdrawablepreview.h \
+ gimpexport.c \
+ gimpexport.h \
+ gimpfontmenu.c \
+ gimpfontmenu.h \
+ gimpfontselectbutton.c \
+ gimpfontselectbutton.h \
+ gimpgradientmenu.c \
+ gimpgradientmenu.h \
+ gimpgradientselectbutton.c \
+ gimpgradientselectbutton.h \
+ gimpimagecombobox.c \
+ gimpimagecombobox.h \
+ gimpimagemetadata.c \
+ gimpimagemetadata.h \
+ gimpitemcombobox.c \
+ gimpitemcombobox.h \
+ gimpmenu.c \
+ gimpmenu.h \
+ gimppalettemenu.c \
+ gimppalettemenu.h \
+ gimppaletteselectbutton.c \
+ gimppaletteselectbutton.h \
+ gimppatternmenu.c \
+ gimppatternmenu.h \
+ gimppatternselectbutton.c \
+ gimppatternselectbutton.h \
+ gimpprocbrowserdialog.c \
+ gimpprocbrowserdialog.h \
+ gimpprocview.c \
+ gimpprocview.h \
+ gimpprogressbar.c \
+ gimpprogressbar.h \
+ gimpselectbutton.c \
+ gimpselectbutton.h \
+ gimpzoompreview.c \
+ gimpzoompreview.h
+
+libgimpui_built_sources = \
+ gimpuimarshal.c \
+ gimpuimarshal.h
+
+libgimpui_extra_sources = gimpuimarshal.list
+libgimpui_@GIMP_API_VERSION@_la_SOURCES = \
+ $(libgimpui_built_sources) \
+ $(libgimpui_sources)
+
+gimpinclude_HEADERS = \
+ gimp.h \
+ gimptypes.h \
+ gimpenums.h \
+ ${PDB_WRAPPERS_H} \
+ gimpbrushes.h \
+ gimpbrushselect.h \
+ gimpchannel.h \
+ gimpdrawable.h \
+ gimpedit.h \
+ gimpfontselect.h \
+ gimpgimprc.h \
+ gimpgradients.h \
+ gimpgradientselect.h \
+ gimpimage.h \
+ gimpimagecolorprofile.h \
+ gimplayer.h \
+ gimppalette.h \
+ gimppalettes.h \
+ gimppaletteselect.h \
+ gimppatterns.h \
+ gimppatternselect.h \
+ gimppixelfetcher.h \
+ gimppixelrgn.h \
+ gimpplugin.h \
+ gimpproceduraldb.h \
+ gimpprogress.h \
+ gimpregioniterator.h \
+ gimpselection.h \
+ gimptile.h \
+ gimpvectors.h \
+ \
+ gimpui.h \
+ gimpuitypes.h \
+ gimpaspectpreview.h \
+ gimpbrushmenu.h \
+ gimpbrushselectbutton.h \
+ gimpdrawablepreview.h \
+ gimpexport.h \
+ gimpfontmenu.h \
+ gimpfontselectbutton.h \
+ gimpgradientmenu.h \
+ gimpgradientselectbutton.h \
+ gimpimagecombobox.h \
+ gimpimagemetadata.h \
+ gimpitemcombobox.h \
+ gimpmenu.h \
+ gimppalettemenu.h \
+ gimppaletteselectbutton.h \
+ gimppatternmenu.h \
+ gimppatternselectbutton.h \
+ gimppixbuf.h \
+ gimpprocbrowserdialog.h \
+ gimpprocview.h \
+ gimpprogressbar.h \
+ gimpselectbutton.h \
+ gimpzoompreview.h
+
+libgimp_@GIMP_API_VERSION@_la_LDFLAGS = \
+ -version-info $(LT_VERSION_INFO) \
+ $(no_undefined) \
+ $(libgimp_export_symbols) \
+ $(framework_cocoa) \
+ $(xnone)
+
+EXTRA_libgimp_@GIMP_API_VERSION@_la_DEPENDENCIES = $(gimp_def)
+libgimp_@GIMP_API_VERSION@_la_LIBADD = \
+ $(libgimpconfig) \
+ $(libgimpcolor) \
+ $(libgimpbase) \
+ $(exchndl) \
+ $(CAIRO_LIBS) \
+ $(GEGL_LIBS) \
+ $(GDK_PIXBUF_LIBS) \
+ $(RT_LIBS)
+
+libgimpui_@GIMP_API_VERSION@_la_LDFLAGS = \
+ -version-info $(LT_VERSION_INFO) \
+ $(no_undefined) \
+ $(libgimpui_export_symbols) \
+ $(framework_cocoa) \
+ $(xnone)
+
+EXTRA_libgimpui_@GIMP_API_VERSION@_la_DEPENDENCIES = $(gimpui_def)
+libgimpui_@GIMP_API_VERSION@_la_LIBADD = \
+ $(libgimp) \
+ $(libgimpwidgets) \
+ $(libgimpcolor) \
+ $(libgimpbase) \
+ $(libgimpmodule) \
+ $(GEGL_LIBS) \
+ $(GTK_LIBS) \
+ $(GEXIV2_LIBS) \
+ $(RT_LIBS)
+
+BUILT_SOURCES = \
+ $(libgimp_built_sources) \
+ $(libgimpui_built_sources)
+
+EXTRA_DIST = \
+ COPYING \
+ gimp.def \
+ gimpui.def \
+ $(libgimp_extra_sources) \
+ $(libgimpui_extra_sources)
+
+
+#
+# rules to generate built sources
+#
+# setup autogeneration dependencies
+gen_sources = xgen-cec xgen-umh xgen-umc
+CLEANFILES = $(gen_sources)
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libgimp/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu libgimp/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+libgimp-@GIMP_API_VERSION@.la: $(libgimp_@GIMP_API_VERSION@_la_OBJECTS) $(libgimp_@GIMP_API_VERSION@_la_DEPENDENCIES) $(EXTRA_libgimp_@GIMP_API_VERSION@_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libgimp_@GIMP_API_VERSION@_la_LINK) -rpath $(libdir) $(libgimp_@GIMP_API_VERSION@_la_OBJECTS) $(libgimp_@GIMP_API_VERSION@_la_LIBADD) $(LIBS)
+
+libgimpui-@GIMP_API_VERSION@.la: $(libgimpui_@GIMP_API_VERSION@_la_OBJECTS) $(libgimpui_@GIMP_API_VERSION@_la_DEPENDENCIES) $(EXTRA_libgimpui_@GIMP_API_VERSION@_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libgimpui_@GIMP_API_VERSION@_la_LINK) -rpath $(libdir) $(libgimpui_@GIMP_API_VERSION@_la_OBJECTS) $(libgimpui_@GIMP_API_VERSION@_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimp.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimp_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpaspectpreview.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpbrush_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpbrushes.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpbrushes_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpbrushmenu.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpbrushselect.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpbrushselect_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpbrushselectbutton.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpbuffer_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpchannel.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpchannel_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpcolor_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpcontext_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpdebug_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpdisplay_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpdrawable.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpdrawable_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpdrawablecolor_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpdrawableedit_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpdrawablepreview.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpdrawabletransform_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpdynamics_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpedit.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpedit_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpenums.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpexport.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpfileops_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpfloatingsel_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpfontmenu.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpfonts_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpfontselect.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpfontselect_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpfontselectbutton.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpgimprc.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpgimprc_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpgradient_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpgradientmenu.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpgradients.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpgradients_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpgradientselect.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpgradientselect_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpgradientselectbutton.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimphelp_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpimage.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpimage_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpimagecolorprofile.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpimagecolorprofile_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpimagecombobox.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpimageconvert_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpimagegrid_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpimageguides_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpimagemetadata.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpimagesamplepoints_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpimageselect_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpimagetransform_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpimageundo_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpitem_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpitemcombobox.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpitemtransform_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimplayer.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimplayer_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpmenu.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpmessage_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppainttools_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppalette.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppalette_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppalettemenu.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppalettes.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppalettes_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppaletteselect.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppaletteselect_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppaletteselectbutton.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppaths_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppattern_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppatternmenu.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppatterns.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppatterns_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppatternselect.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppatternselect_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppatternselectbutton.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppixbuf.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppixelfetcher.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppixelrgn.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpplugin.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpplugin_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpprocbrowserdialog.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpproceduraldb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpproceduraldb_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpprocview.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpprogress.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpprogress_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpprogressbar.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpregioniterator.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpselectbutton.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpselection.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpselection_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpselectiontools_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimptextlayer_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimptexttool_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimptile.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimptilebackendplugin.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimptransformtools_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpui.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpuimarshal.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpunit_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpunitcache.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpvectors.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpvectors_pdb.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpzoompreview.Plo@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-gimpincludeHEADERS: $(gimpinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(gimpinclude_HEADERS)'; test -n "$(gimpincludedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(gimpincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(gimpincludedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(gimpincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(gimpincludedir)" || exit $$?; \
+ done
+
+uninstall-gimpincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(gimpinclude_HEADERS)'; test -n "$(gimpincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(gimpincludedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(gimpincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f ./$(DEPDIR)/gimp.Plo
+ -rm -f ./$(DEPDIR)/gimp_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpaspectpreview.Plo
+ -rm -f ./$(DEPDIR)/gimpbrush_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpbrushes.Plo
+ -rm -f ./$(DEPDIR)/gimpbrushes_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpbrushmenu.Plo
+ -rm -f ./$(DEPDIR)/gimpbrushselect.Plo
+ -rm -f ./$(DEPDIR)/gimpbrushselect_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpbrushselectbutton.Plo
+ -rm -f ./$(DEPDIR)/gimpbuffer_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpchannel.Plo
+ -rm -f ./$(DEPDIR)/gimpchannel_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpcolor_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpcontext_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdebug_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdisplay_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdrawable.Plo
+ -rm -f ./$(DEPDIR)/gimpdrawable_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdrawablecolor_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdrawableedit_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdrawablepreview.Plo
+ -rm -f ./$(DEPDIR)/gimpdrawabletransform_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdynamics_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpedit.Plo
+ -rm -f ./$(DEPDIR)/gimpedit_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpenums.Plo
+ -rm -f ./$(DEPDIR)/gimpexport.Plo
+ -rm -f ./$(DEPDIR)/gimpfileops_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpfloatingsel_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpfontmenu.Plo
+ -rm -f ./$(DEPDIR)/gimpfonts_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpfontselect.Plo
+ -rm -f ./$(DEPDIR)/gimpfontselect_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpfontselectbutton.Plo
+ -rm -f ./$(DEPDIR)/gimpgimprc.Plo
+ -rm -f ./$(DEPDIR)/gimpgimprc_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpgradient_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpgradientmenu.Plo
+ -rm -f ./$(DEPDIR)/gimpgradients.Plo
+ -rm -f ./$(DEPDIR)/gimpgradients_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpgradientselect.Plo
+ -rm -f ./$(DEPDIR)/gimpgradientselect_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpgradientselectbutton.Plo
+ -rm -f ./$(DEPDIR)/gimphelp_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimage.Plo
+ -rm -f ./$(DEPDIR)/gimpimage_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimagecolorprofile.Plo
+ -rm -f ./$(DEPDIR)/gimpimagecolorprofile_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimagecombobox.Plo
+ -rm -f ./$(DEPDIR)/gimpimageconvert_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimagegrid_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimageguides_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimagemetadata.Plo
+ -rm -f ./$(DEPDIR)/gimpimagesamplepoints_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimageselect_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimagetransform_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimageundo_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpitem_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpitemcombobox.Plo
+ -rm -f ./$(DEPDIR)/gimpitemtransform_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimplayer.Plo
+ -rm -f ./$(DEPDIR)/gimplayer_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpmenu.Plo
+ -rm -f ./$(DEPDIR)/gimpmessage_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppainttools_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppalette.Plo
+ -rm -f ./$(DEPDIR)/gimppalette_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppalettemenu.Plo
+ -rm -f ./$(DEPDIR)/gimppalettes.Plo
+ -rm -f ./$(DEPDIR)/gimppalettes_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppaletteselect.Plo
+ -rm -f ./$(DEPDIR)/gimppaletteselect_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppaletteselectbutton.Plo
+ -rm -f ./$(DEPDIR)/gimppaths_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppattern_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppatternmenu.Plo
+ -rm -f ./$(DEPDIR)/gimppatterns.Plo
+ -rm -f ./$(DEPDIR)/gimppatterns_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppatternselect.Plo
+ -rm -f ./$(DEPDIR)/gimppatternselect_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppatternselectbutton.Plo
+ -rm -f ./$(DEPDIR)/gimppixbuf.Plo
+ -rm -f ./$(DEPDIR)/gimppixelfetcher.Plo
+ -rm -f ./$(DEPDIR)/gimppixelrgn.Plo
+ -rm -f ./$(DEPDIR)/gimpplugin.Plo
+ -rm -f ./$(DEPDIR)/gimpplugin_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpprocbrowserdialog.Plo
+ -rm -f ./$(DEPDIR)/gimpproceduraldb.Plo
+ -rm -f ./$(DEPDIR)/gimpproceduraldb_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpprocview.Plo
+ -rm -f ./$(DEPDIR)/gimpprogress.Plo
+ -rm -f ./$(DEPDIR)/gimpprogress_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpprogressbar.Plo
+ -rm -f ./$(DEPDIR)/gimpregioniterator.Plo
+ -rm -f ./$(DEPDIR)/gimpselectbutton.Plo
+ -rm -f ./$(DEPDIR)/gimpselection.Plo
+ -rm -f ./$(DEPDIR)/gimpselection_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpselectiontools_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimptextlayer_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimptexttool_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimptile.Plo
+ -rm -f ./$(DEPDIR)/gimptilebackendplugin.Plo
+ -rm -f ./$(DEPDIR)/gimptransformtools_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpui.Plo
+ -rm -f ./$(DEPDIR)/gimpuimarshal.Plo
+ -rm -f ./$(DEPDIR)/gimpunit_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpunitcache.Plo
+ -rm -f ./$(DEPDIR)/gimpvectors.Plo
+ -rm -f ./$(DEPDIR)/gimpvectors_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpzoompreview.Plo
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local install-gimpincludeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f ./$(DEPDIR)/gimp.Plo
+ -rm -f ./$(DEPDIR)/gimp_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpaspectpreview.Plo
+ -rm -f ./$(DEPDIR)/gimpbrush_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpbrushes.Plo
+ -rm -f ./$(DEPDIR)/gimpbrushes_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpbrushmenu.Plo
+ -rm -f ./$(DEPDIR)/gimpbrushselect.Plo
+ -rm -f ./$(DEPDIR)/gimpbrushselect_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpbrushselectbutton.Plo
+ -rm -f ./$(DEPDIR)/gimpbuffer_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpchannel.Plo
+ -rm -f ./$(DEPDIR)/gimpchannel_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpcolor_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpcontext_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdebug_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdisplay_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdrawable.Plo
+ -rm -f ./$(DEPDIR)/gimpdrawable_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdrawablecolor_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdrawableedit_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdrawablepreview.Plo
+ -rm -f ./$(DEPDIR)/gimpdrawabletransform_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpdynamics_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpedit.Plo
+ -rm -f ./$(DEPDIR)/gimpedit_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpenums.Plo
+ -rm -f ./$(DEPDIR)/gimpexport.Plo
+ -rm -f ./$(DEPDIR)/gimpfileops_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpfloatingsel_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpfontmenu.Plo
+ -rm -f ./$(DEPDIR)/gimpfonts_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpfontselect.Plo
+ -rm -f ./$(DEPDIR)/gimpfontselect_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpfontselectbutton.Plo
+ -rm -f ./$(DEPDIR)/gimpgimprc.Plo
+ -rm -f ./$(DEPDIR)/gimpgimprc_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpgradient_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpgradientmenu.Plo
+ -rm -f ./$(DEPDIR)/gimpgradients.Plo
+ -rm -f ./$(DEPDIR)/gimpgradients_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpgradientselect.Plo
+ -rm -f ./$(DEPDIR)/gimpgradientselect_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpgradientselectbutton.Plo
+ -rm -f ./$(DEPDIR)/gimphelp_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimage.Plo
+ -rm -f ./$(DEPDIR)/gimpimage_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimagecolorprofile.Plo
+ -rm -f ./$(DEPDIR)/gimpimagecolorprofile_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimagecombobox.Plo
+ -rm -f ./$(DEPDIR)/gimpimageconvert_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimagegrid_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimageguides_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimagemetadata.Plo
+ -rm -f ./$(DEPDIR)/gimpimagesamplepoints_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimageselect_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimagetransform_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpimageundo_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpitem_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpitemcombobox.Plo
+ -rm -f ./$(DEPDIR)/gimpitemtransform_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimplayer.Plo
+ -rm -f ./$(DEPDIR)/gimplayer_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpmenu.Plo
+ -rm -f ./$(DEPDIR)/gimpmessage_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppainttools_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppalette.Plo
+ -rm -f ./$(DEPDIR)/gimppalette_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppalettemenu.Plo
+ -rm -f ./$(DEPDIR)/gimppalettes.Plo
+ -rm -f ./$(DEPDIR)/gimppalettes_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppaletteselect.Plo
+ -rm -f ./$(DEPDIR)/gimppaletteselect_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppaletteselectbutton.Plo
+ -rm -f ./$(DEPDIR)/gimppaths_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppattern_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppatternmenu.Plo
+ -rm -f ./$(DEPDIR)/gimppatterns.Plo
+ -rm -f ./$(DEPDIR)/gimppatterns_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppatternselect.Plo
+ -rm -f ./$(DEPDIR)/gimppatternselect_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimppatternselectbutton.Plo
+ -rm -f ./$(DEPDIR)/gimppixbuf.Plo
+ -rm -f ./$(DEPDIR)/gimppixelfetcher.Plo
+ -rm -f ./$(DEPDIR)/gimppixelrgn.Plo
+ -rm -f ./$(DEPDIR)/gimpplugin.Plo
+ -rm -f ./$(DEPDIR)/gimpplugin_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpprocbrowserdialog.Plo
+ -rm -f ./$(DEPDIR)/gimpproceduraldb.Plo
+ -rm -f ./$(DEPDIR)/gimpproceduraldb_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpprocview.Plo
+ -rm -f ./$(DEPDIR)/gimpprogress.Plo
+ -rm -f ./$(DEPDIR)/gimpprogress_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpprogressbar.Plo
+ -rm -f ./$(DEPDIR)/gimpregioniterator.Plo
+ -rm -f ./$(DEPDIR)/gimpselectbutton.Plo
+ -rm -f ./$(DEPDIR)/gimpselection.Plo
+ -rm -f ./$(DEPDIR)/gimpselection_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpselectiontools_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimptextlayer_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimptexttool_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimptile.Plo
+ -rm -f ./$(DEPDIR)/gimptilebackendplugin.Plo
+ -rm -f ./$(DEPDIR)/gimptransformtools_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpui.Plo
+ -rm -f ./$(DEPDIR)/gimpuimarshal.Plo
+ -rm -f ./$(DEPDIR)/gimpunit_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpunitcache.Plo
+ -rm -f ./$(DEPDIR)/gimpvectors.Plo
+ -rm -f ./$(DEPDIR)/gimpvectors_pdb.Plo
+ -rm -f ./$(DEPDIR)/gimpzoompreview.Plo
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-gimpincludeHEADERS uninstall-libLTLIBRARIES \
+ uninstall-local
+
+.MAKE: all check install install-am install-exec install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+ clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \
+ ctags ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-data-local install-dvi install-dvi-am \
+ install-exec install-exec-am install-gimpincludeHEADERS \
+ install-html install-html-am install-info install-info-am \
+ install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am \
+ uninstall-gimpincludeHEADERS uninstall-libLTLIBRARIES \
+ uninstall-local
+
+.PRECIOUS: Makefile
+
+
+@OS_WIN32_TRUE@install-libtool-import-lib:
+@OS_WIN32_TRUE@ $(INSTALL) .libs/libgimp-$(GIMP_API_VERSION).dll.a $(DESTDIR)$(libdir)
+@OS_WIN32_TRUE@ $(INSTALL) .libs/libgimpui-$(GIMP_API_VERSION).dll.a $(DESTDIR)$(libdir)
+@OS_WIN32_TRUE@ $(INSTALL) $(srcdir)/gimp.def $(DESTDIR)$(libdir)
+@OS_WIN32_TRUE@ $(INSTALL) $(srcdir)/gimpui.def $(DESTDIR)$(libdir)
+
+@OS_WIN32_TRUE@uninstall-libtool-import-lib:
+@OS_WIN32_TRUE@ -rm $(DESTDIR)$(libdir)/libgimp-$(GIMP_API_VERSION).dll.a
+@OS_WIN32_TRUE@ -rm $(DESTDIR)$(libdir)/libgimpui-$(GIMP_API_VERSION).dll.a
+@OS_WIN32_TRUE@ -rm $(DESTDIR)$(libdir)/gimp.def
+@OS_WIN32_TRUE@ -rm $(DESTDIR)$(libdir)/gimpui.def
+@OS_WIN32_FALSE@install-libtool-import-lib:
+@OS_WIN32_FALSE@uninstall-libtool-import-lib:
+
+@MS_LIB_AVAILABLE_TRUE@install-ms-lib:
+@MS_LIB_AVAILABLE_TRUE@ $(INSTALL) gimp-$(GIMP_API_VERSION).lib $(DESTDIR)$(libdir)
+@MS_LIB_AVAILABLE_TRUE@ $(INSTALL) gimpui-$(GIMP_API_VERSION).lib $(DESTDIR)$(libdir)
+
+@MS_LIB_AVAILABLE_TRUE@uninstall-ms-lib:
+@MS_LIB_AVAILABLE_TRUE@ -rm $(DESTDIR)$(libdir)/gimp-$(GIMP_API_VERSION).lib
+@MS_LIB_AVAILABLE_TRUE@ -rm $(DESTDIR)$(libdir)/gimpui-$(GIMP_API_VERSION).lib
+
+@MS_LIB_AVAILABLE_TRUE@gimp-@GIMP_API_VERSION@.lib: gimp.def
+@MS_LIB_AVAILABLE_TRUE@ lib -name:libgimp-$(GIMP_API_VERSION)-@LT_CURRENT_MINUS_AGE@.dll -def:gimp.def -out:$@
+
+@MS_LIB_AVAILABLE_TRUE@gimpui-@GIMP_API_VERSION@.lib: gimpui.def
+@MS_LIB_AVAILABLE_TRUE@ lib -name:libgimpui-$(GIMP_API_VERSION)-@LT_CURRENT_MINUS_AGE@.dll -def:gimpui.def -out:$@
+
+@MS_LIB_AVAILABLE_FALSE@install-ms-lib:
+@MS_LIB_AVAILABLE_FALSE@uninstall-ms-lib:
+
+install-data-local: install-ms-lib install-libtool-import-lib
+
+uninstall-local: uninstall-ms-lib uninstall-libtool-import-lib
+
+gimpenums.c: $(srcdir)/gimpenums.h $(srcdir)/gimpenums.c.tail $(GIMP_MKENUMS) Makefile.am
+ $(AM_V_GEN) $(GIMP_MKENUMS) \
+ --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include <gegl.h>\n#undef GIMP_DISABLE_DEPRECATED\n#include \"libgimpbase/gimpbase.h\"\n#include \"libgimpbase/gimpbase-private.h\"\n#include \"libgimpconfig/gimpconfigenums.h\"\n#include \"gimpenums.h\"" \
+ --fprod "\n/* enumerations from \"@filename@\" */" \
+ --vhead "GType\n@enum_name@_get_type (void)\n{\n static const G@Type@Value values[] =\n {" \
+ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+ --vtail " { 0, NULL, NULL }\n };\n" \
+ --dhead " static const Gimp@Type@Desc descs[] =\n {" \
+ --dprod " { @VALUENAME@, @valuedesc@, @valuehelp@ },@if ('@valueabbrev@' ne 'NULL')@\n /* Translators: this is an abbreviated version of @valueudesc@.\n Keep it short. */\n { @VALUENAME@, @valueabbrev@, NULL },@endif@" \
+ --dtail " { 0, NULL, NULL }\n };\n\n static GType type = 0;\n\n if (G_UNLIKELY (! type))\n {\n type = g_@type@_register_static (\"@EnumName@\", values);\n gimp_type_set_translation_domain (type, GETTEXT_PACKAGE \"-libgimp\");\n gimp_type_set_translation_context (type, \"@enumnick@\");\n gimp_@type@_set_value_descriptions (type, descs);\n }\n\n return type;\n}\n" \
+ $< > xgen-cec \
+ && cat $(srcdir)/gimpenums.c.tail >> xgen-cec \
+ && cp xgen-cec $(@F) \
+ && rm -f xgen-cec
+
+gimpuimarshal.h: $(srcdir)/gimpuimarshal.list
+ $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_gimpui_marshal $(srcdir)/gimpuimarshal.list --header >> xgen-umh \
+ && (cmp -s xgen-umh $(@F) || cp xgen-umh $(@F)) \
+ && rm -f xgen-umh xgen-umh~
+
+gimpuimarshal.c: gimpuimarshal.h
+ $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_gimpui_marshal $(srcdir)/gimpuimarshal.list --header --body >> xgen-umc \
+ && cp xgen-umc $(@F) \
+ && rm -f xgen-umc xgen-umc~
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
new file mode 100644
index 0000000..f0734ff
--- /dev/null
+++ b/libgimp/gimp.c
@@ -0,0 +1,2588 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimp.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#define _GNU_SOURCE /* for the sigaction stuff */
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifndef WAIT_ANY
+#define WAIT_ANY -1
+#endif
+
+#include <gtk/gtk.h> /* need GDK_WINDOWING_FOO defines */
+
+#ifndef G_OS_WIN32
+#include "libgimpbase/gimpsignal.h"
+
+#else
+
+#ifdef HAVE_EXCHNDL
+#include <time.h>
+#include <exchndl.h>
+#endif
+
+#include <signal.h>
+#endif
+
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#if defined(USE_SYSV_SHM)
+
+#ifdef HAVE_IPC_H
+#include <sys/ipc.h>
+#endif
+
+#ifdef HAVE_SHM_H
+#include <sys/shm.h>
+#endif
+
+#elif defined(USE_POSIX_SHM)
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <fcntl.h>
+#include <sys/mman.h>
+
+#endif /* USE_POSIX_SHM */
+
+#ifdef GDK_WINDOWING_QUARTZ
+#include <Cocoa/Cocoa.h>
+#endif
+
+#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
+# ifdef STRICT
+# undef STRICT
+# endif
+# define STRICT
+
+# ifdef _WIN32_WINNT
+# undef _WIN32_WINNT
+# endif
+# define _WIN32_WINNT 0x0601
+
+# include <windows.h>
+# include <tlhelp32.h>
+# undef RGB
+# define USE_WIN32_SHM 1
+#endif
+
+#include <locale.h>
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpbase/gimpbase-private.h"
+#include "libgimpbase/gimpprotocol.h"
+#include "libgimpbase/gimpwire.h"
+
+#include "gimp.h"
+#include "gimpunitcache.h"
+
+#include "libgimp-intl.h"
+
+
+/**
+ * SECTION: gimp
+ * @title: Gimp
+ * @short_description: Main functions needed for building a GIMP plug-in.
+ * This header includes all other GIMP Library headers.
+ *
+ * Main functions needed for building a GIMP plug-in. This header
+ * includes all other GIMP Library headers.
+ **/
+
+
+#define TILE_MAP_SIZE (_tile_width * _tile_height * 32)
+
+#define ERRMSG_SHM_FAILED "Could not attach to gimp shared memory segment"
+
+/* Maybe this should go in a public header if we add other things to it */
+typedef enum
+{
+ GIMP_DEBUG_PID = 1 << 0,
+ GIMP_DEBUG_FATAL_WARNINGS = 1 << 1,
+ GIMP_DEBUG_QUERY = 1 << 2,
+ GIMP_DEBUG_INIT = 1 << 3,
+ GIMP_DEBUG_RUN = 1 << 4,
+ GIMP_DEBUG_QUIT = 1 << 5,
+
+ GIMP_DEBUG_DEFAULT = (GIMP_DEBUG_RUN | GIMP_DEBUG_FATAL_WARNINGS)
+} GimpDebugFlag;
+
+#define WRITE_BUFFER_SIZE 1024
+
+void gimp_read_expect_msg (GimpWireMessage *msg,
+ gint type);
+
+
+static void gimp_close (void);
+static void gimp_debug_stop (void);
+static void gimp_message_func (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer data);
+static void gimp_fatal_func (const gchar *log_domain,
+ GLogLevelFlags flags,
+ const gchar *message,
+ gpointer data);
+#ifdef G_OS_WIN32
+#ifdef HAVE_EXCHNDL
+static LONG WINAPI gimp_plugin_sigfatal_handler (PEXCEPTION_POINTERS pExceptionInfo);
+#endif
+#else
+static void gimp_plugin_sigfatal_handler (gint sig_num);
+#endif
+static gboolean gimp_plugin_io_error_handler (GIOChannel *channel,
+ GIOCondition cond,
+ gpointer data);
+static gboolean gimp_write (GIOChannel *channel,
+ const guint8 *buf,
+ gulong count,
+ gpointer user_data);
+static gboolean gimp_flush (GIOChannel *channel,
+ gpointer user_data);
+static void gimp_loop (void);
+static void gimp_config (GPConfig *config);
+static void gimp_proc_run (GPProcRun *proc_run);
+static void gimp_temp_proc_run (GPProcRun *proc_run);
+static void gimp_process_message (GimpWireMessage *msg);
+static void gimp_single_message (void);
+static gboolean gimp_extension_read (GIOChannel *channel,
+ GIOCondition condition,
+ gpointer data);
+
+static void gimp_set_pdb_error (const GimpParam *return_vals,
+ gint n_return_vals);
+
+
+#if defined G_OS_WIN32 && defined HAVE_EXCHNDL
+static LPTOP_LEVEL_EXCEPTION_FILTER _prevExceptionFilter = NULL;
+static gchar *plug_in_backtrace_path = NULL;
+#endif
+
+static GIOChannel *_readchannel = NULL;
+GIOChannel *_writechannel = NULL;
+
+#ifdef USE_WIN32_SHM
+static HANDLE shm_handle;
+#endif
+
+static gint _tile_width = -1;
+static gint _tile_height = -1;
+static gint _shm_ID = -1;
+static guchar *_shm_addr = NULL;
+static gboolean _show_tool_tips = TRUE;
+static gboolean _show_help_button = TRUE;
+static gboolean _export_profile = FALSE;
+static gboolean _export_exif = FALSE;
+static gboolean _export_xmp = FALSE;
+static gboolean _export_iptc = FALSE;
+static GimpCheckSize _check_size = GIMP_CHECK_SIZE_MEDIUM_CHECKS;
+static GimpCheckType _check_type = GIMP_CHECK_TYPE_GRAY_CHECKS;
+static gint _min_colors = 144;
+static gint _gdisp_ID = -1;
+static gchar *_wm_class = NULL;
+static gchar *_display_name = NULL;
+static gint _monitor_number = 0;
+static guint32 _timestamp = 0;
+static gchar *_icon_theme_dir = NULL;
+static const gchar *progname = NULL;
+
+static gchar write_buffer[WRITE_BUFFER_SIZE];
+static gulong write_buffer_index = 0;
+
+static GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_NEVER;
+
+static GHashTable *temp_proc_ht = NULL;
+
+static guint gimp_debug_flags = 0;
+
+static const GDebugKey gimp_debug_keys[] =
+{
+ { "pid", GIMP_DEBUG_PID },
+ { "fatal-warnings", GIMP_DEBUG_FATAL_WARNINGS },
+ { "fw", GIMP_DEBUG_FATAL_WARNINGS },
+ { "query", GIMP_DEBUG_QUERY },
+ { "init", GIMP_DEBUG_INIT },
+ { "run", GIMP_DEBUG_RUN },
+ { "quit", GIMP_DEBUG_QUIT },
+ { "on", GIMP_DEBUG_DEFAULT }
+};
+
+static GimpPlugInInfo PLUG_IN_INFO;
+
+
+static GimpPDBStatusType pdb_error_status = GIMP_PDB_SUCCESS;
+static gchar *pdb_error_message = NULL;
+
+
+/**
+ * gimp_main:
+ * @info: the PLUG_IN_INFO structure
+ * @argc: the number of arguments
+ * @argv: the arguments
+ *
+ * The main procedure that must be called with the PLUG_IN_INFO structure
+ * and the 'argc' and 'argv' that are passed to "main".
+ *
+ * Returns: an exit status as defined by the C library,
+ * on success EXIT_SUCCESS.
+ **/
+gint
+gimp_main (const GimpPlugInInfo *info,
+ gint argc,
+ gchar *argv[])
+{
+ enum
+ {
+ ARG_PROGNAME,
+ ARG_GIMP,
+ ARG_READ_FD,
+ ARG_WRITE_FD,
+ ARG_MODE,
+ ARG_STACK_TRACE_MODE,
+
+ N_ARGS
+ };
+
+ gchar *basename;
+ const gchar *env_string;
+ gchar *debug_string;
+
+#ifdef G_OS_WIN32
+ gint i, j, k;
+
+ /* Reduce risks */
+ {
+ typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName);
+ t_SetDllDirectoryA p_SetDllDirectoryA;
+
+ p_SetDllDirectoryA = (t_SetDllDirectoryA) GetProcAddress (GetModuleHandle ("kernel32.dll"),
+ "SetDllDirectoryA");
+ if (p_SetDllDirectoryA)
+ (*p_SetDllDirectoryA) ("");
+ }
+
+ /* On Windows, set DLL search path to $INSTALLDIR/bin so that GEGL
+ file operations can find their respective file library DLLs (such
+ as jasper, etc.) without needing to set external PATH. */
+ {
+ const gchar *install_dir;
+ gchar *bin_dir;
+ LPWSTR w_bin_dir;
+ int n;
+
+ w_bin_dir = NULL;
+ install_dir = gimp_installation_directory ();
+ bin_dir = g_build_filename (install_dir, "bin", NULL);
+
+ n = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS,
+ bin_dir, -1, NULL, 0);
+ if (n == 0)
+ goto out;
+
+ w_bin_dir = g_malloc_n (n + 1, sizeof (wchar_t));
+ n = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS,
+ bin_dir, -1,
+ w_bin_dir, (n + 1) * sizeof (wchar_t));
+ if (n == 0)
+ goto out;
+
+ SetDllDirectoryW (w_bin_dir);
+
+ out:
+ if (w_bin_dir)
+ g_free (w_bin_dir);
+ g_free (bin_dir);
+ }
+
+#ifdef HAVE_EXCHNDL
+ /* Use Dr. Mingw (dumps backtrace on crash) if it is available. */
+ {
+ time_t t;
+ gchar *filename;
+ gchar *dir;
+
+ /* This has to be the non-roaming directory (i.e., the local
+ directory) as backtraces correspond to the binaries on this
+ system. */
+ dir = g_build_filename (g_get_user_data_dir (),
+ GIMPDIR, GIMP_USER_VERSION, "CrashLog",
+ NULL);
+ /* Ensure the path exists. */
+ g_mkdir_with_parents (dir, 0700);
+
+ time (&t);
+ filename = g_strdup_printf ("%s-crash-%" G_GUINT64_FORMAT ".txt",
+ g_get_prgname(), t);
+ plug_in_backtrace_path = g_build_filename (dir, filename, NULL);
+ g_free (filename);
+ g_free (dir);
+
+ /* Similar to core crash handling in app/signals.c, the order here
+ * is very important!
+ */
+ if (! _prevExceptionFilter)
+ _prevExceptionFilter = SetUnhandledExceptionFilter (gimp_plugin_sigfatal_handler);
+
+ ExcHndlInit ();
+ ExcHndlSetLogFileNameA (plug_in_backtrace_path);
+ }
+#endif
+
+#ifndef _WIN64
+ {
+ typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags);
+ t_SetProcessDEPPolicy p_SetProcessDEPPolicy;
+
+ p_SetProcessDEPPolicy = GetProcAddress (GetModuleHandle ("kernel32.dll"),
+ "SetProcessDEPPolicy");
+ if (p_SetProcessDEPPolicy)
+ (*p_SetProcessDEPPolicy) (PROCESS_DEP_ENABLE|PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION);
+ }
+#endif
+
+ /* Group all our windows together on the taskbar */
+ {
+ typedef HRESULT (WINAPI *t_SetCurrentProcessExplicitAppUserModelID) (PCWSTR lpPathName);
+ t_SetCurrentProcessExplicitAppUserModelID p_SetCurrentProcessExplicitAppUserModelID;
+
+ p_SetCurrentProcessExplicitAppUserModelID = (t_SetCurrentProcessExplicitAppUserModelID) GetProcAddress (GetModuleHandle ("shell32.dll"),
+ "SetCurrentProcessExplicitAppUserModelID");
+ if (p_SetCurrentProcessExplicitAppUserModelID)
+ (*p_SetCurrentProcessExplicitAppUserModelID) (L"gimp.GimpApplication");
+ }
+
+ /* Check for exe file name with spaces in the path having been split up
+ * by buggy NT C runtime, or something. I don't know why this happens
+ * on NT (including w2k), but not on w95/98.
+ */
+
+ for (i = 1; i < argc; i++)
+ {
+ k = strlen (argv[i]);
+
+ if (k > 10)
+ {
+ if (g_ascii_strcasecmp (argv[i] + k - 4, ".exe") == 0)
+ {
+ /* Found the end of the executable name, most probably.
+ * Splice the parts of the name back together.
+ */
+ GString *s;
+
+ s = g_string_new (argv[ARG_PROGNAME]);
+
+ for (j = 1; j <= i; j++)
+ {
+ s = g_string_append_c (s, ' ');
+ s = g_string_append (s, argv[j]);
+ }
+
+ argv[ARG_PROGNAME] = s->str;
+
+ /* Move rest of argv down */
+ for (j = 1; j < argc - i; j++)
+ argv[j] = argv[j + i];
+
+ argv[argc - i] = NULL;
+ argc -= i;
+
+ break;
+ }
+ }
+ }
+#endif
+
+ g_assert (info != NULL);
+
+ PLUG_IN_INFO = *info;
+
+ if ((argc != N_ARGS) || (strcmp (argv[ARG_GIMP], "-gimp") != 0))
+ {
+ g_printerr ("%s is a GIMP plug-in and must be run by GIMP to be used\n",
+ argv[ARG_PROGNAME]);
+ return 1;
+ }
+
+ gimp_env_init (TRUE);
+
+ progname = argv[ARG_PROGNAME];
+
+ basename = g_path_get_basename (progname);
+
+ g_set_prgname (basename);
+
+ env_string = g_getenv ("GIMP_PLUGIN_DEBUG");
+
+ if (env_string)
+ {
+ const gchar *debug_messages;
+
+ debug_string = strchr (env_string, ',');
+
+ if (debug_string)
+ {
+ gint len = debug_string - env_string;
+
+ if ((strlen (basename) == len) &&
+ (strncmp (basename, env_string, len) == 0))
+ {
+ gimp_debug_flags =
+ g_parse_debug_string (debug_string + 1,
+ gimp_debug_keys,
+ G_N_ELEMENTS (gimp_debug_keys));
+ }
+ }
+ else if (strcmp (env_string, basename) == 0)
+ {
+ gimp_debug_flags = GIMP_DEBUG_DEFAULT;
+ }
+
+ /* make debug output visible by setting G_MESSAGES_DEBUG */
+ debug_messages = g_getenv ("G_MESSAGES_DEBUG");
+
+ if (debug_messages)
+ {
+ gchar *tmp = g_strconcat (debug_messages, ",LibGimp", NULL);
+ g_setenv ("G_MESSAGES_DEBUG", tmp, TRUE);
+ g_free (tmp);
+ }
+ else
+ {
+ g_setenv ("G_MESSAGES_DEBUG", "LibGimp", TRUE);
+ }
+ }
+
+ g_free (basename);
+
+ stack_trace_mode = (GimpStackTraceMode) CLAMP (atoi (argv[ARG_STACK_TRACE_MODE]),
+ GIMP_STACK_TRACE_NEVER,
+ GIMP_STACK_TRACE_ALWAYS);
+
+#ifndef G_OS_WIN32
+ /* No use catching these on Win32, the user won't get any meaningful
+ * stack trace from glib anyhow. It's better to let Windows inform
+ * about the program error, and offer debugging if the plug-in
+ * has been built with MSVC, and the user has MSVC installed.
+ */
+ gimp_signal_private (SIGHUP, gimp_plugin_sigfatal_handler, 0);
+ gimp_signal_private (SIGINT, gimp_plugin_sigfatal_handler, 0);
+ gimp_signal_private (SIGQUIT, gimp_plugin_sigfatal_handler, 0);
+ gimp_signal_private (SIGTERM, gimp_plugin_sigfatal_handler, 0);
+
+ gimp_signal_private (SIGABRT, gimp_plugin_sigfatal_handler, 0);
+ gimp_signal_private (SIGBUS, gimp_plugin_sigfatal_handler, 0);
+ gimp_signal_private (SIGSEGV, gimp_plugin_sigfatal_handler, 0);
+ gimp_signal_private (SIGFPE, gimp_plugin_sigfatal_handler, 0);
+
+ /* Ignore SIGPIPE from crashing Gimp */
+ gimp_signal_private (SIGPIPE, SIG_IGN, 0);
+
+ /* Restart syscalls interrupted by SIGCHLD */
+ gimp_signal_private (SIGCHLD, SIG_DFL, SA_RESTART);
+#endif
+
+#ifdef G_OS_WIN32
+ _readchannel = g_io_channel_win32_new_fd (atoi (argv[ARG_READ_FD]));
+ _writechannel = g_io_channel_win32_new_fd (atoi (argv[ARG_WRITE_FD]));
+#else
+ _readchannel = g_io_channel_unix_new (atoi (argv[ARG_READ_FD]));
+ _writechannel = g_io_channel_unix_new (atoi (argv[ARG_WRITE_FD]));
+#endif
+
+ g_io_channel_set_encoding (_readchannel, NULL, NULL);
+ g_io_channel_set_encoding (_writechannel, NULL, NULL);
+
+ g_io_channel_set_buffered (_readchannel, FALSE);
+ g_io_channel_set_buffered (_writechannel, FALSE);
+
+ g_io_channel_set_close_on_unref (_readchannel, TRUE);
+ g_io_channel_set_close_on_unref (_writechannel, TRUE);
+
+ gp_init ();
+
+ gimp_wire_set_writer (gimp_write);
+ gimp_wire_set_flusher (gimp_flush);
+
+ gimp_enums_init ();
+
+ /* initialize units */
+ {
+ GimpUnitVtable vtable;
+
+ vtable.unit_get_number_of_units = _gimp_unit_cache_get_number_of_units;
+ vtable.unit_get_number_of_built_in_units =
+ _gimp_unit_cache_get_number_of_built_in_units;
+ vtable.unit_new = _gimp_unit_cache_new;
+ vtable.unit_get_deletion_flag = _gimp_unit_cache_get_deletion_flag;
+ vtable.unit_set_deletion_flag = _gimp_unit_cache_set_deletion_flag;
+ vtable.unit_get_factor = _gimp_unit_cache_get_factor;
+ vtable.unit_get_digits = _gimp_unit_cache_get_digits;
+ vtable.unit_get_identifier = _gimp_unit_cache_get_identifier;
+ vtable.unit_get_symbol = _gimp_unit_cache_get_symbol;
+ vtable.unit_get_abbreviation = _gimp_unit_cache_get_abbreviation;
+ vtable.unit_get_singular = _gimp_unit_cache_get_singular;
+ vtable.unit_get_plural = _gimp_unit_cache_get_plural;
+
+ gimp_base_init (&vtable);
+ }
+
+ /* initialize i18n support */
+
+ setlocale (LC_ALL, "");
+
+ bindtextdomain (GETTEXT_PACKAGE"-libgimp", gimp_locale_directory ());
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE"-libgimp", "UTF-8");
+#endif
+
+
+ /* set handler both for the "LibGimp" and "" domains */
+ {
+ const gchar * const log_domains[] =
+ {
+ "LibGimp",
+ "LibGimpBase",
+ "LibGimpColor",
+ "LibGimpConfig",
+ "LibGimpMath",
+ "LibGimpModule",
+ "LibGimpThumb",
+ "LibGimpWidgets"
+ };
+ gint i;
+
+ for (i = 0; i < G_N_ELEMENTS (log_domains); i++)
+ g_log_set_handler (log_domains[i],
+ G_LOG_LEVEL_MESSAGE,
+ gimp_message_func,
+ NULL);
+
+ g_log_set_handler (NULL,
+ G_LOG_LEVEL_MESSAGE,
+ gimp_message_func,
+ NULL);
+ }
+
+ if (gimp_debug_flags & GIMP_DEBUG_FATAL_WARNINGS)
+ {
+ GLogLevelFlags fatal_mask;
+
+ fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
+ fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
+ g_log_set_always_fatal (fatal_mask);
+
+ g_log_set_handler (NULL,
+ G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL |
+ G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL,
+ gimp_fatal_func, NULL);
+ }
+ else
+ {
+ g_log_set_handler (NULL,
+ G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL,
+ gimp_fatal_func, NULL);
+ }
+
+ if (strcmp (argv[ARG_MODE], "-query") == 0)
+ {
+ if (PLUG_IN_INFO.init_proc)
+ gp_has_init_write (_writechannel, NULL);
+
+ if (gimp_debug_flags & GIMP_DEBUG_QUERY)
+ gimp_debug_stop ();
+
+ if (PLUG_IN_INFO.query_proc)
+ (* PLUG_IN_INFO.query_proc) ();
+
+ gimp_close ();
+
+ return EXIT_SUCCESS;
+ }
+
+ if (strcmp (argv[ARG_MODE], "-init") == 0)
+ {
+ if (gimp_debug_flags & GIMP_DEBUG_INIT)
+ gimp_debug_stop ();
+
+ if (PLUG_IN_INFO.init_proc)
+ (* PLUG_IN_INFO.init_proc) ();
+
+ gimp_close ();
+
+ return EXIT_SUCCESS;
+ }
+
+ if (gimp_debug_flags & GIMP_DEBUG_RUN)
+ gimp_debug_stop ();
+ else if (gimp_debug_flags & GIMP_DEBUG_PID)
+ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Here I am!");
+
+ temp_proc_ht = g_hash_table_new (g_str_hash, g_str_equal);
+
+ g_io_add_watch (_readchannel,
+ G_IO_ERR | G_IO_HUP,
+ gimp_plugin_io_error_handler,
+ NULL);
+
+ gimp_loop ();
+
+ return EXIT_SUCCESS;
+}
+
+/**
+ * gimp_quit:
+ *
+ * Forcefully causes the GIMP library to exit and close down its
+ * connection to main gimp application. This function never returns.
+ **/
+void
+gimp_quit (void)
+{
+ gimp_close ();
+
+#if defined G_OS_WIN32 && defined HAVE_EXCHNDL
+ if (plug_in_backtrace_path)
+ g_free (plug_in_backtrace_path);
+#endif
+
+ exit (EXIT_SUCCESS);
+}
+
+/**
+ * gimp_install_procedure:
+ * @name: the procedure's name.
+ * @blurb: a short text describing what the procedure does.
+ * @help: the help text for the procedure (usually considerably
+ * longer than @blurb).
+ * @author: the procedure's author(s).
+ * @copyright: the procedure's copyright.
+ * @date: the date the procedure was added.
+ * @menu_label: the label to use for the procedure's menu entry,
+ * or #NULL if the procedure has no menu entry.
+ * @image_types: the drawable types the procedure can handle.
+ * @type: the type of the procedure.
+ * @n_params: the number of parameters the procedure takes.
+ * @n_return_vals: the number of return values the procedure returns.
+ * @params: the procedure's parameters.
+ * @return_vals: the procedure's return values.
+ *
+ * Installs a new procedure with the PDB (procedural database).
+ *
+ * Call this function from within your plug-in's query() function for
+ * each procedure your plug-in implements.
+ *
+ * The @name parameter is mandatory and should be unique, or it will
+ * overwrite an already existing procedure (overwrite procedures only
+ * if you know what you're doing).
+ *
+ * The @blurb, @help, @author, @copyright and @date parameters are
+ * optional but then you shouldn't write procedures without proper
+ * documentation, should you.
+ *
+ * @menu_label defines the label that should be used for the
+ * procedure's menu entry. The position where to register in the menu
+ * hierarchy is chosen using gimp_plugin_menu_register(). This
+ * function also still accepts the old (pre-2.2) way of registering a
+ * menu entry and takes a string in the form
+ * "&lt;Domain&gt;/Path/To/My/Menu"
+ * (e.g. "&lt;Image&gt;/Filters/Render/Useless").
+ *
+ * Note that registering a full (pre-2.2-style) menu path is
+ * deprecated and will cause a failure in GIMP 3.0 and newer.
+ *
+ * It is possible to register a procedure only for keyboard-shortcut
+ * activation by passing a @menu_label to gimp_install_procedure() but
+ * not registering any menu path with gimp_plugin_menu_register(). In
+ * this case, the given @menu_label will only be used as the
+ * procedure's user-visible name in the keyboard shortcut editor.
+ *
+ * @image_types is a comma separated list of image types, or actually
+ * drawable types, that this procedure can deal with. Wildcards are
+ * possible here, so you could say "RGB*" instead of "RGB, RGBA" or
+ * "*" for all image types. If the procedure doesn't need an image to
+ * run, use the empty string.
+ *
+ * @type must be one of %GIMP_PLUGIN or %GIMP_EXTENSION. Note that
+ * temporary procedures must be installed using
+ * gimp_install_temp_proc().
+ *
+ * NOTE: Unlike the GIMP 1.2 API, %GIMP_EXTENSION no longer means
+ * that the procedure's menu prefix is &lt;Toolbox&gt;, but that
+ * it will install temporary procedures. Therefore, the GIMP core
+ * will wait until the %GIMP_EXTENSION procedure has called
+ * gimp_extension_ack(), which means that the procedure has done
+ * its initialization, installed its temporary procedures and is
+ * ready to run.
+ *
+ * <emphasis>Not calling gimp_extension_ack() from a %GIMP_EXTENSION
+ * procedure will cause the GIMP core to lock up.</emphasis>
+ *
+ * Additionally, a %GIMP_EXTENSION procedure with no parameters
+ * (@n_params == 0 and @params == #NULL) is an "automatic" extension
+ * that will be automatically started on each GIMP startup.
+ **/
+void
+gimp_install_procedure (const gchar *name,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ const gchar *menu_label,
+ const gchar *image_types,
+ GimpPDBProcType type,
+ gint n_params,
+ gint n_return_vals,
+ const GimpParamDef *params,
+ const GimpParamDef *return_vals)
+{
+ GPProcInstall proc_install;
+
+ g_return_if_fail (name != NULL);
+ g_return_if_fail (type != GIMP_INTERNAL);
+ g_return_if_fail ((n_params == 0 && params == NULL) ||
+ (n_params > 0 && params != NULL));
+ g_return_if_fail ((n_return_vals == 0 && return_vals == NULL) ||
+ (n_return_vals > 0 && return_vals != NULL));
+
+ proc_install.name = (gchar *) name;
+ proc_install.blurb = (gchar *) blurb;
+ proc_install.help = (gchar *) help;
+ proc_install.author = (gchar *) author;
+ proc_install.copyright = (gchar *) copyright;
+ proc_install.date = (gchar *) date;
+ proc_install.menu_path = (gchar *) menu_label;
+ proc_install.image_types = (gchar *) image_types;
+ proc_install.type = type;
+ proc_install.nparams = n_params;
+ proc_install.nreturn_vals = n_return_vals;
+ proc_install.params = (GPParamDef *) params;
+ proc_install.return_vals = (GPParamDef *) return_vals;
+
+ if (! gp_proc_install_write (_writechannel, &proc_install, NULL))
+ gimp_quit ();
+}
+
+/**
+ * gimp_install_temp_proc:
+ * @name: the procedure's name.
+ * @blurb: a short text describing what the procedure does.
+ * @help: the help text for the procedure (usually considerably
+ * longer than @blurb).
+ * @author: the procedure's author(s).
+ * @copyright: the procedure's copyright.
+ * @date: the date the procedure was added.
+ * @menu_label: the procedure's menu label, or #NULL if the procedure has
+ * no menu entry.
+ * @image_types: the drawable types the procedure can handle.
+ * @type: the type of the procedure.
+ * @n_params: the number of parameters the procedure takes.
+ * @n_return_vals: the number of return values the procedure returns.
+ * @params: the procedure's parameters.
+ * @return_vals: the procedure's return values.
+ * @run_proc: the function to call for executing the procedure.
+ *
+ * Installs a new temporary procedure with the PDB (procedural database).
+ *
+ * A temporary procedure is a procedure which is only available while
+ * one of your plug-in's "real" procedures is running.
+ *
+ * See gimp_install_procedure() for most details.
+ *
+ * @type <emphasis>must</emphasis> be %GIMP_TEMPORARY or the function
+ * will fail.
+ *
+ * @run_proc is the function which will be called to execute the
+ * procedure.
+ *
+ * NOTE: Normally, plug-in communication is triggered by the plug-in
+ * and the GIMP core only responds to the plug-in's requests. You must
+ * explicitly enable receiving of temporary procedure run requests
+ * using either gimp_extension_enable() or
+ * gimp_extension_process(). See this functions' documentation for
+ * details.
+ **/
+void
+gimp_install_temp_proc (const gchar *name,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ const gchar *menu_label,
+ const gchar *image_types,
+ GimpPDBProcType type,
+ gint n_params,
+ gint n_return_vals,
+ const GimpParamDef *params,
+ const GimpParamDef *return_vals,
+ GimpRunProc run_proc)
+{
+ g_return_if_fail (name != NULL);
+ g_return_if_fail ((n_params == 0 && params == NULL) ||
+ (n_params > 0 && params != NULL));
+ g_return_if_fail ((n_return_vals == 0 && return_vals == NULL) ||
+ (n_return_vals > 0 && return_vals != NULL));
+ g_return_if_fail (type == GIMP_TEMPORARY);
+ g_return_if_fail (run_proc != NULL);
+
+ gimp_install_procedure (name,
+ blurb, help,
+ author, copyright, date,
+ menu_label,
+ image_types,
+ type,
+ n_params, n_return_vals,
+ params, return_vals);
+
+ /* Insert the temp proc run function into the hash table */
+ g_hash_table_insert (temp_proc_ht, g_strdup (name), (gpointer) run_proc);
+}
+
+/**
+ * gimp_uninstall_temp_proc:
+ * @name: the procedure's name
+ *
+ * Uninstalls a temporary procedure which has previously been
+ * installed using gimp_install_temp_proc().
+ **/
+void
+gimp_uninstall_temp_proc (const gchar *name)
+{
+ GPProcUninstall proc_uninstall;
+ gpointer hash_name;
+ gboolean found;
+
+ g_return_if_fail (name != NULL);
+
+ proc_uninstall.name = (gchar *) name;
+
+ if (! gp_proc_uninstall_write (_writechannel, &proc_uninstall, NULL))
+ gimp_quit ();
+
+ found = g_hash_table_lookup_extended (temp_proc_ht, name, &hash_name, NULL);
+ if (found)
+ {
+ g_hash_table_remove (temp_proc_ht, (gpointer) name);
+ g_free (hash_name);
+ }
+}
+
+/**
+ * gimp_run_procedure:
+ * @name: the name of the procedure to run
+ * @n_return_vals: return location for the number of return values
+ * @...: list of procedure parameters
+ *
+ * This function calls a GIMP procedure and returns its return values.
+ *
+ * The procedure's parameters are given by a va_list in the format
+ * (type, value, type, value) and must be terminated by %GIMP_PDB_END.
+ *
+ * This function converts the va_list of parameters into an array and
+ * passes them to gimp_run_procedure2(). Please look there for further
+ * information.
+ *
+ * Return value: the procedure's return values unless there was an error,
+ * in which case the zero-th return value will be the error status, and
+ * the first return value will be a string detailing the error.
+ **/
+GimpParam *
+gimp_run_procedure (const gchar *name,
+ gint *n_return_vals,
+ ...)
+{
+ GimpPDBArgType param_type;
+ GimpParam *return_vals;
+ GimpParam *params = NULL;
+ gint n_params = 0;
+ va_list args;
+ gint i;
+
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (n_return_vals != NULL, NULL);
+
+ va_start (args, n_return_vals);
+ param_type = va_arg (args, GimpPDBArgType);
+
+ while (param_type != GIMP_PDB_END)
+ {
+ switch (param_type)
+ {
+ case GIMP_PDB_INT32:
+ case GIMP_PDB_DISPLAY:
+ case GIMP_PDB_IMAGE:
+ case GIMP_PDB_ITEM:
+ case GIMP_PDB_LAYER:
+ case GIMP_PDB_CHANNEL:
+ case GIMP_PDB_DRAWABLE:
+ case GIMP_PDB_SELECTION:
+ case GIMP_PDB_VECTORS:
+ case GIMP_PDB_STATUS:
+ (void) va_arg (args, gint);
+ break;
+ case GIMP_PDB_INT16:
+ (void) va_arg (args, gint);
+ break;
+ case GIMP_PDB_INT8:
+ (void) va_arg (args, gint);
+ break;
+ case GIMP_PDB_FLOAT:
+ (void) va_arg (args, gdouble);
+ break;
+ case GIMP_PDB_STRING:
+ (void) va_arg (args, gchar *);
+ break;
+ case GIMP_PDB_INT32ARRAY:
+ (void) va_arg (args, gint32 *);
+ break;
+ case GIMP_PDB_INT16ARRAY:
+ (void) va_arg (args, gint16 *);
+ break;
+ case GIMP_PDB_INT8ARRAY:
+ (void) va_arg (args, gint8 *);
+ break;
+ case GIMP_PDB_FLOATARRAY:
+ (void) va_arg (args, gdouble *);
+ break;
+ case GIMP_PDB_STRINGARRAY:
+ (void) va_arg (args, gchar **);
+ break;
+ case GIMP_PDB_COLOR:
+ case GIMP_PDB_COLORARRAY:
+ (void) va_arg (args, GimpRGB *);
+ break;
+ case GIMP_PDB_PARASITE:
+ (void) va_arg (args, GimpParasite *);
+ break;
+ case GIMP_PDB_END:
+ break;
+ }
+
+ n_params++;
+
+ param_type = va_arg (args, GimpPDBArgType);
+ }
+
+ va_end (args);
+
+ params = g_new0 (GimpParam, n_params);
+
+ va_start (args, n_return_vals);
+
+ for (i = 0; i < n_params; i++)
+ {
+ params[i].type = va_arg (args, GimpPDBArgType);
+
+ switch (params[i].type)
+ {
+ case GIMP_PDB_INT32:
+ params[i].data.d_int32 = (gint32) va_arg (args, gint);
+ break;
+ case GIMP_PDB_INT16:
+ params[i].data.d_int16 = (gint16) va_arg (args, gint);
+ break;
+ case GIMP_PDB_INT8:
+ params[i].data.d_int8 = (guint8) va_arg (args, gint);
+ break;
+ case GIMP_PDB_FLOAT:
+ params[i].data.d_float = (gdouble) va_arg (args, gdouble);
+ break;
+ case GIMP_PDB_STRING:
+ params[i].data.d_string = va_arg (args, gchar *);
+ break;
+ case GIMP_PDB_INT32ARRAY:
+ params[i].data.d_int32array = va_arg (args, gint32 *);
+ break;
+ case GIMP_PDB_INT16ARRAY:
+ params[i].data.d_int16array = va_arg (args, gint16 *);
+ break;
+ case GIMP_PDB_INT8ARRAY:
+ params[i].data.d_int8array = va_arg (args, guint8 *);
+ break;
+ case GIMP_PDB_FLOATARRAY:
+ params[i].data.d_floatarray = va_arg (args, gdouble *);
+ break;
+ case GIMP_PDB_STRINGARRAY:
+ params[i].data.d_stringarray = va_arg (args, gchar **);
+ break;
+ case GIMP_PDB_COLOR:
+ params[i].data.d_color = *va_arg (args, GimpRGB *);
+ break;
+ case GIMP_PDB_ITEM:
+ params[i].data.d_item = va_arg (args, gint32);
+ break;
+ case GIMP_PDB_DISPLAY:
+ params[i].data.d_display = va_arg (args, gint32);
+ break;
+ case GIMP_PDB_IMAGE:
+ params[i].data.d_image = va_arg (args, gint32);
+ break;
+ case GIMP_PDB_LAYER:
+ params[i].data.d_layer = va_arg (args, gint32);
+ break;
+ case GIMP_PDB_CHANNEL:
+ params[i].data.d_channel = va_arg (args, gint32);
+ break;
+ case GIMP_PDB_DRAWABLE:
+ params[i].data.d_drawable = va_arg (args, gint32);
+ break;
+ case GIMP_PDB_SELECTION:
+ params[i].data.d_selection = va_arg (args, gint32);
+ break;
+ case GIMP_PDB_COLORARRAY:
+ params[i].data.d_colorarray = va_arg (args, GimpRGB *);
+ break;
+ case GIMP_PDB_VECTORS:
+ params[i].data.d_vectors = va_arg (args, gint32);
+ break;
+ case GIMP_PDB_PARASITE:
+ {
+ GimpParasite *parasite = va_arg (args, GimpParasite *);
+
+ if (parasite == NULL)
+ {
+ params[i].data.d_parasite.name = NULL;
+ params[i].data.d_parasite.data = NULL;
+ }
+ else
+ {
+ params[i].data.d_parasite.name = parasite->name;
+ params[i].data.d_parasite.flags = parasite->flags;
+ params[i].data.d_parasite.size = parasite->size;
+ params[i].data.d_parasite.data = parasite->data;
+ }
+ }
+ break;
+ case GIMP_PDB_STATUS:
+ params[i].data.d_status = va_arg (args, gint32);
+ break;
+ case GIMP_PDB_END:
+ break;
+ }
+ }
+
+ va_end (args);
+
+ return_vals = gimp_run_procedure2 (name, n_return_vals, n_params, params);
+
+ g_free (params);
+
+ return return_vals;
+}
+
+void
+gimp_read_expect_msg (GimpWireMessage *msg,
+ gint type)
+{
+ while (TRUE)
+ {
+ if (! gimp_wire_read_msg (_readchannel, msg, NULL))
+ gimp_quit ();
+
+ if (msg->type == type)
+ return; /* up to the caller to call wire_destroy() */
+
+ if (msg->type == GP_TEMP_PROC_RUN || msg->type == GP_QUIT)
+ {
+ gimp_process_message (msg);
+ }
+ else
+ {
+ g_error ("unexpected message: %d", msg->type);
+ }
+
+ gimp_wire_destroy (msg);
+ }
+}
+
+/**
+ * gimp_run_procedure2:
+ * @name: the name of the procedure to run
+ * @n_return_vals: return location for the number of return values
+ * @n_params: the number of parameters the procedure takes.
+ * @params: the procedure's parameters array.
+ *
+ * This function calls a GIMP procedure and returns its return values.
+ * To get more information about the available procedures and the
+ * parameters they expect, please have a look at the Procedure Browser
+ * as found in the Xtns menu in GIMP's toolbox.
+ *
+ * As soon as you don't need the return values any longer, you should
+ * free them using gimp_destroy_params().
+ *
+ * Return value: the procedure's return values unless there was an error,
+ * in which case the zero-th return value will be the error status, and
+ * if there are two values returned, the other return value will be a
+ * string detailing the error.
+ **/
+GimpParam *
+gimp_run_procedure2 (const gchar *name,
+ gint *n_return_vals,
+ gint n_params,
+ const GimpParam *params)
+{
+ GPProcRun proc_run;
+ GPProcReturn *proc_return;
+ GimpWireMessage msg;
+ GimpParam *return_vals;
+
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (n_return_vals != NULL, NULL);
+
+ proc_run.name = (gchar *) name;
+ proc_run.nparams = n_params;
+ proc_run.params = (GPParam *) params;
+
+ if (! gp_proc_run_write (_writechannel, &proc_run, NULL))
+ gimp_quit ();
+
+ gimp_read_expect_msg (&msg, GP_PROC_RETURN);
+
+ proc_return = msg.data;
+
+ *n_return_vals = proc_return->nparams;
+ return_vals = (GimpParam *) proc_return->params;
+
+ proc_return->nparams = 0;
+ proc_return->params = NULL;
+
+ gimp_wire_destroy (&msg);
+
+ gimp_set_pdb_error (return_vals, *n_return_vals);
+
+ return return_vals;
+}
+
+/**
+ * gimp_destroy_params:
+ * @params: the #GimpParam array to destroy
+ * @n_params: the number of elements in the array
+ *
+ * Destroys a #GimpParam array as returned by gimp_run_procedure() or
+ * gimp_run_procedure2().
+ **/
+void
+gimp_destroy_params (GimpParam *params,
+ gint n_params)
+{
+ gp_params_destroy ((GPParam *) params, n_params);
+}
+
+/**
+ * gimp_destroy_paramdefs:
+ * @paramdefs: the #GimpParamDef array to destroy
+ * @n_params: the number of elements in the array
+ *
+ * Destroys a #GimpParamDef array as returned by
+ * gimp_procedural_db_proc_info().
+ **/
+void
+gimp_destroy_paramdefs (GimpParamDef *paramdefs,
+ gint n_params)
+{
+ while (n_params--)
+ {
+ g_free (paramdefs[n_params].name);
+ g_free (paramdefs[n_params].description);
+ }
+
+ g_free (paramdefs);
+}
+
+/**
+ * gimp_get_pdb_error:
+ *
+ * Retrieves the error message from the last procedure call.
+ *
+ * If a procedure call fails, then it might pass an error message with
+ * the return values. Plug-ins that are using the libgimp C wrappers
+ * don't access the procedure return values directly. Thus libgimp
+ * stores the error message and makes it available with this
+ * function. The next procedure call unsets the error message again.
+ *
+ * The returned string is owned by libgimp and must not be freed or
+ * modified.
+ *
+ * Return value: the error message
+ *
+ * Since: 2.6
+ **/
+const gchar *
+gimp_get_pdb_error (void)
+{
+ if (pdb_error_message && strlen (pdb_error_message))
+ return pdb_error_message;
+
+ switch (pdb_error_status)
+ {
+ case GIMP_PDB_SUCCESS:
+ /* procedure executed successfully */
+ return _("success");
+
+ case GIMP_PDB_EXECUTION_ERROR:
+ /* procedure execution failed */
+ return _("execution error");
+
+ case GIMP_PDB_CALLING_ERROR:
+ /* procedure called incorrectly */
+ return _("calling error");
+
+ case GIMP_PDB_CANCEL:
+ /* procedure execution cancelled */
+ return _("cancelled");
+
+ default:
+ return "invalid return status";
+ }
+}
+
+/**
+ * gimp_get_pdb_status:
+ *
+ * Retrieves the status from the last procedure call.
+ *
+ * Return value: the #GimpPDBStatusType.
+ *
+ * Since: 2.10
+ **/
+GimpPDBStatusType
+gimp_get_pdb_status (void)
+{
+ return pdb_error_status;
+}
+
+/**
+ * gimp_tile_width:
+ *
+ * Returns the tile width GIMP is using.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * Return value: the tile_width
+ **/
+guint
+gimp_tile_width (void)
+{
+ return _tile_width;
+}
+
+/**
+ * gimp_tile_height:
+ *
+ * Returns the tile height GIMP is using.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * Return value: the tile_height
+ **/
+guint
+gimp_tile_height (void)
+{
+ return _tile_height;
+}
+
+/**
+ * gimp_shm_ID:
+ *
+ * Returns the shared memory ID used for passing tile data between the
+ * GIMP core and the plug-in.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * Return value: the shared memory ID
+ **/
+gint
+gimp_shm_ID (void)
+{
+ return _shm_ID;
+}
+
+/**
+ * gimp_shm_addr:
+ *
+ * Returns the address of the shared memory segment used for passing
+ * tile data between the GIMP core and the plug-in.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * Return value: the shared memory address
+ **/
+guchar *
+gimp_shm_addr (void)
+{
+ return _shm_addr;
+}
+
+/**
+ * gimp_gamma:
+ *
+ * Returns the global gamma value GIMP and all its plug-ins should
+ * use.
+ *
+ * This is a constant value.
+ *
+ * NOTE: This function will always return 2.2, the gamma value for
+ * sRGB. If you need the actual gamma value of a drawable, look at its
+ * format.
+ *
+ * See also: gimp_drawable_get_format().
+ *
+ * @Deprecated: 2.8.4
+ *
+ * Return value: the gamma value
+ **/
+gdouble
+gimp_gamma (void)
+{
+ return 2.2;
+}
+
+/**
+ * gimp_install_cmap:
+ *
+ * Returns whether or not the plug-in should allocate an own colormap
+ * when running on an 8 bit display. See also: gimp_min_colors().
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * @Deprecated: 2.8
+ *
+ * Return value: the install_cmap boolean
+ **/
+gboolean
+gimp_install_cmap (void)
+{
+ return FALSE;
+}
+
+/**
+ * gimp_min_colors:
+ *
+ * Returns the minimum number of colors to use when allocating an own
+ * colormap on 8 bit displays.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * See also: gimp_install_cmap()
+ *
+ * @Deprecated: 2.8
+ *
+ * Return value: the minimum number of colors to allocate
+ **/
+gint
+gimp_min_colors (void)
+{
+ return _min_colors;
+}
+
+/**
+ * gimp_show_tool_tips:
+ *
+ * Returns whether or not the plug-in should show tool-tips.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * Return value: the show_tool_tips boolean
+ **/
+gboolean
+gimp_show_tool_tips (void)
+{
+ return _show_tool_tips;
+}
+
+/**
+ * gimp_show_help_button:
+ *
+ * Returns whether or not GimpDialog should automatically add a help
+ * button if help_func and help_id are given.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * Return value: the show_help_button boolean
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_show_help_button (void)
+{
+ return _show_help_button;
+}
+
+/**
+ * gimp_export_color_profile:
+ *
+ * Returns whether file plug-ins should default to exporting the
+ * image's color profile.
+ *
+ * Return value: TRUE if preferences are set to export the color profile.
+ *
+ * Since: 2.10.4
+ **/
+gboolean
+gimp_export_color_profile (void)
+{
+ return _export_profile;
+}
+
+/**
+ * gimp_export_exif:
+ *
+ * Returns whether file plug-ins should default to exporting Exif
+ * metadata, according preferences (original settings is #FALSE since
+ * metadata can contain sensitive information).
+ *
+ * Return value: TRUE if preferences are set to export Exif.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_export_exif (void)
+{
+ return _export_exif;
+}
+
+/**
+ * gimp_export_xmp:
+ *
+ * Returns whether file plug-ins should default to exporting XMP
+ * metadata, according preferences (original settings is #FALSE since
+ * metadata can contain sensitive information).
+ *
+ * Return value: TRUE if preferences are set to export XMP.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_export_xmp (void)
+{
+ return _export_xmp;
+}
+
+/**
+ * gimp_export_iptc:
+ *
+ * Returns whether file plug-ins should default to exporting IPTC
+ * metadata, according preferences (original settings is #FALSE since
+ * metadata can contain sensitive information).
+ *
+ * Return value: TRUE if preferences are set to export IPTC.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_export_iptc (void)
+{
+ return _export_iptc;
+}
+
+/**
+ * gimp_check_size:
+ *
+ * Returns the size of the checkerboard to be used in previews.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * Return value: the check_size value
+ *
+ * Since: 2.2
+ **/
+GimpCheckSize
+gimp_check_size (void)
+{
+ return _check_size;
+}
+
+/**
+ * gimp_check_type:
+ *
+ * Returns the type of the checkerboard to be used in previews.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * Return value: the check_type value
+ *
+ * Since: 2.2
+ **/
+GimpCheckType
+gimp_check_type (void)
+{
+ return _check_type;
+}
+
+/**
+ * gimp_default_display:
+ *
+ * Returns the default display ID. This corresponds to the display the
+ * running procedure's menu entry was invoked from.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * Return value: the default display ID
+ **/
+gint32
+gimp_default_display (void)
+{
+ return _gdisp_ID;
+}
+
+/**
+ * gimp_wm_class:
+ *
+ * Returns the window manager class to be used for plug-in windows.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * Return value: the window manager class
+ **/
+const gchar *
+gimp_wm_class (void)
+{
+ return _wm_class;
+}
+
+/**
+ * gimp_display_name:
+ *
+ * Returns the display to be used for plug-in windows.
+ *
+ * This is a constant value given at plug-in configuration time.
+ * Will return #NULL if GIMP has been started with no GUI, either
+ * via "--no-interface" flag, or a console build.
+ *
+ * Return value: the display name
+ **/
+const gchar *
+gimp_display_name (void)
+{
+ return _display_name;
+}
+
+/**
+ * gimp_monitor_number:
+ *
+ * Returns the monitor number to be used for plug-in windows.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * Return value: the monitor number
+ **/
+gint
+gimp_monitor_number (void)
+{
+ return _monitor_number;
+}
+
+/**
+ * gimp_user_time:
+ *
+ * Returns the timestamp of the user interaction that should be set on
+ * the plug-in window. This is handled transparently, plug-in authors
+ * do not have to care about it.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * Return value: timestamp for plug-in window
+ *
+ * Since: 2.6
+ **/
+guint32
+gimp_user_time (void)
+{
+ return _timestamp;
+}
+
+/**
+ * gimp_get_icon_theme_dir:
+ *
+ * Returns the directory of the current icon theme.
+ *
+ * This is a constant value given at plug-in configuration time.
+ *
+ * Return value: the icon theme directory
+ *
+ * Since: 2.10.4
+ **/
+const gchar *
+gimp_icon_theme_dir (void)
+{
+ return _icon_theme_dir;
+}
+
+/**
+ * gimp_get_progname:
+ *
+ * Returns the plug-in's executable name.
+ *
+ * Return value: the executable name
+ **/
+const gchar *
+gimp_get_progname (void)
+{
+ return progname;
+}
+
+/**
+ * gimp_extension_ack:
+ *
+ * Notify the main GIMP application that the extension has been properly
+ * initialized and is ready to run.
+ *
+ * This function <emphasis>must</emphasis> be called from every
+ * procedure that was registered as #GIMP_EXTENSION.
+ *
+ * Subsequently, extensions can process temporary procedure run
+ * requests using either gimp_extension_enable() or
+ * gimp_extension_process().
+ *
+ * See also: gimp_install_procedure(), gimp_install_temp_proc()
+ **/
+void
+gimp_extension_ack (void)
+{
+ if (! gp_extension_ack_write (_writechannel, NULL))
+ gimp_quit ();
+}
+
+/**
+ * gimp_extension_enable:
+ *
+ * Enables asynchronous processing of messages from the main GIMP
+ * application.
+ *
+ * Normally, a plug-in is not called by GIMP except for the call to
+ * the procedure it implements. All subsequent communication is
+ * triggered by the plug-in and all messages sent from GIMP to the
+ * plug-in are just answers to requests the plug-in made.
+ *
+ * If the plug-in however registered temporary procedures using
+ * gimp_install_temp_proc(), it needs to be able to receive requests
+ * to execute them. Usually this will be done by running
+ * gimp_extension_process() in an endless loop.
+ *
+ * If the plug-in cannot use gimp_extension_process(), i.e. if it has
+ * a GUI and is hanging around in a #GMainLoop, it must call
+ * gimp_extension_enable().
+ *
+ * Note that the plug-in does not need to be a #GIMP_EXTENSION to
+ * register temporary procedures.
+ *
+ * See also: gimp_install_procedure(), gimp_install_temp_proc()
+ **/
+void
+gimp_extension_enable (void)
+{
+ static gboolean callback_added = FALSE;
+
+ if (! callback_added)
+ {
+ g_io_add_watch (_readchannel, G_IO_IN | G_IO_PRI, gimp_extension_read,
+ NULL);
+
+ callback_added = TRUE;
+ }
+}
+
+/**
+ * gimp_extension_process:
+ * @timeout: The timeout (in ms) to use for the select() call.
+ *
+ * Processes one message sent by GIMP and returns.
+ *
+ * Call this function in an endless loop after calling
+ * gimp_extension_ack() to process requests for running temporary
+ * procedures.
+ *
+ * See gimp_extension_enable() for an asynchronous way of doing the
+ * same if running an endless loop is not an option.
+ *
+ * See also: gimp_install_procedure(), gimp_install_temp_proc()
+ **/
+void
+gimp_extension_process (guint timeout)
+{
+#ifndef G_OS_WIN32
+ gint select_val;
+
+ do
+ {
+ fd_set readfds;
+ struct timeval tv;
+ struct timeval *tvp;
+
+ if (timeout)
+ {
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout % 1000) * 1000;
+ tvp = &tv;
+ }
+ else
+ tvp = NULL;
+
+ FD_ZERO (&readfds);
+ FD_SET (g_io_channel_unix_get_fd (_readchannel), &readfds);
+
+ if ((select_val = select (FD_SETSIZE, &readfds, NULL, NULL, tvp)) > 0)
+ {
+ gimp_single_message ();
+ }
+ else if (select_val == -1 && errno != EINTR)
+ {
+ perror ("gimp_extension_process");
+ gimp_quit ();
+ }
+ }
+ while (select_val == -1 && errno == EINTR);
+#else
+ /* Zero means infinite wait for us, but g_poll and
+ * g_io_channel_win32_poll use -1 to indicate
+ * infinite wait.
+ */
+ GPollFD pollfd;
+
+ if (timeout == 0)
+ timeout = -1;
+
+ g_io_channel_win32_make_pollfd (_readchannel, G_IO_IN, &pollfd);
+
+ if (g_io_channel_win32_poll (&pollfd, 1, timeout) == 1)
+ gimp_single_message ();
+#endif
+}
+
+/**
+ * gimp_parasite_find:
+ * @name: The name of the parasite to find.
+ *
+ * Deprecated: Use gimp_get_parasite() instead.
+ *
+ * Returns: The found parasite.
+ **/
+GimpParasite *
+gimp_parasite_find (const gchar *name)
+{
+ return gimp_get_parasite (name);
+}
+
+/**
+ * gimp_parasite_attach:
+ * @parasite: The parasite to attach.
+ *
+ * Deprecated: Use gimp_attach_parasite() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_parasite_attach (const GimpParasite *parasite)
+{
+ return gimp_attach_parasite (parasite);
+}
+
+/**
+ * gimp_parasite_detach:
+ * @name: The name of the parasite to detach.
+ *
+ * Deprecated: Use gimp_detach_parasite() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_parasite_detach (const gchar *name)
+{
+ return gimp_detach_parasite (name);
+}
+
+/**
+ * gimp_parasite_list:
+ * @num_parasites: The number of attached parasites.
+ * @parasites: The names of currently attached parasites.
+ *
+ * Deprecated: Use gimp_get_parasite_list() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_parasite_list (gint *num_parasites,
+ gchar ***parasites)
+{
+ *parasites = gimp_get_parasite_list (num_parasites);
+
+ return *parasites != NULL;
+}
+
+/**
+ * gimp_attach_new_parasite:
+ * @name: the name of the #GimpParasite to create and attach.
+ * @flags: the flags set on the #GimpParasite.
+ * @size: the size of the parasite data in bytes.
+ * @data: a pointer to the data attached with the #GimpParasite.
+ *
+ * Convenience function that creates a parasite and attaches it
+ * to GIMP.
+ *
+ * Deprecated: Use gimp_attach_parasite() instead.
+ *
+ * Return value: TRUE on successful creation and attachment of
+ * the new parasite.
+ *
+ * See Also: gimp_attach_parasite()
+ */
+gboolean
+gimp_attach_new_parasite (const gchar *name,
+ gint flags,
+ gint size,
+ gconstpointer data)
+{
+ GimpParasite *parasite = gimp_parasite_new (name, flags, size, data);
+ gboolean success;
+
+ success = gimp_attach_parasite (parasite);
+
+ gimp_parasite_free (parasite);
+
+ return success;
+}
+
+
+/* private functions */
+
+static void
+gimp_close (void)
+{
+ if (gimp_debug_flags & GIMP_DEBUG_QUIT)
+ gimp_debug_stop ();
+
+ if (PLUG_IN_INFO.quit_proc)
+ (* PLUG_IN_INFO.quit_proc) ();
+
+#if defined(USE_SYSV_SHM)
+
+ if ((_shm_ID != -1) && _shm_addr)
+ shmdt ((char *) _shm_addr);
+
+#elif defined(USE_WIN32_SHM)
+
+ if (shm_handle)
+ CloseHandle (shm_handle);
+
+#elif defined(USE_POSIX_SHM)
+
+ if ((_shm_ID != -1) && (_shm_addr != MAP_FAILED))
+ munmap (_shm_addr, TILE_MAP_SIZE);
+
+#endif
+
+ gp_quit_write (_writechannel, NULL);
+}
+
+static void
+gimp_debug_stop (void)
+{
+#ifndef G_OS_WIN32
+
+ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Waiting for debugger...");
+ raise (SIGSTOP);
+
+#else
+
+ HANDLE hThreadSnap = NULL;
+ THREADENTRY32 te32 = { 0 };
+ pid_t opid = getpid ();
+
+ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
+ "Debugging (restart externally): %ld",
+ (long int) opid);
+
+ hThreadSnap = CreateToolhelp32Snapshot (TH32CS_SNAPTHREAD, 0);
+ if (hThreadSnap == INVALID_HANDLE_VALUE)
+ {
+ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
+ "error getting threadsnap - debugging impossible");
+ return;
+ }
+
+ te32.dwSize = sizeof (THREADENTRY32);
+
+ if (Thread32First (hThreadSnap, &te32))
+ {
+ do
+ {
+ if (te32.th32OwnerProcessID == opid)
+ {
+ HANDLE hThread = OpenThread (THREAD_SUSPEND_RESUME, FALSE,
+ te32.th32ThreadID);
+ SuspendThread (hThread);
+ CloseHandle (hThread);
+ }
+ }
+ while (Thread32Next (hThreadSnap, &te32));
+ }
+ else
+ {
+ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "error getting threads");
+ }
+
+ CloseHandle (hThreadSnap);
+
+#endif
+}
+
+static void
+gimp_message_func (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer data)
+{
+ gimp_message (message);
+}
+
+static void
+gimp_fatal_func (const gchar *log_domain,
+ GLogLevelFlags flags,
+ const gchar *message,
+ gpointer data)
+{
+ const gchar *level;
+
+ switch (flags & G_LOG_LEVEL_MASK)
+ {
+ case G_LOG_LEVEL_WARNING:
+ level = "WARNING";
+ break;
+ case G_LOG_LEVEL_CRITICAL:
+ level = "CRITICAL";
+ break;
+ case G_LOG_LEVEL_ERROR:
+ level = "ERROR";
+ break;
+ default:
+ level = "FATAL";
+ break;
+ }
+
+ g_printerr ("%s: %s: %s\n",
+ progname, level, message);
+
+#ifndef G_OS_WIN32
+ switch (stack_trace_mode)
+ {
+ case GIMP_STACK_TRACE_NEVER:
+ break;
+
+ case GIMP_STACK_TRACE_QUERY:
+ {
+ sigset_t sigset;
+
+ sigemptyset (&sigset);
+ sigprocmask (SIG_SETMASK, &sigset, NULL);
+ gimp_stack_trace_query (progname);
+ }
+ break;
+
+ case GIMP_STACK_TRACE_ALWAYS:
+ {
+ sigset_t sigset;
+
+ sigemptyset (&sigset);
+ sigprocmask (SIG_SETMASK, &sigset, NULL);
+ gimp_stack_trace_print (progname, stdout, NULL);
+ }
+ break;
+ }
+#endif
+
+ /* Do not end with gimp_quit().
+ * We want the plug-in to continue its normal crash course, otherwise
+ * we won't get the "Plug-in crashed" error in GIMP.
+ */
+ exit (EXIT_FAILURE);
+}
+
+#ifdef G_OS_WIN32
+
+#ifdef HAVE_EXCHNDL
+static LONG WINAPI
+gimp_plugin_sigfatal_handler (PEXCEPTION_POINTERS pExceptionInfo)
+{
+ g_printerr ("%s: fatal error\n", progname);
+
+ SetUnhandledExceptionFilter (_prevExceptionFilter);
+
+ /* For simplicity, do not make a difference between QUERY and ALWAYS
+ * on Windows (at least not for now).
+ */
+ if (stack_trace_mode != GIMP_STACK_TRACE_NEVER &&
+ g_file_test (plug_in_backtrace_path, G_FILE_TEST_IS_REGULAR))
+ {
+ FILE *stream;
+ guchar buffer[256];
+ size_t read_len;
+
+ stream = fopen (plug_in_backtrace_path, "r");
+ do
+ {
+ /* Just read and output directly the file content. */
+ read_len = fread (buffer, 1, sizeof (buffer) - 1, stream);
+ buffer[read_len] = '\0';
+ g_printerr ("%s", buffer);
+ }
+ while (read_len);
+ fclose (stream);
+ }
+
+ if (_prevExceptionFilter && _prevExceptionFilter != gimp_plugin_sigfatal_handler)
+ return _prevExceptionFilter (pExceptionInfo);
+ else
+ return EXCEPTION_CONTINUE_SEARCH;
+}
+#endif
+
+#else
+static void
+gimp_plugin_sigfatal_handler (gint sig_num)
+{
+ switch (sig_num)
+ {
+ case SIGHUP:
+ case SIGINT:
+ case SIGQUIT:
+ case SIGTERM:
+ g_printerr ("%s terminated: %s\n", progname, g_strsignal (sig_num));
+ break;
+
+ case SIGABRT:
+ case SIGBUS:
+ case SIGSEGV:
+ case SIGFPE:
+ case SIGPIPE:
+ default:
+ g_printerr ("%s: fatal error: %s\n", progname, g_strsignal (sig_num));
+ switch (stack_trace_mode)
+ {
+ case GIMP_STACK_TRACE_NEVER:
+ break;
+
+ case GIMP_STACK_TRACE_QUERY:
+ {
+ sigset_t sigset;
+
+ sigemptyset (&sigset);
+ sigprocmask (SIG_SETMASK, &sigset, NULL);
+ gimp_stack_trace_query (progname);
+ }
+ break;
+
+ case GIMP_STACK_TRACE_ALWAYS:
+ {
+ sigset_t sigset;
+
+ sigemptyset (&sigset);
+ sigprocmask (SIG_SETMASK, &sigset, NULL);
+ gimp_stack_trace_print (progname, stdout, NULL);
+ }
+ break;
+ }
+ break;
+ }
+
+ /* Do not end with gimp_quit().
+ * We want the plug-in to continue its normal crash course, otherwise
+ * we won't get the "Plug-in crashed" error in GIMP.
+ */
+ exit (EXIT_FAILURE);
+}
+#endif
+
+static gboolean
+gimp_plugin_io_error_handler (GIOChannel *channel,
+ GIOCondition cond,
+ gpointer data)
+{
+ g_printerr ("%s: fatal error: GIMP crashed\n", progname);
+ gimp_quit ();
+
+ /* never reached */
+ return TRUE;
+}
+
+static gboolean
+gimp_write (GIOChannel *channel,
+ const guint8 *buf,
+ gulong count,
+ gpointer user_data)
+{
+ gulong bytes;
+
+ while (count > 0)
+ {
+ if ((write_buffer_index + count) >= WRITE_BUFFER_SIZE)
+ {
+ bytes = WRITE_BUFFER_SIZE - write_buffer_index;
+ memcpy (&write_buffer[write_buffer_index], buf, bytes);
+ write_buffer_index += bytes;
+ if (! gimp_wire_flush (channel, NULL))
+ return FALSE;
+ }
+ else
+ {
+ bytes = count;
+ memcpy (&write_buffer[write_buffer_index], buf, bytes);
+ write_buffer_index += bytes;
+ }
+
+ buf += bytes;
+ count -= bytes;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+gimp_flush (GIOChannel *channel,
+ gpointer user_data)
+{
+ GIOStatus status;
+ GError *error = NULL;
+ gsize count;
+ gsize bytes;
+
+ if (write_buffer_index > 0)
+ {
+ count = 0;
+ while (count != write_buffer_index)
+ {
+ do
+ {
+ bytes = 0;
+ status = g_io_channel_write_chars (channel,
+ &write_buffer[count],
+ (write_buffer_index - count),
+ &bytes,
+ &error);
+ }
+ while (status == G_IO_STATUS_AGAIN);
+
+ if (status != G_IO_STATUS_NORMAL)
+ {
+ if (error)
+ {
+ g_warning ("%s: gimp_flush(): error: %s",
+ g_get_prgname (), error->message);
+ g_error_free (error);
+ }
+ else
+ {
+ g_warning ("%s: gimp_flush(): error", g_get_prgname ());
+ }
+
+ return FALSE;
+ }
+
+ count += bytes;
+ }
+
+ write_buffer_index = 0;
+ }
+
+ return TRUE;
+}
+
+static void
+gimp_loop (void)
+{
+ GimpWireMessage msg;
+
+ while (TRUE)
+ {
+ if (! gimp_wire_read_msg (_readchannel, &msg, NULL))
+ {
+ gimp_close ();
+ return;
+ }
+
+ switch (msg.type)
+ {
+ case GP_QUIT:
+ gimp_wire_destroy (&msg);
+ gimp_close ();
+ return;
+
+ case GP_CONFIG:
+ gimp_config (msg.data);
+ break;
+
+ case GP_TILE_REQ:
+ case GP_TILE_ACK:
+ case GP_TILE_DATA:
+ g_warning ("unexpected tile message received (should not happen)");
+ break;
+
+ case GP_PROC_RUN:
+ gimp_proc_run (msg.data);
+ gimp_wire_destroy (&msg);
+ gimp_close ();
+ return;
+
+ case GP_PROC_RETURN:
+ g_warning ("unexpected proc return message received (should not happen)");
+ break;
+
+ case GP_TEMP_PROC_RUN:
+ g_warning ("unexpected temp proc run message received (should not happen");
+ break;
+
+ case GP_TEMP_PROC_RETURN:
+ g_warning ("unexpected temp proc return message received (should not happen");
+ break;
+
+ case GP_PROC_INSTALL:
+ g_warning ("unexpected proc install message received (should not happen)");
+ break;
+
+ case GP_HAS_INIT:
+ g_warning ("unexpected has init message received (should not happen)");
+ break;
+ }
+
+ gimp_wire_destroy (&msg);
+ }
+}
+
+static void
+gimp_config (GPConfig *config)
+{
+ GFile *file;
+ gchar *path;
+
+ if (config->version < GIMP_PROTOCOL_VERSION)
+ {
+ g_message ("Could not execute plug-in \"%s\"\n(%s)\n"
+ "because GIMP is using an older version of the "
+ "plug-in protocol.",
+ gimp_filename_to_utf8 (g_get_prgname ()),
+ gimp_filename_to_utf8 (progname));
+ gimp_quit ();
+ }
+ else if (config->version > GIMP_PROTOCOL_VERSION)
+ {
+ g_message ("Could not execute plug-in \"%s\"\n(%s)\n"
+ "because it uses an obsolete version of the "
+ "plug-in protocol.",
+ gimp_filename_to_utf8 (g_get_prgname ()),
+ gimp_filename_to_utf8 (progname));
+ gimp_quit ();
+ }
+
+ _tile_width = config->tile_width;
+ _tile_height = config->tile_height;
+ _shm_ID = config->shm_ID;
+ _check_size = config->check_size;
+ _check_type = config->check_type;
+ _show_tool_tips = config->show_tooltips ? TRUE : FALSE;
+ _show_help_button = config->show_help_button ? TRUE : FALSE;
+ _export_profile = config->export_profile ? TRUE : FALSE;
+ _export_exif = config->export_exif ? TRUE : FALSE;
+ _export_xmp = config->export_xmp ? TRUE : FALSE;
+ _export_iptc = config->export_iptc ? TRUE : FALSE;
+ _min_colors = config->min_colors;
+ _gdisp_ID = config->gdisp_ID;
+ _wm_class = g_strdup (config->wm_class);
+ _display_name = g_strdup (config->display_name);
+ _monitor_number = config->monitor_number;
+ _timestamp = config->timestamp;
+ _icon_theme_dir = g_strdup (config->icon_theme_dir);
+
+ if (config->app_name)
+ g_set_application_name (config->app_name);
+
+ gimp_cpu_accel_set_use (config->use_cpu_accel);
+
+ file = gimp_file_new_for_config_path (config->swap_path, NULL);
+ path = g_file_get_path (file);
+
+ g_object_set (gegl_config (),
+ "tile-cache-size", config->tile_cache_size,
+ "swap", path,
+ "swap-compression", config->swap_compression,
+ "threads", (gint) config->num_processors,
+ "use-opencl", config->use_opencl,
+ "application-license", "GPL3",
+ NULL);
+
+ g_free (path);
+ g_object_unref (file);
+
+ if (_shm_ID != -1)
+ {
+#if defined(USE_SYSV_SHM)
+
+ /* Use SysV shared memory mechanisms for transferring tile data. */
+
+ _shm_addr = (guchar *) shmat (_shm_ID, NULL, 0);
+
+ if (_shm_addr == (guchar *) -1)
+ {
+ g_error ("shmat() failed: %s\n" ERRMSG_SHM_FAILED,
+ g_strerror (errno));
+ }
+
+#elif defined(USE_WIN32_SHM)
+
+ /* Use Win32 shared memory mechanisms for transferring tile data. */
+
+ gchar fileMapName[128];
+
+ /* From the id, derive the file map name */
+ g_snprintf (fileMapName, sizeof (fileMapName), "GIMP%d.SHM", _shm_ID);
+
+ /* Open the file mapping */
+ shm_handle = OpenFileMapping (FILE_MAP_ALL_ACCESS,
+ 0, fileMapName);
+ if (shm_handle)
+ {
+ /* Map the shared memory into our address space for use */
+ _shm_addr = (guchar *) MapViewOfFile (shm_handle,
+ FILE_MAP_ALL_ACCESS,
+ 0, 0, TILE_MAP_SIZE);
+
+ /* Verify that we mapped our view */
+ if (!_shm_addr)
+ {
+ g_error ("MapViewOfFile error: %lu... " ERRMSG_SHM_FAILED,
+ GetLastError ());
+ }
+ }
+ else
+ {
+ g_error ("OpenFileMapping error: %lu... " ERRMSG_SHM_FAILED,
+ GetLastError ());
+ }
+
+#elif defined(USE_POSIX_SHM)
+
+ /* Use POSIX shared memory mechanisms for transferring tile data. */
+
+ gchar map_file[32];
+ gint shm_fd;
+
+ /* From the id, derive the file map name */
+ g_snprintf (map_file, sizeof (map_file), "/gimp-shm-%d", _shm_ID);
+
+ /* Open the file mapping */
+ shm_fd = shm_open (map_file, O_RDWR, 0600);
+
+ if (shm_fd != -1)
+ {
+ /* Map the shared memory into our address space for use */
+ _shm_addr = (guchar *) mmap (NULL, TILE_MAP_SIZE,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ shm_fd, 0);
+
+ /* Verify that we mapped our view */
+ if (_shm_addr == MAP_FAILED)
+ {
+ g_error ("mmap() failed: %s\n" ERRMSG_SHM_FAILED,
+ g_strerror (errno));
+ }
+
+ close (shm_fd);
+ }
+ else
+ {
+ g_error ("shm_open() failed: %s\n" ERRMSG_SHM_FAILED,
+ g_strerror (errno));
+ }
+
+#endif
+ }
+}
+
+static void
+gimp_proc_run (GPProcRun *proc_run)
+{
+ if (PLUG_IN_INFO.run_proc)
+ {
+ GPProcReturn proc_return;
+ GimpParam *return_vals;
+ gint n_return_vals;
+
+ (* PLUG_IN_INFO.run_proc) (proc_run->name,
+ proc_run->nparams,
+ (GimpParam *) proc_run->params,
+ &n_return_vals, &return_vals);
+
+ proc_return.name = proc_run->name;
+ proc_return.nparams = n_return_vals;
+ proc_return.params = (GPParam *) return_vals;
+
+ if (! gp_proc_return_write (_writechannel, &proc_return, NULL))
+ gimp_quit ();
+ }
+}
+
+static void
+gimp_temp_proc_run (GPProcRun *proc_run)
+{
+ GimpRunProc run_proc = g_hash_table_lookup (temp_proc_ht, proc_run->name);
+
+ if (run_proc)
+ {
+ GPProcReturn proc_return;
+ GimpParam *return_vals;
+ gint n_return_vals;
+
+#ifdef GDK_WINDOWING_QUARTZ
+ if (proc_run->params &&
+ proc_run->params[0].data.d_int32 == GIMP_RUN_INTERACTIVE)
+ {
+ [NSApp activateIgnoringOtherApps: YES];
+ }
+#endif
+
+ (* run_proc) (proc_run->name,
+ proc_run->nparams,
+ (GimpParam *) proc_run->params,
+ &n_return_vals, &return_vals);
+
+ proc_return.name = proc_run->name;
+ proc_return.nparams = n_return_vals;
+ proc_return.params = (GPParam *) return_vals;
+
+ if (! gp_temp_proc_return_write (_writechannel, &proc_return, NULL))
+ gimp_quit ();
+ }
+}
+
+static void
+gimp_process_message (GimpWireMessage *msg)
+{
+ switch (msg->type)
+ {
+ case GP_QUIT:
+ gimp_quit ();
+ break;
+ case GP_CONFIG:
+ gimp_config (msg->data);
+ break;
+ case GP_TILE_REQ:
+ case GP_TILE_ACK:
+ case GP_TILE_DATA:
+ g_warning ("unexpected tile message received (should not happen)");
+ break;
+ case GP_PROC_RUN:
+ g_warning ("unexpected proc run message received (should not happen)");
+ break;
+ case GP_PROC_RETURN:
+ g_warning ("unexpected proc return message received (should not happen)");
+ break;
+ case GP_TEMP_PROC_RUN:
+ gimp_temp_proc_run (msg->data);
+ break;
+ case GP_TEMP_PROC_RETURN:
+ g_warning ("unexpected temp proc return message received (should not happen)");
+ break;
+ case GP_PROC_INSTALL:
+ g_warning ("unexpected proc install message received (should not happen)");
+ break;
+ case GP_HAS_INIT:
+ g_warning ("unexpected has init message received (should not happen)");
+ break;
+ }
+}
+
+static void
+gimp_single_message (void)
+{
+ GimpWireMessage msg;
+
+ /* Run a temp function */
+ if (! gimp_wire_read_msg (_readchannel, &msg, NULL))
+ gimp_quit ();
+
+ gimp_process_message (&msg);
+
+ gimp_wire_destroy (&msg);
+}
+
+static gboolean
+gimp_extension_read (GIOChannel *channel,
+ GIOCondition condition,
+ gpointer data)
+{
+ gimp_single_message ();
+
+ return TRUE;
+}
+
+static void
+gimp_set_pdb_error (const GimpParam *return_vals,
+ gint n_return_vals)
+{
+ if (pdb_error_message)
+ {
+ g_free (pdb_error_message);
+ pdb_error_message = NULL;
+ }
+
+ pdb_error_status = return_vals[0].data.d_status;
+
+ switch (pdb_error_status)
+ {
+ case GIMP_PDB_SUCCESS:
+ case GIMP_PDB_PASS_THROUGH:
+ break;
+
+ case GIMP_PDB_EXECUTION_ERROR:
+ case GIMP_PDB_CALLING_ERROR:
+ case GIMP_PDB_CANCEL:
+ if (n_return_vals > 1 && return_vals[1].type == GIMP_PDB_STRING)
+ {
+ pdb_error_message = g_strdup (return_vals[1].data.d_string);
+ }
+ break;
+ }
+}
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
new file mode 100644
index 0000000..b65b730
--- /dev/null
+++ b/libgimp/gimp.def
@@ -0,0 +1,939 @@
+EXPORTS
+ gimp_airbrush
+ gimp_airbrush_default
+ gimp_attach_new_parasite
+ gimp_attach_parasite
+ gimp_brightness_contrast
+ gimp_brush_application_mode_get_type
+ gimp_brush_delete
+ gimp_brush_duplicate
+ gimp_brush_get_angle
+ gimp_brush_get_aspect_ratio
+ gimp_brush_get_hardness
+ gimp_brush_get_info
+ gimp_brush_get_pixels
+ gimp_brush_get_radius
+ gimp_brush_get_shape
+ gimp_brush_get_spacing
+ gimp_brush_get_spikes
+ gimp_brush_is_editable
+ gimp_brush_is_generated
+ gimp_brush_new
+ gimp_brush_rename
+ gimp_brush_select_destroy
+ gimp_brush_select_new
+ gimp_brush_set_angle
+ gimp_brush_set_aspect_ratio
+ gimp_brush_set_hardness
+ gimp_brush_set_radius
+ gimp_brush_set_shape
+ gimp_brush_set_spacing
+ gimp_brush_set_spikes
+ gimp_brushes_close_popup
+ gimp_brushes_get_brush
+ gimp_brushes_get_brush_data
+ gimp_brushes_get_list
+ gimp_brushes_get_opacity
+ gimp_brushes_get_paint_mode
+ gimp_brushes_get_spacing
+ gimp_brushes_popup
+ gimp_brushes_refresh
+ gimp_brushes_set_brush
+ gimp_brushes_set_opacity
+ gimp_brushes_set_paint_mode
+ gimp_brushes_set_popup
+ gimp_brushes_set_spacing
+ gimp_buffer_delete
+ gimp_buffer_get_bytes
+ gimp_buffer_get_height
+ gimp_buffer_get_image_type
+ gimp_buffer_get_width
+ gimp_buffer_rename
+ gimp_buffers_get_list
+ gimp_by_color_select
+ gimp_by_color_select_full
+ gimp_channel_combine_masks
+ gimp_channel_copy
+ gimp_channel_get_color
+ gimp_channel_get_opacity
+ gimp_channel_get_show_masked
+ gimp_channel_new
+ gimp_channel_new_from_component
+ gimp_channel_set_color
+ gimp_channel_set_opacity
+ gimp_channel_set_show_masked
+ gimp_check_size
+ gimp_check_type
+ gimp_clone
+ gimp_clone_default
+ gimp_color_balance
+ gimp_colorize
+ gimp_context_get_antialias
+ gimp_context_get_background
+ gimp_context_get_brush
+ gimp_context_get_brush_angle
+ gimp_context_get_brush_aspect_ratio
+ gimp_context_get_brush_force
+ gimp_context_get_brush_hardness
+ gimp_context_get_brush_size
+ gimp_context_get_brush_spacing
+ gimp_context_get_diagonal_neighbors
+ gimp_context_get_distance_metric
+ gimp_context_get_dynamics
+ gimp_context_get_feather
+ gimp_context_get_feather_radius
+ gimp_context_get_font
+ gimp_context_get_foreground
+ gimp_context_get_gradient
+ gimp_context_get_gradient_blend_color_space
+ gimp_context_get_gradient_repeat_mode
+ gimp_context_get_gradient_reverse
+ gimp_context_get_ink_angle
+ gimp_context_get_ink_blob_angle
+ gimp_context_get_ink_blob_aspect_ratio
+ gimp_context_get_ink_blob_type
+ gimp_context_get_ink_size
+ gimp_context_get_ink_size_sensitivity
+ gimp_context_get_ink_speed_sensitivity
+ gimp_context_get_ink_tilt_sensitivity
+ gimp_context_get_interpolation
+ gimp_context_get_line_cap_style
+ gimp_context_get_line_dash_offset
+ gimp_context_get_line_dash_pattern
+ gimp_context_get_line_join_style
+ gimp_context_get_line_miter_limit
+ gimp_context_get_line_width
+ gimp_context_get_line_width_unit
+ gimp_context_get_mypaint_brush
+ gimp_context_get_opacity
+ gimp_context_get_paint_method
+ gimp_context_get_paint_mode
+ gimp_context_get_palette
+ gimp_context_get_pattern
+ gimp_context_get_sample_criterion
+ gimp_context_get_sample_merged
+ gimp_context_get_sample_threshold
+ gimp_context_get_sample_threshold_int
+ gimp_context_get_sample_transparent
+ gimp_context_get_stroke_method
+ gimp_context_get_transform_direction
+ gimp_context_get_transform_recursion
+ gimp_context_get_transform_resize
+ gimp_context_list_paint_methods
+ gimp_context_pop
+ gimp_context_push
+ gimp_context_set_antialias
+ gimp_context_set_background
+ gimp_context_set_brush
+ gimp_context_set_brush_angle
+ gimp_context_set_brush_aspect_ratio
+ gimp_context_set_brush_default_hardness
+ gimp_context_set_brush_default_size
+ gimp_context_set_brush_default_spacing
+ gimp_context_set_brush_force
+ gimp_context_set_brush_hardness
+ gimp_context_set_brush_size
+ gimp_context_set_brush_spacing
+ gimp_context_set_default_colors
+ gimp_context_set_defaults
+ gimp_context_set_diagonal_neighbors
+ gimp_context_set_distance_metric
+ gimp_context_set_dynamics
+ gimp_context_set_feather
+ gimp_context_set_feather_radius
+ gimp_context_set_font
+ gimp_context_set_foreground
+ gimp_context_set_gradient
+ gimp_context_set_gradient_blend_color_space
+ gimp_context_set_gradient_fg_bg_hsv_ccw
+ gimp_context_set_gradient_fg_bg_hsv_cw
+ gimp_context_set_gradient_fg_bg_rgb
+ gimp_context_set_gradient_fg_transparent
+ gimp_context_set_gradient_repeat_mode
+ gimp_context_set_gradient_reverse
+ gimp_context_set_ink_angle
+ gimp_context_set_ink_blob_angle
+ gimp_context_set_ink_blob_aspect_ratio
+ gimp_context_set_ink_blob_type
+ gimp_context_set_ink_size
+ gimp_context_set_ink_size_sensitivity
+ gimp_context_set_ink_speed_sensitivity
+ gimp_context_set_ink_tilt_sensitivity
+ gimp_context_set_interpolation
+ gimp_context_set_line_cap_style
+ gimp_context_set_line_dash_offset
+ gimp_context_set_line_dash_pattern
+ gimp_context_set_line_join_style
+ gimp_context_set_line_miter_limit
+ gimp_context_set_line_width
+ gimp_context_set_line_width_unit
+ gimp_context_set_mypaint_brush
+ gimp_context_set_opacity
+ gimp_context_set_paint_method
+ gimp_context_set_paint_mode
+ gimp_context_set_palette
+ gimp_context_set_pattern
+ gimp_context_set_sample_criterion
+ gimp_context_set_sample_merged
+ gimp_context_set_sample_threshold
+ gimp_context_set_sample_threshold_int
+ gimp_context_set_sample_transparent
+ gimp_context_set_stroke_method
+ gimp_context_set_transform_direction
+ gimp_context_set_transform_recursion
+ gimp_context_set_transform_resize
+ gimp_context_swap_colors
+ gimp_convert_dither_type_get_type
+ gimp_convolve
+ gimp_convolve_default
+ gimp_curves_explicit
+ gimp_curves_spline
+ gimp_debug_timer_end
+ gimp_debug_timer_start
+ gimp_default_display
+ gimp_desaturate
+ gimp_desaturate_full
+ gimp_destroy_paramdefs
+ gimp_destroy_params
+ gimp_detach_parasite
+ gimp_display_delete
+ gimp_display_get_window_handle
+ gimp_display_is_valid
+ gimp_display_name
+ gimp_display_new
+ gimp_displays_flush
+ gimp_displays_reconnect
+ gimp_dodgeburn
+ gimp_dodgeburn_default
+ gimp_drawable_attach_new_parasite
+ gimp_drawable_bpp
+ gimp_drawable_brightness_contrast
+ gimp_drawable_color_balance
+ gimp_drawable_colorize_hsl
+ gimp_drawable_curves_explicit
+ gimp_drawable_curves_spline
+ gimp_drawable_delete
+ gimp_drawable_desaturate
+ gimp_drawable_detach
+ gimp_drawable_edit_bucket_fill
+ gimp_drawable_edit_clear
+ gimp_drawable_edit_fill
+ gimp_drawable_edit_gradient_fill
+ gimp_drawable_edit_stroke_item
+ gimp_drawable_edit_stroke_selection
+ gimp_drawable_equalize
+ gimp_drawable_extract_component
+ gimp_drawable_fill
+ gimp_drawable_flush
+ gimp_drawable_foreground_extract
+ gimp_drawable_free_shadow
+ gimp_drawable_get
+ gimp_drawable_get_buffer
+ gimp_drawable_get_color_uchar
+ gimp_drawable_get_format
+ gimp_drawable_get_image
+ gimp_drawable_get_linked
+ gimp_drawable_get_name
+ gimp_drawable_get_pixel
+ gimp_drawable_get_shadow_buffer
+ gimp_drawable_get_sub_thumbnail
+ gimp_drawable_get_sub_thumbnail_data
+ gimp_drawable_get_tattoo
+ gimp_drawable_get_thumbnail
+ gimp_drawable_get_thumbnail_data
+ gimp_drawable_get_thumbnail_format
+ gimp_drawable_get_tile
+ gimp_drawable_get_tile2
+ gimp_drawable_get_visible
+ gimp_drawable_has_alpha
+ gimp_drawable_height
+ gimp_drawable_histogram
+ gimp_drawable_hue_saturation
+ gimp_drawable_invert
+ gimp_drawable_is_channel
+ gimp_drawable_is_gray
+ gimp_drawable_is_indexed
+ gimp_drawable_is_layer
+ gimp_drawable_is_layer_mask
+ gimp_drawable_is_rgb
+ gimp_drawable_is_text_layer
+ gimp_drawable_is_valid
+ gimp_drawable_levels
+ gimp_drawable_levels_stretch
+ gimp_drawable_mask_bounds
+ gimp_drawable_mask_intersect
+ gimp_drawable_merge_shadow
+ gimp_drawable_offset
+ gimp_drawable_offsets
+ gimp_drawable_parasite_attach
+ gimp_drawable_parasite_detach
+ gimp_drawable_parasite_find
+ gimp_drawable_parasite_list
+ gimp_drawable_posterize
+ gimp_drawable_set_image
+ gimp_drawable_set_linked
+ gimp_drawable_set_name
+ gimp_drawable_set_pixel
+ gimp_drawable_set_tattoo
+ gimp_drawable_set_visible
+ gimp_drawable_shadows_highlights
+ gimp_drawable_threshold
+ gimp_drawable_transform_2d
+ gimp_drawable_transform_2d_default
+ gimp_drawable_transform_flip
+ gimp_drawable_transform_flip_default
+ gimp_drawable_transform_flip_simple
+ gimp_drawable_transform_matrix
+ gimp_drawable_transform_matrix_default
+ gimp_drawable_transform_perspective
+ gimp_drawable_transform_perspective_default
+ gimp_drawable_transform_rotate
+ gimp_drawable_transform_rotate_default
+ gimp_drawable_transform_rotate_simple
+ gimp_drawable_transform_scale
+ gimp_drawable_transform_scale_default
+ gimp_drawable_transform_shear
+ gimp_drawable_transform_shear_default
+ gimp_drawable_type
+ gimp_drawable_type_with_alpha
+ gimp_drawable_update
+ gimp_drawable_width
+ gimp_dynamics_get_list
+ gimp_dynamics_refresh
+ gimp_edit_blend
+ gimp_edit_bucket_fill
+ gimp_edit_bucket_fill_full
+ gimp_edit_clear
+ gimp_edit_copy
+ gimp_edit_copy_visible
+ gimp_edit_cut
+ gimp_edit_fill
+ gimp_edit_named_copy
+ gimp_edit_named_copy_visible
+ gimp_edit_named_cut
+ gimp_edit_named_paste
+ gimp_edit_named_paste_as_new
+ gimp_edit_named_paste_as_new_image
+ gimp_edit_paste
+ gimp_edit_paste_as_new
+ gimp_edit_paste_as_new_image
+ gimp_edit_stroke
+ gimp_edit_stroke_vectors
+ gimp_ellipse_select
+ gimp_enums_get_type_names
+ gimp_enums_init
+ gimp_equalize
+ gimp_eraser
+ gimp_eraser_default
+ gimp_export_color_profile
+ gimp_export_exif
+ gimp_export_iptc
+ gimp_export_xmp
+ gimp_extension_ack
+ gimp_extension_enable
+ gimp_extension_process
+ gimp_file_load
+ gimp_file_load_layer
+ gimp_file_load_layers
+ gimp_file_save
+ gimp_file_save_thumbnail
+ gimp_flip
+ gimp_floating_sel_anchor
+ gimp_floating_sel_attach
+ gimp_floating_sel_relax
+ gimp_floating_sel_remove
+ gimp_floating_sel_rigor
+ gimp_floating_sel_to_layer
+ gimp_font_select_destroy
+ gimp_font_select_new
+ gimp_fonts_close_popup
+ gimp_fonts_get_list
+ gimp_fonts_popup
+ gimp_fonts_refresh
+ gimp_fonts_set_popup
+ gimp_free_select
+ gimp_fuzzy_select
+ gimp_fuzzy_select_full
+ gimp_gamma
+ gimp_get_color_configuration
+ gimp_get_default_comment
+ gimp_get_default_unit
+ gimp_get_icon_theme_dir
+ gimp_get_module_load_inhibit
+ gimp_get_monitor_resolution
+ gimp_get_parasite
+ gimp_get_parasite_list
+ gimp_get_path_by_tattoo
+ gimp_get_pdb_error
+ gimp_get_pdb_status
+ gimp_get_progname
+ gimp_get_theme_dir
+ gimp_getpid
+ gimp_gimprc_query
+ gimp_gimprc_set
+ gimp_gradient_delete
+ gimp_gradient_duplicate
+ gimp_gradient_get_custom_samples
+ gimp_gradient_get_number_of_segments
+ gimp_gradient_get_uniform_samples
+ gimp_gradient_is_editable
+ gimp_gradient_new
+ gimp_gradient_rename
+ gimp_gradient_segment_get_blending_function
+ gimp_gradient_segment_get_coloring_type
+ gimp_gradient_segment_get_left_color
+ gimp_gradient_segment_get_left_pos
+ gimp_gradient_segment_get_middle_pos
+ gimp_gradient_segment_get_right_color
+ gimp_gradient_segment_get_right_pos
+ gimp_gradient_segment_range_blend_colors
+ gimp_gradient_segment_range_blend_opacity
+ gimp_gradient_segment_range_delete
+ gimp_gradient_segment_range_flip
+ gimp_gradient_segment_range_move
+ gimp_gradient_segment_range_redistribute_handles
+ gimp_gradient_segment_range_replicate
+ gimp_gradient_segment_range_set_blending_function
+ gimp_gradient_segment_range_set_coloring_type
+ gimp_gradient_segment_range_split_midpoint
+ gimp_gradient_segment_range_split_uniform
+ gimp_gradient_segment_set_left_color
+ gimp_gradient_segment_set_left_pos
+ gimp_gradient_segment_set_middle_pos
+ gimp_gradient_segment_set_right_color
+ gimp_gradient_segment_set_right_pos
+ gimp_gradient_select_destroy
+ gimp_gradient_select_new
+ gimp_gradients_close_popup
+ gimp_gradients_get_gradient
+ gimp_gradients_get_gradient_data
+ gimp_gradients_get_list
+ gimp_gradients_popup
+ gimp_gradients_refresh
+ gimp_gradients_sample_custom
+ gimp_gradients_sample_uniform
+ gimp_gradients_set_gradient
+ gimp_gradients_set_popup
+ gimp_heal
+ gimp_heal_default
+ gimp_help
+ gimp_histogram
+ gimp_histogram_channel_get_type
+ gimp_hue_saturation
+ gimp_icon_theme_dir
+ gimp_image_add_channel
+ gimp_image_add_hguide
+ gimp_image_add_layer
+ gimp_image_add_sample_point
+ gimp_image_add_vectors
+ gimp_image_add_vguide
+ gimp_image_attach_new_parasite
+ gimp_image_attach_parasite
+ gimp_image_base_type
+ gimp_image_clean_all
+ gimp_image_convert_color_profile
+ gimp_image_convert_color_profile_from_file
+ gimp_image_convert_grayscale
+ gimp_image_convert_indexed
+ gimp_image_convert_precision
+ gimp_image_convert_rgb
+ gimp_image_convert_set_dither_matrix
+ gimp_image_crop
+ gimp_image_delete
+ gimp_image_delete_guide
+ gimp_image_delete_sample_point
+ gimp_image_detach_parasite
+ gimp_image_duplicate
+ gimp_image_find_next_guide
+ gimp_image_find_next_sample_point
+ gimp_image_flatten
+ gimp_image_flip
+ gimp_image_floating_sel_attached_to
+ gimp_image_free_shadow
+ gimp_image_freeze_channels
+ gimp_image_freeze_layers
+ gimp_image_freeze_vectors
+ gimp_image_get_active_channel
+ gimp_image_get_active_drawable
+ gimp_image_get_active_layer
+ gimp_image_get_active_vectors
+ gimp_image_get_channel_by_name
+ gimp_image_get_channel_by_tattoo
+ gimp_image_get_channel_position
+ gimp_image_get_channels
+ gimp_image_get_cmap
+ gimp_image_get_color_profile
+ gimp_image_get_colormap
+ gimp_image_get_component_active
+ gimp_image_get_component_visible
+ gimp_image_get_default_new_layer_mode
+ gimp_image_get_effective_color_profile
+ gimp_image_get_exported_uri
+ gimp_image_get_filename
+ gimp_image_get_floating_sel
+ gimp_image_get_guide_orientation
+ gimp_image_get_guide_position
+ gimp_image_get_imported_uri
+ gimp_image_get_item_position
+ gimp_image_get_layer_by_name
+ gimp_image_get_layer_by_tattoo
+ gimp_image_get_layer_position
+ gimp_image_get_layers
+ gimp_image_get_metadata
+ gimp_image_get_name
+ gimp_image_get_parasite
+ gimp_image_get_parasite_list
+ gimp_image_get_precision
+ gimp_image_get_resolution
+ gimp_image_get_sample_point_position
+ gimp_image_get_selection
+ gimp_image_get_tattoo_state
+ gimp_image_get_thumbnail
+ gimp_image_get_thumbnail_data
+ gimp_image_get_unit
+ gimp_image_get_uri
+ gimp_image_get_vectors
+ gimp_image_get_vectors_by_name
+ gimp_image_get_vectors_by_tattoo
+ gimp_image_get_vectors_position
+ gimp_image_get_xcf_uri
+ gimp_image_grid_get_background_color
+ gimp_image_grid_get_foreground_color
+ gimp_image_grid_get_offset
+ gimp_image_grid_get_spacing
+ gimp_image_grid_get_style
+ gimp_image_grid_set_background_color
+ gimp_image_grid_set_foreground_color
+ gimp_image_grid_set_offset
+ gimp_image_grid_set_spacing
+ gimp_image_grid_set_style
+ gimp_image_height
+ gimp_image_insert_channel
+ gimp_image_insert_layer
+ gimp_image_insert_vectors
+ gimp_image_is_dirty
+ gimp_image_is_valid
+ gimp_image_list
+ gimp_image_lower_channel
+ gimp_image_lower_item
+ gimp_image_lower_item_to_bottom
+ gimp_image_lower_layer
+ gimp_image_lower_layer_to_bottom
+ gimp_image_lower_vectors
+ gimp_image_lower_vectors_to_bottom
+ gimp_image_merge_down
+ gimp_image_merge_layer_group
+ gimp_image_merge_visible_layers
+ gimp_image_new
+ gimp_image_new_with_precision
+ gimp_image_parasite_attach
+ gimp_image_parasite_detach
+ gimp_image_parasite_find
+ gimp_image_parasite_list
+ gimp_image_pick_color
+ gimp_image_pick_correlate_layer
+ gimp_image_raise_channel
+ gimp_image_raise_item
+ gimp_image_raise_item_to_top
+ gimp_image_raise_layer
+ gimp_image_raise_layer_to_top
+ gimp_image_raise_vectors
+ gimp_image_raise_vectors_to_top
+ gimp_image_remove_channel
+ gimp_image_remove_layer
+ gimp_image_remove_vectors
+ gimp_image_reorder_item
+ gimp_image_resize
+ gimp_image_resize_to_layers
+ gimp_image_rotate
+ gimp_image_scale
+ gimp_image_scale_full
+ gimp_image_select_color
+ gimp_image_select_contiguous_color
+ gimp_image_select_ellipse
+ gimp_image_select_item
+ gimp_image_select_polygon
+ gimp_image_select_rectangle
+ gimp_image_select_round_rectangle
+ gimp_image_set_active_channel
+ gimp_image_set_active_layer
+ gimp_image_set_active_vectors
+ gimp_image_set_cmap
+ gimp_image_set_color_profile
+ gimp_image_set_color_profile_from_file
+ gimp_image_set_colormap
+ gimp_image_set_component_active
+ gimp_image_set_component_visible
+ gimp_image_set_filename
+ gimp_image_set_metadata
+ gimp_image_set_resolution
+ gimp_image_set_tattoo_state
+ gimp_image_set_unit
+ gimp_image_thaw_channels
+ gimp_image_thaw_layers
+ gimp_image_thaw_vectors
+ gimp_image_undo_disable
+ gimp_image_undo_enable
+ gimp_image_undo_freeze
+ gimp_image_undo_group_end
+ gimp_image_undo_group_start
+ gimp_image_undo_is_enabled
+ gimp_image_undo_thaw
+ gimp_image_unset_active_channel
+ gimp_image_width
+ gimp_install_cmap
+ gimp_install_procedure
+ gimp_install_temp_proc
+ gimp_invert
+ gimp_item_attach_parasite
+ gimp_item_delete
+ gimp_item_detach_parasite
+ gimp_item_get_children
+ gimp_item_get_color_tag
+ gimp_item_get_expanded
+ gimp_item_get_image
+ gimp_item_get_linked
+ gimp_item_get_lock_content
+ gimp_item_get_lock_position
+ gimp_item_get_name
+ gimp_item_get_parasite
+ gimp_item_get_parasite_list
+ gimp_item_get_parent
+ gimp_item_get_tattoo
+ gimp_item_get_visible
+ gimp_item_is_channel
+ gimp_item_is_drawable
+ gimp_item_is_group
+ gimp_item_is_layer
+ gimp_item_is_layer_mask
+ gimp_item_is_selection
+ gimp_item_is_text_layer
+ gimp_item_is_valid
+ gimp_item_is_vectors
+ gimp_item_set_color_tag
+ gimp_item_set_expanded
+ gimp_item_set_linked
+ gimp_item_set_lock_content
+ gimp_item_set_lock_position
+ gimp_item_set_name
+ gimp_item_set_tattoo
+ gimp_item_set_visible
+ gimp_item_transform_2d
+ gimp_item_transform_flip
+ gimp_item_transform_flip_simple
+ gimp_item_transform_matrix
+ gimp_item_transform_perspective
+ gimp_item_transform_rotate
+ gimp_item_transform_rotate_simple
+ gimp_item_transform_scale
+ gimp_item_transform_shear
+ gimp_item_transform_translate
+ gimp_layer_add_alpha
+ gimp_layer_add_mask
+ gimp_layer_color_space_get_type
+ gimp_layer_composite_mode_get_type
+ gimp_layer_copy
+ gimp_layer_create_mask
+ gimp_layer_flatten
+ gimp_layer_from_mask
+ gimp_layer_get_apply_mask
+ gimp_layer_get_blend_space
+ gimp_layer_get_composite_mode
+ gimp_layer_get_composite_space
+ gimp_layer_get_edit_mask
+ gimp_layer_get_lock_alpha
+ gimp_layer_get_mask
+ gimp_layer_get_mode
+ gimp_layer_get_opacity
+ gimp_layer_get_preserve_trans
+ gimp_layer_get_show_mask
+ gimp_layer_group_new
+ gimp_layer_is_floating_sel
+ gimp_layer_mode_get_type
+ gimp_layer_new
+ gimp_layer_new_from_drawable
+ gimp_layer_new_from_pixbuf
+ gimp_layer_new_from_surface
+ gimp_layer_new_from_visible
+ gimp_layer_remove_mask
+ gimp_layer_resize
+ gimp_layer_resize_to_image_size
+ gimp_layer_scale
+ gimp_layer_scale_full
+ gimp_layer_set_apply_mask
+ gimp_layer_set_blend_space
+ gimp_layer_set_composite_mode
+ gimp_layer_set_composite_space
+ gimp_layer_set_edit_mask
+ gimp_layer_set_lock_alpha
+ gimp_layer_set_mode
+ gimp_layer_set_offsets
+ gimp_layer_set_opacity
+ gimp_layer_set_preserve_trans
+ gimp_layer_set_show_mask
+ gimp_layer_translate
+ gimp_levels
+ gimp_levels_auto
+ gimp_levels_stretch
+ gimp_main
+ gimp_message
+ gimp_message_get_handler
+ gimp_message_set_handler
+ gimp_min_colors
+ gimp_monitor_number
+ gimp_paintbrush
+ gimp_paintbrush_default
+ gimp_palette_add_entry
+ gimp_palette_delete
+ gimp_palette_delete_entry
+ gimp_palette_duplicate
+ gimp_palette_entry_get_color
+ gimp_palette_entry_get_name
+ gimp_palette_entry_set_color
+ gimp_palette_entry_set_name
+ gimp_palette_get_background
+ gimp_palette_get_colors
+ gimp_palette_get_columns
+ gimp_palette_get_foreground
+ gimp_palette_get_info
+ gimp_palette_is_editable
+ gimp_palette_new
+ gimp_palette_rename
+ gimp_palette_select_destroy
+ gimp_palette_select_new
+ gimp_palette_set_background
+ gimp_palette_set_columns
+ gimp_palette_set_default_colors
+ gimp_palette_set_foreground
+ gimp_palette_swap_colors
+ gimp_palettes_close_popup
+ gimp_palettes_get_list
+ gimp_palettes_get_palette
+ gimp_palettes_get_palette_entry
+ gimp_palettes_popup
+ gimp_palettes_refresh
+ gimp_palettes_set_palette
+ gimp_palettes_set_popup
+ gimp_parasite_attach
+ gimp_parasite_detach
+ gimp_parasite_find
+ gimp_parasite_list
+ gimp_path_delete
+ gimp_path_get_current
+ gimp_path_get_locked
+ gimp_path_get_point_at_dist
+ gimp_path_get_points
+ gimp_path_get_tattoo
+ gimp_path_import
+ gimp_path_list
+ gimp_path_set_current
+ gimp_path_set_locked
+ gimp_path_set_points
+ gimp_path_set_tattoo
+ gimp_path_stroke_current
+ gimp_path_to_selection
+ gimp_pattern_get_info
+ gimp_pattern_get_pixels
+ gimp_pattern_select_destroy
+ gimp_pattern_select_new
+ gimp_patterns_close_popup
+ gimp_patterns_get_list
+ gimp_patterns_get_pattern
+ gimp_patterns_get_pattern_data
+ gimp_patterns_popup
+ gimp_patterns_refresh
+ gimp_patterns_set_pattern
+ gimp_patterns_set_popup
+ gimp_pencil
+ gimp_perspective
+ gimp_pixel_fetcher_destroy
+ gimp_pixel_fetcher_get_pixel
+ gimp_pixel_fetcher_new
+ gimp_pixel_fetcher_put_pixel
+ gimp_pixel_fetcher_set_bg_color
+ gimp_pixel_fetcher_set_edge_mode
+ gimp_pixel_rgn_get_col
+ gimp_pixel_rgn_get_pixel
+ gimp_pixel_rgn_get_rect
+ gimp_pixel_rgn_get_row
+ gimp_pixel_rgn_init
+ gimp_pixel_rgn_resize
+ gimp_pixel_rgn_set_col
+ gimp_pixel_rgn_set_pixel
+ gimp_pixel_rgn_set_rect
+ gimp_pixel_rgn_set_row
+ gimp_pixel_rgns_process
+ gimp_pixel_rgns_register
+ gimp_pixel_rgns_register2
+ gimp_plug_in_error_quark
+ gimp_plugin_domain_register
+ gimp_plugin_enable_precision
+ gimp_plugin_get_pdb_error_handler
+ gimp_plugin_help_register
+ gimp_plugin_icon_register
+ gimp_plugin_menu_branch_register
+ gimp_plugin_menu_register
+ gimp_plugin_precision_enabled
+ gimp_plugin_set_pdb_error_handler
+ gimp_posterize
+ gimp_procedural_db_dump
+ gimp_procedural_db_get_data
+ gimp_procedural_db_get_data_size
+ gimp_procedural_db_proc_arg
+ gimp_procedural_db_proc_exists
+ gimp_procedural_db_proc_info
+ gimp_procedural_db_proc_val
+ gimp_procedural_db_query
+ gimp_procedural_db_set_data
+ gimp_procedural_db_temp_name
+ gimp_progress_cancel
+ gimp_progress_end
+ gimp_progress_get_window_handle
+ gimp_progress_init
+ gimp_progress_init_printf
+ gimp_progress_install
+ gimp_progress_install_vtable
+ gimp_progress_pulse
+ gimp_progress_set_text
+ gimp_progress_set_text_printf
+ gimp_progress_uninstall
+ gimp_progress_update
+ gimp_quit
+ gimp_read_expect_msg
+ gimp_rect_select
+ gimp_register_file_handler_mime
+ gimp_register_file_handler_priority
+ gimp_register_file_handler_raw
+ gimp_register_file_handler_uri
+ gimp_register_load_handler
+ gimp_register_magic_load_handler
+ gimp_register_save_handler
+ gimp_register_thumbnail_loader
+ gimp_rgn_iterate1
+ gimp_rgn_iterate2
+ gimp_rgn_iterator_dest
+ gimp_rgn_iterator_free
+ gimp_rgn_iterator_new
+ gimp_rgn_iterator_src
+ gimp_rgn_iterator_src_dest
+ gimp_rotate
+ gimp_round_rect_select
+ gimp_run_procedure
+ gimp_run_procedure2
+ gimp_scale
+ gimp_selection_all
+ gimp_selection_border
+ gimp_selection_bounds
+ gimp_selection_clear
+ gimp_selection_combine
+ gimp_selection_feather
+ gimp_selection_float
+ gimp_selection_flood
+ gimp_selection_grow
+ gimp_selection_invert
+ gimp_selection_is_empty
+ gimp_selection_layer_alpha
+ gimp_selection_load
+ gimp_selection_none
+ gimp_selection_save
+ gimp_selection_sharpen
+ gimp_selection_shrink
+ gimp_selection_translate
+ gimp_selection_value
+ gimp_shear
+ gimp_shm_ID
+ gimp_shm_addr
+ gimp_show_help_button
+ gimp_show_tool_tips
+ gimp_smudge
+ gimp_smudge_default
+ gimp_temp_name
+ gimp_text
+ gimp_text_fontname
+ gimp_text_get_extents
+ gimp_text_get_extents_fontname
+ gimp_text_layer_get_antialias
+ gimp_text_layer_get_base_direction
+ gimp_text_layer_get_color
+ gimp_text_layer_get_font
+ gimp_text_layer_get_font_size
+ gimp_text_layer_get_hint_style
+ gimp_text_layer_get_hinting
+ gimp_text_layer_get_indent
+ gimp_text_layer_get_justification
+ gimp_text_layer_get_kerning
+ gimp_text_layer_get_language
+ gimp_text_layer_get_letter_spacing
+ gimp_text_layer_get_line_spacing
+ gimp_text_layer_get_markup
+ gimp_text_layer_get_text
+ gimp_text_layer_new
+ gimp_text_layer_resize
+ gimp_text_layer_set_antialias
+ gimp_text_layer_set_base_direction
+ gimp_text_layer_set_color
+ gimp_text_layer_set_font
+ gimp_text_layer_set_font_size
+ gimp_text_layer_set_hint_style
+ gimp_text_layer_set_hinting
+ gimp_text_layer_set_indent
+ gimp_text_layer_set_justification
+ gimp_text_layer_set_kerning
+ gimp_text_layer_set_language
+ gimp_text_layer_set_letter_spacing
+ gimp_text_layer_set_line_spacing
+ gimp_text_layer_set_text
+ gimp_threshold
+ gimp_tile_cache_ntiles
+ gimp_tile_cache_size
+ gimp_tile_flush
+ gimp_tile_height
+ gimp_tile_ref
+ gimp_tile_ref_zero
+ gimp_tile_unref
+ gimp_tile_width
+ gimp_transform_2d
+ gimp_uninstall_temp_proc
+ gimp_user_time
+ gimp_vectors_bezier_stroke_conicto
+ gimp_vectors_bezier_stroke_cubicto
+ gimp_vectors_bezier_stroke_lineto
+ gimp_vectors_bezier_stroke_new_ellipse
+ gimp_vectors_bezier_stroke_new_moveto
+ gimp_vectors_copy
+ gimp_vectors_export_to_file
+ gimp_vectors_export_to_string
+ gimp_vectors_get_image
+ gimp_vectors_get_linked
+ gimp_vectors_get_name
+ gimp_vectors_get_strokes
+ gimp_vectors_get_tattoo
+ gimp_vectors_get_visible
+ gimp_vectors_import_from_file
+ gimp_vectors_import_from_string
+ gimp_vectors_is_valid
+ gimp_vectors_new
+ gimp_vectors_new_from_text_layer
+ gimp_vectors_parasite_attach
+ gimp_vectors_parasite_detach
+ gimp_vectors_parasite_find
+ gimp_vectors_parasite_list
+ gimp_vectors_remove_stroke
+ gimp_vectors_set_linked
+ gimp_vectors_set_name
+ gimp_vectors_set_tattoo
+ gimp_vectors_set_visible
+ gimp_vectors_stroke_close
+ gimp_vectors_stroke_flip
+ gimp_vectors_stroke_flip_free
+ gimp_vectors_stroke_get_length
+ gimp_vectors_stroke_get_point_at_dist
+ gimp_vectors_stroke_get_points
+ gimp_vectors_stroke_interpolate
+ gimp_vectors_stroke_new_from_points
+ gimp_vectors_stroke_rotate
+ gimp_vectors_stroke_scale
+ gimp_vectors_stroke_translate
+ gimp_vectors_to_selection
+ gimp_version
+ gimp_wm_class
diff --git a/libgimp/gimp.h b/libgimp/gimp.h
new file mode 100644
index 0000000..992974e
--- /dev/null
+++ b/libgimp/gimp.h
@@ -0,0 +1,372 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimp.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#ifndef __GIMP_H__
+#define __GIMP_H__
+
+#include <cairo.h>
+#include <gegl.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include <libgimpbase/gimpbase.h>
+#include <libgimpcolor/gimpcolor.h>
+#include <libgimpconfig/gimpconfig.h>
+#include <libgimpmath/gimpmath.h>
+
+#define __GIMP_H_INSIDE__
+
+#include <libgimp/gimpenums.h>
+#include <libgimp/gimptypes.h>
+
+#include <libgimp/gimpbrushes.h>
+#include <libgimp/gimpbrushselect.h>
+#include <libgimp/gimpchannel.h>
+#include <libgimp/gimpdrawable.h>
+#include <libgimp/gimpedit.h>
+#include <libgimp/gimpfontselect.h>
+#include <libgimp/gimpgimprc.h>
+#include <libgimp/gimpgradients.h>
+#include <libgimp/gimpgradientselect.h>
+#include <libgimp/gimpimage.h>
+#include <libgimp/gimpimagecolorprofile.h>
+#include <libgimp/gimplayer.h>
+#include <libgimp/gimppalette.h>
+#include <libgimp/gimppalettes.h>
+#include <libgimp/gimppaletteselect.h>
+#include <libgimp/gimppatterns.h>
+#include <libgimp/gimppatternselect.h>
+#include <libgimp/gimppixbuf.h>
+#include <libgimp/gimppixelfetcher.h>
+#include <libgimp/gimppixelrgn.h>
+#include <libgimp/gimpplugin.h>
+#include <libgimp/gimpproceduraldb.h>
+#include <libgimp/gimpprogress.h>
+#include <libgimp/gimpregioniterator.h>
+#include <libgimp/gimpselection.h>
+#include <libgimp/gimptile.h>
+#include <libgimp/gimpvectors.h>
+
+#include <libgimp/gimp_pdb_headers.h>
+
+#undef __GIMP_H_INSIDE__
+
+#ifdef G_OS_WIN32
+#include <stdlib.h> /* For __argc and __argv */
+#endif
+
+G_BEGIN_DECLS
+
+
+#define gimp_get_data gimp_procedural_db_get_data
+#define gimp_get_data_size gimp_procedural_db_get_data_size
+#define gimp_set_data gimp_procedural_db_set_data
+
+
+typedef void (* GimpInitProc) (void);
+typedef void (* GimpQuitProc) (void);
+typedef void (* GimpQueryProc) (void);
+typedef void (* GimpRunProc) (const gchar *name,
+ gint n_params,
+ const GimpParam *param,
+ gint *n_return_vals,
+ GimpParam **return_vals);
+
+
+/**
+ * GimpPlugInInfo:
+ * @init_proc: called when the gimp application initially starts up
+ * @quit_proc: called when the gimp application exits
+ * @query_proc: called by gimp so that the plug-in can inform the
+ * gimp of what it does. (ie. installing a procedure database
+ * procedure).
+ * @run_proc: called to run a procedure the plug-in installed in the
+ * procedure database.
+ **/
+struct _GimpPlugInInfo
+{
+ GimpInitProc init_proc;
+ GimpQuitProc quit_proc;
+ GimpQueryProc query_proc;
+ GimpRunProc run_proc;
+};
+
+struct _GimpParamDef
+{
+ GimpPDBArgType type;
+ gchar *name;
+ gchar *description;
+};
+
+struct _GimpParamRegion
+{
+ gint32 x;
+ gint32 y;
+ gint32 width;
+ gint32 height;
+};
+
+union _GimpParamData
+{
+ gint32 d_int32;
+ gint16 d_int16;
+ guint8 d_int8;
+ gdouble d_float;
+ gchar *d_string;
+ gint32 *d_int32array;
+ gint16 *d_int16array;
+ guint8 *d_int8array;
+ gdouble *d_floatarray;
+ gchar **d_stringarray;
+ GimpRGB *d_colorarray;
+ GimpRGB d_color;
+ GimpParamRegion d_region; /* deprecated */
+ gint32 d_display;
+ gint32 d_image;
+ gint32 d_item;
+ gint32 d_layer;
+ gint32 d_layer_mask;
+ gint32 d_channel;
+ gint32 d_drawable;
+ gint32 d_selection;
+ gint32 d_boundary;
+ gint32 d_path; /* deprecated */
+ gint32 d_vectors;
+ gint32 d_unit;
+ GimpParasite d_parasite;
+ gint32 d_tattoo;
+ GimpPDBStatusType d_status;
+};
+
+struct _GimpParam
+{
+ GimpPDBArgType type;
+ GimpParamData data;
+};
+
+
+
+/**
+ * MAIN:
+ *
+ * A macro that expands to the appropriate main() function for the
+ * platform being compiled for.
+ *
+ * To use this macro, simply place a line that contains just the code
+ * MAIN() at the toplevel of your file. No semicolon should be used.
+ **/
+
+#ifdef G_OS_WIN32
+
+/* Define WinMain() because plug-ins are built as GUI applications. Also
+ * define a main() in case some plug-in still is built as a console
+ * application.
+ */
+# ifdef __GNUC__
+# ifndef _stdcall
+# define _stdcall __attribute__((stdcall))
+# endif
+# endif
+
+# define MAIN() \
+ struct HINSTANCE__; \
+ \
+ int _stdcall \
+ WinMain (struct HINSTANCE__ *hInstance, \
+ struct HINSTANCE__ *hPrevInstance, \
+ char *lpszCmdLine, \
+ int nCmdShow); \
+ \
+ int _stdcall \
+ WinMain (struct HINSTANCE__ *hInstance, \
+ struct HINSTANCE__ *hPrevInstance, \
+ char *lpszCmdLine, \
+ int nCmdShow) \
+ { \
+ return gimp_main (&PLUG_IN_INFO, __argc, __argv); \
+ } \
+ \
+ int \
+ main (int argc, char *argv[]) \
+ { \
+ /* Use __argc and __argv here, too, as they work \
+ * better with mingw-w64. \
+ */ \
+ return gimp_main (&PLUG_IN_INFO, __argc, __argv); \
+ }
+#else
+# define MAIN() \
+ int \
+ main (int argc, char *argv[]) \
+ { \
+ return gimp_main (&PLUG_IN_INFO, argc, argv); \
+ }
+#endif
+
+
+/* The main procedure that must be called with the PLUG_IN_INFO structure
+ * and the 'argc' and 'argv' that are passed to "main".
+ */
+gint gimp_main (const GimpPlugInInfo *info,
+ gint argc,
+ gchar *argv[]);
+
+/* Forcefully causes the gimp library to exit and
+ * close down its connection to main gimp application.
+ */
+void gimp_quit (void) G_GNUC_NORETURN;
+
+
+/* Install a procedure in the procedure database.
+ */
+void gimp_install_procedure (const gchar *name,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ const gchar *menu_label,
+ const gchar *image_types,
+ GimpPDBProcType type,
+ gint n_params,
+ gint n_return_vals,
+ const GimpParamDef *params,
+ const GimpParamDef *return_vals);
+
+/* Install a temporary procedure in the procedure database.
+ */
+void gimp_install_temp_proc (const gchar *name,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ const gchar *menu_label,
+ const gchar *image_types,
+ GimpPDBProcType type,
+ gint n_params,
+ gint n_return_vals,
+ const GimpParamDef *params,
+ const GimpParamDef *return_vals,
+ GimpRunProc run_proc);
+
+/* Uninstall a temporary procedure
+ */
+void gimp_uninstall_temp_proc (const gchar *name);
+
+/* Notify the main GIMP application that the extension is ready to run
+ */
+void gimp_extension_ack (void);
+
+/* Enable asynchronous processing of temp_procs
+ */
+void gimp_extension_enable (void);
+
+/* Process one temp_proc and return
+ */
+void gimp_extension_process (guint timeout);
+
+/* Run a procedure in the procedure database. The parameters are
+ * specified via the variable length argument list. The return
+ * values are returned in the 'GimpParam*' array.
+ */
+GimpParam * gimp_run_procedure (const gchar *name,
+ gint *n_return_vals,
+ ...);
+
+/* Run a procedure in the procedure database. The parameters are
+ * specified as an array of GimpParam. The return
+ * values are returned in the 'GimpParam*' array.
+ */
+GimpParam * gimp_run_procedure2 (const gchar *name,
+ gint *n_return_vals,
+ gint n_params,
+ const GimpParam *params);
+
+/* Destroy the an array of parameters. This is useful for
+ * destroying the return values returned by a call to
+ * 'gimp_run_procedure'.
+ */
+void gimp_destroy_params (GimpParam *params,
+ gint n_params);
+
+/* Destroy the an array of GimpParamDef's. This is useful for
+ * destroying the return values returned by a call to
+ * 'gimp_procedural_db_proc_info'.
+ */
+void gimp_destroy_paramdefs (GimpParamDef *paramdefs,
+ gint n_params);
+
+/* Retrieve the error message for the last procedure call.
+ */
+const gchar * gimp_get_pdb_error (void);
+
+/* Retrieve the return status for the last procedure call.
+ */
+GimpPDBStatusType gimp_get_pdb_status (void);
+
+/* Return various constants given by the GIMP core at plug-in config time.
+ */
+guint gimp_tile_width (void) G_GNUC_CONST;
+guint gimp_tile_height (void) G_GNUC_CONST;
+gint gimp_shm_ID (void) G_GNUC_CONST;
+guchar * gimp_shm_addr (void) G_GNUC_CONST;
+gboolean gimp_show_tool_tips (void) G_GNUC_CONST;
+gboolean gimp_show_help_button (void) G_GNUC_CONST;
+gboolean gimp_export_color_profile (void) G_GNUC_CONST;
+gboolean gimp_export_exif (void) G_GNUC_CONST;
+gboolean gimp_export_xmp (void) G_GNUC_CONST;
+gboolean gimp_export_iptc (void) G_GNUC_CONST;
+GimpCheckSize gimp_check_size (void) G_GNUC_CONST;
+GimpCheckType gimp_check_type (void) G_GNUC_CONST;
+gint32 gimp_default_display (void) G_GNUC_CONST;
+const gchar * gimp_wm_class (void) G_GNUC_CONST;
+const gchar * gimp_display_name (void) G_GNUC_CONST;
+gint gimp_monitor_number (void) G_GNUC_CONST;
+guint32 gimp_user_time (void) G_GNUC_CONST;
+const gchar * gimp_icon_theme_dir (void) G_GNUC_CONST;
+
+const gchar * gimp_get_progname (void) G_GNUC_CONST;
+
+GIMP_DEPRECATED
+gdouble gimp_gamma (void) G_GNUC_CONST;
+GIMP_DEPRECATED
+gboolean gimp_install_cmap (void) G_GNUC_CONST;
+GIMP_DEPRECATED
+gint gimp_min_colors (void) G_GNUC_CONST;
+
+GIMP_DEPRECATED_FOR(gimp_get_parasite)
+GimpParasite * gimp_parasite_find (const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_attach_parasite)
+gboolean gimp_parasite_attach (const GimpParasite *parasite);
+GIMP_DEPRECATED_FOR(gimp_detach_parasite)
+gboolean gimp_parasite_detach (const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_get_parasite_list)
+gboolean gimp_parasite_list (gint *num_parasites,
+ gchar ***parasites);
+GIMP_DEPRECATED_FOR(gimp_attach_parasite)
+gboolean gimp_attach_new_parasite (const gchar *name,
+ gint flags,
+ gint size,
+ gconstpointer data);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_H__ */
diff --git a/libgimp/gimp_pdb.c b/libgimp/gimp_pdb.c
new file mode 100644
index 0000000..b041d76
--- /dev/null
+++ b/libgimp/gimp_pdb.c
@@ -0,0 +1,263 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimp_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimp
+ * @title: gimp
+ * @short_description: Miscellaneous procedures
+ *
+ * Miscellaneous procedures not fitting in any category.
+ **/
+
+
+/**
+ * gimp_version:
+ *
+ * Returns the host GIMP version.
+ *
+ * This procedure returns the version number of the currently running
+ * GIMP.
+ *
+ * Returns: GIMP version number.
+ **/
+gchar *
+gimp_version (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *version = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-version",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ version = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return version;
+}
+
+/**
+ * gimp_getpid:
+ *
+ * Returns the PID of the host GIMP process.
+ *
+ * This procedure returns the process ID of the currently running GIMP.
+ *
+ * Returns: The PID.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_getpid (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint pid = 0;
+
+ return_vals = gimp_run_procedure ("gimp-getpid",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ pid = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return pid;
+}
+
+/**
+ * gimp_attach_parasite:
+ * @parasite: The parasite to attach.
+ *
+ * Add a global parasite.
+ *
+ * This procedure attaches a global parasite. It has no return values.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_attach_parasite (const GimpParasite *parasite)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-attach-parasite",
+ &nreturn_vals,
+ GIMP_PDB_PARASITE, parasite,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_detach_parasite:
+ * @name: The name of the parasite to detach.
+ *
+ * Removes a global parasite.
+ *
+ * This procedure detaches a global parasite from. It has no return
+ * values.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_detach_parasite (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-detach-parasite",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_get_parasite:
+ * @name: The name of the parasite to find.
+ *
+ * Look up a global parasite.
+ *
+ * Finds and returns the global parasite that was previously attached.
+ *
+ * Returns: The found parasite.
+ *
+ * Since: 2.8
+ **/
+GimpParasite *
+gimp_get_parasite (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpParasite *parasite = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-get-parasite",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ parasite = gimp_parasite_copy (&return_vals[1].data.d_parasite);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return parasite;
+}
+
+/**
+ * gimp_get_parasite_list:
+ * @num_parasites: The number of attached parasites.
+ *
+ * List all parasites.
+ *
+ * Returns a list of all currently attached global parasites.
+ *
+ * Returns: The names of currently attached parasites. The returned
+ * value must be freed with g_strfreev().
+ *
+ * Since: 2.8
+ **/
+gchar **
+gimp_get_parasite_list (gint *num_parasites)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar **parasites = NULL;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-get-parasite-list",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ *num_parasites = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_parasites = return_vals[1].data.d_int32;
+ if (*num_parasites > 0)
+ {
+ parasites = g_new0 (gchar *, *num_parasites + 1);
+ for (i = 0; i < *num_parasites; i++)
+ parasites[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return parasites;
+}
+
+/**
+ * gimp_temp_name:
+ * @extension: The extension the file will have.
+ *
+ * Generates a unique filename.
+ *
+ * Generates a unique filename using the temp path supplied in the
+ * user's gimprc.
+ *
+ * Returns: The new temp filename.
+ **/
+gchar *
+gimp_temp_name (const gchar *extension)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-temp-name",
+ &nreturn_vals,
+ GIMP_PDB_STRING, extension,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
diff --git a/libgimp/gimp_pdb.h b/libgimp/gimp_pdb.h
new file mode 100644
index 0000000..25ef652
--- /dev/null
+++ b/libgimp/gimp_pdb.h
@@ -0,0 +1,46 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimp_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_GIMP_PDB_H__
+#define __GIMP_GIMP_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gchar* gimp_version (void);
+gint gimp_getpid (void);
+gboolean gimp_attach_parasite (const GimpParasite *parasite);
+gboolean gimp_detach_parasite (const gchar *name);
+GimpParasite* gimp_get_parasite (const gchar *name);
+gchar** gimp_get_parasite_list (gint *num_parasites);
+gchar* gimp_temp_name (const gchar *extension);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_GIMP_PDB_H__ */
diff --git a/libgimp/gimp_pdb_headers.h b/libgimp/gimp_pdb_headers.h
new file mode 100644
index 0000000..82113d8
--- /dev/null
+++ b/libgimp/gimp_pdb_headers.h
@@ -0,0 +1,87 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimp_pdb_headers.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PDB_HEADERS_H__
+#define __GIMP_PDB_HEADERS_H__
+
+#include <libgimp/gimp_pdb.h>
+#include <libgimp/gimpbrush_pdb.h>
+#include <libgimp/gimpbrushes_pdb.h>
+#include <libgimp/gimpbrushselect_pdb.h>
+#include <libgimp/gimpbuffer_pdb.h>
+#include <libgimp/gimpchannel_pdb.h>
+#include <libgimp/gimpcolor_pdb.h>
+#include <libgimp/gimpcontext_pdb.h>
+#include <libgimp/gimpdebug_pdb.h>
+#include <libgimp/gimpdisplay_pdb.h>
+#include <libgimp/gimpdrawable_pdb.h>
+#include <libgimp/gimpdrawablecolor_pdb.h>
+#include <libgimp/gimpdrawableedit_pdb.h>
+#include <libgimp/gimpdrawabletransform_pdb.h>
+#include <libgimp/gimpdynamics_pdb.h>
+#include <libgimp/gimpedit_pdb.h>
+#include <libgimp/gimpfileops_pdb.h>
+#include <libgimp/gimpfloatingsel_pdb.h>
+#include <libgimp/gimpfonts_pdb.h>
+#include <libgimp/gimpfontselect_pdb.h>
+#include <libgimp/gimpgimprc_pdb.h>
+#include <libgimp/gimpgradient_pdb.h>
+#include <libgimp/gimpgradients_pdb.h>
+#include <libgimp/gimpgradientselect_pdb.h>
+#include <libgimp/gimphelp_pdb.h>
+#include <libgimp/gimpimage_pdb.h>
+#include <libgimp/gimpimagecolorprofile_pdb.h>
+#include <libgimp/gimpimageconvert_pdb.h>
+#include <libgimp/gimpimagegrid_pdb.h>
+#include <libgimp/gimpimageguides_pdb.h>
+#include <libgimp/gimpimagesamplepoints_pdb.h>
+#include <libgimp/gimpimageselect_pdb.h>
+#include <libgimp/gimpimagetransform_pdb.h>
+#include <libgimp/gimpimageundo_pdb.h>
+#include <libgimp/gimpitem_pdb.h>
+#include <libgimp/gimpitemtransform_pdb.h>
+#include <libgimp/gimplayer_pdb.h>
+#include <libgimp/gimpmessage_pdb.h>
+#include <libgimp/gimppainttools_pdb.h>
+#include <libgimp/gimppalette_pdb.h>
+#include <libgimp/gimppalettes_pdb.h>
+#include <libgimp/gimppaletteselect_pdb.h>
+#include <libgimp/gimppaths_pdb.h>
+#include <libgimp/gimppattern_pdb.h>
+#include <libgimp/gimppatterns_pdb.h>
+#include <libgimp/gimppatternselect_pdb.h>
+#include <libgimp/gimpplugin_pdb.h>
+#include <libgimp/gimpproceduraldb_pdb.h>
+#include <libgimp/gimpprogress_pdb.h>
+#include <libgimp/gimpselection_pdb.h>
+#include <libgimp/gimpselectiontools_pdb.h>
+#include <libgimp/gimptextlayer_pdb.h>
+#include <libgimp/gimptexttool_pdb.h>
+#include <libgimp/gimptransformtools_pdb.h>
+#include <libgimp/gimpunit_pdb.h>
+#include <libgimp/gimpvectors_pdb.h>
+
+#endif /* __GIMP_PDB_HEADERS_H__ */
diff --git a/libgimp/gimpaspectpreview.c b/libgimp/gimpaspectpreview.c
new file mode 100644
index 0000000..6177746
--- /dev/null
+++ b/libgimp/gimpaspectpreview.c
@@ -0,0 +1,483 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpaspectpreview.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "gimpuitypes.h"
+
+#include "gimp.h"
+
+#include "libgimp-intl.h"
+
+#include "gimpaspectpreview.h"
+
+
+/**
+ * SECTION: gimpaspectpreview
+ * @title: GimpAspectPreview
+ * @short_description: A widget providing a preview with fixed aspect ratio.
+ *
+ * A widget providing a preview with fixed aspect ratio.
+ **/
+
+
+enum
+{
+ PROP_0,
+ PROP_DRAWABLE,
+ PROP_DRAWABLE_ID
+};
+
+typedef struct
+{
+ gint32 drawable_ID;
+} GimpAspectPreviewPrivate;
+
+typedef struct
+{
+ gboolean update;
+} PreviewSettings;
+
+
+#define GIMP_ASPECT_PREVIEW_GET_PRIVATE(obj) \
+ ((GimpAspectPreviewPrivate *) gimp_aspect_preview_get_instance_private ((GimpAspectPreview *) (preview)))
+
+static void gimp_aspect_preview_constructed (GObject *object);
+static void gimp_aspect_preview_dispose (GObject *object);
+static void gimp_aspect_preview_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_aspect_preview_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_aspect_preview_style_set (GtkWidget *widget,
+ GtkStyle *prev_style);
+static void gimp_aspect_preview_draw (GimpPreview *preview);
+static void gimp_aspect_preview_draw_buffer (GimpPreview *preview,
+ const guchar *buffer,
+ gint rowstride);
+static void gimp_aspect_preview_transform (GimpPreview *preview,
+ gint src_x,
+ gint src_y,
+ gint *dest_x,
+ gint *dest_y);
+static void gimp_aspect_preview_untransform (GimpPreview *preview,
+ gint src_x,
+ gint src_y,
+ gint *dest_x,
+ gint *dest_y);
+
+static void gimp_aspect_preview_set_drawable (GimpAspectPreview *preview,
+ GimpDrawable *drawable);
+static void gimp_aspect_preview_set_drawable_id
+ (GimpAspectPreview *preview,
+ gint32 drawable_ID);
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpAspectPreview, gimp_aspect_preview,
+ GIMP_TYPE_PREVIEW)
+
+#define parent_class gimp_aspect_preview_parent_class
+
+static gint gimp_aspect_preview_counter = 0;
+
+
+static void
+gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
+
+ object_class->constructed = gimp_aspect_preview_constructed;
+ object_class->dispose = gimp_aspect_preview_dispose;
+ object_class->get_property = gimp_aspect_preview_get_property;
+ object_class->set_property = gimp_aspect_preview_set_property;
+
+ widget_class->style_set = gimp_aspect_preview_style_set;
+
+ preview_class->draw = gimp_aspect_preview_draw;
+ preview_class->draw_buffer = gimp_aspect_preview_draw_buffer;
+ preview_class->transform = gimp_aspect_preview_transform;
+ preview_class->untransform = gimp_aspect_preview_untransform;
+
+ /**
+ * GimpAspectPreview:drawable:
+ *
+ * Deprecated: use the drawable-id property instead.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_DRAWABLE,
+ g_param_spec_pointer ("drawable",
+ "Drawable",
+ "Deprecated: use the drawable-id property instead",
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * GimpAspectPreview:drawable-id:
+ *
+ * The drawable the #GimpAspectPreview is attached to.
+ *
+ * Since: 2.10
+ */
+ g_object_class_install_property (object_class, PROP_DRAWABLE_ID,
+ g_param_spec_int ("drawable-id",
+ "Drawable ID",
+ "The drawable this preview is attached to",
+ -1, G_MAXINT, -1,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+gimp_aspect_preview_init (GimpAspectPreview *preview)
+{
+ g_object_set (GIMP_PREVIEW (preview)->area,
+ "check-size", gimp_check_size (),
+ "check-type", gimp_check_type (),
+ NULL);
+}
+
+static void
+gimp_aspect_preview_constructed (GObject *object)
+{
+ gchar *data_name;
+ PreviewSettings settings;
+
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ data_name = g_strdup_printf ("%s-aspect-preview-%d",
+ g_get_prgname (),
+ gimp_aspect_preview_counter++);
+
+ if (gimp_get_data (data_name, &settings))
+ {
+ gimp_preview_set_update (GIMP_PREVIEW (object), settings.update);
+ }
+
+ g_object_set_data_full (object, "gimp-aspect-preview-data-name",
+ data_name, (GDestroyNotify) g_free);
+}
+
+static void
+gimp_aspect_preview_dispose (GObject *object)
+{
+ const gchar *data_name = g_object_get_data (G_OBJECT (object),
+ "gimp-aspect-preview-data-name");
+
+ if (data_name)
+ {
+ GimpPreview *preview = GIMP_PREVIEW (object);
+ PreviewSettings settings;
+
+ settings.update = gimp_preview_get_update (preview);
+
+ gimp_set_data (data_name, &settings, sizeof (PreviewSettings));
+ }
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+gimp_aspect_preview_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpAspectPreview *preview = GIMP_ASPECT_PREVIEW (object);
+ GimpAspectPreviewPrivate *priv = GIMP_ASPECT_PREVIEW_GET_PRIVATE (preview);
+
+ switch (property_id)
+ {
+ case PROP_DRAWABLE:
+ g_value_set_pointer (value, preview->drawable);
+ break;
+
+ case PROP_DRAWABLE_ID:
+ g_value_set_int (value, priv->drawable_ID);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_aspect_preview_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpAspectPreview *preview = GIMP_ASPECT_PREVIEW (object);
+ GimpAspectPreviewPrivate *priv = GIMP_ASPECT_PREVIEW_GET_PRIVATE (preview);
+
+ switch (property_id)
+ {
+ case PROP_DRAWABLE:
+ g_return_if_fail (priv->drawable_ID < 1);
+ if (g_value_get_pointer (value))
+ gimp_aspect_preview_set_drawable (preview,
+ g_value_get_pointer (value));
+ break;
+
+ case PROP_DRAWABLE_ID:
+ gimp_aspect_preview_set_drawable_id (preview,
+ g_value_get_int (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_aspect_preview_style_set (GtkWidget *widget,
+ GtkStyle *prev_style)
+{
+ GimpPreview *preview = GIMP_PREVIEW (widget);
+ GimpAspectPreviewPrivate *priv = GIMP_ASPECT_PREVIEW_GET_PRIVATE (preview);
+ gint width;
+ gint height;
+ gint size;
+
+ if (GTK_WIDGET_CLASS (parent_class)->style_set)
+ GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+
+ gtk_widget_style_get (widget,
+ "size", &size,
+ NULL);
+
+ width = gimp_drawable_width (priv->drawable_ID);
+ height = gimp_drawable_height (priv->drawable_ID);
+
+ if (width > height)
+ {
+ preview->width = MIN (width, size);
+ preview->height = (height * preview->width) / width;
+ }
+ else
+ {
+ preview->height = MIN (height, size);
+ preview->width = (width * preview->height) / height;
+ }
+
+ gtk_widget_set_size_request (preview->area,
+ preview->width, preview->height);
+}
+
+
+static void
+gimp_aspect_preview_draw (GimpPreview *preview)
+{
+ g_return_if_fail (GIMP_IS_ASPECT_PREVIEW (preview));
+
+ gimp_preview_area_fill (GIMP_PREVIEW_AREA (preview->area),
+ 0, 0,
+ preview->width,
+ preview->height,
+ 0, 0, 0);
+}
+
+static void
+gimp_aspect_preview_draw_buffer (GimpPreview *preview,
+ const guchar *buffer,
+ gint rowstride)
+{
+ GimpAspectPreviewPrivate *priv = GIMP_ASPECT_PREVIEW_GET_PRIVATE (preview);
+ gint32 image_ID;
+
+ image_ID = gimp_item_get_image (priv->drawable_ID);
+
+ if (gimp_selection_is_empty (image_ID))
+ {
+ gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview->area),
+ 0, 0,
+ preview->width, preview->height,
+ gimp_drawable_type (priv->drawable_ID),
+ buffer,
+ rowstride);
+ }
+ else
+ {
+ guchar *sel;
+ guchar *src;
+ gint selection_ID;
+ gint width, height;
+ gint bpp;
+
+ selection_ID = gimp_image_get_selection (image_ID);
+
+ width = preview->width;
+ height = preview->height;
+
+ src = gimp_drawable_get_thumbnail_data (priv->drawable_ID,
+ &width, &height, &bpp);
+ sel = gimp_drawable_get_thumbnail_data (selection_ID,
+ &width, &height, &bpp);
+
+ gimp_preview_area_mask (GIMP_PREVIEW_AREA (preview->area),
+ 0, 0, preview->width, preview->height,
+ gimp_drawable_type (priv->drawable_ID),
+ src, width * gimp_drawable_bpp (priv->drawable_ID),
+ buffer, rowstride,
+ sel, width);
+
+ g_free (sel);
+ g_free (src);
+ }
+}
+
+static void
+gimp_aspect_preview_transform (GimpPreview *preview,
+ gint src_x,
+ gint src_y,
+ gint *dest_x,
+ gint *dest_y)
+{
+ GimpAspectPreviewPrivate *priv = GIMP_ASPECT_PREVIEW_GET_PRIVATE (preview);
+
+ *dest_x = (gdouble) src_x * preview->width / gimp_drawable_width (priv->drawable_ID);
+ *dest_y = (gdouble) src_y * preview->height / gimp_drawable_height (priv->drawable_ID);
+}
+
+static void
+gimp_aspect_preview_untransform (GimpPreview *preview,
+ gint src_x,
+ gint src_y,
+ gint *dest_x,
+ gint *dest_y)
+{
+ GimpAspectPreviewPrivate *priv = GIMP_ASPECT_PREVIEW_GET_PRIVATE (preview);
+
+ *dest_x = (gdouble) src_x * gimp_drawable_width (priv->drawable_ID) / preview->width;
+ *dest_y = (gdouble) src_y * gimp_drawable_height (priv->drawable_ID) / preview->height;
+}
+
+static void
+gimp_aspect_preview_set_drawable (GimpAspectPreview *preview,
+ GimpDrawable *drawable)
+{
+ GimpAspectPreviewPrivate *priv = GIMP_ASPECT_PREVIEW_GET_PRIVATE (preview);
+
+ g_return_if_fail (preview->drawable == NULL);
+ g_return_if_fail (priv->drawable_ID < 1);
+
+ preview->drawable = drawable;
+
+ gimp_aspect_preview_set_drawable_id (preview, drawable->drawable_id);
+}
+
+static void
+gimp_aspect_preview_set_drawable_id (GimpAspectPreview *preview,
+ gint32 drawable_ID)
+{
+ GimpAspectPreviewPrivate *priv = GIMP_ASPECT_PREVIEW_GET_PRIVATE (preview);
+ gint d_width;
+ gint d_height;
+ gint width;
+ gint height;
+
+ g_return_if_fail (priv->drawable_ID < 1);
+
+ priv->drawable_ID = drawable_ID;
+
+ d_width = gimp_drawable_width (priv->drawable_ID);
+ d_height = gimp_drawable_height (priv->drawable_ID);
+
+ if (d_width > d_height)
+ {
+ width = MIN (d_width, 512);
+ height = (d_height * width) / d_width;
+ }
+ else
+ {
+ height = MIN (d_height, 512);
+ width = (d_width * height) / d_height;
+ }
+
+ gimp_preview_set_bounds (GIMP_PREVIEW (preview), 0, 0, width, height);
+
+ if (height > 0)
+ g_object_set (GIMP_PREVIEW (preview)->frame,
+ "ratio",
+ (gdouble) d_width / (gdouble) d_height,
+ NULL);
+}
+
+/**
+ * gimp_aspect_preview_new_from_drawable_id:
+ * @drawable_ID: a drawable ID
+ *
+ * Creates a new #GimpAspectPreview widget for @drawable_ID. See also
+ * gimp_drawable_preview_new_from_drawable_id().
+ *
+ * Since: 2.10
+ *
+ * Returns: a new #GimpAspectPreview.
+ **/
+GtkWidget *
+gimp_aspect_preview_new_from_drawable_id (gint32 drawable_ID)
+{
+ g_return_val_if_fail (gimp_item_is_valid (drawable_ID), NULL);
+ g_return_val_if_fail (gimp_item_is_drawable (drawable_ID), NULL);
+
+ return g_object_new (GIMP_TYPE_ASPECT_PREVIEW,
+ "drawable-id", drawable_ID,
+ NULL);
+}
+/**
+ * gimp_aspect_preview_new:
+ * @drawable: a #GimpDrawable
+ * @toggle: unused
+ *
+ * Creates a new #GimpAspectPreview widget for @drawable. See also
+ * gimp_drawable_preview_new().
+ *
+ * In GIMP 2.2 the @toggle parameter was provided to conviently access
+ * the state of the "Preview" check-button. This is not any longer
+ * necessary as the preview itself now stores this state, as well as
+ * the scroll offset.
+ *
+ * Since: 2.2
+ *
+ * Returns: a new #GimpAspectPreview.
+ **/
+GtkWidget *
+gimp_aspect_preview_new (GimpDrawable *drawable,
+ gboolean *toggle)
+{
+ g_return_val_if_fail (drawable != NULL, NULL);
+
+ return g_object_new (GIMP_TYPE_ASPECT_PREVIEW,
+ "drawable", drawable,
+ NULL);
+}
diff --git a/libgimp/gimpaspectpreview.h b/libgimp/gimpaspectpreview.h
new file mode 100644
index 0000000..6e95f0d
--- /dev/null
+++ b/libgimp/gimpaspectpreview.h
@@ -0,0 +1,75 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpaspectpreview.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_ASPECT_PREVIEW_H__
+#define __GIMP_ASPECT_PREVIEW_H__
+
+G_BEGIN_DECLS
+
+
+/* For information look into the C source or the html documentation */
+
+
+#define GIMP_TYPE_ASPECT_PREVIEW (gimp_aspect_preview_get_type ())
+#define GIMP_ASPECT_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ASPECT_PREVIEW, GimpAspectPreview))
+#define GIMP_ASPECT_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ASPECT_PREVIEW, GimpAspectPreviewClass))
+#define GIMP_IS_ASPECT_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ASPECT_PREVIEW))
+#define GIMP_IS_ASPECT_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ASPECT_PREVIEW))
+#define GIMP_ASPECT_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ASPECT_PREVIEW, GimpAspectPreviewClass))
+
+
+typedef struct _GimpAspectPreviewClass GimpAspectPreviewClass;
+
+struct _GimpAspectPreview
+{
+ GimpPreview parent_instance;
+
+ /*< private >*/
+ GimpDrawable *drawable;
+};
+
+struct _GimpAspectPreviewClass
+{
+ GimpPreviewClass parent_class;
+
+ /* Padding for future expansion */
+ void (* _gimp_reserved1) (void);
+ void (* _gimp_reserved2) (void);
+ void (* _gimp_reserved3) (void);
+ void (* _gimp_reserved4) (void);
+};
+
+
+GType gimp_aspect_preview_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_aspect_preview_new_from_drawable_id (gint32 drawable_ID);
+
+GIMP_DEPRECATED_FOR(gimp_aspect_preview_new_from_drawable_id)
+GtkWidget * gimp_aspect_preview_new (GimpDrawable *drawable,
+ gboolean *toggle);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_ASPECT_PREVIEW_H__ */
diff --git a/libgimp/gimpbrush_pdb.c b/libgimp/gimpbrush_pdb.c
new file mode 100644
index 0000000..6cb5bc7
--- /dev/null
+++ b/libgimp/gimpbrush_pdb.c
@@ -0,0 +1,864 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrush_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpbrush
+ * @title: gimpbrush
+ * @short_description: Functions operating on a single brush.
+ *
+ * Functions operating on a single brush.
+ **/
+
+
+/**
+ * gimp_brush_new:
+ * @name: The requested name of the new brush.
+ *
+ * Creates a new brush.
+ *
+ * This procedure creates a new, uninitialized brush.
+ *
+ * Returns: The actual new brush name. The returned value must be freed
+ * with g_free().
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_brush_new (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *actual_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-brush-new",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ actual_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return actual_name;
+}
+
+/**
+ * gimp_brush_duplicate:
+ * @name: The brush name.
+ *
+ * Duplicates a brush.
+ *
+ * This procedure creates an identical brush by a different name.
+ *
+ * Returns: The name of the brush's copy. The returned value must be
+ * freed with g_free().
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_brush_duplicate (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *copy_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-brush-duplicate",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ copy_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return copy_name;
+}
+
+/**
+ * gimp_brush_is_generated:
+ * @name: The brush name.
+ *
+ * Tests if brush is generated.
+ *
+ * Returns TRUE if this brush is parametric, FALSE for other types.
+ *
+ * Returns: TRUE if the brush is generated.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_brush_is_generated (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean generated = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-brush-is-generated",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ generated = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return generated;
+}
+
+/**
+ * gimp_brush_rename:
+ * @name: The brush name.
+ * @new_name: The new name of the brush.
+ *
+ * Renames a brush.
+ *
+ * This procedure renames a brush.
+ *
+ * Returns: The actual new name of the brush. The returned value must
+ * be freed with g_free().
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_brush_rename (const gchar *name,
+ const gchar *new_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *actual_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-brush-rename",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_STRING, new_name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ actual_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return actual_name;
+}
+
+/**
+ * gimp_brush_delete:
+ * @name: The brush name.
+ *
+ * Deletes a brush.
+ *
+ * This procedure deletes a brush.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_brush_delete (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-brush-delete",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_brush_is_editable:
+ * @name: The brush name.
+ *
+ * Tests if brush can be edited.
+ *
+ * Returns TRUE if you have permission to change the brush.
+ *
+ * Returns: TRUE if the brush can be edited.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_brush_is_editable (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean editable = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-brush-is-editable",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ editable = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return editable;
+}
+
+/**
+ * gimp_brush_get_info:
+ * @name: The brush name.
+ * @width: The brush width.
+ * @height: The brush height.
+ * @mask_bpp: The brush mask bpp.
+ * @color_bpp: The brush color bpp.
+ *
+ * Retrieves information about the specified brush.
+ *
+ * This procedure retrieves information about the specified brush:
+ * brush extents (width and height), color depth and mask depth.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_brush_get_info (const gchar *name,
+ gint *width,
+ gint *height,
+ gint *mask_bpp,
+ gint *color_bpp)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-brush-get-info",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ *width = 0;
+ *height = 0;
+ *mask_bpp = 0;
+ *color_bpp = 0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *width = return_vals[1].data.d_int32;
+ *height = return_vals[2].data.d_int32;
+ *mask_bpp = return_vals[3].data.d_int32;
+ *color_bpp = return_vals[4].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_brush_get_pixels:
+ * @name: The brush name.
+ * @width: The brush width.
+ * @height: The brush height.
+ * @mask_bpp: The brush mask bpp.
+ * @num_mask_bytes: Length of brush mask data.
+ * @mask_bytes: The brush mask data.
+ * @color_bpp: The brush color bpp.
+ * @num_color_bytes: Length of brush color data.
+ * @color_bytes: The brush color data.
+ *
+ * Retrieves information about the specified brush.
+ *
+ * This procedure retrieves information about the specified brush. This
+ * includes the brush extents (width and height) and its pixels data.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_brush_get_pixels (const gchar *name,
+ gint *width,
+ gint *height,
+ gint *mask_bpp,
+ gint *num_mask_bytes,
+ guint8 **mask_bytes,
+ gint *color_bpp,
+ gint *num_color_bytes,
+ guint8 **color_bytes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-brush-get-pixels",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ *width = 0;
+ *height = 0;
+ *mask_bpp = 0;
+ *num_mask_bytes = 0;
+ *mask_bytes = NULL;
+ *color_bpp = 0;
+ *num_color_bytes = 0;
+ *color_bytes = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *width = return_vals[1].data.d_int32;
+ *height = return_vals[2].data.d_int32;
+ *mask_bpp = return_vals[3].data.d_int32;
+ *num_mask_bytes = return_vals[4].data.d_int32;
+ *mask_bytes = g_new (guint8, *num_mask_bytes);
+ memcpy (*mask_bytes,
+ return_vals[5].data.d_int8array,
+ *num_mask_bytes * sizeof (guint8));
+ *color_bpp = return_vals[6].data.d_int32;
+ *num_color_bytes = return_vals[7].data.d_int32;
+ *color_bytes = g_new (guint8, *num_color_bytes);
+ memcpy (*color_bytes,
+ return_vals[8].data.d_int8array,
+ *num_color_bytes * sizeof (guint8));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_brush_get_spacing:
+ * @name: The brush name.
+ * @spacing: The brush spacing.
+ *
+ * Gets the brush spacing.
+ *
+ * This procedure returns the spacing setting for the specified brush.
+ * The return value is an integer between 0 and 1000 which represents
+ * percentage of the maximum of the width and height of the mask.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_brush_get_spacing (const gchar *name,
+ gint *spacing)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-brush-get-spacing",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ *spacing = 0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *spacing = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_brush_set_spacing:
+ * @name: The brush name.
+ * @spacing: The brush spacing.
+ *
+ * Sets the brush spacing.
+ *
+ * This procedure modifies the spacing setting for the specified brush.
+ * The value should be a integer between 0 and 1000.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_brush_set_spacing (const gchar *name,
+ gint spacing)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-brush-set-spacing",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, spacing,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_brush_get_shape:
+ * @name: The brush name.
+ *
+ * Gets the shape of a generated brush.
+ *
+ * This procedure gets the shape value for a generated brush. If called
+ * for any other type of brush, it does not succeed. The current
+ * possibilities are Circle (GIMP_BRUSH_GENERATED_CIRCLE), Square
+ * (GIMP_BRUSH_GENERATED_SQUARE), and Diamond
+ * (GIMP_BRUSH_GENERATED_DIAMOND). Other shapes are likely to be added
+ * in the future.
+ *
+ * Returns: The brush shape.
+ *
+ * Since: 2.4
+ **/
+GimpBrushGeneratedShape
+gimp_brush_get_shape (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpBrushGeneratedShape shape = 0;
+
+ return_vals = gimp_run_procedure ("gimp-brush-get-shape",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ shape = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return shape;
+}
+
+/**
+ * gimp_brush_set_shape:
+ * @name: The brush name.
+ * @shape_in: The brush shape.
+ *
+ * Sets the shape of a generated brush.
+ *
+ * This procedure sets the shape value for a generated brush. If called
+ * for any other type of brush, it does not succeed. The current
+ * possibilities are Circle (GIMP_BRUSH_GENERATED_CIRCLE), Square
+ * (GIMP_BRUSH_GENERATED_SQUARE), and Diamond
+ * (GIMP_BRUSH_GENERATED_DIAMOND). Other shapes are likely to be added
+ * in the future.
+ *
+ * Returns: The brush shape actually assigned.
+ *
+ * Since: 2.4
+ **/
+GimpBrushGeneratedShape
+gimp_brush_set_shape (const gchar *name,
+ GimpBrushGeneratedShape shape_in)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpBrushGeneratedShape shape_out = 0;
+
+ return_vals = gimp_run_procedure ("gimp-brush-set-shape",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, shape_in,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ shape_out = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return shape_out;
+}
+
+/**
+ * gimp_brush_get_radius:
+ * @name: The brush name.
+ *
+ * Gets the radius of a generated brush.
+ *
+ * This procedure gets the radius value for a generated brush. If
+ * called for any other type of brush, it does not succeed.
+ *
+ * Returns: The radius of the brush in pixels.
+ *
+ * Since: 2.4
+ **/
+gdouble
+gimp_brush_get_radius (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble radius = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-brush-get-radius",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ radius = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return radius;
+}
+
+/**
+ * gimp_brush_set_radius:
+ * @name: The brush name.
+ * @radius_in: The desired brush radius in pixel.
+ *
+ * Sets the radius of a generated brush.
+ *
+ * This procedure sets the radius for a generated brush. If called for
+ * any other type of brush, it does not succeed.
+ *
+ * Returns: The brush radius actually assigned.
+ *
+ * Since: 2.4
+ **/
+gdouble
+gimp_brush_set_radius (const gchar *name,
+ gdouble radius_in)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble radius_out = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-brush-set-radius",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_FLOAT, radius_in,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ radius_out = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return radius_out;
+}
+
+/**
+ * gimp_brush_get_spikes:
+ * @name: The brush name.
+ *
+ * Gets the number of spikes for a generated brush.
+ *
+ * This procedure gets the number of spikes for a generated brush. If
+ * called for any other type of brush, it does not succeed.
+ *
+ * Returns: The number of spikes on the brush.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_brush_get_spikes (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint spikes = 0;
+
+ return_vals = gimp_run_procedure ("gimp-brush-get-spikes",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ spikes = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return spikes;
+}
+
+/**
+ * gimp_brush_set_spikes:
+ * @name: The brush name.
+ * @spikes_in: The desired number of spikes.
+ *
+ * Sets the number of spikes for a generated brush.
+ *
+ * This procedure sets the number of spikes for a generated brush. If
+ * called for any other type of brush, it does not succeed.
+ *
+ * Returns: The number of spikes actually assigned.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_brush_set_spikes (const gchar *name,
+ gint spikes_in)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint spikes_out = 0;
+
+ return_vals = gimp_run_procedure ("gimp-brush-set-spikes",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, spikes_in,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ spikes_out = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return spikes_out;
+}
+
+/**
+ * gimp_brush_get_hardness:
+ * @name: The brush name.
+ *
+ * Gets the hardness of a generated brush.
+ *
+ * This procedure gets the hardness of a generated brush. The hardness
+ * of a brush is the amount its intensity fades at the outside edge, as
+ * a float between 0.0 and 1.0. If called for any other type of brush,
+ * the function does not succeed.
+ *
+ * Returns: The hardness of the brush.
+ *
+ * Since: 2.4
+ **/
+gdouble
+gimp_brush_get_hardness (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble hardness = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-brush-get-hardness",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ hardness = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return hardness;
+}
+
+/**
+ * gimp_brush_set_hardness:
+ * @name: The brush name.
+ * @hardness_in: The desired brush hardness.
+ *
+ * Sets the hardness of a generated brush.
+ *
+ * This procedure sets the hardness for a generated brush. If called
+ * for any other type of brush, it does not succeed. The value should
+ * be a float between 0.0 and 1.0.
+ *
+ * Returns: The brush hardness actually assigned.
+ *
+ * Since: 2.4
+ **/
+gdouble
+gimp_brush_set_hardness (const gchar *name,
+ gdouble hardness_in)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble hardness_out = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-brush-set-hardness",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_FLOAT, hardness_in,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ hardness_out = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return hardness_out;
+}
+
+/**
+ * gimp_brush_get_aspect_ratio:
+ * @name: The brush name.
+ *
+ * Gets the aspect ratio of a generated brush.
+ *
+ * This procedure gets the aspect ratio of a generated brush. If called
+ * for any other type of brush, it does not succeed. The return value
+ * is a float between 0.0 and 1000.0.
+ *
+ * Returns: The aspect ratio of the brush.
+ *
+ * Since: 2.4
+ **/
+gdouble
+gimp_brush_get_aspect_ratio (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble aspect_ratio = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-brush-get-aspect-ratio",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ aspect_ratio = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return aspect_ratio;
+}
+
+/**
+ * gimp_brush_set_aspect_ratio:
+ * @name: The brush name.
+ * @aspect_ratio_in: The desired brush aspect ratio.
+ *
+ * Sets the aspect ratio of a generated brush.
+ *
+ * This procedure sets the aspect ratio for a generated brush. If
+ * called for any other type of brush, it does not succeed. The value
+ * should be a float between 0.0 and 1000.0.
+ *
+ * Returns: The brush aspect ratio actually assigned.
+ *
+ * Since: 2.4
+ **/
+gdouble
+gimp_brush_set_aspect_ratio (const gchar *name,
+ gdouble aspect_ratio_in)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble aspect_ratio_out = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-brush-set-aspect-ratio",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_FLOAT, aspect_ratio_in,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ aspect_ratio_out = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return aspect_ratio_out;
+}
+
+/**
+ * gimp_brush_get_angle:
+ * @name: The brush name.
+ *
+ * Gets the rotation angle of a generated brush.
+ *
+ * This procedure gets the angle of rotation for a generated brush. If
+ * called for any other type of brush, it does not succeed.
+ *
+ * Returns: The rotation angle of the brush in degree.
+ *
+ * Since: 2.4
+ **/
+gdouble
+gimp_brush_get_angle (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble angle = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-brush-get-angle",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ angle = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return angle;
+}
+
+/**
+ * gimp_brush_set_angle:
+ * @name: The brush name.
+ * @angle_in: The desired brush rotation angle in degree.
+ *
+ * Sets the rotation angle of a generated brush.
+ *
+ * This procedure sets the rotation angle for a generated brush. If
+ * called for any other type of brush, it does not succeed.
+ *
+ * Returns: The brush rotation angle actually assigned.
+ *
+ * Since: 2.4
+ **/
+gdouble
+gimp_brush_set_angle (const gchar *name,
+ gdouble angle_in)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble angle_out = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-brush-set-angle",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_FLOAT, angle_in,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ angle_out = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return angle_out;
+}
diff --git a/libgimp/gimpbrush_pdb.h b/libgimp/gimpbrush_pdb.h
new file mode 100644
index 0000000..f56c568
--- /dev/null
+++ b/libgimp/gimpbrush_pdb.h
@@ -0,0 +1,82 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrush_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_BRUSH_PDB_H__
+#define __GIMP_BRUSH_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gchar* gimp_brush_new (const gchar *name);
+gchar* gimp_brush_duplicate (const gchar *name);
+gboolean gimp_brush_is_generated (const gchar *name);
+gchar* gimp_brush_rename (const gchar *name,
+ const gchar *new_name);
+gboolean gimp_brush_delete (const gchar *name);
+gboolean gimp_brush_is_editable (const gchar *name);
+gboolean gimp_brush_get_info (const gchar *name,
+ gint *width,
+ gint *height,
+ gint *mask_bpp,
+ gint *color_bpp);
+gboolean gimp_brush_get_pixels (const gchar *name,
+ gint *width,
+ gint *height,
+ gint *mask_bpp,
+ gint *num_mask_bytes,
+ guint8 **mask_bytes,
+ gint *color_bpp,
+ gint *num_color_bytes,
+ guint8 **color_bytes);
+gboolean gimp_brush_get_spacing (const gchar *name,
+ gint *spacing);
+gboolean gimp_brush_set_spacing (const gchar *name,
+ gint spacing);
+GimpBrushGeneratedShape gimp_brush_get_shape (const gchar *name);
+GimpBrushGeneratedShape gimp_brush_set_shape (const gchar *name,
+ GimpBrushGeneratedShape shape_in);
+gdouble gimp_brush_get_radius (const gchar *name);
+gdouble gimp_brush_set_radius (const gchar *name,
+ gdouble radius_in);
+gint gimp_brush_get_spikes (const gchar *name);
+gint gimp_brush_set_spikes (const gchar *name,
+ gint spikes_in);
+gdouble gimp_brush_get_hardness (const gchar *name);
+gdouble gimp_brush_set_hardness (const gchar *name,
+ gdouble hardness_in);
+gdouble gimp_brush_get_aspect_ratio (const gchar *name);
+gdouble gimp_brush_set_aspect_ratio (const gchar *name,
+ gdouble aspect_ratio_in);
+gdouble gimp_brush_get_angle (const gchar *name);
+gdouble gimp_brush_set_angle (const gchar *name,
+ gdouble angle_in);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_BRUSH_PDB_H__ */
diff --git a/libgimp/gimpbrushes.c b/libgimp/gimpbrushes.c
new file mode 100644
index 0000000..c8fdff7
--- /dev/null
+++ b/libgimp/gimpbrushes.c
@@ -0,0 +1,94 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrushes.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+#include "gimpbrushes.h"
+
+/**
+ * gimp_brushes_get_opacity:
+ *
+ * This procedure is deprecated! Use gimp_context_get_opacity() instead.
+ *
+ * Returns: The brush opacity.
+ */
+gdouble
+gimp_brushes_get_opacity (void)
+{
+ return gimp_context_get_opacity ();
+}
+
+/**
+ * gimp_brushes_set_opacity:
+ * @opacity: The brush opacity.
+ *
+ * This procedure is deprecated! Use gimp_context_set_opacity() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_brushes_set_opacity (gdouble opacity)
+{
+ return gimp_context_set_opacity (opacity);
+}
+
+/**
+ * gimp_brushes_get_paint_mode:
+ *
+ * This procedure is deprecated! Use gimp_context_get_paint_mode() instead.
+ *
+ * Returns: The paint mode.
+ */
+GimpLayerMode
+gimp_brushes_get_paint_mode (void)
+{
+ return gimp_context_get_paint_mode ();
+}
+
+/**
+ * gimp_brushes_set_paint_mode:
+ * @paint_mode: The paint mode.
+ *
+ * This procedure is deprecated! Use gimp_context_set_paint_mode() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_brushes_set_paint_mode (GimpLayerMode paint_mode)
+{
+ return gimp_context_set_paint_mode (paint_mode);
+}
+
+/**
+ * gimp_brushes_set_brush:
+ * @name: The brush name.
+ *
+ * This procedure is deprecated! Use gimp_context_set_brush() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_brushes_set_brush (const gchar *name)
+{
+ return gimp_context_set_brush (name);
+}
diff --git a/libgimp/gimpbrushes.h b/libgimp/gimpbrushes.h
new file mode 100644
index 0000000..aaa3701
--- /dev/null
+++ b/libgimp/gimpbrushes.h
@@ -0,0 +1,45 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrushes.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_BRUSHES_H__
+#define __GIMP_BRUSHES_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+GIMP_DEPRECATED_FOR(gimp_context_get_opacity)
+gdouble gimp_brushes_get_opacity (void);
+GIMP_DEPRECATED_FOR(gimp_context_set_opacity)
+gboolean gimp_brushes_set_opacity (gdouble opacity);
+GIMP_DEPRECATED_FOR(gimp_context_get_paint_mode)
+GimpLayerMode gimp_brushes_get_paint_mode (void);
+GIMP_DEPRECATED_FOR(gimp_context_set_paint_mode)
+gboolean gimp_brushes_set_paint_mode (GimpLayerMode paint_mode);
+GIMP_DEPRECATED_FOR(gimp_context_set_brush)
+gboolean gimp_brushes_set_brush (const gchar *name);
+
+G_END_DECLS
+
+#endif /* __GIMP_BRUSHES_H__ */
diff --git a/libgimp/gimpbrushes_pdb.c b/libgimp/gimpbrushes_pdb.c
new file mode 100644
index 0000000..594504b
--- /dev/null
+++ b/libgimp/gimpbrushes_pdb.c
@@ -0,0 +1,256 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrushes_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpbrushes
+ * @title: gimpbrushes
+ * @short_description: Functions for manipulating brushes.
+ *
+ * Functions related to getting and setting brushes.
+ **/
+
+
+/**
+ * gimp_brushes_refresh:
+ *
+ * Refresh current brushes. This function always succeeds.
+ *
+ * This procedure retrieves all brushes currently in the user's brush
+ * path and updates the brush dialogs accordingly.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_brushes_refresh (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-brushes-refresh",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_brushes_get_list:
+ * @filter: An optional regular expression used to filter the list.
+ * @num_brushes: The number of brushes in the brush list.
+ *
+ * Retrieve a complete listing of the available brushes.
+ *
+ * This procedure returns a complete listing of available GIMP brushes.
+ * Each name returned can be used as input to the
+ * gimp_context_set_brush() procedure.
+ *
+ * Returns: The list of brush names. The returned value must be freed
+ * with g_strfreev().
+ **/
+gchar **
+gimp_brushes_get_list (const gchar *filter,
+ gint *num_brushes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar **brush_list = NULL;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-brushes-get-list",
+ &nreturn_vals,
+ GIMP_PDB_STRING, filter,
+ GIMP_PDB_END);
+
+ *num_brushes = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_brushes = return_vals[1].data.d_int32;
+ if (*num_brushes > 0)
+ {
+ brush_list = g_new0 (gchar *, *num_brushes + 1);
+ for (i = 0; i < *num_brushes; i++)
+ brush_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return brush_list;
+}
+
+/**
+ * gimp_brushes_get_brush:
+ * @width: The brush width.
+ * @height: The brush height.
+ * @spacing: The brush spacing.
+ *
+ * Deprecated: Use gimp_context_get_brush() instead.
+ *
+ * Returns: The brush name.
+ **/
+gchar *
+gimp_brushes_get_brush (gint *width,
+ gint *height,
+ gint *spacing)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-brushes-get-brush",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ name = g_strdup (return_vals[1].data.d_string);
+ *width = return_vals[2].data.d_int32;
+ *height = return_vals[3].data.d_int32;
+ *spacing = return_vals[4].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_brushes_get_spacing:
+ *
+ * Deprecated: Use gimp_brush_get_spacing() instead.
+ *
+ * Returns: The brush spacing.
+ **/
+gint
+gimp_brushes_get_spacing (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint spacing = 0;
+
+ return_vals = gimp_run_procedure ("gimp-brushes-get-spacing",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ spacing = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return spacing;
+}
+
+/**
+ * gimp_brushes_set_spacing:
+ * @spacing: The brush spacing.
+ *
+ * Deprecated: Use gimp_brush_set_spacing() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_brushes_set_spacing (gint spacing)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-brushes-set-spacing",
+ &nreturn_vals,
+ GIMP_PDB_INT32, spacing,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_brushes_get_brush_data:
+ * @name: The brush name (\"\" means current active brush).
+ * @opacity: The brush opacity.
+ * @spacing: The brush spacing.
+ * @paint_mode: The paint mode.
+ * @width: The brush width.
+ * @height: The brush height.
+ * @length: Length of brush mask data.
+ * @mask_data: The brush mask data.
+ *
+ * Deprecated: Use gimp_brush_get_pixels() instead.
+ *
+ * Returns: The brush name.
+ **/
+gchar *
+gimp_brushes_get_brush_data (const gchar *name,
+ gdouble *opacity,
+ gint *spacing,
+ GimpLayerMode *paint_mode,
+ gint *width,
+ gint *height,
+ gint *length,
+ guint8 **mask_data)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *actual_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-brushes-get-brush-data",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ *length = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ actual_name = g_strdup (return_vals[1].data.d_string);
+ *opacity = return_vals[2].data.d_float;
+ *spacing = return_vals[3].data.d_int32;
+ *paint_mode = return_vals[4].data.d_int32;
+ *width = return_vals[5].data.d_int32;
+ *height = return_vals[6].data.d_int32;
+ *length = return_vals[7].data.d_int32;
+ *mask_data = g_new (guint8, *length);
+ memcpy (*mask_data,
+ return_vals[8].data.d_int8array,
+ *length * sizeof (guint8));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return actual_name;
+}
diff --git a/libgimp/gimpbrushes_pdb.h b/libgimp/gimpbrushes_pdb.h
new file mode 100644
index 0000000..8faaee9
--- /dev/null
+++ b/libgimp/gimpbrushes_pdb.h
@@ -0,0 +1,59 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrushes_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_BRUSHES_PDB_H__
+#define __GIMP_BRUSHES_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_brushes_refresh (void);
+gchar** gimp_brushes_get_list (const gchar *filter,
+ gint *num_brushes);
+GIMP_DEPRECATED_FOR(gimp_context_get_brush)
+gchar* gimp_brushes_get_brush (gint *width,
+ gint *height,
+ gint *spacing);
+GIMP_DEPRECATED_FOR(gimp_brush_get_spacing)
+gint gimp_brushes_get_spacing (void);
+GIMP_DEPRECATED_FOR(gimp_brush_set_spacing)
+gboolean gimp_brushes_set_spacing (gint spacing);
+GIMP_DEPRECATED_FOR(gimp_brush_get_pixels)
+gchar* gimp_brushes_get_brush_data (const gchar *name,
+ gdouble *opacity,
+ gint *spacing,
+ GimpLayerMode *paint_mode,
+ gint *width,
+ gint *height,
+ gint *length,
+ guint8 **mask_data);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_BRUSHES_PDB_H__ */
diff --git a/libgimp/gimpbrushmenu.c b/libgimp/gimpbrushmenu.c
new file mode 100644
index 0000000..43dde0b
--- /dev/null
+++ b/libgimp/gimpbrushmenu.c
@@ -0,0 +1,168 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrushmenu.c
+ * Copyright (C) 1998 Andy Thomas
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimpbrushmenu.h"
+#include "gimpbrushselectbutton.h"
+
+
+/**
+ * SECTION: gimpbrushmenu
+ * @title: gimpbrushmenu
+ * @short_description: A widget for selecting brushes.
+ *
+ * A widget for selecting brushes.
+ **/
+
+
+typedef struct
+{
+ GimpRunBrushCallback callback;
+ gpointer data;
+} CompatCallbackData;
+
+
+static void compat_callback (GimpBrushSelectButton *brush_button,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode,
+ gint width,
+ gint height,
+ const guchar *mask_data,
+ gboolean dialog_closing,
+ CompatCallbackData *data);
+static void compat_callback_data_free (CompatCallbackData *data);
+
+
+/**
+ * gimp_brush_select_widget_new:
+ * @title: Title of the dialog to use or %NULL to use the default title.
+ * @brush_name: Initial brush name or %NULL to use current selection.
+ * @opacity: Initial opacity. -1 means to use current opacity.
+ * @spacing: Initial spacing. -1 means to use current spacing.
+ * @paint_mode: Initial paint mode. -1 means to use current paint mode.
+ * @callback: A function to call when the selected brush changes.
+ * @data: A pointer to arbitrary data to be used in the call to @callback.
+ *
+ * Creates a new #GtkWidget that completely controls the selection of
+ * a #GimpBrush. This widget is suitable for placement in a table in
+ * a plug-in dialog.
+ *
+ * Returns: A #GtkWidget that you can use in your UI.
+ */
+GtkWidget *
+gimp_brush_select_widget_new (const gchar *title,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode,
+ GimpRunBrushCallback callback,
+ gpointer data)
+{
+ GtkWidget *brush_button;
+ CompatCallbackData *compat_data;
+
+ g_return_val_if_fail (callback != NULL, NULL);
+
+ brush_button = gimp_brush_select_button_new (title, brush_name,
+ opacity, spacing, paint_mode);
+
+ compat_data = g_slice_new (CompatCallbackData);
+
+ compat_data->callback = callback;
+ compat_data->data = data;
+
+ g_signal_connect_data (brush_button, "brush-set",
+ G_CALLBACK (compat_callback),
+ compat_data,
+ (GClosureNotify) compat_callback_data_free, 0);
+
+ return brush_button;
+}
+
+/**
+ * gimp_brush_select_widget_close:
+ * @widget: A brush select widget.
+ *
+ * Closes the popup window associated with @widget.
+ */
+void
+gimp_brush_select_widget_close (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+
+ gimp_select_button_close_popup (GIMP_SELECT_BUTTON (widget));
+}
+
+/**
+ * gimp_brush_select_widget_set:
+ * @widget: A brush select widget.
+ * @brush_name: Brush name to set; %NULL means no change.
+ * @opacity: Opacity to set. -1.0 means no change.
+ * @spacing: Spacing to set. -1 means no change.
+ * @paint_mode: Paint mode to set. -1 means no change.
+ *
+ * Sets the current brush and other values for the brush select
+ * widget. Calls the callback function if one was supplied in the
+ * call to gimp_brush_select_widget_new().
+ */
+void
+gimp_brush_select_widget_set (GtkWidget *widget,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode)
+{
+ g_return_if_fail (widget != NULL);
+
+ gimp_brush_select_button_set_brush (GIMP_BRUSH_SELECT_BUTTON (widget),
+ brush_name, opacity, spacing, paint_mode);
+}
+
+
+static void
+compat_callback (GimpBrushSelectButton *brush_button,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode,
+ gint width,
+ gint height,
+ const guchar *mask_data,
+ gboolean dialog_closing,
+ CompatCallbackData *data)
+{
+ data->callback (brush_name, opacity, spacing, paint_mode,
+ width, height, mask_data, dialog_closing, data->data);
+}
+
+static void
+compat_callback_data_free (CompatCallbackData *data)
+{
+ g_slice_free (CompatCallbackData, data);
+}
diff --git a/libgimp/gimpbrushmenu.h b/libgimp/gimpbrushmenu.h
new file mode 100644
index 0000000..64d9565
--- /dev/null
+++ b/libgimp/gimpbrushmenu.h
@@ -0,0 +1,55 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrushmenu.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_BRUSH_MENU_H__
+#define __GIMP_BRUSH_MENU_H__
+
+/* These functions are deprecated and should not be used in newly
+ * written code.
+ */
+
+G_BEGIN_DECLS
+
+GIMP_DEPRECATED_FOR(gimp_brush_select_button_new)
+GtkWidget * gimp_brush_select_widget_new (const gchar *title,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode,
+ GimpRunBrushCallback callback,
+ gpointer data);
+
+GIMP_DEPRECATED_FOR(gimp_select_button_close_popup)
+void gimp_brush_select_widget_close (GtkWidget *widget);
+GIMP_DEPRECATED_FOR(gimp_brush_select_button_set_brush)
+void gimp_brush_select_widget_set (GtkWidget *widget,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_BRUSH_MENU_H__ */
diff --git a/libgimp/gimpbrushselect.c b/libgimp/gimpbrushselect.c
new file mode 100644
index 0000000..fb17659
--- /dev/null
+++ b/libgimp/gimpbrushselect.c
@@ -0,0 +1,240 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrushselect.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+typedef struct
+{
+ gchar *brush_callback;
+ guint idle_id;
+ gchar *brush_name;
+ gdouble opacity;
+ gint spacing;
+ gint paint_mode;
+ gint width;
+ gint height;
+ guchar *brush_mask_data;
+ GimpRunBrushCallback callback;
+ gboolean closing;
+ gpointer data;
+} GimpBrushData;
+
+
+/* local function prototypes */
+
+static void gimp_brush_data_free (GimpBrushData *data);
+
+static void gimp_temp_brush_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals);
+static gboolean gimp_temp_brush_run_idle (GimpBrushData *brush_data);
+
+
+/* private variables */
+
+static GHashTable *gimp_brush_select_ht = NULL;
+
+
+/* public functions */
+
+const gchar *
+gimp_brush_select_new (const gchar *title,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode,
+ GimpRunBrushCallback callback,
+ gpointer data)
+{
+ static const GimpParamDef args[] =
+ {
+ { GIMP_PDB_STRING, "str", "String" },
+ { GIMP_PDB_FLOAT, "opacity", "Opacity" },
+ { GIMP_PDB_INT32, "spacing", "Spacing" },
+ { GIMP_PDB_INT32, "paint-mode", "Paint mode" },
+ { GIMP_PDB_INT32, "mask-width", "Brush width" },
+ { GIMP_PDB_INT32, "mask-height", "Brush height" },
+ { GIMP_PDB_INT32, "mask-len", "Length of brush mask data" },
+ { GIMP_PDB_INT8ARRAY, "mask-data", "The brush mask data" },
+ { GIMP_PDB_INT32, "dialog-status", "If the dialog was closing "
+ "[0 = No, 1 = Yes]" }
+ };
+
+ gchar *brush_callback = gimp_procedural_db_temp_name ();
+
+ gimp_install_temp_proc (brush_callback,
+ "Temporary brush popup callback procedure",
+ "",
+ "",
+ "",
+ "",
+ NULL,
+ "",
+ GIMP_TEMPORARY,
+ G_N_ELEMENTS (args), 0,
+ args, NULL,
+ gimp_temp_brush_run);
+
+ if (gimp_brushes_popup (brush_callback, title, brush_name,
+ opacity, spacing, paint_mode))
+ {
+ GimpBrushData *brush_data;
+
+ gimp_extension_enable (); /* Allow callbacks to be watched */
+
+ /* Now add to hash table so we can find it again */
+ if (! gimp_brush_select_ht)
+ {
+ gimp_brush_select_ht =
+ g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free,
+ (GDestroyNotify) gimp_brush_data_free);
+ }
+
+ brush_data = g_slice_new0 (GimpBrushData);
+
+ brush_data->brush_callback = brush_callback;
+ brush_data->callback = callback;
+ brush_data->data = data;
+
+ g_hash_table_insert (gimp_brush_select_ht, brush_callback, brush_data);
+
+ return brush_callback;
+ }
+
+ gimp_uninstall_temp_proc (brush_callback);
+ g_free (brush_callback);
+
+ return NULL;
+}
+
+void
+gimp_brush_select_destroy (const gchar *brush_callback)
+{
+ GimpBrushData *brush_data;
+
+ g_return_if_fail (brush_callback != NULL);
+ g_return_if_fail (gimp_brush_select_ht != NULL);
+
+ brush_data = g_hash_table_lookup (gimp_brush_select_ht, brush_callback);
+
+ if (! brush_data)
+ {
+ g_warning ("Can't find internal brush data");
+ return;
+ }
+
+ if (brush_data->idle_id)
+ g_source_remove (brush_data->idle_id);
+
+ g_free (brush_data->brush_name);
+ g_free (brush_data->brush_mask_data);
+
+ if (brush_data->brush_callback)
+ gimp_brushes_close_popup (brush_data->brush_callback);
+
+ gimp_uninstall_temp_proc (brush_callback);
+
+ g_hash_table_remove (gimp_brush_select_ht, brush_callback);
+}
+
+
+/* private functions */
+
+static void
+gimp_brush_data_free (GimpBrushData *data)
+{
+ g_slice_free (GimpBrushData, data);
+}
+
+static void
+gimp_temp_brush_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals)
+{
+ static GimpParam values[1];
+ GimpBrushData *brush_data;
+
+ brush_data = g_hash_table_lookup (gimp_brush_select_ht, name);
+
+ if (! brush_data)
+ {
+ g_warning ("Can't find internal brush data");
+ }
+ else
+ {
+ g_free (brush_data->brush_name);
+ g_free (brush_data->brush_mask_data);
+
+ brush_data->brush_name = g_strdup (param[0].data.d_string);
+ brush_data->opacity = param[1].data.d_float;
+ brush_data->spacing = param[2].data.d_int32;
+ brush_data->paint_mode = param[3].data.d_int32;
+ brush_data->width = param[4].data.d_int32;
+ brush_data->height = param[5].data.d_int32;
+ brush_data->brush_mask_data = g_memdup (param[7].data.d_int8array,
+ param[6].data.d_int32);
+ brush_data->closing = param[8].data.d_int32;
+
+ if (! brush_data->idle_id)
+ brush_data->idle_id = g_idle_add ((GSourceFunc) gimp_temp_brush_run_idle,
+ brush_data);
+ }
+
+ *nreturn_vals = 1;
+ *return_vals = values;
+
+ values[0].type = GIMP_PDB_STATUS;
+ values[0].data.d_status = GIMP_PDB_SUCCESS;
+}
+
+static gboolean
+gimp_temp_brush_run_idle (GimpBrushData *brush_data)
+{
+ brush_data->idle_id = 0;
+
+ if (brush_data->callback)
+ brush_data->callback (brush_data->brush_name,
+ brush_data->opacity,
+ brush_data->spacing,
+ brush_data->paint_mode,
+ brush_data->width,
+ brush_data->height,
+ brush_data->brush_mask_data,
+ brush_data->closing,
+ brush_data->data);
+
+ if (brush_data->closing)
+ {
+ gchar *brush_callback = brush_data->brush_callback;
+
+ brush_data->brush_callback = NULL;
+ gimp_brush_select_destroy (brush_callback);
+ }
+
+ return FALSE;
+}
diff --git a/libgimp/gimpbrushselect.h b/libgimp/gimpbrushselect.h
new file mode 100644
index 0000000..ee66d05
--- /dev/null
+++ b/libgimp/gimpbrushselect.h
@@ -0,0 +1,54 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrushselect.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_BRUSH_SELECT_H__
+#define __GIMP_BRUSH_SELECT_H__
+
+G_BEGIN_DECLS
+
+
+typedef void (* GimpRunBrushCallback) (const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode,
+ gint width,
+ gint height,
+ const guchar *mask_data,
+ gboolean dialog_closing,
+ gpointer user_data);
+
+
+const gchar * gimp_brush_select_new (const gchar *title,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode,
+ GimpRunBrushCallback callback,
+ gpointer data);
+void gimp_brush_select_destroy (const gchar *brush_callback);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_BRUSH_SELECT_H__ */
diff --git a/libgimp/gimpbrushselect_pdb.c b/libgimp/gimpbrushselect_pdb.c
new file mode 100644
index 0000000..9a813f1
--- /dev/null
+++ b/libgimp/gimpbrushselect_pdb.c
@@ -0,0 +1,149 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrushselect_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpbrushselect
+ * @title: gimpbrushselect
+ * @short_description: Functions providing a brush selection dialog.
+ *
+ * Functions providing a brush selection dialog.
+ **/
+
+
+/**
+ * gimp_brushes_popup:
+ * @brush_callback: The callback PDB proc to call when brush selection is made.
+ * @popup_title: Title of the brush selection dialog.
+ * @initial_brush: The name of the brush to set as the first selected.
+ * @opacity: The initial opacity of the brush.
+ * @spacing: The initial spacing of the brush (if < 0 then use brush default spacing).
+ * @paint_mode: The initial paint mode.
+ *
+ * Invokes the Gimp brush selection.
+ *
+ * This procedure opens the brush selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_brushes_popup (const gchar *brush_callback,
+ const gchar *popup_title,
+ const gchar *initial_brush,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-brushes-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, brush_callback,
+ GIMP_PDB_STRING, popup_title,
+ GIMP_PDB_STRING, initial_brush,
+ GIMP_PDB_FLOAT, opacity,
+ GIMP_PDB_INT32, spacing,
+ GIMP_PDB_INT32, paint_mode,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_brushes_close_popup:
+ * @brush_callback: The name of the callback registered for this pop-up.
+ *
+ * Close the brush selection dialog.
+ *
+ * This procedure closes an opened brush selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_brushes_close_popup (const gchar *brush_callback)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-brushes-close-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, brush_callback,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_brushes_set_popup:
+ * @brush_callback: The name of the callback registered for this pop-up.
+ * @brush_name: The name of the brush to set as selected.
+ * @opacity: The initial opacity of the brush.
+ * @spacing: The initial spacing of the brush (if < 0 then use brush default spacing).
+ * @paint_mode: The initial paint mode.
+ *
+ * Sets the current brush in a brush selection dialog.
+ *
+ * Sets the current brush in a brush selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_brushes_set_popup (const gchar *brush_callback,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-brushes-set-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, brush_callback,
+ GIMP_PDB_STRING, brush_name,
+ GIMP_PDB_FLOAT, opacity,
+ GIMP_PDB_INT32, spacing,
+ GIMP_PDB_INT32, paint_mode,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpbrushselect_pdb.h b/libgimp/gimpbrushselect_pdb.h
new file mode 100644
index 0000000..ae401f2
--- /dev/null
+++ b/libgimp/gimpbrushselect_pdb.h
@@ -0,0 +1,51 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrushselect_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_BRUSH_SELECT_PDB_H__
+#define __GIMP_BRUSH_SELECT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_brushes_popup (const gchar *brush_callback,
+ const gchar *popup_title,
+ const gchar *initial_brush,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode);
+gboolean gimp_brushes_close_popup (const gchar *brush_callback);
+gboolean gimp_brushes_set_popup (const gchar *brush_callback,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_BRUSH_SELECT_PDB_H__ */
diff --git a/libgimp/gimpbrushselectbutton.c b/libgimp/gimpbrushselectbutton.c
new file mode 100644
index 0000000..0dc3d54
--- /dev/null
+++ b/libgimp/gimpbrushselectbutton.c
@@ -0,0 +1,932 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrushselectbutton.c
+ * Copyright (C) 1998 Andy Thomas
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimpbrushselectbutton.h"
+#include "gimpuimarshal.h"
+
+#include "libgimp-intl.h"
+
+
+/**
+ * SECTION: gimpbrushselectbutton
+ * @title: gimpbrushselectbutton
+ * @short_description: A button that pops up a brush selection dialog.
+ *
+ * A button that pops up a brush selection dialog.
+ **/
+
+
+#define CELL_SIZE 20
+
+
+#define GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE(obj) ((GimpBrushSelectButtonPrivate *) gimp_brush_select_button_get_instance_private ((GimpBrushSelectButton *) (obj)))
+
+typedef struct _GimpBrushSelectButtonPrivate GimpBrushSelectButtonPrivate;
+
+struct _GimpBrushSelectButtonPrivate
+{
+ gchar *title;
+
+ gchar *brush_name; /* Local copy */
+ gdouble opacity;
+ gint spacing;
+ GimpLayerMode paint_mode;
+ gint width;
+ gint height;
+ guchar *mask_data; /* local copy */
+
+ GtkWidget *inside;
+ GtkWidget *preview;
+ GtkWidget *popup;
+};
+
+enum
+{
+ BRUSH_SET,
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_TITLE,
+ PROP_BRUSH_NAME,
+ PROP_BRUSH_OPACITY,
+ PROP_BRUSH_SPACING,
+ PROP_BRUSH_PAINT_MODE
+};
+
+
+/* local function prototypes */
+
+static void gimp_brush_select_button_finalize (GObject *object);
+
+static void gimp_brush_select_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_brush_select_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_brush_select_button_clicked (GimpBrushSelectButton *button);
+
+static void gimp_brush_select_button_callback (const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode,
+ gint width,
+ gint height,
+ const guchar *mask_data,
+ gboolean dialog_closing,
+ gpointer user_data);
+
+static void gimp_brush_select_preview_resize (GimpBrushSelectButton *button);
+static gboolean gimp_brush_select_preview_events (GtkWidget *widget,
+ GdkEvent *event,
+ GimpBrushSelectButton *button);
+static void gimp_brush_select_preview_draw (GimpPreviewArea *area,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ const guchar *mask_data,
+ gint rowstride);
+static void gimp_brush_select_preview_update (GtkWidget *preview,
+ gint brush_width,
+ gint brush_height,
+ const guchar *mask_data);
+
+static void gimp_brush_select_button_open_popup (GimpBrushSelectButton *button,
+ gint x,
+ gint y);
+static void gimp_brush_select_button_close_popup (GimpBrushSelectButton *button);
+
+static void gimp_brush_select_drag_data_received (GimpBrushSelectButton *button,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time);
+
+static GtkWidget * gimp_brush_select_button_create_inside (GimpBrushSelectButton *button);
+
+
+static const GtkTargetEntry target = { "application/x-gimp-brush-name", 0 };
+
+static guint brush_button_signals[LAST_SIGNAL] = { 0 };
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpBrushSelectButton, gimp_brush_select_button,
+ GIMP_TYPE_SELECT_BUTTON)
+
+
+static void
+gimp_brush_select_button_class_init (GimpBrushSelectButtonClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GimpSelectButtonClass *select_button_class = GIMP_SELECT_BUTTON_CLASS (klass);
+
+ object_class->finalize = gimp_brush_select_button_finalize;
+ object_class->set_property = gimp_brush_select_button_set_property;
+ object_class->get_property = gimp_brush_select_button_get_property;
+
+ select_button_class->select_destroy = gimp_brush_select_destroy;
+
+ klass->brush_set = NULL;
+
+ /**
+ * GimpBrushSelectButton:title:
+ *
+ * The title to be used for the brush selection popup dialog.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_TITLE,
+ g_param_spec_string ("title",
+ "Title",
+ "The title to be used for the brush selection popup dialog",
+ _("Brush Selection"),
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * GimpBrushSelectButton:brush-name:
+ *
+ * The name of the currently selected brush.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_BRUSH_NAME,
+ g_param_spec_string ("brush-name",
+ "Brush name",
+ "The name of the currently selected brush",
+ NULL,
+ GIMP_PARAM_READWRITE));
+
+ /**
+ * GimpBrushSelectButton:opacity:
+ *
+ * The opacity of the currently selected brush.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_BRUSH_OPACITY,
+ g_param_spec_double ("brush-opacity",
+ "Brush opacity",
+ "The opacity of the currently selected brush",
+ -1.0, 100.0, -1.0,
+ GIMP_PARAM_READWRITE));
+
+ /**
+ * GimpBrushSelectButton:spacing:
+ *
+ * The spacing of the currently selected brush.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_BRUSH_SPACING,
+ g_param_spec_int ("brush-spacing",
+ "Brush spacing",
+ "The spacing of the currently selected brush",
+ -G_MAXINT, 1000, -1,
+ GIMP_PARAM_READWRITE));
+
+ /**
+ * GimpBrushSelectButton:paint-mode:
+ *
+ * The paint mode.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_BRUSH_PAINT_MODE,
+ g_param_spec_int ("brush-paint-mode",
+ "Brush paint mode",
+ "The paint mode of the currently selected brush",
+ -1, GIMP_LAYER_MODE_LUMINANCE,
+ -1,
+ GIMP_PARAM_READWRITE));
+
+ /**
+ * GimpBrushSelectButton::brush-set:
+ * @widget: the object which received the signal.
+ * @brush_name: the name of the currently selected brush.
+ * @opacity: opacity of the brush
+ * @spacing: spacing of the brush
+ * @paint_mode: paint mode of the brush
+ * @width: width of the brush
+ * @height: height of the brush
+ * @mask_data: brush mask data
+ * @dialog_closing: whether the dialog was closed or not.
+ *
+ * The ::brush-set signal is emitted when the user selects a brush.
+ *
+ * Since: 2.4
+ */
+ brush_button_signals[BRUSH_SET] =
+ g_signal_new ("brush-set",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpBrushSelectButtonClass, brush_set),
+ NULL, NULL,
+ _gimpui_marshal_VOID__STRING_DOUBLE_INT_INT_INT_INT_POINTER_BOOLEAN,
+ G_TYPE_NONE, 8,
+ G_TYPE_STRING,
+ G_TYPE_DOUBLE,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ G_TYPE_POINTER,
+ G_TYPE_BOOLEAN);
+}
+
+static void
+gimp_brush_select_button_init (GimpBrushSelectButton *button)
+{
+ GimpBrushSelectButtonPrivate *priv;
+ gint mask_bpp;
+ gint mask_data_size;
+ gint color_bpp;
+ gint color_data_size;
+ guint8 *color_data;
+
+ priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (button);
+
+ priv->brush_name = gimp_context_get_brush ();
+ gimp_brush_get_pixels (priv->brush_name,
+ &priv->width,
+ &priv->height,
+ &mask_bpp,
+ &mask_data_size,
+ &priv->mask_data,
+ &color_bpp,
+ &color_data_size,
+ &color_data);
+
+ if (color_data)
+ g_free (color_data);
+
+ priv->inside = gimp_brush_select_button_create_inside (button);
+ gtk_container_add (GTK_CONTAINER (button), priv->inside);
+
+ priv->popup = NULL;
+}
+
+/**
+ * gimp_brush_select_button_new:
+ * @title: Title of the dialog to use or %NULL means to use the default
+ * title.
+ * @brush_name: Initial brush name or %NULL to use current selection.
+ * @opacity: Initial opacity. -1 means to use current opacity.
+ * @spacing: Initial spacing. -1 means to use current spacing.
+ * @paint_mode: Initial paint mode. -1 means to use current paint mode.
+ *
+ * Creates a new #GtkWidget that completely controls the selection of
+ * a brush. This widget is suitable for placement in a table in a
+ * plug-in dialog.
+ *
+ * Returns: A #GtkWidget that you can use in your UI.
+ *
+ * Since: 2.4
+ */
+GtkWidget *
+gimp_brush_select_button_new (const gchar *title,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode)
+{
+ GtkWidget *button;
+
+ if (title)
+ button = g_object_new (GIMP_TYPE_BRUSH_SELECT_BUTTON,
+ "title", title,
+ "brush-name", brush_name,
+ "brush-opacity", opacity,
+ "brush-spacing", spacing,
+ "brush-paint-mode", paint_mode,
+ NULL);
+ else
+ button = g_object_new (GIMP_TYPE_BRUSH_SELECT_BUTTON,
+ "brush-name", brush_name,
+ "brush-opacity", opacity,
+ "brush-spacing", spacing,
+ "brush-paint-mode", paint_mode,
+ NULL);
+
+ return button;
+}
+
+/**
+ * gimp_brush_select_button_get_brush:
+ * @button: A #GimpBrushSelectButton
+ * @opacity: Opacity of the selected brush.
+ * @spacing: Spacing of the selected brush.
+ * @paint_mode: Paint mode of the selected brush.
+ *
+ * Retrieves the properties of currently selected brush.
+ *
+ * Returns: an internal copy of the brush name which must not be freed.
+ *
+ * Since: 2.4
+ */
+const gchar *
+gimp_brush_select_button_get_brush (GimpBrushSelectButton *button,
+ gdouble *opacity,
+ gint *spacing,
+ GimpLayerMode *paint_mode)
+{
+ GimpBrushSelectButtonPrivate *priv;
+
+ g_return_val_if_fail (GIMP_IS_BRUSH_SELECT_BUTTON (button), NULL);
+
+ priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (button);
+
+ if (opacity)
+ *opacity = priv->opacity;
+
+ if (spacing)
+ *spacing = priv->spacing;
+
+ if (paint_mode)
+ *paint_mode = priv->paint_mode;
+
+ return priv->brush_name;
+}
+
+/**
+ * gimp_brush_select_button_set_brush:
+ * @button: A #GimpBrushSelectButton
+ * @brush_name: Brush name to set; %NULL means no change.
+ * @opacity: Opacity to set. -1.0 means no change.
+ * @spacing: Spacing to set. -1 means no change.
+ * @paint_mode: Paint mode to set. -1 means no change.
+ *
+ * Sets the current brush and other values for the brush select
+ * button.
+ *
+ * Since: 2.4
+ */
+void
+gimp_brush_select_button_set_brush (GimpBrushSelectButton *button,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode)
+{
+ GimpSelectButton *select_button;
+
+ g_return_if_fail (GIMP_IS_BRUSH_SELECT_BUTTON (button));
+
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ if (select_button->temp_callback)
+ {
+ gimp_brushes_set_popup (select_button->temp_callback, brush_name,
+ opacity, spacing, paint_mode);
+ }
+ else
+ {
+ gchar *name;
+ gint width;
+ gint height;
+ gint bytes;
+ gint mask_data_size;
+ guint8 *mask_data;
+ gint color_bpp;
+ gint color_data_size;
+ guint8 *color_data;
+
+ if (brush_name && *brush_name)
+ name = g_strdup (brush_name);
+ else
+ name = gimp_context_get_brush ();
+
+ if (gimp_brush_get_pixels (name,
+ &width,
+ &height,
+ &bytes,
+ &mask_data_size,
+ &mask_data,
+ &color_bpp,
+ &color_data_size,
+ &color_data))
+ {
+ if (color_data)
+ g_free (color_data);
+
+ if (opacity < 0.0)
+ opacity = gimp_context_get_opacity ();
+
+ if (spacing == -1)
+ gimp_brush_get_spacing (name, &spacing);
+
+ if (paint_mode == -1)
+ paint_mode = gimp_context_get_paint_mode ();
+
+ gimp_brush_select_button_callback (name,
+ opacity, spacing, paint_mode,
+ width, height, mask_data,
+ FALSE, button);
+
+ g_free (mask_data);
+ }
+
+ g_free (name);
+ }
+}
+
+
+/* private functions */
+
+static void
+gimp_brush_select_button_finalize (GObject *object)
+{
+ GimpBrushSelectButtonPrivate *priv;
+
+ priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (object);
+
+ g_clear_pointer (&priv->brush_name, g_free);
+ g_clear_pointer (&priv->mask_data, g_free);
+ g_clear_pointer (&priv->title, g_free);
+
+ G_OBJECT_CLASS (gimp_brush_select_button_parent_class)->finalize (object);
+}
+
+static void
+gimp_brush_select_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpBrushSelectButton *button = GIMP_BRUSH_SELECT_BUTTON (object);
+ GimpBrushSelectButtonPrivate *priv;
+ gdouble opacity;
+ gint32 spacing;
+ gint32 paint_mode;
+
+ priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (button);
+
+ switch (property_id)
+ {
+ case PROP_TITLE:
+ priv->title = g_value_dup_string (value);
+ break;
+ case PROP_BRUSH_NAME:
+ gimp_brush_select_button_set_brush (button,
+ g_value_get_string (value),
+ -1.0, -1, -1);
+ break;
+ case PROP_BRUSH_OPACITY:
+ opacity = g_value_get_double (value);
+ if (opacity >= 0.0)
+ priv->opacity = opacity;
+ break;
+ case PROP_BRUSH_SPACING:
+ spacing = g_value_get_int (value);
+ if (spacing != -1)
+ priv->spacing = spacing;
+ break;
+ case PROP_BRUSH_PAINT_MODE:
+ paint_mode = g_value_get_int (value);
+ if (paint_mode != -1)
+ priv->paint_mode = paint_mode;
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_brush_select_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpBrushSelectButton *button = GIMP_BRUSH_SELECT_BUTTON (object);
+ GimpBrushSelectButtonPrivate *priv;
+
+ priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (button);
+
+ switch (property_id)
+ {
+ case PROP_TITLE:
+ g_value_set_string (value, priv->title);
+ break;
+ case PROP_BRUSH_NAME:
+ g_value_set_string (value, priv->brush_name);
+ break;
+ case PROP_BRUSH_OPACITY:
+ g_value_set_double (value, priv->opacity);
+ break;
+ case PROP_BRUSH_SPACING:
+ g_value_set_int (value, priv->spacing);
+ break;
+ case PROP_BRUSH_PAINT_MODE:
+ g_value_set_int (value, priv->paint_mode);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_brush_select_button_callback (const gchar *name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode,
+ gint width,
+ gint height,
+ const guchar *mask_data,
+ gboolean dialog_closing,
+ gpointer data)
+{
+ GimpBrushSelectButton *button;
+ GimpBrushSelectButtonPrivate *priv;
+ GimpSelectButton *select_button;
+
+ button = GIMP_BRUSH_SELECT_BUTTON (data);
+
+ priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (button);
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ g_free (priv->brush_name);
+ g_free (priv->mask_data);
+
+ priv->brush_name = g_strdup (name);
+ priv->width = width;
+ priv->height = height;
+ priv->mask_data = g_memdup (mask_data, width * height);
+ priv->opacity = opacity;
+ priv->spacing = spacing;
+ priv->paint_mode = paint_mode;
+
+ gimp_brush_select_preview_update (priv->preview,
+ width, height, mask_data);
+
+ if (dialog_closing)
+ select_button->temp_callback = NULL;
+
+ g_signal_emit (button, brush_button_signals[BRUSH_SET], 0,
+ name, opacity, spacing, paint_mode, width, height, mask_data,
+ dialog_closing);
+ g_object_notify (G_OBJECT (button), "brush-name");
+}
+
+static void
+gimp_brush_select_button_clicked (GimpBrushSelectButton *button)
+{
+ GimpBrushSelectButtonPrivate *priv;
+ GimpSelectButton *select_button;
+
+ priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (button);
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ if (select_button->temp_callback)
+ {
+ /* calling gimp_brushes_set_popup() raises the dialog */
+ gimp_brushes_set_popup (select_button->temp_callback,
+ priv->brush_name,
+ priv->opacity,
+ priv->spacing,
+ priv->paint_mode);
+ }
+ else
+ {
+ select_button->temp_callback =
+ gimp_brush_select_new (priv->title, priv->brush_name,
+ priv->opacity, priv->spacing, priv->paint_mode,
+ gimp_brush_select_button_callback,
+ button);
+ }
+}
+
+static void
+gimp_brush_select_preview_resize (GimpBrushSelectButton *button)
+{
+ GimpBrushSelectButtonPrivate *priv;
+
+ priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (button);
+
+ if (priv->width > 0 && priv->height > 0)
+ gimp_brush_select_preview_update (priv->preview,
+ priv->width,
+ priv->height,
+ priv->mask_data);
+}
+
+static gboolean
+gimp_brush_select_preview_events (GtkWidget *widget,
+ GdkEvent *event,
+ GimpBrushSelectButton *button)
+{
+ GimpBrushSelectButtonPrivate *priv;
+ GdkEventButton *bevent;
+
+ priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (button);
+
+ if (priv->mask_data)
+ {
+ switch (event->type)
+ {
+ case GDK_BUTTON_PRESS:
+ bevent = (GdkEventButton *) event;
+
+ if (bevent->button == 1)
+ {
+ gtk_grab_add (widget);
+ gimp_brush_select_button_open_popup (button,
+ bevent->x, bevent->y);
+ }
+ break;
+
+ case GDK_BUTTON_RELEASE:
+ bevent = (GdkEventButton *) event;
+
+ if (bevent->button == 1)
+ {
+ gtk_grab_remove (widget);
+ gimp_brush_select_button_close_popup (button);
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return FALSE;
+}
+
+static void
+gimp_brush_select_preview_draw (GimpPreviewArea *area,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ const guchar *mask_data,
+ gint rowstride)
+{
+ const guchar *src;
+ guchar *dest;
+ guchar *buf;
+ gint i, j;
+
+ buf = g_new (guchar, width * height);
+
+ src = mask_data;
+ dest = buf;
+
+ for (j = 0; j < height; j++)
+ {
+ const guchar *s = src;
+
+ for (i = 0; i < width; i++, s++, dest++)
+ *dest = 255 - *s;
+
+ src += rowstride;
+ }
+
+ gimp_preview_area_draw (area,
+ x, y, width, height,
+ GIMP_GRAY_IMAGE,
+ buf,
+ width);
+
+ g_free (buf);
+}
+
+static void
+gimp_brush_select_preview_update (GtkWidget *preview,
+ gint brush_width,
+ gint brush_height,
+ const guchar *mask_data)
+{
+ GimpPreviewArea *area = GIMP_PREVIEW_AREA (preview);
+ GtkAllocation allocation;
+ gint x, y;
+ gint width, height;
+
+ gtk_widget_get_allocation (preview, &allocation);
+
+ width = MIN (brush_width, allocation.width);
+ height = MIN (brush_height, allocation.height);
+
+ x = ((allocation.width - width) / 2);
+ y = ((allocation.height - height) / 2);
+
+ if (x || y)
+ gimp_preview_area_fill (area,
+ 0, 0,
+ allocation.width,
+ allocation.height,
+ 0xFF, 0xFF, 0xFF);
+
+ gimp_brush_select_preview_draw (area,
+ x, y, width, height,
+ mask_data, brush_width);
+}
+
+static void
+gimp_brush_select_button_open_popup (GimpBrushSelectButton *button,
+ gint x,
+ gint y)
+{
+ GimpBrushSelectButtonPrivate *priv;
+ GtkWidget *frame;
+ GtkWidget *preview;
+ GdkScreen *screen;
+ gint x_org;
+ gint y_org;
+ gint scr_w;
+ gint scr_h;
+
+ priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (button);
+
+ if (priv->popup)
+ gimp_brush_select_button_close_popup (button);
+
+ if (priv->width <= CELL_SIZE && priv->height <= CELL_SIZE)
+ return;
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (button));
+
+ priv->popup = gtk_window_new (GTK_WINDOW_POPUP);
+ gtk_window_set_type_hint (GTK_WINDOW (priv->popup), GDK_WINDOW_TYPE_HINT_DND);
+ gtk_window_set_screen (GTK_WINDOW (priv->popup), screen);
+
+ frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
+ gtk_container_add (GTK_CONTAINER (priv->popup), frame);
+ gtk_widget_show (frame);
+
+ preview = gimp_preview_area_new ();
+ gtk_widget_set_size_request (preview, priv->width, priv->height);
+ gtk_container_add (GTK_CONTAINER (frame), preview);
+ gtk_widget_show (preview);
+
+ /* decide where to put the popup */
+ gdk_window_get_origin (gtk_widget_get_window (priv->preview),
+ &x_org, &y_org);
+
+ scr_w = gdk_screen_get_width (screen);
+ scr_h = gdk_screen_get_height (screen);
+
+ x = x_org + x - (priv->width / 2);
+ y = y_org + y - (priv->height / 2);
+ x = (x < 0) ? 0 : x;
+ y = (y < 0) ? 0 : y;
+ x = (x + priv->width > scr_w) ? scr_w - priv->width : x;
+ y = (y + priv->height > scr_h) ? scr_h - priv->height : y;
+
+ gtk_window_move (GTK_WINDOW (priv->popup), x, y);
+
+ gtk_widget_show (priv->popup);
+
+ /* Draw the brush */
+ gimp_brush_select_preview_draw (GIMP_PREVIEW_AREA (preview),
+ 0, 0, priv->width, priv->height,
+ priv->mask_data, priv->width);
+}
+
+static void
+gimp_brush_select_button_close_popup (GimpBrushSelectButton *button)
+{
+ GimpBrushSelectButtonPrivate *priv;
+
+ priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (button);
+
+ if (priv->popup)
+ {
+ gtk_widget_destroy (priv->popup);
+ priv->popup = NULL;
+ }
+}
+
+static void
+gimp_brush_select_drag_data_received (GimpBrushSelectButton *button,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time)
+{
+ gint length = gtk_selection_data_get_length (selection);
+ gchar *str;
+
+ if (gtk_selection_data_get_format (selection) != 8 || length < 1)
+ {
+ g_warning ("%s: received invalid brush data", G_STRFUNC);
+ return;
+ }
+
+ str = g_strndup ((const gchar *) gtk_selection_data_get_data (selection),
+ length);
+
+ if (g_utf8_validate (str, -1, NULL))
+ {
+ gint pid;
+ gpointer unused;
+ gint name_offset = 0;
+
+ if (sscanf (str, "%i:%p:%n", &pid, &unused, &name_offset) >= 2 &&
+ pid == gimp_getpid () && name_offset > 0)
+ {
+ gchar *name = str + name_offset;
+
+ gimp_brush_select_button_set_brush (button, name, -1.0, -1, -1);
+ }
+ }
+
+ g_free (str);
+}
+
+static GtkWidget *
+gimp_brush_select_button_create_inside (GimpBrushSelectButton *brush_button)
+{
+ GtkWidget *hbox;
+ GtkWidget *frame;
+ GtkWidget *button;
+ GimpBrushSelectButtonPrivate *priv;
+
+ priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (brush_button);
+
+ gtk_widget_push_composite_child ();
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+
+ frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
+ gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
+
+ priv->preview = gimp_preview_area_new ();
+ gtk_widget_add_events (priv->preview,
+ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
+ gtk_widget_set_size_request (priv->preview, CELL_SIZE, CELL_SIZE);
+ gtk_container_add (GTK_CONTAINER (frame), priv->preview);
+
+ g_signal_connect_swapped (priv->preview, "size-allocate",
+ G_CALLBACK (gimp_brush_select_preview_resize),
+ brush_button);
+ g_signal_connect (priv->preview, "event",
+ G_CALLBACK (gimp_brush_select_preview_events),
+ brush_button);
+
+ gtk_drag_dest_set (GTK_WIDGET (priv->preview),
+ GTK_DEST_DEFAULT_HIGHLIGHT |
+ GTK_DEST_DEFAULT_MOTION |
+ GTK_DEST_DEFAULT_DROP,
+ &target, 1,
+ GDK_ACTION_COPY);
+
+ g_signal_connect_swapped (priv->preview, "drag-data-received",
+ G_CALLBACK (gimp_brush_select_drag_data_received),
+ brush_button);
+
+ button = gtk_button_new_with_mnemonic (_("_Browse..."));
+ gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
+
+ g_signal_connect_swapped (button, "clicked",
+ G_CALLBACK (gimp_brush_select_button_clicked),
+ brush_button);
+
+ gtk_widget_show_all (hbox);
+
+ gtk_widget_pop_composite_child ();
+
+ return hbox;
+}
diff --git a/libgimp/gimpbrushselectbutton.h b/libgimp/gimpbrushselectbutton.h
new file mode 100644
index 0000000..8bc3a28
--- /dev/null
+++ b/libgimp/gimpbrushselectbutton.h
@@ -0,0 +1,94 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpbrushselectbutton.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_BRUSH_SELECT_BUTTON_H__
+#define __GIMP_BRUSH_SELECT_BUTTON_H__
+
+#include <libgimp/gimpselectbutton.h>
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+#define GIMP_TYPE_BRUSH_SELECT_BUTTON (gimp_brush_select_button_get_type ())
+#define GIMP_BRUSH_SELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_BRUSH_SELECT_BUTTON, GimpBrushSelectButton))
+#define GIMP_BRUSH_SELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH_SELECT_BUTTON, GimpBrushSelectButtonClass))
+#define GIMP_IS_BRUSH_SELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_BRUSH_SELECT_BUTTON))
+#define GIMP_IS_BRUSH_SELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_SELECT_BUTTON))
+#define GIMP_BRUSH_SELECT_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_BRUSH_SELECT_BUTTON, GimpBrushSelectButtonClass))
+
+
+typedef struct _GimpBrushSelectButtonClass GimpBrushSelectButtonClass;
+
+struct _GimpBrushSelectButton
+{
+ GimpSelectButton parent_instance;
+};
+
+struct _GimpBrushSelectButtonClass
+{
+ GimpSelectButtonClass parent_class;
+
+ /* brush_set signal is emitted when brush is chosen */
+ void (* brush_set) (GimpBrushSelectButton *button,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode,
+ gint width,
+ gint height,
+ const guchar *mask_data,
+ gboolean dialog_closing);
+
+ /* Padding for future expansion */
+ void (*_gimp_reserved1) (void);
+ void (*_gimp_reserved2) (void);
+ void (*_gimp_reserved3) (void);
+ void (*_gimp_reserved4) (void);
+};
+
+
+GType gimp_brush_select_button_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_brush_select_button_new (const gchar *title,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode);
+
+const gchar * gimp_brush_select_button_get_brush (GimpBrushSelectButton *button,
+ gdouble *opacity,
+ gint *spacing,
+ GimpLayerMode *paint_mode);
+void gimp_brush_select_button_set_brush (GimpBrushSelectButton *button,
+ const gchar *brush_name,
+ gdouble opacity,
+ gint spacing,
+ GimpLayerMode paint_mode);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_BRUSH_SELECT_BUTTON_H__ */
diff --git a/libgimp/gimpbuffer_pdb.c b/libgimp/gimpbuffer_pdb.c
new file mode 100644
index 0000000..afe8ee0
--- /dev/null
+++ b/libgimp/gimpbuffer_pdb.c
@@ -0,0 +1,276 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpbuffer_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpbuffer
+ * @title: gimpbuffer
+ * @short_description: Functions for manipulating cut buffers.
+ *
+ * Functions related to named cut buffers.
+ **/
+
+
+/**
+ * gimp_buffers_get_list:
+ * @filter: An optional regular expression used to filter the list.
+ * @num_buffers: The number of buffers.
+ *
+ * Retrieve a complete listing of the available buffers.
+ *
+ * This procedure returns a complete listing of available named
+ * buffers.
+ *
+ * Returns: The list of buffer names. The returned value must be freed
+ * with g_strfreev().
+ *
+ * Since: 2.4
+ **/
+gchar **
+gimp_buffers_get_list (const gchar *filter,
+ gint *num_buffers)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar **buffer_list = NULL;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-buffers-get-list",
+ &nreturn_vals,
+ GIMP_PDB_STRING, filter,
+ GIMP_PDB_END);
+
+ *num_buffers = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_buffers = return_vals[1].data.d_int32;
+ if (*num_buffers > 0)
+ {
+ buffer_list = g_new0 (gchar *, *num_buffers + 1);
+ for (i = 0; i < *num_buffers; i++)
+ buffer_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return buffer_list;
+}
+
+/**
+ * gimp_buffer_rename:
+ * @buffer_name: The buffer name.
+ * @new_name: The buffer's new name.
+ *
+ * Renames a named buffer.
+ *
+ * This procedure renames a named buffer.
+ *
+ * Returns: The real name given to the buffer.
+ *
+ * Since: 2.4
+ **/
+gchar *
+gimp_buffer_rename (const gchar *buffer_name,
+ const gchar *new_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *real_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-buffer-rename",
+ &nreturn_vals,
+ GIMP_PDB_STRING, buffer_name,
+ GIMP_PDB_STRING, new_name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ real_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return real_name;
+}
+
+/**
+ * gimp_buffer_delete:
+ * @buffer_name: The buffer name.
+ *
+ * Deletes a named buffer.
+ *
+ * This procedure deletes a named buffer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_buffer_delete (const gchar *buffer_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-buffer-delete",
+ &nreturn_vals,
+ GIMP_PDB_STRING, buffer_name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_buffer_get_width:
+ * @buffer_name: The buffer name.
+ *
+ * Retrieves the specified buffer's width.
+ *
+ * This procedure retrieves the specified named buffer's width.
+ *
+ * Returns: The buffer width.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_buffer_get_width (const gchar *buffer_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint width = 0;
+
+ return_vals = gimp_run_procedure ("gimp-buffer-get-width",
+ &nreturn_vals,
+ GIMP_PDB_STRING, buffer_name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ width = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return width;
+}
+
+/**
+ * gimp_buffer_get_height:
+ * @buffer_name: The buffer name.
+ *
+ * Retrieves the specified buffer's height.
+ *
+ * This procedure retrieves the specified named buffer's height.
+ *
+ * Returns: The buffer height.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_buffer_get_height (const gchar *buffer_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint height = 0;
+
+ return_vals = gimp_run_procedure ("gimp-buffer-get-height",
+ &nreturn_vals,
+ GIMP_PDB_STRING, buffer_name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ height = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return height;
+}
+
+/**
+ * gimp_buffer_get_bytes:
+ * @buffer_name: The buffer name.
+ *
+ * Retrieves the specified buffer's bytes.
+ *
+ * This procedure retrieves the specified named buffer's bytes.
+ *
+ * Returns: The buffer bpp.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_buffer_get_bytes (const gchar *buffer_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint bytes = 0;
+
+ return_vals = gimp_run_procedure ("gimp-buffer-get-bytes",
+ &nreturn_vals,
+ GIMP_PDB_STRING, buffer_name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ bytes = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return bytes;
+}
+
+/**
+ * gimp_buffer_get_image_type:
+ * @buffer_name: The buffer name.
+ *
+ * Retrieves the specified buffer's image type.
+ *
+ * This procedure retrieves the specified named buffer's image type.
+ *
+ * Returns: The buffer image type.
+ *
+ * Since: 2.4
+ **/
+GimpImageBaseType
+gimp_buffer_get_image_type (const gchar *buffer_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpImageBaseType image_type = 0;
+
+ return_vals = gimp_run_procedure ("gimp-buffer-get-image-type",
+ &nreturn_vals,
+ GIMP_PDB_STRING, buffer_name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ image_type = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return image_type;
+}
diff --git a/libgimp/gimpbuffer_pdb.h b/libgimp/gimpbuffer_pdb.h
new file mode 100644
index 0000000..83b9196
--- /dev/null
+++ b/libgimp/gimpbuffer_pdb.h
@@ -0,0 +1,48 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpbuffer_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_BUFFER_PDB_H__
+#define __GIMP_BUFFER_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gchar** gimp_buffers_get_list (const gchar *filter,
+ gint *num_buffers);
+gchar* gimp_buffer_rename (const gchar *buffer_name,
+ const gchar *new_name);
+gboolean gimp_buffer_delete (const gchar *buffer_name);
+gint gimp_buffer_get_width (const gchar *buffer_name);
+gint gimp_buffer_get_height (const gchar *buffer_name);
+gint gimp_buffer_get_bytes (const gchar *buffer_name);
+GimpImageBaseType gimp_buffer_get_image_type (const gchar *buffer_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_BUFFER_PDB_H__ */
diff --git a/libgimp/gimpchannel.c b/libgimp/gimpchannel.c
new file mode 100644
index 0000000..00a45f2
--- /dev/null
+++ b/libgimp/gimpchannel.c
@@ -0,0 +1,61 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpchannel.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * gimp_channel_new:
+ * @image_ID: The image to which to add the channel.
+ * @name: The channel name.
+ * @width: The channel width.
+ * @height: The channel height.
+ * @opacity: The channel opacity.
+ * @color: The channel compositing color.
+ *
+ * Create a new channel.
+ *
+ * This procedure creates a new channel with the specified width and
+ * height. Name, opacity, and color are also supplied parameters. The
+ * new channel still needs to be added to the image, as this is not
+ * automatic. Add the new channel with the gimp_image_insert_channel()
+ * command. Other attributes such as channel show masked, should be
+ * set with explicit procedure calls. The channel's contents are
+ * undefined initially.
+ *
+ * Returns: The newly created channel.
+ */
+gint32
+gimp_channel_new (gint32 image_ID,
+ const gchar *name,
+ guint width,
+ guint height,
+ gdouble opacity,
+ const GimpRGB *color)
+{
+ return _gimp_channel_new (image_ID,
+ width,
+ height,
+ name,
+ opacity,
+ color);
+}
diff --git a/libgimp/gimpchannel.h b/libgimp/gimpchannel.h
new file mode 100644
index 0000000..47b141b
--- /dev/null
+++ b/libgimp/gimpchannel.h
@@ -0,0 +1,44 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpchannel.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_CHANNEL_H__
+#define __GIMP_CHANNEL_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gint32 gimp_channel_new (gint32 image_ID,
+ const gchar *name,
+ guint width,
+ guint height,
+ gdouble opacity,
+ const GimpRGB *color);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_CHANNEL_H__ */
+
diff --git a/libgimp/gimpchannel_pdb.c b/libgimp/gimpchannel_pdb.c
new file mode 100644
index 0000000..a1b1a85
--- /dev/null
+++ b/libgimp/gimpchannel_pdb.c
@@ -0,0 +1,396 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpchannel_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpchannel
+ * @title: gimpchannel
+ * @short_description: Functions for manipulating channels.
+ *
+ * Functions for manipulating channels.
+ **/
+
+
+/**
+ * _gimp_channel_new:
+ * @image_ID: The image to which to add the channel.
+ * @width: The channel width.
+ * @height: The channel height.
+ * @name: The channel name.
+ * @opacity: The channel opacity.
+ * @color: The channel compositing color.
+ *
+ * Create a new channel.
+ *
+ * This procedure creates a new channel with the specified width,
+ * height, name, opacity and color.
+ * The new channel still needs to be added to the image, as this is not
+ * automatic. Add the new channel with gimp_image_insert_channel().
+ * Other attributes, such as channel visibility, should be set with
+ * explicit procedure calls.
+ * The channel's contents are undefined initially.
+ *
+ * Returns: The newly created channel.
+ **/
+gint32
+_gimp_channel_new (gint32 image_ID,
+ gint width,
+ gint height,
+ const gchar *name,
+ gdouble opacity,
+ const GimpRGB *color)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 channel_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-channel-new",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, width,
+ GIMP_PDB_INT32, height,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_FLOAT, opacity,
+ GIMP_PDB_COLOR, color,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ channel_ID = return_vals[1].data.d_channel;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return channel_ID;
+}
+
+/**
+ * gimp_channel_new_from_component:
+ * @image_ID: The image to which to add the channel.
+ * @component: The image component.
+ * @name: The channel name.
+ *
+ * Create a new channel from a color component
+ *
+ * This procedure creates a new channel from a color component.
+ * The new channel still needs to be added to the image, as this is not
+ * automatic. Add the new channel with gimp_image_insert_channel().
+ * Other attributes, such as channel visibility, should be set with
+ * explicit procedure calls.
+ *
+ * Returns: The newly created channel.
+ *
+ * Since: 2.4
+ **/
+gint32
+gimp_channel_new_from_component (gint32 image_ID,
+ GimpChannelType component,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 channel_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-channel-new-from-component",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, component,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ channel_ID = return_vals[1].data.d_channel;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return channel_ID;
+}
+
+/**
+ * gimp_channel_copy:
+ * @channel_ID: The channel to copy.
+ *
+ * Copy a channel.
+ *
+ * This procedure copies the specified channel and returns the copy.
+ * The new channel still needs to be added to the image, as this is not
+ * automatic. Add the new channel with gimp_image_insert_channel().
+ *
+ * Returns: The newly copied channel.
+ **/
+gint32
+gimp_channel_copy (gint32 channel_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 channel_copy_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-channel-copy",
+ &nreturn_vals,
+ GIMP_PDB_CHANNEL, channel_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ channel_copy_ID = return_vals[1].data.d_channel;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return channel_copy_ID;
+}
+
+/**
+ * gimp_channel_combine_masks:
+ * @channel1_ID: The channel1.
+ * @channel2_ID: The channel2.
+ * @operation: The selection operation.
+ * @offx: x offset between upper left corner of channels: (second - first).
+ * @offy: y offset between upper left corner of channels: (second - first).
+ *
+ * Combine two channel masks.
+ *
+ * This procedure combines two channel masks. The result is stored in
+ * the first channel.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_channel_combine_masks (gint32 channel1_ID,
+ gint32 channel2_ID,
+ GimpChannelOps operation,
+ gint offx,
+ gint offy)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-channel-combine-masks",
+ &nreturn_vals,
+ GIMP_PDB_CHANNEL, channel1_ID,
+ GIMP_PDB_CHANNEL, channel2_ID,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_INT32, offx,
+ GIMP_PDB_INT32, offy,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_channel_get_show_masked:
+ * @channel_ID: The channel.
+ *
+ * Get the composite method of the specified channel.
+ *
+ * This procedure returns the specified channel's composite method. If
+ * it is TRUE, then the channel is composited with the image so that
+ * masked regions are shown. Otherwise, selected regions are shown.
+ *
+ * Returns: The channel composite method.
+ **/
+gboolean
+gimp_channel_get_show_masked (gint32 channel_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean show_masked = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-channel-get-show-masked",
+ &nreturn_vals,
+ GIMP_PDB_CHANNEL, channel_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ show_masked = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return show_masked;
+}
+
+/**
+ * gimp_channel_set_show_masked:
+ * @channel_ID: The channel.
+ * @show_masked: The new channel composite method.
+ *
+ * Set the composite method of the specified channel.
+ *
+ * This procedure sets the specified channel's composite method. If it
+ * is TRUE, then the channel is composited with the image so that
+ * masked regions are shown. Otherwise, selected regions are shown.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_channel_set_show_masked (gint32 channel_ID,
+ gboolean show_masked)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-channel-set-show-masked",
+ &nreturn_vals,
+ GIMP_PDB_CHANNEL, channel_ID,
+ GIMP_PDB_INT32, show_masked,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_channel_get_opacity:
+ * @channel_ID: The channel.
+ *
+ * Get the opacity of the specified channel.
+ *
+ * This procedure returns the specified channel's opacity.
+ *
+ * Returns: The channel opacity.
+ **/
+gdouble
+gimp_channel_get_opacity (gint32 channel_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble opacity = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-channel-get-opacity",
+ &nreturn_vals,
+ GIMP_PDB_CHANNEL, channel_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ opacity = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return opacity;
+}
+
+/**
+ * gimp_channel_set_opacity:
+ * @channel_ID: The channel.
+ * @opacity: The new channel opacity.
+ *
+ * Set the opacity of the specified channel.
+ *
+ * This procedure sets the specified channel's opacity.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_channel_set_opacity (gint32 channel_ID,
+ gdouble opacity)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-channel-set-opacity",
+ &nreturn_vals,
+ GIMP_PDB_CHANNEL, channel_ID,
+ GIMP_PDB_FLOAT, opacity,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_channel_get_color:
+ * @channel_ID: The channel.
+ * @color: The channel compositing color.
+ *
+ * Get the compositing color of the specified channel.
+ *
+ * This procedure returns the specified channel's compositing color.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_channel_get_color (gint32 channel_ID,
+ GimpRGB *color)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-channel-get-color",
+ &nreturn_vals,
+ GIMP_PDB_CHANNEL, channel_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *color = return_vals[1].data.d_color;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_channel_set_color:
+ * @channel_ID: The channel.
+ * @color: The new channel compositing color.
+ *
+ * Set the compositing color of the specified channel.
+ *
+ * This procedure sets the specified channel's compositing color.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_channel_set_color (gint32 channel_ID,
+ const GimpRGB *color)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-channel-set-color",
+ &nreturn_vals,
+ GIMP_PDB_CHANNEL, channel_ID,
+ GIMP_PDB_COLOR, color,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpchannel_pdb.h b/libgimp/gimpchannel_pdb.h
new file mode 100644
index 0000000..84fa4af
--- /dev/null
+++ b/libgimp/gimpchannel_pdb.h
@@ -0,0 +1,64 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpchannel_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_CHANNEL_PDB_H__
+#define __GIMP_CHANNEL_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+G_GNUC_INTERNAL gint32 _gimp_channel_new (gint32 image_ID,
+ gint width,
+ gint height,
+ const gchar *name,
+ gdouble opacity,
+ const GimpRGB *color);
+gint32 gimp_channel_new_from_component (gint32 image_ID,
+ GimpChannelType component,
+ const gchar *name);
+gint32 gimp_channel_copy (gint32 channel_ID);
+gboolean gimp_channel_combine_masks (gint32 channel1_ID,
+ gint32 channel2_ID,
+ GimpChannelOps operation,
+ gint offx,
+ gint offy);
+gboolean gimp_channel_get_show_masked (gint32 channel_ID);
+gboolean gimp_channel_set_show_masked (gint32 channel_ID,
+ gboolean show_masked);
+gdouble gimp_channel_get_opacity (gint32 channel_ID);
+gboolean gimp_channel_set_opacity (gint32 channel_ID,
+ gdouble opacity);
+gboolean gimp_channel_get_color (gint32 channel_ID,
+ GimpRGB *color);
+gboolean gimp_channel_set_color (gint32 channel_ID,
+ const GimpRGB *color);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_CHANNEL_PDB_H__ */
diff --git a/libgimp/gimpcolor_pdb.c b/libgimp/gimpcolor_pdb.c
new file mode 100644
index 0000000..aea8572
--- /dev/null
+++ b/libgimp/gimpcolor_pdb.c
@@ -0,0 +1,611 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpcolor_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpcolor
+ * @title: gimpcolor
+ * @short_description: Functions for manipulating color.
+ *
+ * Functions for manipulating color, including curves and histograms.
+ **/
+
+
+/**
+ * gimp_brightness_contrast:
+ * @drawable_ID: The drawable.
+ * @brightness: Brightness adjustment.
+ * @contrast: Contrast adjustment.
+ *
+ * Deprecated: Use gimp_drawable_brightness_contrast() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_brightness_contrast (gint32 drawable_ID,
+ gint brightness,
+ gint contrast)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-brightness-contrast",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, brightness,
+ GIMP_PDB_INT32, contrast,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_levels:
+ * @drawable_ID: The drawable.
+ * @channel: The channel to modify.
+ * @low_input: Intensity of lowest input.
+ * @high_input: Intensity of highest input.
+ * @gamma: Gamma adjustment factor.
+ * @low_output: Intensity of lowest output.
+ * @high_output: Intensity of highest output.
+ *
+ * Deprecated: Use gimp_drawable_levels() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_levels (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint low_input,
+ gint high_input,
+ gdouble gamma,
+ gint low_output,
+ gint high_output)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-levels",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, channel,
+ GIMP_PDB_INT32, low_input,
+ GIMP_PDB_INT32, high_input,
+ GIMP_PDB_FLOAT, gamma,
+ GIMP_PDB_INT32, low_output,
+ GIMP_PDB_INT32, high_output,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_levels_auto:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_drawable_levels_stretch() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_levels_auto (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-levels-auto",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_levels_stretch:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_drawable_levels_stretch() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_levels_stretch (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-levels-stretch",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_posterize:
+ * @drawable_ID: The drawable.
+ * @levels: Levels of posterization.
+ *
+ * Deprecated: Use gimp_drawable_posterize() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_posterize (gint32 drawable_ID,
+ gint levels)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-posterize",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, levels,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_desaturate:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_drawable_desaturate() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_desaturate (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-desaturate",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_desaturate_full:
+ * @drawable_ID: The drawable.
+ * @desaturate_mode: The formula to use to desaturate.
+ *
+ * Deprecated: Use gimp_drawable_desaturate() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_desaturate_full (gint32 drawable_ID,
+ GimpDesaturateMode desaturate_mode)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-desaturate-full",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, desaturate_mode,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_equalize:
+ * @drawable_ID: The drawable.
+ * @mask_only: Equalization option.
+ *
+ * Deprecated: Use gimp_drawable_equalize() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_equalize (gint32 drawable_ID,
+ gboolean mask_only)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-equalize",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, mask_only,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_invert:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_drawable_invert() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_invert (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-invert",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_curves_spline:
+ * @drawable_ID: The drawable.
+ * @channel: The channel to modify.
+ * @num_points: The number of values in the control point array.
+ * @control_pts: The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y, ... }.
+ *
+ * Deprecated: Use gimp_drawable_curves_spline() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_curves_spline (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_points,
+ const guint8 *control_pts)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-curves-spline",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, channel,
+ GIMP_PDB_INT32, num_points,
+ GIMP_PDB_INT8ARRAY, control_pts,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_curves_explicit:
+ * @drawable_ID: The drawable.
+ * @channel: The channel to modify.
+ * @num_bytes: The number of bytes in the new curve (always 256).
+ * @curve: The explicit curve.
+ *
+ * Deprecated: Use gimp_drawable_curves_explicit() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_curves_explicit (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_bytes,
+ const guint8 *curve)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-curves-explicit",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, channel,
+ GIMP_PDB_INT32, num_bytes,
+ GIMP_PDB_INT8ARRAY, curve,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_color_balance:
+ * @drawable_ID: The drawable.
+ * @transfer_mode: Transfer mode.
+ * @preserve_lum: Preserve luminosity values at each pixel.
+ * @cyan_red: Cyan-Red color balance.
+ * @magenta_green: Magenta-Green color balance.
+ * @yellow_blue: Yellow-Blue color balance.
+ *
+ * Modify the color balance of the specified drawable.
+ *
+ * Modify the color balance of the specified drawable. There are three
+ * axis which can be modified: cyan-red, magenta-green, and
+ * yellow-blue. Negative values increase the amount of the former,
+ * positive values increase the amount of the latter. Color balance can
+ * be controlled with the 'transfer_mode' setting, which allows
+ * shadows, mid-tones, and highlights in an image to be affected
+ * differently. The 'preserve-lum' parameter, if TRUE, ensures that the
+ * luminosity of each pixel remains fixed.
+ *
+ * Deprecated: Use gimp_drawable_color_color_balance() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_color_balance (gint32 drawable_ID,
+ GimpTransferMode transfer_mode,
+ gboolean preserve_lum,
+ gdouble cyan_red,
+ gdouble magenta_green,
+ gdouble yellow_blue)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-color-balance",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, transfer_mode,
+ GIMP_PDB_INT32, preserve_lum,
+ GIMP_PDB_FLOAT, cyan_red,
+ GIMP_PDB_FLOAT, magenta_green,
+ GIMP_PDB_FLOAT, yellow_blue,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_colorize:
+ * @drawable_ID: The drawable.
+ * @hue: Hue in degrees.
+ * @saturation: Saturation in percent.
+ * @lightness: Lightness in percent.
+ *
+ * Deprecated: Use gimp_drawable_colorize_hsl() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_colorize (gint32 drawable_ID,
+ gdouble hue,
+ gdouble saturation,
+ gdouble lightness)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-colorize",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, hue,
+ GIMP_PDB_FLOAT, saturation,
+ GIMP_PDB_FLOAT, lightness,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_histogram:
+ * @drawable_ID: The drawable.
+ * @channel: The channel to modify.
+ * @start_range: Start of the intensity measurement range.
+ * @end_range: End of the intensity measurement range.
+ * @mean: Mean intensity value.
+ * @std_dev: Standard deviation of intensity values.
+ * @median: Median intensity value.
+ * @pixels: Alpha-weighted pixel count for entire image.
+ * @count: Alpha-weighted pixel count for range.
+ * @percentile: Percentile that range falls under.
+ *
+ * Deprecated: Use gimp_drawable_histogram() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_histogram (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint start_range,
+ gint end_range,
+ gdouble *mean,
+ gdouble *std_dev,
+ gdouble *median,
+ gdouble *pixels,
+ gdouble *count,
+ gdouble *percentile)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-histogram",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, channel,
+ GIMP_PDB_INT32, start_range,
+ GIMP_PDB_INT32, end_range,
+ GIMP_PDB_END);
+
+ *mean = 0.0;
+ *std_dev = 0.0;
+ *median = 0.0;
+ *pixels = 0.0;
+ *count = 0.0;
+ *percentile = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *mean = return_vals[1].data.d_float;
+ *std_dev = return_vals[2].data.d_float;
+ *median = return_vals[3].data.d_float;
+ *pixels = return_vals[4].data.d_float;
+ *count = return_vals[5].data.d_float;
+ *percentile = return_vals[6].data.d_float;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_hue_saturation:
+ * @drawable_ID: The drawable.
+ * @hue_range: Range of affected hues.
+ * @hue_offset: Hue offset in degrees.
+ * @lightness: Lightness modification.
+ * @saturation: Saturation modification.
+ *
+ * Deprecated: Use gimp_drawable_hue_saturation() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_hue_saturation (gint32 drawable_ID,
+ GimpHueRange hue_range,
+ gdouble hue_offset,
+ gdouble lightness,
+ gdouble saturation)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-hue-saturation",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, hue_range,
+ GIMP_PDB_FLOAT, hue_offset,
+ GIMP_PDB_FLOAT, lightness,
+ GIMP_PDB_FLOAT, saturation,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_threshold:
+ * @drawable_ID: The drawable.
+ * @low_threshold: The low threshold value.
+ * @high_threshold: The high threshold value.
+ *
+ * Deprecated: Use gimp_drawable_threshold() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_threshold (gint32 drawable_ID,
+ gint low_threshold,
+ gint high_threshold)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-threshold",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, low_threshold,
+ GIMP_PDB_INT32, high_threshold,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpcolor_pdb.h b/libgimp/gimpcolor_pdb.h
new file mode 100644
index 0000000..ef53d9e
--- /dev/null
+++ b/libgimp/gimpcolor_pdb.h
@@ -0,0 +1,111 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpcolor_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_COLOR_PDB_H__
+#define __GIMP_COLOR_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+GIMP_DEPRECATED_FOR(gimp_drawable_brightness_contrast)
+gboolean gimp_brightness_contrast (gint32 drawable_ID,
+ gint brightness,
+ gint contrast);
+GIMP_DEPRECATED_FOR(gimp_drawable_levels)
+gboolean gimp_levels (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint low_input,
+ gint high_input,
+ gdouble gamma,
+ gint low_output,
+ gint high_output);
+GIMP_DEPRECATED_FOR(gimp_drawable_levels_stretch)
+gboolean gimp_levels_auto (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_drawable_levels_stretch)
+gboolean gimp_levels_stretch (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_drawable_posterize)
+gboolean gimp_posterize (gint32 drawable_ID,
+ gint levels);
+GIMP_DEPRECATED_FOR(gimp_drawable_desaturate)
+gboolean gimp_desaturate (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_drawable_desaturate)
+gboolean gimp_desaturate_full (gint32 drawable_ID,
+ GimpDesaturateMode desaturate_mode);
+GIMP_DEPRECATED_FOR(gimp_drawable_equalize)
+gboolean gimp_equalize (gint32 drawable_ID,
+ gboolean mask_only);
+GIMP_DEPRECATED_FOR(gimp_drawable_invert)
+gboolean gimp_invert (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_drawable_curves_spline)
+gboolean gimp_curves_spline (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_points,
+ const guint8 *control_pts);
+GIMP_DEPRECATED_FOR(gimp_drawable_curves_explicit)
+gboolean gimp_curves_explicit (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_bytes,
+ const guint8 *curve);
+GIMP_DEPRECATED_FOR(gimp_drawable_color_color_balance)
+gboolean gimp_color_balance (gint32 drawable_ID,
+ GimpTransferMode transfer_mode,
+ gboolean preserve_lum,
+ gdouble cyan_red,
+ gdouble magenta_green,
+ gdouble yellow_blue);
+GIMP_DEPRECATED_FOR(gimp_drawable_colorize_hsl)
+gboolean gimp_colorize (gint32 drawable_ID,
+ gdouble hue,
+ gdouble saturation,
+ gdouble lightness);
+GIMP_DEPRECATED_FOR(gimp_drawable_histogram)
+gboolean gimp_histogram (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint start_range,
+ gint end_range,
+ gdouble *mean,
+ gdouble *std_dev,
+ gdouble *median,
+ gdouble *pixels,
+ gdouble *count,
+ gdouble *percentile);
+GIMP_DEPRECATED_FOR(gimp_drawable_hue_saturation)
+gboolean gimp_hue_saturation (gint32 drawable_ID,
+ GimpHueRange hue_range,
+ gdouble hue_offset,
+ gdouble lightness,
+ gdouble saturation);
+GIMP_DEPRECATED_FOR(gimp_drawable_threshold)
+gboolean gimp_threshold (gint32 drawable_ID,
+ gint low_threshold,
+ gint high_threshold);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_COLOR_PDB_H__ */
diff --git a/libgimp/gimpcontext_pdb.c b/libgimp/gimpcontext_pdb.c
new file mode 100644
index 0000000..92f71e2
--- /dev/null
+++ b/libgimp/gimpcontext_pdb.c
@@ -0,0 +1,3812 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpcontext_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpcontext
+ * @title: gimpcontext
+ * @short_description: Functions to manipulate a plug-in's context.
+ *
+ * Functions to manipulate a plug-in's context.
+ **/
+
+
+/**
+ * gimp_context_push:
+ *
+ * Pushes a context to the top of the plug-in's context stack.
+ *
+ * This procedure creates a new context by copying the current context.
+ * This copy becomes the new current context for the calling plug-in
+ * until it is popped again using gimp_context_pop().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_push (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-push",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_pop:
+ *
+ * Pops the topmost context from the plug-in's context stack.
+ *
+ * This procedure removes the topmost context from the plug-in's
+ * context stack. The context that was active before the corresponding
+ * call to gimp_context_push() becomes the new current context of the
+ * plug-in.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_pop (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-pop",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_defaults:
+ *
+ * Reset context settings to their default values.
+ *
+ * This procedure resets context settings used by various procedures to
+ * their default value. This procedure will usually be called after a
+ * context push so that a script which calls procedures affected by
+ * context settings will not be affected by changes in the global
+ * context.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_defaults (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-defaults",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_list_paint_methods:
+ * @num_paint_methods: The number of the available paint methods.
+ * @paint_methods: The names of the available paint methods.
+ *
+ * Lists the available paint methods.
+ *
+ * This procedure lists the names of the available paint methods. Any
+ * of the results can be used for gimp_context_set_paint_method().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_context_list_paint_methods (gint *num_paint_methods,
+ gchar ***paint_methods)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-context-list-paint-methods",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ *num_paint_methods = 0;
+ *paint_methods = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *num_paint_methods = return_vals[1].data.d_int32;
+ if (*num_paint_methods > 0)
+ {
+ *paint_methods = g_new0 (gchar *, *num_paint_methods + 1);
+ for (i = 0; i < *num_paint_methods; i++)
+ (*paint_methods)[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_paint_method:
+ *
+ * Retrieve the currently active paint method.
+ *
+ * This procedure returns the name of the currently active paint
+ * method.
+ *
+ * Returns: The name of the active paint method.
+ *
+ * Since: 2.4
+ **/
+gchar *
+gimp_context_get_paint_method (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-paint-method",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_context_set_paint_method:
+ * @name: The name of the paint method.
+ *
+ * Set the specified paint method as the active paint method.
+ *
+ * This procedure allows the active paint method to be set by
+ * specifying its name. The name is simply a string which corresponds
+ * to one of the names of the available paint methods. If there is no
+ * matching method found, this procedure will return an error.
+ * Otherwise, the specified method becomes active and will be used in
+ * all subsequent paint operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_context_set_paint_method (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-paint-method",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_stroke_method:
+ *
+ * Retrieve the currently active stroke method.
+ *
+ * This procedure returns the currently active stroke method.
+ *
+ * Returns: The active stroke method.
+ *
+ * Since: 2.10
+ **/
+GimpStrokeMethod
+gimp_context_get_stroke_method (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpStrokeMethod stroke_method = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-stroke-method",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ stroke_method = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return stroke_method;
+}
+
+/**
+ * gimp_context_set_stroke_method:
+ * @stroke_method: The new stroke method.
+ *
+ * Set the specified stroke method as the active stroke method.
+ *
+ * This procedure set the specified stroke method as the active stroke
+ * method. The new method will be used in all subsequent stroke
+ * operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_stroke_method (GimpStrokeMethod stroke_method)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-stroke-method",
+ &nreturn_vals,
+ GIMP_PDB_INT32, stroke_method,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_foreground:
+ * @foreground: The foreground color.
+ *
+ * Get the current GIMP foreground color.
+ *
+ * This procedure returns the current GIMP foreground color. The
+ * foreground color is used in a variety of tools such as paint tools,
+ * blending, and bucket fill.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_get_foreground (GimpRGB *foreground)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-foreground",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *foreground = return_vals[1].data.d_color;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_foreground:
+ * @foreground: The foreground color.
+ *
+ * Set the current GIMP foreground color.
+ *
+ * This procedure sets the current GIMP foreground color. After this is
+ * set, operations which use foreground such as paint tools, blending,
+ * and bucket fill will use the new value.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_set_foreground (const GimpRGB *foreground)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-foreground",
+ &nreturn_vals,
+ GIMP_PDB_COLOR, foreground,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_background:
+ * @background: The background color.
+ *
+ * Get the current GIMP background color.
+ *
+ * This procedure returns the current GIMP background color. The
+ * background color is used in a variety of tools such as blending,
+ * erasing (with non-alpha images), and image filling.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_get_background (GimpRGB *background)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-background",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *background = return_vals[1].data.d_color;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_background:
+ * @background: The background color.
+ *
+ * Set the current GIMP background color.
+ *
+ * This procedure sets the current GIMP background color. After this is
+ * set, operations which use background such as blending, filling
+ * images, clearing, and erasing (in non-alpha images) will use the new
+ * value.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_set_background (const GimpRGB *background)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-background",
+ &nreturn_vals,
+ GIMP_PDB_COLOR, background,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_default_colors:
+ *
+ * Set the current GIMP foreground and background colors to black and
+ * white.
+ *
+ * This procedure sets the current GIMP foreground and background
+ * colors to their initial default values, black and white.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_set_default_colors (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-default-colors",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_swap_colors:
+ *
+ * Swap the current GIMP foreground and background colors.
+ *
+ * This procedure swaps the current GIMP foreground and background
+ * colors, so that the new foreground color becomes the old background
+ * color and vice versa.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_swap_colors (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-swap-colors",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_opacity:
+ *
+ * Get the opacity.
+ *
+ * This procedure returns the opacity setting. The return value is a
+ * floating point number between 0 and 100.
+ *
+ * Returns: The opacity.
+ *
+ * Since: 2.2
+ **/
+gdouble
+gimp_context_get_opacity (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble opacity = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-opacity",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ opacity = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return opacity;
+}
+
+/**
+ * gimp_context_set_opacity:
+ * @opacity: The opacity.
+ *
+ * Set the opacity.
+ *
+ * This procedure modifies the opacity setting. The value should be a
+ * floating point number between 0 and 100.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_set_opacity (gdouble opacity)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-opacity",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, opacity,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_paint_mode:
+ *
+ * Get the paint mode.
+ *
+ * This procedure returns the paint-mode setting. The return value is
+ * an integer which corresponds to the values listed in the argument
+ * description.
+ *
+ * Returns: The paint mode.
+ *
+ * Since: 2.2
+ **/
+GimpLayerMode
+gimp_context_get_paint_mode (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpLayerMode paint_mode = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-paint-mode",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ paint_mode = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return paint_mode;
+}
+
+/**
+ * gimp_context_set_paint_mode:
+ * @paint_mode: The paint mode.
+ *
+ * Set the paint mode.
+ *
+ * This procedure modifies the paint_mode setting.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_set_paint_mode (GimpLayerMode paint_mode)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-paint-mode",
+ &nreturn_vals,
+ GIMP_PDB_INT32, paint_mode,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_line_width:
+ *
+ * Get the line width setting.
+ *
+ * This procedure returns the line width setting.
+ *
+ * Returns: The line width setting.
+ *
+ * Since: 2.10
+ **/
+gdouble
+gimp_context_get_line_width (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble line_width = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-line-width",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ line_width = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return line_width;
+}
+
+/**
+ * gimp_context_set_line_width:
+ * @line_width: The line width setting.
+ *
+ * Set the line width setting.
+ *
+ * This procedure modifies the line width setting for stroking lines.
+ *
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection(),
+ * gimp_drawable_edit_stroke_item().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_width (gdouble line_width)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-line-width",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, line_width,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_line_width_unit:
+ *
+ * Get the line width unit setting.
+ *
+ * This procedure returns the line width unit setting.
+ *
+ * Returns: The line width unit setting.
+ *
+ * Since: 2.10
+ **/
+GimpUnit
+gimp_context_get_line_width_unit (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpUnit line_width_unit = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-line-width-unit",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ line_width_unit = return_vals[1].data.d_unit;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return line_width_unit;
+}
+
+/**
+ * gimp_context_set_line_width_unit:
+ * @line_width_unit: The line width setting unit.
+ *
+ * Set the line width unit setting.
+ *
+ * This procedure modifies the line width unit setting for stroking
+ * lines.
+ *
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection(),
+ * gimp_drawable_edit_stroke_item().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_width_unit (GimpUnit line_width_unit)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-line-width-unit",
+ &nreturn_vals,
+ GIMP_PDB_INT32, line_width_unit,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_line_cap_style:
+ *
+ * Get the line cap style setting.
+ *
+ * This procedure returns the line cap style setting.
+ *
+ * Returns: The line cap style setting.
+ *
+ * Since: 2.10
+ **/
+GimpCapStyle
+gimp_context_get_line_cap_style (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpCapStyle cap_style = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-line-cap-style",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ cap_style = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return cap_style;
+}
+
+/**
+ * gimp_context_set_line_cap_style:
+ * @cap_style: The line cap style setting.
+ *
+ * Set the line cap style setting.
+ *
+ * This procedure modifies the line cap style setting for stroking
+ * lines.
+ *
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection(),
+ * gimp_drawable_edit_stroke_item().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_cap_style (GimpCapStyle cap_style)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-line-cap-style",
+ &nreturn_vals,
+ GIMP_PDB_INT32, cap_style,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_line_join_style:
+ *
+ * Get the line join style setting.
+ *
+ * This procedure returns the line join style setting.
+ *
+ * Returns: The line join style setting.
+ *
+ * Since: 2.10
+ **/
+GimpJoinStyle
+gimp_context_get_line_join_style (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpJoinStyle join_style = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-line-join-style",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ join_style = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return join_style;
+}
+
+/**
+ * gimp_context_set_line_join_style:
+ * @join_style: The line join style setting.
+ *
+ * Set the line join style setting.
+ *
+ * This procedure modifies the line join style setting for stroking
+ * lines.
+ *
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection(),
+ * gimp_drawable_edit_stroke_item().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_join_style (GimpJoinStyle join_style)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-line-join-style",
+ &nreturn_vals,
+ GIMP_PDB_INT32, join_style,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_line_miter_limit:
+ *
+ * Get the line miter limit setting.
+ *
+ * This procedure returns the line miter limit setting.
+ *
+ * Returns: The line miter limit setting.
+ *
+ * Since: 2.10
+ **/
+gdouble
+gimp_context_get_line_miter_limit (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble miter_limit = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-line-miter-limit",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ miter_limit = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return miter_limit;
+}
+
+/**
+ * gimp_context_set_line_miter_limit:
+ * @miter_limit: The line miter limit setting.
+ *
+ * Set the line miter limit setting.
+ *
+ * This procedure modifies the line miter limit setting for stroking
+ * lines.
+ * A mitered join is converted to a bevelled join if the miter would
+ * extend to a distance of more than (miter-limit * line-width) from
+ * the actual join point.
+ *
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection(),
+ * gimp_drawable_edit_stroke_item().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_miter_limit (gdouble miter_limit)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-line-miter-limit",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, miter_limit,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_line_dash_offset:
+ *
+ * Get the line dash offset setting.
+ *
+ * This procedure returns the line dash offset setting.
+ *
+ * Returns: The line dash offset setting.
+ *
+ * Since: 2.10
+ **/
+gdouble
+gimp_context_get_line_dash_offset (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble dash_offset = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-line-dash-offset",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ dash_offset = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return dash_offset;
+}
+
+/**
+ * gimp_context_set_line_dash_offset:
+ * @dash_offset: The line dash offset setting.
+ *
+ * Set the line dash offset setting.
+ *
+ * This procedure modifies the line dash offset setting for stroking
+ * lines.
+ *
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection(),
+ * gimp_drawable_edit_stroke_item().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_dash_offset (gdouble dash_offset)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-line-dash-offset",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, dash_offset,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_line_dash_pattern:
+ * @num_dashes: The number of dashes in the dash_pattern array.
+ * @dashes: The line dash pattern setting.
+ *
+ * Get the line dash pattern setting.
+ *
+ * This procedure returns the line dash pattern setting.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_get_line_dash_pattern (gint *num_dashes,
+ gdouble **dashes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-line-dash-pattern",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ *num_dashes = 0;
+ *dashes = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *num_dashes = return_vals[1].data.d_int32;
+ *dashes = g_new (gdouble, *num_dashes);
+ memcpy (*dashes,
+ return_vals[2].data.d_floatarray,
+ *num_dashes * sizeof (gdouble));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_line_dash_pattern:
+ * @num_dashes: The number of dashes in the dash_pattern array.
+ * @dashes: The line dash pattern setting.
+ *
+ * Set the line dash pattern setting.
+ *
+ * This procedure modifies the line dash pattern setting for stroking
+ * lines.
+ *
+ * The unit of the dash pattern segments is the actual line width used
+ * for the stroke operation, in other words a segment length of 1.0
+ * results in a square segment shape (or gap shape).
+ *
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection_(),
+ * gimp_drawable_edit_stroke_item().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_dash_pattern (gint num_dashes,
+ const gdouble *dashes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-line-dash-pattern",
+ &nreturn_vals,
+ GIMP_PDB_INT32, num_dashes,
+ GIMP_PDB_FLOATARRAY, dashes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_brush:
+ *
+ * Retrieve the currently active brush.
+ *
+ * This procedure returns the name of the currently active brush. All
+ * paint operations and stroke operations use this brush to control the
+ * application of paint to the image.
+ *
+ * Returns: The name of the active brush.
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_context_get_brush (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-brush",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_context_set_brush:
+ * @name: The name of the brush.
+ *
+ * Set the specified brush as the active brush.
+ *
+ * This procedure allows the active brush to be set by specifying its
+ * name. The name is simply a string which corresponds to one of the
+ * names of the installed brushes. If there is no matching brush found,
+ * this procedure will return an error. Otherwise, the specified brush
+ * becomes active and will be used in all subsequent paint operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_set_brush (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-brush",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_brush_size:
+ *
+ * Get brush size in pixels.
+ *
+ * Get the brush size in pixels for brush based paint tools.
+ *
+ * Returns: Brush size in pixels.
+ *
+ * Since: 2.8
+ **/
+gdouble
+gimp_context_get_brush_size (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble size = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-brush-size",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ size = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return size;
+}
+
+/**
+ * gimp_context_set_brush_size:
+ * @size: Brush size in pixels.
+ *
+ * Set brush size in pixels.
+ *
+ * Set the brush size in pixels for brush based paint tools.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_brush_size (gdouble size)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-brush-size",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, size,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_brush_default_size:
+ *
+ * Set brush size to its default.
+ *
+ * Set the brush size to the default (max of width and height) for
+ * paintbrush, airbrush, or pencil tools.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_brush_default_size (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-brush-default-size",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_brush_aspect_ratio:
+ *
+ * Get brush aspect ratio.
+ *
+ * Set the aspect ratio for brush based paint tools.
+ *
+ * Returns: Aspect ratio.
+ *
+ * Since: 2.8
+ **/
+gdouble
+gimp_context_get_brush_aspect_ratio (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble aspect = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-brush-aspect-ratio",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ aspect = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return aspect;
+}
+
+/**
+ * gimp_context_set_brush_aspect_ratio:
+ * @aspect: Aspect ratio.
+ *
+ * Set brush aspect ratio.
+ *
+ * Set the aspect ratio for brush based paint tools.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_brush_aspect_ratio (gdouble aspect)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-brush-aspect-ratio",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, aspect,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_brush_angle:
+ *
+ * Get brush angle in degrees.
+ *
+ * Set the angle in degrees for brush based paint tools.
+ *
+ * Returns: Angle in degrees.
+ *
+ * Since: 2.8
+ **/
+gdouble
+gimp_context_get_brush_angle (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble angle = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-brush-angle",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ angle = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return angle;
+}
+
+/**
+ * gimp_context_set_brush_angle:
+ * @angle: Angle in degrees.
+ *
+ * Set brush angle in degrees.
+ *
+ * Set the angle in degrees for brush based paint tools.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_brush_angle (gdouble angle)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-brush-angle",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, angle,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_brush_spacing:
+ *
+ * Get brush spacing as percent of size.
+ *
+ * Get the brush spacing as percent of size for brush based paint
+ * tools.
+ *
+ * Returns: Brush spacing as fraction of size.
+ *
+ * Since: 2.10
+ **/
+gdouble
+gimp_context_get_brush_spacing (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble spacing = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-brush-spacing",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ spacing = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return spacing;
+}
+
+/**
+ * gimp_context_set_brush_spacing:
+ * @spacing: Brush spacing as fraction of size.
+ *
+ * Set brush spacing as percent of size.
+ *
+ * Set the brush spacing as percent of size for brush based paint
+ * tools.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_brush_spacing (gdouble spacing)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-brush-spacing",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, spacing,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_brush_default_spacing:
+ *
+ * Set brush spacing to its default.
+ *
+ * Set the brush spacing to the default for paintbrush, airbrush, or
+ * pencil tools.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_brush_default_spacing (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-brush-default-spacing",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_brush_hardness:
+ *
+ * Get brush hardness in paint options.
+ *
+ * Get the brush hardness for brush based paint tools.
+ *
+ * Returns: Brush hardness.
+ *
+ * Since: 2.10
+ **/
+gdouble
+gimp_context_get_brush_hardness (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble hardness = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-brush-hardness",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ hardness = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return hardness;
+}
+
+/**
+ * gimp_context_set_brush_hardness:
+ * @hardness: Brush hardness.
+ *
+ * Set brush hardness.
+ *
+ * Set the brush hardness for brush based paint tools.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_brush_hardness (gdouble hardness)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-brush-hardness",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, hardness,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_brush_default_hardness:
+ *
+ * Set brush spacing to its default.
+ *
+ * Set the brush spacing to the default for paintbrush, airbrush, or
+ * pencil tools.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_brush_default_hardness (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-brush-default-hardness",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_brush_force:
+ *
+ * Get brush force in paint options.
+ *
+ * Get the brush application force for brush based paint tools.
+ *
+ * Returns: Brush application force.
+ *
+ * Since: 2.10
+ **/
+gdouble
+gimp_context_get_brush_force (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble force = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-brush-force",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ force = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return force;
+}
+
+/**
+ * gimp_context_set_brush_force:
+ * @force: Brush application force.
+ *
+ * Set brush application force.
+ *
+ * Set the brush application force for brush based paint tools.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_brush_force (gdouble force)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-brush-force",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, force,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_dynamics:
+ *
+ * Retrieve the currently active paint dynamics.
+ *
+ * This procedure returns the name of the currently active paint
+ * dynamics. All paint operations and stroke operations use this paint
+ * dynamics to control the application of paint to the image.
+ *
+ * Returns: The name of the active paint dynamics.
+ *
+ * Since: 2.8
+ **/
+gchar *
+gimp_context_get_dynamics (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-dynamics",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_context_set_dynamics:
+ * @name: The name of the paint dynamics.
+ *
+ * Set the specified paint dynamics as the active paint dynamics.
+ *
+ * This procedure allows the active paint dynamics to be set by
+ * specifying its name. The name is simply a string which corresponds
+ * to one of the names of the installed paint dynamics. If there is no
+ * matching paint dynamics found, this procedure will return an error.
+ * Otherwise, the specified paint dynamics becomes active and will be
+ * used in all subsequent paint operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_dynamics (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-dynamics",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_mypaint_brush:
+ *
+ * Retrieve the currently active MyPaint brush.
+ *
+ * This procedure returns the name of the currently active MyPaint
+ * brush.
+ *
+ * Returns: The name of the active MyPaint brush.
+ *
+ * Since: 2.10
+ **/
+gchar *
+gimp_context_get_mypaint_brush (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-mypaint-brush",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_context_set_mypaint_brush:
+ * @name: The name of the MyPaint brush.
+ *
+ * Set the specified MyPaint brush as the active MyPaint brush.
+ *
+ * This procedure allows the active MyPaint brush to be set by
+ * specifying its name. The name is simply a string which corresponds
+ * to one of the names of the installed MyPaint brushes. If there is no
+ * matching MyPaint brush found, this procedure will return an error.
+ * Otherwise, the specified MyPaint brush becomes active and will be
+ * used in all subsequent MyPaint paint operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_mypaint_brush (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-mypaint-brush",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_pattern:
+ *
+ * Retrieve the currently active pattern.
+ *
+ * This procedure returns name of the the currently active pattern. All
+ * clone and bucket-fill operations with patterns will use this pattern
+ * to control the application of paint to the image.
+ *
+ * Returns: The name of the active pattern.
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_context_get_pattern (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-pattern",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_context_set_pattern:
+ * @name: The name of the pattern.
+ *
+ * Set the specified pattern as the active pattern.
+ *
+ * This procedure allows the active pattern to be set by specifying its
+ * name. The name is simply a string which corresponds to one of the
+ * names of the installed patterns. If there is no matching pattern
+ * found, this procedure will return an error. Otherwise, the specified
+ * pattern becomes active and will be used in all subsequent paint
+ * operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_set_pattern (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-pattern",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_gradient:
+ *
+ * Retrieve the currently active gradient.
+ *
+ * This procedure returns the name of the currently active gradient.
+ *
+ * Returns: The name of the active gradient.
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_context_get_gradient (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-gradient",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_context_set_gradient:
+ * @name: The name of the gradient.
+ *
+ * Sets the specified gradient as the active gradient.
+ *
+ * This procedure lets you set the specified gradient as the active or
+ * \"current\" one. The name is simply a string which corresponds to
+ * one of the loaded gradients. If no matching gradient is found, this
+ * procedure will return an error. Otherwise, the specified gradient
+ * will become active and will be used for subsequent custom gradient
+ * operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_set_gradient (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-gradient",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_gradient_fg_bg_rgb:
+ *
+ * Sets the built-in FG-BG RGB gradient as the active gradient.
+ *
+ * This procedure sets the built-in FG-BG RGB gradient as the active
+ * gradient. The gradient will be used for subsequent gradient
+ * operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_fg_bg_rgb (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-bg-rgb",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_gradient_fg_bg_hsv_cw:
+ *
+ * Sets the built-in FG-BG HSV (cw) gradient as the active gradient.
+ *
+ * This procedure sets the built-in FG-BG HSV (cw) gradient as the
+ * active gradient. The gradient will be used for subsequent gradient
+ * operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_fg_bg_hsv_cw (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-bg-hsv-cw",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_gradient_fg_bg_hsv_ccw:
+ *
+ * Sets the built-in FG-BG HSV (ccw) gradient as the active gradient.
+ *
+ * This procedure sets the built-in FG-BG HSV (ccw) gradient as the
+ * active gradient. The gradient will be used for subsequent gradient
+ * operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_fg_bg_hsv_ccw (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-bg-hsv-ccw",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_gradient_fg_transparent:
+ *
+ * Sets the built-in FG-Transparent gradient as the active gradient.
+ *
+ * This procedure sets the built-in FG-Transparent gradient as the
+ * active gradient. The gradient will be used for subsequent gradient
+ * operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_fg_transparent (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-transparent",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_gradient_blend_color_space:
+ *
+ * Get the gradient blend color space.
+ *
+ * Get the gradient blend color space for paint tools and the gradient
+ * tool.
+ *
+ * Returns: Color blend space.
+ *
+ * Since: 2.10
+ **/
+GimpGradientBlendColorSpace
+gimp_context_get_gradient_blend_color_space (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpGradientBlendColorSpace blend_color_space = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-gradient-blend-color-space",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ blend_color_space = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return blend_color_space;
+}
+
+/**
+ * gimp_context_set_gradient_blend_color_space:
+ * @blend_color_space: Blend color space.
+ *
+ * Set the gradient blend color space.
+ *
+ * Set the gradient blend color space for paint tools and the gradient
+ * tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_blend_color_space (GimpGradientBlendColorSpace blend_color_space)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-gradient-blend-color-space",
+ &nreturn_vals,
+ GIMP_PDB_INT32, blend_color_space,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_gradient_repeat_mode:
+ *
+ * Get the gradient repeat mode.
+ *
+ * Get the gradient repeat mode for paint tools and the gradient tool.
+ *
+ * Returns: Repeat mode.
+ *
+ * Since: 2.10
+ **/
+GimpRepeatMode
+gimp_context_get_gradient_repeat_mode (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpRepeatMode repeat_mode = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-gradient-repeat-mode",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ repeat_mode = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return repeat_mode;
+}
+
+/**
+ * gimp_context_set_gradient_repeat_mode:
+ * @repeat_mode: Repeat mode.
+ *
+ * Set the gradient repeat mode.
+ *
+ * Set the gradient repeat mode for paint tools and the gradient tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_repeat_mode (GimpRepeatMode repeat_mode)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-gradient-repeat-mode",
+ &nreturn_vals,
+ GIMP_PDB_INT32, repeat_mode,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_gradient_reverse:
+ *
+ * Get the gradient reverse setting.
+ *
+ * Get the gradient reverse setting for paint tools and the gradient
+ * tool.
+ *
+ * Returns: Reverse.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_get_gradient_reverse (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean reverse = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-gradient-reverse",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ reverse = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return reverse;
+}
+
+/**
+ * gimp_context_set_gradient_reverse:
+ * @reverse: Reverse.
+ *
+ * Set the gradient reverse setting.
+ *
+ * Set the gradient reverse setting for paint tools and the gradient
+ * tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_reverse (gboolean reverse)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-gradient-reverse",
+ &nreturn_vals,
+ GIMP_PDB_INT32, reverse,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_palette:
+ *
+ * Retrieve the currently active palette.
+ *
+ * This procedure returns the name of the the currently active palette.
+ *
+ * Returns: The name of the active palette.
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_context_get_palette (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-palette",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_context_set_palette:
+ * @name: The name of the palette.
+ *
+ * Set the specified palette as the active palette.
+ *
+ * This procedure allows the active palette to be set by specifying its
+ * name. The name is simply a string which corresponds to one of the
+ * names of the installed palettes. If no matching palette is found,
+ * this procedure will return an error. Otherwise, the specified
+ * palette becomes active and will be used in all subsequent palette
+ * operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_set_palette (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-palette",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_font:
+ *
+ * Retrieve the currently active font.
+ *
+ * This procedure returns the name of the currently active font.
+ *
+ * Returns: The name of the active font.
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_context_get_font (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-font",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_context_set_font:
+ * @name: The name of the font.
+ *
+ * Set the specified font as the active font.
+ *
+ * This procedure allows the active font to be set by specifying its
+ * name. The name is simply a string which corresponds to one of the
+ * names of the installed fonts. If no matching font is found, this
+ * procedure will return an error. Otherwise, the specified font
+ * becomes active and will be used in all subsequent font operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_context_set_font (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-font",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_antialias:
+ *
+ * Get the antialias setting.
+ *
+ * This procedure returns the antialias setting.
+ *
+ * Returns: The antialias setting.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_get_antialias (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean antialias = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-antialias",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ antialias = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return antialias;
+}
+
+/**
+ * gimp_context_set_antialias:
+ * @antialias: The antialias setting.
+ *
+ * Set the antialias setting.
+ *
+ * This procedure modifies the antialias setting. If antialiasing is
+ * turned on, the edges of selected region will contain intermediate
+ * values which give the appearance of a sharper, less pixelized edge.
+ * This should be set as TRUE most of the time unless a binary-only
+ * selection is wanted.
+ *
+ * This setting affects the following procedures:
+ * gimp_image_select_color(), gimp_image_select_contiguous_color(),
+ * gimp_image_select_round_rectangle(), gimp_image_select_ellipse(),
+ * gimp_image_select_polygon(), gimp_image_select_item(),
+ * gimp_drawable_edit_bucket_fill(), gimp_drawable_edit_stroke_item(),
+ * gimp_drawable_edit_stroke_selection().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_antialias (gboolean antialias)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-antialias",
+ &nreturn_vals,
+ GIMP_PDB_INT32, antialias,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_feather:
+ *
+ * Get the feather setting.
+ *
+ * This procedure returns the feather setting.
+ *
+ * Returns: The feather setting.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_get_feather (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean feather = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-feather",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ feather = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return feather;
+}
+
+/**
+ * gimp_context_set_feather:
+ * @feather: The feather setting.
+ *
+ * Set the feather setting.
+ *
+ * This procedure modifies the feather setting. If the feather option
+ * is enabled, selections will be blurred before combining. The blur is
+ * a gaussian blur; its radii can be controlled using
+ * gimp_context_set_feather_radius().
+ *
+ * This setting affects the following procedures:
+ * gimp_image_select_color(), gimp_image_select_contiguous_color(),
+ * gimp_image_select_rectangle(), gimp_image_select_round_rectangle(),
+ * gimp_image_select_ellipse(), gimp_image_select_polygon(),
+ * gimp_image_select_item().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_feather (gboolean feather)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-feather",
+ &nreturn_vals,
+ GIMP_PDB_INT32, feather,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_feather_radius:
+ * @feather_radius_x: The horizontal feather radius.
+ * @feather_radius_y: The vertical feather radius.
+ *
+ * Get the feather radius setting.
+ *
+ * This procedure returns the feather radius setting.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_get_feather_radius (gdouble *feather_radius_x,
+ gdouble *feather_radius_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-feather-radius",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ *feather_radius_x = 0.0;
+ *feather_radius_y = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *feather_radius_x = return_vals[1].data.d_float;
+ *feather_radius_y = return_vals[2].data.d_float;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_feather_radius:
+ * @feather_radius_x: The horizontal feather radius.
+ * @feather_radius_y: The vertical feather radius.
+ *
+ * Set the feather radius setting.
+ *
+ * This procedure modifies the feather radius setting.
+ *
+ * This setting affects all procedures that are affected by
+ * gimp_context_set_feather().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_feather_radius (gdouble feather_radius_x,
+ gdouble feather_radius_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-feather-radius",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, feather_radius_x,
+ GIMP_PDB_FLOAT, feather_radius_y,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_sample_merged:
+ *
+ * Get the sample merged setting.
+ *
+ * This procedure returns the sample merged setting.
+ *
+ * Returns: The sample merged setting.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_get_sample_merged (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean sample_merged = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-sample-merged",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ sample_merged = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return sample_merged;
+}
+
+/**
+ * gimp_context_set_sample_merged:
+ * @sample_merged: The sample merged setting.
+ *
+ * Set the sample merged setting.
+ *
+ * This procedure modifies the sample merged setting. If an operation
+ * depends on the colors of the pixels present in a drawable, like when
+ * doing a seed fill, this setting controls whether the pixel data from
+ * the specified drawable is used ('sample-merged' is FALSE), or the
+ * pixel data from the composite image ('sample-merged' is TRUE. This
+ * is equivalent to sampling for colors after merging all visible
+ * layers).
+ *
+ * This setting affects the following procedures:
+ * gimp_image_select_color(), gimp_image_select_contiguous_color(),
+ * gimp_drawable_edit_bucket_fill().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_sample_merged (gboolean sample_merged)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-sample-merged",
+ &nreturn_vals,
+ GIMP_PDB_INT32, sample_merged,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_sample_criterion:
+ *
+ * Get the sample criterion setting.
+ *
+ * This procedure returns the sample criterion setting.
+ *
+ * Returns: The sample criterion setting.
+ *
+ * Since: 2.8
+ **/
+GimpSelectCriterion
+gimp_context_get_sample_criterion (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpSelectCriterion sample_criterion = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-sample-criterion",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ sample_criterion = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return sample_criterion;
+}
+
+/**
+ * gimp_context_set_sample_criterion:
+ * @sample_criterion: The sample criterion setting.
+ *
+ * Set the sample criterion setting.
+ *
+ * This procedure modifies the sample criterion setting. If an
+ * operation depends on the colors of the pixels present in a drawable,
+ * like when doing a seed fill, this setting controls how color
+ * similarity is determined. SELECT_CRITERION_COMPOSITE is the default
+ * value.
+ *
+ * This setting affects the following procedures:
+ * gimp_image_select_color(), gimp_image_select_contiguous_color(),
+ * gimp_drawable_edit_bucket_fill().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_sample_criterion (GimpSelectCriterion sample_criterion)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-sample-criterion",
+ &nreturn_vals,
+ GIMP_PDB_INT32, sample_criterion,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_sample_threshold:
+ *
+ * Get the sample threshold setting.
+ *
+ * This procedure returns the sample threshold setting.
+ *
+ * Returns: The sample threshold setting.
+ *
+ * Since: 2.8
+ **/
+gdouble
+gimp_context_get_sample_threshold (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble sample_threshold = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-sample-threshold",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ sample_threshold = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return sample_threshold;
+}
+
+/**
+ * gimp_context_set_sample_threshold:
+ * @sample_threshold: The sample threshold setting.
+ *
+ * Set the sample threshold setting.
+ *
+ * This procedure modifies the sample threshold setting. If an
+ * operation depends on the colors of the pixels present in a drawable,
+ * like when doing a seed fill, this setting controls what is
+ * \"sufficiently close\" to be considered a similar color. If the
+ * sample threshold has not been set explicitly, the default threshold
+ * set in gimprc will be used.
+ *
+ * This setting affects the following procedures:
+ * gimp_image_select_color(), gimp_image_select_contiguous_color(),
+ * gimp_drawable_edit_bucket_fill().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_sample_threshold (gdouble sample_threshold)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-sample-threshold",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, sample_threshold,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_sample_threshold_int:
+ *
+ * Get the sample threshold setting as an integer value.
+ *
+ * This procedure returns the sample threshold setting as an integer
+ * value. See gimp_context_get_sample_threshold().
+ *
+ * Returns: The sample threshold setting.
+ *
+ * Since: 2.8
+ **/
+gint
+gimp_context_get_sample_threshold_int (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint sample_threshold = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-sample-threshold-int",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ sample_threshold = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return sample_threshold;
+}
+
+/**
+ * gimp_context_set_sample_threshold_int:
+ * @sample_threshold: The sample threshold setting.
+ *
+ * Set the sample threshold setting as an integer value.
+ *
+ * This procedure modifies the sample threshold setting as an integer
+ * value. See gimp_context_set_sample_threshold().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_sample_threshold_int (gint sample_threshold)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-sample-threshold-int",
+ &nreturn_vals,
+ GIMP_PDB_INT32, sample_threshold,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_sample_transparent:
+ *
+ * Get the sample transparent setting.
+ *
+ * This procedure returns the sample transparent setting.
+ *
+ * Returns: The sample transparent setting.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_get_sample_transparent (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean sample_transparent = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-sample-transparent",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ sample_transparent = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return sample_transparent;
+}
+
+/**
+ * gimp_context_set_sample_transparent:
+ * @sample_transparent: The sample transparent setting.
+ *
+ * Set the sample transparent setting.
+ *
+ * This procedure modifies the sample transparent setting. If an
+ * operation depends on the colors of the pixels present in a drawable,
+ * like when doing a seed fill, this setting controls whether
+ * transparency is considered to be a unique selectable color. When
+ * this setting is TRUE, transparent areas can be selected or filled.
+ *
+ * This setting affects the following procedures:
+ * gimp_image_select_color(), gimp_image_select_contiguous_color(),
+ * gimp_drawable_edit_bucket_fill().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_sample_transparent (gboolean sample_transparent)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-sample-transparent",
+ &nreturn_vals,
+ GIMP_PDB_INT32, sample_transparent,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_diagonal_neighbors:
+ *
+ * Get the diagonal neighbors setting.
+ *
+ * This procedure returns the diagonal neighbors setting.
+ *
+ * Returns: The diagonal neighbors setting.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_get_diagonal_neighbors (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean diagonal_neighbors = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-diagonal-neighbors",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ diagonal_neighbors = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return diagonal_neighbors;
+}
+
+/**
+ * gimp_context_set_diagonal_neighbors:
+ * @diagonal_neighbors: The diagonal neighbors setting.
+ *
+ * Set the diagonal neighbors setting.
+ *
+ * This procedure modifies the diagonal neighbors setting. If the
+ * affected region of an operation is based on a seed point, like when
+ * doing a seed fill, then, when this setting is TRUE, all eight
+ * neighbors of each pixel are considered when calculating the affected
+ * region; in contrast, when this setting is FALSE, only the four
+ * orthogonal neighbors of each pixel are considered.
+ *
+ * This setting affects the following procedures:
+ * gimp_image_select_contiguous_color(),
+ * gimp_drawable_edit_bucket_fill().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_diagonal_neighbors (gboolean diagonal_neighbors)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-diagonal-neighbors",
+ &nreturn_vals,
+ GIMP_PDB_INT32, diagonal_neighbors,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_distance_metric:
+ *
+ * Get the distance metric used in some computations.
+ *
+ * This procedure returns the distance metric in the current context.
+ * See gimp_context_set_distance_metric() to know more about its usage.
+ *
+ * Returns: The distance metric.
+ *
+ * Since: 2.10
+ **/
+GeglDistanceMetric
+gimp_context_get_distance_metric (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GeglDistanceMetric metric = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-distance-metric",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ metric = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return metric;
+}
+
+/**
+ * gimp_context_set_distance_metric:
+ * @metric: The distance metric.
+ *
+ * Set the distance metric used in some computations.
+ *
+ * This procedure modifies the distance metric used in some
+ * computations, such as gimp_drawable_edit_gradient_fill(). In
+ * particular, it does not change the metric used in generic distance
+ * computation on canvas, as in the Measure tool.
+ *
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_gradient_fill().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_distance_metric (GeglDistanceMetric metric)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-distance-metric",
+ &nreturn_vals,
+ GIMP_PDB_INT32, metric,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_interpolation:
+ *
+ * Get the interpolation type.
+ *
+ * This procedure returns the interpolation setting. The return value
+ * is an integer which corresponds to the values listed in the argument
+ * description. If the interpolation has not been set explicitly by
+ * gimp_context_set_interpolation(), the default interpolation set in
+ * gimprc will be used.
+ *
+ * Returns: The interpolation type.
+ *
+ * Since: 2.8
+ **/
+GimpInterpolationType
+gimp_context_get_interpolation (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpInterpolationType interpolation = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-interpolation",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ interpolation = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return interpolation;
+}
+
+/**
+ * gimp_context_set_interpolation:
+ * @interpolation: The interpolation type.
+ *
+ * Set the interpolation type.
+ *
+ * This procedure modifies the interpolation setting.
+ *
+ * This setting affects affects the following procedures:
+ * gimp_item_transform_flip(), gimp_item_transform_perspective(),
+ * gimp_item_transform_rotate(), gimp_item_transform_scale(),
+ * gimp_item_transform_shear(), gimp_item_transform_2d(),
+ * gimp_item_transform_matrix(), gimp_image_scale(),
+ * gimp_layer_scale().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_interpolation (GimpInterpolationType interpolation)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-interpolation",
+ &nreturn_vals,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_transform_direction:
+ *
+ * Get the transform direction.
+ *
+ * This procedure returns the transform direction. The return value is
+ * an integer which corresponds to the values listed in the argument
+ * description.
+ *
+ * Returns: The transform direction.
+ *
+ * Since: 2.8
+ **/
+GimpTransformDirection
+gimp_context_get_transform_direction (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpTransformDirection transform_direction = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-transform-direction",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ transform_direction = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return transform_direction;
+}
+
+/**
+ * gimp_context_set_transform_direction:
+ * @transform_direction: The transform direction.
+ *
+ * Set the transform direction.
+ *
+ * This procedure modifies the transform direction setting.
+ *
+ * This setting affects affects the following procedures:
+ * gimp_item_transform_flip(), gimp_item_transform_perspective(),
+ * gimp_item_transform_rotate(), gimp_item_transform_scale(),
+ * gimp_item_transform_shear(), gimp_item_transform_2d(),
+ * gimp_item_transform_matrix().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_transform_direction (GimpTransformDirection transform_direction)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-transform-direction",
+ &nreturn_vals,
+ GIMP_PDB_INT32, transform_direction,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_transform_resize:
+ *
+ * Get the transform resize type.
+ *
+ * This procedure returns the transform resize setting. The return
+ * value is an integer which corresponds to the values listed in the
+ * argument description.
+ *
+ * Returns: The transform resize type.
+ *
+ * Since: 2.8
+ **/
+GimpTransformResize
+gimp_context_get_transform_resize (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpTransformResize transform_resize = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-transform-resize",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ transform_resize = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return transform_resize;
+}
+
+/**
+ * gimp_context_set_transform_resize:
+ * @transform_resize: The transform resize type.
+ *
+ * Set the transform resize type.
+ *
+ * This procedure modifies the transform resize setting. When
+ * transforming pixels, if the result of a transform operation has a
+ * different size than the original area, this setting determines how
+ * the resulting area is sized.
+ *
+ * This setting affects affects the following procedures:
+ * gimp_item_transform_flip(), gimp_item_transform_flip_simple(),
+ * gimp_item_transform_perspective(), gimp_item_transform_rotate(),
+ * gimp_item_transform_rotate_simple(), gimp_item_transform_scale(),
+ * gimp_item_transform_shear(), gimp_item_transform_2d(),
+ * gimp_item_transform_matrix().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_transform_resize (GimpTransformResize transform_resize)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-transform-resize",
+ &nreturn_vals,
+ GIMP_PDB_INT32, transform_resize,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_transform_recursion:
+ *
+ * Deprecated: There is no replacement for this procedure.
+ *
+ * Returns: This returns always 3 and is meaningless.
+ **/
+gint
+gimp_context_get_transform_recursion (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint transform_recursion = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-transform-recursion",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ transform_recursion = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return transform_recursion;
+}
+
+/**
+ * gimp_context_set_transform_recursion:
+ * @transform_recursion: This parameter is ignored.
+ *
+ * Deprecated: There is no replacement for this procedure.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_context_set_transform_recursion (gint transform_recursion)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-transform-recursion",
+ &nreturn_vals,
+ GIMP_PDB_INT32, transform_recursion,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_ink_size:
+ *
+ * Get ink blob size in pixels.
+ *
+ * Get the ink blob size in pixels for ink tool.
+ *
+ * Returns: ink blob size in pixels.
+ *
+ * Since: 2.8
+ **/
+gdouble
+gimp_context_get_ink_size (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble size = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-ink-size",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ size = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return size;
+}
+
+/**
+ * gimp_context_set_ink_size:
+ * @size: ink blob size in pixels.
+ *
+ * Set ink blob size in pixels.
+ *
+ * Set the ink blob size in pixels for ink tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_ink_size (gdouble size)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-ink-size",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, size,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_ink_angle:
+ *
+ * Get ink angle in degrees.
+ *
+ * Get the ink angle in degrees for ink tool.
+ *
+ * Returns: ink angle in degrees.
+ *
+ * Since: 2.8
+ **/
+gdouble
+gimp_context_get_ink_angle (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble angle = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-ink-angle",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ angle = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return angle;
+}
+
+/**
+ * gimp_context_set_ink_angle:
+ * @angle: ink angle in degrees.
+ *
+ * Set ink angle in degrees.
+ *
+ * Set the ink angle in degrees for ink tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_ink_angle (gdouble angle)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-ink-angle",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, angle,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_ink_size_sensitivity:
+ *
+ * Get ink size sensitivity.
+ *
+ * Get the ink size sensitivity for ink tool.
+ *
+ * Returns: ink size sensitivity.
+ *
+ * Since: 2.8
+ **/
+gdouble
+gimp_context_get_ink_size_sensitivity (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble size = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-ink-size-sensitivity",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ size = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return size;
+}
+
+/**
+ * gimp_context_set_ink_size_sensitivity:
+ * @size: ink size sensitivity.
+ *
+ * Set ink size sensitivity.
+ *
+ * Set the ink size sensitivity for ink tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_ink_size_sensitivity (gdouble size)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-ink-size-sensitivity",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, size,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_ink_tilt_sensitivity:
+ *
+ * Get ink tilt sensitivity.
+ *
+ * Get the ink tilt sensitivity for ink tool.
+ *
+ * Returns: ink tilt sensitivity.
+ *
+ * Since: 2.8
+ **/
+gdouble
+gimp_context_get_ink_tilt_sensitivity (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble tilt = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-ink-tilt-sensitivity",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ tilt = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return tilt;
+}
+
+/**
+ * gimp_context_set_ink_tilt_sensitivity:
+ * @tilt: ink tilt sensitivity.
+ *
+ * Set ink tilt sensitivity.
+ *
+ * Set the ink tilt sensitivity for ink tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_ink_tilt_sensitivity (gdouble tilt)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-ink-tilt-sensitivity",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, tilt,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_ink_speed_sensitivity:
+ *
+ * Get ink speed sensitivity.
+ *
+ * Get the ink speed sensitivity for ink tool.
+ *
+ * Returns: ink speed sensitivity.
+ *
+ * Since: 2.8
+ **/
+gdouble
+gimp_context_get_ink_speed_sensitivity (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble speed = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-ink-speed-sensitivity",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ speed = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return speed;
+}
+
+/**
+ * gimp_context_set_ink_speed_sensitivity:
+ * @speed: ink speed sensitivity.
+ *
+ * Set ink speed sensitivity.
+ *
+ * Set the ink speed sensitivity for ink tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_ink_speed_sensitivity (gdouble speed)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-ink-speed-sensitivity",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, speed,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_ink_blob_type:
+ *
+ * Get ink blob type.
+ *
+ * Get the ink blob type for ink tool.
+ *
+ * Returns: Ink blob type.
+ *
+ * Since: 2.8
+ **/
+GimpInkBlobType
+gimp_context_get_ink_blob_type (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpInkBlobType type = 0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-ink-blob-type",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ type = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return type;
+}
+
+/**
+ * gimp_context_set_ink_blob_type:
+ * @type: Ink blob type.
+ *
+ * Set ink blob type.
+ *
+ * Set the ink blob type for ink tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_ink_blob_type (GimpInkBlobType type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-ink-blob-type",
+ &nreturn_vals,
+ GIMP_PDB_INT32, type,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_ink_blob_aspect_ratio:
+ *
+ * Get ink blob aspect ratio.
+ *
+ * Get the ink blob aspect ratio for ink tool.
+ *
+ * Returns: ink blob aspect ratio.
+ *
+ * Since: 2.8
+ **/
+gdouble
+gimp_context_get_ink_blob_aspect_ratio (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble aspect = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-ink-blob-aspect-ratio",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ aspect = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return aspect;
+}
+
+/**
+ * gimp_context_set_ink_blob_aspect_ratio:
+ * @aspect: ink blob aspect ratio.
+ *
+ * Set ink blob aspect ratio.
+ *
+ * Set the ink blob aspect ratio for ink tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_ink_blob_aspect_ratio (gdouble aspect)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-ink-blob-aspect-ratio",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, aspect,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_get_ink_blob_angle:
+ *
+ * Get ink blob angle in degrees.
+ *
+ * Get the ink blob angle in degrees for ink tool.
+ *
+ * Returns: ink blob angle in degrees.
+ *
+ * Since: 2.8
+ **/
+gdouble
+gimp_context_get_ink_blob_angle (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble angle = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-context-get-ink-blob-angle",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ angle = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return angle;
+}
+
+/**
+ * gimp_context_set_ink_blob_angle:
+ * @angle: ink blob angle in degrees.
+ *
+ * Set ink blob angle in degrees.
+ *
+ * Set the ink blob angle in degrees for ink tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_context_set_ink_blob_angle (gdouble angle)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-ink-blob-angle",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, angle,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpcontext_pdb.h b/libgimp/gimpcontext_pdb.h
new file mode 100644
index 0000000..e735296
--- /dev/null
+++ b/libgimp/gimpcontext_pdb.h
@@ -0,0 +1,161 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpcontext_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_CONTEXT_PDB_H__
+#define __GIMP_CONTEXT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_context_push (void);
+gboolean gimp_context_pop (void);
+gboolean gimp_context_set_defaults (void);
+gboolean gimp_context_list_paint_methods (gint *num_paint_methods,
+ gchar ***paint_methods);
+gchar* gimp_context_get_paint_method (void);
+gboolean gimp_context_set_paint_method (const gchar *name);
+GimpStrokeMethod gimp_context_get_stroke_method (void);
+gboolean gimp_context_set_stroke_method (GimpStrokeMethod stroke_method);
+gboolean gimp_context_get_foreground (GimpRGB *foreground);
+gboolean gimp_context_set_foreground (const GimpRGB *foreground);
+gboolean gimp_context_get_background (GimpRGB *background);
+gboolean gimp_context_set_background (const GimpRGB *background);
+gboolean gimp_context_set_default_colors (void);
+gboolean gimp_context_swap_colors (void);
+gdouble gimp_context_get_opacity (void);
+gboolean gimp_context_set_opacity (gdouble opacity);
+GimpLayerMode gimp_context_get_paint_mode (void);
+gboolean gimp_context_set_paint_mode (GimpLayerMode paint_mode);
+gdouble gimp_context_get_line_width (void);
+gboolean gimp_context_set_line_width (gdouble line_width);
+GimpUnit gimp_context_get_line_width_unit (void);
+gboolean gimp_context_set_line_width_unit (GimpUnit line_width_unit);
+GimpCapStyle gimp_context_get_line_cap_style (void);
+gboolean gimp_context_set_line_cap_style (GimpCapStyle cap_style);
+GimpJoinStyle gimp_context_get_line_join_style (void);
+gboolean gimp_context_set_line_join_style (GimpJoinStyle join_style);
+gdouble gimp_context_get_line_miter_limit (void);
+gboolean gimp_context_set_line_miter_limit (gdouble miter_limit);
+gdouble gimp_context_get_line_dash_offset (void);
+gboolean gimp_context_set_line_dash_offset (gdouble dash_offset);
+gboolean gimp_context_get_line_dash_pattern (gint *num_dashes,
+ gdouble **dashes);
+gboolean gimp_context_set_line_dash_pattern (gint num_dashes,
+ const gdouble *dashes);
+gchar* gimp_context_get_brush (void);
+gboolean gimp_context_set_brush (const gchar *name);
+gdouble gimp_context_get_brush_size (void);
+gboolean gimp_context_set_brush_size (gdouble size);
+gboolean gimp_context_set_brush_default_size (void);
+gdouble gimp_context_get_brush_aspect_ratio (void);
+gboolean gimp_context_set_brush_aspect_ratio (gdouble aspect);
+gdouble gimp_context_get_brush_angle (void);
+gboolean gimp_context_set_brush_angle (gdouble angle);
+gdouble gimp_context_get_brush_spacing (void);
+gboolean gimp_context_set_brush_spacing (gdouble spacing);
+gboolean gimp_context_set_brush_default_spacing (void);
+gdouble gimp_context_get_brush_hardness (void);
+gboolean gimp_context_set_brush_hardness (gdouble hardness);
+gboolean gimp_context_set_brush_default_hardness (void);
+gdouble gimp_context_get_brush_force (void);
+gboolean gimp_context_set_brush_force (gdouble force);
+gchar* gimp_context_get_dynamics (void);
+gboolean gimp_context_set_dynamics (const gchar *name);
+gchar* gimp_context_get_mypaint_brush (void);
+gboolean gimp_context_set_mypaint_brush (const gchar *name);
+gchar* gimp_context_get_pattern (void);
+gboolean gimp_context_set_pattern (const gchar *name);
+gchar* gimp_context_get_gradient (void);
+gboolean gimp_context_set_gradient (const gchar *name);
+gboolean gimp_context_set_gradient_fg_bg_rgb (void);
+gboolean gimp_context_set_gradient_fg_bg_hsv_cw (void);
+gboolean gimp_context_set_gradient_fg_bg_hsv_ccw (void);
+gboolean gimp_context_set_gradient_fg_transparent (void);
+GimpGradientBlendColorSpace gimp_context_get_gradient_blend_color_space (void);
+gboolean gimp_context_set_gradient_blend_color_space (GimpGradientBlendColorSpace blend_color_space);
+GimpRepeatMode gimp_context_get_gradient_repeat_mode (void);
+gboolean gimp_context_set_gradient_repeat_mode (GimpRepeatMode repeat_mode);
+gboolean gimp_context_get_gradient_reverse (void);
+gboolean gimp_context_set_gradient_reverse (gboolean reverse);
+gchar* gimp_context_get_palette (void);
+gboolean gimp_context_set_palette (const gchar *name);
+gchar* gimp_context_get_font (void);
+gboolean gimp_context_set_font (const gchar *name);
+gboolean gimp_context_get_antialias (void);
+gboolean gimp_context_set_antialias (gboolean antialias);
+gboolean gimp_context_get_feather (void);
+gboolean gimp_context_set_feather (gboolean feather);
+gboolean gimp_context_get_feather_radius (gdouble *feather_radius_x,
+ gdouble *feather_radius_y);
+gboolean gimp_context_set_feather_radius (gdouble feather_radius_x,
+ gdouble feather_radius_y);
+gboolean gimp_context_get_sample_merged (void);
+gboolean gimp_context_set_sample_merged (gboolean sample_merged);
+GimpSelectCriterion gimp_context_get_sample_criterion (void);
+gboolean gimp_context_set_sample_criterion (GimpSelectCriterion sample_criterion);
+gdouble gimp_context_get_sample_threshold (void);
+gboolean gimp_context_set_sample_threshold (gdouble sample_threshold);
+gint gimp_context_get_sample_threshold_int (void);
+gboolean gimp_context_set_sample_threshold_int (gint sample_threshold);
+gboolean gimp_context_get_sample_transparent (void);
+gboolean gimp_context_set_sample_transparent (gboolean sample_transparent);
+gboolean gimp_context_get_diagonal_neighbors (void);
+gboolean gimp_context_set_diagonal_neighbors (gboolean diagonal_neighbors);
+GeglDistanceMetric gimp_context_get_distance_metric (void);
+gboolean gimp_context_set_distance_metric (GeglDistanceMetric metric);
+GimpInterpolationType gimp_context_get_interpolation (void);
+gboolean gimp_context_set_interpolation (GimpInterpolationType interpolation);
+GimpTransformDirection gimp_context_get_transform_direction (void);
+gboolean gimp_context_set_transform_direction (GimpTransformDirection transform_direction);
+GimpTransformResize gimp_context_get_transform_resize (void);
+gboolean gimp_context_set_transform_resize (GimpTransformResize transform_resize);
+GIMP_DEPRECATED
+gint gimp_context_get_transform_recursion (void);
+GIMP_DEPRECATED
+gboolean gimp_context_set_transform_recursion (gint transform_recursion);
+gdouble gimp_context_get_ink_size (void);
+gboolean gimp_context_set_ink_size (gdouble size);
+gdouble gimp_context_get_ink_angle (void);
+gboolean gimp_context_set_ink_angle (gdouble angle);
+gdouble gimp_context_get_ink_size_sensitivity (void);
+gboolean gimp_context_set_ink_size_sensitivity (gdouble size);
+gdouble gimp_context_get_ink_tilt_sensitivity (void);
+gboolean gimp_context_set_ink_tilt_sensitivity (gdouble tilt);
+gdouble gimp_context_get_ink_speed_sensitivity (void);
+gboolean gimp_context_set_ink_speed_sensitivity (gdouble speed);
+GimpInkBlobType gimp_context_get_ink_blob_type (void);
+gboolean gimp_context_set_ink_blob_type (GimpInkBlobType type);
+gdouble gimp_context_get_ink_blob_aspect_ratio (void);
+gboolean gimp_context_set_ink_blob_aspect_ratio (gdouble aspect);
+gdouble gimp_context_get_ink_blob_angle (void);
+gboolean gimp_context_set_ink_blob_angle (gdouble angle);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_CONTEXT_PDB_H__ */
diff --git a/libgimp/gimpdebug_pdb.c b/libgimp/gimpdebug_pdb.c
new file mode 100644
index 0000000..64c165b
--- /dev/null
+++ b/libgimp/gimpdebug_pdb.c
@@ -0,0 +1,105 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdebug_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpdebug
+ * @title: gimpdebug
+ * @short_description: Debug utility functions
+ *
+ * Miscellaneous debug utility functions. Not part of the stable
+ * library interface.
+ **/
+
+
+/**
+ * gimp_debug_timer_start:
+ *
+ * Starts measuring elapsed time.
+ *
+ * This procedure starts a timer, measuring the elapsed time since the
+ * call. Each call to this procedure should be matched by a call to
+ * gimp_debug_timer_end(), which returns the elapsed time.
+ * If there is already an active timer, it is not affected by the call,
+ * however, a matching gimp_debug_timer_end() call is still required.
+ *
+ * This is a debug utility procedure. It is subject to change at any
+ * point, and should not be used in production.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_debug_timer_start (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-debug-timer-start",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_debug_timer_end:
+ *
+ * Finishes measuring elapsed time.
+ *
+ * This procedure stops the timer started by a previous
+ * gimp_debug_timer_start() call, and prints and returns the elapsed
+ * time.
+ * If there was already an active timer at the time of corresponding
+ * call to gimp_debug_timer_start(), a dummy value is returned.
+ *
+ * This is a debug utility procedure. It is subject to change at any
+ * point, and should not be used in production.
+ *
+ * Returns: The elapsed time, in seconds.
+ **/
+gdouble
+gimp_debug_timer_end (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble elapsed = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-debug-timer-end",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ elapsed = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return elapsed;
+}
diff --git a/libgimp/gimpdebug_pdb.h b/libgimp/gimpdebug_pdb.h
new file mode 100644
index 0000000..234dc18
--- /dev/null
+++ b/libgimp/gimpdebug_pdb.h
@@ -0,0 +1,41 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdebug_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_DEBUG_PDB_H__
+#define __GIMP_DEBUG_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_debug_timer_start (void);
+gdouble gimp_debug_timer_end (void);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_DEBUG_PDB_H__ */
diff --git a/libgimp/gimpdisplay_pdb.c b/libgimp/gimpdisplay_pdb.c
new file mode 100644
index 0000000..9f1eba0
--- /dev/null
+++ b/libgimp/gimpdisplay_pdb.c
@@ -0,0 +1,237 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdisplay_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpdisplay
+ * @title: gimpdisplay
+ * @short_description: Functions to create, delete and flush displays (views) on an image.
+ *
+ * Functions to create, delete and flush displays (views) on an image.
+ **/
+
+
+/**
+ * gimp_display_is_valid:
+ * @display_ID: The display to check.
+ *
+ * Returns TRUE if the display is valid.
+ *
+ * This procedure checks if the given display ID is valid and refers to
+ * an existing display.
+ *
+ * Returns: Whether the display ID is valid.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_display_is_valid (gint32 display_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean valid = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-display-is-valid",
+ &nreturn_vals,
+ GIMP_PDB_DISPLAY, display_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ valid = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return valid;
+}
+
+/**
+ * gimp_display_new:
+ * @image_ID: The image.
+ *
+ * Create a new display for the specified image.
+ *
+ * Creates a new display for the specified image. If the image already
+ * has a display, another is added. Multiple displays are handled
+ * transparently by GIMP. The newly created display is returned and can
+ * be subsequently destroyed with a call to gimp_display_delete(). This
+ * procedure only makes sense for use with the GIMP UI, and will result
+ * in an execution error if called when GIMP has no UI.
+ *
+ * Returns: The new display.
+ **/
+gint32
+gimp_display_new (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 display_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-display-new",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ display_ID = return_vals[1].data.d_display;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return display_ID;
+}
+
+/**
+ * gimp_display_delete:
+ * @display_ID: The display to delete.
+ *
+ * Delete the specified display.
+ *
+ * This procedure removes the specified display. If this is the last
+ * remaining display for the underlying image, then the image is
+ * deleted also. Note that the display is closed no matter if the image
+ * is dirty or not. Better save the image before calling this
+ * procedure.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_display_delete (gint32 display_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-display-delete",
+ &nreturn_vals,
+ GIMP_PDB_DISPLAY, display_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_display_get_window_handle:
+ * @display_ID: The display to get the window handle from.
+ *
+ * Get a handle to the native window for an image display.
+ *
+ * This procedure returns a handle to the native window for a given
+ * image display. For example in the X backend of GDK, a native window
+ * handle is an Xlib XID. A value of 0 is returned for an invalid
+ * display or if this function is unimplemented for the windowing
+ * system that is being used.
+ *
+ * Returns: The native window handle or 0.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_display_get_window_handle (gint32 display_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint window = 0;
+
+ return_vals = gimp_run_procedure ("gimp-display-get-window-handle",
+ &nreturn_vals,
+ GIMP_PDB_DISPLAY, display_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ window = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return window;
+}
+
+/**
+ * gimp_displays_flush:
+ *
+ * Flush all internal changes to the user interface
+ *
+ * This procedure takes no arguments and returns nothing except a
+ * success status. Its purpose is to flush all pending updates of image
+ * manipulations to the user interface. It should be called whenever
+ * appropriate.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_displays_flush (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-displays-flush",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_displays_reconnect:
+ * @old_image_ID: The old image (must have at least one display).
+ * @new_image_ID: The new image (must not have a display).
+ *
+ * Reconnect displays from one image to another image.
+ *
+ * This procedure connects all displays of the old_image to the
+ * new_image. If the old_image has no display or new_image already has
+ * a display the reconnect is not performed and the procedure returns
+ * without success. You should rarely need to use this function.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_displays_reconnect (gint32 old_image_ID,
+ gint32 new_image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-displays-reconnect",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, old_image_ID,
+ GIMP_PDB_IMAGE, new_image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpdisplay_pdb.h b/libgimp/gimpdisplay_pdb.h
new file mode 100644
index 0000000..b9cdeb9
--- /dev/null
+++ b/libgimp/gimpdisplay_pdb.h
@@ -0,0 +1,46 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdisplay_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_DISPLAY_PDB_H__
+#define __GIMP_DISPLAY_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_display_is_valid (gint32 display_ID);
+gint32 gimp_display_new (gint32 image_ID);
+gboolean gimp_display_delete (gint32 display_ID);
+gint gimp_display_get_window_handle (gint32 display_ID);
+gboolean gimp_displays_flush (void);
+gboolean gimp_displays_reconnect (gint32 old_image_ID,
+ gint32 new_image_ID);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_DISPLAY_PDB_H__ */
diff --git a/libgimp/gimpdrawable.c b/libgimp/gimpdrawable.c
new file mode 100644
index 0000000..5ea1079
--- /dev/null
+++ b/libgimp/gimpdrawable.c
@@ -0,0 +1,822 @@
+/* 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
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#define GIMP_DISABLE_DEPRECATION_WARNINGS
+
+#include "gimp.h"
+
+#include "gimptilebackendplugin.h"
+
+
+#define TILE_WIDTH gimp_tile_width()
+#define TILE_HEIGHT gimp_tile_height()
+
+
+/**
+ * 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
+ **/
+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);
+
+ 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;
+
+ 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().
+ **/
+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);
+}
+
+/**
+ * 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.
+ **/
+void
+gimp_drawable_flush (GimpDrawable *drawable)
+{
+ GimpTile *tiles;
+ gint n_tiles;
+ gint i;
+
+ g_return_if_fail (drawable != NULL);
+
+ if (drawable->tiles)
+ {
+ 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]);
+ }
+
+ /* nuke all references to this drawable from the cache */
+ _gimp_tile_cache_flush_drawable (drawable);
+}
+
+GimpTile *
+gimp_drawable_get_tile (GimpDrawable *drawable,
+ gboolean shadow,
+ gint row,
+ gint col)
+{
+ GimpTile *tiles;
+ guint right_tile;
+ guint bottom_tile;
+ gint n_tiles;
+ gint tile_num;
+ gint i, j, k;
+
+ g_return_val_if_fail (drawable != NULL, NULL);
+
+ if (shadow)
+ tiles = drawable->shadow_tiles;
+ else
+ tiles = drawable->tiles;
+
+ if (! tiles)
+ {
+ 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;
+ }
+ }
+
+ if (shadow)
+ drawable->shadow_tiles = tiles;
+ else
+ drawable->tiles = tiles;
+ }
+
+ tile_num = row * drawable->ntile_cols + col;
+
+ return &tiles[tile_num];
+}
+
+GimpTile *
+gimp_drawable_get_tile2 (GimpDrawable *drawable,
+ gboolean shadow,
+ gint x,
+ gint y)
+{
+ gint row;
+ gint col;
+
+ g_return_val_if_fail (drawable != NULL, NULL);
+
+ col = x / TILE_WIDTH;
+ row = y / TILE_HEIGHT;
+
+ return gimp_drawable_get_tile (drawable, shadow, row, col);
+}
+
+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);
+ color_uchar[1] = 255;
+ break;
+
+ case GIMP_GRAYA_IMAGE:
+ color_uchar[0] = gimp_rgb_luminance_uchar (color);
+ 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;
+}
+
+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_is_valid:
+ * @drawable_ID: The drawable to check.
+ *
+ * Deprecated: Use gimp_item_is_valid() instead.
+ *
+ * Returns: Whether the drawable ID is valid.
+ *
+ * Since: 2.4
+ */
+gboolean
+gimp_drawable_is_valid (gint32 drawable_ID)
+{
+ return gimp_item_is_valid (drawable_ID);
+}
+
+/**
+ * gimp_drawable_is_layer:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_item_is_layer() instead.
+ *
+ * Returns: TRUE if the drawable is a layer, FALSE otherwise.
+ */
+gboolean
+gimp_drawable_is_layer (gint32 drawable_ID)
+{
+ return gimp_item_is_layer (drawable_ID);
+}
+
+/**
+ * gimp_drawable_is_text_layer:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_item_is_text_layer() instead.
+ *
+ * Returns: TRUE if the drawable is a text layer, FALSE otherwise.
+ *
+ * Since: 2.6
+ */
+gboolean
+gimp_drawable_is_text_layer (gint32 drawable_ID)
+{
+ return gimp_item_is_text_layer (drawable_ID);
+}
+
+/**
+ * gimp_drawable_is_layer_mask:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_item_is_layer_mask() instead.
+ *
+ * Returns: TRUE if the drawable is a layer mask, FALSE otherwise.
+ */
+gboolean
+gimp_drawable_is_layer_mask (gint32 drawable_ID)
+{
+ return gimp_item_is_layer_mask (drawable_ID);
+}
+
+/**
+ * gimp_drawable_is_channel:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_item_is_channel() instead.
+ *
+ * Returns: TRUE if the drawable is a channel, FALSE otherwise.
+ */
+gboolean
+gimp_drawable_is_channel (gint32 drawable_ID)
+{
+ return gimp_item_is_channel (drawable_ID);
+}
+
+/**
+ * gimp_drawable_delete:
+ * @drawable_ID: The drawable to delete.
+ *
+ * Deprecated: Use gimp_item_delete() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_drawable_delete (gint32 drawable_ID)
+{
+ return gimp_item_delete (drawable_ID);
+}
+
+/**
+ * gimp_drawable_get_image:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_item_get_image() instead.
+ *
+ * Returns: The drawable's image.
+ */
+gint32
+gimp_drawable_get_image (gint32 drawable_ID)
+{
+ return gimp_item_get_image (drawable_ID);
+}
+
+/**
+ * gimp_drawable_get_name:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_item_get_name() instead.
+ *
+ * Returns: The drawable name.
+ */
+gchar *
+gimp_drawable_get_name (gint32 drawable_ID)
+{
+ return gimp_item_get_name (drawable_ID);
+}
+
+/**
+ * gimp_drawable_set_name:
+ * @drawable_ID: The drawable.
+ * @name: The new drawable name.
+ *
+ * Deprecated: Use gimp_item_set_name() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_drawable_set_name (gint32 drawable_ID,
+ const gchar *name)
+{
+ return gimp_item_set_name (drawable_ID, name);
+}
+
+/**
+ * gimp_drawable_get_visible:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_item_get_visible() instead.
+ *
+ * Returns: The drawable visibility.
+ */
+gboolean
+gimp_drawable_get_visible (gint32 drawable_ID)
+{
+ return gimp_item_get_visible (drawable_ID);
+}
+
+/**
+ * gimp_drawable_set_visible:
+ * @drawable_ID: The drawable.
+ * @visible: The new drawable visibility.
+ *
+ * Deprecated: Use gimp_item_set_visible() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_drawable_set_visible (gint32 drawable_ID,
+ gboolean visible)
+{
+ return gimp_item_set_visible (drawable_ID, visible);
+}
+
+/**
+ * gimp_drawable_get_linked:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_item_get_linked() instead.
+ *
+ * Returns: The drawable linked state (for moves).
+ */
+gboolean
+gimp_drawable_get_linked (gint32 drawable_ID)
+{
+ return gimp_item_get_linked (drawable_ID);
+}
+
+/**
+ * gimp_drawable_set_linked:
+ * @drawable_ID: The drawable.
+ * @linked: The new drawable linked state.
+ *
+ * Deprecated: Use gimp_item_set_linked() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_drawable_set_linked (gint32 drawable_ID,
+ gboolean linked)
+{
+ return gimp_item_set_linked (drawable_ID, linked);
+}
+
+/**
+ * gimp_drawable_get_tattoo:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_item_get_tattoo() instead.
+ *
+ * Returns: The drawable tattoo.
+ */
+gint
+gimp_drawable_get_tattoo (gint32 drawable_ID)
+{
+ return gimp_item_get_tattoo (drawable_ID);
+}
+
+/**
+ * gimp_drawable_set_tattoo:
+ * @drawable_ID: The drawable.
+ * @tattoo: The new drawable tattoo.
+ *
+ * Deprecated: Use gimp_item_set_tattoo() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_drawable_set_tattoo (gint32 drawable_ID,
+ gint tattoo)
+{
+ return gimp_item_set_tattoo (drawable_ID, tattoo);
+}
+
+/**
+ * gimp_drawable_parasite_find:
+ * @drawable_ID: The drawable.
+ * @name: The name of the parasite to find.
+ *
+ * Deprecated: Use gimp_item_get_parasite() instead.
+ *
+ * Returns: The found parasite.
+ **/
+GimpParasite *
+gimp_drawable_parasite_find (gint32 drawable_ID,
+ const gchar *name)
+{
+ return gimp_item_get_parasite (drawable_ID, name);
+}
+
+/**
+ * gimp_drawable_parasite_attach:
+ * @drawable_ID: The drawable.
+ * @parasite: The parasite to attach to a drawable.
+ *
+ * Deprecated: Use gimp_item_attach_parasite() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_parasite_attach (gint32 drawable_ID,
+ const GimpParasite *parasite)
+{
+ return gimp_item_attach_parasite (drawable_ID, parasite);
+}
+
+/**
+ * gimp_drawable_parasite_detach:
+ * @drawable_ID: The drawable.
+ * @name: The name of the parasite to detach from a drawable.
+ *
+ * Deprecated: Use gimp_item_detach_parasite() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_parasite_detach (gint32 drawable_ID,
+ const gchar *name)
+{
+ return gimp_item_detach_parasite (drawable_ID, name);
+}
+
+/**
+ * gimp_drawable_parasite_list:
+ * @drawable_ID: The drawable.
+ * @num_parasites: The number of attached parasites.
+ * @parasites: The names of currently attached parasites.
+ *
+ * Deprecated: Use gimp_item_get_parasite_list() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_parasite_list (gint32 drawable_ID,
+ gint *num_parasites,
+ gchar ***parasites)
+{
+ *parasites = gimp_item_get_parasite_list (drawable_ID, num_parasites);
+
+ return *parasites != NULL;
+}
+
+/**
+ * gimp_drawable_attach_new_parasite:
+ * @drawable_ID: the ID of the #GimpDrawable to attach the #GimpParasite to.
+ * @name: the name of the #GimpParasite to create and attach.
+ * @flags: the flags set on the #GimpParasite.
+ * @size: the size of the parasite data in bytes.
+ * @data: a pointer to the data attached with the #GimpParasite.
+ *
+ * Convenience function that creates a parasite and attaches it
+ * to GIMP.
+ *
+ * Deprecated: use gimp_item_attach_parasite() instead.
+ *
+ * Return value: TRUE on successful creation and attachment of
+ * the new parasite.
+ *
+ * See Also: gimp_drawable_parasite_attach()
+ */
+gboolean
+gimp_drawable_attach_new_parasite (gint32 drawable_ID,
+ const gchar *name,
+ gint flags,
+ gint size,
+ gconstpointer data)
+{
+ GimpParasite *parasite = gimp_parasite_new (name, flags, size, data);
+ gboolean success;
+
+ success = gimp_item_attach_parasite (drawable_ID, parasite);
+
+ gimp_parasite_free (parasite);
+
+ return success;
+}
+
+/**
+ * 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);
+
+ 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;
+}
+/**
+ * gimp_drawable_get_thumbnail_format:
+ * @drawable_ID: the ID of the #GimpDrawable to get the thumbnail format for.
+ *
+ * Returns the #Babl thumbnail format of the drawable.
+ *
+ * Return value: The #Babl thumbnail format.
+ *
+ * Since: 2.10.14
+ */
+const Babl *
+gimp_drawable_get_thumbnail_format (gint32 drawable_ID)
+{
+ const Babl *format = NULL;
+ gchar *format_str = _gimp_drawable_get_thumbnail_format (drawable_ID);
+
+ if (format_str)
+ format = babl_format (format_str);
+
+ return format;
+}
diff --git a/libgimp/gimpdrawable.h b/libgimp/gimpdrawable.h
new file mode 100644
index 0000000..7d7aaec
--- /dev/null
+++ b/libgimp/gimpdrawable.h
@@ -0,0 +1,142 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawable.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_DRAWABLE_H__
+#define __GIMP_DRAWABLE_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+struct _GimpDrawable
+{
+ gint32 drawable_id; /* drawable ID */
+ guint width; /* width of drawble */
+ guint height; /* height of drawble */
+ guint bpp; /* bytes per pixel of drawable */
+ guint ntile_rows; /* # of tile rows */
+ guint ntile_cols; /* # of tile columns */
+ GimpTile *tiles; /* the normal tiles */
+ GimpTile *shadow_tiles; /* the shadow tiles */
+};
+
+
+GeglBuffer * gimp_drawable_get_buffer (gint32 drawable_ID);
+GeglBuffer * gimp_drawable_get_shadow_buffer (gint32 drawable_ID);
+
+const Babl * gimp_drawable_get_format (gint32 drawable_ID);
+const Babl * gimp_drawable_get_thumbnail_format (gint32 drawable_ID);
+
+GIMP_DEPRECATED_FOR(gimp_drawable_get_buffer)
+GimpDrawable * gimp_drawable_get (gint32 drawable_ID);
+GIMP_DEPRECATED
+void gimp_drawable_detach (GimpDrawable *drawable);
+GIMP_DEPRECATED_FOR(gegl_buffer_flush)
+void gimp_drawable_flush (GimpDrawable *drawable);
+GIMP_DEPRECATED_FOR(gimp_drawable_get_buffer)
+GimpTile * gimp_drawable_get_tile (GimpDrawable *drawable,
+ gboolean shadow,
+ gint row,
+ gint col);
+GIMP_DEPRECATED_FOR(gimp_drawable_get_buffer)
+GimpTile * gimp_drawable_get_tile2 (GimpDrawable *drawable,
+ gboolean shadow,
+ gint x,
+ gint y);
+
+GIMP_DEPRECATED
+void gimp_drawable_get_color_uchar (gint32 drawable_ID,
+ const GimpRGB *color,
+ guchar *color_uchar);
+
+guchar * gimp_drawable_get_thumbnail_data (gint32 drawable_ID,
+ gint *width,
+ gint *height,
+ gint *bpp);
+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);
+
+GIMP_DEPRECATED_FOR(gimp_item_is_valid)
+gboolean gimp_drawable_is_valid (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_item_is_layer)
+gboolean gimp_drawable_is_layer (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_item_is_text_layer)
+gboolean gimp_drawable_is_text_layer (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_item_is_layer_mask)
+gboolean gimp_drawable_is_layer_mask (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_item_is_channel)
+gboolean gimp_drawable_is_channel (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_item_delete)
+gboolean gimp_drawable_delete (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_item_get_image)
+gint32 gimp_drawable_get_image (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_item_get_name)
+gchar* gimp_drawable_get_name (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_item_set_name)
+gboolean gimp_drawable_set_name (gint32 drawable_ID,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_item_get_visible)
+gboolean gimp_drawable_get_visible (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_item_set_visible)
+gboolean gimp_drawable_set_visible (gint32 drawable_ID,
+ gboolean visible);
+GIMP_DEPRECATED_FOR(gimp_item_get_linked)
+gboolean gimp_drawable_get_linked (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_item_set_linked)
+gboolean gimp_drawable_set_linked (gint32 drawable_ID,
+ gboolean linked);
+GIMP_DEPRECATED_FOR(gimp_item_get_tattoo)
+gint gimp_drawable_get_tattoo (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_item_set_tattoo)
+gboolean gimp_drawable_set_tattoo (gint32 drawable_ID,
+ gint tattoo);
+GIMP_DEPRECATED_FOR(gimp_item_get_parasite)
+GimpParasite * gimp_drawable_parasite_find (gint32 drawable_ID,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_item_attach_parasite)
+gboolean gimp_drawable_parasite_attach (gint32 drawable_ID,
+ const GimpParasite *parasite);
+GIMP_DEPRECATED_FOR(gimp_item_detach_parasite)
+gboolean gimp_drawable_parasite_detach (gint32 drawable_ID,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_item_get_parasite_list)
+gboolean gimp_drawable_parasite_list (gint32 drawable_ID,
+ gint *num_parasites,
+ gchar ***parasites);
+GIMP_DEPRECATED_FOR(gimp_item_attach_parasite)
+gboolean gimp_drawable_attach_new_parasite (gint32 drawable_ID,
+ const gchar *name,
+ gint flags,
+ gint size,
+ gconstpointer data);
+
+G_END_DECLS
+
+#endif /* __GIMP_DRAWABLE_H__ */
diff --git a/libgimp/gimpdrawable_pdb.c b/libgimp/gimpdrawable_pdb.c
new file mode 100644
index 0000000..72da2b2
--- /dev/null
+++ b/libgimp/gimpdrawable_pdb.c
@@ -0,0 +1,1043 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawable_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpdrawable
+ * @title: gimpdrawable
+ * @short_description: Functions to manipulate drawables.
+ *
+ * Functions to manipulate drawables.
+ **/
+
+
+/**
+ * _gimp_drawable_get_format:
+ * @drawable_ID: The drawable.
+ *
+ * Returns the drawable's Babl format
+ *
+ * This procedure returns the drawable's Babl format.
+ *
+ * Returns: The drawable's Babl format.
+ *
+ * Since: 2.10
+ **/
+gchar *
+_gimp_drawable_get_format (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *format = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-get-format",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ format = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return format;
+}
+
+/**
+ * _gimp_drawable_get_thumbnail_format:
+ * @drawable_ID: The drawable.
+ *
+ * Returns the drawable's thumbnail Babl format
+ *
+ * This procedure returns the drawable's thumbnail Babl format.
+ * Thumbnails are always 8-bit images, see gimp_drawable_thumbnail()
+ * and gimp_drawable_sub_thmbnail().
+ *
+ * Returns: The drawable's thumbnail Babl format.
+ *
+ * Since: 2.10.14
+ **/
+gchar *
+_gimp_drawable_get_thumbnail_format (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *format = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-get-thumbnail-format",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ format = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return format;
+}
+
+/**
+ * gimp_drawable_type:
+ * @drawable_ID: The drawable.
+ *
+ * Returns the drawable's type.
+ *
+ * This procedure returns the drawable's type.
+ *
+ * Returns: The drawable's type.
+ **/
+GimpImageType
+gimp_drawable_type (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpImageType type = 0;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-type",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ type = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return type;
+}
+
+/**
+ * gimp_drawable_type_with_alpha:
+ * @drawable_ID: The drawable.
+ *
+ * Returns the drawable's type with alpha.
+ *
+ * This procedure returns the drawable's type as if had an alpha
+ * channel. If the type is currently Gray, for instance, the returned
+ * type would be GrayA. If the drawable already has an alpha channel,
+ * the drawable's type is simply returned.
+ *
+ * Returns: The drawable's type with alpha.
+ **/
+GimpImageType
+gimp_drawable_type_with_alpha (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpImageType type_with_alpha = 0;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-type-with-alpha",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ type_with_alpha = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return type_with_alpha;
+}
+
+/**
+ * gimp_drawable_has_alpha:
+ * @drawable_ID: The drawable.
+ *
+ * Returns TRUE if the drawable has an alpha channel.
+ *
+ * This procedure returns whether the specified drawable has an alpha
+ * channel. This can only be true for layers, and the associated type
+ * will be one of: { RGBA , GRAYA, INDEXEDA }.
+ *
+ * Returns: Does the drawable have an alpha channel?
+ **/
+gboolean
+gimp_drawable_has_alpha (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean has_alpha = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-has-alpha",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ has_alpha = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return has_alpha;
+}
+
+/**
+ * gimp_drawable_is_rgb:
+ * @drawable_ID: The drawable.
+ *
+ * Returns whether the drawable is an RGB type.
+ *
+ * This procedure returns TRUE if the specified drawable is of type {
+ * RGB, RGBA }.
+ *
+ * Returns: TRUE if the drawable is an RGB type.
+ **/
+gboolean
+gimp_drawable_is_rgb (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean is_rgb = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-is-rgb",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ is_rgb = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return is_rgb;
+}
+
+/**
+ * gimp_drawable_is_gray:
+ * @drawable_ID: The drawable.
+ *
+ * Returns whether the drawable is a grayscale type.
+ *
+ * This procedure returns TRUE if the specified drawable is of type {
+ * Gray, GrayA }.
+ *
+ * Returns: TRUE if the drawable is a grayscale type.
+ **/
+gboolean
+gimp_drawable_is_gray (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean is_gray = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-is-gray",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ is_gray = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return is_gray;
+}
+
+/**
+ * gimp_drawable_is_indexed:
+ * @drawable_ID: The drawable.
+ *
+ * Returns whether the drawable is an indexed type.
+ *
+ * This procedure returns TRUE if the specified drawable is of type {
+ * Indexed, IndexedA }.
+ *
+ * Returns: TRUE if the drawable is an indexed type.
+ **/
+gboolean
+gimp_drawable_is_indexed (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean is_indexed = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-is-indexed",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ is_indexed = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return is_indexed;
+}
+
+/**
+ * gimp_drawable_bpp:
+ * @drawable_ID: The drawable.
+ *
+ * Returns the bytes per pixel.
+ *
+ * This procedure returns the number of bytes per pixel, which
+ * corresponds to the number of components unless
+ * gimp_plugin_enable_precision() was called.
+ *
+ * Returns: Bytes per pixel.
+ **/
+gint
+gimp_drawable_bpp (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint bpp = 0;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-bpp",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ bpp = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return bpp;
+}
+
+/**
+ * gimp_drawable_width:
+ * @drawable_ID: The drawable.
+ *
+ * Returns the width of the drawable.
+ *
+ * This procedure returns the specified drawable's width in pixels.
+ *
+ * Returns: Width of drawable.
+ **/
+gint
+gimp_drawable_width (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint width = 0;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-width",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ width = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return width;
+}
+
+/**
+ * gimp_drawable_height:
+ * @drawable_ID: The drawable.
+ *
+ * Returns the height of the drawable.
+ *
+ * This procedure returns the specified drawable's height in pixels.
+ *
+ * Returns: Height of drawable.
+ **/
+gint
+gimp_drawable_height (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint height = 0;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-height",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ height = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return height;
+}
+
+/**
+ * gimp_drawable_offsets:
+ * @drawable_ID: The drawable.
+ * @offset_x: x offset of drawable.
+ * @offset_y: y offset of drawable.
+ *
+ * Returns the offsets for the drawable.
+ *
+ * This procedure returns the specified drawable's offsets. This only
+ * makes sense if the drawable is a layer since channels are anchored.
+ * The offsets of a channel will be returned as 0.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_offsets (gint32 drawable_ID,
+ gint *offset_x,
+ gint *offset_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-offsets",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ *offset_x = 0;
+ *offset_y = 0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *offset_x = return_vals[1].data.d_int32;
+ *offset_y = return_vals[2].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_set_image:
+ * @drawable_ID: The drawable.
+ * @image_ID: The image.
+ *
+ * Deprecated: There is no replacement for this procedure.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_set_image (gint32 drawable_ID,
+ gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-set-image",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_mask_bounds:
+ * @drawable_ID: The drawable.
+ * @x1: x coordinate of the upper left corner of selection bounds.
+ * @y1: y coordinate of the upper left corner of selection bounds.
+ * @x2: x coordinate of the lower right corner of selection bounds.
+ * @y2: y coordinate of the lower right corner of selection bounds.
+ *
+ * Find the bounding box of the current selection in relation to the
+ * specified drawable.
+ *
+ * This procedure returns whether there is a selection. If there is
+ * one, the upper left and lower right-hand corners of its bounding box
+ * are returned. These coordinates are specified relative to the
+ * drawable's origin, and bounded by the drawable's extents. Please
+ * note that the pixel specified by the lower right-hand coordinate of
+ * the bounding box is not part of the selection. The selection ends at
+ * the upper left corner of this pixel. This means the width of the
+ * selection can be calculated as (x2 - x1), its height as (y2 - y1).
+ * Note that the returned boolean does NOT correspond with the returned
+ * region being empty or not, it always returns whether the selection
+ * is non_empty. See gimp_drawable_mask_intersect() for a boolean
+ * return value which is more useful in most cases.
+ *
+ * Returns: TRUE if there is a selection.
+ **/
+gboolean
+gimp_drawable_mask_bounds (gint32 drawable_ID,
+ gint *x1,
+ gint *y1,
+ gint *x2,
+ gint *y2)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean non_empty = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-mask-bounds",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ non_empty = return_vals[1].data.d_int32;
+ *x1 = return_vals[2].data.d_int32;
+ *y1 = return_vals[3].data.d_int32;
+ *x2 = return_vals[4].data.d_int32;
+ *y2 = return_vals[5].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return non_empty;
+}
+
+/**
+ * gimp_drawable_mask_intersect:
+ * @drawable_ID: The drawable.
+ * @x: x coordinate of the upper left corner of the intersection.
+ * @y: y coordinate of the upper left corner of the intersection.
+ * @width: width of the intersection.
+ * @height: height of the intersection.
+ *
+ * Find the bounding box of the current selection in relation to the
+ * specified drawable.
+ *
+ * This procedure returns whether there is an intersection between the
+ * drawable and the selection. Unlike gimp_drawable_mask_bounds(), the
+ * intersection's bounds are returned as x, y, width, height.
+ * If there is no selection this function returns TRUE and the returned
+ * bounds are the extents of the whole drawable.
+ *
+ * Returns: TRUE if the returned area is not empty.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_drawable_mask_intersect (gint32 drawable_ID,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean non_empty = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-mask-intersect",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ non_empty = return_vals[1].data.d_int32;
+ *x = return_vals[2].data.d_int32;
+ *y = return_vals[3].data.d_int32;
+ *width = return_vals[4].data.d_int32;
+ *height = return_vals[5].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return non_empty;
+}
+
+/**
+ * gimp_drawable_merge_shadow:
+ * @drawable_ID: The drawable.
+ * @undo: Push merge to undo stack?
+ *
+ * Merge the shadow buffer with the specified drawable.
+ *
+ * This procedure combines the contents of the drawable's shadow buffer
+ * (for temporary processing) with the specified drawable. The 'undo'
+ * parameter specifies whether to add an undo step for the operation.
+ * Requesting no undo is useful for such applications as 'auto-apply'.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_merge_shadow (gint32 drawable_ID,
+ gboolean undo)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-merge-shadow",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, undo,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_free_shadow:
+ * @drawable_ID: The drawable.
+ *
+ * Free the specified drawable's shadow data (if it exists).
+ *
+ * This procedure is intended as a memory saving device. If any shadow
+ * memory has been allocated, it will be freed automatically when the
+ * drawable is removed from the image, or when the plug-in procedure
+ * which allocated it returns.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_drawable_free_shadow (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-free-shadow",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_update:
+ * @drawable_ID: The drawable.
+ * @x: x coordinate of upper left corner of update region.
+ * @y: y coordinate of upper left corner of update region.
+ * @width: Width of update region.
+ * @height: Height of update region.
+ *
+ * Update the specified region of the drawable.
+ *
+ * This procedure updates the specified region of the drawable. The (x,
+ * y) coordinate pair is relative to the drawable's origin, not to the
+ * image origin. Therefore, the entire drawable can be updated using
+ * (0, 0, width, height).
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_update (gint32 drawable_ID,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-update",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, x,
+ GIMP_PDB_INT32, y,
+ GIMP_PDB_INT32, width,
+ GIMP_PDB_INT32, height,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_get_pixel:
+ * @drawable_ID: The drawable.
+ * @x_coord: The x coordinate.
+ * @y_coord: The y coordinate.
+ * @num_channels: The number of channels for the pixel.
+ *
+ * Gets the value of the pixel at the specified coordinates.
+ *
+ * This procedure gets the pixel value at the specified coordinates.
+ * The 'num_channels' argument must always be equal to the
+ * bytes-per-pixel value for the specified drawable.
+ *
+ * Returns: The pixel value.
+ **/
+guint8 *
+gimp_drawable_get_pixel (gint32 drawable_ID,
+ gint x_coord,
+ gint y_coord,
+ gint *num_channels)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ guint8 *pixel = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-get-pixel",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, x_coord,
+ GIMP_PDB_INT32, y_coord,
+ GIMP_PDB_END);
+
+ *num_channels = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_channels = return_vals[1].data.d_int32;
+ pixel = g_new (guint8, *num_channels);
+ memcpy (pixel,
+ return_vals[2].data.d_int8array,
+ *num_channels * sizeof (guint8));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return pixel;
+}
+
+/**
+ * gimp_drawable_set_pixel:
+ * @drawable_ID: The drawable.
+ * @x_coord: The x coordinate.
+ * @y_coord: The y coordinate.
+ * @num_channels: The number of channels for the pixel.
+ * @pixel: The pixel value.
+ *
+ * Sets the value of the pixel at the specified coordinates.
+ *
+ * This procedure sets the pixel value at the specified coordinates.
+ * The 'num_channels' argument must always be equal to the
+ * bytes-per-pixel value for the specified drawable. Note that this
+ * function is not undoable, you should use it only on drawables you
+ * just created yourself.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_set_pixel (gint32 drawable_ID,
+ gint x_coord,
+ gint y_coord,
+ gint num_channels,
+ const guint8 *pixel)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-set-pixel",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, x_coord,
+ GIMP_PDB_INT32, y_coord,
+ GIMP_PDB_INT32, num_channels,
+ GIMP_PDB_INT8ARRAY, pixel,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_fill:
+ * @drawable_ID: The drawable.
+ * @fill_type: The type of fill.
+ *
+ * Fill the drawable with the specified fill mode.
+ *
+ * This procedure fills the drawable. If the fill mode is foreground
+ * the current foreground color is used. If the fill mode is
+ * background, the current background color is used. If the fill type
+ * is white, then white is used. Transparent fill only affects layers
+ * with an alpha channel, in which case the alpha channel is set to
+ * transparent. If the drawable has no alpha channel, it is filled to
+ * white. No fill leaves the drawable's contents undefined.
+ * This procedure is unlike gimp_edit_fill() or the bucket fill tool
+ * because it fills regardless of a selection. Its main purpose is to
+ * fill a newly created drawable before adding it to the image. This
+ * operation cannot be undone.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_fill (gint32 drawable_ID,
+ GimpFillType fill_type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-fill",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, fill_type,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_offset:
+ * @drawable_ID: The drawable to offset.
+ * @wrap_around: wrap image around or fill vacated regions.
+ * @fill_type: fill vacated regions of drawable with background or transparent.
+ * @offset_x: offset by this amount in X direction.
+ * @offset_y: offset by this amount in Y direction.
+ *
+ * Offset the drawable by the specified amounts in the X and Y
+ * directions
+ *
+ * This procedure offsets the specified drawable by the amounts
+ * specified by 'offset_x' and 'offset_y'. If 'wrap_around' is set to
+ * TRUE, then portions of the drawable which are offset out of bounds
+ * are wrapped around. Alternatively, the undefined regions of the
+ * drawable can be filled with transparency or the background color, as
+ * specified by the 'fill-type' parameter.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_offset (gint32 drawable_ID,
+ gboolean wrap_around,
+ GimpOffsetType fill_type,
+ gint offset_x,
+ gint offset_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-offset",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, wrap_around,
+ GIMP_PDB_INT32, fill_type,
+ GIMP_PDB_INT32, offset_x,
+ GIMP_PDB_INT32, offset_y,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_thumbnail:
+ * @drawable_ID: The drawable.
+ * @width: The requested thumbnail width.
+ * @height: The requested thumbnail height.
+ * @actual_width: The previews width.
+ * @actual_height: The previews height.
+ * @bpp: The previews bpp.
+ * @thumbnail_data_count: The number of bytes in thumbnail data.
+ * @thumbnail_data: The thumbnail data.
+ *
+ * Get a thumbnail of a drawable.
+ *
+ * This function gets data from which a thumbnail of a drawable preview
+ * can be created. Maximum x or y dimension is 1024 pixels. The pixels
+ * are returned in RGB[A] or GRAY[A] format. The bpp return value gives
+ * the number of bytes in the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_drawable_thumbnail (gint32 drawable_ID,
+ gint width,
+ gint height,
+ gint *actual_width,
+ gint *actual_height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-thumbnail",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, width,
+ GIMP_PDB_INT32, height,
+ GIMP_PDB_END);
+
+ *actual_width = 0;
+ *actual_height = 0;
+ *bpp = 0;
+ *thumbnail_data_count = 0;
+ *thumbnail_data = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *actual_width = return_vals[1].data.d_int32;
+ *actual_height = return_vals[2].data.d_int32;
+ *bpp = return_vals[3].data.d_int32;
+ *thumbnail_data_count = return_vals[4].data.d_int32;
+ *thumbnail_data = g_new (guint8, *thumbnail_data_count);
+ memcpy (*thumbnail_data,
+ return_vals[5].data.d_int8array,
+ *thumbnail_data_count * sizeof (guint8));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_sub_thumbnail:
+ * @drawable_ID: The drawable.
+ * @src_x: The x coordinate of the area.
+ * @src_y: The y coordinate of the area.
+ * @src_width: The width of the area.
+ * @src_height: The height of the area.
+ * @dest_width: The thumbnail width.
+ * @dest_height: The thumbnail height.
+ * @width: The previews width.
+ * @height: The previews height.
+ * @bpp: The previews bpp.
+ * @thumbnail_data_count: The number of bytes in thumbnail data.
+ * @thumbnail_data: The thumbnail data.
+ *
+ * Get a thumbnail of a sub-area of a drawable drawable.
+ *
+ * This function gets data from which a thumbnail of a drawable preview
+ * can be created. Maximum x or y dimension is 1024 pixels. The pixels
+ * are returned in RGB[A] or GRAY[A] format. The bpp return value gives
+ * the number of bytes in the image.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+_gimp_drawable_sub_thumbnail (gint32 drawable_ID,
+ gint src_x,
+ gint src_y,
+ gint src_width,
+ gint src_height,
+ gint dest_width,
+ gint dest_height,
+ gint *width,
+ gint *height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-sub-thumbnail",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, src_x,
+ GIMP_PDB_INT32, src_y,
+ GIMP_PDB_INT32, src_width,
+ GIMP_PDB_INT32, src_height,
+ GIMP_PDB_INT32, dest_width,
+ GIMP_PDB_INT32, dest_height,
+ GIMP_PDB_END);
+
+ *width = 0;
+ *height = 0;
+ *bpp = 0;
+ *thumbnail_data_count = 0;
+ *thumbnail_data = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *width = return_vals[1].data.d_int32;
+ *height = return_vals[2].data.d_int32;
+ *bpp = return_vals[3].data.d_int32;
+ *thumbnail_data_count = return_vals[4].data.d_int32;
+ *thumbnail_data = g_new (guint8, *thumbnail_data_count);
+ memcpy (*thumbnail_data,
+ return_vals[5].data.d_int8array,
+ *thumbnail_data_count * sizeof (guint8));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_foreground_extract:
+ * @drawable_ID: The drawable.
+ * @mode: The algorithm to use.
+ * @mask_ID: Tri-Map.
+ *
+ * Extract the foreground of a drawable using a given trimap.
+ *
+ * Image Segmentation by Uniform Color Clustering, see
+ * https://www.inf.fu-berlin.de/inst/pubs/tr-b-05-07.pdf
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_drawable_foreground_extract (gint32 drawable_ID,
+ GimpForegroundExtractMode mode,
+ gint32 mask_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-foreground-extract",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, mode,
+ GIMP_PDB_DRAWABLE, mask_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpdrawable_pdb.h b/libgimp/gimpdrawable_pdb.h
new file mode 100644
index 0000000..ce289b2
--- /dev/null
+++ b/libgimp/gimpdrawable_pdb.h
@@ -0,0 +1,113 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawable_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_DRAWABLE_PDB_H__
+#define __GIMP_DRAWABLE_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+G_GNUC_INTERNAL gchar* _gimp_drawable_get_format (gint32 drawable_ID);
+G_GNUC_INTERNAL gchar* _gimp_drawable_get_thumbnail_format (gint32 drawable_ID);
+GimpImageType gimp_drawable_type (gint32 drawable_ID);
+GimpImageType gimp_drawable_type_with_alpha (gint32 drawable_ID);
+gboolean gimp_drawable_has_alpha (gint32 drawable_ID);
+gboolean gimp_drawable_is_rgb (gint32 drawable_ID);
+gboolean gimp_drawable_is_gray (gint32 drawable_ID);
+gboolean gimp_drawable_is_indexed (gint32 drawable_ID);
+gint gimp_drawable_bpp (gint32 drawable_ID);
+gint gimp_drawable_width (gint32 drawable_ID);
+gint gimp_drawable_height (gint32 drawable_ID);
+gboolean gimp_drawable_offsets (gint32 drawable_ID,
+ gint *offset_x,
+ gint *offset_y);
+GIMP_DEPRECATED
+gboolean gimp_drawable_set_image (gint32 drawable_ID,
+ gint32 image_ID);
+gboolean gimp_drawable_mask_bounds (gint32 drawable_ID,
+ gint *x1,
+ gint *y1,
+ gint *x2,
+ gint *y2);
+gboolean gimp_drawable_mask_intersect (gint32 drawable_ID,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height);
+gboolean gimp_drawable_merge_shadow (gint32 drawable_ID,
+ gboolean undo);
+gboolean gimp_drawable_free_shadow (gint32 drawable_ID);
+gboolean gimp_drawable_update (gint32 drawable_ID,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+guint8* gimp_drawable_get_pixel (gint32 drawable_ID,
+ gint x_coord,
+ gint y_coord,
+ gint *num_channels);
+gboolean gimp_drawable_set_pixel (gint32 drawable_ID,
+ gint x_coord,
+ gint y_coord,
+ gint num_channels,
+ const guint8 *pixel);
+gboolean gimp_drawable_fill (gint32 drawable_ID,
+ GimpFillType fill_type);
+gboolean gimp_drawable_offset (gint32 drawable_ID,
+ gboolean wrap_around,
+ GimpOffsetType fill_type,
+ gint offset_x,
+ gint offset_y);
+G_GNUC_INTERNAL gboolean _gimp_drawable_thumbnail (gint32 drawable_ID,
+ gint width,
+ gint height,
+ gint *actual_width,
+ gint *actual_height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data);
+G_GNUC_INTERNAL gboolean _gimp_drawable_sub_thumbnail (gint32 drawable_ID,
+ gint src_x,
+ gint src_y,
+ gint src_width,
+ gint src_height,
+ gint dest_width,
+ gint dest_height,
+ gint *width,
+ gint *height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data);
+gboolean gimp_drawable_foreground_extract (gint32 drawable_ID,
+ GimpForegroundExtractMode mode,
+ gint32 mask_ID);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_DRAWABLE_PDB_H__ */
diff --git a/libgimp/gimpdrawablecolor_pdb.c b/libgimp/gimpdrawablecolor_pdb.c
new file mode 100644
index 0000000..2684270
--- /dev/null
+++ b/libgimp/gimpdrawablecolor_pdb.c
@@ -0,0 +1,780 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawablecolor_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpdrawablecolor
+ * @title: gimpdrawablecolor
+ * @short_description: Functions for manipulating a drawable's color.
+ *
+ * Functions for manipulating a drawable's color, including curves and
+ * histograms.
+ **/
+
+
+/**
+ * gimp_drawable_brightness_contrast:
+ * @drawable_ID: The drawable.
+ * @brightness: Brightness adjustment.
+ * @contrast: Contrast adjustment.
+ *
+ * Modify brightness/contrast in the specified drawable.
+ *
+ * This procedures allows the brightness and contrast of the specified
+ * drawable to be modified. Both 'brightness' and 'contrast' parameters
+ * are defined between -1.0 and 1.0.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_brightness_contrast (gint32 drawable_ID,
+ gdouble brightness,
+ gdouble contrast)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-brightness-contrast",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, brightness,
+ GIMP_PDB_FLOAT, contrast,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_color_balance:
+ * @drawable_ID: The drawable.
+ * @transfer_mode: Transfer mode.
+ * @preserve_lum: Preserve luminosity values at each pixel.
+ * @cyan_red: Cyan-Red color balance.
+ * @magenta_green: Magenta-Green color balance.
+ * @yellow_blue: Yellow-Blue color balance.
+ *
+ * Modify the color balance of the specified drawable.
+ *
+ * Modify the color balance of the specified drawable. There are three
+ * axis which can be modified: cyan-red, magenta-green, and
+ * yellow-blue. Negative values increase the amount of the former,
+ * positive values increase the amount of the latter. Color balance can
+ * be controlled with the 'transfer_mode' setting, which allows
+ * shadows, mid-tones, and highlights in an image to be affected
+ * differently. The 'preserve-lum' parameter, if TRUE, ensures that the
+ * luminosity of each pixel remains fixed.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_color_balance (gint32 drawable_ID,
+ GimpTransferMode transfer_mode,
+ gboolean preserve_lum,
+ gdouble cyan_red,
+ gdouble magenta_green,
+ gdouble yellow_blue)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-color-balance",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, transfer_mode,
+ GIMP_PDB_INT32, preserve_lum,
+ GIMP_PDB_FLOAT, cyan_red,
+ GIMP_PDB_FLOAT, magenta_green,
+ GIMP_PDB_FLOAT, yellow_blue,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_colorize_hsl:
+ * @drawable_ID: The drawable.
+ * @hue: Hue in degrees.
+ * @saturation: Saturation in percent.
+ * @lightness: Lightness in percent.
+ *
+ * Render the drawable as a grayscale image seen through a colored
+ * glass.
+ *
+ * Desaturates the drawable, then tints it with the specified color.
+ * This tool is only valid on RGB color images. It will not operate on
+ * grayscale drawables.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_colorize_hsl (gint32 drawable_ID,
+ gdouble hue,
+ gdouble saturation,
+ gdouble lightness)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-colorize-hsl",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, hue,
+ GIMP_PDB_FLOAT, saturation,
+ GIMP_PDB_FLOAT, lightness,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_curves_explicit:
+ * @drawable_ID: The drawable.
+ * @channel: The channel to modify.
+ * @num_values: The number of values in the new curve.
+ * @values: The explicit curve.
+ *
+ * Modifies the intensity curve(s) for specified drawable.
+ *
+ * Modifies the intensity mapping for one channel in the specified
+ * drawable. The channel can be either an intensity component, or the
+ * value. The 'values' parameter is an array of doubles which
+ * explicitly defines how each pixel value in the drawable will be
+ * modified. Use the gimp_curves_spline() function to modify intensity
+ * levels with Catmull Rom splines.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_curves_explicit (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_values,
+ const gdouble *values)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-curves-explicit",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, channel,
+ GIMP_PDB_INT32, num_values,
+ GIMP_PDB_FLOATARRAY, values,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_curves_spline:
+ * @drawable_ID: The drawable.
+ * @channel: The channel to modify.
+ * @num_points: The number of values in the control point array.
+ * @points: The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y, ... }.
+ *
+ * Modifies the intensity curve(s) for specified drawable.
+ *
+ * Modifies the intensity mapping for one channel in the specified
+ * drawable. The channel can be either an intensity component, or the
+ * value. The 'points' parameter is an array of doubles which define a
+ * set of control points which describe a Catmull Rom spline which
+ * yields the final intensity curve. Use the gimp_curves_explicit()
+ * function to explicitly modify intensity levels.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_curves_spline (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_points,
+ const gdouble *points)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-curves-spline",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, channel,
+ GIMP_PDB_INT32, num_points,
+ GIMP_PDB_FLOATARRAY, points,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_extract_component:
+ * @drawable_ID: The drawable.
+ * @component: Component (RGB Red (0), RGB Green (1), RGB Blue (2), Hue (3), HSV Saturation (4), HSV Value (5), HSL Saturation (6), HSL Lightness (7), CMYK Cyan (8), CMYK Magenta (9), CMYK Yellow (10), CMYK Key (11), Y'CbCr Y' (12), Y'CbCr Cb (13), Y'CbCr Cr (14), LAB L (15), LAB A (16), LAB B (17), LCH C(ab) (18), LCH H(ab) (19), Alpha (20)).
+ * @invert: Invert the extracted component.
+ * @linear: Use linear output instead of gamma corrected.
+ *
+ * Extract a color model component.
+ *
+ * Extract a color model component.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10.34
+ **/
+gboolean
+gimp_drawable_extract_component (gint32 drawable_ID,
+ guint8 component,
+ gboolean invert,
+ gboolean linear)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-extract-component",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT8, component,
+ GIMP_PDB_INT32, invert,
+ GIMP_PDB_INT32, linear,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_desaturate:
+ * @drawable_ID: The drawable.
+ * @desaturate_mode: The formula to use to desaturate.
+ *
+ * Desaturate the contents of the specified drawable, with the
+ * specified formula.
+ *
+ * This procedure desaturates the contents of the specified drawable,
+ * with the specified formula. This procedure only works on drawables
+ * of type RGB color.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_desaturate (gint32 drawable_ID,
+ GimpDesaturateMode desaturate_mode)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-desaturate",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, desaturate_mode,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_equalize:
+ * @drawable_ID: The drawable.
+ * @mask_only: Equalization option.
+ *
+ * Equalize the contents of the specified drawable.
+ *
+ * This procedure equalizes the contents of the specified drawable.
+ * Each intensity channel is equalized independently. The equalized
+ * intensity is given as inten' = (255 - inten). The 'mask_only' option
+ * specifies whether to adjust only the area of the image within the
+ * selection bounds, or the entire image based on the histogram of the
+ * selected area. If there is no selection, the entire image is
+ * adjusted based on the histogram for the entire image.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_equalize (gint32 drawable_ID,
+ gboolean mask_only)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-equalize",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, mask_only,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_histogram:
+ * @drawable_ID: The drawable.
+ * @channel: The channel to query.
+ * @start_range: Start of the intensity measurement range.
+ * @end_range: End of the intensity measurement range.
+ * @mean: Mean intensity value.
+ * @std_dev: Standard deviation of intensity values.
+ * @median: Median intensity value.
+ * @pixels: Alpha-weighted pixel count for entire image.
+ * @count: Alpha-weighted pixel count for range.
+ * @percentile: Percentile that range falls under.
+ *
+ * Returns information on the intensity histogram for the specified
+ * drawable.
+ *
+ * This tool makes it possible to gather information about the
+ * intensity histogram of a drawable. A channel to examine is first
+ * specified. This can be either value, red, green, or blue, depending
+ * on whether the drawable is of type color or grayscale. Second, a
+ * range of intensities are specified. The gimp_drawable_histogram()
+ * function returns statistics based on the pixels in the drawable that
+ * fall under this range of values. Mean, standard deviation, median,
+ * number of pixels, and percentile are all returned. Additionally, the
+ * total count of pixels in the image is returned. Counts of pixels are
+ * weighted by any associated alpha values and by the current selection
+ * mask. That is, pixels that lie outside an active selection mask will
+ * not be counted. Similarly, pixels with transparent alpha values will
+ * not be counted. The returned mean, std_dev and median are in the
+ * range (0..255) for 8-bit images or if the plug-in is not
+ * precision-aware, and in the range (0.0..1.0) otherwise.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_histogram (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble start_range,
+ gdouble end_range,
+ gdouble *mean,
+ gdouble *std_dev,
+ gdouble *median,
+ gdouble *pixels,
+ gdouble *count,
+ gdouble *percentile)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-histogram",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, channel,
+ GIMP_PDB_FLOAT, start_range,
+ GIMP_PDB_FLOAT, end_range,
+ GIMP_PDB_END);
+
+ *mean = 0.0;
+ *std_dev = 0.0;
+ *median = 0.0;
+ *pixels = 0.0;
+ *count = 0.0;
+ *percentile = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *mean = return_vals[1].data.d_float;
+ *std_dev = return_vals[2].data.d_float;
+ *median = return_vals[3].data.d_float;
+ *pixels = return_vals[4].data.d_float;
+ *count = return_vals[5].data.d_float;
+ *percentile = return_vals[6].data.d_float;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_hue_saturation:
+ * @drawable_ID: The drawable.
+ * @hue_range: Range of affected hues.
+ * @hue_offset: Hue offset in degrees.
+ * @lightness: Lightness modification.
+ * @saturation: Saturation modification.
+ * @overlap: Overlap other hue channels.
+ *
+ * Modify hue, lightness, and saturation in the specified drawable.
+ *
+ * This procedure allows the hue, lightness, and saturation in the
+ * specified drawable to be modified. The 'hue-range' parameter
+ * provides the capability to limit range of affected hues. The
+ * 'overlap' parameter provides blending into neighboring hue channels
+ * when rendering.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_hue_saturation (gint32 drawable_ID,
+ GimpHueRange hue_range,
+ gdouble hue_offset,
+ gdouble lightness,
+ gdouble saturation,
+ gdouble overlap)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-hue-saturation",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, hue_range,
+ GIMP_PDB_FLOAT, hue_offset,
+ GIMP_PDB_FLOAT, lightness,
+ GIMP_PDB_FLOAT, saturation,
+ GIMP_PDB_FLOAT, overlap,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_invert:
+ * @drawable_ID: The drawable.
+ * @linear: Whether to invert in linear space.
+ *
+ * Invert the contents of the specified drawable.
+ *
+ * This procedure inverts the contents of the specified drawable. Each
+ * intensity channel is inverted independently. The inverted intensity
+ * is given as inten' = (255 - inten). If 'linear' is TRUE, the
+ * drawable is inverted in linear space.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_invert (gint32 drawable_ID,
+ gboolean linear)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-invert",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, linear,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_levels:
+ * @drawable_ID: The drawable.
+ * @channel: The channel to modify.
+ * @low_input: Intensity of lowest input.
+ * @high_input: Intensity of highest input.
+ * @clamp_input: Clamp input values before applying output levels.
+ * @gamma: Gamma adjustment factor.
+ * @low_output: Intensity of lowest output.
+ * @high_output: Intensity of highest output.
+ * @clamp_output: Clamp final output values.
+ *
+ * Modifies intensity levels in the specified drawable.
+ *
+ * This tool allows intensity levels in the specified drawable to be
+ * remapped according to a set of parameters. The low/high input levels
+ * specify an initial mapping from the source intensities. The gamma
+ * value determines how intensities between the low and high input
+ * intensities are interpolated. A gamma value of 1.0 results in a
+ * linear interpolation. Higher gamma values result in more high-level
+ * intensities. Lower gamma values result in more low-level
+ * intensities. The low/high output levels constrain the final
+ * intensity mapping--that is, no final intensity will be lower than
+ * the low output level and no final intensity will be higher than the
+ * high output level. This tool is only valid on RGB color and
+ * grayscale images.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_levels (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble low_input,
+ gdouble high_input,
+ gboolean clamp_input,
+ gdouble gamma,
+ gdouble low_output,
+ gdouble high_output,
+ gboolean clamp_output)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-levels",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, channel,
+ GIMP_PDB_FLOAT, low_input,
+ GIMP_PDB_FLOAT, high_input,
+ GIMP_PDB_INT32, clamp_input,
+ GIMP_PDB_FLOAT, gamma,
+ GIMP_PDB_FLOAT, low_output,
+ GIMP_PDB_FLOAT, high_output,
+ GIMP_PDB_INT32, clamp_output,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_levels_stretch:
+ * @drawable_ID: The drawable.
+ *
+ * Automatically modifies intensity levels in the specified drawable.
+ *
+ * This procedure allows intensity levels in the specified drawable to
+ * be remapped according to a set of guessed parameters. It is
+ * equivalent to clicking the \"Auto\" button in the Levels tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_levels_stretch (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-levels-stretch",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_shadows_highlights:
+ * @drawable_ID: The drawable.
+ * @shadows: Adjust exposure of shadows.
+ * @highlights: Adjust exposure of highlights.
+ * @whitepoint: Shift white point.
+ * @radius: Spatial extent.
+ * @compress: Compress the effect on shadows/highlights and preserve midtones.
+ * @shadows_ccorrect: Adjust saturation of shadows.
+ * @highlights_ccorrect: Adjust saturation of highlights.
+ *
+ * Perform shadows and highlights correction.
+ *
+ * This filter allows adjusting shadows and highlights in the image
+ * separately. The implementation closely follow its counterpart in the
+ * Darktable photography software.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10.34
+ **/
+gboolean
+gimp_drawable_shadows_highlights (gint32 drawable_ID,
+ gdouble shadows,
+ gdouble highlights,
+ gdouble whitepoint,
+ gdouble radius,
+ gdouble compress,
+ gdouble shadows_ccorrect,
+ gdouble highlights_ccorrect)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-shadows-highlights",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, shadows,
+ GIMP_PDB_FLOAT, highlights,
+ GIMP_PDB_FLOAT, whitepoint,
+ GIMP_PDB_FLOAT, radius,
+ GIMP_PDB_FLOAT, compress,
+ GIMP_PDB_FLOAT, shadows_ccorrect,
+ GIMP_PDB_FLOAT, highlights_ccorrect,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_posterize:
+ * @drawable_ID: The drawable.
+ * @levels: Levels of posterization.
+ *
+ * Posterize the specified drawable.
+ *
+ * This procedures reduces the number of shades allows in each
+ * intensity channel to the specified 'levels' parameter.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_posterize (gint32 drawable_ID,
+ gint levels)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-posterize",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, levels,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_threshold:
+ * @drawable_ID: The drawable.
+ * @channel: The channel to base the threshold on.
+ * @low_threshold: The low threshold value.
+ * @high_threshold: The high threshold value.
+ *
+ * Threshold the specified drawable.
+ *
+ * This procedures generates a threshold map of the specified drawable.
+ * All pixels between the values of 'low_threshold' and
+ * 'high_threshold', on the scale of 'channel' are replaced with white,
+ * and all other pixels with black.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_threshold (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble low_threshold,
+ gdouble high_threshold)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-threshold",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, channel,
+ GIMP_PDB_FLOAT, low_threshold,
+ GIMP_PDB_FLOAT, high_threshold,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpdrawablecolor_pdb.h b/libgimp/gimpdrawablecolor_pdb.h
new file mode 100644
index 0000000..5d7aa9e
--- /dev/null
+++ b/libgimp/gimpdrawablecolor_pdb.h
@@ -0,0 +1,110 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawablecolor_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_DRAWABLE_COLOR_PDB_H__
+#define __GIMP_DRAWABLE_COLOR_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_drawable_brightness_contrast (gint32 drawable_ID,
+ gdouble brightness,
+ gdouble contrast);
+gboolean gimp_drawable_color_balance (gint32 drawable_ID,
+ GimpTransferMode transfer_mode,
+ gboolean preserve_lum,
+ gdouble cyan_red,
+ gdouble magenta_green,
+ gdouble yellow_blue);
+gboolean gimp_drawable_colorize_hsl (gint32 drawable_ID,
+ gdouble hue,
+ gdouble saturation,
+ gdouble lightness);
+gboolean gimp_drawable_curves_explicit (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_values,
+ const gdouble *values);
+gboolean gimp_drawable_curves_spline (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_points,
+ const gdouble *points);
+gboolean gimp_drawable_extract_component (gint32 drawable_ID,
+ guint8 component,
+ gboolean invert,
+ gboolean linear);
+gboolean gimp_drawable_desaturate (gint32 drawable_ID,
+ GimpDesaturateMode desaturate_mode);
+gboolean gimp_drawable_equalize (gint32 drawable_ID,
+ gboolean mask_only);
+gboolean gimp_drawable_histogram (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble start_range,
+ gdouble end_range,
+ gdouble *mean,
+ gdouble *std_dev,
+ gdouble *median,
+ gdouble *pixels,
+ gdouble *count,
+ gdouble *percentile);
+gboolean gimp_drawable_hue_saturation (gint32 drawable_ID,
+ GimpHueRange hue_range,
+ gdouble hue_offset,
+ gdouble lightness,
+ gdouble saturation,
+ gdouble overlap);
+gboolean gimp_drawable_invert (gint32 drawable_ID,
+ gboolean linear);
+gboolean gimp_drawable_levels (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble low_input,
+ gdouble high_input,
+ gboolean clamp_input,
+ gdouble gamma,
+ gdouble low_output,
+ gdouble high_output,
+ gboolean clamp_output);
+gboolean gimp_drawable_levels_stretch (gint32 drawable_ID);
+gboolean gimp_drawable_shadows_highlights (gint32 drawable_ID,
+ gdouble shadows,
+ gdouble highlights,
+ gdouble whitepoint,
+ gdouble radius,
+ gdouble compress,
+ gdouble shadows_ccorrect,
+ gdouble highlights_ccorrect);
+gboolean gimp_drawable_posterize (gint32 drawable_ID,
+ gint levels);
+gboolean gimp_drawable_threshold (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble low_threshold,
+ gdouble high_threshold);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_DRAWABLE_COLOR_PDB_H__ */
diff --git a/libgimp/gimpdrawableedit_pdb.c b/libgimp/gimpdrawableedit_pdb.c
new file mode 100644
index 0000000..f8eb93b
--- /dev/null
+++ b/libgimp/gimpdrawableedit_pdb.c
@@ -0,0 +1,320 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawableedit_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpdrawableedit
+ * @title: gimpdrawableedit
+ * @short_description: Drawable edit functions (clear, fill, gradient, stroke etc.)
+ *
+ * Drawable edit functions (clear, fill, gradient, stroke etc.)
+ **/
+
+
+/**
+ * gimp_drawable_edit_clear:
+ * @drawable_ID: The drawable to clear from.
+ *
+ * Clear selected area of drawable.
+ *
+ * This procedure clears the specified drawable. If the drawable has an
+ * alpha channel, the cleared pixels will become transparent. If the
+ * drawable does not have an alpha channel, cleared pixels will be set
+ * to the background color. This procedure only affects regions within
+ * a selection if there is a selection active.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_background().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_edit_clear (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-edit-clear",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_edit_fill:
+ * @drawable_ID: The drawable to fill to.
+ * @fill_type: The type of fill.
+ *
+ * Fill selected area of drawable.
+ *
+ * This procedure fills the specified drawable according to fill mode.
+ * This procedure only affects regions within a selection if there is a
+ * selection active. If you want to fill the whole drawable, regardless
+ * of the selection, use gimp_drawable_fill().
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_foreground(), gimp_context_set_background(),
+ * gimp_context_set_pattern().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_edit_fill (gint32 drawable_ID,
+ GimpFillType fill_type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-edit-fill",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, fill_type,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_edit_bucket_fill:
+ * @drawable_ID: The affected drawable.
+ * @fill_type: The type of fill.
+ * @x: The x coordinate of this bucket fill's application.
+ * @y: The y coordinate of this bucket fill's application.
+ *
+ * Fill the area by a seed fill starting at the specified coordinates.
+ *
+ * This procedure does a seed fill at the specified coordinates, using
+ * various parameters from the current context.
+ * In the case of merged sampling, the x and y coordinates are relative
+ * to the image's origin; otherwise, they are relative to the
+ * drawable's origin.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_foreground(), gimp_context_set_background(),
+ * gimp_context_set_pattern(), gimp_context_set_sample_threshold(),
+ * gimp_context_set_sample_merged(),
+ * gimp_context_set_sample_criterion(),
+ * gimp_context_set_diagonal_neighbors(), gimp_context_set_antialias().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
+ GimpFillType fill_type,
+ gdouble x,
+ gdouble y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-edit-bucket-fill",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, fill_type,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_edit_gradient_fill:
+ * @drawable_ID: The affected drawable.
+ * @gradient_type: The type of gradient.
+ * @offset: Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode dependent.
+ * @supersample: Do adaptive supersampling.
+ * @supersample_max_depth: Maximum recursion levels for supersampling.
+ * @supersample_threshold: Supersampling threshold.
+ * @dither: Use dithering to reduce banding.
+ * @x1: The x coordinate of this gradient's starting point.
+ * @y1: The y coordinate of this gradient's starting point.
+ * @x2: The x coordinate of this gradient's ending point.
+ * @y2: The y coordinate of this gradient's ending point.
+ *
+ * Draw a gradient between the starting and ending coordinates with the
+ * specified gradient type.
+ *
+ * This tool requires information on the gradient type. It creates the
+ * specified variety of gradient using the starting and ending
+ * coordinates as defined for each gradient type. For shapeburst
+ * gradient types, the context's distance metric is also relevant and
+ * can be updated with gimp_context_set_distance_metric().
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_foreground(), gimp_context_set_background(),
+ * gimp_context_set_gradient() and all gradient property settings,
+ * gimp_context_set_distance_metric().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
+ GimpGradientType gradient_type,
+ gdouble offset,
+ gboolean supersample,
+ gint supersample_max_depth,
+ gdouble supersample_threshold,
+ gboolean dither,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-edit-gradient-fill",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, gradient_type,
+ GIMP_PDB_FLOAT, offset,
+ GIMP_PDB_INT32, supersample,
+ GIMP_PDB_INT32, supersample_max_depth,
+ GIMP_PDB_FLOAT, supersample_threshold,
+ GIMP_PDB_INT32, dither,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_FLOAT, x2,
+ GIMP_PDB_FLOAT, y2,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_edit_stroke_selection:
+ * @drawable_ID: The drawable to stroke to.
+ *
+ * Stroke the current selection
+ *
+ * This procedure strokes the current selection, painting along the
+ * selection boundary with the active paint method and brush, or using
+ * a plain line with configurable properties. The paint is applied to
+ * the specified drawable regardless of the active selection.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_paint_method(), gimp_context_set_stroke_method(),
+ * gimp_context_set_foreground(), gimp_context_set_brush() and all
+ * brush property settings, gimp_context_set_gradient() and all
+ * gradient property settings, gimp_context_set_line_width() and all
+ * line property settings, gimp_context_set_antialias().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_edit_stroke_selection (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-edit-stroke-selection",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_edit_stroke_item:
+ * @drawable_ID: The drawable to stroke to.
+ * @item_ID: The item to stroke.
+ *
+ * Stroke the specified item
+ *
+ * This procedure strokes the specified item, painting along its
+ * outline (e.g. along a path, or along a channel's boundary), with the
+ * active paint method and brush, or using a plain line with
+ * configurable properties.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_paint_method(), gimp_context_set_stroke_method(),
+ * gimp_context_set_foreground(), gimp_context_set_brush() and all
+ * brush property settings, gimp_context_set_gradient() and all
+ * gradient property settings, gimp_context_set_line_width() and all
+ * line property settings, gimp_context_set_antialias().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_edit_stroke_item (gint32 drawable_ID,
+ gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-edit-stroke-item",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpdrawableedit_pdb.h b/libgimp/gimpdrawableedit_pdb.h
new file mode 100644
index 0000000..5b63662
--- /dev/null
+++ b/libgimp/gimpdrawableedit_pdb.h
@@ -0,0 +1,60 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawableedit_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_DRAWABLE_EDIT_PDB_H__
+#define __GIMP_DRAWABLE_EDIT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_drawable_edit_clear (gint32 drawable_ID);
+gboolean gimp_drawable_edit_fill (gint32 drawable_ID,
+ GimpFillType fill_type);
+gboolean gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
+ GimpFillType fill_type,
+ gdouble x,
+ gdouble y);
+gboolean gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
+ GimpGradientType gradient_type,
+ gdouble offset,
+ gboolean supersample,
+ gint supersample_max_depth,
+ gdouble supersample_threshold,
+ gboolean dither,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2);
+gboolean gimp_drawable_edit_stroke_selection (gint32 drawable_ID);
+gboolean gimp_drawable_edit_stroke_item (gint32 drawable_ID,
+ gint32 item_ID);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_DRAWABLE_EDIT_PDB_H__ */
diff --git a/libgimp/gimpdrawablepreview.c b/libgimp/gimpdrawablepreview.c
new file mode 100644
index 0000000..dcdc6c2
--- /dev/null
+++ b/libgimp/gimpdrawablepreview.c
@@ -0,0 +1,757 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawablepreview.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+/* we use our own deprecated API here */
+#define GIMP_DISABLE_DEPRECATION_WARNINGS
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "gimpuitypes.h"
+
+#include "gimp.h"
+
+#include "gimpdrawablepreview.h"
+
+
+/**
+ * SECTION: gimpdrawablepreview
+ * @title: GimpDrawablePreview
+ * @short_description: A widget providing a preview of a #GimpDrawable.
+ *
+ * A widget providing a preview of a #GimpDrawable.
+ **/
+
+
+#define SELECTION_BORDER 8
+
+enum
+{
+ PROP_0,
+ PROP_DRAWABLE,
+ PROP_DRAWABLE_ID
+};
+
+typedef struct
+{
+ gint32 drawable_ID;
+} GimpDrawablePreviewPrivate;
+
+typedef struct
+{
+ gint x;
+ gint y;
+ gboolean update;
+} PreviewSettings;
+
+
+#define GIMP_DRAWABLE_PREVIEW_GET_PRIVATE(obj) \
+ ((GimpDrawablePreviewPrivate *) gimp_drawable_preview_get_instance_private ((GimpDrawablePreview *) (preview)))
+
+static void gimp_drawable_preview_constructed (GObject *object);
+static void gimp_drawable_preview_dispose (GObject *object);
+static void gimp_drawable_preview_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_drawable_preview_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_drawable_preview_style_set (GtkWidget *widget,
+ GtkStyle *prev_style);
+
+static void gimp_drawable_preview_draw_original (GimpPreview *preview);
+static void gimp_drawable_preview_draw_thumb (GimpPreview *preview,
+ GimpPreviewArea *area,
+ gint width,
+ gint height);
+static void gimp_drawable_preview_draw_buffer (GimpPreview *preview,
+ const guchar *buffer,
+ gint rowstride);
+
+static void gimp_drawable_preview_set_drawable (GimpDrawablePreview *preview,
+ GimpDrawable *drawable);
+static void gimp_drawable_preview_set_drawable_id
+ (GimpDrawablePreview *preview,
+ gint32 drawable_ID);
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpDrawablePreview, gimp_drawable_preview,
+ GIMP_TYPE_SCROLLED_PREVIEW)
+
+#define parent_class gimp_drawable_preview_parent_class
+
+static gint gimp_drawable_preview_counter = 0;
+
+
+static void
+gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
+
+ object_class->constructed = gimp_drawable_preview_constructed;
+ object_class->dispose = gimp_drawable_preview_dispose;
+ object_class->get_property = gimp_drawable_preview_get_property;
+ object_class->set_property = gimp_drawable_preview_set_property;
+
+ widget_class->style_set = gimp_drawable_preview_style_set;
+
+ preview_class->draw = gimp_drawable_preview_draw_original;
+ preview_class->draw_thumb = gimp_drawable_preview_draw_thumb;
+ preview_class->draw_buffer = gimp_drawable_preview_draw_buffer;
+
+ /**
+ * GimpDrawablePreview:drawable:
+ *
+ * Deprecated: use the drawable-id property instead.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_DRAWABLE,
+ g_param_spec_pointer ("drawable",
+ "Drawable",
+ "Deprecated: use the drawable-id property instead",
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * GimpDrawablePreview:drawable-id:
+ *
+ * The drawable the #GimpDrawablePreview is attached to.
+ *
+ * Since: 2.10
+ */
+ g_object_class_install_property (object_class, PROP_DRAWABLE_ID,
+ g_param_spec_int ("drawable-id",
+ "Drawable ID",
+ "The drawable this preview is attached to",
+ -1, G_MAXINT, -1,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+}
+
+static void
+gimp_drawable_preview_init (GimpDrawablePreview *preview)
+{
+ g_object_set (GIMP_PREVIEW (preview)->area,
+ "check-size", gimp_check_size (),
+ "check-type", gimp_check_type (),
+ NULL);
+}
+
+static void
+gimp_drawable_preview_constructed (GObject *object)
+{
+ gchar *data_name;
+ PreviewSettings settings;
+
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ data_name = g_strdup_printf ("%s-drawable-preview-%d",
+ g_get_prgname (),
+ ++gimp_drawable_preview_counter);
+
+ if (gimp_get_data (data_name, &settings))
+ {
+ gimp_preview_set_update (GIMP_PREVIEW (object), settings.update);
+ gimp_scrolled_preview_set_position (GIMP_SCROLLED_PREVIEW (object),
+ settings.x, settings.y);
+ }
+
+ g_object_set_data_full (object, "gimp-drawable-preview-data-name",
+ data_name, (GDestroyNotify) g_free);
+}
+
+static void
+gimp_drawable_preview_dispose (GObject *object)
+{
+ const gchar *data_name = g_object_get_data (G_OBJECT (object),
+ "gimp-drawable-preview-data-name");
+
+ if (data_name)
+ {
+ GimpPreview *preview = GIMP_PREVIEW (object);
+ PreviewSettings settings;
+
+ settings.x = preview->xoff + preview->xmin;
+ settings.y = preview->yoff + preview->ymin;
+ settings.update = gimp_preview_get_update (preview);
+
+ gimp_set_data (data_name, &settings, sizeof (PreviewSettings));
+ }
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+gimp_drawable_preview_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpDrawablePreview *preview = GIMP_DRAWABLE_PREVIEW (object);
+
+ switch (property_id)
+ {
+ case PROP_DRAWABLE:
+ g_value_set_pointer (value, preview->drawable);
+ break;
+
+ case PROP_DRAWABLE_ID:
+ g_value_set_int (value,
+ gimp_drawable_preview_get_drawable_id (preview));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_drawable_preview_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpDrawablePreview *preview = GIMP_DRAWABLE_PREVIEW (object);
+ GimpDrawablePreviewPrivate *priv = GIMP_DRAWABLE_PREVIEW_GET_PRIVATE (preview);
+
+ switch (property_id)
+ {
+ case PROP_DRAWABLE:
+ g_return_if_fail (priv->drawable_ID < 1);
+ if (g_value_get_pointer (value))
+ gimp_drawable_preview_set_drawable (preview,
+ g_value_get_pointer (value));
+ break;
+
+ case PROP_DRAWABLE_ID:
+ gimp_drawable_preview_set_drawable_id (preview,
+ g_value_get_int (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_drawable_preview_style_set (GtkWidget *widget,
+ GtkStyle *prev_style)
+{
+ GimpPreview *preview = GIMP_PREVIEW (widget);
+ gint width = preview->xmax - preview->xmin;
+ gint height = preview->ymax - preview->ymin;
+ gint size;
+
+ if (GTK_WIDGET_CLASS (parent_class)->style_set)
+ GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+
+ gtk_widget_style_get (widget,
+ "size", &size,
+ NULL);
+
+ gtk_widget_set_size_request (GIMP_PREVIEW (preview)->area,
+ MIN (width, size), MIN (height, size));
+}
+
+static void
+gimp_drawable_preview_draw_original (GimpPreview *preview)
+{
+ GimpDrawablePreviewPrivate *priv = GIMP_DRAWABLE_PREVIEW_GET_PRIVATE (preview);
+ guchar *buffer;
+ gint width, height;
+ gint bpp;
+ GimpImageType type;
+
+ if (priv->drawable_ID < 1)
+ return;
+
+ preview->xoff = CLAMP (preview->xoff,
+ 0, preview->xmax - preview->xmin - preview->width);
+ preview->yoff = CLAMP (preview->yoff,
+ 0, preview->ymax - preview->ymin - preview->height);
+
+ width = preview->width;
+ height = preview->height;
+
+ buffer = gimp_drawable_get_sub_thumbnail_data (priv->drawable_ID,
+ preview->xoff + preview->xmin,
+ preview->yoff + preview->ymin,
+ preview->width, preview->height,
+ &width, &height, &bpp);
+
+ switch (bpp)
+ {
+ case 1: type = GIMP_GRAY_IMAGE; break;
+ case 2: type = GIMP_GRAYA_IMAGE; break;
+ case 3: type = GIMP_RGB_IMAGE; break;
+ case 4: type = GIMP_RGBA_IMAGE; break;
+ default:
+ g_free (buffer);
+ return;
+ }
+
+ gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview->area),
+ 0, 0, width, height, type, buffer, width * bpp);
+ g_free (buffer);
+}
+
+static void
+gimp_drawable_preview_draw_thumb (GimpPreview *preview,
+ GimpPreviewArea *area,
+ gint width,
+ gint height)
+{
+ GimpDrawablePreviewPrivate *priv = GIMP_DRAWABLE_PREVIEW_GET_PRIVATE (preview);
+
+ if (priv->drawable_ID > 0)
+ _gimp_drawable_preview_area_draw_thumb (area, priv->drawable_ID,
+ width, height);
+}
+
+void
+_gimp_drawable_preview_area_draw_thumb (GimpPreviewArea *area,
+ gint32 drawable_ID,
+ gint width,
+ gint height)
+{
+ guchar *buffer;
+ gint x1, y1, x2, y2;
+ gint bpp;
+ gint size = 100;
+ gint nav_width, nav_height;
+
+ g_return_if_fail (GIMP_IS_PREVIEW_AREA (area));
+ g_return_if_fail (gimp_item_is_valid (drawable_ID));
+ g_return_if_fail (gimp_item_is_drawable (drawable_ID));
+
+ if (_gimp_drawable_preview_get_bounds (drawable_ID, &x1, &y1, &x2, &y2))
+ {
+ width = x2 - x1;
+ height = y2 - y1;
+ }
+ else
+ {
+ width = gimp_drawable_width (drawable_ID);
+ height = gimp_drawable_height (drawable_ID);
+ }
+
+ if (width > height)
+ {
+ nav_width = MIN (width, size);
+ nav_height = (height * nav_width) / width;
+ }
+ else
+ {
+ nav_height = MIN (height, size);
+ nav_width = (width * nav_height) / height;
+ }
+
+ if (_gimp_drawable_preview_get_bounds (drawable_ID, &x1, &y1, &x2, &y2))
+ {
+ buffer = gimp_drawable_get_sub_thumbnail_data (drawable_ID,
+ x1, y1, x2 - x1, y2 - y1,
+ &nav_width, &nav_height,
+ &bpp);
+ }
+ else
+ {
+ buffer = gimp_drawable_get_thumbnail_data (drawable_ID,
+ &nav_width, &nav_height,
+ &bpp);
+ }
+
+ if (buffer)
+ {
+ GimpImageType type;
+
+ gtk_widget_set_size_request (GTK_WIDGET (area), nav_width, nav_height);
+ gtk_widget_show (GTK_WIDGET (area));
+ gtk_widget_realize (GTK_WIDGET (area));
+
+ switch (bpp)
+ {
+ case 1: type = GIMP_GRAY_IMAGE; break;
+ case 2: type = GIMP_GRAYA_IMAGE; break;
+ case 3: type = GIMP_RGB_IMAGE; break;
+ case 4: type = GIMP_RGBA_IMAGE; break;
+ default:
+ g_free (buffer);
+ return;
+ }
+
+ gimp_preview_area_draw (area,
+ 0, 0, nav_width, nav_height,
+ type, buffer, bpp * nav_width);
+ g_free (buffer);
+ }
+}
+
+static void
+gimp_drawable_preview_draw_area (GimpDrawablePreview *preview,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ const guchar *buf,
+ gint rowstride)
+{
+ GimpDrawablePreviewPrivate *priv = GIMP_DRAWABLE_PREVIEW_GET_PRIVATE (preview);
+ GimpPreview *gimp_preview = GIMP_PREVIEW (preview);
+ gint32 image_ID;
+
+ image_ID = gimp_item_get_image (priv->drawable_ID);
+
+ if (gimp_selection_is_empty (image_ID))
+ {
+ gimp_preview_area_draw (GIMP_PREVIEW_AREA (gimp_preview->area),
+ x - gimp_preview->xoff - gimp_preview->xmin,
+ y - gimp_preview->yoff - gimp_preview->ymin,
+ width,
+ height,
+ gimp_drawable_type (priv->drawable_ID),
+ buf, rowstride);
+ }
+ else
+ {
+ gint offset_x, offset_y;
+ gint mask_x, mask_y;
+ gint mask_width, mask_height;
+ gint draw_x, draw_y;
+ gint draw_width, draw_height;
+
+ gimp_drawable_offsets (priv->drawable_ID, &offset_x, &offset_y);
+
+ if (gimp_drawable_mask_intersect (priv->drawable_ID,
+ &mask_x, &mask_y,
+ &mask_width, &mask_height) &&
+ gimp_rectangle_intersect (mask_x, mask_y,
+ mask_width, mask_height,
+ x, y, width, height,
+ &draw_x, &draw_y,
+ &draw_width, &draw_height))
+ {
+ GimpImageType type;
+ gint32 selection_ID;
+ guchar *src;
+ guchar *sel;
+ gint d_w, d_h, d_bpp;
+ gint s_w, s_h, s_bpp;
+
+ d_w = draw_width;
+ d_h = draw_height;
+
+ s_w = draw_width;
+ s_h = draw_height;
+
+ selection_ID = gimp_image_get_selection (image_ID);
+
+ src = gimp_drawable_get_sub_thumbnail_data (priv->drawable_ID,
+ draw_x, draw_y,
+ draw_width, draw_height,
+ &d_w, &d_h,
+ &d_bpp);
+
+ sel = gimp_drawable_get_sub_thumbnail_data (selection_ID,
+ draw_x + offset_x,
+ draw_y + offset_y,
+ draw_width, draw_height,
+ &s_w, &s_h,
+ &s_bpp);
+
+ switch (d_bpp)
+ {
+ case 1: type = GIMP_GRAY_IMAGE; break;
+ case 2: type = GIMP_GRAYA_IMAGE; break;
+ case 3: type = GIMP_RGB_IMAGE; break;
+ case 4: type = GIMP_RGBA_IMAGE; break;
+ default:
+ g_free (sel);
+ g_free (src);
+ return;
+ }
+
+ gimp_preview_area_mask (GIMP_PREVIEW_AREA (gimp_preview->area),
+ draw_x - gimp_preview->xoff - gimp_preview->xmin,
+ draw_y - gimp_preview->yoff - gimp_preview->ymin,
+ draw_width,
+ draw_height,
+ type,
+ src, draw_width * d_bpp,
+ (buf +
+ (draw_x - x) * d_bpp +
+ (draw_y - y) * d_w * d_bpp),
+ rowstride,
+ sel, s_w);
+
+ g_free (sel);
+ g_free (src);
+ }
+ }
+}
+
+static void
+gimp_drawable_preview_draw_buffer (GimpPreview *preview,
+ const guchar *buffer,
+ gint rowstride)
+{
+ gimp_drawable_preview_draw_area (GIMP_DRAWABLE_PREVIEW (preview),
+ preview->xmin + preview->xoff,
+ preview->ymin + preview->yoff,
+ preview->width,
+ preview->height,
+ buffer, rowstride);
+}
+
+static void
+gimp_drawable_preview_set_drawable (GimpDrawablePreview *drawable_preview,
+ GimpDrawable *drawable)
+{
+ GimpPreview *preview = GIMP_PREVIEW (drawable_preview);
+ GimpDrawablePreviewPrivate *priv = GIMP_DRAWABLE_PREVIEW_GET_PRIVATE (preview);
+
+ g_return_if_fail (drawable_preview->drawable == NULL);
+ g_return_if_fail (priv->drawable_ID < 1);
+
+ drawable_preview->drawable = drawable;
+
+ gimp_drawable_preview_set_drawable_id (drawable_preview,
+ drawable->drawable_id);
+}
+
+static void
+gimp_drawable_preview_set_drawable_id (GimpDrawablePreview *drawable_preview,
+ gint32 drawable_ID)
+{
+ GimpPreview *preview = GIMP_PREVIEW (drawable_preview);
+ GimpDrawablePreviewPrivate *priv = GIMP_DRAWABLE_PREVIEW_GET_PRIVATE (preview);
+ gint x1, y1, x2, y2;
+
+ g_return_if_fail (priv->drawable_ID < 1);
+
+ priv->drawable_ID = drawable_ID;
+
+ _gimp_drawable_preview_get_bounds (drawable_ID, &x1, &y1, &x2, &y2);
+
+ gimp_preview_set_bounds (preview, x1, y1, x2, y2);
+
+ if (gimp_drawable_is_indexed (drawable_ID))
+ {
+ guint32 image_ID = gimp_item_get_image (drawable_ID);
+ guchar *cmap;
+ gint num_colors;
+
+ cmap = gimp_image_get_colormap (image_ID, &num_colors);
+ gimp_preview_area_set_colormap (GIMP_PREVIEW_AREA (preview->area),
+ cmap, num_colors);
+ g_free (cmap);
+ }
+}
+
+
+#define MAX3(a, b, c) (MAX (MAX ((a), (b)), (c)))
+#define MIN3(a, b, c) (MIN (MIN ((a), (b)), (c)))
+
+gboolean
+_gimp_drawable_preview_get_bounds (gint32 drawable_ID,
+ gint *xmin,
+ gint *ymin,
+ gint *xmax,
+ gint *ymax)
+{
+ gint width;
+ gint height;
+ gint offset_x;
+ gint offset_y;
+ gint x1, y1;
+ gint x2, y2;
+ gboolean retval;
+
+ g_return_val_if_fail (gimp_item_is_valid (drawable_ID), FALSE);
+ g_return_val_if_fail (gimp_item_is_drawable (drawable_ID), FALSE);
+
+ width = gimp_drawable_width (drawable_ID);
+ height = gimp_drawable_height (drawable_ID);
+
+ retval = gimp_drawable_mask_bounds (drawable_ID, &x1, &y1, &x2, &y2);
+
+ gimp_drawable_offsets (drawable_ID, &offset_x, &offset_y);
+
+ *xmin = MAX3 (x1 - SELECTION_BORDER, 0, - offset_x);
+ *ymin = MAX3 (y1 - SELECTION_BORDER, 0, - offset_y);
+ *xmax = MIN3 (x2 + SELECTION_BORDER, width, width + offset_x);
+ *ymax = MIN3 (y2 + SELECTION_BORDER, height, height + offset_y);
+
+ return retval;
+}
+
+
+/**
+ * gimp_drawable_preview_new_from_drawable_id:
+ * @drawable_ID: a drawable ID
+ *
+ * Creates a new #GimpDrawablePreview widget for @drawable_ID.
+ *
+ * Returns: A pointer to the new #GimpDrawablePreview widget.
+ *
+ * Since: 2.10
+ **/
+GtkWidget *
+gimp_drawable_preview_new_from_drawable_id (gint32 drawable_ID)
+{
+ g_return_val_if_fail (gimp_item_is_valid (drawable_ID), NULL);
+ g_return_val_if_fail (gimp_item_is_drawable (drawable_ID), NULL);
+
+ return g_object_new (GIMP_TYPE_DRAWABLE_PREVIEW,
+ "drawable-id", drawable_ID,
+ NULL);
+}
+
+/**
+ * gimp_drawable_preview_get_drawable_id:
+ * @preview: a #GimpDrawablePreview widget
+ *
+ * Return value: the drawable_ID that has been passed to
+ * gimp_drawable_preview_new_from_drawable_id().
+ *
+ * Since: 2.10
+ **/
+gint32
+gimp_drawable_preview_get_drawable_id (GimpDrawablePreview *preview)
+{
+ g_return_val_if_fail (GIMP_IS_DRAWABLE_PREVIEW (preview), -1);
+
+ return GIMP_DRAWABLE_PREVIEW_GET_PRIVATE (preview)->drawable_ID;
+}
+
+/**
+ * gimp_drawable_preview_new:
+ * @drawable: a #GimpDrawable
+ * @toggle: unused
+ *
+ * Creates a new #GimpDrawablePreview widget for @drawable.
+ *
+ * In GIMP 2.2 the @toggle parameter was provided to conviently access
+ * the state of the "Preview" check-button. This is not any longer
+ * necessary as the preview itself now stores this state, as well as
+ * the scroll offset.
+ *
+ * Returns: A pointer to the new #GimpDrawablePreview widget.
+ *
+ * Deprecated: Use gimp_drawable_preview_new_from_drawable_id() instead.
+ *
+ * Since: 2.2
+ **/
+GtkWidget *
+gimp_drawable_preview_new (GimpDrawable *drawable,
+ gboolean *toggle)
+{
+ g_return_val_if_fail (drawable != NULL, NULL);
+
+ return g_object_new (GIMP_TYPE_DRAWABLE_PREVIEW,
+ "drawable", drawable,
+ NULL);
+}
+
+/**
+ * gimp_drawable_preview_get_drawable:
+ * @preview: a #GimpDrawablePreview widget
+ *
+ * Return value: the #GimpDrawable that has been passed to
+ * gimp_drawable_preview_new().
+ *
+ * Deprecated: use gimp_drawable_preview_get_drawable_id() instead.
+ *
+ * Since: 2.2
+ **/
+GimpDrawable *
+gimp_drawable_preview_get_drawable (GimpDrawablePreview *preview)
+{
+ g_return_val_if_fail (GIMP_IS_DRAWABLE_PREVIEW (preview), NULL);
+
+ return preview->drawable;
+}
+
+/**
+ * gimp_drawable_preview_draw_region:
+ * @preview: a #GimpDrawablePreview widget
+ * @region: a #GimpPixelRgn
+ *
+ * Since: 2.2
+ **/
+void
+gimp_drawable_preview_draw_region (GimpDrawablePreview *preview,
+ const GimpPixelRgn *region)
+{
+ GimpDrawablePreviewPrivate *priv;
+
+ g_return_if_fail (GIMP_IS_DRAWABLE_PREVIEW (preview));
+ g_return_if_fail (region != NULL);
+
+ priv = GIMP_DRAWABLE_PREVIEW_GET_PRIVATE (preview);
+
+ g_return_if_fail (priv->drawable_ID > 0);
+
+ /* If the data field is initialized, this region is currently being
+ * processed and we can access it directly.
+ */
+ if (region->data)
+ {
+ gimp_drawable_preview_draw_area (preview,
+ region->x,
+ region->y,
+ region->w,
+ region->h,
+ region->data,
+ region->rowstride);
+ }
+ else
+ {
+ GimpPixelRgn src = *region;
+ gpointer iter;
+
+ src.dirty = FALSE; /* we don't dirty the tiles, just read them */
+
+ for (iter = gimp_pixel_rgns_register (1, &src);
+ iter != NULL;
+ iter = gimp_pixel_rgns_process (iter))
+ {
+ gimp_drawable_preview_draw_area (preview,
+ src.x,
+ src.y,
+ src.w,
+ src.h,
+ src.data,
+ src.rowstride);
+ }
+ }
+}
diff --git a/libgimp/gimpdrawablepreview.h b/libgimp/gimpdrawablepreview.h
new file mode 100644
index 0000000..c442994
--- /dev/null
+++ b/libgimp/gimpdrawablepreview.h
@@ -0,0 +1,93 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawablepreview.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_DRAWABLE_PREVIEW_H__
+#define __GIMP_DRAWABLE_PREVIEW_H__
+
+G_BEGIN_DECLS
+
+
+/* For information look into the C source or the html documentation */
+
+
+#define GIMP_TYPE_DRAWABLE_PREVIEW (gimp_drawable_preview_get_type ())
+#define GIMP_DRAWABLE_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DRAWABLE_PREVIEW, GimpDrawablePreview))
+#define GIMP_DRAWABLE_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DRAWABLE_PREVIEW, GimpDrawablePreviewClass))
+#define GIMP_IS_DRAWABLE_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DRAWABLE_PREVIEW))
+#define GIMP_IS_DRAWABLE_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DRAWABLE_PREVIEW))
+#define GIMP_DRAWABLE_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DRAWABLE_PREVIEW, GimpDrawablePreviewClass))
+
+
+typedef struct _GimpDrawablePreviewClass GimpDrawablePreviewClass;
+
+struct _GimpDrawablePreview
+{
+ GimpScrolledPreview parent_instance;
+
+ GimpDrawable *drawable;
+};
+
+struct _GimpDrawablePreviewClass
+{
+ GimpScrolledPreviewClass parent_class;
+
+ /* Padding for future expansion */
+ void (* _gimp_reserved1) (void);
+ void (* _gimp_reserved2) (void);
+ void (* _gimp_reserved3) (void);
+ void (* _gimp_reserved4) (void);
+};
+
+
+GType gimp_drawable_preview_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_drawable_preview_new_from_drawable_id (gint32 drawable_ID);
+gint32 gimp_drawable_preview_get_drawable_id (GimpDrawablePreview *preview);
+
+GIMP_DEPRECATED_FOR(gimp_drawable_preview_new_from_drawable_id)
+GtkWidget * gimp_drawable_preview_new (GimpDrawable *drawable,
+ gboolean *toggle);
+GIMP_DEPRECATED_FOR(gimp_drawable_preview_get_drawable_id)
+GimpDrawable * gimp_drawable_preview_get_drawable (GimpDrawablePreview *preview);
+
+GIMP_DEPRECATED_FOR(gimp_preview_draw_buffer)
+void gimp_drawable_preview_draw_region (GimpDrawablePreview *preview,
+ const GimpPixelRgn *region);
+
+/* for internal use only */
+G_GNUC_INTERNAL void _gimp_drawable_preview_area_draw_thumb (GimpPreviewArea *area,
+ gint32 drawable_ID,
+ gint width,
+ gint height);
+G_GNUC_INTERNAL gboolean _gimp_drawable_preview_get_bounds (gint32 drawable_ID,
+ gint *xmin,
+ gint *ymin,
+ gint *xmax,
+ gint *ymax);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_DRAWABLE_PREVIEW_H__ */
+
diff --git a/libgimp/gimpdrawabletransform_pdb.c b/libgimp/gimpdrawabletransform_pdb.c
new file mode 100644
index 0000000..fa92d50
--- /dev/null
+++ b/libgimp/gimpdrawabletransform_pdb.c
@@ -0,0 +1,917 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawabletransform_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpdrawabletransform
+ * @title: gimpdrawabletransform
+ * @short_description: Functions to perform transformatrions on drawables.
+ *
+ * Functions to perform transformatrions on drawables.
+ **/
+
+
+/**
+ * gimp_drawable_transform_flip_simple:
+ * @drawable_ID: The affected drawable.
+ * @flip_type: Type of flip.
+ * @auto_center: Whether to automatically position the axis in the selection center.
+ * @axis: coord. of flip axis.
+ * @clip_result: Whether to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_flip_simple() instead.
+ *
+ * Returns: The flipped drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_flip_simple (gint32 drawable_ID,
+ GimpOrientationType flip_type,
+ gboolean auto_center,
+ gdouble axis,
+ gboolean clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-flip-simple",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, flip_type,
+ GIMP_PDB_INT32, auto_center,
+ GIMP_PDB_FLOAT, axis,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_flip:
+ * @drawable_ID: The affected drawable.
+ * @x0: horz. coord. of one end of axis.
+ * @y0: vert. coord. of one end of axis.
+ * @x1: horz. coord. of other end of axis.
+ * @y1: vert. coord. of other end of axis.
+ * @transform_direction: Direction of transformation.
+ * @interpolation: Type of interpolation.
+ * @supersample: This parameter is ignored.
+ * @recursion_level: This parameter is ignored.
+ * @clip_result: Whether to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_flip() instead.
+ *
+ * Returns: The flipped drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_flip (gint32 drawable_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ gboolean clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-flip",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_INT32, transform_direction,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_INT32, supersample,
+ GIMP_PDB_INT32, recursion_level,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_flip_default:
+ * @drawable_ID: The affected drawable.
+ * @x0: horz. coord. of one end of axis.
+ * @y0: vert. coord. of one end of axis.
+ * @x1: horz. coord. of other end of axis.
+ * @y1: vert. coord. of other end of axis.
+ * @interpolate: Whether to use interpolation and supersampling.
+ * @clip_result: Whether to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_flip() instead.
+ *
+ * Returns: The flipped drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_flip_default (gint32 drawable_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gboolean interpolate,
+ gboolean clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-flip-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_INT32, interpolate,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_perspective:
+ * @drawable_ID: The affected drawable.
+ * @x0: The new x coordinate of upper-left corner of original bounding box.
+ * @y0: The new y coordinate of upper-left corner of original bounding box.
+ * @x1: The new x coordinate of upper-right corner of original bounding box.
+ * @y1: The new y coordinate of upper-right corner of original bounding box.
+ * @x2: The new x coordinate of lower-left corner of original bounding box.
+ * @y2: The new y coordinate of lower-left corner of original bounding box.
+ * @x3: The new x coordinate of lower-right corner of original bounding box.
+ * @y3: The new y coordinate of lower-right corner of original bounding box.
+ * @transform_direction: Direction of transformation.
+ * @interpolation: Type of interpolation.
+ * @supersample: This parameter is ignored.
+ * @recursion_level: This parameter is ignored.
+ * @clip_result: How to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_perspective() instead.
+ *
+ * Returns: The newly mapped drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_perspective (gint32 drawable_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ gdouble x3,
+ gdouble y3,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ GimpTransformResize clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-perspective",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_FLOAT, x2,
+ GIMP_PDB_FLOAT, y2,
+ GIMP_PDB_FLOAT, x3,
+ GIMP_PDB_FLOAT, y3,
+ GIMP_PDB_INT32, transform_direction,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_INT32, supersample,
+ GIMP_PDB_INT32, recursion_level,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_perspective_default:
+ * @drawable_ID: The affected drawable.
+ * @x0: The new x coordinate of upper-left corner of original bounding box.
+ * @y0: The new y coordinate of upper-left corner of original bounding box.
+ * @x1: The new x coordinate of upper-right corner of original bounding box.
+ * @y1: The new y coordinate of upper-right corner of original bounding box.
+ * @x2: The new x coordinate of lower-left corner of original bounding box.
+ * @y2: The new y coordinate of lower-left corner of original bounding box.
+ * @x3: The new x coordinate of lower-right corner of original bounding box.
+ * @y3: The new y coordinate of lower-right corner of original bounding box.
+ * @interpolate: Whether to use interpolation and supersampling.
+ * @clip_result: How to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_perspective() instead.
+ *
+ * Returns: The newly mapped drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_perspective_default (gint32 drawable_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ gdouble x3,
+ gdouble y3,
+ gboolean interpolate,
+ GimpTransformResize clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-perspective-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_FLOAT, x2,
+ GIMP_PDB_FLOAT, y2,
+ GIMP_PDB_FLOAT, x3,
+ GIMP_PDB_FLOAT, y3,
+ GIMP_PDB_INT32, interpolate,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_rotate_simple:
+ * @drawable_ID: The affected drawable.
+ * @rotate_type: Type of rotation.
+ * @auto_center: Whether to automatically rotate around the selection center.
+ * @center_x: The hor. coordinate of the center of rotation.
+ * @center_y: The vert. coordinate of the center of rotation.
+ * @clip_result: Whether to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_rotate_simple() instead.
+ *
+ * Returns: The rotated drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_rotate_simple (gint32 drawable_ID,
+ GimpRotationType rotate_type,
+ gboolean auto_center,
+ gint center_x,
+ gint center_y,
+ gboolean clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-rotate-simple",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, rotate_type,
+ GIMP_PDB_INT32, auto_center,
+ GIMP_PDB_INT32, center_x,
+ GIMP_PDB_INT32, center_y,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_rotate:
+ * @drawable_ID: The affected drawable.
+ * @angle: The angle of rotation (radians).
+ * @auto_center: Whether to automatically rotate around the selection center.
+ * @center_x: The hor. coordinate of the center of rotation.
+ * @center_y: The vert. coordinate of the center of rotation.
+ * @transform_direction: Direction of transformation.
+ * @interpolation: Type of interpolation.
+ * @supersample: This parameter is ignored.
+ * @recursion_level: This parameter is ignored.
+ * @clip_result: How to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_rotate() instead.
+ *
+ * Returns: The rotated drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_rotate (gint32 drawable_ID,
+ gdouble angle,
+ gboolean auto_center,
+ gint center_x,
+ gint center_y,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ GimpTransformResize clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-rotate",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, angle,
+ GIMP_PDB_INT32, auto_center,
+ GIMP_PDB_INT32, center_x,
+ GIMP_PDB_INT32, center_y,
+ GIMP_PDB_INT32, transform_direction,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_INT32, supersample,
+ GIMP_PDB_INT32, recursion_level,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_rotate_default:
+ * @drawable_ID: The affected drawable.
+ * @angle: The angle of rotation (radians).
+ * @auto_center: Whether to automatically rotate around the selection center.
+ * @center_x: The hor. coordinate of the center of rotation.
+ * @center_y: The vert. coordinate of the center of rotation.
+ * @interpolate: Whether to use interpolation and supersampling.
+ * @clip_result: How to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_rotate() instead.
+ *
+ * Returns: The rotated drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_rotate_default (gint32 drawable_ID,
+ gdouble angle,
+ gboolean auto_center,
+ gint center_x,
+ gint center_y,
+ gboolean interpolate,
+ GimpTransformResize clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-rotate-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, angle,
+ GIMP_PDB_INT32, auto_center,
+ GIMP_PDB_INT32, center_x,
+ GIMP_PDB_INT32, center_y,
+ GIMP_PDB_INT32, interpolate,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_scale:
+ * @drawable_ID: The affected drawable.
+ * @x0: The new x coordinate of the upper-left corner of the scaled region.
+ * @y0: The new y coordinate of the upper-left corner of the scaled region.
+ * @x1: The new x coordinate of the lower-right corner of the scaled region.
+ * @y1: The new y coordinate of the lower-right corner of the scaled region.
+ * @transform_direction: Direction of transformation.
+ * @interpolation: Type of interpolation.
+ * @supersample: This parameter is ignored.
+ * @recursion_level: This parameter is ignored.
+ * @clip_result: How to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_scale() instead.
+ *
+ * Returns: The scaled drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_scale (gint32 drawable_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ GimpTransformResize clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-scale",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_INT32, transform_direction,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_INT32, supersample,
+ GIMP_PDB_INT32, recursion_level,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_scale_default:
+ * @drawable_ID: The affected drawable.
+ * @x0: The new x coordinate of the upper-left corner of the scaled region.
+ * @y0: The new y coordinate of the upper-left corner of the scaled region.
+ * @x1: The new x coordinate of the lower-right corner of the scaled region.
+ * @y1: The new y coordinate of the lower-right corner of the scaled region.
+ * @interpolate: Whether to use interpolation and supersampling.
+ * @clip_result: How to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_scale() instead.
+ *
+ * Returns: The scaled drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_scale_default (gint32 drawable_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gboolean interpolate,
+ GimpTransformResize clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-scale-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_INT32, interpolate,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_shear:
+ * @drawable_ID: The affected drawable.
+ * @shear_type: Type of shear.
+ * @magnitude: The magnitude of the shear.
+ * @transform_direction: Direction of transformation.
+ * @interpolation: Type of interpolation.
+ * @supersample: This parameter is ignored.
+ * @recursion_level: This parameter is ignored.
+ * @clip_result: How to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_shear() instead.
+ *
+ * Returns: The sheared drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_shear (gint32 drawable_ID,
+ GimpOrientationType shear_type,
+ gdouble magnitude,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ GimpTransformResize clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-shear",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, shear_type,
+ GIMP_PDB_FLOAT, magnitude,
+ GIMP_PDB_INT32, transform_direction,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_INT32, supersample,
+ GIMP_PDB_INT32, recursion_level,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_shear_default:
+ * @drawable_ID: The affected drawable.
+ * @shear_type: Type of shear.
+ * @magnitude: The magnitude of the shear.
+ * @interpolate: Whether to use interpolation and supersampling.
+ * @clip_result: How to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_shear() instead.
+ *
+ * Returns: The sheared drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_shear_default (gint32 drawable_ID,
+ GimpOrientationType shear_type,
+ gdouble magnitude,
+ gboolean interpolate,
+ GimpTransformResize clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-shear-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, shear_type,
+ GIMP_PDB_FLOAT, magnitude,
+ GIMP_PDB_INT32, interpolate,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_2d:
+ * @drawable_ID: The affected drawable.
+ * @source_x: X coordinate of the transformation center.
+ * @source_y: Y coordinate of the transformation center.
+ * @scale_x: Amount to scale in x direction.
+ * @scale_y: Amount to scale in y direction.
+ * @angle: The angle of rotation (radians).
+ * @dest_x: X coordinate of where the center goes.
+ * @dest_y: Y coordinate of where the center goes.
+ * @transform_direction: Direction of transformation.
+ * @interpolation: Type of interpolation.
+ * @supersample: This parameter is ignored.
+ * @recursion_level: This parameter is ignored.
+ * @clip_result: How to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_2d() instead.
+ *
+ * Returns: The transformed drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_2d (gint32 drawable_ID,
+ gdouble source_x,
+ gdouble source_y,
+ gdouble scale_x,
+ gdouble scale_y,
+ gdouble angle,
+ gdouble dest_x,
+ gdouble dest_y,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ GimpTransformResize clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-2d",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, source_x,
+ GIMP_PDB_FLOAT, source_y,
+ GIMP_PDB_FLOAT, scale_x,
+ GIMP_PDB_FLOAT, scale_y,
+ GIMP_PDB_FLOAT, angle,
+ GIMP_PDB_FLOAT, dest_x,
+ GIMP_PDB_FLOAT, dest_y,
+ GIMP_PDB_INT32, transform_direction,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_INT32, supersample,
+ GIMP_PDB_INT32, recursion_level,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_2d_default:
+ * @drawable_ID: The affected drawable.
+ * @source_x: X coordinate of the transformation center.
+ * @source_y: Y coordinate of the transformation center.
+ * @scale_x: Amount to scale in x direction.
+ * @scale_y: Amount to scale in y direction.
+ * @angle: The angle of rotation (radians).
+ * @dest_x: X coordinate of where the center goes.
+ * @dest_y: Y coordinate of where the center goes.
+ * @interpolate: Whether to use interpolation and supersampling.
+ * @clip_result: How to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_2d() instead.
+ *
+ * Returns: The transformed drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_2d_default (gint32 drawable_ID,
+ gdouble source_x,
+ gdouble source_y,
+ gdouble scale_x,
+ gdouble scale_y,
+ gdouble angle,
+ gdouble dest_x,
+ gdouble dest_y,
+ gboolean interpolate,
+ GimpTransformResize clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-2d-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, source_x,
+ GIMP_PDB_FLOAT, source_y,
+ GIMP_PDB_FLOAT, scale_x,
+ GIMP_PDB_FLOAT, scale_y,
+ GIMP_PDB_FLOAT, angle,
+ GIMP_PDB_FLOAT, dest_x,
+ GIMP_PDB_FLOAT, dest_y,
+ GIMP_PDB_INT32, interpolate,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_matrix:
+ * @drawable_ID: The affected drawable.
+ * @coeff_0_0: coefficient (0,0) of the transformation matrix.
+ * @coeff_0_1: coefficient (0,1) of the transformation matrix.
+ * @coeff_0_2: coefficient (0,2) of the transformation matrix.
+ * @coeff_1_0: coefficient (1,0) of the transformation matrix.
+ * @coeff_1_1: coefficient (1,1) of the transformation matrix.
+ * @coeff_1_2: coefficient (1,2) of the transformation matrix.
+ * @coeff_2_0: coefficient (2,0) of the transformation matrix.
+ * @coeff_2_1: coefficient (2,1) of the transformation matrix.
+ * @coeff_2_2: coefficient (2,2) of the transformation matrix.
+ * @transform_direction: Direction of transformation.
+ * @interpolation: Type of interpolation.
+ * @supersample: This parameter is ignored.
+ * @recursion_level: This parameter is ignored.
+ * @clip_result: How to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_matrix() instead.
+ *
+ * Returns: The transformed drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_matrix (gint32 drawable_ID,
+ gdouble coeff_0_0,
+ gdouble coeff_0_1,
+ gdouble coeff_0_2,
+ gdouble coeff_1_0,
+ gdouble coeff_1_1,
+ gdouble coeff_1_2,
+ gdouble coeff_2_0,
+ gdouble coeff_2_1,
+ gdouble coeff_2_2,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ GimpTransformResize clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-matrix",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, coeff_0_0,
+ GIMP_PDB_FLOAT, coeff_0_1,
+ GIMP_PDB_FLOAT, coeff_0_2,
+ GIMP_PDB_FLOAT, coeff_1_0,
+ GIMP_PDB_FLOAT, coeff_1_1,
+ GIMP_PDB_FLOAT, coeff_1_2,
+ GIMP_PDB_FLOAT, coeff_2_0,
+ GIMP_PDB_FLOAT, coeff_2_1,
+ GIMP_PDB_FLOAT, coeff_2_2,
+ GIMP_PDB_INT32, transform_direction,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_INT32, supersample,
+ GIMP_PDB_INT32, recursion_level,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_drawable_transform_matrix_default:
+ * @drawable_ID: The affected drawable.
+ * @coeff_0_0: coefficient (0,0) of the transformation matrix.
+ * @coeff_0_1: coefficient (0,1) of the transformation matrix.
+ * @coeff_0_2: coefficient (0,2) of the transformation matrix.
+ * @coeff_1_0: coefficient (1,0) of the transformation matrix.
+ * @coeff_1_1: coefficient (1,1) of the transformation matrix.
+ * @coeff_1_2: coefficient (1,2) of the transformation matrix.
+ * @coeff_2_0: coefficient (2,0) of the transformation matrix.
+ * @coeff_2_1: coefficient (2,1) of the transformation matrix.
+ * @coeff_2_2: coefficient (2,2) of the transformation matrix.
+ * @interpolate: Whether to use interpolation and supersampling.
+ * @clip_result: How to clip results.
+ *
+ * Deprecated: Use gimp_item_transform_matrix() instead.
+ *
+ * Returns: The transformed drawable.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_drawable_transform_matrix_default (gint32 drawable_ID,
+ gdouble coeff_0_0,
+ gdouble coeff_0_1,
+ gdouble coeff_0_2,
+ gdouble coeff_1_0,
+ gdouble coeff_1_1,
+ gdouble coeff_1_2,
+ gdouble coeff_2_0,
+ gdouble coeff_2_1,
+ gdouble coeff_2_2,
+ gboolean interpolate,
+ GimpTransformResize clip_result)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-transform-matrix-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, coeff_0_0,
+ GIMP_PDB_FLOAT, coeff_0_1,
+ GIMP_PDB_FLOAT, coeff_0_2,
+ GIMP_PDB_FLOAT, coeff_1_0,
+ GIMP_PDB_FLOAT, coeff_1_1,
+ GIMP_PDB_FLOAT, coeff_1_2,
+ GIMP_PDB_FLOAT, coeff_2_0,
+ GIMP_PDB_FLOAT, coeff_2_1,
+ GIMP_PDB_FLOAT, coeff_2_2,
+ GIMP_PDB_INT32, interpolate,
+ GIMP_PDB_INT32, clip_result,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
diff --git a/libgimp/gimpdrawabletransform_pdb.h b/libgimp/gimpdrawabletransform_pdb.h
new file mode 100644
index 0000000..5ec36f5
--- /dev/null
+++ b/libgimp/gimpdrawabletransform_pdb.h
@@ -0,0 +1,205 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawabletransform_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_DRAWABLE_TRANSFORM_PDB_H__
+#define __GIMP_DRAWABLE_TRANSFORM_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+GIMP_DEPRECATED_FOR(gimp_item_transform_flip_simple)
+gint32 gimp_drawable_transform_flip_simple (gint32 drawable_ID,
+ GimpOrientationType flip_type,
+ gboolean auto_center,
+ gdouble axis,
+ gboolean clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_flip)
+gint32 gimp_drawable_transform_flip (gint32 drawable_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ gboolean clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_flip)
+gint32 gimp_drawable_transform_flip_default (gint32 drawable_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gboolean interpolate,
+ gboolean clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_perspective)
+gint32 gimp_drawable_transform_perspective (gint32 drawable_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ gdouble x3,
+ gdouble y3,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ GimpTransformResize clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_perspective)
+gint32 gimp_drawable_transform_perspective_default (gint32 drawable_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ gdouble x3,
+ gdouble y3,
+ gboolean interpolate,
+ GimpTransformResize clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_rotate_simple)
+gint32 gimp_drawable_transform_rotate_simple (gint32 drawable_ID,
+ GimpRotationType rotate_type,
+ gboolean auto_center,
+ gint center_x,
+ gint center_y,
+ gboolean clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_rotate)
+gint32 gimp_drawable_transform_rotate (gint32 drawable_ID,
+ gdouble angle,
+ gboolean auto_center,
+ gint center_x,
+ gint center_y,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ GimpTransformResize clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_rotate)
+gint32 gimp_drawable_transform_rotate_default (gint32 drawable_ID,
+ gdouble angle,
+ gboolean auto_center,
+ gint center_x,
+ gint center_y,
+ gboolean interpolate,
+ GimpTransformResize clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_scale)
+gint32 gimp_drawable_transform_scale (gint32 drawable_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ GimpTransformResize clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_scale)
+gint32 gimp_drawable_transform_scale_default (gint32 drawable_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gboolean interpolate,
+ GimpTransformResize clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_shear)
+gint32 gimp_drawable_transform_shear (gint32 drawable_ID,
+ GimpOrientationType shear_type,
+ gdouble magnitude,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ GimpTransformResize clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_shear)
+gint32 gimp_drawable_transform_shear_default (gint32 drawable_ID,
+ GimpOrientationType shear_type,
+ gdouble magnitude,
+ gboolean interpolate,
+ GimpTransformResize clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_2d)
+gint32 gimp_drawable_transform_2d (gint32 drawable_ID,
+ gdouble source_x,
+ gdouble source_y,
+ gdouble scale_x,
+ gdouble scale_y,
+ gdouble angle,
+ gdouble dest_x,
+ gdouble dest_y,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ GimpTransformResize clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_2d)
+gint32 gimp_drawable_transform_2d_default (gint32 drawable_ID,
+ gdouble source_x,
+ gdouble source_y,
+ gdouble scale_x,
+ gdouble scale_y,
+ gdouble angle,
+ gdouble dest_x,
+ gdouble dest_y,
+ gboolean interpolate,
+ GimpTransformResize clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_matrix)
+gint32 gimp_drawable_transform_matrix (gint32 drawable_ID,
+ gdouble coeff_0_0,
+ gdouble coeff_0_1,
+ gdouble coeff_0_2,
+ gdouble coeff_1_0,
+ gdouble coeff_1_1,
+ gdouble coeff_1_2,
+ gdouble coeff_2_0,
+ gdouble coeff_2_1,
+ gdouble coeff_2_2,
+ GimpTransformDirection transform_direction,
+ GimpInterpolationType interpolation,
+ gboolean supersample,
+ gint recursion_level,
+ GimpTransformResize clip_result);
+GIMP_DEPRECATED_FOR(gimp_item_transform_matrix)
+gint32 gimp_drawable_transform_matrix_default (gint32 drawable_ID,
+ gdouble coeff_0_0,
+ gdouble coeff_0_1,
+ gdouble coeff_0_2,
+ gdouble coeff_1_0,
+ gdouble coeff_1_1,
+ gdouble coeff_1_2,
+ gdouble coeff_2_0,
+ gdouble coeff_2_1,
+ gdouble coeff_2_2,
+ gboolean interpolate,
+ GimpTransformResize clip_result);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_DRAWABLE_TRANSFORM_PDB_H__ */
diff --git a/libgimp/gimpdynamics_pdb.c b/libgimp/gimpdynamics_pdb.c
new file mode 100644
index 0000000..929ce35
--- /dev/null
+++ b/libgimp/gimpdynamics_pdb.c
@@ -0,0 +1,113 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdynamics_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpdynamics
+ * @title: gimpdynamics
+ * @short_description: Operations related to paint dynamics.
+ *
+ * Operations related to paint dynamics.
+ **/
+
+
+/**
+ * gimp_dynamics_refresh:
+ *
+ * Refresh current paint dynamics. This function always succeeds.
+ *
+ * This procedure retrieves all paint dynamics currently in the user's
+ * paint dynamics path and updates the paint dynamics dialogs
+ * accordingly.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_dynamics_refresh (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-dynamics-refresh",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_dynamics_get_list:
+ * @filter: An optional regular expression used to filter the list.
+ * @num_dynamics: The number of available paint dynamics.
+ *
+ * Retrieve the list of loaded paint dynamics.
+ *
+ * This procedure returns a list of the paint dynamics that are
+ * currently available.
+ *
+ * Returns: The list of paint dynamics names. The returned value must
+ * be freed with g_strfreev().
+ *
+ * Since: 2.8
+ **/
+gchar **
+gimp_dynamics_get_list (const gchar *filter,
+ gint *num_dynamics)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar **dynamics_list = NULL;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-dynamics-get-list",
+ &nreturn_vals,
+ GIMP_PDB_STRING, filter,
+ GIMP_PDB_END);
+
+ *num_dynamics = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_dynamics = return_vals[1].data.d_int32;
+ if (*num_dynamics > 0)
+ {
+ dynamics_list = g_new0 (gchar *, *num_dynamics + 1);
+ for (i = 0; i < *num_dynamics; i++)
+ dynamics_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return dynamics_list;
+}
diff --git a/libgimp/gimpdynamics_pdb.h b/libgimp/gimpdynamics_pdb.h
new file mode 100644
index 0000000..6623ffc
--- /dev/null
+++ b/libgimp/gimpdynamics_pdb.h
@@ -0,0 +1,42 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdynamics_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_DYNAMICS_PDB_H__
+#define __GIMP_DYNAMICS_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_dynamics_refresh (void);
+gchar** gimp_dynamics_get_list (const gchar *filter,
+ gint *num_dynamics);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_DYNAMICS_PDB_H__ */
diff --git a/libgimp/gimpedit.c b/libgimp/gimpedit.c
new file mode 100644
index 0000000..0dbf929
--- /dev/null
+++ b/libgimp/gimpedit.c
@@ -0,0 +1,67 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpedit.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * gimp_edit_paste_as_new:
+ *
+ * Paste buffer to a new image.
+ *
+ * This procedure pastes a copy of the internal GIMP edit buffer to a
+ * new image. The GIMP edit buffer will be empty unless a call was
+ * previously made to either gimp_edit_cut() or gimp_edit_copy(). This
+ * procedure returns the new image or -1 if the edit buffer was empty.
+ *
+ * Deprecated: Use gimp_edit_paste_as_new_image() instead.
+ *
+ * Returns: The new image.
+ *
+ * Since: 2.4
+ **/
+gint32
+gimp_edit_paste_as_new (void)
+{
+ return gimp_edit_paste_as_new_image ();
+}
+
+/**
+ * gimp_edit_named_paste_as_new:
+ * @buffer_name: The name of the buffer to paste.
+ *
+ * Paste named buffer to a new image.
+ *
+ * This procedure works like gimp_edit_paste_as_new_image() but pastes a
+ * named buffer instead of the global buffer.
+ *
+ * Deprecated: Use gimp_edit_named_paste_as_new_image() instead.
+ *
+ * Returns: The new image.
+ *
+ * Since: 2.4
+ **/
+gint32
+gimp_edit_named_paste_as_new (const gchar *buffer_name)
+{
+ return gimp_edit_named_paste_as_new_image (buffer_name);
+}
diff --git a/libgimp/gimpedit.h b/libgimp/gimpedit.h
new file mode 100644
index 0000000..d77a5f6
--- /dev/null
+++ b/libgimp/gimpedit.h
@@ -0,0 +1,41 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpedit.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_EDIT_H__
+#define __GIMP_EDIT_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+GIMP_DEPRECATED_FOR(gimp_edit_paste_as_new_image)
+gint32 gimp_edit_paste_as_new (void);
+
+GIMP_DEPRECATED_FOR(gimp_edit_named_paste_as_new_image)
+gint32 gimp_edit_named_paste_as_new (const gchar *buffer_name);
+
+G_END_DECLS
+
+#endif /* __GIMP_EDIT_H__ */
diff --git a/libgimp/gimpedit_pdb.c b/libgimp/gimpedit_pdb.c
new file mode 100644
index 0000000..76314a9
--- /dev/null
+++ b/libgimp/gimpedit_pdb.c
@@ -0,0 +1,781 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpedit_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpedit
+ * @title: gimpedit
+ * @short_description: Edit menu functions (cut, copy, paste, clear, etc.)
+ *
+ * Edit menu functions (cut, copy, paste, clear, etc.)
+ **/
+
+
+/**
+ * gimp_edit_cut:
+ * @drawable_ID: The drawable to cut from.
+ *
+ * Cut from the specified drawable.
+ *
+ * If there is a selection in the image, then the area specified by the
+ * selection is cut from the specified drawable and placed in an
+ * internal GIMP edit buffer. It can subsequently be retrieved using
+ * the gimp_edit_paste() command. If there is no selection, then the
+ * specified drawable will be removed and its contents stored in the
+ * internal GIMP edit buffer. This procedure will fail if the selected
+ * area lies completely outside the bounds of the current drawable and
+ * there is nothing to copy from.
+ *
+ * Returns: TRUE if the cut was successful, FALSE if there was nothing
+ * to copy from.
+ **/
+gboolean
+gimp_edit_cut (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean non_empty = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-edit-cut",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ non_empty = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return non_empty;
+}
+
+/**
+ * gimp_edit_copy:
+ * @drawable_ID: The drawable to copy from.
+ *
+ * Copy from the specified drawable.
+ *
+ * If there is a selection in the image, then the area specified by the
+ * selection is copied from the specified drawable and placed in an
+ * internal GIMP edit buffer. It can subsequently be retrieved using
+ * the gimp_edit_paste() command. If there is no selection, then the
+ * specified drawable's contents will be stored in the internal GIMP
+ * edit buffer. This procedure will fail if the selected area lies
+ * completely outside the bounds of the current drawable and there is
+ * nothing to copy from.
+ *
+ * Returns: TRUE if the cut was successful, FALSE if there was nothing
+ * to copy from.
+ **/
+gboolean
+gimp_edit_copy (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean non_empty = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-edit-copy",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ non_empty = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return non_empty;
+}
+
+/**
+ * gimp_edit_copy_visible:
+ * @image_ID: The image to copy from.
+ *
+ * Copy from the projection.
+ *
+ * If there is a selection in the image, then the area specified by the
+ * selection is copied from the projection and placed in an internal
+ * GIMP edit buffer. It can subsequently be retrieved using the
+ * gimp_edit_paste() command. If there is no selection, then the
+ * projection's contents will be stored in the internal GIMP edit
+ * buffer.
+ *
+ * Returns: TRUE if the copy was successful.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_edit_copy_visible (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean non_empty = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-edit-copy-visible",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ non_empty = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return non_empty;
+}
+
+/**
+ * gimp_edit_paste:
+ * @drawable_ID: The drawable to paste to.
+ * @paste_into: Clear selection, or paste behind it?
+ *
+ * Paste buffer to the specified drawable.
+ *
+ * This procedure pastes a copy of the internal GIMP edit buffer to the
+ * specified drawable. The GIMP edit buffer will be empty unless a call
+ * was previously made to either gimp_edit_cut() or gimp_edit_copy().
+ * The \"paste_into\" option specifies whether to clear the current
+ * image selection, or to paste the buffer \"behind\" the selection.
+ * This allows the selection to act as a mask for the pasted buffer.
+ * Anywhere that the selection mask is non-zero, the pasted buffer will
+ * show through. The pasted buffer will be a new layer in the image
+ * which is designated as the image floating selection. If the image
+ * has a floating selection at the time of pasting, the old floating
+ * selection will be anchored to its drawable before the new floating
+ * selection is added. This procedure returns the new floating layer.
+ * The resulting floating selection will already be attached to the
+ * specified drawable, and a subsequent call to floating_sel_attach is
+ * not needed.
+ *
+ * Returns: The new floating selection.
+ **/
+gint32
+gimp_edit_paste (gint32 drawable_ID,
+ gboolean paste_into)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 floating_sel_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-edit-paste",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, paste_into,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ floating_sel_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return floating_sel_ID;
+}
+
+/**
+ * gimp_edit_paste_as_new_image:
+ *
+ * Paste buffer to a new image.
+ *
+ * This procedure pastes a copy of the internal GIMP edit buffer to a
+ * new image. The GIMP edit buffer will be empty unless a call was
+ * previously made to either gimp_edit_cut() or gimp_edit_copy(). This
+ * procedure returns the new image or -1 if the edit buffer was empty.
+ *
+ * Returns: The new image.
+ *
+ * Since: 2.10
+ **/
+gint32
+gimp_edit_paste_as_new_image (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 image_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-edit-paste-as-new-image",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ image_ID = return_vals[1].data.d_image;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return image_ID;
+}
+
+/**
+ * gimp_edit_named_cut:
+ * @drawable_ID: The drawable to cut from.
+ * @buffer_name: The name of the buffer to create.
+ *
+ * Cut into a named buffer.
+ *
+ * This procedure works like gimp_edit_cut(), but additionally stores
+ * the cut buffer into a named buffer that will stay available for
+ * later pasting, regardless of any intermediate copy or cut
+ * operations.
+ *
+ * Returns: The real name given to the buffer, or NULL if the cut
+ * failed.
+ *
+ * Since: 2.4
+ **/
+gchar *
+gimp_edit_named_cut (gint32 drawable_ID,
+ const gchar *buffer_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *real_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-edit-named-cut",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_STRING, buffer_name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ real_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return real_name;
+}
+
+/**
+ * gimp_edit_named_copy:
+ * @drawable_ID: The drawable to copy from.
+ * @buffer_name: The name of the buffer to create.
+ *
+ * Copy into a named buffer.
+ *
+ * This procedure works like gimp_edit_copy(), but additionally stores
+ * the copied buffer into a named buffer that will stay available for
+ * later pasting, regardless of any intermediate copy or cut
+ * operations.
+ *
+ * Returns: The real name given to the buffer, or NULL if the copy
+ * failed.
+ *
+ * Since: 2.4
+ **/
+gchar *
+gimp_edit_named_copy (gint32 drawable_ID,
+ const gchar *buffer_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *real_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-edit-named-copy",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_STRING, buffer_name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ real_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return real_name;
+}
+
+/**
+ * gimp_edit_named_copy_visible:
+ * @image_ID: The image to copy from.
+ * @buffer_name: The name of the buffer to create.
+ *
+ * Copy from the projection into a named buffer.
+ *
+ * This procedure works like gimp_edit_copy_visible(), but additionally
+ * stores the copied buffer into a named buffer that will stay
+ * available for later pasting, regardless of any intermediate copy or
+ * cut operations.
+ *
+ * Returns: The real name given to the buffer, or NULL if the copy
+ * failed.
+ *
+ * Since: 2.4
+ **/
+gchar *
+gimp_edit_named_copy_visible (gint32 image_ID,
+ const gchar *buffer_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *real_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-edit-named-copy-visible",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, buffer_name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ real_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return real_name;
+}
+
+/**
+ * gimp_edit_named_paste:
+ * @drawable_ID: The drawable to paste to.
+ * @buffer_name: The name of the buffer to paste.
+ * @paste_into: Clear selection, or paste behind it?
+ *
+ * Paste named buffer to the specified drawable.
+ *
+ * This procedure works like gimp_edit_paste() but pastes a named
+ * buffer instead of the global buffer.
+ *
+ * Returns: The new floating selection.
+ *
+ * Since: 2.4
+ **/
+gint32
+gimp_edit_named_paste (gint32 drawable_ID,
+ const gchar *buffer_name,
+ gboolean paste_into)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 floating_sel_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-edit-named-paste",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_STRING, buffer_name,
+ GIMP_PDB_INT32, paste_into,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ floating_sel_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return floating_sel_ID;
+}
+
+/**
+ * gimp_edit_named_paste_as_new_image:
+ * @buffer_name: The name of the buffer to paste.
+ *
+ * Paste named buffer to a new image.
+ *
+ * This procedure works like gimp_edit_paste_as_new_image() but pastes
+ * a named buffer instead of the global buffer.
+ *
+ * Returns: The new image.
+ *
+ * Since: 2.10
+ **/
+gint32
+gimp_edit_named_paste_as_new_image (const gchar *buffer_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 image_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-edit-named-paste-as-new-image",
+ &nreturn_vals,
+ GIMP_PDB_STRING, buffer_name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ image_ID = return_vals[1].data.d_image;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return image_ID;
+}
+
+/**
+ * gimp_edit_clear:
+ * @drawable_ID: The drawable to clear from.
+ *
+ * Clear selected area of drawable.
+ *
+ * This procedure clears the specified drawable. If the drawable has an
+ * alpha channel, the cleared pixels will become transparent. If the
+ * drawable does not have an alpha channel, cleared pixels will be set
+ * to the background color. This procedure only affects regions within
+ * a selection if there is a selection active.
+ *
+ * Deprecated: Use gimp_drawable_edit_clear() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_edit_clear (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-edit-clear",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_edit_fill:
+ * @drawable_ID: The drawable to fill to.
+ * @fill_type: The type of fill.
+ *
+ * Fill selected area of drawable.
+ *
+ * This procedure fills the specified drawable with the fill mode. If
+ * the fill mode is foreground, the current foreground color is used.
+ * If the fill mode is background, the current background color is
+ * used. Other fill modes should not be used. This procedure only
+ * affects regions within a selection if there is a selection active.
+ * If you want to fill the whole drawable, regardless of the selection,
+ * use gimp_drawable_fill().
+ *
+ * Deprecated: Use gimp_drawable_edit_fill() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_edit_fill (gint32 drawable_ID,
+ GimpFillType fill_type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-edit-fill",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, fill_type,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_edit_bucket_fill:
+ * @drawable_ID: The affected drawable.
+ * @fill_mode: The type of fill.
+ * @paint_mode: The paint application mode.
+ * @opacity: The opacity of the final bucket fill.
+ * @threshold: The threshold determines how extensive the seed fill will be. It's value is specified in terms of intensity levels. This parameter is only valid when there is no selection in the specified image.
+ * @sample_merged: Use the composite image, not the drawable.
+ * @x: The x coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.
+ * @y: The y coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.
+ *
+ * Fill the area specified either by the current selection if there is
+ * one, or by a seed fill starting at the specified coordinates.
+ *
+ * This tool requires information on the paint application mode, and
+ * the fill mode, which can either be in the foreground color, or in
+ * the currently active pattern. If there is no selection, a seed fill
+ * is executed at the specified coordinates and extends outward in
+ * keeping with the threshold parameter. If there is a selection in the
+ * target image, the threshold, sample merged, x, and y arguments are
+ * unused. If the sample_merged parameter is TRUE, the data of the
+ * composite image will be used instead of that for the specified
+ * drawable. This is equivalent to sampling for colors after merging
+ * all visible layers. In the case of merged sampling, the x and y
+ * coordinates are relative to the image's origin; otherwise, they are
+ * relative to the drawable's origin.
+ *
+ * Deprecated: Use gimp_drawable_edit_bucket_fill() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_edit_bucket_fill (gint32 drawable_ID,
+ GimpBucketFillMode fill_mode,
+ GimpLayerMode paint_mode,
+ gdouble opacity,
+ gdouble threshold,
+ gboolean sample_merged,
+ gdouble x,
+ gdouble y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-edit-bucket-fill",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, fill_mode,
+ GIMP_PDB_INT32, paint_mode,
+ GIMP_PDB_FLOAT, opacity,
+ GIMP_PDB_FLOAT, threshold,
+ GIMP_PDB_INT32, sample_merged,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_edit_bucket_fill_full:
+ * @drawable_ID: The affected drawable.
+ * @fill_mode: The type of fill.
+ * @paint_mode: The paint application mode.
+ * @opacity: The opacity of the final bucket fill.
+ * @threshold: The threshold determines how extensive the seed fill will be. It's value is specified in terms of intensity levels. This parameter is only valid when there is no selection in the specified image.
+ * @sample_merged: Use the composite image, not the drawable.
+ * @fill_transparent: Whether to consider transparent pixels for filling. If TRUE, transparency is considered as a unique fillable color.
+ * @select_criterion: The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.
+ * @x: The x coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.
+ * @y: The y coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.
+ *
+ * Fill the area specified either by the current selection if there is
+ * one, or by a seed fill starting at the specified coordinates.
+ *
+ * This tool requires information on the paint application mode, and
+ * the fill mode, which can either be in the foreground color, or in
+ * the currently active pattern. If there is no selection, a seed fill
+ * is executed at the specified coordinates and extends outward in
+ * keeping with the threshold parameter. If there is a selection in the
+ * target image, the threshold, sample merged, x, and y arguments are
+ * unused. If the sample_merged parameter is TRUE, the data of the
+ * composite image will be used instead of that for the specified
+ * drawable. This is equivalent to sampling for colors after merging
+ * all visible layers. In the case of merged sampling, the x and y
+ * coordinates are relative to the image's origin; otherwise, they are
+ * relative to the drawable's origin.
+ *
+ * Deprecated: Use gimp_drawable_edit_bucket_fill() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_edit_bucket_fill_full (gint32 drawable_ID,
+ GimpBucketFillMode fill_mode,
+ GimpLayerMode paint_mode,
+ gdouble opacity,
+ gdouble threshold,
+ gboolean sample_merged,
+ gboolean fill_transparent,
+ GimpSelectCriterion select_criterion,
+ gdouble x,
+ gdouble y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-edit-bucket-fill-full",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, fill_mode,
+ GIMP_PDB_INT32, paint_mode,
+ GIMP_PDB_FLOAT, opacity,
+ GIMP_PDB_FLOAT, threshold,
+ GIMP_PDB_INT32, sample_merged,
+ GIMP_PDB_INT32, fill_transparent,
+ GIMP_PDB_INT32, select_criterion,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_edit_blend:
+ * @drawable_ID: The affected drawable.
+ * @blend_mode: The type of blend.
+ * @paint_mode: The paint application mode.
+ * @gradient_type: The type of gradient.
+ * @opacity: The opacity of the final blend.
+ * @offset: Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode dependent.
+ * @repeat: Repeat mode.
+ * @reverse: Use the reverse gradient.
+ * @supersample: Do adaptive supersampling.
+ * @max_depth: Maximum recursion levels for supersampling.
+ * @threshold: Supersampling threshold.
+ * @dither: Use dithering to reduce banding.
+ * @x1: The x coordinate of this blend's starting point.
+ * @y1: The y coordinate of this blend's starting point.
+ * @x2: The x coordinate of this blend's ending point.
+ * @y2: The y coordinate of this blend's ending point.
+ *
+ * Blend between the starting and ending coordinates with the specified
+ * blend mode and gradient type.
+ *
+ * This tool requires information on the paint application mode, the
+ * blend mode, and the gradient type. It creates the specified variety
+ * of blend using the starting and ending coordinates as defined for
+ * each gradient type. For shapeburst gradient types, the context's
+ * distance metric is also relevant and can be updated with
+ * gimp_context_set_distance_metric().
+ *
+ * Deprecated: Use gimp_drawable_edit_gradient_fill() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_edit_blend (gint32 drawable_ID,
+ GimpBlendMode blend_mode,
+ GimpLayerMode paint_mode,
+ GimpGradientType gradient_type,
+ gdouble opacity,
+ gdouble offset,
+ GimpRepeatMode repeat,
+ gboolean reverse,
+ gboolean supersample,
+ gint max_depth,
+ gdouble threshold,
+ gboolean dither,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-edit-blend",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, blend_mode,
+ GIMP_PDB_INT32, paint_mode,
+ GIMP_PDB_INT32, gradient_type,
+ GIMP_PDB_FLOAT, opacity,
+ GIMP_PDB_FLOAT, offset,
+ GIMP_PDB_INT32, repeat,
+ GIMP_PDB_INT32, reverse,
+ GIMP_PDB_INT32, supersample,
+ GIMP_PDB_INT32, max_depth,
+ GIMP_PDB_FLOAT, threshold,
+ GIMP_PDB_INT32, dither,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_FLOAT, x2,
+ GIMP_PDB_FLOAT, y2,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_edit_stroke:
+ * @drawable_ID: The drawable to stroke to.
+ *
+ * Stroke the current selection
+ *
+ * This procedure strokes the current selection, painting along the
+ * selection boundary with the active brush and foreground color. The
+ * paint is applied to the specified drawable regardless of the active
+ * selection.
+ *
+ * Deprecated: Use gimp_drawable_edit_stroke_selection() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_edit_stroke (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-edit-stroke",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_edit_stroke_vectors:
+ * @drawable_ID: The drawable to stroke to.
+ * @vectors_ID: The vectors object.
+ *
+ * Stroke the specified vectors object
+ *
+ * This procedure strokes the specified vectors object, painting along
+ * the path with the active brush and foreground color.
+ *
+ * Deprecated: Use gimp_drawable_edit_stroke_item() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_edit_stroke_vectors (gint32 drawable_ID,
+ gint32 vectors_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-edit-stroke-vectors",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpedit_pdb.h b/libgimp/gimpedit_pdb.h
new file mode 100644
index 0000000..4a3e1b7
--- /dev/null
+++ b/libgimp/gimpedit_pdb.h
@@ -0,0 +1,102 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpedit_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_EDIT_PDB_H__
+#define __GIMP_EDIT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_edit_cut (gint32 drawable_ID);
+gboolean gimp_edit_copy (gint32 drawable_ID);
+gboolean gimp_edit_copy_visible (gint32 image_ID);
+gint32 gimp_edit_paste (gint32 drawable_ID,
+ gboolean paste_into);
+gint32 gimp_edit_paste_as_new_image (void);
+gchar* gimp_edit_named_cut (gint32 drawable_ID,
+ const gchar *buffer_name);
+gchar* gimp_edit_named_copy (gint32 drawable_ID,
+ const gchar *buffer_name);
+gchar* gimp_edit_named_copy_visible (gint32 image_ID,
+ const gchar *buffer_name);
+gint32 gimp_edit_named_paste (gint32 drawable_ID,
+ const gchar *buffer_name,
+ gboolean paste_into);
+gint32 gimp_edit_named_paste_as_new_image (const gchar *buffer_name);
+GIMP_DEPRECATED_FOR(gimp_drawable_edit_clear)
+gboolean gimp_edit_clear (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_drawable_edit_fill)
+gboolean gimp_edit_fill (gint32 drawable_ID,
+ GimpFillType fill_type);
+GIMP_DEPRECATED_FOR(gimp_drawable_edit_bucket_fill)
+gboolean gimp_edit_bucket_fill (gint32 drawable_ID,
+ GimpBucketFillMode fill_mode,
+ GimpLayerMode paint_mode,
+ gdouble opacity,
+ gdouble threshold,
+ gboolean sample_merged,
+ gdouble x,
+ gdouble y);
+GIMP_DEPRECATED_FOR(gimp_drawable_edit_bucket_fill)
+gboolean gimp_edit_bucket_fill_full (gint32 drawable_ID,
+ GimpBucketFillMode fill_mode,
+ GimpLayerMode paint_mode,
+ gdouble opacity,
+ gdouble threshold,
+ gboolean sample_merged,
+ gboolean fill_transparent,
+ GimpSelectCriterion select_criterion,
+ gdouble x,
+ gdouble y);
+GIMP_DEPRECATED_FOR(gimp_drawable_edit_gradient_fill)
+gboolean gimp_edit_blend (gint32 drawable_ID,
+ GimpBlendMode blend_mode,
+ GimpLayerMode paint_mode,
+ GimpGradientType gradient_type,
+ gdouble opacity,
+ gdouble offset,
+ GimpRepeatMode repeat,
+ gboolean reverse,
+ gboolean supersample,
+ gint max_depth,
+ gdouble threshold,
+ gboolean dither,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2);
+GIMP_DEPRECATED_FOR(gimp_drawable_edit_stroke_selection)
+gboolean gimp_edit_stroke (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_drawable_edit_stroke_item)
+gboolean gimp_edit_stroke_vectors (gint32 drawable_ID,
+ gint32 vectors_ID);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_EDIT_PDB_H__ */
diff --git a/libgimp/gimpenums.c b/libgimp/gimpenums.c
new file mode 100644
index 0000000..a497cd8
--- /dev/null
+++ b/libgimp/gimpenums.c
@@ -0,0 +1,541 @@
+
+/* Generated data (by gimp-mkenums) */
+
+#include "config.h"
+#include <gio/gio.h>
+#include <gegl.h>
+#undef GIMP_DISABLE_DEPRECATED
+#include "libgimpbase/gimpbase.h"
+#include "libgimpbase/gimpbase-private.h"
+#include "libgimpconfig/gimpconfigenums.h"
+#include "gimpenums.h"
+
+/* enumerations from "../../libgimp/gimpenums.h" */
+GType
+gimp_brush_application_mode_get_type (void)
+{
+ static const GEnumValue values[] =
+ {
+ { GIMP_BRUSH_HARD, "GIMP_BRUSH_HARD", "hard" },
+ { GIMP_BRUSH_SOFT, "GIMP_BRUSH_SOFT", "soft" },
+ { 0, NULL, NULL }
+ };
+
+ static const GimpEnumDesc descs[] =
+ {
+ { GIMP_BRUSH_HARD, "GIMP_BRUSH_HARD", NULL },
+ { GIMP_BRUSH_SOFT, "GIMP_BRUSH_SOFT", NULL },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (G_UNLIKELY (! type))
+ {
+ type = g_enum_register_static ("GimpBrushApplicationMode", values);
+ gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
+ gimp_type_set_translation_context (type, "brush-application-mode");
+ gimp_enum_set_value_descriptions (type, descs);
+ }
+
+ return type;
+}
+
+GType
+gimp_convert_dither_type_get_type (void)
+{
+ static const GEnumValue values[] =
+ {
+ { GIMP_CONVERT_DITHER_NONE, "GIMP_CONVERT_DITHER_NONE", "none" },
+ { GIMP_CONVERT_DITHER_FS, "GIMP_CONVERT_DITHER_FS", "fs" },
+ { GIMP_CONVERT_DITHER_FS_LOWBLEED, "GIMP_CONVERT_DITHER_FS_LOWBLEED", "fs-lowbleed" },
+ { GIMP_CONVERT_DITHER_FIXED, "GIMP_CONVERT_DITHER_FIXED", "fixed" },
+ { 0, NULL, NULL }
+ };
+
+ static const GimpEnumDesc descs[] =
+ {
+ { GIMP_CONVERT_DITHER_NONE, "GIMP_CONVERT_DITHER_NONE", NULL },
+ { GIMP_CONVERT_DITHER_FS, "GIMP_CONVERT_DITHER_FS", NULL },
+ { GIMP_CONVERT_DITHER_FS_LOWBLEED, "GIMP_CONVERT_DITHER_FS_LOWBLEED", NULL },
+ { GIMP_CONVERT_DITHER_FIXED, "GIMP_CONVERT_DITHER_FIXED", NULL },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (G_UNLIKELY (! type))
+ {
+ type = g_enum_register_static ("GimpConvertDitherType", values);
+ gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
+ gimp_type_set_translation_context (type, "convert-dither-type");
+ gimp_enum_set_value_descriptions (type, descs);
+ }
+
+ return type;
+}
+
+GType
+gimp_histogram_channel_get_type (void)
+{
+ static const GEnumValue values[] =
+ {
+ { GIMP_HISTOGRAM_VALUE, "GIMP_HISTOGRAM_VALUE", "value" },
+ { GIMP_HISTOGRAM_RED, "GIMP_HISTOGRAM_RED", "red" },
+ { GIMP_HISTOGRAM_GREEN, "GIMP_HISTOGRAM_GREEN", "green" },
+ { GIMP_HISTOGRAM_BLUE, "GIMP_HISTOGRAM_BLUE", "blue" },
+ { GIMP_HISTOGRAM_ALPHA, "GIMP_HISTOGRAM_ALPHA", "alpha" },
+ { GIMP_HISTOGRAM_LUMINANCE, "GIMP_HISTOGRAM_LUMINANCE", "luminance" },
+ { 0, NULL, NULL }
+ };
+
+ static const GimpEnumDesc descs[] =
+ {
+ { GIMP_HISTOGRAM_VALUE, "GIMP_HISTOGRAM_VALUE", NULL },
+ { GIMP_HISTOGRAM_RED, "GIMP_HISTOGRAM_RED", NULL },
+ { GIMP_HISTOGRAM_GREEN, "GIMP_HISTOGRAM_GREEN", NULL },
+ { GIMP_HISTOGRAM_BLUE, "GIMP_HISTOGRAM_BLUE", NULL },
+ { GIMP_HISTOGRAM_ALPHA, "GIMP_HISTOGRAM_ALPHA", NULL },
+ { GIMP_HISTOGRAM_LUMINANCE, "GIMP_HISTOGRAM_LUMINANCE", NULL },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (G_UNLIKELY (! type))
+ {
+ type = g_enum_register_static ("GimpHistogramChannel", values);
+ gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
+ gimp_type_set_translation_context (type, "histogram-channel");
+ gimp_enum_set_value_descriptions (type, descs);
+ }
+
+ return type;
+}
+
+GType
+gimp_layer_color_space_get_type (void)
+{
+ static const GEnumValue values[] =
+ {
+ { GIMP_LAYER_COLOR_SPACE_AUTO, "GIMP_LAYER_COLOR_SPACE_AUTO", "auto" },
+ { GIMP_LAYER_COLOR_SPACE_RGB_LINEAR, "GIMP_LAYER_COLOR_SPACE_RGB_LINEAR", "rgb-linear" },
+ { GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL, "GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL", "rgb-perceptual" },
+ { 0, NULL, NULL }
+ };
+
+ static const GimpEnumDesc descs[] =
+ {
+ { GIMP_LAYER_COLOR_SPACE_AUTO, "GIMP_LAYER_COLOR_SPACE_AUTO", NULL },
+ { GIMP_LAYER_COLOR_SPACE_RGB_LINEAR, "GIMP_LAYER_COLOR_SPACE_RGB_LINEAR", NULL },
+ { GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL, "GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL", NULL },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (G_UNLIKELY (! type))
+ {
+ type = g_enum_register_static ("GimpLayerColorSpace", values);
+ gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
+ gimp_type_set_translation_context (type, "layer-color-space");
+ gimp_enum_set_value_descriptions (type, descs);
+ }
+
+ return type;
+}
+
+GType
+gimp_layer_composite_mode_get_type (void)
+{
+ static const GEnumValue values[] =
+ {
+ { GIMP_LAYER_COMPOSITE_AUTO, "GIMP_LAYER_COMPOSITE_AUTO", "auto" },
+ { GIMP_LAYER_COMPOSITE_UNION, "GIMP_LAYER_COMPOSITE_UNION", "union" },
+ { GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP, "GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP", "clip-to-backdrop" },
+ { GIMP_LAYER_COMPOSITE_CLIP_TO_LAYER, "GIMP_LAYER_COMPOSITE_CLIP_TO_LAYER", "clip-to-layer" },
+ { GIMP_LAYER_COMPOSITE_INTERSECTION, "GIMP_LAYER_COMPOSITE_INTERSECTION", "intersection" },
+ { 0, NULL, NULL }
+ };
+
+ static const GimpEnumDesc descs[] =
+ {
+ { GIMP_LAYER_COMPOSITE_AUTO, "GIMP_LAYER_COMPOSITE_AUTO", NULL },
+ { GIMP_LAYER_COMPOSITE_UNION, "GIMP_LAYER_COMPOSITE_UNION", NULL },
+ { GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP, "GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP", NULL },
+ { GIMP_LAYER_COMPOSITE_CLIP_TO_LAYER, "GIMP_LAYER_COMPOSITE_CLIP_TO_LAYER", NULL },
+ { GIMP_LAYER_COMPOSITE_INTERSECTION, "GIMP_LAYER_COMPOSITE_INTERSECTION", NULL },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (G_UNLIKELY (! type))
+ {
+ type = g_enum_register_static ("GimpLayerCompositeMode", values);
+ gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
+ gimp_type_set_translation_context (type, "layer-composite-mode");
+ gimp_enum_set_value_descriptions (type, descs);
+ }
+
+ return type;
+}
+
+GType
+gimp_layer_mode_get_type (void)
+{
+ static const GEnumValue values[] =
+ {
+ { GIMP_LAYER_MODE_NORMAL_LEGACY, "GIMP_LAYER_MODE_NORMAL_LEGACY", "normal-legacy" },
+ { GIMP_LAYER_MODE_DISSOLVE, "GIMP_LAYER_MODE_DISSOLVE", "dissolve" },
+ { GIMP_LAYER_MODE_BEHIND_LEGACY, "GIMP_LAYER_MODE_BEHIND_LEGACY", "behind-legacy" },
+ { GIMP_LAYER_MODE_MULTIPLY_LEGACY, "GIMP_LAYER_MODE_MULTIPLY_LEGACY", "multiply-legacy" },
+ { GIMP_LAYER_MODE_SCREEN_LEGACY, "GIMP_LAYER_MODE_SCREEN_LEGACY", "screen-legacy" },
+ { GIMP_LAYER_MODE_OVERLAY_LEGACY, "GIMP_LAYER_MODE_OVERLAY_LEGACY", "overlay-legacy" },
+ { GIMP_LAYER_MODE_DIFFERENCE_LEGACY, "GIMP_LAYER_MODE_DIFFERENCE_LEGACY", "difference-legacy" },
+ { GIMP_LAYER_MODE_ADDITION_LEGACY, "GIMP_LAYER_MODE_ADDITION_LEGACY", "addition-legacy" },
+ { GIMP_LAYER_MODE_SUBTRACT_LEGACY, "GIMP_LAYER_MODE_SUBTRACT_LEGACY", "subtract-legacy" },
+ { GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY, "GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY", "darken-only-legacy" },
+ { GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY, "GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY", "lighten-only-legacy" },
+ { GIMP_LAYER_MODE_HSV_HUE_LEGACY, "GIMP_LAYER_MODE_HSV_HUE_LEGACY", "hsv-hue-legacy" },
+ { GIMP_LAYER_MODE_HSV_SATURATION_LEGACY, "GIMP_LAYER_MODE_HSV_SATURATION_LEGACY", "hsv-saturation-legacy" },
+ { GIMP_LAYER_MODE_HSL_COLOR_LEGACY, "GIMP_LAYER_MODE_HSL_COLOR_LEGACY", "hsl-color-legacy" },
+ { GIMP_LAYER_MODE_HSV_VALUE_LEGACY, "GIMP_LAYER_MODE_HSV_VALUE_LEGACY", "hsv-value-legacy" },
+ { GIMP_LAYER_MODE_DIVIDE_LEGACY, "GIMP_LAYER_MODE_DIVIDE_LEGACY", "divide-legacy" },
+ { GIMP_LAYER_MODE_DODGE_LEGACY, "GIMP_LAYER_MODE_DODGE_LEGACY", "dodge-legacy" },
+ { GIMP_LAYER_MODE_BURN_LEGACY, "GIMP_LAYER_MODE_BURN_LEGACY", "burn-legacy" },
+ { GIMP_LAYER_MODE_HARDLIGHT_LEGACY, "GIMP_LAYER_MODE_HARDLIGHT_LEGACY", "hardlight-legacy" },
+ { GIMP_LAYER_MODE_SOFTLIGHT_LEGACY, "GIMP_LAYER_MODE_SOFTLIGHT_LEGACY", "softlight-legacy" },
+ { GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY, "GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY", "grain-extract-legacy" },
+ { GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY, "GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY", "grain-merge-legacy" },
+ { GIMP_LAYER_MODE_COLOR_ERASE_LEGACY, "GIMP_LAYER_MODE_COLOR_ERASE_LEGACY", "color-erase-legacy" },
+ { GIMP_LAYER_MODE_OVERLAY, "GIMP_LAYER_MODE_OVERLAY", "overlay" },
+ { GIMP_LAYER_MODE_LCH_HUE, "GIMP_LAYER_MODE_LCH_HUE", "lch-hue" },
+ { GIMP_LAYER_MODE_LCH_CHROMA, "GIMP_LAYER_MODE_LCH_CHROMA", "lch-chroma" },
+ { GIMP_LAYER_MODE_LCH_COLOR, "GIMP_LAYER_MODE_LCH_COLOR", "lch-color" },
+ { GIMP_LAYER_MODE_LCH_LIGHTNESS, "GIMP_LAYER_MODE_LCH_LIGHTNESS", "lch-lightness" },
+ { GIMP_LAYER_MODE_NORMAL, "GIMP_LAYER_MODE_NORMAL", "normal" },
+ { GIMP_LAYER_MODE_BEHIND, "GIMP_LAYER_MODE_BEHIND", "behind" },
+ { GIMP_LAYER_MODE_MULTIPLY, "GIMP_LAYER_MODE_MULTIPLY", "multiply" },
+ { GIMP_LAYER_MODE_SCREEN, "GIMP_LAYER_MODE_SCREEN", "screen" },
+ { GIMP_LAYER_MODE_DIFFERENCE, "GIMP_LAYER_MODE_DIFFERENCE", "difference" },
+ { GIMP_LAYER_MODE_ADDITION, "GIMP_LAYER_MODE_ADDITION", "addition" },
+ { GIMP_LAYER_MODE_SUBTRACT, "GIMP_LAYER_MODE_SUBTRACT", "subtract" },
+ { GIMP_LAYER_MODE_DARKEN_ONLY, "GIMP_LAYER_MODE_DARKEN_ONLY", "darken-only" },
+ { GIMP_LAYER_MODE_LIGHTEN_ONLY, "GIMP_LAYER_MODE_LIGHTEN_ONLY", "lighten-only" },
+ { GIMP_LAYER_MODE_HSV_HUE, "GIMP_LAYER_MODE_HSV_HUE", "hsv-hue" },
+ { GIMP_LAYER_MODE_HSV_SATURATION, "GIMP_LAYER_MODE_HSV_SATURATION", "hsv-saturation" },
+ { GIMP_LAYER_MODE_HSL_COLOR, "GIMP_LAYER_MODE_HSL_COLOR", "hsl-color" },
+ { GIMP_LAYER_MODE_HSV_VALUE, "GIMP_LAYER_MODE_HSV_VALUE", "hsv-value" },
+ { GIMP_LAYER_MODE_DIVIDE, "GIMP_LAYER_MODE_DIVIDE", "divide" },
+ { GIMP_LAYER_MODE_DODGE, "GIMP_LAYER_MODE_DODGE", "dodge" },
+ { GIMP_LAYER_MODE_BURN, "GIMP_LAYER_MODE_BURN", "burn" },
+ { GIMP_LAYER_MODE_HARDLIGHT, "GIMP_LAYER_MODE_HARDLIGHT", "hardlight" },
+ { GIMP_LAYER_MODE_SOFTLIGHT, "GIMP_LAYER_MODE_SOFTLIGHT", "softlight" },
+ { GIMP_LAYER_MODE_GRAIN_EXTRACT, "GIMP_LAYER_MODE_GRAIN_EXTRACT", "grain-extract" },
+ { GIMP_LAYER_MODE_GRAIN_MERGE, "GIMP_LAYER_MODE_GRAIN_MERGE", "grain-merge" },
+ { GIMP_LAYER_MODE_VIVID_LIGHT, "GIMP_LAYER_MODE_VIVID_LIGHT", "vivid-light" },
+ { GIMP_LAYER_MODE_PIN_LIGHT, "GIMP_LAYER_MODE_PIN_LIGHT", "pin-light" },
+ { GIMP_LAYER_MODE_LINEAR_LIGHT, "GIMP_LAYER_MODE_LINEAR_LIGHT", "linear-light" },
+ { GIMP_LAYER_MODE_HARD_MIX, "GIMP_LAYER_MODE_HARD_MIX", "hard-mix" },
+ { GIMP_LAYER_MODE_EXCLUSION, "GIMP_LAYER_MODE_EXCLUSION", "exclusion" },
+ { GIMP_LAYER_MODE_LINEAR_BURN, "GIMP_LAYER_MODE_LINEAR_BURN", "linear-burn" },
+ { GIMP_LAYER_MODE_LUMA_DARKEN_ONLY, "GIMP_LAYER_MODE_LUMA_DARKEN_ONLY", "luma-darken-only" },
+ { GIMP_LAYER_MODE_LUMA_LIGHTEN_ONLY, "GIMP_LAYER_MODE_LUMA_LIGHTEN_ONLY", "luma-lighten-only" },
+ { GIMP_LAYER_MODE_LUMINANCE, "GIMP_LAYER_MODE_LUMINANCE", "luminance" },
+ { GIMP_LAYER_MODE_COLOR_ERASE, "GIMP_LAYER_MODE_COLOR_ERASE", "color-erase" },
+ { GIMP_LAYER_MODE_ERASE, "GIMP_LAYER_MODE_ERASE", "erase" },
+ { GIMP_LAYER_MODE_MERGE, "GIMP_LAYER_MODE_MERGE", "merge" },
+ { GIMP_LAYER_MODE_SPLIT, "GIMP_LAYER_MODE_SPLIT", "split" },
+ { GIMP_LAYER_MODE_PASS_THROUGH, "GIMP_LAYER_MODE_PASS_THROUGH", "pass-through" },
+ { 0, NULL, NULL }
+ };
+
+ static const GimpEnumDesc descs[] =
+ {
+ { GIMP_LAYER_MODE_NORMAL_LEGACY, "GIMP_LAYER_MODE_NORMAL_LEGACY", NULL },
+ { GIMP_LAYER_MODE_DISSOLVE, "GIMP_LAYER_MODE_DISSOLVE", NULL },
+ { GIMP_LAYER_MODE_BEHIND_LEGACY, "GIMP_LAYER_MODE_BEHIND_LEGACY", NULL },
+ { GIMP_LAYER_MODE_MULTIPLY_LEGACY, "GIMP_LAYER_MODE_MULTIPLY_LEGACY", NULL },
+ { GIMP_LAYER_MODE_SCREEN_LEGACY, "GIMP_LAYER_MODE_SCREEN_LEGACY", NULL },
+ { GIMP_LAYER_MODE_OVERLAY_LEGACY, "GIMP_LAYER_MODE_OVERLAY_LEGACY", NULL },
+ { GIMP_LAYER_MODE_DIFFERENCE_LEGACY, "GIMP_LAYER_MODE_DIFFERENCE_LEGACY", NULL },
+ { GIMP_LAYER_MODE_ADDITION_LEGACY, "GIMP_LAYER_MODE_ADDITION_LEGACY", NULL },
+ { GIMP_LAYER_MODE_SUBTRACT_LEGACY, "GIMP_LAYER_MODE_SUBTRACT_LEGACY", NULL },
+ { GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY, "GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY", NULL },
+ { GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY, "GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY", NULL },
+ { GIMP_LAYER_MODE_HSV_HUE_LEGACY, "GIMP_LAYER_MODE_HSV_HUE_LEGACY", NULL },
+ { GIMP_LAYER_MODE_HSV_SATURATION_LEGACY, "GIMP_LAYER_MODE_HSV_SATURATION_LEGACY", NULL },
+ { GIMP_LAYER_MODE_HSL_COLOR_LEGACY, "GIMP_LAYER_MODE_HSL_COLOR_LEGACY", NULL },
+ { GIMP_LAYER_MODE_HSV_VALUE_LEGACY, "GIMP_LAYER_MODE_HSV_VALUE_LEGACY", NULL },
+ { GIMP_LAYER_MODE_DIVIDE_LEGACY, "GIMP_LAYER_MODE_DIVIDE_LEGACY", NULL },
+ { GIMP_LAYER_MODE_DODGE_LEGACY, "GIMP_LAYER_MODE_DODGE_LEGACY", NULL },
+ { GIMP_LAYER_MODE_BURN_LEGACY, "GIMP_LAYER_MODE_BURN_LEGACY", NULL },
+ { GIMP_LAYER_MODE_HARDLIGHT_LEGACY, "GIMP_LAYER_MODE_HARDLIGHT_LEGACY", NULL },
+ { GIMP_LAYER_MODE_SOFTLIGHT_LEGACY, "GIMP_LAYER_MODE_SOFTLIGHT_LEGACY", NULL },
+ { GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY, "GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY", NULL },
+ { GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY, "GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY", NULL },
+ { GIMP_LAYER_MODE_COLOR_ERASE_LEGACY, "GIMP_LAYER_MODE_COLOR_ERASE_LEGACY", NULL },
+ { GIMP_LAYER_MODE_OVERLAY, "GIMP_LAYER_MODE_OVERLAY", NULL },
+ { GIMP_LAYER_MODE_LCH_HUE, "GIMP_LAYER_MODE_LCH_HUE", NULL },
+ { GIMP_LAYER_MODE_LCH_CHROMA, "GIMP_LAYER_MODE_LCH_CHROMA", NULL },
+ { GIMP_LAYER_MODE_LCH_COLOR, "GIMP_LAYER_MODE_LCH_COLOR", NULL },
+ { GIMP_LAYER_MODE_LCH_LIGHTNESS, "GIMP_LAYER_MODE_LCH_LIGHTNESS", NULL },
+ { GIMP_LAYER_MODE_NORMAL, "GIMP_LAYER_MODE_NORMAL", NULL },
+ { GIMP_LAYER_MODE_BEHIND, "GIMP_LAYER_MODE_BEHIND", NULL },
+ { GIMP_LAYER_MODE_MULTIPLY, "GIMP_LAYER_MODE_MULTIPLY", NULL },
+ { GIMP_LAYER_MODE_SCREEN, "GIMP_LAYER_MODE_SCREEN", NULL },
+ { GIMP_LAYER_MODE_DIFFERENCE, "GIMP_LAYER_MODE_DIFFERENCE", NULL },
+ { GIMP_LAYER_MODE_ADDITION, "GIMP_LAYER_MODE_ADDITION", NULL },
+ { GIMP_LAYER_MODE_SUBTRACT, "GIMP_LAYER_MODE_SUBTRACT", NULL },
+ { GIMP_LAYER_MODE_DARKEN_ONLY, "GIMP_LAYER_MODE_DARKEN_ONLY", NULL },
+ { GIMP_LAYER_MODE_LIGHTEN_ONLY, "GIMP_LAYER_MODE_LIGHTEN_ONLY", NULL },
+ { GIMP_LAYER_MODE_HSV_HUE, "GIMP_LAYER_MODE_HSV_HUE", NULL },
+ { GIMP_LAYER_MODE_HSV_SATURATION, "GIMP_LAYER_MODE_HSV_SATURATION", NULL },
+ { GIMP_LAYER_MODE_HSL_COLOR, "GIMP_LAYER_MODE_HSL_COLOR", NULL },
+ { GIMP_LAYER_MODE_HSV_VALUE, "GIMP_LAYER_MODE_HSV_VALUE", NULL },
+ { GIMP_LAYER_MODE_DIVIDE, "GIMP_LAYER_MODE_DIVIDE", NULL },
+ { GIMP_LAYER_MODE_DODGE, "GIMP_LAYER_MODE_DODGE", NULL },
+ { GIMP_LAYER_MODE_BURN, "GIMP_LAYER_MODE_BURN", NULL },
+ { GIMP_LAYER_MODE_HARDLIGHT, "GIMP_LAYER_MODE_HARDLIGHT", NULL },
+ { GIMP_LAYER_MODE_SOFTLIGHT, "GIMP_LAYER_MODE_SOFTLIGHT", NULL },
+ { GIMP_LAYER_MODE_GRAIN_EXTRACT, "GIMP_LAYER_MODE_GRAIN_EXTRACT", NULL },
+ { GIMP_LAYER_MODE_GRAIN_MERGE, "GIMP_LAYER_MODE_GRAIN_MERGE", NULL },
+ { GIMP_LAYER_MODE_VIVID_LIGHT, "GIMP_LAYER_MODE_VIVID_LIGHT", NULL },
+ { GIMP_LAYER_MODE_PIN_LIGHT, "GIMP_LAYER_MODE_PIN_LIGHT", NULL },
+ { GIMP_LAYER_MODE_LINEAR_LIGHT, "GIMP_LAYER_MODE_LINEAR_LIGHT", NULL },
+ { GIMP_LAYER_MODE_HARD_MIX, "GIMP_LAYER_MODE_HARD_MIX", NULL },
+ { GIMP_LAYER_MODE_EXCLUSION, "GIMP_LAYER_MODE_EXCLUSION", NULL },
+ { GIMP_LAYER_MODE_LINEAR_BURN, "GIMP_LAYER_MODE_LINEAR_BURN", NULL },
+ { GIMP_LAYER_MODE_LUMA_DARKEN_ONLY, "GIMP_LAYER_MODE_LUMA_DARKEN_ONLY", NULL },
+ { GIMP_LAYER_MODE_LUMA_LIGHTEN_ONLY, "GIMP_LAYER_MODE_LUMA_LIGHTEN_ONLY", NULL },
+ { GIMP_LAYER_MODE_LUMINANCE, "GIMP_LAYER_MODE_LUMINANCE", NULL },
+ { GIMP_LAYER_MODE_COLOR_ERASE, "GIMP_LAYER_MODE_COLOR_ERASE", NULL },
+ { GIMP_LAYER_MODE_ERASE, "GIMP_LAYER_MODE_ERASE", NULL },
+ { GIMP_LAYER_MODE_MERGE, "GIMP_LAYER_MODE_MERGE", NULL },
+ { GIMP_LAYER_MODE_SPLIT, "GIMP_LAYER_MODE_SPLIT", NULL },
+ { GIMP_LAYER_MODE_PASS_THROUGH, "GIMP_LAYER_MODE_PASS_THROUGH", NULL },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (G_UNLIKELY (! type))
+ {
+ type = g_enum_register_static ("GimpLayerMode", values);
+ gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
+ gimp_type_set_translation_context (type, "layer-mode");
+ gimp_enum_set_value_descriptions (type, descs);
+ }
+
+ return type;
+}
+
+
+/* Generated data ends here */
+
+
+typedef GType (* GimpGetTypeFunc) (void);
+
+static const GimpGetTypeFunc get_type_funcs[] =
+{
+ gegl_distance_metric_get_type,
+ gimp_add_mask_type_get_type,
+ gimp_blend_mode_get_type,
+ gimp_brush_application_mode_get_type,
+ gimp_brush_generated_shape_get_type,
+ gimp_bucket_fill_mode_get_type,
+ gimp_cap_style_get_type,
+ gimp_channel_ops_get_type,
+ gimp_channel_type_get_type,
+ gimp_clone_type_get_type,
+ gimp_color_management_mode_get_type,
+ gimp_color_rendering_intent_get_type,
+ gimp_color_tag_get_type,
+ gimp_component_type_get_type,
+ gimp_convert_dither_type_get_type,
+ gimp_convert_palette_type_get_type,
+ gimp_convolve_type_get_type,
+ gimp_desaturate_mode_get_type,
+ gimp_dodge_burn_type_get_type,
+ gimp_fill_type_get_type,
+ gimp_foreground_extract_mode_get_type,
+ gimp_gradient_blend_color_space_get_type,
+ gimp_gradient_segment_color_get_type,
+ gimp_gradient_segment_type_get_type,
+ gimp_gradient_type_get_type,
+ gimp_grid_style_get_type,
+ gimp_histogram_channel_get_type,
+ gimp_hue_range_get_type,
+ gimp_icon_type_get_type,
+ gimp_image_base_type_get_type,
+ gimp_image_type_get_type,
+ gimp_ink_blob_type_get_type,
+ gimp_interpolation_type_get_type,
+ gimp_join_style_get_type,
+ gimp_layer_color_space_get_type,
+ gimp_layer_composite_mode_get_type,
+ gimp_layer_mode_get_type,
+ gimp_mask_apply_mode_get_type,
+ gimp_merge_type_get_type,
+ gimp_message_handler_type_get_type,
+ gimp_offset_type_get_type,
+ gimp_orientation_type_get_type,
+ gimp_pdb_arg_type_get_type,
+ gimp_pdb_error_handler_get_type,
+ gimp_pdb_proc_type_get_type,
+ gimp_pdb_status_type_get_type,
+ gimp_paint_application_mode_get_type,
+ gimp_precision_get_type,
+ gimp_progress_command_get_type,
+ gimp_repeat_mode_get_type,
+ gimp_rotation_type_get_type,
+ gimp_run_mode_get_type,
+ gimp_select_criterion_get_type,
+ gimp_size_type_get_type,
+ gimp_stack_trace_mode_get_type,
+ gimp_stroke_method_get_type,
+ gimp_text_direction_get_type,
+ gimp_text_hint_style_get_type,
+ gimp_text_justification_get_type,
+ gimp_transfer_mode_get_type,
+ gimp_transform_direction_get_type,
+ gimp_transform_resize_get_type,
+ gimp_user_directory_get_type,
+ gimp_vectors_stroke_type_get_type
+};
+
+static const gchar * const type_names[] =
+{
+ "GeglDistanceMetric",
+ "GimpAddMaskType",
+ "GimpBlendMode",
+ "GimpBrushApplicationMode",
+ "GimpBrushGeneratedShape",
+ "GimpBucketFillMode",
+ "GimpCapStyle",
+ "GimpChannelOps",
+ "GimpChannelType",
+ "GimpCloneType",
+ "GimpColorManagementMode",
+ "GimpColorRenderingIntent",
+ "GimpColorTag",
+ "GimpComponentType",
+ "GimpConvertDitherType",
+ "GimpConvertPaletteType",
+ "GimpConvolveType",
+ "GimpDesaturateMode",
+ "GimpDodgeBurnType",
+ "GimpFillType",
+ "GimpForegroundExtractMode",
+ "GimpGradientBlendColorSpace",
+ "GimpGradientSegmentColor",
+ "GimpGradientSegmentType",
+ "GimpGradientType",
+ "GimpGridStyle",
+ "GimpHistogramChannel",
+ "GimpHueRange",
+ "GimpIconType",
+ "GimpImageBaseType",
+ "GimpImageType",
+ "GimpInkBlobType",
+ "GimpInterpolationType",
+ "GimpJoinStyle",
+ "GimpLayerColorSpace",
+ "GimpLayerCompositeMode",
+ "GimpLayerMode",
+ "GimpMaskApplyMode",
+ "GimpMergeType",
+ "GimpMessageHandlerType",
+ "GimpOffsetType",
+ "GimpOrientationType",
+ "GimpPDBArgType",
+ "GimpPDBErrorHandler",
+ "GimpPDBProcType",
+ "GimpPDBStatusType",
+ "GimpPaintApplicationMode",
+ "GimpPrecision",
+ "GimpProgressCommand",
+ "GimpRepeatMode",
+ "GimpRotationType",
+ "GimpRunMode",
+ "GimpSelectCriterion",
+ "GimpSizeType",
+ "GimpStackTraceMode",
+ "GimpStrokeMethod",
+ "GimpTextDirection",
+ "GimpTextHintStyle",
+ "GimpTextJustification",
+ "GimpTransferMode",
+ "GimpTransformDirection",
+ "GimpTransformResize",
+ "GimpUserDirectory",
+ "GimpVectorsStrokeType"
+};
+
+static gboolean enums_initialized = FALSE;
+
+GType gimp_convert_dither_type_compat_get_type (void);
+GType gimp_layer_mode_effects_get_type (void);
+
+/**
+ * gimp_enums_init:
+ *
+ * This function makes sure all the enum types are registered
+ * with the #GType system. This is intended for use by language
+ * bindings that need the symbols early, before gimp_main is run.
+ * It's not necessary for plug-ins to call this directly, because
+ * the normal plug-in initialization code will handle it implicitly.
+ *
+ * Since: 2.4
+ **/
+void
+gimp_enums_init (void)
+{
+ const GimpGetTypeFunc *funcs = get_type_funcs;
+ GQuark quark;
+ gint i;
+
+ if (enums_initialized)
+ return;
+
+ for (i = 0; i < G_N_ELEMENTS (get_type_funcs); i++, funcs++)
+ {
+ GType type = (*funcs) ();
+
+ g_type_class_ref (type);
+ }
+
+ /* keep compat enum code in sync with app/app.c (app_libs_init) */
+ quark = g_quark_from_static_string ("gimp-compat-enum");
+
+ g_type_set_qdata (GIMP_TYPE_CONVERT_DITHER_TYPE, quark,
+ (gpointer) gimp_convert_dither_type_compat_get_type ());
+ g_type_set_qdata (GIMP_TYPE_LAYER_MODE, quark,
+ (gpointer) gimp_layer_mode_effects_get_type ());
+
+ gimp_base_compat_enums_init ();
+
+ enums_initialized = TRUE;
+}
+
+/**
+ * gimp_enums_get_type_names:
+ * @n_type_names: return location for the number of names
+ *
+ * This function gives access to the list of enums registered by libgimp.
+ * The returned array is static and must not be modified.
+ *
+ * Return value: an array with type names
+ *
+ * Since: 2.2
+ **/
+const gchar **
+gimp_enums_get_type_names (gint *n_type_names)
+{
+ g_return_val_if_fail (n_type_names != NULL, NULL);
+
+ *n_type_names = G_N_ELEMENTS (type_names);
+
+ return (const gchar **) type_names;
+}
diff --git a/libgimp/gimpenums.c.tail b/libgimp/gimpenums.c.tail
new file mode 100644
index 0000000..e8821e2
--- /dev/null
+++ b/libgimp/gimpenums.c.tail
@@ -0,0 +1,205 @@
+
+typedef GType (* GimpGetTypeFunc) (void);
+
+static const GimpGetTypeFunc get_type_funcs[] =
+{
+ gegl_distance_metric_get_type,
+ gimp_add_mask_type_get_type,
+ gimp_blend_mode_get_type,
+ gimp_brush_application_mode_get_type,
+ gimp_brush_generated_shape_get_type,
+ gimp_bucket_fill_mode_get_type,
+ gimp_cap_style_get_type,
+ gimp_channel_ops_get_type,
+ gimp_channel_type_get_type,
+ gimp_clone_type_get_type,
+ gimp_color_management_mode_get_type,
+ gimp_color_rendering_intent_get_type,
+ gimp_color_tag_get_type,
+ gimp_component_type_get_type,
+ gimp_convert_dither_type_get_type,
+ gimp_convert_palette_type_get_type,
+ gimp_convolve_type_get_type,
+ gimp_desaturate_mode_get_type,
+ gimp_dodge_burn_type_get_type,
+ gimp_fill_type_get_type,
+ gimp_foreground_extract_mode_get_type,
+ gimp_gradient_blend_color_space_get_type,
+ gimp_gradient_segment_color_get_type,
+ gimp_gradient_segment_type_get_type,
+ gimp_gradient_type_get_type,
+ gimp_grid_style_get_type,
+ gimp_histogram_channel_get_type,
+ gimp_hue_range_get_type,
+ gimp_icon_type_get_type,
+ gimp_image_base_type_get_type,
+ gimp_image_type_get_type,
+ gimp_ink_blob_type_get_type,
+ gimp_interpolation_type_get_type,
+ gimp_join_style_get_type,
+ gimp_layer_color_space_get_type,
+ gimp_layer_composite_mode_get_type,
+ gimp_layer_mode_get_type,
+ gimp_mask_apply_mode_get_type,
+ gimp_merge_type_get_type,
+ gimp_message_handler_type_get_type,
+ gimp_offset_type_get_type,
+ gimp_orientation_type_get_type,
+ gimp_pdb_arg_type_get_type,
+ gimp_pdb_error_handler_get_type,
+ gimp_pdb_proc_type_get_type,
+ gimp_pdb_status_type_get_type,
+ gimp_paint_application_mode_get_type,
+ gimp_precision_get_type,
+ gimp_progress_command_get_type,
+ gimp_repeat_mode_get_type,
+ gimp_rotation_type_get_type,
+ gimp_run_mode_get_type,
+ gimp_select_criterion_get_type,
+ gimp_size_type_get_type,
+ gimp_stack_trace_mode_get_type,
+ gimp_stroke_method_get_type,
+ gimp_text_direction_get_type,
+ gimp_text_hint_style_get_type,
+ gimp_text_justification_get_type,
+ gimp_transfer_mode_get_type,
+ gimp_transform_direction_get_type,
+ gimp_transform_resize_get_type,
+ gimp_user_directory_get_type,
+ gimp_vectors_stroke_type_get_type
+};
+
+static const gchar * const type_names[] =
+{
+ "GeglDistanceMetric",
+ "GimpAddMaskType",
+ "GimpBlendMode",
+ "GimpBrushApplicationMode",
+ "GimpBrushGeneratedShape",
+ "GimpBucketFillMode",
+ "GimpCapStyle",
+ "GimpChannelOps",
+ "GimpChannelType",
+ "GimpCloneType",
+ "GimpColorManagementMode",
+ "GimpColorRenderingIntent",
+ "GimpColorTag",
+ "GimpComponentType",
+ "GimpConvertDitherType",
+ "GimpConvertPaletteType",
+ "GimpConvolveType",
+ "GimpDesaturateMode",
+ "GimpDodgeBurnType",
+ "GimpFillType",
+ "GimpForegroundExtractMode",
+ "GimpGradientBlendColorSpace",
+ "GimpGradientSegmentColor",
+ "GimpGradientSegmentType",
+ "GimpGradientType",
+ "GimpGridStyle",
+ "GimpHistogramChannel",
+ "GimpHueRange",
+ "GimpIconType",
+ "GimpImageBaseType",
+ "GimpImageType",
+ "GimpInkBlobType",
+ "GimpInterpolationType",
+ "GimpJoinStyle",
+ "GimpLayerColorSpace",
+ "GimpLayerCompositeMode",
+ "GimpLayerMode",
+ "GimpMaskApplyMode",
+ "GimpMergeType",
+ "GimpMessageHandlerType",
+ "GimpOffsetType",
+ "GimpOrientationType",
+ "GimpPDBArgType",
+ "GimpPDBErrorHandler",
+ "GimpPDBProcType",
+ "GimpPDBStatusType",
+ "GimpPaintApplicationMode",
+ "GimpPrecision",
+ "GimpProgressCommand",
+ "GimpRepeatMode",
+ "GimpRotationType",
+ "GimpRunMode",
+ "GimpSelectCriterion",
+ "GimpSizeType",
+ "GimpStackTraceMode",
+ "GimpStrokeMethod",
+ "GimpTextDirection",
+ "GimpTextHintStyle",
+ "GimpTextJustification",
+ "GimpTransferMode",
+ "GimpTransformDirection",
+ "GimpTransformResize",
+ "GimpUserDirectory",
+ "GimpVectorsStrokeType"
+};
+
+static gboolean enums_initialized = FALSE;
+
+GType gimp_convert_dither_type_compat_get_type (void);
+GType gimp_layer_mode_effects_get_type (void);
+
+/**
+ * gimp_enums_init:
+ *
+ * This function makes sure all the enum types are registered
+ * with the #GType system. This is intended for use by language
+ * bindings that need the symbols early, before gimp_main is run.
+ * It's not necessary for plug-ins to call this directly, because
+ * the normal plug-in initialization code will handle it implicitly.
+ *
+ * Since: 2.4
+ **/
+void
+gimp_enums_init (void)
+{
+ const GimpGetTypeFunc *funcs = get_type_funcs;
+ GQuark quark;
+ gint i;
+
+ if (enums_initialized)
+ return;
+
+ for (i = 0; i < G_N_ELEMENTS (get_type_funcs); i++, funcs++)
+ {
+ GType type = (*funcs) ();
+
+ g_type_class_ref (type);
+ }
+
+ /* keep compat enum code in sync with app/app.c (app_libs_init) */
+ quark = g_quark_from_static_string ("gimp-compat-enum");
+
+ g_type_set_qdata (GIMP_TYPE_CONVERT_DITHER_TYPE, quark,
+ (gpointer) gimp_convert_dither_type_compat_get_type ());
+ g_type_set_qdata (GIMP_TYPE_LAYER_MODE, quark,
+ (gpointer) gimp_layer_mode_effects_get_type ());
+
+ gimp_base_compat_enums_init ();
+
+ enums_initialized = TRUE;
+}
+
+/**
+ * gimp_enums_get_type_names:
+ * @n_type_names: return location for the number of names
+ *
+ * This function gives access to the list of enums registered by libgimp.
+ * The returned array is static and must not be modified.
+ *
+ * Return value: an array with type names
+ *
+ * Since: 2.2
+ **/
+const gchar **
+gimp_enums_get_type_names (gint *n_type_names)
+{
+ g_return_val_if_fail (n_type_names != NULL, NULL);
+
+ *n_type_names = G_N_ELEMENTS (type_names);
+
+ return (const gchar **) type_names;
+}
diff --git a/libgimp/gimpenums.h b/libgimp/gimpenums.h
new file mode 100644
index 0000000..6265ee8
--- /dev/null
+++ b/libgimp/gimpenums.h
@@ -0,0 +1,170 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is autogenerated by enumcode.pl */
+
+#ifndef __GIMP_ENUMS_H__
+#define __GIMP_ENUMS_H__
+
+G_BEGIN_DECLS
+
+
+#define GIMP_TYPE_BRUSH_APPLICATION_MODE (gimp_brush_application_mode_get_type ())
+
+GType gimp_brush_application_mode_get_type (void) G_GNUC_CONST;
+
+typedef enum
+{
+ GIMP_BRUSH_HARD,
+ GIMP_BRUSH_SOFT
+} GimpBrushApplicationMode;
+
+
+#define GIMP_TYPE_CONVERT_DITHER_TYPE (gimp_convert_dither_type_get_type ())
+
+GType gimp_convert_dither_type_get_type (void) G_GNUC_CONST;
+
+typedef enum
+{
+ GIMP_CONVERT_DITHER_NONE,
+ GIMP_CONVERT_DITHER_FS,
+ GIMP_CONVERT_DITHER_FS_LOWBLEED,
+ GIMP_CONVERT_DITHER_FIXED
+} GimpConvertDitherType;
+
+
+#define GIMP_TYPE_HISTOGRAM_CHANNEL (gimp_histogram_channel_get_type ())
+
+GType gimp_histogram_channel_get_type (void) G_GNUC_CONST;
+
+typedef enum
+{
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_HISTOGRAM_RED,
+ GIMP_HISTOGRAM_GREEN,
+ GIMP_HISTOGRAM_BLUE,
+ GIMP_HISTOGRAM_ALPHA,
+ GIMP_HISTOGRAM_LUMINANCE
+} GimpHistogramChannel;
+
+
+#define GIMP_TYPE_LAYER_COLOR_SPACE (gimp_layer_color_space_get_type ())
+
+GType gimp_layer_color_space_get_type (void) G_GNUC_CONST;
+
+typedef enum
+{
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
+ GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
+} GimpLayerColorSpace;
+
+
+#define GIMP_TYPE_LAYER_COMPOSITE_MODE (gimp_layer_composite_mode_get_type ())
+
+GType gimp_layer_composite_mode_get_type (void) G_GNUC_CONST;
+
+typedef enum
+{
+ GIMP_LAYER_COMPOSITE_AUTO,
+ GIMP_LAYER_COMPOSITE_UNION,
+ GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
+ GIMP_LAYER_COMPOSITE_CLIP_TO_LAYER,
+ GIMP_LAYER_COMPOSITE_INTERSECTION
+} GimpLayerCompositeMode;
+
+
+#define GIMP_TYPE_LAYER_MODE (gimp_layer_mode_get_type ())
+
+GType gimp_layer_mode_get_type (void) G_GNUC_CONST;
+
+typedef enum
+{
+ GIMP_LAYER_MODE_NORMAL_LEGACY,
+ GIMP_LAYER_MODE_DISSOLVE,
+ GIMP_LAYER_MODE_BEHIND_LEGACY,
+ GIMP_LAYER_MODE_MULTIPLY_LEGACY,
+ GIMP_LAYER_MODE_SCREEN_LEGACY,
+ GIMP_LAYER_MODE_OVERLAY_LEGACY,
+ GIMP_LAYER_MODE_DIFFERENCE_LEGACY,
+ GIMP_LAYER_MODE_ADDITION_LEGACY,
+ GIMP_LAYER_MODE_SUBTRACT_LEGACY,
+ GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY,
+ GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY,
+ GIMP_LAYER_MODE_HSV_HUE_LEGACY,
+ GIMP_LAYER_MODE_HSV_SATURATION_LEGACY,
+ GIMP_LAYER_MODE_HSL_COLOR_LEGACY,
+ GIMP_LAYER_MODE_HSV_VALUE_LEGACY,
+ GIMP_LAYER_MODE_DIVIDE_LEGACY,
+ GIMP_LAYER_MODE_DODGE_LEGACY,
+ GIMP_LAYER_MODE_BURN_LEGACY,
+ GIMP_LAYER_MODE_HARDLIGHT_LEGACY,
+ GIMP_LAYER_MODE_SOFTLIGHT_LEGACY,
+ GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY,
+ GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY,
+ GIMP_LAYER_MODE_COLOR_ERASE_LEGACY,
+ GIMP_LAYER_MODE_OVERLAY,
+ GIMP_LAYER_MODE_LCH_HUE,
+ GIMP_LAYER_MODE_LCH_CHROMA,
+ GIMP_LAYER_MODE_LCH_COLOR,
+ GIMP_LAYER_MODE_LCH_LIGHTNESS,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_LAYER_MODE_BEHIND,
+ GIMP_LAYER_MODE_MULTIPLY,
+ GIMP_LAYER_MODE_SCREEN,
+ GIMP_LAYER_MODE_DIFFERENCE,
+ GIMP_LAYER_MODE_ADDITION,
+ GIMP_LAYER_MODE_SUBTRACT,
+ GIMP_LAYER_MODE_DARKEN_ONLY,
+ GIMP_LAYER_MODE_LIGHTEN_ONLY,
+ GIMP_LAYER_MODE_HSV_HUE,
+ GIMP_LAYER_MODE_HSV_SATURATION,
+ GIMP_LAYER_MODE_HSL_COLOR,
+ GIMP_LAYER_MODE_HSV_VALUE,
+ GIMP_LAYER_MODE_DIVIDE,
+ GIMP_LAYER_MODE_DODGE,
+ GIMP_LAYER_MODE_BURN,
+ GIMP_LAYER_MODE_HARDLIGHT,
+ GIMP_LAYER_MODE_SOFTLIGHT,
+ GIMP_LAYER_MODE_GRAIN_EXTRACT,
+ GIMP_LAYER_MODE_GRAIN_MERGE,
+ GIMP_LAYER_MODE_VIVID_LIGHT,
+ GIMP_LAYER_MODE_PIN_LIGHT,
+ GIMP_LAYER_MODE_LINEAR_LIGHT,
+ GIMP_LAYER_MODE_HARD_MIX,
+ GIMP_LAYER_MODE_EXCLUSION,
+ GIMP_LAYER_MODE_LINEAR_BURN,
+ GIMP_LAYER_MODE_LUMA_DARKEN_ONLY,
+ GIMP_LAYER_MODE_LUMA_LIGHTEN_ONLY,
+ GIMP_LAYER_MODE_LUMINANCE,
+ GIMP_LAYER_MODE_COLOR_ERASE,
+ GIMP_LAYER_MODE_ERASE,
+ GIMP_LAYER_MODE_MERGE,
+ GIMP_LAYER_MODE_SPLIT,
+ GIMP_LAYER_MODE_PASS_THROUGH
+} GimpLayerMode;
+
+
+void gimp_enums_init (void);
+
+const gchar ** gimp_enums_get_type_names (gint *n_type_names);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_ENUMS_H__ */
diff --git a/libgimp/gimpexport.c b/libgimp/gimpexport.c
new file mode 100644
index 0000000..e5621da
--- /dev/null
+++ b/libgimp/gimpexport.c
@@ -0,0 +1,1157 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpexport.c
+ * Copyright (C) 1999-2004 Sven Neumann <sven@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gtk/gtk.h>
+
+#include "gimp.h"
+#include "gimpui.h"
+
+#include "libgimp-intl.h"
+
+
+/**
+ * SECTION: gimpexport
+ * @title: gimpexport
+ * @short_description: Export an image before it is saved.
+ *
+ * This function should be called by all save_plugins unless they are
+ * able to save all image formats GIMP knows about. It takes care of
+ * asking the user if she wishes to export the image to a format the
+ * save_plugin can handle. It then performs the necessary conversions
+ * (e.g. Flatten) on a copy of the image so that the image can be
+ * saved without changing the original image.
+ *
+ * The capabilities of the save_plugin are specified by combining
+ * #GimpExportCapabilities using a bitwise OR.
+ *
+ * Make sure you have initialized GTK+ before you call this function
+ * as it will most probably have to open a dialog.
+ **/
+
+
+typedef void (* ExportFunc) (gint32 imageID,
+ gint32 *drawable_ID);
+
+
+/* the export action structure */
+typedef struct
+{
+ ExportFunc default_action;
+ ExportFunc alt_action;
+ const gchar *reason;
+ const gchar *possibilities[2];
+ gint choice;
+} ExportAction;
+
+
+/* the functions that do the actual export */
+
+static void
+export_merge (gint32 image_ID,
+ gint32 *drawable_ID)
+{
+ gint32 nlayers;
+ gint32 nvisible = 0;
+ gint32 i;
+ gint32 *layers;
+ gint32 merged;
+ gint32 transp;
+
+ layers = gimp_image_get_layers (image_ID, &nlayers);
+ for (i = 0; i < nlayers; i++)
+ {
+ if (gimp_item_get_visible (layers[i]))
+ nvisible++;
+ }
+
+ if (nvisible <= 1)
+ {
+ /* if there is only one (or zero) visible layer, add a new
+ * transparent layer that has the same size as the canvas. The
+ * merge that follows will ensure that the offset, opacity and
+ * size are correct
+ */
+ transp = gimp_layer_new (image_ID, "-",
+ gimp_image_width (image_ID),
+ gimp_image_height (image_ID),
+ gimp_drawable_type (*drawable_ID) | 1,
+ 100.0, GIMP_LAYER_MODE_NORMAL);
+ gimp_image_insert_layer (image_ID, transp, -1, 1);
+ gimp_selection_none (image_ID);
+ gimp_drawable_edit_clear (transp);
+ nvisible++;
+ }
+
+ if (nvisible > 1)
+ {
+ g_free (layers);
+ merged = gimp_image_merge_visible_layers (image_ID, GIMP_CLIP_TO_IMAGE);
+
+ if (merged != -1)
+ *drawable_ID = merged;
+ else
+ return; /* shouldn't happen */
+
+ layers = gimp_image_get_layers (image_ID, &nlayers);
+
+ /* make sure that the merged drawable matches the image size */
+ if (gimp_drawable_width (merged) != gimp_image_width (image_ID) ||
+ gimp_drawable_height (merged) != gimp_image_height (image_ID))
+ {
+ gint off_x, off_y;
+
+ gimp_drawable_offsets (merged, &off_x, &off_y);
+ gimp_layer_resize (merged,
+ gimp_image_width (image_ID),
+ gimp_image_height (image_ID),
+ off_x, off_y);
+ }
+ }
+
+ /* remove any remaining (invisible) layers */
+ for (i = 0; i < nlayers; i++)
+ {
+ if (layers[i] != *drawable_ID)
+ gimp_image_remove_layer (image_ID, layers[i]);
+ }
+ g_free (layers);
+}
+
+static void
+export_flatten (gint32 image_ID,
+ gint32 *drawable_ID)
+{
+ gint32 flattened;
+
+ flattened = gimp_image_flatten (image_ID);
+
+ if (flattened != -1)
+ *drawable_ID = flattened;
+}
+
+static void
+export_remove_alpha (gint32 image_ID,
+ gint32 *drawable_ID)
+{
+ gint32 n_layers;
+ gint32 *layers;
+ gint i;
+
+ layers = gimp_image_get_layers (image_ID, &n_layers);
+
+ for (i = 0; i < n_layers; i++)
+ {
+ if (gimp_drawable_has_alpha (layers[i]))
+ gimp_layer_flatten (layers[i]);
+ }
+
+ g_free (layers);
+}
+
+static void
+export_apply_masks (gint32 image_ID,
+ gint *drawable_ID)
+{
+ gint32 n_layers;
+ gint32 *layers;
+ gint i;
+
+ layers = gimp_image_get_layers (image_ID, &n_layers);
+
+ for (i = 0; i < n_layers; i++)
+ {
+ if (gimp_layer_get_mask (layers[i]) != -1)
+ {
+ /* we can't apply the mask directly to a layer group, so merge it
+ * first
+ */
+ if (gimp_item_is_group (layers[i]))
+ layers[i] = gimp_image_merge_layer_group (image_ID, layers[i]);
+
+ gimp_layer_remove_mask (layers[i], GIMP_MASK_APPLY);
+ }
+ }
+
+ g_free (layers);
+}
+
+static void
+export_convert_rgb (gint32 image_ID,
+ gint32 *drawable_ID)
+{
+ gimp_image_convert_rgb (image_ID);
+}
+
+static void
+export_convert_grayscale (gint32 image_ID,
+ gint32 *drawable_ID)
+{
+ gimp_image_convert_grayscale (image_ID);
+}
+
+static void
+export_convert_indexed (gint32 image_ID,
+ gint32 *drawable_ID)
+{
+ gint32 nlayers;
+
+ /* check alpha */
+ g_free (gimp_image_get_layers (image_ID, &nlayers));
+ if (nlayers > 1 || gimp_drawable_has_alpha (*drawable_ID))
+ gimp_image_convert_indexed (image_ID,
+ GIMP_CONVERT_DITHER_NONE,
+ GIMP_CONVERT_PALETTE_GENERATE,
+ 255, FALSE, FALSE, "");
+ else
+ gimp_image_convert_indexed (image_ID,
+ GIMP_CONVERT_DITHER_NONE,
+ GIMP_CONVERT_PALETTE_GENERATE,
+ 256, FALSE, FALSE, "");
+}
+
+static void
+export_convert_bitmap (gint32 image_ID,
+ gint32 *drawable_ID)
+{
+ if (gimp_image_base_type (image_ID) == GIMP_INDEXED)
+ gimp_image_convert_rgb (image_ID);
+
+ gimp_image_convert_indexed (image_ID,
+ GIMP_CONVERT_DITHER_FS,
+ GIMP_CONVERT_PALETTE_GENERATE,
+ 2, FALSE, FALSE, "");
+}
+
+static void
+export_add_alpha (gint32 image_ID,
+ gint32 *drawable_ID)
+{
+ gint32 nlayers;
+ gint32 i;
+ gint32 *layers;
+
+ layers = gimp_image_get_layers (image_ID, &nlayers);
+ for (i = 0; i < nlayers; i++)
+ {
+ if (!gimp_drawable_has_alpha (layers[i]))
+ gimp_layer_add_alpha (layers[i]);
+ }
+ g_free (layers);
+}
+
+static void
+export_crop_image (gint32 image_ID,
+ gint32 *drawable_ID)
+{
+ gimp_image_crop (image_ID,
+ gimp_image_width (image_ID),
+ gimp_image_height (image_ID),
+ 0, 0);
+}
+
+static void
+export_resize_image (gint32 image_ID,
+ gint32 *drawable_ID)
+{
+ gimp_image_resize_to_layers (image_ID);
+}
+
+static void
+export_void (gint32 image_ID,
+ gint32 *drawable_ID)
+{
+ /* do nothing */
+}
+
+
+/* a set of predefined actions */
+
+static ExportAction export_action_merge =
+{
+ export_merge,
+ NULL,
+ N_("%s plug-in can't handle layers"),
+ { N_("Merge Visible Layers"), NULL },
+ 0
+};
+
+static ExportAction export_action_merge_single =
+{
+ export_merge,
+ NULL,
+ N_("%s plug-in can't handle layer offsets, size or opacity"),
+ { N_("Merge Visible Layers"), NULL },
+ 0
+};
+
+static ExportAction export_action_animate_or_merge =
+{
+ NULL,
+ export_merge,
+ N_("%s plug-in can only handle layers as animation frames"),
+ { N_("Save as Animation"), N_("Merge Visible Layers") },
+ 0
+};
+
+static ExportAction export_action_animate_or_flatten =
+{
+ NULL,
+ export_flatten,
+ N_("%s plug-in can only handle layers as animation frames"),
+ { N_("Save as Animation"), N_("Flatten Image") },
+ 0
+};
+
+static ExportAction export_action_merge_or_flatten =
+{
+ export_flatten,
+ export_merge,
+ N_("%s plug-in can't handle layers"),
+ { N_("Flatten Image"), N_("Merge Visible Layers") },
+ 1
+};
+
+static ExportAction export_action_flatten =
+{
+ export_flatten,
+ NULL,
+ N_("%s plug-in can't handle transparency"),
+ { N_("Flatten Image"), NULL },
+ 0
+};
+
+static ExportAction export_action_remove_alpha =
+{
+ export_remove_alpha,
+ NULL,
+ N_("%s plug-in can't handle transparent layers"),
+ { N_("Flatten Image"), NULL },
+ 0
+};
+
+static ExportAction export_action_apply_masks =
+{
+ export_apply_masks,
+ NULL,
+ N_("%s plug-in can't handle layer masks"),
+ { N_("Apply Layer Masks"), NULL },
+ 0
+};
+
+static ExportAction export_action_convert_rgb =
+{
+ export_convert_rgb,
+ NULL,
+ N_("%s plug-in can only handle RGB images"),
+ { N_("Convert to RGB"), NULL },
+ 0
+};
+
+static ExportAction export_action_convert_grayscale =
+{
+ export_convert_grayscale,
+ NULL,
+ N_("%s plug-in can only handle grayscale images"),
+ { N_("Convert to Grayscale"), NULL },
+ 0
+};
+
+static ExportAction export_action_convert_indexed =
+{
+ export_convert_indexed,
+ NULL,
+ N_("%s plug-in can only handle indexed images"),
+ { N_("Convert to Indexed using default settings\n"
+ "(Do it manually to tune the result)"), NULL },
+ 0
+};
+
+static ExportAction export_action_convert_bitmap =
+{
+ export_convert_bitmap,
+ NULL,
+ N_("%s plug-in can only handle bitmap (two color) indexed images"),
+ { N_("Convert to Indexed using bitmap default settings\n"
+ "(Do it manually to tune the result)"), NULL },
+ 0
+};
+
+static ExportAction export_action_convert_rgb_or_grayscale =
+{
+ export_convert_rgb,
+ export_convert_grayscale,
+ N_("%s plug-in can only handle RGB or grayscale images"),
+ { N_("Convert to RGB"), N_("Convert to Grayscale")},
+ 0
+};
+
+static ExportAction export_action_convert_rgb_or_indexed =
+{
+ export_convert_rgb,
+ export_convert_indexed,
+ N_("%s plug-in can only handle RGB or indexed images"),
+ { N_("Convert to RGB"), N_("Convert to Indexed using default settings\n"
+ "(Do it manually to tune the result)")},
+ 0
+};
+
+static ExportAction export_action_convert_indexed_or_grayscale =
+{
+ export_convert_indexed,
+ export_convert_grayscale,
+ N_("%s plug-in can only handle grayscale or indexed images"),
+ { N_("Convert to Indexed using default settings\n"
+ "(Do it manually to tune the result)"),
+ N_("Convert to Grayscale") },
+ 0
+};
+
+static ExportAction export_action_add_alpha =
+{
+ export_add_alpha,
+ NULL,
+ N_("%s plug-in needs an alpha channel"),
+ { N_("Add Alpha Channel"), NULL},
+ 0
+};
+
+static ExportAction export_action_crop_or_resize =
+{
+ export_crop_image,
+ export_resize_image,
+ N_("%s plug-in needs to crop the layers to the image bounds"),
+ { N_("Crop Layers"), N_("Resize Image to Layers")},
+ 0
+};
+
+
+static ExportFunc
+export_action_get_func (const ExportAction *action)
+{
+ if (action->choice == 0 && action->default_action)
+ {
+ return action->default_action;
+ }
+
+ if (action->choice == 1 && action->alt_action)
+ {
+ return action->alt_action;
+ }
+
+ return export_void;
+}
+
+static void
+export_action_perform (const ExportAction *action,
+ gint32 image_ID,
+ gint32 *drawable_ID)
+{
+ export_action_get_func (action) (image_ID, drawable_ID);
+}
+
+
+/* dialog functions */
+
+static void
+export_toggle_callback (GtkWidget *widget,
+ gpointer data)
+{
+ gint *choice = (gint *) data;
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ *choice = FALSE;
+ else
+ *choice = TRUE;
+}
+
+static GimpExportReturn
+confirm_save_dialog (const gchar *message,
+ const gchar *format_name)
+{
+ GtkWidget *dialog;
+ GtkWidget *hbox;
+ GtkWidget *image;
+ GtkWidget *main_vbox;
+ GtkWidget *label;
+ gchar *text;
+ GimpExportReturn retval;
+
+ g_return_val_if_fail (message != NULL, GIMP_EXPORT_CANCEL);
+ g_return_val_if_fail (format_name != NULL, GIMP_EXPORT_CANCEL);
+
+ dialog = gimp_dialog_new (_("Confirm Save"), "gimp-export-image-confirm",
+ NULL, 0,
+ gimp_standard_help_func,
+ "gimp-export-confirm-dialog",
+
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("C_onfirm"), GTK_RESPONSE_OK,
+
+ NULL);
+
+ gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+ GTK_RESPONSE_OK,
+ GTK_RESPONSE_CANCEL,
+ -1);
+
+ gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+ gimp_window_set_transient (GTK_WINDOW (dialog));
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
+ hbox, TRUE, TRUE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
+ gtk_widget_show (hbox);
+
+ image = gtk_image_new_from_icon_name ("dialog-warning",
+ GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
+ gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+ gtk_widget_show (image);
+
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ gtk_box_pack_start (GTK_BOX (hbox), main_vbox, FALSE, FALSE, 0);
+ gtk_widget_show (main_vbox);
+
+ text = g_strdup_printf (message, format_name);
+ label = gtk_label_new (text);
+ g_free (text);
+
+ gimp_label_set_attributes (GTK_LABEL (label),
+ PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
+ PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
+ -1);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+ gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ gtk_widget_show (dialog);
+
+ switch (gimp_dialog_run (GIMP_DIALOG (dialog)))
+ {
+ case GTK_RESPONSE_OK:
+ retval = GIMP_EXPORT_EXPORT;
+ break;
+
+ default:
+ retval = GIMP_EXPORT_CANCEL;
+ break;
+ }
+
+ gtk_widget_destroy (dialog);
+
+ return retval;
+}
+
+static GimpExportReturn
+export_dialog (GSList *actions,
+ const gchar *format_name)
+{
+ GtkWidget *dialog;
+ GtkWidget *hbox;
+ GtkWidget *image;
+ GtkWidget *main_vbox;
+ GtkWidget *label;
+ GSList *list;
+ gchar *text;
+ GimpExportReturn retval;
+
+ g_return_val_if_fail (actions != NULL, GIMP_EXPORT_CANCEL);
+ g_return_val_if_fail (format_name != NULL, GIMP_EXPORT_CANCEL);
+
+ dialog = gimp_dialog_new (_("Export File"), "gimp-export-image",
+ NULL, 0,
+ gimp_standard_help_func, "gimp-export-dialog",
+
+ _("_Ignore"), GTK_RESPONSE_NO,
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_Export"), GTK_RESPONSE_OK,
+
+ NULL);
+
+ gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+ GTK_RESPONSE_NO,
+ GTK_RESPONSE_OK,
+ GTK_RESPONSE_CANCEL,
+ -1);
+
+ gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+ gimp_window_set_transient (GTK_WINDOW (dialog));
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
+ hbox, TRUE, TRUE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
+ gtk_widget_show (hbox);
+
+ image = gtk_image_new_from_icon_name ("dialog-information",
+ GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
+ gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+ gtk_widget_show (image);
+
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ gtk_box_pack_start (GTK_BOX (hbox), main_vbox, FALSE, FALSE, 0);
+ gtk_widget_show (main_vbox);
+
+ /* the headline */
+ text = g_strdup_printf (_("Your image should be exported before it "
+ "can be saved as %s for the following reasons:"),
+ format_name);
+ label = gtk_label_new (text);
+ g_free (text);
+
+ gimp_label_set_attributes (GTK_LABEL (label),
+ PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
+ -1);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+ gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ for (list = actions; list; list = g_slist_next (list))
+ {
+ ExportAction *action = list->data;
+ GtkWidget *frame;
+ GtkWidget *vbox;
+
+ text = g_strdup_printf (gettext (action->reason), format_name);
+ frame = gimp_frame_new (text);
+ g_free (text);
+
+ gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+
+ if (action->possibilities[0] && action->possibilities[1])
+ {
+ GtkWidget *button;
+ GSList *radio_group = NULL;
+
+ button = gtk_radio_button_new_with_label (radio_group,
+ gettext (action->possibilities[0]));
+ gtk_label_set_justify (GTK_LABEL (gtk_bin_get_child (GTK_BIN (button))),
+ GTK_JUSTIFY_LEFT);
+ radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+ g_signal_connect (button, "toggled",
+ G_CALLBACK (export_toggle_callback),
+ &action->choice);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
+ (action->choice == 0));
+ gtk_widget_show (button);
+
+ button = gtk_radio_button_new_with_label (radio_group,
+ gettext (action->possibilities[1]));
+ gtk_label_set_justify (GTK_LABEL (gtk_bin_get_child (GTK_BIN (button))),
+ GTK_JUSTIFY_LEFT);
+ radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
+ (action->choice == 1));
+ gtk_widget_show (button);
+ }
+ else if (action->possibilities[0])
+ {
+ label = gtk_label_new (gettext (action->possibilities[0]));
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+ action->choice = 0;
+ }
+
+ gtk_widget_show (vbox);
+ }
+
+ /* the footline */
+ label = gtk_label_new (_("The export conversion won't modify your "
+ "original image."));
+ gimp_label_set_attributes (GTK_LABEL (label),
+ PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
+ -1);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+ gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ gtk_widget_show (dialog);
+
+ switch (gimp_dialog_run (GIMP_DIALOG (dialog)))
+ {
+ case GTK_RESPONSE_OK:
+ retval = GIMP_EXPORT_EXPORT;
+ break;
+
+ case GTK_RESPONSE_NO:
+ retval = GIMP_EXPORT_IGNORE;
+ break;
+
+ default:
+ retval = GIMP_EXPORT_CANCEL;
+ break;
+ }
+
+ gtk_widget_destroy (dialog);
+
+ return retval;
+}
+
+/**
+ * gimp_export_image:
+ * @image_ID: Pointer to the image_ID.
+ * @drawable_ID: Pointer to the drawable_ID.
+ * @format_name: The (short) name of the image_format (e.g. JPEG or GIF).
+ * @capabilities: What can the image_format do?
+ *
+ * Takes an image and a drawable to be saved together with a
+ * description of the capabilities of the image_format. If the
+ * type of image doesn't match the capabilities of the format
+ * a dialog is opened that informs the user that the image has
+ * to be exported and offers to do the necessary conversions.
+ *
+ * If the user chooses to export the image, a copy is created.
+ * This copy is then converted, the image_ID and drawable_ID
+ * are changed to point to the new image and the procedure returns
+ * GIMP_EXPORT_EXPORT. The save_plugin has to take care of deleting the
+ * created image using gimp_image_delete() when it has saved it.
+ *
+ * If the user chooses to Ignore the export problem, the image_ID
+ * and drawable_ID is not altered, GIMP_EXPORT_IGNORE is returned and
+ * the save_plugin should try to save the original image. If the
+ * user chooses Cancel, GIMP_EXPORT_CANCEL is returned and the
+ * save_plugin should quit itself with status %GIMP_PDB_CANCEL.
+ *
+ * If @format_name is NULL, no dialogs will be shown and this function
+ * will behave as if the user clicked on the 'Export' button, if a
+ * dialog would have been shown.
+ *
+ * Returns: An enum of #GimpExportReturn describing the user_action.
+ **/
+GimpExportReturn
+gimp_export_image (gint32 *image_ID,
+ gint32 *drawable_ID,
+ const gchar *format_name,
+ GimpExportCapabilities capabilities)
+{
+ GSList *actions = NULL;
+ GimpImageBaseType type;
+ gint32 i;
+ gint32 n_layers;
+ gint32 *layers;
+ gboolean interactive = FALSE;
+ gboolean added_flatten = FALSE;
+ gboolean has_layer_masks = FALSE;
+ gboolean background_has_alpha = TRUE;
+ GimpExportReturn retval = GIMP_EXPORT_CANCEL;
+
+ g_return_val_if_fail (*image_ID > -1 && *drawable_ID > -1, FALSE);
+
+ /* do some sanity checks */
+ if (capabilities & GIMP_EXPORT_NEEDS_ALPHA)
+ capabilities |= GIMP_EXPORT_CAN_HANDLE_ALPHA;
+
+ if (capabilities & GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION)
+ capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS;
+
+ if (capabilities & GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS)
+ capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS;
+
+ if (format_name && g_getenv ("GIMP_INTERACTIVE_EXPORT"))
+ interactive = TRUE;
+
+ /* ask for confirmation if the user is not saving a layer (see bug #51114) */
+ if (interactive &&
+ ! gimp_item_is_layer (*drawable_ID) &&
+ ! (capabilities & GIMP_EXPORT_CAN_HANDLE_LAYERS))
+ {
+ if (gimp_item_is_layer_mask (*drawable_ID))
+ {
+ retval = confirm_save_dialog
+ (_("You are about to save a layer mask as %s.\n"
+ "This will not save the visible layers."), format_name);
+ }
+ else if (gimp_item_is_channel (*drawable_ID))
+ {
+ retval = confirm_save_dialog
+ (_("You are about to save a channel (saved selection) as %s.\n"
+ "This will not save the visible layers."), format_name);
+ }
+ else
+ {
+ /* this should not happen */
+ g_warning ("%s: unknown drawable type!", G_STRFUNC);
+ }
+
+ /* cancel - the user can then select an appropriate layer to save */
+ if (retval == GIMP_EXPORT_CANCEL)
+ return GIMP_EXPORT_CANCEL;
+ }
+
+
+ /* check alpha and layer masks */
+ layers = gimp_image_get_layers (*image_ID, &n_layers);
+
+ for (i = 0; i < n_layers; i++)
+ {
+ if (gimp_drawable_has_alpha (layers[i]))
+ {
+ if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_ALPHA))
+ {
+ if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_LAYERS))
+ {
+ actions = g_slist_prepend (actions, &export_action_flatten);
+ added_flatten = TRUE;
+ break;
+ }
+ else
+ {
+ actions = g_slist_prepend (actions, &export_action_remove_alpha);
+ break;
+ }
+ }
+ }
+ else
+ {
+ /* If this is the last layer, it's visible and has no alpha
+ * channel, then the image has a "flat" background
+ */
+ if (i == n_layers - 1 && gimp_item_get_visible (layers[i]))
+ background_has_alpha = FALSE;
+
+ if (capabilities & GIMP_EXPORT_NEEDS_ALPHA)
+ {
+ actions = g_slist_prepend (actions, &export_action_add_alpha);
+ break;
+ }
+ }
+ }
+
+ if (! added_flatten)
+ {
+ for (i = 0; i < n_layers; i++)
+ {
+ if (gimp_layer_get_mask (layers[i]) != -1)
+ has_layer_masks = TRUE;
+ }
+ }
+
+ if (! added_flatten)
+ {
+ gint32 n_children;
+ gint32 *children;
+
+ children = gimp_item_get_children (layers[0], &n_children);
+
+ if ((capabilities & GIMP_EXPORT_CAN_HANDLE_LAYERS) &&
+ (capabilities & GIMP_EXPORT_NEEDS_CROP))
+ {
+ GeglRectangle image_bounds;
+ gboolean needs_crop = FALSE;
+
+ image_bounds.x = 0;
+ image_bounds.y = 0;
+ image_bounds.width = gimp_image_width (*image_ID);
+ image_bounds.height = gimp_image_height (*image_ID);
+
+ for (i = 0; i < n_layers; i++)
+ {
+ GeglRectangle layer_bounds;
+
+ gimp_drawable_offsets (layers[i],
+ &layer_bounds.x, &layer_bounds.y);
+
+ layer_bounds.width = gimp_drawable_width (layers[i]);
+ layer_bounds.height = gimp_drawable_height (layers[i]);
+
+ if (! gegl_rectangle_contains (&image_bounds, &layer_bounds))
+ {
+ needs_crop = TRUE;
+
+ break;
+ }
+ }
+
+ if (needs_crop)
+ {
+ actions = g_slist_prepend (actions,
+ &export_action_crop_or_resize);
+ }
+ }
+
+ /* check if layer size != canvas size, opacity != 100%, or offsets != 0 */
+ if (n_layers == 1 &&
+ ! children &&
+ gimp_item_is_layer (*drawable_ID) &&
+ ! (capabilities & GIMP_EXPORT_CAN_HANDLE_LAYERS))
+ {
+ gint offset_x;
+ gint offset_y;
+
+ gimp_drawable_offsets (*drawable_ID, &offset_x, &offset_y);
+
+ if ((gimp_layer_get_opacity (*drawable_ID) < 100.0) ||
+ (gimp_image_width (*image_ID) !=
+ gimp_drawable_width (*drawable_ID)) ||
+ (gimp_image_height (*image_ID) !=
+ gimp_drawable_height (*drawable_ID)) ||
+ offset_x || offset_y)
+ {
+ if (capabilities & GIMP_EXPORT_CAN_HANDLE_ALPHA)
+ {
+ actions = g_slist_prepend (actions,
+ &export_action_merge_single);
+ }
+ else
+ {
+ actions = g_slist_prepend (actions,
+ &export_action_flatten);
+ }
+ }
+ }
+ /* check multiple layers */
+ else if (n_layers > 1)
+ {
+ if (capabilities & GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION)
+ {
+ if (background_has_alpha ||
+ capabilities & GIMP_EXPORT_NEEDS_ALPHA)
+ actions = g_slist_prepend (actions,
+ &export_action_animate_or_merge);
+ else
+ actions = g_slist_prepend (actions,
+ &export_action_animate_or_flatten);
+ }
+ else if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_LAYERS))
+ {
+ if (capabilities & GIMP_EXPORT_NEEDS_ALPHA)
+ actions = g_slist_prepend (actions,
+ &export_action_merge);
+ else
+ actions = g_slist_prepend (actions,
+ &export_action_merge_or_flatten);
+ }
+ }
+ /* check for a single toplevel layer group */
+ else if (children)
+ {
+ if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_LAYERS))
+ {
+ if (capabilities & GIMP_EXPORT_NEEDS_ALPHA)
+ actions = g_slist_prepend (actions,
+ &export_action_merge);
+ else
+ actions = g_slist_prepend (actions,
+ &export_action_merge_or_flatten);
+ }
+ }
+
+ g_free (children);
+
+ /* check layer masks */
+ if (has_layer_masks &&
+ ! (capabilities & GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS))
+ actions = g_slist_prepend (actions, &export_action_apply_masks);
+ }
+
+ g_free (layers);
+
+ /* check the image type */
+ type = gimp_image_base_type (*image_ID);
+ switch (type)
+ {
+ case GIMP_RGB:
+ if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_RGB))
+ {
+ if ((capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED) &&
+ (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY))
+ actions = g_slist_prepend (actions,
+ &export_action_convert_indexed_or_grayscale);
+ else if (capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED)
+ actions = g_slist_prepend (actions,
+ &export_action_convert_indexed);
+ else if (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY)
+ actions = g_slist_prepend (actions,
+ &export_action_convert_grayscale);
+ else if (capabilities & GIMP_EXPORT_CAN_HANDLE_BITMAP)
+ actions = g_slist_prepend (actions,
+ &export_action_convert_bitmap);
+ }
+ break;
+
+ case GIMP_GRAY:
+ if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY))
+ {
+ if ((capabilities & GIMP_EXPORT_CAN_HANDLE_RGB) &&
+ (capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED))
+ actions = g_slist_prepend (actions,
+ &export_action_convert_rgb_or_indexed);
+ else if (capabilities & GIMP_EXPORT_CAN_HANDLE_RGB)
+ actions = g_slist_prepend (actions,
+ &export_action_convert_rgb);
+ else if (capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED)
+ actions = g_slist_prepend (actions,
+ &export_action_convert_indexed);
+ else if (capabilities & GIMP_EXPORT_CAN_HANDLE_BITMAP)
+ actions = g_slist_prepend (actions,
+ &export_action_convert_bitmap);
+ }
+ break;
+
+ case GIMP_INDEXED:
+ if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED))
+ {
+ if ((capabilities & GIMP_EXPORT_CAN_HANDLE_RGB) &&
+ (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY))
+ actions = g_slist_prepend (actions,
+ &export_action_convert_rgb_or_grayscale);
+ else if (capabilities & GIMP_EXPORT_CAN_HANDLE_RGB)
+ actions = g_slist_prepend (actions,
+ &export_action_convert_rgb);
+ else if (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY)
+ actions = g_slist_prepend (actions,
+ &export_action_convert_grayscale);
+ else if (capabilities & GIMP_EXPORT_CAN_HANDLE_BITMAP)
+ {
+ gint n_colors;
+
+ g_free (gimp_image_get_colormap (*image_ID, &n_colors));
+
+ if (n_colors > 2)
+ actions = g_slist_prepend (actions,
+ &export_action_convert_bitmap);
+ }
+ }
+ break;
+ }
+
+ if (actions)
+ {
+ actions = g_slist_reverse (actions);
+
+ if (interactive)
+ retval = export_dialog (actions, format_name);
+ else
+ retval = GIMP_EXPORT_EXPORT;
+ }
+ else
+ {
+ retval = GIMP_EXPORT_IGNORE;
+ }
+
+ if (retval == GIMP_EXPORT_EXPORT)
+ {
+ GSList *list;
+
+ *image_ID = gimp_image_duplicate (*image_ID);
+ *drawable_ID = gimp_image_get_active_layer (*image_ID);
+
+ gimp_image_undo_disable (*image_ID);
+
+ for (list = actions; list; list = list->next)
+ {
+ export_action_perform (list->data, *image_ID, drawable_ID);
+ }
+ }
+
+ g_slist_free (actions);
+
+ return retval;
+}
+
+/**
+ * gimp_export_dialog_new:
+ * @format_name: The short name of the image_format (e.g. JPEG or PNG).
+ * @role: The dialog's @role which will be set with
+ * gtk_window_set_role().
+ * @help_id: The GIMP help id.
+ *
+ * Creates a new export dialog. All file plug-ins should use this
+ * dialog to get a consistent look on the export dialogs. Use
+ * gimp_export_dialog_get_content_area() to get a #GtkVBox to be
+ * filled with export options. The export dialog is a wrapped
+ * #GimpDialog.
+ *
+ * The dialog response when the user clicks on the Export button is
+ * %GTK_RESPONSE_OK, and when the Cancel button is clicked it is
+ * %GTK_RESPONSE_CANCEL.
+ *
+ * Returns: The new export dialog.
+ *
+ * Since: 2.8
+ **/
+GtkWidget *
+gimp_export_dialog_new (const gchar *format_name,
+ const gchar *role,
+ const gchar *help_id)
+{
+ GtkWidget *dialog;
+ /* TRANSLATORS: the %s parameter is an image format name (ex: PNG). */
+ gchar *title = g_strdup_printf (_("Export Image as %s"), format_name);
+
+ dialog = gimp_dialog_new (title, role,
+ NULL, 0,
+ gimp_standard_help_func, help_id,
+
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_Export"), GTK_RESPONSE_OK,
+
+ NULL);
+
+ gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+ GTK_RESPONSE_OK,
+ GTK_RESPONSE_CANCEL,
+ -1);
+
+ gimp_window_set_transient (GTK_WINDOW (dialog));
+
+ g_free (title);
+
+ return dialog;
+}
+
+/**
+ * gimp_export_dialog_get_content_area:
+ * @dialog: A dialog created with gimp_export_dialog_new()
+ *
+ * Returns the #GtkVBox of the passed export dialog to be filled with
+ * export options.
+ *
+ * Returns: The #GtkVBox to fill with export options.
+ *
+ * Since: 2.8
+ **/
+GtkWidget *
+gimp_export_dialog_get_content_area (GtkWidget *dialog)
+{
+ return gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+}
diff --git a/libgimp/gimpexport.h b/libgimp/gimpexport.h
new file mode 100644
index 0000000..bc8c385
--- /dev/null
+++ b/libgimp/gimpexport.h
@@ -0,0 +1,93 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1999 Peter Mattis and Spencer Kimball
+ *
+ * gimpexport.h
+ * Copyright (C) 1999-2000 Sven Neumann <sven@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_EXPORT_H__
+#define __GIMP_EXPORT_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+/**
+ * GimpExportCapabilities:
+ * @GIMP_EXPORT_CAN_HANDLE_RGB: Handles RGB images
+ * @GIMP_EXPORT_CAN_HANDLE_GRAY: Handles grayscale images
+ * @GIMP_EXPORT_CAN_HANDLE_INDEXED: Handles indexed images
+ * @GIMP_EXPORT_CAN_HANDLE_BITMAP: Handles two-color indexed images
+ * @GIMP_EXPORT_CAN_HANDLE_ALPHA: Handles alpha channels
+ * @GIMP_EXPORT_CAN_HANDLE_LAYERS: Hanldes layers
+ * @GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION: Handles aminations of layers
+ * @GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS: Handles layer masks
+ * @GIMP_EXPORT_NEEDS_ALPHA: Needs alpha channels
+ * @GIMP_EXPORT_NEEDS_CROP: Needs to crop content to image bounds
+ *
+ * The types of images and layers an export procedure can handle
+ **/
+typedef enum
+{
+ GIMP_EXPORT_CAN_HANDLE_RGB = 1 << 0,
+ GIMP_EXPORT_CAN_HANDLE_GRAY = 1 << 1,
+ GIMP_EXPORT_CAN_HANDLE_INDEXED = 1 << 2,
+ GIMP_EXPORT_CAN_HANDLE_BITMAP = 1 << 3,
+ GIMP_EXPORT_CAN_HANDLE_ALPHA = 1 << 4,
+ GIMP_EXPORT_CAN_HANDLE_LAYERS = 1 << 5,
+ GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION = 1 << 6,
+ GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS = 1 << 7,
+ GIMP_EXPORT_NEEDS_ALPHA = 1 << 8,
+ GIMP_EXPORT_NEEDS_CROP = 1 << 9
+} GimpExportCapabilities;
+
+
+/**
+ * GimpExportReturn:
+ * @GIMP_EXPORT_CANCEL: The export was cancelled
+ * @GIMP_EXPORT_IGNORE: The image is unmodified but export shall continue anyway
+ * @GIMP_EXPORT_EXPORT: The chosen transforms were applied to the image
+ *
+ * Possible return values of gimp_export_image().
+ **/
+typedef enum
+{
+ GIMP_EXPORT_CANCEL,
+ GIMP_EXPORT_IGNORE,
+ GIMP_EXPORT_EXPORT
+} GimpExportReturn;
+
+
+GimpExportReturn gimp_export_image (gint32 *image_ID,
+ gint32 *drawable_ID,
+ const gchar *format_name,
+ GimpExportCapabilities capabilities);
+
+GtkWidget * gimp_export_dialog_new (const gchar *format_name,
+ const gchar *role,
+ const gchar *help_id);
+GtkWidget * gimp_export_dialog_get_content_area (GtkWidget *dialog);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_EXPORT_H__ */
diff --git a/libgimp/gimpfileops_pdb.c b/libgimp/gimpfileops_pdb.c
new file mode 100644
index 0000000..4e5d8ae
--- /dev/null
+++ b/libgimp/gimpfileops_pdb.c
@@ -0,0 +1,550 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpfileops_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpfileops
+ * @title: gimpfileops
+ * @short_description: Image file operations (load, save, etc.)
+ *
+ * Image file operations (load, save, etc.)
+ **/
+
+
+/**
+ * gimp_file_load:
+ * @run_mode: The run mode.
+ * @filename: The name of the file to load.
+ * @raw_filename: The name as entered by the user.
+ *
+ * Loads an image file by invoking the right load handler.
+ *
+ * This procedure invokes the correct file load handler using magic if
+ * possible, and falling back on the file's extension and/or prefix if
+ * not. The name of the file to load is typically a full pathname, and
+ * the name entered is what the user actually typed before prepending a
+ * directory path. The reason for this is that if the user types
+ * https://www.gimp.org/foo.png he wants to fetch a URL, and the full
+ * pathname will not look like a URL.
+ *
+ * Returns: The output image.
+ **/
+gint32
+gimp_file_load (GimpRunMode run_mode,
+ const gchar *filename,
+ const gchar *raw_filename)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 image_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-file-load",
+ &nreturn_vals,
+ GIMP_PDB_INT32, run_mode,
+ GIMP_PDB_STRING, filename,
+ GIMP_PDB_STRING, raw_filename,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ image_ID = return_vals[1].data.d_image;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return image_ID;
+}
+
+/**
+ * gimp_file_load_layer:
+ * @run_mode: The run mode.
+ * @image_ID: Destination image.
+ * @filename: The name of the file to load.
+ *
+ * Loads an image file as a layer for an existing image.
+ *
+ * This procedure behaves like the file-load procedure but opens the
+ * specified image as a layer for an existing image. The returned layer
+ * needs to be added to the existing image with
+ * gimp_image_insert_layer().
+ *
+ * Returns: The layer created when loading the image file.
+ *
+ * Since: 2.4
+ **/
+gint32
+gimp_file_load_layer (GimpRunMode run_mode,
+ gint32 image_ID,
+ const gchar *filename)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-file-load-layer",
+ &nreturn_vals,
+ GIMP_PDB_INT32, run_mode,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, filename,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_file_load_layers:
+ * @run_mode: The run mode.
+ * @image_ID: Destination image.
+ * @filename: The name of the file to load.
+ * @num_layers: The number of loaded layers.
+ *
+ * Loads an image file as layers for an existing image.
+ *
+ * This procedure behaves like the file-load procedure but opens the
+ * specified image as layers for an existing image. The returned layers
+ * needs to be added to the existing image with
+ * gimp_image_insert_layer().
+ *
+ * Returns: The list of loaded layers.
+ *
+ * Since: 2.4
+ **/
+gint *
+gimp_file_load_layers (GimpRunMode run_mode,
+ gint32 image_ID,
+ const gchar *filename,
+ gint *num_layers)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint *layer_ids = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-file-load-layers",
+ &nreturn_vals,
+ GIMP_PDB_INT32, run_mode,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, filename,
+ GIMP_PDB_END);
+
+ *num_layers = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_layers = return_vals[1].data.d_int32;
+ layer_ids = g_new (gint32, *num_layers);
+ memcpy (layer_ids,
+ return_vals[2].data.d_int32array,
+ *num_layers * sizeof (gint32));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ids;
+}
+
+/**
+ * gimp_file_save:
+ * @run_mode: The run mode.
+ * @image_ID: Input image.
+ * @drawable_ID: Drawable to save.
+ * @filename: The name of the file to save the image in.
+ * @raw_filename: The name as entered by the user.
+ *
+ * Saves a file by extension.
+ *
+ * This procedure invokes the correct file save handler according to
+ * the file's extension and/or prefix. The name of the file to save is
+ * typically a full pathname, and the name entered is what the user
+ * actually typed before prepending a directory path. The reason for
+ * this is that if the user types https://www.gimp.org/foo.png she
+ * wants to fetch a URL, and the full pathname will not look like a
+ * URL.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_file_save (GimpRunMode run_mode,
+ gint32 image_ID,
+ gint32 drawable_ID,
+ const gchar *filename,
+ const gchar *raw_filename)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-file-save",
+ &nreturn_vals,
+ GIMP_PDB_INT32, run_mode,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_STRING, filename,
+ GIMP_PDB_STRING, raw_filename,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_file_save_thumbnail:
+ * @image_ID: The image.
+ * @filename: The name of the file the thumbnail belongs to.
+ *
+ * Saves a thumbnail for the given image
+ *
+ * This procedure saves a thumbnail for the given image according to
+ * the Free Desktop Thumbnail Managing Standard. The thumbnail is saved
+ * so that it belongs to the file with the given filename. This means
+ * you have to save the image under this name first, otherwise this
+ * procedure will fail. This procedure may become useful if you want to
+ * explicitly save a thumbnail with a file.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_file_save_thumbnail (gint32 image_ID,
+ const gchar *filename)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-file-save-thumbnail",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, filename,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_register_magic_load_handler:
+ * @procedure_name: The name of the procedure to be used for loading.
+ * @extensions: comma separated list of extensions this handler can load (i.e. \"jpg,jpeg\").
+ * @prefixes: comma separated list of prefixes this handler can load (i.e. \"http:,ftp:\").
+ * @magics: comma separated list of magic file information this handler can load (i.e. \"0,string,GIF\").
+ *
+ * Registers a file load handler procedure.
+ *
+ * Registers a procedural database procedure to be called to load files
+ * of a particular file format using magic file information.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_register_magic_load_handler (const gchar *procedure_name,
+ const gchar *extensions,
+ const gchar *prefixes,
+ const gchar *magics)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-register-magic-load-handler",
+ &nreturn_vals,
+ GIMP_PDB_STRING, procedure_name,
+ GIMP_PDB_STRING, extensions,
+ GIMP_PDB_STRING, prefixes,
+ GIMP_PDB_STRING, magics,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_register_load_handler:
+ * @procedure_name: The name of the procedure to be used for loading.
+ * @extensions: comma separated list of extensions this handler can load (i.e. \"jpg,jpeg\").
+ * @prefixes: comma separated list of prefixes this handler can load (i.e. \"http:,ftp:\").
+ *
+ * Registers a file load handler procedure.
+ *
+ * Registers a procedural database procedure to be called to load files
+ * of a particular file format.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_register_load_handler (const gchar *procedure_name,
+ const gchar *extensions,
+ const gchar *prefixes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-register-load-handler",
+ &nreturn_vals,
+ GIMP_PDB_STRING, procedure_name,
+ GIMP_PDB_STRING, extensions,
+ GIMP_PDB_STRING, prefixes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_register_save_handler:
+ * @procedure_name: The name of the procedure to be used for saving.
+ * @extensions: comma separated list of extensions this handler can save (i.e. \"jpg,jpeg\").
+ * @prefixes: comma separated list of prefixes this handler can save (i.e. \"http:,ftp:\").
+ *
+ * Registers a file save handler procedure.
+ *
+ * Registers a procedural database procedure to be called to save files
+ * in a particular file format.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_register_save_handler (const gchar *procedure_name,
+ const gchar *extensions,
+ const gchar *prefixes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-register-save-handler",
+ &nreturn_vals,
+ GIMP_PDB_STRING, procedure_name,
+ GIMP_PDB_STRING, extensions,
+ GIMP_PDB_STRING, prefixes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_register_file_handler_priority:
+ * @procedure_name: The name of the procedure to set the priority of.
+ * @priority: The procedure priority.
+ *
+ * Sets the priority of a file handler procedure.
+ *
+ * Sets the priority of a file handler procedure. When more than one
+ * procedure matches a given file, the procedure with the lowest
+ * priority is used; if more than one procedure has the lowest
+ * priority, it is unspecified which one of them is used. The default
+ * priority for file handler procedures is 0.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10.6
+ **/
+gboolean
+gimp_register_file_handler_priority (const gchar *procedure_name,
+ gint priority)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-register-file-handler-priority",
+ &nreturn_vals,
+ GIMP_PDB_STRING, procedure_name,
+ GIMP_PDB_INT32, priority,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_register_file_handler_mime:
+ * @procedure_name: The name of the procedure to associate a MIME type with.
+ * @mime_types: A comma-separated list of MIME types, such as \"image/jpeg\".
+ *
+ * Associates MIME types with a file handler procedure.
+ *
+ * Registers MIME types for a file handler procedure. This allows GIMP
+ * to determine the MIME type of the file opened or saved using this
+ * procedure. It is recommended that only one MIME type is registered
+ * per file procedure; when registering more than one MIME type, GIMP
+ * will associate the first one with files opened or saved with this
+ * procedure.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_register_file_handler_mime (const gchar *procedure_name,
+ const gchar *mime_types)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-register-file-handler-mime",
+ &nreturn_vals,
+ GIMP_PDB_STRING, procedure_name,
+ GIMP_PDB_STRING, mime_types,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_register_file_handler_uri:
+ * @procedure_name: The name of the procedure to enable URIs for.
+ *
+ * Registers a file handler procedure as capable of handling URIs.
+ *
+ * Registers a file handler procedure as capable of handling URIs. This
+ * allows GIMP to call the procedure directly for all kinds of URIs,
+ * and the 'filename' traditionally passed to file procedures turns
+ * into an URI.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_register_file_handler_uri (const gchar *procedure_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-register-file-handler-uri",
+ &nreturn_vals,
+ GIMP_PDB_STRING, procedure_name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_register_file_handler_raw:
+ * @procedure_name: The name of the procedure to enable raw handling for.
+ *
+ * Registers a file handler procedure as capable of handling raw camera
+ * files.
+ *
+ * Registers a file handler procedure as capable of handling raw
+ * digital camera files. Use this procedure only to register raw load
+ * handlers, calling it on a save handler will generate an error.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_register_file_handler_raw (const gchar *procedure_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-register-file-handler-raw",
+ &nreturn_vals,
+ GIMP_PDB_STRING, procedure_name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_register_thumbnail_loader:
+ * @load_proc: The name of the procedure the thumbnail loader with.
+ * @thumb_proc: The name of the thumbnail load procedure.
+ *
+ * Associates a thumbnail loader with a file load procedure.
+ *
+ * Some file formats allow for embedded thumbnails, other file formats
+ * contain a scalable image or provide the image data in different
+ * resolutions. A file plug-in for such a format may register a special
+ * procedure that allows GIMP to load a thumbnail preview of the image.
+ * This procedure is then associated with the standard load procedure
+ * using this function.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_register_thumbnail_loader (const gchar *load_proc,
+ const gchar *thumb_proc)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-register-thumbnail-loader",
+ &nreturn_vals,
+ GIMP_PDB_STRING, load_proc,
+ GIMP_PDB_STRING, thumb_proc,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpfileops_pdb.h b/libgimp/gimpfileops_pdb.h
new file mode 100644
index 0000000..80d2589
--- /dev/null
+++ b/libgimp/gimpfileops_pdb.h
@@ -0,0 +1,74 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpfileops_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_FILEOPS_PDB_H__
+#define __GIMP_FILEOPS_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gint32 gimp_file_load (GimpRunMode run_mode,
+ const gchar *filename,
+ const gchar *raw_filename);
+gint32 gimp_file_load_layer (GimpRunMode run_mode,
+ gint32 image_ID,
+ const gchar *filename);
+gint* gimp_file_load_layers (GimpRunMode run_mode,
+ gint32 image_ID,
+ const gchar *filename,
+ gint *num_layers);
+gboolean gimp_file_save (GimpRunMode run_mode,
+ gint32 image_ID,
+ gint32 drawable_ID,
+ const gchar *filename,
+ const gchar *raw_filename);
+gboolean gimp_file_save_thumbnail (gint32 image_ID,
+ const gchar *filename);
+gboolean gimp_register_magic_load_handler (const gchar *procedure_name,
+ const gchar *extensions,
+ const gchar *prefixes,
+ const gchar *magics);
+gboolean gimp_register_load_handler (const gchar *procedure_name,
+ const gchar *extensions,
+ const gchar *prefixes);
+gboolean gimp_register_save_handler (const gchar *procedure_name,
+ const gchar *extensions,
+ const gchar *prefixes);
+gboolean gimp_register_file_handler_priority (const gchar *procedure_name,
+ gint priority);
+gboolean gimp_register_file_handler_mime (const gchar *procedure_name,
+ const gchar *mime_types);
+gboolean gimp_register_file_handler_uri (const gchar *procedure_name);
+gboolean gimp_register_file_handler_raw (const gchar *procedure_name);
+gboolean gimp_register_thumbnail_loader (const gchar *load_proc,
+ const gchar *thumb_proc);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_FILEOPS_PDB_H__ */
diff --git a/libgimp/gimpfloatingsel_pdb.c b/libgimp/gimpfloatingsel_pdb.c
new file mode 100644
index 0000000..b49e69e
--- /dev/null
+++ b/libgimp/gimpfloatingsel_pdb.c
@@ -0,0 +1,227 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpfloatingsel_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpfloatingsel
+ * @title: gimpfloatingsel
+ * @short_description: Functions for removing or attaching floating selections.
+ *
+ * Functions for removing or attaching floating selections.
+ **/
+
+
+/**
+ * gimp_floating_sel_remove:
+ * @floating_sel_ID: The floating selection.
+ *
+ * Remove the specified floating selection from its associated
+ * drawable.
+ *
+ * This procedure removes the floating selection completely, without
+ * any side effects. The associated drawable is then set to active.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_floating_sel_remove (gint32 floating_sel_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-floating-sel-remove",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, floating_sel_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_floating_sel_anchor:
+ * @floating_sel_ID: The floating selection.
+ *
+ * Anchor the specified floating selection to its associated drawable.
+ *
+ * This procedure anchors the floating selection to its associated
+ * drawable. This is similar to merging with a merge type of
+ * ClipToBottomLayer. The floating selection layer is no longer valid
+ * after this operation.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_floating_sel_anchor (gint32 floating_sel_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-floating-sel-anchor",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, floating_sel_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_floating_sel_to_layer:
+ * @floating_sel_ID: The floating selection.
+ *
+ * Transforms the specified floating selection into a layer.
+ *
+ * This procedure transforms the specified floating selection into a
+ * layer with the same offsets and extents. The composited image will
+ * look precisely the same, but the floating selection layer will no
+ * longer be clipped to the extents of the drawable it was attached to.
+ * The floating selection will become the active layer. This procedure
+ * will not work if the floating selection has a different base type
+ * from the underlying image. This might be the case if the floating
+ * selection is above an auxiliary channel or a layer mask.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_floating_sel_to_layer (gint32 floating_sel_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-floating-sel-to-layer",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, floating_sel_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_floating_sel_attach:
+ * @layer_ID: The layer (is attached as floating selection).
+ * @drawable_ID: The drawable (where to attach the floating selection).
+ *
+ * Attach the specified layer as floating to the specified drawable.
+ *
+ * This procedure attaches the layer as floating selection to the
+ * drawable.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_floating_sel_attach (gint32 layer_ID,
+ gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-floating-sel-attach",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_floating_sel_rigor:
+ * @floating_sel_ID: The floating selection.
+ * @undo: .
+ *
+ * Deprecated: There is no replacement for this procedure.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_floating_sel_rigor (gint32 floating_sel_ID,
+ gboolean undo)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-floating-sel-rigor",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, floating_sel_ID,
+ GIMP_PDB_INT32, undo,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_floating_sel_relax:
+ * @floating_sel_ID: The floating selection.
+ * @undo: .
+ *
+ * Deprecated: There is no replacement for this procedure.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_floating_sel_relax (gint32 floating_sel_ID,
+ gboolean undo)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-floating-sel-relax",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, floating_sel_ID,
+ GIMP_PDB_INT32, undo,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpfloatingsel_pdb.h b/libgimp/gimpfloatingsel_pdb.h
new file mode 100644
index 0000000..e6d87dd
--- /dev/null
+++ b/libgimp/gimpfloatingsel_pdb.h
@@ -0,0 +1,50 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpfloatingsel_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_FLOATING_SEL_PDB_H__
+#define __GIMP_FLOATING_SEL_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_floating_sel_remove (gint32 floating_sel_ID);
+gboolean gimp_floating_sel_anchor (gint32 floating_sel_ID);
+gboolean gimp_floating_sel_to_layer (gint32 floating_sel_ID);
+gboolean gimp_floating_sel_attach (gint32 layer_ID,
+ gint32 drawable_ID);
+GIMP_DEPRECATED
+gboolean gimp_floating_sel_rigor (gint32 floating_sel_ID,
+ gboolean undo);
+GIMP_DEPRECATED
+gboolean gimp_floating_sel_relax (gint32 floating_sel_ID,
+ gboolean undo);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_FLOATING_SEL_PDB_H__ */
diff --git a/libgimp/gimpfontmenu.c b/libgimp/gimpfontmenu.c
new file mode 100644
index 0000000..5e85539
--- /dev/null
+++ b/libgimp/gimpfontmenu.c
@@ -0,0 +1,142 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpfontmenu.c
+ * Copyright (C) 2003 Sven Neumann <sven@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimpfontmenu.h"
+#include "gimpfontselectbutton.h"
+
+
+/**
+ * SECTION: gimpfontmenu
+ * @title: gimpfontmenu
+ * @short_description: A widget for selecting fonts.
+ *
+ * A widget for selecting fonts.
+ **/
+
+
+typedef struct
+{
+ GimpRunFontCallback callback;
+ gpointer data;
+} CompatCallbackData;
+
+
+static void compat_callback (GimpFontSelectButton *font_button,
+ const gchar *font_name,
+ gboolean dialog_closing,
+ CompatCallbackData *data);
+static void compat_callback_data_free (CompatCallbackData *data);
+
+
+/**
+ * gimp_font_select_widget_new:
+ * @title: Title of the dialog to use or %NULL to use the default title.
+ * @font_name: Initial font name.
+ * @callback: A function to call when the selected font changes.
+ * @data: A pointer to arbitrary data to be used in the call to @callback.
+ *
+ * Creates a new #GtkWidget that completely controls the selection of
+ * a font. This widget is suitable for placement in a table in a
+ * plug-in dialog.
+ *
+ * Returns: A #GtkWidget that you can use in your UI.
+ */
+GtkWidget *
+gimp_font_select_widget_new (const gchar *title,
+ const gchar *font_name,
+ GimpRunFontCallback callback,
+ gpointer data)
+{
+ GtkWidget *font_button;
+ CompatCallbackData *compat_data;
+
+ g_return_val_if_fail (callback != NULL, NULL);
+
+ font_button = gimp_font_select_button_new (title, font_name);
+
+ compat_data = g_slice_new (CompatCallbackData);
+
+ compat_data->callback = callback;
+ compat_data->data = data;
+
+ g_signal_connect_data (font_button, "font-set",
+ G_CALLBACK (compat_callback),
+ compat_data,
+ (GClosureNotify) compat_callback_data_free, 0);
+
+ return font_button;
+}
+
+/**
+ * gimp_font_select_widget_close:
+ * @widget: A font select widget.
+ *
+ * Closes the popup window associated with @widget.
+ */
+void
+gimp_font_select_widget_close (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+
+ gimp_select_button_close_popup (GIMP_SELECT_BUTTON (widget));
+}
+
+/**
+ * gimp_font_select_widget_set:
+ * @widget: A font select widget.
+ * @font_name: Font name to set; %NULL means no change.
+ *
+ * Sets the current font for the font select widget. Calls the
+ * callback function if one was supplied in the call to
+ * gimp_font_select_widget_new().
+ */
+void
+gimp_font_select_widget_set (GtkWidget *widget,
+ const gchar *font_name)
+{
+ g_return_if_fail (widget != NULL);
+
+ gimp_font_select_button_set_font (GIMP_FONT_SELECT_BUTTON (widget),
+ font_name);
+}
+
+
+static void
+compat_callback (GimpFontSelectButton *font_button,
+ const gchar *font_name,
+ gboolean dialog_closing,
+ CompatCallbackData *data)
+{
+ data->callback (font_name, dialog_closing, data->data);
+}
+
+static void
+compat_callback_data_free (CompatCallbackData *data)
+{
+ g_slice_free (CompatCallbackData, data);
+}
diff --git a/libgimp/gimpfontmenu.h b/libgimp/gimpfontmenu.h
new file mode 100644
index 0000000..64b8c8f
--- /dev/null
+++ b/libgimp/gimpfontmenu.h
@@ -0,0 +1,49 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpfontmenu.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_FONT_MENU_H__
+#define __GIMP_FONT_MENU_H__
+
+/* These functions are deprecated and should not be used in newly
+ * written code.
+ */
+
+G_BEGIN_DECLS
+
+GIMP_DEPRECATED_FOR(gimp_font_select_button_new)
+GtkWidget * gimp_font_select_widget_new (const gchar *title,
+ const gchar *font_name,
+ GimpRunFontCallback callback,
+ gpointer data);
+
+GIMP_DEPRECATED_FOR(gimp_select_button_close_popup)
+void gimp_font_select_widget_close (GtkWidget *widget);
+GIMP_DEPRECATED_FOR(gimp_font_select_button_set_font)
+void gimp_font_select_widget_set (GtkWidget *widget,
+ const gchar *font_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_FONT_MENU_H__ */
diff --git a/libgimp/gimpfonts_pdb.c b/libgimp/gimpfonts_pdb.c
new file mode 100644
index 0000000..c84b2bd
--- /dev/null
+++ b/libgimp/gimpfonts_pdb.c
@@ -0,0 +1,109 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpfonts_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpfonts
+ * @title: gimpfonts
+ * @short_description: Operations related to fonts.
+ *
+ * Operations related to fonts.
+ **/
+
+
+/**
+ * gimp_fonts_refresh:
+ *
+ * Refresh current fonts. This function always succeeds.
+ *
+ * This procedure retrieves all fonts currently in the user's font path
+ * and updates the font dialogs accordingly. Depending on the amount of
+ * fonts on the system, this can take considerable time.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_fonts_refresh (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-fonts-refresh",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_fonts_get_list:
+ * @filter: An optional regular expression used to filter the list.
+ * @num_fonts: The number of available fonts.
+ *
+ * Retrieve the list of loaded fonts.
+ *
+ * This procedure returns a list of the fonts that are currently
+ * available.
+ *
+ * Returns: The list of font names. The returned value must be freed
+ * with g_strfreev().
+ **/
+gchar **
+gimp_fonts_get_list (const gchar *filter,
+ gint *num_fonts)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar **font_list = NULL;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-fonts-get-list",
+ &nreturn_vals,
+ GIMP_PDB_STRING, filter,
+ GIMP_PDB_END);
+
+ *num_fonts = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_fonts = return_vals[1].data.d_int32;
+ if (*num_fonts > 0)
+ {
+ font_list = g_new0 (gchar *, *num_fonts + 1);
+ for (i = 0; i < *num_fonts; i++)
+ font_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return font_list;
+}
diff --git a/libgimp/gimpfonts_pdb.h b/libgimp/gimpfonts_pdb.h
new file mode 100644
index 0000000..8ef2a7b
--- /dev/null
+++ b/libgimp/gimpfonts_pdb.h
@@ -0,0 +1,42 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpfonts_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_FONTS_PDB_H__
+#define __GIMP_FONTS_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_fonts_refresh (void);
+gchar** gimp_fonts_get_list (const gchar *filter,
+ gint *num_fonts);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_FONTS_PDB_H__ */
diff --git a/libgimp/gimpfontselect.c b/libgimp/gimpfontselect.c
new file mode 100644
index 0000000..2012af6
--- /dev/null
+++ b/libgimp/gimpfontselect.c
@@ -0,0 +1,208 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpfontselect.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+typedef struct
+{
+ gchar *font_callback;
+ guint idle_id;
+ gchar *font_name;
+ GimpRunFontCallback callback;
+ gboolean closing;
+ gpointer data;
+} GimpFontData;
+
+
+/* local function prototypes */
+
+static void gimp_font_data_free (GimpFontData *data);
+
+static void gimp_temp_font_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals);
+static gboolean gimp_temp_font_run_idle (GimpFontData *font_data);
+
+
+/* private variables */
+
+static GHashTable *gimp_font_select_ht = NULL;
+
+
+/* public functions */
+
+const gchar *
+gimp_font_select_new (const gchar *title,
+ const gchar *font_name,
+ GimpRunFontCallback callback,
+ gpointer data)
+{
+ static const GimpParamDef args[] =
+ {
+ { GIMP_PDB_STRING, "str", "String" },
+ { GIMP_PDB_INT32, "dialog-status", "If the dialog was closing "
+ "[0 = No, 1 = Yes]" }
+ };
+
+ gchar *font_callback = gimp_procedural_db_temp_name ();
+
+ gimp_install_temp_proc (font_callback,
+ "Temporary font popup callback procedure",
+ "",
+ "",
+ "",
+ "",
+ NULL,
+ "",
+ GIMP_TEMPORARY,
+ G_N_ELEMENTS (args), 0,
+ args, NULL,
+ gimp_temp_font_run);
+
+ if (gimp_fonts_popup (font_callback, title, font_name))
+ {
+ GimpFontData *font_data;
+
+ gimp_extension_enable (); /* Allow callbacks to be watched */
+
+ /* Now add to hash table so we can find it again */
+ if (! gimp_font_select_ht)
+ {
+ gimp_font_select_ht =
+ g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free,
+ (GDestroyNotify) gimp_font_data_free);
+ }
+
+ font_data = g_slice_new0 (GimpFontData);
+
+ font_data->font_callback = font_callback;
+ font_data->callback = callback;
+ font_data->data = data;
+
+ g_hash_table_insert (gimp_font_select_ht, font_callback, font_data);
+
+ return font_callback;
+ }
+
+ gimp_uninstall_temp_proc (font_callback);
+ g_free (font_callback);
+
+ return NULL;
+}
+
+void
+gimp_font_select_destroy (const gchar *font_callback)
+{
+ GimpFontData *font_data;
+
+ g_return_if_fail (font_callback != NULL);
+ g_return_if_fail (gimp_font_select_ht != NULL);
+
+ font_data = g_hash_table_lookup (gimp_font_select_ht, font_callback);
+
+ if (! font_data)
+ {
+ g_warning ("Can't find internal font data");
+ return;
+ }
+
+ if (font_data->idle_id)
+ g_source_remove (font_data->idle_id);
+
+ g_free (font_data->font_name);
+
+ if (font_data->font_callback)
+ gimp_fonts_close_popup (font_data->font_callback);
+
+ gimp_uninstall_temp_proc (font_callback);
+
+ g_hash_table_remove (gimp_font_select_ht, font_callback);
+}
+
+
+/* private functions */
+
+static void
+gimp_font_data_free (GimpFontData *data)
+{
+ g_slice_free (GimpFontData, data);
+}
+
+static void
+gimp_temp_font_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals)
+{
+ static GimpParam values[1];
+ GimpFontData *font_data;
+
+ font_data = g_hash_table_lookup (gimp_font_select_ht, name);
+
+ if (! font_data)
+ {
+ g_warning ("Can't find internal font data");
+ }
+ else
+ {
+ g_free (font_data->font_name);
+
+ font_data->font_name = g_strdup (param[0].data.d_string);
+ font_data->closing = param[1].data.d_int32;
+
+ if (! font_data->idle_id)
+ font_data->idle_id = g_idle_add ((GSourceFunc) gimp_temp_font_run_idle,
+ font_data);
+ }
+
+ *nreturn_vals = 1;
+ *return_vals = values;
+
+ values[0].type = GIMP_PDB_STATUS;
+ values[0].data.d_status = GIMP_PDB_SUCCESS;
+}
+
+static gboolean
+gimp_temp_font_run_idle (GimpFontData *font_data)
+{
+ font_data->idle_id = 0;
+
+ if (font_data->callback)
+ font_data->callback (font_data->font_name,
+ font_data->closing,
+ font_data->data);
+
+ if (font_data->closing)
+ {
+ gchar *font_callback = font_data->font_callback;
+
+ font_data->font_callback = NULL;
+ gimp_font_select_destroy (font_callback);
+ }
+
+ return FALSE;
+}
diff --git a/libgimp/gimpfontselect.h b/libgimp/gimpfontselect.h
new file mode 100644
index 0000000..3adfb1d
--- /dev/null
+++ b/libgimp/gimpfontselect.h
@@ -0,0 +1,45 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpfontselect.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_FONT_SELECT_H__
+#define __GIMP_FONT_SELECT_H__
+
+G_BEGIN_DECLS
+
+
+typedef void (* GimpRunFontCallback) (const gchar *font_name,
+ gboolean dialog_closing,
+ gpointer user_data);
+
+
+const gchar * gimp_font_select_new (const gchar *title,
+ const gchar *font_name,
+ GimpRunFontCallback callback,
+ gpointer data);
+void gimp_font_select_destroy (const gchar *font_callback);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_FONT_SELECT_H__ */
diff --git a/libgimp/gimpfontselect_pdb.c b/libgimp/gimpfontselect_pdb.c
new file mode 100644
index 0000000..14c1218
--- /dev/null
+++ b/libgimp/gimpfontselect_pdb.c
@@ -0,0 +1,131 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpfontselect_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpfontselect
+ * @title: gimpfontselect
+ * @short_description: Functions providing a font selection dialog.
+ *
+ * Functions providing a font selection dialog.
+ **/
+
+
+/**
+ * gimp_fonts_popup:
+ * @font_callback: The callback PDB proc to call when font selection is made.
+ * @popup_title: Title of the font selection dialog.
+ * @initial_font: The name of the font to set as the first selected.
+ *
+ * Invokes the Gimp font selection.
+ *
+ * This procedure opens the font selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_fonts_popup (const gchar *font_callback,
+ const gchar *popup_title,
+ const gchar *initial_font)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-fonts-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, font_callback,
+ GIMP_PDB_STRING, popup_title,
+ GIMP_PDB_STRING, initial_font,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_fonts_close_popup:
+ * @font_callback: The name of the callback registered for this pop-up.
+ *
+ * Close the font selection dialog.
+ *
+ * This procedure closes an opened font selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_fonts_close_popup (const gchar *font_callback)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-fonts-close-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, font_callback,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_fonts_set_popup:
+ * @font_callback: The name of the callback registered for this pop-up.
+ * @font_name: The name of the font to set as selected.
+ *
+ * Sets the current font in a font selection dialog.
+ *
+ * Sets the current font in a font selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_fonts_set_popup (const gchar *font_callback,
+ const gchar *font_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-fonts-set-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, font_callback,
+ GIMP_PDB_STRING, font_name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpfontselect_pdb.h b/libgimp/gimpfontselect_pdb.h
new file mode 100644
index 0000000..1685e35
--- /dev/null
+++ b/libgimp/gimpfontselect_pdb.h
@@ -0,0 +1,45 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpfontselect_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_FONT_SELECT_PDB_H__
+#define __GIMP_FONT_SELECT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_fonts_popup (const gchar *font_callback,
+ const gchar *popup_title,
+ const gchar *initial_font);
+gboolean gimp_fonts_close_popup (const gchar *font_callback);
+gboolean gimp_fonts_set_popup (const gchar *font_callback,
+ const gchar *font_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_FONT_SELECT_PDB_H__ */
diff --git a/libgimp/gimpfontselectbutton.c b/libgimp/gimpfontselectbutton.c
new file mode 100644
index 0000000..287b666
--- /dev/null
+++ b/libgimp/gimpfontselectbutton.c
@@ -0,0 +1,471 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpfontselectbutton.c
+ * Copyright (C) 2003 Sven Neumann <sven@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimpfontselectbutton.h"
+#include "gimpuimarshal.h"
+
+#include "libgimp-intl.h"
+
+
+/**
+ * SECTION: gimpfontselectbutton
+ * @title: GimpFontSelectButton
+ * @short_description: A button which pops up a font selection dialog.
+ *
+ * A button which pops up a font selection dialog.
+ **/
+
+
+#define GIMP_FONT_SELECT_BUTTON_GET_PRIVATE(obj) ((GimpFontSelectButtonPrivate *) gimp_font_select_button_get_instance_private ((GimpFontSelectButton *) (obj)))
+
+typedef struct _GimpFontSelectButtonPrivate GimpFontSelectButtonPrivate;
+
+struct _GimpFontSelectButtonPrivate
+{
+ gchar *title;
+
+ gchar *font_name; /* local copy */
+
+ GtkWidget *inside;
+ GtkWidget *label;
+};
+
+enum
+{
+ FONT_SET,
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_TITLE,
+ PROP_FONT_NAME
+};
+
+
+/* local function prototypes */
+
+static void gimp_font_select_button_finalize (GObject *object);
+
+static void gimp_font_select_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_font_select_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_font_select_button_clicked (GimpFontSelectButton *button);
+
+static void gimp_font_select_button_callback (const gchar *font_name,
+ gboolean dialog_closing,
+ gpointer user_data);
+
+static void gimp_font_select_drag_data_received (GimpFontSelectButton *button,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time);
+
+static GtkWidget * gimp_font_select_button_create_inside (GimpFontSelectButton *button);
+
+
+static const GtkTargetEntry target = { "application/x-gimp-font-name", 0 };
+
+static guint font_button_signals[LAST_SIGNAL] = { 0 };
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpFontSelectButton, gimp_font_select_button,
+ GIMP_TYPE_SELECT_BUTTON)
+
+
+static void
+gimp_font_select_button_class_init (GimpFontSelectButtonClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GimpSelectButtonClass *select_button_class = GIMP_SELECT_BUTTON_CLASS (klass);
+
+ object_class->finalize = gimp_font_select_button_finalize;
+ object_class->set_property = gimp_font_select_button_set_property;
+ object_class->get_property = gimp_font_select_button_get_property;
+
+ select_button_class->select_destroy = gimp_font_select_destroy;
+
+ klass->font_set = NULL;
+
+ /**
+ * GimpFontSelectButton:title:
+ *
+ * The title to be used for the font selection popup dialog.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_TITLE,
+ g_param_spec_string ("title",
+ "Title",
+ "The title to be used for the font selection popup dialog",
+ _("Font Selection"),
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * GimpFontSelectButton:font-name:
+ *
+ * The name of the currently selected font.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_FONT_NAME,
+ g_param_spec_string ("font-name",
+ "Font name",
+ "The name of the currently selected font",
+ "Sans-serif",
+ GIMP_PARAM_READWRITE));
+
+ /**
+ * GimpFontSelectButton::font-set:
+ * @widget: the object which received the signal.
+ * @font_name: the name of the currently selected font.
+ * @dialog_closing: whether the dialog was closed or not.
+ *
+ * The ::font-set signal is emitted when the user selects a font.
+ *
+ * Since: 2.4
+ */
+ font_button_signals[FONT_SET] =
+ g_signal_new ("font-set",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpFontSelectButtonClass, font_set),
+ NULL, NULL,
+ _gimpui_marshal_VOID__STRING_BOOLEAN,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING,
+ G_TYPE_BOOLEAN);
+}
+
+static void
+gimp_font_select_button_init (GimpFontSelectButton *button)
+{
+ GimpFontSelectButtonPrivate *priv;
+
+ priv = GIMP_FONT_SELECT_BUTTON_GET_PRIVATE (button);
+
+ priv->font_name = NULL;
+
+ priv->inside = gimp_font_select_button_create_inside (button);
+ gtk_container_add (GTK_CONTAINER (button), priv->inside);
+}
+
+/**
+ * gimp_font_select_button_new:
+ * @title: Title of the dialog to use or %NULL to use the default title.
+ * @font_name: Initial font name.
+ *
+ * Creates a new #GtkWidget that completely controls the selection of
+ * a font. This widget is suitable for placement in a table in a
+ * plug-in dialog.
+ *
+ * Returns: A #GtkWidget that you can use in your UI.
+ *
+ * Since: 2.4
+ */
+GtkWidget *
+gimp_font_select_button_new (const gchar *title,
+ const gchar *font_name)
+{
+ GtkWidget *button;
+
+ if (title)
+ button = g_object_new (GIMP_TYPE_FONT_SELECT_BUTTON,
+ "title", title,
+ "font-name", font_name,
+ NULL);
+ else
+ button = g_object_new (GIMP_TYPE_FONT_SELECT_BUTTON,
+ "font-name", font_name,
+ NULL);
+
+ return button;
+}
+
+/**
+ * gimp_font_select_button_get_font:
+ * @button: A #GimpFontSelectButton
+ *
+ * Retrieves the name of currently selected font.
+ *
+ * Returns: an internal copy of the font name which must not be freed.
+ *
+ * Since: 2.4
+ */
+const gchar *
+gimp_font_select_button_get_font (GimpFontSelectButton *button)
+{
+ GimpFontSelectButtonPrivate *priv;
+
+ g_return_val_if_fail (GIMP_IS_FONT_SELECT_BUTTON (button), NULL);
+
+ priv = GIMP_FONT_SELECT_BUTTON_GET_PRIVATE (button);
+ return priv->font_name;
+}
+
+/**
+ * gimp_font_select_button_set_font:
+ * @button: A #GimpFontSelectButton
+ * @font_name: Font name to set; %NULL means no change.
+ *
+ * Sets the current font for the font select button.
+ *
+ * Since: 2.4
+ */
+void
+gimp_font_select_button_set_font (GimpFontSelectButton *button,
+ const gchar *font_name)
+{
+ GimpSelectButton *select_button;
+
+ g_return_if_fail (GIMP_IS_FONT_SELECT_BUTTON (button));
+
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ if (select_button->temp_callback)
+ gimp_fonts_set_popup (select_button->temp_callback, font_name);
+ else
+ gimp_font_select_button_callback (font_name, FALSE, button);
+}
+
+
+/* private functions */
+
+static void
+gimp_font_select_button_finalize (GObject *object)
+{
+ GimpFontSelectButtonPrivate *priv;
+
+ priv = GIMP_FONT_SELECT_BUTTON_GET_PRIVATE (object);
+
+ g_clear_pointer (&priv->font_name, g_free);
+ g_clear_pointer (&priv->title, g_free);
+
+ G_OBJECT_CLASS (gimp_font_select_button_parent_class)->finalize (object);
+}
+
+static void
+gimp_font_select_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpFontSelectButton *button = GIMP_FONT_SELECT_BUTTON (object);
+ GimpFontSelectButtonPrivate *priv;
+
+ priv = GIMP_FONT_SELECT_BUTTON_GET_PRIVATE (button);
+
+ switch (property_id)
+ {
+ case PROP_TITLE:
+ priv->title = g_value_dup_string (value);
+ break;
+ case PROP_FONT_NAME:
+ gimp_font_select_button_set_font (button,
+ g_value_get_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_font_select_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpFontSelectButton *button = GIMP_FONT_SELECT_BUTTON (object);
+ GimpFontSelectButtonPrivate *priv;
+
+ priv = GIMP_FONT_SELECT_BUTTON_GET_PRIVATE (button);
+
+ switch (property_id)
+ {
+ case PROP_TITLE:
+ g_value_set_string (value, priv->title);
+ break;
+ case PROP_FONT_NAME:
+ g_value_set_string (value, priv->font_name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_font_select_button_callback (const gchar *font_name,
+ gboolean dialog_closing,
+ gpointer user_data)
+{
+ GimpFontSelectButton *button;
+ GimpFontSelectButtonPrivate *priv;
+ GimpSelectButton *select_button;
+
+ button = GIMP_FONT_SELECT_BUTTON (user_data);
+
+ priv = GIMP_FONT_SELECT_BUTTON_GET_PRIVATE (button);
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ g_free (priv->font_name);
+ priv->font_name = g_strdup (font_name);
+
+ gtk_label_set_text (GTK_LABEL (priv->label), font_name);
+
+ if (dialog_closing)
+ select_button->temp_callback = NULL;
+
+ g_signal_emit (button, font_button_signals[FONT_SET], 0,
+ font_name, dialog_closing);
+ g_object_notify (G_OBJECT (button), "font-name");
+}
+
+static void
+gimp_font_select_button_clicked (GimpFontSelectButton *button)
+{
+ GimpFontSelectButtonPrivate *priv;
+ GimpSelectButton *select_button;
+
+ priv = GIMP_FONT_SELECT_BUTTON_GET_PRIVATE (button);
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ if (select_button->temp_callback)
+ {
+ /* calling gimp_fonts_set_popup() raises the dialog */
+ gimp_fonts_set_popup (select_button->temp_callback,
+ priv->font_name);
+ }
+ else
+ {
+ select_button->temp_callback =
+ gimp_font_select_new (priv->title, priv->font_name,
+ gimp_font_select_button_callback,
+ button);
+ }
+}
+
+static void
+gimp_font_select_drag_data_received (GimpFontSelectButton *button,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time)
+{
+ gint length = gtk_selection_data_get_length (selection);
+ gchar *str;
+
+ if (gtk_selection_data_get_format (selection) != 8 || length < 1)
+ {
+ g_warning ("%s: received invalid font data", G_STRFUNC);
+ return;
+ }
+
+ str = g_strndup ((const gchar *) gtk_selection_data_get_data (selection),
+ length);
+
+ if (g_utf8_validate (str, -1, NULL))
+ {
+ gint pid;
+ gpointer unused;
+ gint name_offset = 0;
+
+ if (sscanf (str, "%i:%p:%n", &pid, &unused, &name_offset) >= 2 &&
+ pid == gimp_getpid () && name_offset > 0)
+ {
+ gchar *name = str + name_offset;
+
+ gimp_font_select_button_set_font (button, name);
+ }
+ }
+
+ g_free (str);
+}
+
+static GtkWidget *
+gimp_font_select_button_create_inside (GimpFontSelectButton *font_button)
+{
+ GtkWidget *button;
+ GtkWidget *hbox;
+ GtkWidget *image;
+ GimpFontSelectButtonPrivate *priv;
+
+ priv = GIMP_FONT_SELECT_BUTTON_GET_PRIVATE (font_button);
+
+ gtk_widget_push_composite_child ();
+
+ button = gtk_button_new ();
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+ gtk_container_add (GTK_CONTAINER (button), hbox);
+
+ image = gtk_image_new_from_icon_name (GIMP_ICON_FONT,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+
+ priv->label = gtk_label_new (priv->font_name);
+ gtk_box_pack_start (GTK_BOX (hbox), priv->label, TRUE, TRUE, 4);
+
+ gtk_widget_show_all (button);
+
+ g_signal_connect_swapped (button, "clicked",
+ G_CALLBACK (gimp_font_select_button_clicked),
+ font_button);
+
+ gtk_drag_dest_set (GTK_WIDGET (button),
+ GTK_DEST_DEFAULT_HIGHLIGHT |
+ GTK_DEST_DEFAULT_MOTION |
+ GTK_DEST_DEFAULT_DROP,
+ &target, 1,
+ GDK_ACTION_COPY);
+
+ g_signal_connect_swapped (button, "drag-data-received",
+ G_CALLBACK (gimp_font_select_drag_data_received),
+ font_button);
+
+ gtk_widget_pop_composite_child ();
+
+ return button;
+}
diff --git a/libgimp/gimpfontselectbutton.h b/libgimp/gimpfontselectbutton.h
new file mode 100644
index 0000000..df413b6
--- /dev/null
+++ b/libgimp/gimpfontselectbutton.h
@@ -0,0 +1,79 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpfontselectbutton.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_FONT_SELECT_BUTTON_H__
+#define __GIMP_FONT_SELECT_BUTTON_H__
+
+#include <libgimp/gimpselectbutton.h>
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+#define GIMP_TYPE_FONT_SELECT_BUTTON (gimp_font_select_button_get_type ())
+#define GIMP_FONT_SELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_FONT_SELECT_BUTTON, GimpFontSelectButton))
+#define GIMP_FONT_SELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FONT_SELECT_BUTTON, GimpFontSelectButtonClass))
+#define GIMP_IS_FONT_SELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_FONT_SELECT_BUTTON))
+#define GIMP_IS_FONT_SELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FONT_SELECT_BUTTON))
+#define GIMP_FONT_SELECT_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_FONT_SELECT_BUTTON, GimpFontSelectButtonClass))
+
+
+typedef struct _GimpFontSelectButtonClass GimpFontSelectButtonClass;
+
+struct _GimpFontSelectButton
+{
+ GimpSelectButton parent_instance;
+};
+
+struct _GimpFontSelectButtonClass
+{
+ GimpSelectButtonClass parent_class;
+
+ /* font_set signal is emitted when font is chosen */
+ void (* font_set) (GimpFontSelectButton *button,
+ const gchar *font_name,
+ gboolean dialog_closing);
+
+ /* Padding for future expansion */
+ void (*_gimp_reserved1) (void);
+ void (*_gimp_reserved2) (void);
+ void (*_gimp_reserved3) (void);
+ void (*_gimp_reserved4) (void);
+};
+
+
+GType gimp_font_select_button_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_font_select_button_new (const gchar *title,
+ const gchar *font_name);
+
+const gchar * gimp_font_select_button_get_font (GimpFontSelectButton *button);
+void gimp_font_select_button_set_font (GimpFontSelectButton *button,
+ const gchar *font_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_FONT_SELECT_BUTTON_H__ */
diff --git a/libgimp/gimpgimprc.c b/libgimp/gimpgimprc.c
new file mode 100644
index 0000000..15dcde7
--- /dev/null
+++ b/libgimp/gimpgimprc.c
@@ -0,0 +1,60 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2005 Peter Mattis and Spencer Kimball
+ *
+ * gimpgimprc.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * gimp_get_color_configuration:
+ *
+ * Retrieve a copy of the current color management configuration.
+ *
+ * Returns: A copy of the core's #GimpColorConfig. You should unref
+ * this copy if you don't need it any longer.
+ *
+ * Since: 2.4
+ */
+GimpColorConfig *
+gimp_get_color_configuration (void)
+{
+ GimpColorConfig *config;
+ gchar *text;
+ GError *error = NULL;
+
+ text = _gimp_get_color_configuration ();
+
+ g_return_val_if_fail (text != NULL, NULL);
+
+ config = g_object_new (GIMP_TYPE_COLOR_CONFIG, NULL);
+
+ if (! gimp_config_deserialize_string (GIMP_CONFIG (config), text, -1, NULL,
+ &error))
+ {
+ g_warning ("failed to deserialize color configuration: %s",
+ error->message);
+ g_error_free (error);
+ }
+
+ g_free (text);
+
+ return config;
+}
diff --git a/libgimp/gimpgimprc.h b/libgimp/gimpgimprc.h
new file mode 100644
index 0000000..a1326f9
--- /dev/null
+++ b/libgimp/gimpgimprc.h
@@ -0,0 +1,38 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2005 Peter Mattis and Spencer Kimball
+ *
+ * gimpgimprc.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_GIMPRC_H__
+#define __GIMP_GIMPRC_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+GimpColorConfig * gimp_get_color_configuration (void);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_GIMPRC_H__ */
diff --git a/libgimp/gimpgimprc_pdb.c b/libgimp/gimpgimprc_pdb.c
new file mode 100644
index 0000000..499b8fc
--- /dev/null
+++ b/libgimp/gimpgimprc_pdb.c
@@ -0,0 +1,330 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpgimprc_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpgimprc
+ * @title: gimpgimprc
+ * @short_description: Interactions with settings from gimprc.
+ *
+ * Interactions with settings from gimprc.
+ **/
+
+
+/**
+ * gimp_gimprc_query:
+ * @token: The token to query for.
+ *
+ * Queries the gimprc file parser for information on a specified token.
+ *
+ * This procedure is used to locate additional information contained in
+ * the gimprc file considered extraneous to the operation of GIMP.
+ * Plug-ins that need configuration information can expect it will be
+ * stored in the user gimprc file and can use this procedure to
+ * retrieve it. This query procedure will return the value associated
+ * with the specified token. This corresponds _only_ to entries with
+ * the format: (&lt;token&gt; &lt;value&gt;). The value must be a
+ * string. Entries not corresponding to this format will cause warnings
+ * to be issued on gimprc parsing and will not be queryable.
+ *
+ * Returns: The value associated with the queried token.
+ **/
+gchar *
+gimp_gimprc_query (const gchar *token)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *value = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-gimprc-query",
+ &nreturn_vals,
+ GIMP_PDB_STRING, token,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ value = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return value;
+}
+
+/**
+ * gimp_gimprc_set:
+ * @token: The token to add or modify.
+ * @value: The value to set the token to.
+ *
+ * Sets a gimprc token to a value and saves it in the gimprc.
+ *
+ * This procedure is used to add or change additional information in
+ * the gimprc file that is considered extraneous to the operation of
+ * GIMP. Plug-ins that need configuration information can use this
+ * function to store it, and gimp_gimprc_query() to retrieve it. This
+ * will accept _only_ string values in UTF-8 encoding.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_gimprc_set (const gchar *token,
+ const gchar *value)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gimprc-set",
+ &nreturn_vals,
+ GIMP_PDB_STRING, token,
+ GIMP_PDB_STRING, value,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_get_default_comment:
+ *
+ * Get the default image comment as specified in the Preferences.
+ *
+ * Returns a copy of the default image comment.
+ *
+ * Returns: Default image comment.
+ **/
+gchar *
+gimp_get_default_comment (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *comment = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-get-default-comment",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ comment = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return comment;
+}
+
+/**
+ * gimp_get_default_unit:
+ *
+ * Get the default unit (taken from the user's locale).
+ *
+ * Returns the default unit's integer ID.
+ *
+ * Returns: Default unit.
+ *
+ * Since: 2.4
+ **/
+GimpUnit
+gimp_get_default_unit (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpUnit unit_id = 0;
+
+ return_vals = gimp_run_procedure ("gimp-get-default-unit",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ unit_id = return_vals[1].data.d_unit;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return unit_id;
+}
+
+/**
+ * gimp_get_monitor_resolution:
+ * @xres: X resolution.
+ * @yres: Y resolution.
+ *
+ * Get the monitor resolution as specified in the Preferences.
+ *
+ * Returns the resolution of the monitor in pixels/inch. This value is
+ * taken from the Preferences (or the windowing system if this is set
+ * in the Preferences) and there's no guarantee for the value to be
+ * reasonable.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_get_monitor_resolution (gdouble *xres,
+ gdouble *yres)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-get-monitor-resolution",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ *xres = 0.0;
+ *yres = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *xres = return_vals[1].data.d_float;
+ *yres = return_vals[2].data.d_float;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_get_theme_dir:
+ *
+ * Get the directory of the current GUI theme.
+ *
+ * Returns a copy of the current GUI theme dir.
+ *
+ * Deprecated: There is no replacement for this procedure.
+ *
+ * Returns: The GUI theme dir.
+ **/
+gchar *
+gimp_get_theme_dir (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *theme_dir = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-get-theme-dir",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ theme_dir = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return theme_dir;
+}
+
+/**
+ * gimp_get_icon_theme_dir:
+ *
+ * Get the directory of the current icon theme.
+ *
+ * Returns a copy of the current icon theme dir.
+ *
+ * Deprecated: There is no replacement for this procedure.
+ *
+ * Returns: The icon theme dir.
+ *
+ * Since: 2.10
+ **/
+gchar *
+gimp_get_icon_theme_dir (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *icon_theme_dir = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-get-icon-theme-dir",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ icon_theme_dir = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return icon_theme_dir;
+}
+
+/**
+ * _gimp_get_color_configuration:
+ *
+ * Get a serialized version of the color management configuration.
+ *
+ * Returns a string that can be deserialized into a GimpColorConfig
+ * object representing the current color management configuration.
+ *
+ * Returns: Serialized color management configuration.
+ *
+ * Since: 2.4
+ **/
+gchar *
+_gimp_get_color_configuration (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *config = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-get-color-configuration",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ config = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return config;
+}
+
+/**
+ * gimp_get_module_load_inhibit:
+ *
+ * Get the list of modules which should not be loaded.
+ *
+ * Returns a copy of the list of modules which should not be loaded.
+ *
+ * Returns: The list of modules.
+ **/
+gchar *
+gimp_get_module_load_inhibit (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *load_inhibit = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-get-module-load-inhibit",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ load_inhibit = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return load_inhibit;
+}
diff --git a/libgimp/gimpgimprc_pdb.h b/libgimp/gimpgimprc_pdb.h
new file mode 100644
index 0000000..341204f
--- /dev/null
+++ b/libgimp/gimpgimprc_pdb.h
@@ -0,0 +1,52 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpgimprc_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_GIMPRC_PDB_H__
+#define __GIMP_GIMPRC_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gchar* gimp_gimprc_query (const gchar *token);
+gboolean gimp_gimprc_set (const gchar *token,
+ const gchar *value);
+gchar* gimp_get_default_comment (void);
+GimpUnit gimp_get_default_unit (void);
+gboolean gimp_get_monitor_resolution (gdouble *xres,
+ gdouble *yres);
+GIMP_DEPRECATED
+gchar* gimp_get_theme_dir (void);
+GIMP_DEPRECATED
+gchar* gimp_get_icon_theme_dir (void);
+G_GNUC_INTERNAL gchar* _gimp_get_color_configuration (void);
+gchar* gimp_get_module_load_inhibit (void);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_GIMPRC_PDB_H__ */
diff --git a/libgimp/gimpgradient_pdb.c b/libgimp/gimpgradient_pdb.c
new file mode 100644
index 0000000..f47ee8f
--- /dev/null
+++ b/libgimp/gimpgradient_pdb.c
@@ -0,0 +1,1320 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradient_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpgradient
+ * @title: gimpgradient
+ * @short_description: Functions operating on a single gradient.
+ *
+ * Functions operating on a single gradient.
+ **/
+
+
+/**
+ * gimp_gradient_new:
+ * @name: The requested name of the new gradient.
+ *
+ * Creates a new gradient
+ *
+ * This procedure creates a new, uninitialized gradient
+ *
+ * Returns: The actual new gradient name.
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_gradient_new (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *actual_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-new",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ actual_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return actual_name;
+}
+
+/**
+ * gimp_gradient_duplicate:
+ * @name: The gradient name.
+ *
+ * Duplicates a gradient
+ *
+ * This procedure creates an identical gradient by a different name
+ *
+ * Returns: The name of the gradient's copy.
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_gradient_duplicate (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *copy_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-duplicate",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ copy_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return copy_name;
+}
+
+/**
+ * gimp_gradient_is_editable:
+ * @name: The gradient name.
+ *
+ * Tests if gradient can be edited
+ *
+ * Returns TRUE if you have permission to change the gradient
+ *
+ * Returns: TRUE if the gradient can be edited.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_gradient_is_editable (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean editable = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-is-editable",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ editable = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return editable;
+}
+
+/**
+ * gimp_gradient_rename:
+ * @name: The gradient name.
+ * @new_name: The new name of the gradient.
+ *
+ * Rename a gradient
+ *
+ * This procedure renames a gradient
+ *
+ * Returns: The actual new name of the gradient.
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_gradient_rename (const gchar *name,
+ const gchar *new_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *actual_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-rename",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_STRING, new_name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ actual_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return actual_name;
+}
+
+/**
+ * gimp_gradient_delete:
+ * @name: The gradient name.
+ *
+ * Deletes a gradient
+ *
+ * This procedure deletes a gradient
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_delete (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-delete",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_get_number_of_segments:
+ * @name: The gradient name.
+ *
+ * Returns the number of segments of the specified gradient
+ *
+ * This procedure returns the number of segments of the specified
+ * gradient.
+ *
+ * Returns: Number of segments.
+ *
+ * Since: 2.6
+ **/
+gint
+gimp_gradient_get_number_of_segments (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint num_segments = 0;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-get-number-of-segments",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ num_segments = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return num_segments;
+}
+
+/**
+ * gimp_gradient_get_uniform_samples:
+ * @name: The gradient name.
+ * @num_samples: The number of samples to take.
+ * @reverse: Use the reverse gradient.
+ * @num_color_samples: Length of the color_samples array (4 * num_samples).
+ * @color_samples: Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
+ *
+ * Sample the specified in uniform parts.
+ *
+ * This procedure samples the active gradient in the specified number
+ * of uniform parts. It returns a list of floating-point values which
+ * correspond to the RGBA values for each sample. The minimum number of
+ * samples to take is 2, in which case the returned colors will
+ * correspond to the { 0.0, 1.0 } positions in the gradient. For
+ * example, if the number of samples is 3, the procedure will return
+ * the colors at positions { 0.0, 0.5, 1.0 }.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_get_uniform_samples (const gchar *name,
+ gint num_samples,
+ gboolean reverse,
+ gint *num_color_samples,
+ gdouble **color_samples)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-get-uniform-samples",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, num_samples,
+ GIMP_PDB_INT32, reverse,
+ GIMP_PDB_END);
+
+ *num_color_samples = 0;
+ *color_samples = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *num_color_samples = return_vals[1].data.d_int32;
+ *color_samples = g_new (gdouble, *num_color_samples);
+ memcpy (*color_samples,
+ return_vals[2].data.d_floatarray,
+ *num_color_samples * sizeof (gdouble));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_get_custom_samples:
+ * @name: The gradient name.
+ * @num_samples: The number of samples to take.
+ * @positions: The list of positions to sample along the gradient.
+ * @reverse: Use the reverse gradient.
+ * @num_color_samples: Length of the color_samples array (4 * num_samples).
+ * @color_samples: Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
+ *
+ * Sample the specified gradient in custom positions.
+ *
+ * This procedure samples the active gradient in the specified number
+ * of points. The procedure will sample the gradient in the specified
+ * positions from the list. The left endpoint of the gradient
+ * corresponds to position 0.0, and the right endpoint corresponds to
+ * 1.0. The procedure returns a list of floating-point values which
+ * correspond to the RGBA values for each sample.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_get_custom_samples (const gchar *name,
+ gint num_samples,
+ const gdouble *positions,
+ gboolean reverse,
+ gint *num_color_samples,
+ gdouble **color_samples)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-get-custom-samples",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, num_samples,
+ GIMP_PDB_FLOATARRAY, positions,
+ GIMP_PDB_INT32, reverse,
+ GIMP_PDB_END);
+
+ *num_color_samples = 0;
+ *color_samples = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *num_color_samples = return_vals[1].data.d_int32;
+ *color_samples = g_new (gdouble, *num_color_samples);
+ memcpy (*color_samples,
+ return_vals[2].data.d_floatarray,
+ *num_color_samples * sizeof (gdouble));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_get_left_color:
+ * @name: The gradient name.
+ * @segment: The index of the segment within the gradient.
+ * @color: The return color.
+ * @opacity: The opacity of the endpoint.
+ *
+ * Retrieves the left endpoint color of the specified segment
+ *
+ * This procedure retrieves the left endpoint color of the specified
+ * segment of the specified gradient.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_get_left_color (const gchar *name,
+ gint segment,
+ GimpRGB *color,
+ gdouble *opacity)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-get-left-color",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, segment,
+ GIMP_PDB_END);
+
+ *opacity = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *color = return_vals[1].data.d_color;
+ *opacity = return_vals[2].data.d_float;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_set_left_color:
+ * @name: The gradient name.
+ * @segment: The index of the segment within the gradient.
+ * @color: The color to set.
+ * @opacity: The opacity to set for the endpoint.
+ *
+ * Sets the left endpoint color of the specified segment
+ *
+ * This procedure sets the left endpoint color of the specified segment
+ * of the specified gradient.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_set_left_color (const gchar *name,
+ gint segment,
+ const GimpRGB *color,
+ gdouble opacity)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-set-left-color",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, segment,
+ GIMP_PDB_COLOR, color,
+ GIMP_PDB_FLOAT, opacity,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_get_right_color:
+ * @name: The gradient name.
+ * @segment: The index of the segment within the gradient.
+ * @color: The return color.
+ * @opacity: The opacity of the endpoint.
+ *
+ * Retrieves the right endpoint color of the specified segment
+ *
+ * This procedure retrieves the right endpoint color of the specified
+ * segment of the specified gradient.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_get_right_color (const gchar *name,
+ gint segment,
+ GimpRGB *color,
+ gdouble *opacity)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-get-right-color",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, segment,
+ GIMP_PDB_END);
+
+ *opacity = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *color = return_vals[1].data.d_color;
+ *opacity = return_vals[2].data.d_float;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_set_right_color:
+ * @name: The gradient name.
+ * @segment: The index of the segment within the gradient.
+ * @color: The color to set.
+ * @opacity: The opacity to set for the endpoint.
+ *
+ * Sets the right endpoint color of the specified segment
+ *
+ * This procedure sets the right endpoint color of the specified
+ * segment of the specified gradient.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_set_right_color (const gchar *name,
+ gint segment,
+ const GimpRGB *color,
+ gdouble opacity)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-set-right-color",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, segment,
+ GIMP_PDB_COLOR, color,
+ GIMP_PDB_FLOAT, opacity,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_get_left_pos:
+ * @name: The gradient name.
+ * @segment: The index of the segment within the gradient.
+ * @pos: The return position.
+ *
+ * Retrieves the left endpoint position of the specified segment
+ *
+ * This procedure retrieves the left endpoint position of the specified
+ * segment of the specified gradient.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_get_left_pos (const gchar *name,
+ gint segment,
+ gdouble *pos)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-get-left-pos",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, segment,
+ GIMP_PDB_END);
+
+ *pos = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *pos = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_set_left_pos:
+ * @name: The gradient name.
+ * @segment: The index of the segment within the gradient.
+ * @pos: The position to set the guidepoint to.
+ * @final_pos: The return position.
+ *
+ * Sets the left endpoint position of the specified segment
+ *
+ * This procedure sets the left endpoint position of the specified
+ * segment of the specified gradient. The final position will be
+ * between the position of the middle point to the left to the middle
+ * point of the current segment.
+ * This procedure returns the final position.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_set_left_pos (const gchar *name,
+ gint segment,
+ gdouble pos,
+ gdouble *final_pos)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-set-left-pos",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, segment,
+ GIMP_PDB_FLOAT, pos,
+ GIMP_PDB_END);
+
+ *final_pos = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *final_pos = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_get_middle_pos:
+ * @name: The gradient name.
+ * @segment: The index of the segment within the gradient.
+ * @pos: The return position.
+ *
+ * Retrieves the middle point position of the specified segment
+ *
+ * This procedure retrieves the middle point position of the specified
+ * segment of the specified gradient.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_get_middle_pos (const gchar *name,
+ gint segment,
+ gdouble *pos)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-get-middle-pos",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, segment,
+ GIMP_PDB_END);
+
+ *pos = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *pos = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_set_middle_pos:
+ * @name: The gradient name.
+ * @segment: The index of the segment within the gradient.
+ * @pos: The position to set the guidepoint to.
+ * @final_pos: The return position.
+ *
+ * Sets the middle point position of the specified segment
+ *
+ * This procedure sets the middle point position of the specified
+ * segment of the specified gradient. The final position will be
+ * between the two endpoints of the segment.
+ * This procedure returns the final position.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_set_middle_pos (const gchar *name,
+ gint segment,
+ gdouble pos,
+ gdouble *final_pos)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-set-middle-pos",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, segment,
+ GIMP_PDB_FLOAT, pos,
+ GIMP_PDB_END);
+
+ *final_pos = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *final_pos = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_get_right_pos:
+ * @name: The gradient name.
+ * @segment: The index of the segment within the gradient.
+ * @pos: The return position.
+ *
+ * Retrieves the right endpoint position of the specified segment
+ *
+ * This procedure retrieves the right endpoint position of the
+ * specified segment of the specified gradient.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_get_right_pos (const gchar *name,
+ gint segment,
+ gdouble *pos)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-get-right-pos",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, segment,
+ GIMP_PDB_END);
+
+ *pos = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *pos = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_set_right_pos:
+ * @name: The gradient name.
+ * @segment: The index of the segment within the gradient.
+ * @pos: The position to set the guidepoint to.
+ * @final_pos: The return position.
+ *
+ * Sets the right endpoint position of the specified segment
+ *
+ * This procedure sets the right endpoint position of the specified
+ * segment of the specified gradient. The final position will be
+ * between the position of the middle point of the current segment and
+ * the middle point of the segment to the right.
+ * This procedure returns the final position.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_set_right_pos (const gchar *name,
+ gint segment,
+ gdouble pos,
+ gdouble *final_pos)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-set-right-pos",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, segment,
+ GIMP_PDB_FLOAT, pos,
+ GIMP_PDB_END);
+
+ *final_pos = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *final_pos = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_get_blending_function:
+ * @name: The gradient name.
+ * @segment: The index of the segment within the gradient.
+ * @blend_func: The blending function of the segment.
+ *
+ * Retrieves the gradient segment's blending function
+ *
+ * This procedure retrieves the blending function of the segment at the
+ * specified gradient name and segment index.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_get_blending_function (const gchar *name,
+ gint segment,
+ GimpGradientSegmentType *blend_func)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-get-blending-function",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, segment,
+ GIMP_PDB_END);
+
+ *blend_func = 0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *blend_func = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_get_coloring_type:
+ * @name: The gradient name.
+ * @segment: The index of the segment within the gradient.
+ * @coloring_type: The coloring type of the segment.
+ *
+ * Retrieves the gradient segment's coloring type
+ *
+ * This procedure retrieves the coloring type of the segment at the
+ * specified gradient name and segment index.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_get_coloring_type (const gchar *name,
+ gint segment,
+ GimpGradientSegmentColor *coloring_type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-get-coloring-type",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, segment,
+ GIMP_PDB_END);
+
+ *coloring_type = 0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *coloring_type = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_range_set_blending_function:
+ * @name: The gradient name.
+ * @start_segment: The index of the first segment to operate on.
+ * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
+ * @blending_function: The blending function.
+ *
+ * Change the blending function of a segments range
+ *
+ * This function changes the blending function of a segment range to
+ * the specified blending function.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_range_set_blending_function (const gchar *name,
+ gint start_segment,
+ gint end_segment,
+ GimpGradientSegmentType blending_function)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-range-set-blending-function",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, start_segment,
+ GIMP_PDB_INT32, end_segment,
+ GIMP_PDB_INT32, blending_function,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_range_set_coloring_type:
+ * @name: The gradient name.
+ * @start_segment: The index of the first segment to operate on.
+ * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
+ * @coloring_type: The coloring type.
+ *
+ * Change the coloring type of a segments range
+ *
+ * This function changes the coloring type of a segment range to the
+ * specified coloring type.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_range_set_coloring_type (const gchar *name,
+ gint start_segment,
+ gint end_segment,
+ GimpGradientSegmentColor coloring_type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-range-set-coloring-type",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, start_segment,
+ GIMP_PDB_INT32, end_segment,
+ GIMP_PDB_INT32, coloring_type,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_range_flip:
+ * @name: The gradient name.
+ * @start_segment: The index of the first segment to operate on.
+ * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
+ *
+ * Flip the segment range
+ *
+ * This function flips a segment range.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_range_flip (const gchar *name,
+ gint start_segment,
+ gint end_segment)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-range-flip",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, start_segment,
+ GIMP_PDB_INT32, end_segment,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_range_replicate:
+ * @name: The gradient name.
+ * @start_segment: The index of the first segment to operate on.
+ * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
+ * @replicate_times: The number of times to replicate.
+ *
+ * Replicate the segment range
+ *
+ * This function replicates a segment range a given number of times.
+ * Instead of the original segment range, several smaller scaled copies
+ * of it will appear in equal widths.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_range_replicate (const gchar *name,
+ gint start_segment,
+ gint end_segment,
+ gint replicate_times)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-range-replicate",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, start_segment,
+ GIMP_PDB_INT32, end_segment,
+ GIMP_PDB_INT32, replicate_times,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_range_split_midpoint:
+ * @name: The gradient name.
+ * @start_segment: The index of the first segment to operate on.
+ * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
+ *
+ * Splits each segment in the segment range at midpoint
+ *
+ * This function splits each segment in the segment range at its
+ * midpoint.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_range_split_midpoint (const gchar *name,
+ gint start_segment,
+ gint end_segment)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-range-split-midpoint",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, start_segment,
+ GIMP_PDB_INT32, end_segment,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_range_split_uniform:
+ * @name: The gradient name.
+ * @start_segment: The index of the first segment to operate on.
+ * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
+ * @split_parts: The number of uniform divisions to split each segment to.
+ *
+ * Splits each segment in the segment range uniformly
+ *
+ * This function splits each segment in the segment range uniformly
+ * according to the number of times specified by the parameter.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_range_split_uniform (const gchar *name,
+ gint start_segment,
+ gint end_segment,
+ gint split_parts)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-range-split-uniform",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, start_segment,
+ GIMP_PDB_INT32, end_segment,
+ GIMP_PDB_INT32, split_parts,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_range_delete:
+ * @name: The gradient name.
+ * @start_segment: The index of the first segment to operate on.
+ * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
+ *
+ * Delete the segment range
+ *
+ * This function deletes a segment range.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_range_delete (const gchar *name,
+ gint start_segment,
+ gint end_segment)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-range-delete",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, start_segment,
+ GIMP_PDB_INT32, end_segment,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_range_redistribute_handles:
+ * @name: The gradient name.
+ * @start_segment: The index of the first segment to operate on.
+ * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
+ *
+ * Uniformly redistribute the segment range's handles
+ *
+ * This function redistributes the handles of the specified segment
+ * range of the specified gradient, so they'll be evenly spaced.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_range_redistribute_handles (const gchar *name,
+ gint start_segment,
+ gint end_segment)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-range-redistribute-handles",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, start_segment,
+ GIMP_PDB_INT32, end_segment,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_range_blend_colors:
+ * @name: The gradient name.
+ * @start_segment: The index of the first segment to operate on.
+ * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
+ *
+ * Blend the colors of the segment range.
+ *
+ * This function blends the colors (but not the opacity) of the
+ * segments' range of the gradient. Using it, the colors' transition
+ * will be uniform across the range.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_range_blend_colors (const gchar *name,
+ gint start_segment,
+ gint end_segment)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-range-blend-colors",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, start_segment,
+ GIMP_PDB_INT32, end_segment,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_range_blend_opacity:
+ * @name: The gradient name.
+ * @start_segment: The index of the first segment to operate on.
+ * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
+ *
+ * Blend the opacity of the segment range.
+ *
+ * This function blends the opacity (but not the colors) of the
+ * segments' range of the gradient. Using it, the opacity's transition
+ * will be uniform across the range.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_gradient_segment_range_blend_opacity (const gchar *name,
+ gint start_segment,
+ gint end_segment)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-range-blend-opacity",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, start_segment,
+ GIMP_PDB_INT32, end_segment,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradient_segment_range_move:
+ * @name: The gradient name.
+ * @start_segment: The index of the first segment to operate on.
+ * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
+ * @delta: The delta to move the segment range.
+ * @control_compress: Whether or not to compress the neighboring segments.
+ *
+ * Move the position of an entire segment range by a delta.
+ *
+ * This function moves the position of an entire segment range by a
+ * delta. The actual delta (which is returned) will be limited by the
+ * control points of the neighboring segments.
+ *
+ * Returns: The final delta by which the range moved.
+ *
+ * Since: 2.2
+ **/
+gdouble
+gimp_gradient_segment_range_move (const gchar *name,
+ gint start_segment,
+ gint end_segment,
+ gdouble delta,
+ gboolean control_compress)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble final_delta = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-gradient-segment-range-move",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, start_segment,
+ GIMP_PDB_INT32, end_segment,
+ GIMP_PDB_FLOAT, delta,
+ GIMP_PDB_INT32, control_compress,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ final_delta = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return final_delta;
+}
diff --git a/libgimp/gimpgradient_pdb.h b/libgimp/gimpgradient_pdb.h
new file mode 100644
index 0000000..e0ea6b3
--- /dev/null
+++ b/libgimp/gimpgradient_pdb.h
@@ -0,0 +1,139 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradient_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_GRADIENT_PDB_H__
+#define __GIMP_GRADIENT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gchar* gimp_gradient_new (const gchar *name);
+gchar* gimp_gradient_duplicate (const gchar *name);
+gboolean gimp_gradient_is_editable (const gchar *name);
+gchar* gimp_gradient_rename (const gchar *name,
+ const gchar *new_name);
+gboolean gimp_gradient_delete (const gchar *name);
+gint gimp_gradient_get_number_of_segments (const gchar *name);
+gboolean gimp_gradient_get_uniform_samples (const gchar *name,
+ gint num_samples,
+ gboolean reverse,
+ gint *num_color_samples,
+ gdouble **color_samples);
+gboolean gimp_gradient_get_custom_samples (const gchar *name,
+ gint num_samples,
+ const gdouble *positions,
+ gboolean reverse,
+ gint *num_color_samples,
+ gdouble **color_samples);
+gboolean gimp_gradient_segment_get_left_color (const gchar *name,
+ gint segment,
+ GimpRGB *color,
+ gdouble *opacity);
+gboolean gimp_gradient_segment_set_left_color (const gchar *name,
+ gint segment,
+ const GimpRGB *color,
+ gdouble opacity);
+gboolean gimp_gradient_segment_get_right_color (const gchar *name,
+ gint segment,
+ GimpRGB *color,
+ gdouble *opacity);
+gboolean gimp_gradient_segment_set_right_color (const gchar *name,
+ gint segment,
+ const GimpRGB *color,
+ gdouble opacity);
+gboolean gimp_gradient_segment_get_left_pos (const gchar *name,
+ gint segment,
+ gdouble *pos);
+gboolean gimp_gradient_segment_set_left_pos (const gchar *name,
+ gint segment,
+ gdouble pos,
+ gdouble *final_pos);
+gboolean gimp_gradient_segment_get_middle_pos (const gchar *name,
+ gint segment,
+ gdouble *pos);
+gboolean gimp_gradient_segment_set_middle_pos (const gchar *name,
+ gint segment,
+ gdouble pos,
+ gdouble *final_pos);
+gboolean gimp_gradient_segment_get_right_pos (const gchar *name,
+ gint segment,
+ gdouble *pos);
+gboolean gimp_gradient_segment_set_right_pos (const gchar *name,
+ gint segment,
+ gdouble pos,
+ gdouble *final_pos);
+gboolean gimp_gradient_segment_get_blending_function (const gchar *name,
+ gint segment,
+ GimpGradientSegmentType *blend_func);
+gboolean gimp_gradient_segment_get_coloring_type (const gchar *name,
+ gint segment,
+ GimpGradientSegmentColor *coloring_type);
+gboolean gimp_gradient_segment_range_set_blending_function (const gchar *name,
+ gint start_segment,
+ gint end_segment,
+ GimpGradientSegmentType blending_function);
+gboolean gimp_gradient_segment_range_set_coloring_type (const gchar *name,
+ gint start_segment,
+ gint end_segment,
+ GimpGradientSegmentColor coloring_type);
+gboolean gimp_gradient_segment_range_flip (const gchar *name,
+ gint start_segment,
+ gint end_segment);
+gboolean gimp_gradient_segment_range_replicate (const gchar *name,
+ gint start_segment,
+ gint end_segment,
+ gint replicate_times);
+gboolean gimp_gradient_segment_range_split_midpoint (const gchar *name,
+ gint start_segment,
+ gint end_segment);
+gboolean gimp_gradient_segment_range_split_uniform (const gchar *name,
+ gint start_segment,
+ gint end_segment,
+ gint split_parts);
+gboolean gimp_gradient_segment_range_delete (const gchar *name,
+ gint start_segment,
+ gint end_segment);
+gboolean gimp_gradient_segment_range_redistribute_handles (const gchar *name,
+ gint start_segment,
+ gint end_segment);
+gboolean gimp_gradient_segment_range_blend_colors (const gchar *name,
+ gint start_segment,
+ gint end_segment);
+gboolean gimp_gradient_segment_range_blend_opacity (const gchar *name,
+ gint start_segment,
+ gint end_segment);
+gdouble gimp_gradient_segment_range_move (const gchar *name,
+ gint start_segment,
+ gint end_segment,
+ gdouble delta,
+ gboolean control_compress);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_GRADIENT_PDB_H__ */
diff --git a/libgimp/gimpgradientmenu.c b/libgimp/gimpgradientmenu.c
new file mode 100644
index 0000000..e3f4ff3
--- /dev/null
+++ b/libgimp/gimpgradientmenu.c
@@ -0,0 +1,148 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradientmenu.c
+ * Copyright (C) 1998 Andy Thomas
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimpgradientmenu.h"
+#include "gimpgradientselectbutton.h"
+
+
+/**
+ * SECTION: gimpgradientmenu
+ * @title: gimpgradientmenu
+ * @short_description: A widget for selecting gradients.
+ *
+ * A widget for selecting gradients.
+ **/
+
+
+typedef struct
+{
+ GimpRunGradientCallback callback;
+ gpointer data;
+} CompatCallbackData;
+
+
+static void compat_callback (GimpGradientSelectButton *gradient_button,
+ const gchar *gradient_name,
+ gint width,
+ const gdouble *grad_data,
+ gboolean dialog_closing,
+ CompatCallbackData *data);
+static void compat_callback_data_free (CompatCallbackData *data);
+
+
+/**
+ * gimp_gradient_select_widget_new:
+ * @title: Title of the dialog to use or %NULL to use the default title.
+ * @gradient_name: Initial gradient name.
+ * @callback: A function to call when the selected gradient changes.
+ * @data: A pointer to arbitrary data to be used in the call to @callback.
+ *
+ * Creates a new #GtkWidget that completely controls the selection of
+ * a gradient. This widget is suitable for placement in a table in a
+ * plug-in dialog.
+ *
+ * Returns: A #GtkWidget that you can use in your UI.
+ *
+ * Since: 2.2
+ */
+GtkWidget *
+gimp_gradient_select_widget_new (const gchar *title,
+ const gchar *gradient_name,
+ GimpRunGradientCallback callback,
+ gpointer data)
+{
+ GtkWidget *gradient_button;
+ CompatCallbackData *compat_data;
+
+ g_return_val_if_fail (callback != NULL, NULL);
+
+ gradient_button = gimp_gradient_select_button_new (title, gradient_name);
+
+ compat_data = g_slice_new (CompatCallbackData);
+
+ compat_data->callback = callback;
+ compat_data->data = data;
+
+ g_signal_connect_data (gradient_button, "gradient-set",
+ G_CALLBACK (compat_callback),
+ compat_data,
+ (GClosureNotify) compat_callback_data_free, 0);
+
+ return gradient_button;
+}
+
+/**
+ * gimp_gradient_select_widget_close:
+ * @widget: A gradient select widget.
+ *
+ * Closes the popup window associated with @widget.
+ */
+void
+gimp_gradient_select_widget_close (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+
+ gimp_select_button_close_popup (GIMP_SELECT_BUTTON (widget));
+}
+
+/**
+ * gimp_gradient_select_widget_set:
+ * @widget: A gradient select widget.
+ * @gradient_name: Gradient name to set.
+ *
+ * Sets the current gradient for the gradient select widget. Calls the
+ * callback function if one was supplied in the call to
+ * gimp_gradient_select_widget_new().
+ */
+void
+gimp_gradient_select_widget_set (GtkWidget *widget,
+ const gchar *gradient_name)
+{
+ g_return_if_fail (widget != NULL);
+
+ gimp_gradient_select_button_set_gradient (GIMP_GRADIENT_SELECT_BUTTON (widget),
+ gradient_name);
+}
+
+
+static void
+compat_callback (GimpGradientSelectButton *gradient_button,
+ const gchar *gradient_name,
+ gint width,
+ const gdouble *grad_data,
+ gboolean dialog_closing,
+ CompatCallbackData *data)
+{
+ data->callback (gradient_name, width, grad_data, dialog_closing, data->data);
+}
+
+static void
+compat_callback_data_free (CompatCallbackData *data)
+{
+ g_slice_free (CompatCallbackData, data);
+}
diff --git a/libgimp/gimpgradientmenu.h b/libgimp/gimpgradientmenu.h
new file mode 100644
index 0000000..975fab8
--- /dev/null
+++ b/libgimp/gimpgradientmenu.h
@@ -0,0 +1,49 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradientmenu.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_GRAIDENT_MENU_H__
+#define __GIMP_GRADIENT_MENU_H__
+
+/* These functions are deprecated and should not be used in newly
+ * written code.
+ */
+
+G_BEGIN_DECLS
+
+GIMP_DEPRECATED_FOR(gimp_gradient_select_button_new)
+GtkWidget * gimp_gradient_select_widget_new (const gchar *title,
+ const gchar *gradient_name,
+ GimpRunGradientCallback callback,
+ gpointer data);
+
+GIMP_DEPRECATED_FOR(gimp_select_button_close_popup)
+void gimp_gradient_select_widget_close (GtkWidget *widget);
+GIMP_DEPRECATED_FOR(gimp_gradient_select_button_set_gradient)
+void gimp_gradient_select_widget_set (GtkWidget *widget,
+ const gchar *gradient_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_GRADIENT_MENU_H__ */
diff --git a/libgimp/gimpgradients.c b/libgimp/gimpgradients.c
new file mode 100644
index 0000000..08f7249
--- /dev/null
+++ b/libgimp/gimpgradients.c
@@ -0,0 +1,53 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradients.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+#include "gimpgradients.h"
+
+/**
+ * gimp_gradients_get_gradient:
+ *
+ * This procedure is deprecated! Use gimp_context_get_gradient() instead.
+ *
+ * Returns: The name of the active gradient.
+ */
+gchar *
+gimp_gradients_get_gradient (void)
+{
+ return gimp_context_get_gradient ();
+}
+
+/**
+ * gimp_gradients_set_gradient:
+ * @name: The name of the gradient to set.
+ *
+ * This procedure is deprecated! Use gimp_context_set_gradient() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_gradients_set_gradient (const gchar *name)
+{
+ return gimp_context_set_gradient (name);
+}
diff --git a/libgimp/gimpgradients.h b/libgimp/gimpgradients.h
new file mode 100644
index 0000000..e1edd43
--- /dev/null
+++ b/libgimp/gimpgradients.h
@@ -0,0 +1,39 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradients.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_GRADIENTS_H__
+#define __GIMP_GRADIENTS_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+GIMP_DEPRECATED_FOR(gimp_context_get_gradient)
+gchar * gimp_gradients_get_gradient (void);
+GIMP_DEPRECATED_FOR(gimp_context_set_gradient)
+gboolean gimp_gradients_set_gradient (const gchar *name);
+
+G_END_DECLS
+
+#endif /* __GIMP_GRADIENTS_H__ */
diff --git a/libgimp/gimpgradients_pdb.c b/libgimp/gimpgradients_pdb.c
new file mode 100644
index 0000000..cc211d4
--- /dev/null
+++ b/libgimp/gimpgradients_pdb.c
@@ -0,0 +1,237 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradients_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpgradients
+ * @title: gimpgradients
+ * @short_description: Operations related to gradients.
+ *
+ * Operations related to gradients.
+ **/
+
+
+/**
+ * gimp_gradients_refresh:
+ *
+ * Refresh current gradients. This function always succeeds.
+ *
+ * This procedure retrieves all gradients currently in the user's
+ * gradient path and updates the gradient dialogs accordingly.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_gradients_refresh (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradients-refresh",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradients_get_list:
+ * @filter: An optional regular expression used to filter the list.
+ * @num_gradients: The number of loaded gradients.
+ *
+ * Retrieve the list of loaded gradients.
+ *
+ * This procedure returns a list of the gradients that are currently
+ * loaded. You can later use the gimp_context_set_gradient() function
+ * to set the active gradient.
+ *
+ * Returns: The list of gradient names. The returned value must be
+ * freed with g_strfreev().
+ **/
+gchar **
+gimp_gradients_get_list (const gchar *filter,
+ gint *num_gradients)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar **gradient_list = NULL;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-gradients-get-list",
+ &nreturn_vals,
+ GIMP_PDB_STRING, filter,
+ GIMP_PDB_END);
+
+ *num_gradients = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_gradients = return_vals[1].data.d_int32;
+ if (*num_gradients > 0)
+ {
+ gradient_list = g_new0 (gchar *, *num_gradients + 1);
+ for (i = 0; i < *num_gradients; i++)
+ gradient_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return gradient_list;
+}
+
+/**
+ * gimp_gradients_sample_uniform:
+ * @num_samples: The number of samples to take.
+ * @reverse: Use the reverse gradient.
+ *
+ * Deprecated: Use gimp_gradient_get_uniform_samples() instead.
+ *
+ * Returns: Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
+ **/
+gdouble *
+gimp_gradients_sample_uniform (gint num_samples,
+ gboolean reverse)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble *color_samples = NULL;
+ gint num_color_samples;
+
+ return_vals = gimp_run_procedure ("gimp-gradients-sample-uniform",
+ &nreturn_vals,
+ GIMP_PDB_INT32, num_samples,
+ GIMP_PDB_INT32, reverse,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ num_color_samples = return_vals[1].data.d_int32;
+ color_samples = g_new (gdouble, num_color_samples);
+ memcpy (color_samples,
+ return_vals[2].data.d_floatarray,
+ num_color_samples * sizeof (gdouble));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return color_samples;
+}
+
+/**
+ * gimp_gradients_sample_custom:
+ * @num_samples: The number of samples to take.
+ * @positions: The list of positions to sample along the gradient.
+ * @reverse: Use the reverse gradient.
+ *
+ * Deprecated: Use gimp_gradient_get_custom_samples() instead.
+ *
+ * Returns: Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
+ **/
+gdouble *
+gimp_gradients_sample_custom (gint num_samples,
+ const gdouble *positions,
+ gboolean reverse)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble *color_samples = NULL;
+ gint num_color_samples;
+
+ return_vals = gimp_run_procedure ("gimp-gradients-sample-custom",
+ &nreturn_vals,
+ GIMP_PDB_INT32, num_samples,
+ GIMP_PDB_FLOATARRAY, positions,
+ GIMP_PDB_INT32, reverse,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ num_color_samples = return_vals[1].data.d_int32;
+ color_samples = g_new (gdouble, num_color_samples);
+ memcpy (color_samples,
+ return_vals[2].data.d_floatarray,
+ num_color_samples * sizeof (gdouble));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return color_samples;
+}
+
+/**
+ * gimp_gradients_get_gradient_data:
+ * @name: The gradient name (\"\" means current active gradient).
+ * @sample_size: Size of the sample to return when the gradient is changed.
+ * @reverse: Use the reverse gradient.
+ * @width: The gradient sample width (r,g,b,a).
+ * @grad_data: The gradient sample data.
+ *
+ * Deprecated: Use gimp_gradient_get_uniform_samples() instead.
+ *
+ * Returns: The gradient name.
+ **/
+gchar *
+gimp_gradients_get_gradient_data (const gchar *name,
+ gint sample_size,
+ gboolean reverse,
+ gint *width,
+ gdouble **grad_data)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *actual_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-gradients-get-gradient-data",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, sample_size,
+ GIMP_PDB_INT32, reverse,
+ GIMP_PDB_END);
+
+ *width = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ actual_name = g_strdup (return_vals[1].data.d_string);
+ *width = return_vals[2].data.d_int32;
+ *grad_data = g_new (gdouble, *width);
+ memcpy (*grad_data,
+ return_vals[3].data.d_floatarray,
+ *width * sizeof (gdouble));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return actual_name;
+}
diff --git a/libgimp/gimpgradients_pdb.h b/libgimp/gimpgradients_pdb.h
new file mode 100644
index 0000000..f869f47
--- /dev/null
+++ b/libgimp/gimpgradients_pdb.h
@@ -0,0 +1,55 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradients_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_GRADIENTS_PDB_H__
+#define __GIMP_GRADIENTS_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_gradients_refresh (void);
+gchar** gimp_gradients_get_list (const gchar *filter,
+ gint *num_gradients);
+GIMP_DEPRECATED_FOR(gimp_gradient_get_uniform_samples)
+gdouble* gimp_gradients_sample_uniform (gint num_samples,
+ gboolean reverse);
+GIMP_DEPRECATED_FOR(gimp_gradient_get_custom_samples)
+gdouble* gimp_gradients_sample_custom (gint num_samples,
+ const gdouble *positions,
+ gboolean reverse);
+GIMP_DEPRECATED_FOR(gimp_gradient_get_uniform_samples)
+gchar* gimp_gradients_get_gradient_data (const gchar *name,
+ gint sample_size,
+ gboolean reverse,
+ gint *width,
+ gdouble **grad_data);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_GRADIENTS_PDB_H__ */
diff --git a/libgimp/gimpgradientselect.c b/libgimp/gimpgradientselect.c
new file mode 100644
index 0000000..28e5de1
--- /dev/null
+++ b/libgimp/gimpgradientselect.c
@@ -0,0 +1,225 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradientselect.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+typedef struct
+{
+ gchar *gradient_callback;
+ guint idle_id;
+ gchar *gradient_name;
+ gint width;
+ gdouble *gradient_data;
+ GimpRunGradientCallback callback;
+ gboolean closing;
+ gpointer data;
+} GimpGradientData;
+
+
+/* local function prototypes */
+
+static void gimp_gradient_data_free (GimpGradientData *data);
+
+static void gimp_temp_gradient_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals);
+static gboolean gimp_temp_gradient_run_idle (GimpGradientData *gradient_data);
+
+
+/* private variables */
+
+static GHashTable *gimp_gradient_select_ht = NULL;
+
+
+/* public functions */
+
+const gchar *
+gimp_gradient_select_new (const gchar *title,
+ const gchar *gradient_name,
+ gint sample_size,
+ GimpRunGradientCallback callback,
+ gpointer data)
+{
+ static const GimpParamDef args[] =
+ {
+ { GIMP_PDB_STRING, "str", "String" },
+ { GIMP_PDB_INT32, "gradient-width", "Gradient width" },
+ { GIMP_PDB_FLOATARRAY,"gradient-data", "The gradient mask data" },
+ { GIMP_PDB_INT32, "dialog-status", "If the dialog was closing "
+ "[0 = No, 1 = Yes]" }
+ };
+
+ gchar *gradient_callback = gimp_procedural_db_temp_name ();
+
+ gimp_install_temp_proc (gradient_callback,
+ "Temporary gradient popup callback procedure",
+ "",
+ "",
+ "",
+ "",
+ NULL,
+ "",
+ GIMP_TEMPORARY,
+ G_N_ELEMENTS (args), 0,
+ args, NULL,
+ gimp_temp_gradient_run);
+
+ if (gimp_gradients_popup (gradient_callback, title, gradient_name,
+ sample_size))
+ {
+ GimpGradientData *gradient_data;
+
+ gimp_extension_enable (); /* Allow callbacks to be watched */
+
+ /* Now add to hash table so we can find it again */
+ if (! gimp_gradient_select_ht)
+ {
+ gimp_gradient_select_ht =
+ g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free,
+ (GDestroyNotify) gimp_gradient_data_free);
+ }
+
+ gradient_data = g_slice_new0 (GimpGradientData);
+
+ gradient_data->gradient_callback = gradient_callback;
+ gradient_data->callback = callback;
+ gradient_data->data = data;
+
+ g_hash_table_insert (gimp_gradient_select_ht,
+ gradient_callback, gradient_data);
+
+ return gradient_callback;
+ }
+
+ gimp_uninstall_temp_proc (gradient_callback);
+ g_free (gradient_callback);
+
+ return NULL;
+}
+
+void
+gimp_gradient_select_destroy (const gchar *gradient_callback)
+{
+ GimpGradientData *gradient_data;
+
+ g_return_if_fail (gradient_callback != NULL);
+ g_return_if_fail (gimp_gradient_select_ht != NULL);
+
+ gradient_data = g_hash_table_lookup (gimp_gradient_select_ht,
+ gradient_callback);
+
+ if (! gradient_data)
+ {
+ g_warning ("Can't find internal gradient data");
+ return;
+ }
+
+ if (gradient_data->idle_id)
+ g_source_remove (gradient_data->idle_id);
+
+ g_free (gradient_data->gradient_name);
+ g_free (gradient_data->gradient_data);
+
+ if (gradient_data->gradient_callback)
+ gimp_gradients_close_popup (gradient_data->gradient_callback);
+
+ gimp_uninstall_temp_proc (gradient_callback);
+
+ g_hash_table_remove (gimp_gradient_select_ht, gradient_callback);
+}
+
+
+/* private functions */
+
+static void
+gimp_gradient_data_free (GimpGradientData *data)
+{
+ g_slice_free (GimpGradientData, data);
+}
+
+static void
+gimp_temp_gradient_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals)
+{
+ static GimpParam values[1];
+ GimpGradientData *gradient_data;
+
+ gradient_data = g_hash_table_lookup (gimp_gradient_select_ht, name);
+
+ if (! gradient_data)
+ {
+ g_warning ("Can't find internal gradient data");
+ }
+ else
+ {
+ g_free (gradient_data->gradient_name);
+ g_free (gradient_data->gradient_data);
+
+ gradient_data->gradient_name = g_strdup (param[0].data.d_string);
+ gradient_data->width = param[1].data.d_int32;
+ gradient_data->gradient_data = g_memdup (param[2].data.d_floatarray,
+ param[1].data.d_int32 *
+ sizeof (gdouble));
+ gradient_data->closing = param[3].data.d_int32;
+
+ if (! gradient_data->idle_id)
+ gradient_data->idle_id =
+ g_idle_add ((GSourceFunc) gimp_temp_gradient_run_idle,
+ gradient_data);
+ }
+
+ *nreturn_vals = 1;
+ *return_vals = values;
+
+ values[0].type = GIMP_PDB_STATUS;
+ values[0].data.d_status = GIMP_PDB_SUCCESS;
+}
+
+static gboolean
+gimp_temp_gradient_run_idle (GimpGradientData *gradient_data)
+{
+ gradient_data->idle_id = 0;
+
+ if (gradient_data->callback)
+ gradient_data->callback (gradient_data->gradient_name,
+ gradient_data->width,
+ gradient_data->gradient_data,
+ gradient_data->closing,
+ gradient_data->data);
+
+ if (gradient_data->closing)
+ {
+ gchar *gradient_callback = gradient_data->gradient_callback;
+
+ gradient_data->gradient_callback = NULL;
+ gimp_gradient_select_destroy (gradient_callback);
+ }
+
+ return FALSE;
+}
diff --git a/libgimp/gimpgradientselect.h b/libgimp/gimpgradientselect.h
new file mode 100644
index 0000000..15063cc
--- /dev/null
+++ b/libgimp/gimpgradientselect.h
@@ -0,0 +1,48 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradientselect.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_GRADIENT_SELECT_H__
+#define __GIMP_GRADIENT_SELECT_H__
+
+G_BEGIN_DECLS
+
+
+typedef void (* GimpRunGradientCallback) (const gchar *gradient_name,
+ gint width,
+ const gdouble *grad_data,
+ gboolean dialog_closing,
+ gpointer user_data);
+
+
+const gchar * gimp_gradient_select_new (const gchar *title,
+ const gchar *gradient_name,
+ gint sample_size,
+ GimpRunGradientCallback callback,
+ gpointer data);
+void gimp_gradient_select_destroy (const gchar *gradient_callback);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_GRADIENT_SELECT_H__ */
diff --git a/libgimp/gimpgradientselect_pdb.c b/libgimp/gimpgradientselect_pdb.c
new file mode 100644
index 0000000..86720d1
--- /dev/null
+++ b/libgimp/gimpgradientselect_pdb.c
@@ -0,0 +1,134 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradientselect_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpgradientselect
+ * @title: gimpgradientselect
+ * @short_description: Functions providing a gradient selection dialog.
+ *
+ * Functions providing a gradient selection dialog.
+ **/
+
+
+/**
+ * gimp_gradients_popup:
+ * @gradient_callback: The callback PDB proc to call when gradient selection is made.
+ * @popup_title: Title of the gradient selection dialog.
+ * @initial_gradient: The name of the gradient to set as the first selected.
+ * @sample_size: Size of the sample to return when the gradient is changed.
+ *
+ * Invokes the Gimp gradients selection.
+ *
+ * This procedure opens the gradient selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_gradients_popup (const gchar *gradient_callback,
+ const gchar *popup_title,
+ const gchar *initial_gradient,
+ gint sample_size)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradients-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, gradient_callback,
+ GIMP_PDB_STRING, popup_title,
+ GIMP_PDB_STRING, initial_gradient,
+ GIMP_PDB_INT32, sample_size,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradients_close_popup:
+ * @gradient_callback: The name of the callback registered for this pop-up.
+ *
+ * Close the gradient selection dialog.
+ *
+ * This procedure closes an opened gradient selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_gradients_close_popup (const gchar *gradient_callback)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradients-close-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, gradient_callback,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_gradients_set_popup:
+ * @gradient_callback: The name of the callback registered for this pop-up.
+ * @gradient_name: The name of the gradient to set as selected.
+ *
+ * Sets the current gradient in a gradient selection dialog.
+ *
+ * Sets the current gradient in a gradient selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_gradients_set_popup (const gchar *gradient_callback,
+ const gchar *gradient_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-gradients-set-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, gradient_callback,
+ GIMP_PDB_STRING, gradient_name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpgradientselect_pdb.h b/libgimp/gimpgradientselect_pdb.h
new file mode 100644
index 0000000..e3b8593
--- /dev/null
+++ b/libgimp/gimpgradientselect_pdb.h
@@ -0,0 +1,46 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradientselect_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_GRADIENT_SELECT_PDB_H__
+#define __GIMP_GRADIENT_SELECT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_gradients_popup (const gchar *gradient_callback,
+ const gchar *popup_title,
+ const gchar *initial_gradient,
+ gint sample_size);
+gboolean gimp_gradients_close_popup (const gchar *gradient_callback);
+gboolean gimp_gradients_set_popup (const gchar *gradient_callback,
+ const gchar *gradient_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_GRADIENT_SELECT_PDB_H__ */
diff --git a/libgimp/gimpgradientselectbutton.c b/libgimp/gimpgradientselectbutton.c
new file mode 100644
index 0000000..fac6e3a
--- /dev/null
+++ b/libgimp/gimpgradientselectbutton.c
@@ -0,0 +1,628 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradientselectbutton.c
+ * Copyright (C) 1998 Andy Thomas
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimpgradientselectbutton.h"
+#include "gimpuimarshal.h"
+
+#include "libgimp-intl.h"
+
+
+/**
+ * SECTION: gimpgradientselectbutton
+ * @title: GimpGradientSelectButton
+ * @short_description: A button which pops up a gradient select dialog.
+ *
+ * A button which pops up a gradient select dialog.
+ **/
+
+
+#define CELL_HEIGHT 18
+#define CELL_WIDTH 84
+
+
+#define GIMP_GRADIENT_SELECT_BUTTON_GET_PRIVATE(obj) ((GimpGradientSelectButtonPrivate *) gimp_gradient_select_button_get_instance_private ((GimpGradientSelectButton *) (obj)))
+
+typedef struct _GimpGradientSelectButtonPrivate GimpGradientSelectButtonPrivate;
+
+struct _GimpGradientSelectButtonPrivate
+{
+ gchar *title;
+
+ gchar *gradient_name; /* Local copy */
+ gint sample_size;
+ gboolean reverse;
+ gint n_samples;
+ gdouble *gradient_data; /* Local copy */
+
+ GtkWidget *inside;
+ GtkWidget *preview;
+};
+
+enum
+{
+ GRADIENT_SET,
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_TITLE,
+ PROP_GRADIENT_NAME
+};
+
+
+/* local function prototypes */
+
+static void gimp_gradient_select_button_finalize (GObject *object);
+
+static void gimp_gradient_select_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_gradient_select_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_gradient_select_button_clicked (GimpGradientSelectButton *button);
+
+static void gimp_gradient_select_button_callback (const gchar *gradient_name,
+ gint n_samples,
+ const gdouble *gradient_data,
+ gboolean dialog_closing,
+ gpointer user_data);
+
+static void gimp_gradient_select_preview_size_allocate
+ (GtkWidget *widget,
+ GtkAllocation *allocation,
+ GimpGradientSelectButton *button);
+static gboolean gimp_gradient_select_preview_expose (GtkWidget *preview,
+ GdkEventExpose *event,
+ GimpGradientSelectButton *button);
+
+static void gimp_gradient_select_drag_data_received (GimpGradientSelectButton *button,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time);
+
+static GtkWidget * gimp_gradient_select_button_create_inside (GimpGradientSelectButton *button);
+
+
+static const GtkTargetEntry target = { "application/x-gimp-gradient-name", 0 };
+
+static guint gradient_button_signals[LAST_SIGNAL] = { 0 };
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpGradientSelectButton,
+ gimp_gradient_select_button,
+ GIMP_TYPE_SELECT_BUTTON)
+
+
+static void
+gimp_gradient_select_button_class_init (GimpGradientSelectButtonClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GimpSelectButtonClass *select_button_class = GIMP_SELECT_BUTTON_CLASS (klass);
+
+ object_class->finalize = gimp_gradient_select_button_finalize;
+ object_class->set_property = gimp_gradient_select_button_set_property;
+ object_class->get_property = gimp_gradient_select_button_get_property;
+
+ select_button_class->select_destroy = gimp_gradient_select_destroy;
+
+ klass->gradient_set = NULL;
+
+ /**
+ * GimpGradientSelectButton:title:
+ *
+ * The title to be used for the gradient selection popup dialog.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_TITLE,
+ g_param_spec_string ("title",
+ "Title",
+ "The title to be used for the gradient selection popup dialog",
+ _("Gradient Selection"),
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * GimpGradientSelectButton:gradient-name:
+ *
+ * The name of the currently selected gradient.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_GRADIENT_NAME,
+ g_param_spec_string ("gradient-name",
+ "Gradient name",
+ "The name of the currently selected gradient",
+ NULL,
+ GIMP_PARAM_READWRITE));
+
+ /**
+ * GimpGradientSelectButton::gradient-set:
+ * @widget: the object which received the signal.
+ * @gradient_name: the name of the currently selected gradient.
+ * @width: width of the gradient
+ * @grad_data: gradient data
+ * @dialog_closing: whether the dialog was closed or not.
+ *
+ * The ::gradient-set signal is emitted when the user selects a gradient.
+ *
+ * Since: 2.4
+ */
+ gradient_button_signals[GRADIENT_SET] =
+ g_signal_new ("gradient-set",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpGradientSelectButtonClass, gradient_set),
+ NULL, NULL,
+ _gimpui_marshal_VOID__STRING_INT_POINTER_BOOLEAN,
+ G_TYPE_NONE, 4,
+ G_TYPE_STRING,
+ G_TYPE_INT,
+ G_TYPE_POINTER,
+ G_TYPE_BOOLEAN);
+}
+
+static void
+gimp_gradient_select_button_init (GimpGradientSelectButton *button)
+{
+ GimpGradientSelectButtonPrivate *priv;
+
+ priv = GIMP_GRADIENT_SELECT_BUTTON_GET_PRIVATE (button);
+
+ priv->gradient_name = gimp_context_get_gradient ();
+ priv->sample_size = CELL_WIDTH;
+ priv->reverse = FALSE;
+
+ priv->inside = gimp_gradient_select_button_create_inside (button);
+ gtk_container_add (GTK_CONTAINER (button), priv->inside);
+}
+
+/**
+ * gimp_gradient_select_button_new:
+ * @title: Title of the dialog to use or %NULL to use the default title.
+ * @gradient_name: Initial gradient name.
+ *
+ * Creates a new #GtkWidget that completely controls the selection of
+ * a gradient. This widget is suitable for placement in a table in a
+ * plug-in dialog.
+ *
+ * Returns: A #GtkWidget that you can use in your UI.
+ *
+ * Since: 2.4
+ */
+GtkWidget *
+gimp_gradient_select_button_new (const gchar *title,
+ const gchar *gradient_name)
+{
+ GtkWidget *button;
+
+ if (title)
+ button = g_object_new (GIMP_TYPE_GRADIENT_SELECT_BUTTON,
+ "title", title,
+ "gradient-name", gradient_name,
+ NULL);
+ else
+ button = g_object_new (GIMP_TYPE_GRADIENT_SELECT_BUTTON,
+ "gradient-name", gradient_name,
+ NULL);
+
+ return button;
+}
+
+/**
+ * gimp_gradient_select_button_get_gradient:
+ * @button: A #GimpGradientSelectButton
+ *
+ * Retrieves the name of currently selected gradient.
+ *
+ * Returns: an internal copy of the gradient name which must not be freed.
+ *
+ * Since: 2.4
+ */
+const gchar *
+gimp_gradient_select_button_get_gradient (GimpGradientSelectButton *button)
+{
+ GimpGradientSelectButtonPrivate *priv;
+
+ g_return_val_if_fail (GIMP_IS_GRADIENT_SELECT_BUTTON (button), NULL);
+
+ priv = GIMP_GRADIENT_SELECT_BUTTON_GET_PRIVATE (button);
+ return priv->gradient_name;
+}
+
+/**
+ * gimp_gradient_select_button_set_gradient:
+ * @button: A #GimpGradientSelectButton
+ * @gradient_name: Gradient name to set.
+ *
+ * Sets the current gradient for the gradient select button.
+ *
+ * Since: 2.4
+ */
+void
+gimp_gradient_select_button_set_gradient (GimpGradientSelectButton *button,
+ const gchar *gradient_name)
+{
+ GimpGradientSelectButtonPrivate *priv;
+ GimpSelectButton *select_button;
+
+ g_return_if_fail (GIMP_IS_GRADIENT_SELECT_BUTTON (button));
+
+ priv = GIMP_GRADIENT_SELECT_BUTTON_GET_PRIVATE (button);
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ if (select_button->temp_callback)
+ {
+ gimp_gradients_set_popup (select_button->temp_callback, gradient_name);
+ }
+ else
+ {
+ gchar *name;
+ gdouble *samples;
+ gint n_samples;
+
+ if (gradient_name && *gradient_name)
+ name = g_strdup (gradient_name);
+ else
+ name = gimp_context_get_gradient ();
+
+ if (gimp_gradient_get_uniform_samples (name,
+ priv->sample_size,
+ priv->reverse,
+ &n_samples,
+ &samples))
+ {
+ gimp_gradient_select_button_callback (name,
+ n_samples, samples,
+ FALSE, button);
+
+ g_free (samples);
+ }
+
+ g_free (name);
+ }
+}
+
+
+/* private functions */
+
+static void
+gimp_gradient_select_button_finalize (GObject *object)
+{
+ GimpGradientSelectButtonPrivate *priv;
+
+ priv = GIMP_GRADIENT_SELECT_BUTTON_GET_PRIVATE (object);
+
+ g_clear_pointer (&priv->gradient_name, g_free);
+ g_clear_pointer (&priv->gradient_data, g_free);
+ g_clear_pointer (&priv->title, g_free);
+
+ G_OBJECT_CLASS (gimp_gradient_select_button_parent_class)->finalize (object);
+}
+
+static void
+gimp_gradient_select_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpGradientSelectButton *button;
+ GimpGradientSelectButtonPrivate *priv;
+
+ button = GIMP_GRADIENT_SELECT_BUTTON (object);
+ priv = GIMP_GRADIENT_SELECT_BUTTON_GET_PRIVATE (button);
+
+ switch (property_id)
+ {
+ case PROP_TITLE:
+ priv->title = g_value_dup_string (value);
+ break;
+ case PROP_GRADIENT_NAME:
+ gimp_gradient_select_button_set_gradient (button,
+ g_value_get_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_gradient_select_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpGradientSelectButton *button;
+ GimpGradientSelectButtonPrivate *priv;
+
+ button = GIMP_GRADIENT_SELECT_BUTTON (object);
+ priv = GIMP_GRADIENT_SELECT_BUTTON_GET_PRIVATE (button);
+
+ switch (property_id)
+ {
+ case PROP_TITLE:
+ g_value_set_string (value, priv->title);
+ break;
+ case PROP_GRADIENT_NAME:
+ g_value_set_string (value, priv->gradient_name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_gradient_select_button_callback (const gchar *gradient_name,
+ gint n_samples,
+ const gdouble *gradient_data,
+ gboolean dialog_closing,
+ gpointer user_data)
+{
+ GimpGradientSelectButton *button;
+ GimpGradientSelectButtonPrivate *priv;
+ GimpSelectButton *select_button;
+
+ button = GIMP_GRADIENT_SELECT_BUTTON (user_data);
+
+ priv = GIMP_GRADIENT_SELECT_BUTTON_GET_PRIVATE (button);
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ g_free (priv->gradient_name);
+ g_free (priv->gradient_data);
+
+ priv->gradient_name = g_strdup (gradient_name);
+ priv->n_samples = n_samples;
+ priv->gradient_data = g_memdup (gradient_data, n_samples * sizeof (gdouble));
+
+ gtk_widget_queue_draw (priv->preview);
+
+ if (dialog_closing)
+ select_button->temp_callback = NULL;
+
+ g_signal_emit (button, gradient_button_signals[GRADIENT_SET], 0,
+ gradient_name, n_samples, gradient_data, dialog_closing);
+ g_object_notify (G_OBJECT (button), "gradient-name");
+}
+
+static void
+gimp_gradient_select_button_clicked (GimpGradientSelectButton *button)
+{
+ GimpGradientSelectButtonPrivate *priv;
+ GimpSelectButton *select_button;
+
+ priv = GIMP_GRADIENT_SELECT_BUTTON_GET_PRIVATE (button);
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ if (select_button->temp_callback)
+ {
+ /* calling gimp_gradients_set_popup() raises the dialog */
+ gimp_gradients_set_popup (select_button->temp_callback,
+ priv->gradient_name);
+ }
+ else
+ {
+ select_button->temp_callback =
+ gimp_gradient_select_new (priv->title, priv->gradient_name,
+ priv->sample_size,
+ gimp_gradient_select_button_callback,
+ button);
+ }
+}
+
+static void
+gimp_gradient_select_preview_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation,
+ GimpGradientSelectButton *button)
+{
+ gdouble *samples;
+ gint n_samples;
+ GimpGradientSelectButtonPrivate *priv;
+
+ priv = GIMP_GRADIENT_SELECT_BUTTON_GET_PRIVATE (button);
+
+ if (gimp_gradient_get_uniform_samples (priv->gradient_name,
+ allocation->width,
+ priv->reverse,
+ &n_samples,
+ &samples))
+ {
+ g_free (priv->gradient_data);
+
+ priv->sample_size = allocation->width;
+ priv->n_samples = n_samples;
+ priv->gradient_data = samples;
+ }
+}
+
+static gboolean
+gimp_gradient_select_preview_expose (GtkWidget *widget,
+ GdkEventExpose *event,
+ GimpGradientSelectButton *button)
+{
+ GimpGradientSelectButtonPrivate *priv;
+ GtkAllocation allocation;
+ cairo_t *cr;
+ cairo_pattern_t *pattern;
+ cairo_surface_t *surface;
+ const gdouble *src;
+ guchar *dest;
+ gint width;
+ gint x;
+
+ priv = GIMP_GRADIENT_SELECT_BUTTON_GET_PRIVATE (button);
+
+ src = priv->gradient_data;
+ if (! src)
+ return FALSE;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ cr = gdk_cairo_create (event->window);
+
+ gdk_cairo_region (cr, event->region);
+ cairo_clip (cr);
+
+ pattern = gimp_cairo_checkerboard_create (cr, GIMP_CHECK_SIZE_SM, NULL, NULL);
+ cairo_set_source (cr, pattern);
+ cairo_pattern_destroy (pattern);
+
+ cairo_paint (cr);
+
+ width = priv->n_samples / 4;
+
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, 1);
+
+ for (x = 0, dest = cairo_image_surface_get_data (surface);
+ x < width;
+ x++, src += 4, dest += 4)
+ {
+ GimpRGB color;
+ guchar r, g, b, a;
+
+ gimp_rgba_set (&color, src[0], src[1], src[2], src[3]);
+ gimp_rgba_get_uchar (&color, &r, &g, &b, &a);
+
+ GIMP_CAIRO_ARGB32_SET_PIXEL(dest, r, g, b, a);
+ }
+
+ cairo_surface_mark_dirty (surface);
+
+ pattern = cairo_pattern_create_for_surface (surface);
+ cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REFLECT);
+ cairo_surface_destroy (surface);
+
+ cairo_scale (cr, (gdouble) allocation.width / (gdouble) width, 1.0);
+
+ cairo_set_source (cr, pattern);
+ cairo_pattern_destroy (pattern);
+
+ cairo_paint (cr);
+
+ cairo_destroy (cr);
+
+ return FALSE;
+}
+
+static void
+gimp_gradient_select_drag_data_received (GimpGradientSelectButton *button,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time)
+{
+ gint length = gtk_selection_data_get_length (selection);
+ gchar *str;
+
+ if (gtk_selection_data_get_format (selection) != 8 || length < 1)
+ {
+ g_warning ("%s: received invalid gradient data", G_STRFUNC);
+ return;
+ }
+
+ str = g_strndup ((const gchar *) gtk_selection_data_get_data (selection),
+ length);
+
+ if (g_utf8_validate (str, -1, NULL))
+ {
+ gint pid;
+ gpointer unused;
+ gint name_offset = 0;
+
+ if (sscanf (str, "%i:%p:%n", &pid, &unused, &name_offset) >= 2 &&
+ pid == gimp_getpid () && name_offset > 0)
+ {
+ gchar *name = str + name_offset;
+
+ gimp_gradient_select_button_set_gradient (button, name);
+ }
+ }
+
+ g_free (str);
+}
+
+static GtkWidget *
+gimp_gradient_select_button_create_inside (GimpGradientSelectButton *gradient_button)
+{
+ GtkWidget *button;
+ GimpGradientSelectButtonPrivate *priv;
+
+ priv = GIMP_GRADIENT_SELECT_BUTTON_GET_PRIVATE (gradient_button);
+
+ gtk_widget_push_composite_child ();
+
+ button = gtk_button_new ();
+
+ priv->preview = gtk_drawing_area_new ();
+ gtk_widget_set_size_request (priv->preview, CELL_WIDTH, CELL_HEIGHT);
+ gtk_container_add (GTK_CONTAINER (button), priv->preview);
+
+ g_signal_connect (priv->preview, "size-allocate",
+ G_CALLBACK (gimp_gradient_select_preview_size_allocate),
+ gradient_button);
+
+ g_signal_connect (priv->preview, "expose-event",
+ G_CALLBACK (gimp_gradient_select_preview_expose),
+ gradient_button);
+
+ gtk_widget_show_all (button);
+
+ g_signal_connect_swapped (button, "clicked",
+ G_CALLBACK (gimp_gradient_select_button_clicked),
+ gradient_button);
+
+ gtk_drag_dest_set (GTK_WIDGET (button),
+ GTK_DEST_DEFAULT_HIGHLIGHT |
+ GTK_DEST_DEFAULT_MOTION |
+ GTK_DEST_DEFAULT_DROP,
+ &target, 1,
+ GDK_ACTION_COPY);
+
+ g_signal_connect_swapped (button, "drag-data-received",
+ G_CALLBACK (gimp_gradient_select_drag_data_received),
+ gradient_button);
+
+ gtk_widget_pop_composite_child ();
+
+ return button;
+}
diff --git a/libgimp/gimpgradientselectbutton.h b/libgimp/gimpgradientselectbutton.h
new file mode 100644
index 0000000..a6f2958
--- /dev/null
+++ b/libgimp/gimpgradientselectbutton.h
@@ -0,0 +1,81 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpgradientselectbutton.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_GRADIENT_SELECT_BUTTON_H__
+#define __GIMP_GRADIENT_SELECT_BUTTON_H__
+
+#include <libgimp/gimpselectbutton.h>
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+#define GIMP_TYPE_GRADIENT_SELECT_BUTTON (gimp_gradient_select_button_get_type ())
+#define GIMP_GRADIENT_SELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_GRADIENT_SELECT_BUTTON, GimpGradientSelectButton))
+#define GIMP_GRADIENT_SELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_GRADIENT_SELECT_BUTTON, GimpGradientSelectButtonClass))
+#define GIMP_IS_GRADIENT_SELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_GRADIENT_SELECT_BUTTON))
+#define GIMP_IS_GRADIENT_SELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_GRADIENT_SELECT_BUTTON))
+#define GIMP_GRADIENT_SELECT_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_GRADIENT_SELECT_BUTTON, GimpGradientSelectButtonClass))
+
+
+typedef struct _GimpGradientSelectButtonClass GimpGradientSelectButtonClass;
+
+struct _GimpGradientSelectButton
+{
+ GimpSelectButton parent_instance;
+};
+
+struct _GimpGradientSelectButtonClass
+{
+ GimpSelectButtonClass parent_class;
+
+ /* gradient_set signal is emitted when gradient is chosen */
+ void (* gradient_set) (GimpGradientSelectButton *button,
+ const gchar *gradient_name,
+ gint width,
+ const gdouble *gradient_data,
+ gboolean dialog_closing);
+
+ /* Padding for future expansion */
+ void (*_gimp_reserved1) (void);
+ void (*_gimp_reserved2) (void);
+ void (*_gimp_reserved3) (void);
+ void (*_gimp_reserved4) (void);
+};
+
+
+GType gimp_gradient_select_button_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_gradient_select_button_new (const gchar *title,
+ const gchar *gradient_name);
+
+const gchar * gimp_gradient_select_button_get_gradient (GimpGradientSelectButton *button);
+void gimp_gradient_select_button_set_gradient (GimpGradientSelectButton *button,
+ const gchar *gradient_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_GRADIENT_SELECT_BUTTON_H__ */
diff --git a/libgimp/gimphelp_pdb.c b/libgimp/gimphelp_pdb.c
new file mode 100644
index 0000000..38e2be5
--- /dev/null
+++ b/libgimp/gimphelp_pdb.c
@@ -0,0 +1,72 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimphelp_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimphelp
+ * @title: gimphelp
+ * @short_description: Loading help pages using gimp_help.
+ *
+ * Loading help pages using gimp_help.
+ **/
+
+
+/**
+ * gimp_help:
+ * @help_domain: The help domain in which help_id is registered.
+ * @help_id: The help page's ID.
+ *
+ * Load a help page.
+ *
+ * This procedure loads the specified help page into the helpbrowser or
+ * what ever is configured as help viewer. The help page is identified
+ * by its domain and ID: if help_domain is NULL, we use the help_domain
+ * which was registered using the gimp_plugin_help_register()
+ * procedure. If help_domain is NULL and no help domain was registered,
+ * the help domain of the main GIMP installation is used.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_help (const gchar *help_domain,
+ const gchar *help_id)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-help",
+ &nreturn_vals,
+ GIMP_PDB_STRING, help_domain,
+ GIMP_PDB_STRING, help_id,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimphelp_pdb.h b/libgimp/gimphelp_pdb.h
new file mode 100644
index 0000000..850bab4
--- /dev/null
+++ b/libgimp/gimphelp_pdb.h
@@ -0,0 +1,41 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimphelp_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_HELP_PDB_H__
+#define __GIMP_HELP_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_help (const gchar *help_domain,
+ const gchar *help_id);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_HELP_PDB_H__ */
diff --git a/libgimp/gimpimage.c b/libgimp/gimpimage.c
new file mode 100644
index 0000000..2b3c110
--- /dev/null
+++ b/libgimp/gimpimage.c
@@ -0,0 +1,520 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimpimage.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+#include "gimpimage.h"
+
+/**
+ * gimp_image_get_colormap:
+ * @image_ID: The image.
+ * @num_colors: Returns the number of colors in the colormap array.
+ *
+ * Returns the image's colormap
+ *
+ * This procedure returns an actual pointer to the image's colormap, as
+ * well as the number of colors contained in the colormap. If the image
+ * is not of base type INDEXED, this pointer will be NULL.
+ *
+ * Returns: The image's colormap.
+ */
+guchar *
+gimp_image_get_colormap (gint32 image_ID,
+ gint *num_colors)
+{
+ gint num_bytes;
+ guchar *cmap;
+
+ cmap = _gimp_image_get_colormap (image_ID, &num_bytes);
+
+ if (num_colors)
+ *num_colors = num_bytes / 3;
+
+ return cmap;
+}
+
+/**
+ * gimp_image_set_colormap:
+ * @image_ID: The image.
+ * @colormap: The new colormap values.
+ * @num_colors: Number of colors in the colormap array.
+ *
+ * Sets the entries in the image's colormap.
+ *
+ * This procedure sets the entries in the specified image's colormap.
+ * The number of colors is specified by the \"num_colors\" parameter
+ * and corresponds to the number of INT8 triples that must be contained
+ * in the \"cmap\" array.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_image_set_colormap (gint32 image_ID,
+ const guchar *colormap,
+ gint num_colors)
+{
+ return _gimp_image_set_colormap (image_ID, num_colors * 3, colormap);
+}
+
+guchar *
+gimp_image_get_thumbnail_data (gint32 image_ID,
+ gint *width,
+ gint *height,
+ gint *bpp)
+{
+ gint ret_width;
+ gint ret_height;
+ guchar *image_data;
+ gint data_size;
+
+ _gimp_image_thumbnail (image_ID,
+ *width,
+ *height,
+ &ret_width,
+ &ret_height,
+ bpp,
+ &data_size,
+ &image_data);
+
+ *width = ret_width;
+ *height = ret_height;
+
+ return image_data;
+}
+
+/**
+ * gimp_image_get_metadata:
+ * @image_ID: The image.
+ *
+ * Returns the image's metadata.
+ *
+ * Returns exif/iptc/xmp metadata from the image.
+ *
+ * Returns: The exif/ptc/xmp metadata, or %NULL if there is none.
+ *
+ * Since: 2.10
+ **/
+GimpMetadata *
+gimp_image_get_metadata (gint32 image_ID)
+{
+ GimpMetadata *metadata = NULL;
+ gchar *metadata_string;
+
+ metadata_string = _gimp_image_get_metadata (image_ID);
+ if (metadata_string)
+ {
+ metadata = gimp_metadata_deserialize (metadata_string);
+ g_free (metadata_string);
+ }
+
+ return metadata;
+}
+
+/**
+ * gimp_image_set_metadata:
+ * @image_ID: The image.
+ * @metadata: The exif/ptc/xmp metadata.
+ *
+ * Set the image's metadata.
+ *
+ * Sets exif/iptc/xmp metadata on the image, or deletes it if
+ * @metadata is %NULL.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_image_set_metadata (gint32 image_ID,
+ GimpMetadata *metadata)
+{
+ gchar *metadata_string = NULL;
+ gboolean success;
+
+ if (metadata)
+ metadata_string = gimp_metadata_serialize (metadata);
+
+ success = _gimp_image_set_metadata (image_ID, metadata_string);
+
+ if (metadata_string)
+ g_free (metadata_string);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_cmap:
+ * @image_ID: The image.
+ * @num_colors: Number of colors in the colormap array.
+ *
+ * Deprecated: Use gimp_image_get_colormap() instead.
+ *
+ * Returns: The image's colormap.
+ */
+guchar *
+gimp_image_get_cmap (gint32 image_ID,
+ gint *num_colors)
+{
+ return gimp_image_get_colormap (image_ID, num_colors);
+}
+
+/**
+ * gimp_image_set_cmap:
+ * @image_ID: The image.
+ * @cmap: The new colormap values.
+ * @num_colors: Number of colors in the colormap array.
+ *
+ * Deprecated: Use gimp_image_set_colormap() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_image_set_cmap (gint32 image_ID,
+ const guchar *cmap,
+ gint num_colors)
+{
+ return gimp_image_set_colormap (image_ID, cmap, num_colors);
+}
+
+/**
+ * gimp_image_get_layer_position:
+ * @image_ID: The image.
+ * @layer_ID: The layer.
+ *
+ * Deprecated: Use gimp_image_get_item_position() instead.
+ *
+ * Returns: The position of the layer in the layer stack.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_image_get_layer_position (gint32 image_ID,
+ gint32 layer_ID)
+{
+ return gimp_image_get_item_position (image_ID, layer_ID);
+}
+
+/**
+ * gimp_image_raise_layer:
+ * @image_ID: The image.
+ * @layer_ID: The layer to raise.
+ *
+ * Deprecated: Use gimp_image_raise_item() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_raise_layer (gint32 image_ID,
+ gint32 layer_ID)
+{
+ return gimp_image_raise_item (image_ID, layer_ID);
+}
+
+/**
+ * gimp_image_lower_layer:
+ * @image_ID: The image.
+ * @layer_ID: The layer to lower.
+ *
+ * Deprecated: Use gimp_image_lower_item() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_lower_layer (gint32 image_ID,
+ gint32 layer_ID)
+{
+ return gimp_image_lower_item (image_ID, layer_ID);
+}
+
+/**
+ * gimp_image_raise_layer_to_top:
+ * @image_ID: The image.
+ * @layer_ID: The layer to raise to top.
+ *
+ * Deprecated: Use gimp_image_raise_item_to_top() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_raise_layer_to_top (gint32 image_ID,
+ gint32 layer_ID)
+{
+ return gimp_image_raise_item_to_top (image_ID, layer_ID);
+}
+
+/**
+ * gimp_image_lower_layer_to_bottom:
+ * @image_ID: The image.
+ * @layer_ID: The layer to lower to bottom.
+ *
+ * Deprecated: Use gimp_image_lower_item_to_bottom() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_lower_layer_to_bottom (gint32 image_ID,
+ gint32 layer_ID)
+{
+ return gimp_image_lower_item_to_bottom (image_ID, layer_ID);
+}
+
+/**
+ * gimp_image_get_channel_position:
+ * @image_ID: The image.
+ * @channel_ID: The channel.
+ *
+ * Deprecated: Use gimp_image_get_item_position() instead.
+ *
+ * Returns: The position of the channel in the channel stack.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_image_get_channel_position (gint32 image_ID,
+ gint32 channel_ID)
+{
+ return gimp_image_get_item_position (image_ID, channel_ID);
+}
+
+/**
+ * gimp_image_raise_channel:
+ * @image_ID: The image.
+ * @channel_ID: The channel to raise.
+ *
+ * Deprecated: Use gimp_image_raise_item() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_raise_channel (gint32 image_ID,
+ gint32 channel_ID)
+{
+ return gimp_image_raise_item (image_ID, channel_ID);
+}
+
+/**
+ * gimp_image_lower_channel:
+ * @image_ID: The image.
+ * @channel_ID: The channel to lower.
+ *
+ * Deprecated: Use gimp_image_lower_item() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_lower_channel (gint32 image_ID,
+ gint32 channel_ID)
+{
+ return gimp_image_lower_item (image_ID, channel_ID);
+}
+
+/**
+ * gimp_image_get_vectors_position:
+ * @image_ID: The image.
+ * @vectors_ID: The vectors object.
+ *
+ * Deprecated: Use gimp_image_get_item_position() instead.
+ *
+ * Returns: The position of the vectors object in the vectors stack.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_image_get_vectors_position (gint32 image_ID,
+ gint32 vectors_ID)
+{
+ return gimp_image_get_item_position (image_ID, vectors_ID);
+}
+
+/**
+ * gimp_image_raise_vectors:
+ * @image_ID: The image.
+ * @vectors_ID: The vectors object to raise.
+ *
+ * Deprecated: Use gimp_image_raise_item() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_raise_vectors (gint32 image_ID,
+ gint32 vectors_ID)
+{
+ return gimp_image_raise_item (image_ID, vectors_ID);
+}
+
+/**
+ * gimp_image_lower_vectors:
+ * @image_ID: The image.
+ * @vectors_ID: The vectors object to lower.
+ *
+ * Deprecated: Use gimp_image_lower_item() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_lower_vectors (gint32 image_ID,
+ gint32 vectors_ID)
+{
+ return gimp_image_lower_item (image_ID, vectors_ID);
+}
+
+/**
+ * gimp_image_raise_vectors_to_top:
+ * @image_ID: The image.
+ * @vectors_ID: The vectors object to raise to top.
+ *
+ * Deprecated: Use gimp_image_raise_item_to_top() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_raise_vectors_to_top (gint32 image_ID,
+ gint32 vectors_ID)
+{
+ return gimp_image_raise_item_to_top (image_ID, vectors_ID);
+}
+
+/**
+ * gimp_image_lower_vectors_to_bottom:
+ * @image_ID: The image.
+ * @vectors_ID: The vectors object to lower to bottom.
+ *
+ * Deprecated: Use gimp_image_lower_item_to_bottom() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_lower_vectors_to_bottom (gint32 image_ID,
+ gint32 vectors_ID)
+{
+ return gimp_image_lower_item_to_bottom (image_ID, vectors_ID);
+}
+
+/**
+ * gimp_image_parasite_find:
+ * @image_ID: The image.
+ * @name: The name of the parasite to find.
+ *
+ * Deprecated: Use gimp_image_get_parasite() instead.
+ *
+ * Returns: The found parasite.
+ **/
+GimpParasite *
+gimp_image_parasite_find (gint32 image_ID,
+ const gchar *name)
+{
+ return gimp_image_get_parasite (image_ID, name);
+}
+
+/**
+ * gimp_image_parasite_attach:
+ * @image_ID: The image.
+ * @parasite: The parasite to attach to an image.
+ *
+ * Deprecated: Use gimp_image_attach_parasite() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_parasite_attach (gint32 image_ID,
+ const GimpParasite *parasite)
+{
+ return gimp_image_attach_parasite (image_ID, parasite);
+}
+
+/**
+ * gimp_image_parasite_detach:
+ * @image_ID: The image.
+ * @name: The name of the parasite to detach from an image.
+ *
+ * Deprecated: Use gimp_image_detach_parasite() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_parasite_detach (gint32 image_ID,
+ const gchar *name)
+{
+ return gimp_image_detach_parasite (image_ID, name);
+}
+
+/**
+ * gimp_image_parasite_list:
+ * @image_ID: The image.
+ * @num_parasites: The number of attached parasites.
+ * @parasites: The names of currently attached parasites.
+ *
+ * Deprecated: Use gimp_image_get_parasite_list() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_parasite_list (gint32 image_ID,
+ gint *num_parasites,
+ gchar ***parasites)
+{
+ *parasites = gimp_image_get_parasite_list (image_ID, num_parasites);
+
+ return *parasites != NULL;
+}
+
+/**
+ * gimp_image_attach_new_parasite:
+ * @image_ID: the ID of the image to attach the #GimpParasite to.
+ * @name: the name of the #GimpParasite to create and attach.
+ * @flags: the flags set on the #GimpParasite.
+ * @size: the size of the parasite data in bytes.
+ * @data: a pointer to the data attached with the #GimpParasite.
+ *
+ * Convenience function that creates a parasite and attaches it
+ * to GIMP.
+ *
+ * Deprecated: Use gimp_image_attach_parasite() instead.
+ *
+ * Return value: TRUE on successful creation and attachment of
+ * the new parasite.
+ *
+ * See Also: gimp_image_parasite_attach()
+ */
+gboolean
+gimp_image_attach_new_parasite (gint32 image_ID,
+ const gchar *name,
+ gint flags,
+ gint size,
+ gconstpointer data)
+{
+ GimpParasite *parasite = gimp_parasite_new (name, flags, size, data);
+ gboolean success;
+
+ success = gimp_image_attach_parasite (image_ID, parasite);
+
+ gimp_parasite_free (parasite);
+
+ return success;
+}
diff --git a/libgimp/gimpimage.h b/libgimp/gimpimage.h
new file mode 100644
index 0000000..fd0c44a
--- /dev/null
+++ b/libgimp/gimpimage.h
@@ -0,0 +1,116 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimpimage.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_H__
+#define __GIMP_IMAGE_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+guchar * gimp_image_get_colormap (gint32 image_ID,
+ gint *num_colors);
+gboolean gimp_image_set_colormap (gint32 image_ID,
+ const guchar *colormap,
+ gint num_colors);
+
+guchar * gimp_image_get_thumbnail_data (gint32 image_ID,
+ gint *width,
+ gint *height,
+ gint *bpp);
+
+GimpMetadata * gimp_image_get_metadata (gint32 image_ID);
+gboolean gimp_image_set_metadata (gint32 image_ID,
+ GimpMetadata *metadata);
+
+GIMP_DEPRECATED_FOR(gimp_image_get_colormap)
+guchar * gimp_image_get_cmap (gint32 image_ID,
+ gint *num_colors);
+GIMP_DEPRECATED_FOR(gimp_image_set_colormap)
+gboolean gimp_image_set_cmap (gint32 image_ID,
+ const guchar *cmap,
+ gint num_colors);
+GIMP_DEPRECATED_FOR(gimp_image_get_item_position)
+gint gimp_image_get_layer_position (gint32 image_ID,
+ gint32 layer_ID);
+GIMP_DEPRECATED_FOR(gimp_image_raise_item)
+gboolean gimp_image_raise_layer (gint32 image_ID,
+ gint32 layer_ID);
+GIMP_DEPRECATED_FOR(gimp_image_lower_item)
+gboolean gimp_image_lower_layer (gint32 image_ID,
+ gint32 layer_ID);
+GIMP_DEPRECATED_FOR(gimp_image_raise_item_to_top)
+gboolean gimp_image_raise_layer_to_top (gint32 image_ID,
+ gint32 layer_ID);
+GIMP_DEPRECATED_FOR(gimp_image_lower_item_to_bottom)
+gboolean gimp_image_lower_layer_to_bottom (gint32 image_ID,
+ gint32 layer_ID);
+GIMP_DEPRECATED_FOR(gimp_image_get_item_position)
+gint gimp_image_get_channel_position (gint32 image_ID,
+ gint32 channel_ID);
+GIMP_DEPRECATED_FOR(gimp_image_raise_item)
+gboolean gimp_image_raise_channel (gint32 image_ID,
+ gint32 channel_ID);
+GIMP_DEPRECATED_FOR(gimp_image_lower_item)
+gboolean gimp_image_lower_channel (gint32 image_ID,
+ gint32 channel_ID);
+GIMP_DEPRECATED_FOR(gimp_image_get_item_position)
+gint gimp_image_get_vectors_position (gint32 image_ID,
+ gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_image_raise_item)
+gboolean gimp_image_raise_vectors (gint32 image_ID,
+ gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_image_lower_item)
+gboolean gimp_image_lower_vectors (gint32 image_ID,
+ gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_image_raise_item_to_top)
+gboolean gimp_image_raise_vectors_to_top (gint32 image_ID,
+ gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_image_lower_item_to_bottom)
+gboolean gimp_image_lower_vectors_to_bottom (gint32 image_ID,
+ gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_image_get_parasite)
+GimpParasite * gimp_image_parasite_find (gint32 image_ID,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_image_attach_parasite)
+gboolean gimp_image_parasite_attach (gint32 image_ID,
+ const GimpParasite *parasite);
+GIMP_DEPRECATED_FOR(gimp_image_detach_parasite)
+gboolean gimp_image_parasite_detach (gint32 image_ID,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_image_get_parasite_list)
+gboolean gimp_image_parasite_list (gint32 image_ID,
+ gint *num_parasites,
+ gchar ***parasites);
+GIMP_DEPRECATED_FOR(gimp_image_attach_parasite)
+gboolean gimp_image_attach_new_parasite (gint32 image_ID,
+ const gchar *name,
+ gint flags,
+ gint size,
+ gconstpointer data);
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_H__ */
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
new file mode 100644
index 0000000..b38a152
--- /dev/null
+++ b/libgimp/gimpimage_pdb.c
@@ -0,0 +1,3223 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimage_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpimage
+ * @title: gimpimage
+ * @short_description: Operations on complete images.
+ *
+ * Operations on complete images: creation, resizing/rescaling, and
+ * operations involving multiple layers.
+ **/
+
+
+/**
+ * gimp_image_is_valid:
+ * @image_ID: The image to check.
+ *
+ * Returns TRUE if the image is valid.
+ *
+ * This procedure checks if the given image ID is valid and refers to
+ * an existing image.
+ *
+ * Returns: Whether the image ID is valid.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_is_valid (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean valid = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-image-is-valid",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ valid = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return valid;
+}
+
+/**
+ * gimp_image_list:
+ * @num_images: The number of images currently open.
+ *
+ * Returns the list of images currently open.
+ *
+ * This procedure returns the list of images currently open in GIMP.
+ *
+ * Returns: The list of images currently open. The returned value must
+ * be freed with g_free().
+ **/
+gint *
+gimp_image_list (gint *num_images)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint *image_ids = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-list",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ *num_images = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_images = return_vals[1].data.d_int32;
+ image_ids = g_new (gint32, *num_images);
+ memcpy (image_ids,
+ return_vals[2].data.d_int32array,
+ *num_images * sizeof (gint32));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return image_ids;
+}
+
+/**
+ * gimp_image_new:
+ * @width: The width of the image.
+ * @height: The height of the image.
+ * @type: The type of image.
+ *
+ * Creates a new image with the specified width, height, and type.
+ *
+ * Creates a new image, undisplayed, with the specified extents and
+ * type. A layer should be created and added before this image is
+ * displayed, or subsequent calls to gimp_display_new() with this image
+ * as an argument will fail. Layers can be created using the
+ * gimp_layer_new() commands. They can be added to an image using the
+ * gimp_image_insert_layer() command.
+ *
+ * If your image's type if INDEXED, a colormap must also be added with
+ * gimp_image_set_colormap(). An indexed image without a colormap will
+ * output unexpected colors.
+ *
+ * Returns: The ID of the newly created image.
+ **/
+gint32
+gimp_image_new (gint width,
+ gint height,
+ GimpImageBaseType type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 image_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-new",
+ &nreturn_vals,
+ GIMP_PDB_INT32, width,
+ GIMP_PDB_INT32, height,
+ GIMP_PDB_INT32, type,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ image_ID = return_vals[1].data.d_image;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return image_ID;
+}
+
+/**
+ * gimp_image_new_with_precision:
+ * @width: The width of the image.
+ * @height: The height of the image.
+ * @type: The type of image.
+ * @precision: The precision.
+ *
+ * Creates a new image with the specified width, height, type and
+ * precision.
+ *
+ * Creates a new image, undisplayed with the specified extents, type
+ * and precision. Indexed images can only be created at
+ * GIMP_PRECISION_U8_GAMMA precision. See gimp_image_new() for further
+ * details.
+ *
+ * Returns: The ID of the newly created image.
+ *
+ * Since: 2.10
+ **/
+gint32
+gimp_image_new_with_precision (gint width,
+ gint height,
+ GimpImageBaseType type,
+ GimpPrecision precision)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 image_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-new-with-precision",
+ &nreturn_vals,
+ GIMP_PDB_INT32, width,
+ GIMP_PDB_INT32, height,
+ GIMP_PDB_INT32, type,
+ GIMP_PDB_INT32, precision,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ image_ID = return_vals[1].data.d_image;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return image_ID;
+}
+
+/**
+ * gimp_image_duplicate:
+ * @image_ID: The image.
+ *
+ * Duplicate the specified image
+ *
+ * This procedure duplicates the specified image, copying all layers,
+ * channels, and image information.
+ *
+ * Returns: The new, duplicated image.
+ **/
+gint32
+gimp_image_duplicate (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 new_image_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-duplicate",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ new_image_ID = return_vals[1].data.d_image;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return new_image_ID;
+}
+
+/**
+ * gimp_image_delete:
+ * @image_ID: The image.
+ *
+ * Delete the specified image.
+ *
+ * If there are no displays associated with this image it will be
+ * deleted. This means that you can not delete an image through the PDB
+ * that was created by the user. If the associated display was however
+ * created through the PDB and you know the display ID, you may delete
+ * the display. Removal of the last associated display will then delete
+ * the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_delete (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-delete",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_base_type:
+ * @image_ID: The image.
+ *
+ * Get the base type of the image.
+ *
+ * This procedure returns the image's base type. Layers in the image
+ * must be of this subtype, but can have an optional alpha channel.
+ *
+ * Returns: The image's base type.
+ **/
+GimpImageBaseType
+gimp_image_base_type (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpImageBaseType base_type = 0;
+
+ return_vals = gimp_run_procedure ("gimp-image-base-type",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ base_type = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return base_type;
+}
+
+/**
+ * gimp_image_get_precision:
+ * @image_ID: The image.
+ *
+ * Get the precision of the image.
+ *
+ * This procedure returns the image's precision.
+ *
+ * Returns: The image's precision.
+ *
+ * Since: 2.10
+ **/
+GimpPrecision
+gimp_image_get_precision (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpPrecision precision = 0;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-precision",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ precision = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return precision;
+}
+
+/**
+ * gimp_image_get_default_new_layer_mode:
+ * @image_ID: The image.
+ *
+ * Get the default mode for newly created layers of this image.
+ *
+ * Returns the default mode for newly created layers of this image.
+ *
+ * Returns: The layer mode.
+ *
+ * Since: 2.10
+ **/
+GimpLayerMode
+gimp_image_get_default_new_layer_mode (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpLayerMode mode = 0;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-default-new-layer-mode",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ mode = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return mode;
+}
+
+/**
+ * gimp_image_width:
+ * @image_ID: The image.
+ *
+ * Return the width of the image
+ *
+ * This procedure returns the image's width. This value is independent
+ * of any of the layers in this image. This is the \"canvas\" width.
+ *
+ * Returns: The image's width.
+ **/
+gint
+gimp_image_width (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint width = 0;
+
+ return_vals = gimp_run_procedure ("gimp-image-width",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ width = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return width;
+}
+
+/**
+ * gimp_image_height:
+ * @image_ID: The image.
+ *
+ * Return the height of the image
+ *
+ * This procedure returns the image's height. This value is independent
+ * of any of the layers in this image. This is the \"canvas\" height.
+ *
+ * Returns: The image's height.
+ **/
+gint
+gimp_image_height (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint height = 0;
+
+ return_vals = gimp_run_procedure ("gimp-image-height",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ height = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return height;
+}
+
+/**
+ * gimp_image_free_shadow:
+ * @image_ID: The image.
+ *
+ * Deprecated: Use gimp_drawable_free_shadow() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_free_shadow (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-free-shadow",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_layers:
+ * @image_ID: The image.
+ * @num_layers: The number of layers contained in the image.
+ *
+ * Returns the list of layers contained in the specified image.
+ *
+ * This procedure returns the list of layers contained in the specified
+ * image. The order of layers is from topmost to bottommost.
+ *
+ * Returns: The list of layers contained in the image. The returned
+ * value must be freed with g_free().
+ **/
+gint *
+gimp_image_get_layers (gint32 image_ID,
+ gint *num_layers)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint *layer_ids = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-layers",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ *num_layers = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_layers = return_vals[1].data.d_int32;
+ layer_ids = g_new (gint32, *num_layers);
+ memcpy (layer_ids,
+ return_vals[2].data.d_int32array,
+ *num_layers * sizeof (gint32));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ids;
+}
+
+/**
+ * gimp_image_get_channels:
+ * @image_ID: The image.
+ * @num_channels: The number of channels contained in the image.
+ *
+ * Returns the list of channels contained in the specified image.
+ *
+ * This procedure returns the list of channels contained in the
+ * specified image. This does not include the selection mask, or layer
+ * masks. The order is from topmost to bottommost. Note that
+ * \"channels\" are custom channels and do not include the image's
+ * color components.
+ *
+ * Returns: The list of channels contained in the image. The returned
+ * value must be freed with g_free().
+ **/
+gint *
+gimp_image_get_channels (gint32 image_ID,
+ gint *num_channels)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint *channel_ids = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-channels",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ *num_channels = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_channels = return_vals[1].data.d_int32;
+ channel_ids = g_new (gint32, *num_channels);
+ memcpy (channel_ids,
+ return_vals[2].data.d_int32array,
+ *num_channels * sizeof (gint32));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return channel_ids;
+}
+
+/**
+ * gimp_image_get_vectors:
+ * @image_ID: The image.
+ * @num_vectors: The number of vectors contained in the image.
+ *
+ * Returns the list of vectors contained in the specified image.
+ *
+ * This procedure returns the list of vectors contained in the
+ * specified image.
+ *
+ * Returns: The list of vectors contained in the image. The returned
+ * value must be freed with g_free().
+ *
+ * Since: 2.4
+ **/
+gint *
+gimp_image_get_vectors (gint32 image_ID,
+ gint *num_vectors)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint *vector_ids = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-vectors",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ *num_vectors = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_vectors = return_vals[1].data.d_int32;
+ vector_ids = g_new (gint32, *num_vectors);
+ memcpy (vector_ids,
+ return_vals[2].data.d_int32array,
+ *num_vectors * sizeof (gint32));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return vector_ids;
+}
+
+/**
+ * gimp_image_get_active_drawable:
+ * @image_ID: The image.
+ *
+ * Get the image's active drawable
+ *
+ * This procedure returns the ID of the image's active drawable. This
+ * can be either a layer, a channel, or a layer mask. The active
+ * drawable is specified by the active image channel. If that is -1,
+ * then by the active image layer. If the active image layer has a
+ * layer mask and the layer mask is in edit mode, then the layer mask
+ * is the active drawable.
+ *
+ * Returns: The active drawable.
+ **/
+gint32
+gimp_image_get_active_drawable (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-active-drawable",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return drawable_ID;
+}
+
+/**
+ * gimp_image_unset_active_channel:
+ * @image_ID: The image.
+ *
+ * Unsets the active channel in the specified image.
+ *
+ * If an active channel exists, it is unset. There then exists no
+ * active channel, and if desired, one can be set through a call to
+ * 'Set Active Channel'. No error is returned in the case of no
+ * existing active channel.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_unset_active_channel (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-unset-active-channel",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_floating_sel:
+ * @image_ID: The image.
+ *
+ * Return the floating selection of the image.
+ *
+ * This procedure returns the image's floating selection, if it exists.
+ * If it doesn't exist, -1 is returned as the layer ID.
+ *
+ * Returns: The image's floating selection.
+ **/
+gint32
+gimp_image_get_floating_sel (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 floating_sel_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-floating-sel",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ floating_sel_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return floating_sel_ID;
+}
+
+/**
+ * gimp_image_floating_sel_attached_to:
+ * @image_ID: The image.
+ *
+ * Return the drawable the floating selection is attached to.
+ *
+ * This procedure returns the drawable the image's floating selection
+ * is attached to, if it exists. If it doesn't exist, -1 is returned as
+ * the drawable ID.
+ *
+ * Returns: The drawable the floating selection is attached to.
+ **/
+gint32
+gimp_image_floating_sel_attached_to (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-floating-sel-attached-to",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return drawable_ID;
+}
+
+/**
+ * gimp_image_pick_color:
+ * @image_ID: The image.
+ * @drawable_ID: The drawable to pick from.
+ * @x: x coordinate of upper-left corner of rectangle.
+ * @y: y coordinate of upper-left corner of rectangle.
+ * @sample_merged: Use the composite image, not the drawable.
+ * @sample_average: Average the color of all the pixels in a specified radius.
+ * @average_radius: The radius of pixels to average.
+ * @color: The return color.
+ *
+ * Determine the color at the given drawable coordinates
+ *
+ * This tool determines the color at the specified coordinates. The
+ * returned color is an RGB triplet even for grayscale and indexed
+ * drawables. If the coordinates lie outside of the extents of the
+ * specified drawable, then an error is returned. If the drawable has
+ * an alpha channel, the algorithm examines the alpha value of the
+ * drawable at the coordinates. If the alpha value is completely
+ * transparent (0), then an error is returned. If the sample_merged
+ * parameter is TRUE, the data of the composite image will be used
+ * instead of that for the specified drawable. This is equivalent to
+ * sampling for colors after merging all visible layers. In the case of
+ * a merged sampling, the supplied drawable is ignored.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_pick_color (gint32 image_ID,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ gboolean sample_merged,
+ gboolean sample_average,
+ gdouble average_radius,
+ GimpRGB *color)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-pick-color",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_INT32, sample_merged,
+ GIMP_PDB_INT32, sample_average,
+ GIMP_PDB_FLOAT, average_radius,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *color = return_vals[1].data.d_color;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_pick_correlate_layer:
+ * @image_ID: The image.
+ * @x: The x coordinate for the pick.
+ * @y: The y coordinate for the pick.
+ *
+ * Find the layer visible at the specified coordinates.
+ *
+ * This procedure finds the layer which is visible at the specified
+ * coordinates. Layers which do not qualify are those whose extents do
+ * not pass within the specified coordinates, or which are transparent
+ * at the specified coordinates. This procedure will return -1 if no
+ * layer is found.
+ *
+ * Returns: The layer found at the specified coordinates.
+ **/
+gint32
+gimp_image_pick_correlate_layer (gint32 image_ID,
+ gint x,
+ gint y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-pick-correlate-layer",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, x,
+ GIMP_PDB_INT32, y,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_image_add_layer:
+ * @image_ID: The image.
+ * @layer_ID: The layer.
+ * @position: The layer position.
+ *
+ * Deprecated: Use gimp_image_insert_layer() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_add_layer (gint32 image_ID,
+ gint32 layer_ID,
+ gint position)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-add-layer",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, position,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_insert_layer:
+ * @image_ID: The image.
+ * @layer_ID: The layer.
+ * @parent_ID: The parent layer.
+ * @position: The layer position.
+ *
+ * Add the specified layer to the image.
+ *
+ * This procedure adds the specified layer to the image at the given
+ * position. If the specified parent is a valid layer group (See
+ * gimp_item_is_group() and gimp_layer_group_new()) then the layer is
+ * added inside the group. If the parent is 0, the layer is added
+ * inside the main stack, outside of any group. The position argument
+ * specifies the location of the layer inside the stack (or the group,
+ * if a valid parent was supplied), starting from the top (0) and
+ * increasing. If the position is specified as -1 and the parent is
+ * specified as 0, then the layer is inserted above the active layer,
+ * or inside the group if the active layer is a layer group. The layer
+ * type must be compatible with the image base type.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_insert_layer (gint32 image_ID,
+ gint32 layer_ID,
+ gint32 parent_ID,
+ gint position)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-insert-layer",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_LAYER, parent_ID,
+ GIMP_PDB_INT32, position,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_remove_layer:
+ * @image_ID: The image.
+ * @layer_ID: The layer.
+ *
+ * Remove the specified layer from the image.
+ *
+ * This procedure removes the specified layer from the image. If the
+ * layer doesn't exist, an error is returned. If there are no layers
+ * left in the image, this call will fail. If this layer is the last
+ * layer remaining, the image will become empty and have no active
+ * layer.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_remove_layer (gint32 image_ID,
+ gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-remove-layer",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_freeze_layers:
+ * @image_ID: The image.
+ *
+ * Freeze the image's layer list.
+ *
+ * This procedure freezes the layer list of the image, suppressing any
+ * updates to the Layers dialog in response to changes to the image's
+ * layers. This can significantly improve performance while applying
+ * changes affecting the layer list.
+ *
+ * Each call to gimp_image_freeze_layers() should be matched by a
+ * corresponding call to gimp_image_thaw_layers(), undoing its effects.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10.2
+ **/
+gboolean
+gimp_image_freeze_layers (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-freeze-layers",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_thaw_layers:
+ * @image_ID: The image.
+ *
+ * Thaw the image's layer list.
+ *
+ * This procedure thaws the layer list of the image, re-enabling
+ * updates to the Layers dialog.
+ *
+ * This procedure should match a corresponding call to
+ * gimp_image_freeze_layers().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10.2
+ **/
+gboolean
+gimp_image_thaw_layers (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-thaw-layers",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_add_channel:
+ * @image_ID: The image.
+ * @channel_ID: The channel.
+ * @position: The channel position.
+ *
+ * Deprecated: Use gimp_image_insert_channel() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_add_channel (gint32 image_ID,
+ gint32 channel_ID,
+ gint position)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-add-channel",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_CHANNEL, channel_ID,
+ GIMP_PDB_INT32, position,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_insert_channel:
+ * @image_ID: The image.
+ * @channel_ID: The channel.
+ * @parent_ID: The parent channel.
+ * @position: The channel position.
+ *
+ * Add the specified channel to the image.
+ *
+ * This procedure adds the specified channel to the image at the given
+ * position. Since channel groups are not currently supported, the
+ * parent argument must always be 0. The position argument specifies
+ * the location of the channel inside the stack, starting from the top
+ * (0) and increasing. If the position is specified as -1, then the
+ * channel is inserted above the active channel.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_insert_channel (gint32 image_ID,
+ gint32 channel_ID,
+ gint32 parent_ID,
+ gint position)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-insert-channel",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_CHANNEL, channel_ID,
+ GIMP_PDB_CHANNEL, parent_ID,
+ GIMP_PDB_INT32, position,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_remove_channel:
+ * @image_ID: The image.
+ * @channel_ID: The channel.
+ *
+ * Remove the specified channel from the image.
+ *
+ * This procedure removes the specified channel from the image. If the
+ * channel doesn't exist, an error is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_remove_channel (gint32 image_ID,
+ gint32 channel_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-remove-channel",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_CHANNEL, channel_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_freeze_channels:
+ * @image_ID: The image.
+ *
+ * Freeze the image's channel list.
+ *
+ * This procedure freezes the channel list of the image, suppressing
+ * any updates to the Channels dialog in response to changes to the
+ * image's channels. This can significantly improve performance while
+ * applying changes affecting the channel list.
+ *
+ * Each call to gimp_image_freeze_channels() should be matched by a
+ * corresponding call to gimp_image_thaw_channels(), undoing its
+ * effects.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10.2
+ **/
+gboolean
+gimp_image_freeze_channels (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-freeze-channels",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_thaw_channels:
+ * @image_ID: The image.
+ *
+ * Thaw the image's channel list.
+ *
+ * This procedure thaws the channel list of the image, re-enabling
+ * updates to the Channels dialog.
+ *
+ * This procedure should match a corresponding call to
+ * gimp_image_freeze_channels().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10.2
+ **/
+gboolean
+gimp_image_thaw_channels (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-thaw-channels",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_add_vectors:
+ * @image_ID: The image.
+ * @vectors_ID: The vectors object.
+ * @position: The vectors objects position.
+ *
+ * Deprecated: Use gimp_image_insert_vectors() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_add_vectors (gint32 image_ID,
+ gint32 vectors_ID,
+ gint position)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-add-vectors",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, position,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_insert_vectors:
+ * @image_ID: The image.
+ * @vectors_ID: The vectors.
+ * @parent_ID: The parent vectors.
+ * @position: The vectors position.
+ *
+ * Add the specified vectors to the image.
+ *
+ * This procedure adds the specified vectors to the image at the given
+ * position. Since vectors groups are not currently supported, the
+ * parent argument must always be 0. The position argument specifies
+ * the location of the vectors inside the stack, starting from the top
+ * (0) and increasing. If the position is specified as -1, then the
+ * vectors is inserted above the active vectors.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_insert_vectors (gint32 image_ID,
+ gint32 vectors_ID,
+ gint32 parent_ID,
+ gint position)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-insert-vectors",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_VECTORS, parent_ID,
+ GIMP_PDB_INT32, position,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_remove_vectors:
+ * @image_ID: The image.
+ * @vectors_ID: The vectors object.
+ *
+ * Remove the specified path from the image.
+ *
+ * This procedure removes the specified path from the image. If the
+ * path doesn't exist, an error is returned.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_remove_vectors (gint32 image_ID,
+ gint32 vectors_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-remove-vectors",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_freeze_vectors:
+ * @image_ID: The image.
+ *
+ * Freeze the image's vectors list.
+ *
+ * This procedure freezes the vectors list of the image, suppressing
+ * any updates to the Paths dialog in response to changes to the
+ * image's vectors. This can significantly improve performance while
+ * applying changes affecting the vectors list.
+ *
+ * Each call to gimp_image_freeze_vectors() should be matched by a
+ * corresponding call to gimp_image_thaw_vectors(), undoing its
+ * effects.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10.2
+ **/
+gboolean
+gimp_image_freeze_vectors (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-freeze-vectors",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_thaw_vectors:
+ * @image_ID: The image.
+ *
+ * Thaw the image's vectors list.
+ *
+ * This procedure thaws the vectors list of the image, re-enabling
+ * updates to the Paths dialog.
+ *
+ * This procedure should match a corresponding call to
+ * gimp_image_freeze_vectors().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10.2
+ **/
+gboolean
+gimp_image_thaw_vectors (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-thaw-vectors",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_item_position:
+ * @image_ID: The image.
+ * @item_ID: The item.
+ *
+ * Returns the position of the item in its level of its item tree.
+ *
+ * This procedure determines the position of the specified item in its
+ * level in its item tree in the image. If the item doesn't exist in
+ * the image, or the item is not part of an item tree, an error is
+ * returned.
+ *
+ * Returns: The position of the item in its level in the item tree.
+ *
+ * Since: 2.8
+ **/
+gint
+gimp_image_get_item_position (gint32 image_ID,
+ gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint position = 0;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-item-position",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ position = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return position;
+}
+
+/**
+ * gimp_image_raise_item:
+ * @image_ID: The image.
+ * @item_ID: The item to raise.
+ *
+ * Raise the specified item in its level in its item tree
+ *
+ * This procedure raises the specified item one step in the item tree.
+ * The procedure call will fail if there is no item above it.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_raise_item (gint32 image_ID,
+ gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-raise-item",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_lower_item:
+ * @image_ID: The image.
+ * @item_ID: The item to lower.
+ *
+ * Lower the specified item in its level in its item tree
+ *
+ * This procedure lowers the specified item one step in the item tree.
+ * The procedure call will fail if there is no item below it.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_lower_item (gint32 image_ID,
+ gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-lower-item",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_raise_item_to_top:
+ * @image_ID: The image.
+ * @item_ID: The item to raise to top.
+ *
+ * Raise the specified item to the top of its level in its item tree
+ *
+ * This procedure raises the specified item to top of its level in the
+ * item tree. It will not move the item if there is no item above it.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_raise_item_to_top (gint32 image_ID,
+ gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-raise-item-to-top",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_lower_item_to_bottom:
+ * @image_ID: The image.
+ * @item_ID: The item to lower to bottom.
+ *
+ * Lower the specified item to the bottom of its level in its item tree
+ *
+ * This procedure lowers the specified item to bottom of its level in
+ * the item tree. It will not move the layer if there is no layer below
+ * it.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_lower_item_to_bottom (gint32 image_ID,
+ gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-lower-item-to-bottom",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_reorder_item:
+ * @image_ID: The image.
+ * @item_ID: The item to reorder.
+ * @parent_ID: The new parent item.
+ * @position: The new position of the item.
+ *
+ * Reorder the specified item within its item tree
+ *
+ * This procedure reorders the specified item within its item tree.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_reorder_item (gint32 image_ID,
+ gint32 item_ID,
+ gint32 parent_ID,
+ gint position)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-reorder-item",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_ITEM, parent_ID,
+ GIMP_PDB_INT32, position,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_flatten:
+ * @image_ID: The image.
+ *
+ * Flatten all visible layers into a single layer. Discard all
+ * invisible layers.
+ *
+ * This procedure combines the visible layers in a manner analogous to
+ * merging with the CLIP_TO_IMAGE merge type. Non-visible layers are
+ * discarded, and the resulting image is stripped of its alpha channel.
+ *
+ * Returns: The resulting layer.
+ **/
+gint32
+gimp_image_flatten (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-flatten",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_image_merge_visible_layers:
+ * @image_ID: The image.
+ * @merge_type: The type of merge.
+ *
+ * Merge the visible image layers into one.
+ *
+ * This procedure combines the visible layers into a single layer using
+ * the specified merge type. A merge type of EXPAND_AS_NECESSARY
+ * expands the final layer to encompass the areas of the visible
+ * layers. A merge type of CLIP_TO_IMAGE clips the final layer to the
+ * extents of the image. A merge type of CLIP_TO_BOTTOM_LAYER clips the
+ * final layer to the size of the bottommost layer.
+ *
+ * Returns: The resulting layer.
+ **/
+gint32
+gimp_image_merge_visible_layers (gint32 image_ID,
+ GimpMergeType merge_type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-merge-visible-layers",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, merge_type,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_image_merge_down:
+ * @image_ID: The image.
+ * @merge_layer_ID: The layer to merge down from.
+ * @merge_type: The type of merge.
+ *
+ * Merge the layer passed and the first visible layer below.
+ *
+ * This procedure combines the passed layer and the first visible layer
+ * below it using the specified merge type. A merge type of
+ * EXPAND_AS_NECESSARY expands the final layer to encompass the areas
+ * of the visible layers. A merge type of CLIP_TO_IMAGE clips the final
+ * layer to the extents of the image. A merge type of
+ * CLIP_TO_BOTTOM_LAYER clips the final layer to the size of the
+ * bottommost layer.
+ *
+ * Returns: The resulting layer.
+ **/
+gint32
+gimp_image_merge_down (gint32 image_ID,
+ gint32 merge_layer_ID,
+ GimpMergeType merge_type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-merge-down",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_LAYER, merge_layer_ID,
+ GIMP_PDB_INT32, merge_type,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_image_merge_layer_group:
+ * @image_ID: The image.
+ * @layer_group_ID: The layer group to merge.
+ *
+ * Merge the passed layer group's layers into one normal layer.
+ *
+ * This procedure combines the layers of the passed layer group into a
+ * single normal layer, replacing the group.
+ *
+ * Returns: The resulting layer.
+ *
+ * Since: 2.10.14
+ **/
+gint32
+gimp_image_merge_layer_group (gint32 image_ID,
+ gint32 layer_group_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-merge-layer-group",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_LAYER, layer_group_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ID;
+}
+
+/**
+ * _gimp_image_get_colormap:
+ * @image_ID: The image.
+ * @num_bytes: Number of bytes in the colormap array.
+ *
+ * Returns the image's colormap
+ *
+ * This procedure returns an actual pointer to the image's colormap, as
+ * well as the number of bytes contained in the colormap. The actual
+ * number of colors in the transmitted colormap will be 'num-bytes' /
+ * 3. If the image is not in Indexed color mode, no colormap is
+ * returned.
+ *
+ * Returns: The image's colormap. The returned value must be freed with
+ * g_free().
+ **/
+guint8 *
+_gimp_image_get_colormap (gint32 image_ID,
+ gint *num_bytes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ guint8 *colormap = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-colormap",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ *num_bytes = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_bytes = return_vals[1].data.d_int32;
+ colormap = g_new (guint8, *num_bytes);
+ memcpy (colormap,
+ return_vals[2].data.d_int8array,
+ *num_bytes * sizeof (guint8));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return colormap;
+}
+
+/**
+ * _gimp_image_set_colormap:
+ * @image_ID: The image.
+ * @num_bytes: Number of bytes in the colormap array.
+ * @colormap: The new colormap values.
+ *
+ * Sets the entries in the image's colormap.
+ *
+ * This procedure sets the entries in the specified image's colormap.
+ * The number of entries is specified by the 'num-bytes' parameter and
+ * corresponds to the number of INT8 triples that must be contained in
+ * the 'colormap' array. The actual number of colors in the transmitted
+ * colormap is 'num-bytes' / 3.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_set_colormap (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *colormap)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-colormap",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, num_bytes,
+ GIMP_PDB_INT8ARRAY, colormap,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_image_get_metadata:
+ * @image_ID: The image.
+ *
+ * Returns the image's metadata.
+ *
+ * Returns exif/iptc/xmp metadata from the image.
+ *
+ * Returns: The exif/ptc/xmp metadata as a string.
+ **/
+gchar *
+_gimp_image_get_metadata (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *metadata_string = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-metadata",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ metadata_string = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return metadata_string;
+}
+
+/**
+ * _gimp_image_set_metadata:
+ * @image_ID: The image.
+ * @metadata_string: The exif/ptc/xmp metadata as a string.
+ *
+ * Set the image's metadata.
+ *
+ * Sets exif/iptc/xmp metadata on the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_set_metadata (gint32 image_ID,
+ const gchar *metadata_string)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-metadata",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, metadata_string,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_clean_all:
+ * @image_ID: The image.
+ *
+ * Set the image dirty count to 0.
+ *
+ * This procedure sets the specified image's dirty count to 0, allowing
+ * operations to occur without having a 'dirtied' image. This is
+ * especially useful for creating and loading images which should not
+ * initially be considered dirty, even though layers must be created,
+ * filled, and installed in the image. Note that save plug-ins must NOT
+ * call this function themselves after saving the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_clean_all (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-clean-all",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_is_dirty:
+ * @image_ID: The image.
+ *
+ * Checks if the image has unsaved changes.
+ *
+ * This procedure checks the specified image's dirty count to see if it
+ * needs to be saved. Note that saving the image does not automatically
+ * set the dirty count to 0, you need to call gimp_image_clean_all()
+ * after calling a save procedure to make the image clean.
+ *
+ * Returns: TRUE if the image has unsaved changes.
+ **/
+gboolean
+gimp_image_is_dirty (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean dirty = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-image-is-dirty",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ dirty = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return dirty;
+}
+
+/**
+ * _gimp_image_thumbnail:
+ * @image_ID: The image.
+ * @width: The requested thumbnail width.
+ * @height: The requested thumbnail height.
+ * @actual_width: The previews width.
+ * @actual_height: The previews height.
+ * @bpp: The previews bpp.
+ * @thumbnail_data_count: The number of bytes in thumbnail data.
+ * @thumbnail_data: The thumbnail data.
+ *
+ * Get a thumbnail of an image.
+ *
+ * This function gets data from which a thumbnail of an image preview
+ * can be created. Maximum x or y dimension is 1024 pixels. The pixels
+ * are returned in RGB[A] or GRAY[A] format. The bpp return value gives
+ * the number of bits per pixel in the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_thumbnail (gint32 image_ID,
+ gint width,
+ gint height,
+ gint *actual_width,
+ gint *actual_height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-thumbnail",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, width,
+ GIMP_PDB_INT32, height,
+ GIMP_PDB_END);
+
+ *actual_width = 0;
+ *actual_height = 0;
+ *bpp = 0;
+ *thumbnail_data_count = 0;
+ *thumbnail_data = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *actual_width = return_vals[1].data.d_int32;
+ *actual_height = return_vals[2].data.d_int32;
+ *bpp = return_vals[3].data.d_int32;
+ *thumbnail_data_count = return_vals[4].data.d_int32;
+ *thumbnail_data = g_new (guint8, *thumbnail_data_count);
+ memcpy (*thumbnail_data,
+ return_vals[5].data.d_int8array,
+ *thumbnail_data_count * sizeof (guint8));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_active_layer:
+ * @image_ID: The image.
+ *
+ * Returns the specified image's active layer.
+ *
+ * If there is an active layer, its ID will be returned, otherwise, -1.
+ * If a channel is currently active, then no layer will be. If a layer
+ * mask is active, then this will return the associated layer.
+ *
+ * Returns: The active layer.
+ **/
+gint32
+gimp_image_get_active_layer (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 active_layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-active-layer",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ active_layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return active_layer_ID;
+}
+
+/**
+ * gimp_image_set_active_layer:
+ * @image_ID: The image.
+ * @active_layer_ID: The new image active layer.
+ *
+ * Sets the specified image's active layer.
+ *
+ * If the layer exists, it is set as the active layer in the image. Any
+ * previous active layer or channel is set to inactive. An exception is
+ * a previously existing floating selection, in which case this
+ * procedure will return an execution error.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_active_layer (gint32 image_ID,
+ gint32 active_layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-active-layer",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_LAYER, active_layer_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_active_channel:
+ * @image_ID: The image.
+ *
+ * Returns the specified image's active channel.
+ *
+ * If there is an active channel, this will return the channel ID,
+ * otherwise, -1.
+ *
+ * Returns: The active channel.
+ **/
+gint32
+gimp_image_get_active_channel (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 active_channel_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-active-channel",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ active_channel_ID = return_vals[1].data.d_channel;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return active_channel_ID;
+}
+
+/**
+ * gimp_image_set_active_channel:
+ * @image_ID: The image.
+ * @active_channel_ID: The new image active channel.
+ *
+ * Sets the specified image's active channel.
+ *
+ * If the channel exists, it is set as the active channel in the image.
+ * Any previous active channel or layer is set to inactive. An
+ * exception is a previously existing floating selection, in which case
+ * this procedure will return an execution error.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_active_channel (gint32 image_ID,
+ gint32 active_channel_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-active-channel",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_CHANNEL, active_channel_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_active_vectors:
+ * @image_ID: The image.
+ *
+ * Returns the specified image's active vectors.
+ *
+ * If there is an active path, its ID will be returned, otherwise, -1.
+ *
+ * Returns: The active vectors.
+ **/
+gint32
+gimp_image_get_active_vectors (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 active_vectors_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-active-vectors",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ active_vectors_ID = return_vals[1].data.d_vectors;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return active_vectors_ID;
+}
+
+/**
+ * gimp_image_set_active_vectors:
+ * @image_ID: The image.
+ * @active_vectors_ID: The new image active vectors.
+ *
+ * Sets the specified image's active vectors.
+ *
+ * If the path exists, it is set as the active path in the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_active_vectors (gint32 image_ID,
+ gint32 active_vectors_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-active-vectors",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_VECTORS, active_vectors_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_selection:
+ * @image_ID: The image.
+ *
+ * Returns the specified image's selection.
+ *
+ * This will always return a valid ID for a selection -- which is
+ * represented as a channel internally.
+ *
+ * Returns: The selection channel.
+ **/
+gint32
+gimp_image_get_selection (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 selection_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-selection",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ selection_ID = return_vals[1].data.d_selection;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return selection_ID;
+}
+
+/**
+ * gimp_image_get_component_active:
+ * @image_ID: The image.
+ * @component: The image component.
+ *
+ * Returns if the specified image's image component is active.
+ *
+ * This procedure returns if the specified image's image component
+ * (i.e. Red, Green, Blue intensity channels in an RGB image) is active
+ * or inactive -- whether or not it can be modified. If the specified
+ * component is not valid for the image type, an error is returned.
+ *
+ * Returns: Component is active.
+ **/
+gboolean
+gimp_image_get_component_active (gint32 image_ID,
+ GimpChannelType component)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean active = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-component-active",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, component,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ active = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return active;
+}
+
+/**
+ * gimp_image_set_component_active:
+ * @image_ID: The image.
+ * @component: The image component.
+ * @active: Component is active.
+ *
+ * Sets if the specified image's image component is active.
+ *
+ * This procedure sets if the specified image's image component (i.e.
+ * Red, Green, Blue intensity channels in an RGB image) is active or
+ * inactive -- whether or not it can be modified. If the specified
+ * component is not valid for the image type, an error is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_component_active (gint32 image_ID,
+ GimpChannelType component,
+ gboolean active)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-component-active",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, component,
+ GIMP_PDB_INT32, active,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_component_visible:
+ * @image_ID: The image.
+ * @component: The image component.
+ *
+ * Returns if the specified image's image component is visible.
+ *
+ * This procedure returns if the specified image's image component
+ * (i.e. Red, Green, Blue intensity channels in an RGB image) is
+ * visible or invisible -- whether or not it can be seen. If the
+ * specified component is not valid for the image type, an error is
+ * returned.
+ *
+ * Returns: Component is visible.
+ **/
+gboolean
+gimp_image_get_component_visible (gint32 image_ID,
+ GimpChannelType component)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean visible = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-component-visible",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, component,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ visible = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return visible;
+}
+
+/**
+ * gimp_image_set_component_visible:
+ * @image_ID: The image.
+ * @component: The image component.
+ * @visible: Component is visible.
+ *
+ * Sets if the specified image's image component is visible.
+ *
+ * This procedure sets if the specified image's image component (i.e.
+ * Red, Green, Blue intensity channels in an RGB image) is visible or
+ * invisible -- whether or not it can be seen. If the specified
+ * component is not valid for the image type, an error is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_component_visible (gint32 image_ID,
+ GimpChannelType component,
+ gboolean visible)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-component-visible",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, component,
+ GIMP_PDB_INT32, visible,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_filename:
+ * @image_ID: The image.
+ *
+ * Returns the specified image's filename.
+ *
+ * This procedure returns the specified image's filename in the
+ * filesystem encoding. The image has a filename only if it was loaded
+ * or imported from a file or has since been saved or exported.
+ * Otherwise, this function returns %NULL. See also
+ * gimp_image_get_uri().
+ *
+ * Returns: The filename. The returned value must be freed with
+ * g_free().
+ **/
+gchar *
+gimp_image_get_filename (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *filename = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-filename",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ filename = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return filename;
+}
+
+/**
+ * gimp_image_set_filename:
+ * @image_ID: The image.
+ * @filename: The new image filename.
+ *
+ * Sets the specified image's filename.
+ *
+ * This procedure sets the specified image's filename. The filename
+ * should be in the filesystem encoding.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_filename (gint32 image_ID,
+ const gchar *filename)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-filename",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, filename,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_uri:
+ * @image_ID: The image.
+ *
+ * Returns the URI for the specified image.
+ *
+ * This procedure returns the URI associated with the specified image.
+ * The image has an URI only if it was loaded or imported from a file
+ * or has since been saved or exported. Otherwise, this function
+ * returns %NULL. See also gimp-image-get-imported-uri to get the URI
+ * of the current file if it was imported from a non-GIMP file format
+ * and not yet saved, or gimp-image-get-exported-uri if the image has
+ * been exported to a non-GIMP file format.
+ *
+ * Returns: The URI. The returned value must be freed with g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+gimp_image_get_uri (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *uri = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-uri",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ uri = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return uri;
+}
+
+/**
+ * gimp_image_get_xcf_uri:
+ * @image_ID: The image.
+ *
+ * Returns the XCF URI for the specified image.
+ *
+ * This procedure returns the XCF URI associated with the image. If
+ * there is no such URI, this procedure returns %NULL.
+ *
+ * Returns: The imported URI. The returned value must be freed with
+ * g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+gimp_image_get_xcf_uri (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *uri = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-xcf-uri",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ uri = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return uri;
+}
+
+/**
+ * gimp_image_get_imported_uri:
+ * @image_ID: The image.
+ *
+ * Returns the imported URI for the specified image.
+ *
+ * This procedure returns the URI associated with the specified image
+ * if the image was imported from a non-native Gimp format. If the
+ * image was not imported, or has since been saved in the native Gimp
+ * format, this procedure returns %NULL.
+ *
+ * Returns: The imported URI. The returned value must be freed with
+ * g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+gimp_image_get_imported_uri (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *uri = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-imported-uri",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ uri = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return uri;
+}
+
+/**
+ * gimp_image_get_exported_uri:
+ * @image_ID: The image.
+ *
+ * Returns the exported URI for the specified image.
+ *
+ * This procedure returns the URI associated with the specified image
+ * if the image was exported a non-native GIMP format. If the image was
+ * not exported, this procedure returns %NULL.
+ *
+ * Returns: The exported URI. The returned value must be freed with
+ * g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+gimp_image_get_exported_uri (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *uri = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-exported-uri",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ uri = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return uri;
+}
+
+/**
+ * gimp_image_get_name:
+ * @image_ID: The image.
+ *
+ * Returns the specified image's name.
+ *
+ * This procedure returns the image's name. If the image has a filename
+ * or an URI, then the returned name contains the filename's or URI's
+ * base name (the last component of the path). Otherwise it is the
+ * translated string \"Untitled\". The returned name is formatted like
+ * the image name in the image window title, it may contain '[]',
+ * '(imported)' etc. and should only be used to label user interface
+ * elements. Never use it to construct filenames.
+ *
+ * Returns: The name. The returned value must be freed with g_free().
+ **/
+gchar *
+gimp_image_get_name (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-name",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_image_get_resolution:
+ * @image_ID: The image.
+ * @xresolution: The resolution in the x-axis, in dots per inch.
+ * @yresolution: The resolution in the y-axis, in dots per inch.
+ *
+ * Returns the specified image's resolution.
+ *
+ * This procedure returns the specified image's resolution in dots per
+ * inch. This value is independent of any of the layers in this image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_get_resolution (gint32 image_ID,
+ gdouble *xresolution,
+ gdouble *yresolution)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-resolution",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ *xresolution = 0.0;
+ *yresolution = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *xresolution = return_vals[1].data.d_float;
+ *yresolution = return_vals[2].data.d_float;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_set_resolution:
+ * @image_ID: The image.
+ * @xresolution: The new image resolution in the x-axis, in dots per inch.
+ * @yresolution: The new image resolution in the y-axis, in dots per inch.
+ *
+ * Sets the specified image's resolution.
+ *
+ * This procedure sets the specified image's resolution in dots per
+ * inch. This value is independent of any of the layers in this image.
+ * No scaling or resizing is performed.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_resolution (gint32 image_ID,
+ gdouble xresolution,
+ gdouble yresolution)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-resolution",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_FLOAT, xresolution,
+ GIMP_PDB_FLOAT, yresolution,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_unit:
+ * @image_ID: The image.
+ *
+ * Returns the specified image's unit.
+ *
+ * This procedure returns the specified image's unit. This value is
+ * independent of any of the layers in this image. See the
+ * gimp_unit_*() procedure definitions for the valid range of unit IDs
+ * and a description of the unit system.
+ *
+ * Returns: The unit.
+ **/
+GimpUnit
+gimp_image_get_unit (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpUnit unit = 0;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-unit",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ unit = return_vals[1].data.d_unit;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return unit;
+}
+
+/**
+ * gimp_image_set_unit:
+ * @image_ID: The image.
+ * @unit: The new image unit.
+ *
+ * Sets the specified image's unit.
+ *
+ * This procedure sets the specified image's unit. No scaling or
+ * resizing is performed. This value is independent of any of the
+ * layers in this image. See the gimp_unit_*() procedure definitions
+ * for the valid range of unit IDs and a description of the unit
+ * system.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_unit (gint32 image_ID,
+ GimpUnit unit)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-unit",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, unit,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_tattoo_state:
+ * @image_ID: The image.
+ *
+ * Returns the tattoo state associated with the image.
+ *
+ * This procedure returns the tattoo state of the image. Use only by
+ * save/load plug-ins that wish to preserve an images tattoo state.
+ * Using this function at other times will produce unexpected results.
+ *
+ * Returns: The tattoo state.
+ **/
+gint
+gimp_image_get_tattoo_state (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint tattoo_state = 0;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-tattoo-state",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ tattoo_state = return_vals[1].data.d_tattoo;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return tattoo_state;
+}
+
+/**
+ * gimp_image_set_tattoo_state:
+ * @image_ID: The image.
+ * @tattoo_state: The new image tattoo state.
+ *
+ * Set the tattoo state associated with the image.
+ *
+ * This procedure sets the tattoo state of the image. Use only by
+ * save/load plug-ins that wish to preserve an images tattoo state.
+ * Using this function at other times will produce unexpected results.
+ * A full check of uniqueness of states in layers, channels and paths
+ * will be performed by this procedure and a execution failure will be
+ * returned if this fails. A failure will also be returned if the new
+ * tattoo state value is less than the maximum tattoo value from all of
+ * the tattoos from the paths, layers and channels. After the image
+ * data has been loaded and all the tattoos have been set then this is
+ * the last procedure that should be called. If effectively does a
+ * status check on the tattoo values that have been set to make sure
+ * that all is OK.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_tattoo_state (gint32 image_ID,
+ gint tattoo_state)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-tattoo-state",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, tattoo_state,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_layer_by_tattoo:
+ * @image_ID: The image.
+ * @tattoo: The tattoo of the layer to find.
+ *
+ * Find a layer with a given tattoo in an image.
+ *
+ * This procedure returns the layer with the given tattoo in the
+ * specified image.
+ *
+ * Returns: The layer with the specified tattoo.
+ **/
+gint32
+gimp_image_get_layer_by_tattoo (gint32 image_ID,
+ gint tattoo)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-layer-by-tattoo",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, tattoo,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_image_get_channel_by_tattoo:
+ * @image_ID: The image.
+ * @tattoo: The tattoo of the channel to find.
+ *
+ * Find a channel with a given tattoo in an image.
+ *
+ * This procedure returns the channel with the given tattoo in the
+ * specified image.
+ *
+ * Returns: The channel with the specified tattoo.
+ **/
+gint32
+gimp_image_get_channel_by_tattoo (gint32 image_ID,
+ gint tattoo)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 channel_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-channel-by-tattoo",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, tattoo,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ channel_ID = return_vals[1].data.d_channel;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return channel_ID;
+}
+
+/**
+ * gimp_image_get_vectors_by_tattoo:
+ * @image_ID: The image.
+ * @tattoo: The tattoo of the vectors to find.
+ *
+ * Find a vectors with a given tattoo in an image.
+ *
+ * This procedure returns the vectors with the given tattoo in the
+ * specified image.
+ *
+ * Returns: The vectors with the specified tattoo.
+ *
+ * Since: 2.6
+ **/
+gint32
+gimp_image_get_vectors_by_tattoo (gint32 image_ID,
+ gint tattoo)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 vectors_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-vectors-by-tattoo",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, tattoo,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ vectors_ID = return_vals[1].data.d_vectors;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return vectors_ID;
+}
+
+/**
+ * gimp_image_get_layer_by_name:
+ * @image_ID: The image.
+ * @name: The name of the layer to find.
+ *
+ * Find a layer with a given name in an image.
+ *
+ * This procedure returns the layer with the given name in the
+ * specified image.
+ *
+ * Returns: The layer with the specified name.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_image_get_layer_by_name (gint32 image_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-layer-by-name",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_image_get_channel_by_name:
+ * @image_ID: The image.
+ * @name: The name of the channel to find.
+ *
+ * Find a channel with a given name in an image.
+ *
+ * This procedure returns the channel with the given name in the
+ * specified image.
+ *
+ * Returns: The channel with the specified name.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_image_get_channel_by_name (gint32 image_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 channel_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-channel-by-name",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ channel_ID = return_vals[1].data.d_channel;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return channel_ID;
+}
+
+/**
+ * gimp_image_get_vectors_by_name:
+ * @image_ID: The image.
+ * @name: The name of the vectors to find.
+ *
+ * Find a vectors with a given name in an image.
+ *
+ * This procedure returns the vectors with the given name in the
+ * specified image.
+ *
+ * Returns: The vectors with the specified name.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_image_get_vectors_by_name (gint32 image_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 vectors_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-vectors-by-name",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ vectors_ID = return_vals[1].data.d_vectors;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return vectors_ID;
+}
+
+/**
+ * gimp_image_attach_parasite:
+ * @image_ID: The image.
+ * @parasite: The parasite to attach to an image.
+ *
+ * Add a parasite to an image.
+ *
+ * This procedure attaches a parasite to an image. It has no return
+ * values.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_attach_parasite (gint32 image_ID,
+ const GimpParasite *parasite)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-attach-parasite",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_PARASITE, parasite,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_detach_parasite:
+ * @image_ID: The image.
+ * @name: The name of the parasite to detach from an image.
+ *
+ * Removes a parasite from an image.
+ *
+ * This procedure detaches a parasite from an image. It has no return
+ * values.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_detach_parasite (gint32 image_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-detach-parasite",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_get_parasite:
+ * @image_ID: The image.
+ * @name: The name of the parasite to find.
+ *
+ * Look up a parasite in an image
+ *
+ * Finds and returns the parasite that was previously attached to an
+ * image.
+ *
+ * Returns: The found parasite.
+ *
+ * Since: 2.8
+ **/
+GimpParasite *
+gimp_image_get_parasite (gint32 image_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpParasite *parasite = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-parasite",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ parasite = gimp_parasite_copy (&return_vals[1].data.d_parasite);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return parasite;
+}
+
+/**
+ * gimp_image_get_parasite_list:
+ * @image_ID: The image.
+ * @num_parasites: The number of attached parasites.
+ *
+ * List all parasites.
+ *
+ * Returns a list of all currently attached parasites.
+ *
+ * Returns: The names of currently attached parasites. The returned
+ * value must be freed with g_strfreev().
+ *
+ * Since: 2.8
+ **/
+gchar **
+gimp_image_get_parasite_list (gint32 image_ID,
+ gint *num_parasites)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar **parasites = NULL;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-parasite-list",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ *num_parasites = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_parasites = return_vals[1].data.d_int32;
+ if (*num_parasites > 0)
+ {
+ parasites = g_new0 (gchar *, *num_parasites + 1);
+ for (i = 0; i < *num_parasites; i++)
+ parasites[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return parasites;
+}
diff --git a/libgimp/gimpimage_pdb.h b/libgimp/gimpimage_pdb.h
new file mode 100644
index 0000000..71f4776
--- /dev/null
+++ b/libgimp/gimpimage_pdb.h
@@ -0,0 +1,214 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimage_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_PDB_H__
+#define __GIMP_IMAGE_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_image_is_valid (gint32 image_ID);
+gint* gimp_image_list (gint *num_images);
+gint32 gimp_image_new (gint width,
+ gint height,
+ GimpImageBaseType type);
+gint32 gimp_image_new_with_precision (gint width,
+ gint height,
+ GimpImageBaseType type,
+ GimpPrecision precision);
+gint32 gimp_image_duplicate (gint32 image_ID);
+gboolean gimp_image_delete (gint32 image_ID);
+GimpImageBaseType gimp_image_base_type (gint32 image_ID);
+GimpPrecision gimp_image_get_precision (gint32 image_ID);
+GimpLayerMode gimp_image_get_default_new_layer_mode (gint32 image_ID);
+gint gimp_image_width (gint32 image_ID);
+gint gimp_image_height (gint32 image_ID);
+GIMP_DEPRECATED_FOR(gimp_drawable_free_shadow)
+gboolean gimp_image_free_shadow (gint32 image_ID);
+gint* gimp_image_get_layers (gint32 image_ID,
+ gint *num_layers);
+gint* gimp_image_get_channels (gint32 image_ID,
+ gint *num_channels);
+gint* gimp_image_get_vectors (gint32 image_ID,
+ gint *num_vectors);
+gint32 gimp_image_get_active_drawable (gint32 image_ID);
+gboolean gimp_image_unset_active_channel (gint32 image_ID);
+gint32 gimp_image_get_floating_sel (gint32 image_ID);
+gint32 gimp_image_floating_sel_attached_to (gint32 image_ID);
+gboolean gimp_image_pick_color (gint32 image_ID,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ gboolean sample_merged,
+ gboolean sample_average,
+ gdouble average_radius,
+ GimpRGB *color);
+gint32 gimp_image_pick_correlate_layer (gint32 image_ID,
+ gint x,
+ gint y);
+GIMP_DEPRECATED_FOR(gimp_image_insert_layer)
+gboolean gimp_image_add_layer (gint32 image_ID,
+ gint32 layer_ID,
+ gint position);
+gboolean gimp_image_insert_layer (gint32 image_ID,
+ gint32 layer_ID,
+ gint32 parent_ID,
+ gint position);
+gboolean gimp_image_remove_layer (gint32 image_ID,
+ gint32 layer_ID);
+gboolean gimp_image_freeze_layers (gint32 image_ID);
+gboolean gimp_image_thaw_layers (gint32 image_ID);
+GIMP_DEPRECATED_FOR(gimp_image_insert_channel)
+gboolean gimp_image_add_channel (gint32 image_ID,
+ gint32 channel_ID,
+ gint position);
+gboolean gimp_image_insert_channel (gint32 image_ID,
+ gint32 channel_ID,
+ gint32 parent_ID,
+ gint position);
+gboolean gimp_image_remove_channel (gint32 image_ID,
+ gint32 channel_ID);
+gboolean gimp_image_freeze_channels (gint32 image_ID);
+gboolean gimp_image_thaw_channels (gint32 image_ID);
+GIMP_DEPRECATED_FOR(gimp_image_insert_vectors)
+gboolean gimp_image_add_vectors (gint32 image_ID,
+ gint32 vectors_ID,
+ gint position);
+gboolean gimp_image_insert_vectors (gint32 image_ID,
+ gint32 vectors_ID,
+ gint32 parent_ID,
+ gint position);
+gboolean gimp_image_remove_vectors (gint32 image_ID,
+ gint32 vectors_ID);
+gboolean gimp_image_freeze_vectors (gint32 image_ID);
+gboolean gimp_image_thaw_vectors (gint32 image_ID);
+gint gimp_image_get_item_position (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_raise_item (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_lower_item (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_raise_item_to_top (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_lower_item_to_bottom (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_reorder_item (gint32 image_ID,
+ gint32 item_ID,
+ gint32 parent_ID,
+ gint position);
+gint32 gimp_image_flatten (gint32 image_ID);
+gint32 gimp_image_merge_visible_layers (gint32 image_ID,
+ GimpMergeType merge_type);
+gint32 gimp_image_merge_down (gint32 image_ID,
+ gint32 merge_layer_ID,
+ GimpMergeType merge_type);
+gint32 gimp_image_merge_layer_group (gint32 image_ID,
+ gint32 layer_group_ID);
+G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (gint32 image_ID,
+ gint *num_bytes);
+G_GNUC_INTERNAL gboolean _gimp_image_set_colormap (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *colormap);
+G_GNUC_INTERNAL gchar* _gimp_image_get_metadata (gint32 image_ID);
+G_GNUC_INTERNAL gboolean _gimp_image_set_metadata (gint32 image_ID,
+ const gchar *metadata_string);
+gboolean gimp_image_clean_all (gint32 image_ID);
+gboolean gimp_image_is_dirty (gint32 image_ID);
+G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (gint32 image_ID,
+ gint width,
+ gint height,
+ gint *actual_width,
+ gint *actual_height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data);
+gint32 gimp_image_get_active_layer (gint32 image_ID);
+gboolean gimp_image_set_active_layer (gint32 image_ID,
+ gint32 active_layer_ID);
+gint32 gimp_image_get_active_channel (gint32 image_ID);
+gboolean gimp_image_set_active_channel (gint32 image_ID,
+ gint32 active_channel_ID);
+gint32 gimp_image_get_active_vectors (gint32 image_ID);
+gboolean gimp_image_set_active_vectors (gint32 image_ID,
+ gint32 active_vectors_ID);
+gint32 gimp_image_get_selection (gint32 image_ID);
+gboolean gimp_image_get_component_active (gint32 image_ID,
+ GimpChannelType component);
+gboolean gimp_image_set_component_active (gint32 image_ID,
+ GimpChannelType component,
+ gboolean active);
+gboolean gimp_image_get_component_visible (gint32 image_ID,
+ GimpChannelType component);
+gboolean gimp_image_set_component_visible (gint32 image_ID,
+ GimpChannelType component,
+ gboolean visible);
+gchar* gimp_image_get_filename (gint32 image_ID);
+gboolean gimp_image_set_filename (gint32 image_ID,
+ const gchar *filename);
+gchar* gimp_image_get_uri (gint32 image_ID);
+gchar* gimp_image_get_xcf_uri (gint32 image_ID);
+gchar* gimp_image_get_imported_uri (gint32 image_ID);
+gchar* gimp_image_get_exported_uri (gint32 image_ID);
+gchar* gimp_image_get_name (gint32 image_ID);
+gboolean gimp_image_get_resolution (gint32 image_ID,
+ gdouble *xresolution,
+ gdouble *yresolution);
+gboolean gimp_image_set_resolution (gint32 image_ID,
+ gdouble xresolution,
+ gdouble yresolution);
+GimpUnit gimp_image_get_unit (gint32 image_ID);
+gboolean gimp_image_set_unit (gint32 image_ID,
+ GimpUnit unit);
+gint gimp_image_get_tattoo_state (gint32 image_ID);
+gboolean gimp_image_set_tattoo_state (gint32 image_ID,
+ gint tattoo_state);
+gint32 gimp_image_get_layer_by_tattoo (gint32 image_ID,
+ gint tattoo);
+gint32 gimp_image_get_channel_by_tattoo (gint32 image_ID,
+ gint tattoo);
+gint32 gimp_image_get_vectors_by_tattoo (gint32 image_ID,
+ gint tattoo);
+gint32 gimp_image_get_layer_by_name (gint32 image_ID,
+ const gchar *name);
+gint32 gimp_image_get_channel_by_name (gint32 image_ID,
+ const gchar *name);
+gint32 gimp_image_get_vectors_by_name (gint32 image_ID,
+ const gchar *name);
+gboolean gimp_image_attach_parasite (gint32 image_ID,
+ const GimpParasite *parasite);
+gboolean gimp_image_detach_parasite (gint32 image_ID,
+ const gchar *name);
+GimpParasite* gimp_image_get_parasite (gint32 image_ID,
+ const gchar *name);
+gchar** gimp_image_get_parasite_list (gint32 image_ID,
+ gint *num_parasites);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_PDB_H__ */
diff --git a/libgimp/gimpimagecolorprofile.c b/libgimp/gimpimagecolorprofile.c
new file mode 100644
index 0000000..0968445
--- /dev/null
+++ b/libgimp/gimpimagecolorprofile.c
@@ -0,0 +1,173 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagecolorprofile.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * gimp_image_get_color_profile:
+ * @image_ID: The image.
+ *
+ * Returns the image's color profile
+ *
+ * This procedure returns the image's color profile, or NULL if the
+ * image has no color profile assigned.
+ *
+ * Returns: The image's color profile. The returned value
+ * must be freed with g_object_unref().
+ *
+ * Since: 2.10
+ **/
+GimpColorProfile *
+gimp_image_get_color_profile (gint32 image_ID)
+{
+ guint8 *data;
+ gint length;
+
+ data = _gimp_image_get_color_profile (image_ID, &length);
+
+ if (data)
+ {
+ GimpColorProfile *profile;
+
+ profile = gimp_color_profile_new_from_icc_profile (data, length, NULL);
+ g_free (data);
+
+ return profile;
+ }
+
+ return NULL;
+}
+
+/**
+ * gimp_image_set_color_profile:
+ * @image_ID: The image.
+ * @profile: A #GimpColorProfile, or %NULL.
+ *
+ * Sets the image's color profile
+ *
+ * This procedure sets the image's color profile.
+ *
+ * Returns: %TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_image_set_color_profile (gint32 image_ID,
+ GimpColorProfile *profile)
+{
+ const guint8 *data = NULL;
+ gint length = 0;
+
+ g_return_val_if_fail (profile == NULL || GIMP_IS_COLOR_PROFILE (profile),
+ FALSE);
+
+ if (profile)
+ {
+ gsize l;
+
+ data = gimp_color_profile_get_icc_profile (profile, &l);
+ length = l;
+ }
+
+ return _gimp_image_set_color_profile (image_ID, length, data);
+}
+
+/**
+ * gimp_image_get_effective_color_profile:
+ * @image_ID: The image.
+ *
+ * Returns the color profile that is used for the image.
+ *
+ * This procedure returns the color profile that is actually used for
+ * this image, which is the profile returned by
+ * gimp_image_get_color_profile() if the image has a profile assigned,
+ * or the default RGB profile from preferences if no profile is
+ * assigned to the image. If there is no default RGB profile configured
+ * in preferences either, a generated default RGB profile is returned.
+ *
+ * Returns: The color profile. The returned value
+ * must be freed with g_object_unref().
+ *
+ * Since: 2.10
+ **/
+GimpColorProfile *
+gimp_image_get_effective_color_profile (gint32 image_ID)
+{
+ guint8 *data;
+ gint length;
+
+ data = _gimp_image_get_effective_color_profile (image_ID, &length);
+
+ if (data)
+ {
+ GimpColorProfile *profile;
+
+ profile = gimp_color_profile_new_from_icc_profile (data, length, NULL);
+ g_free (data);
+
+ return profile;
+ }
+
+ return NULL;
+}
+
+/**
+ * gimp_image_convert_color_profile:
+ * @image_ID: The image.
+ * @profile: The color profile to convert to.
+ * @intent: Rendering intent.
+ * @bpc: Black point compensation.
+ *
+ * Convert the image's layers to a color profile
+ *
+ * This procedure converts from the image's color profile (or the
+ * default RGB profile if none is set) to the given color profile. Only
+ * RGB color profiles are accepted.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_image_convert_color_profile (gint32 image_ID,
+ GimpColorProfile *profile,
+ GimpColorRenderingIntent intent,
+ gboolean bpc)
+{
+ const guint8 *data = NULL;
+ gint length = 0;
+
+ g_return_val_if_fail (profile == NULL || GIMP_IS_COLOR_PROFILE (profile),
+ FALSE);
+
+ if (profile)
+ {
+ gsize l;
+
+ data = gimp_color_profile_get_icc_profile (profile, &l);
+ length = l;
+ }
+
+ return _gimp_image_convert_color_profile (image_ID, length, data,
+ intent, bpc);
+}
diff --git a/libgimp/gimpimagecolorprofile.h b/libgimp/gimpimagecolorprofile.h
new file mode 100644
index 0000000..15defcc
--- /dev/null
+++ b/libgimp/gimpimagecolorprofile.h
@@ -0,0 +1,47 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagecolorprofile.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_COLOR_PROFILE_H__
+#define __GIMP_IMAGE_COLOR_PROFILE_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+GimpColorProfile * gimp_image_get_color_profile (gint32 image_ID);
+gboolean gimp_image_set_color_profile (gint32 image_ID,
+ GimpColorProfile *profile);
+
+GimpColorProfile * gimp_image_get_effective_color_profile (gint32 image_ID);
+
+gboolean gimp_image_convert_color_profile (gint32 image_ID,
+ GimpColorProfile *profile,
+ GimpColorRenderingIntent intent,
+ gboolean bpc);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_COLOR_PROFILE_H__ */
diff --git a/libgimp/gimpimagecolorprofile_pdb.c b/libgimp/gimpimagecolorprofile_pdb.c
new file mode 100644
index 0000000..ba55760
--- /dev/null
+++ b/libgimp/gimpimagecolorprofile_pdb.c
@@ -0,0 +1,292 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagecolorprofile_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpimagecolorprofile
+ * @title: gimpimagecolorprofile
+ * @short_description: Operations on an image's color profile.
+ *
+ * Operations on an image's color profile.
+ **/
+
+
+/**
+ * _gimp_image_get_color_profile:
+ * @image_ID: The image.
+ * @num_bytes: Number of bytes in the color_profile array.
+ *
+ * Returns the image's color profile
+ *
+ * This procedure returns the image's color profile, or NULL if the
+ * image has no color profile assigned.
+ *
+ * Returns: The image's serialized color profile. The returned value
+ * must be freed with g_free().
+ *
+ * Since: 2.10
+ **/
+guint8 *
+_gimp_image_get_color_profile (gint32 image_ID,
+ gint *num_bytes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ guint8 *profile_data = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-color-profile",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ *num_bytes = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_bytes = return_vals[1].data.d_int32;
+ profile_data = g_new (guint8, *num_bytes);
+ memcpy (profile_data,
+ return_vals[2].data.d_int8array,
+ *num_bytes * sizeof (guint8));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return profile_data;
+}
+
+/**
+ * _gimp_image_get_effective_color_profile:
+ * @image_ID: The image.
+ * @num_bytes: Number of bytes in the color_profile array.
+ *
+ * Returns the color profile that is used for the image
+ *
+ * This procedure returns the color profile that is actually used for
+ * this image, which is the profile returned by
+ * gimp_image_get_color_profile() if the image has a profile assigned,
+ * or a generated default RGB or grayscale profile, according to the
+ * image's type.
+ *
+ * Returns: The image's serialized color profile. The returned value
+ * must be freed with g_free().
+ *
+ * Since: 2.10
+ **/
+guint8 *
+_gimp_image_get_effective_color_profile (gint32 image_ID,
+ gint *num_bytes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ guint8 *profile_data = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-effective-color-profile",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ *num_bytes = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_bytes = return_vals[1].data.d_int32;
+ profile_data = g_new (guint8, *num_bytes);
+ memcpy (profile_data,
+ return_vals[2].data.d_int8array,
+ *num_bytes * sizeof (guint8));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return profile_data;
+}
+
+/**
+ * _gimp_image_set_color_profile:
+ * @image_ID: The image.
+ * @num_bytes: Number of bytes in the color_profile array.
+ * @color_profile: The new serialized color profile.
+ *
+ * Sets the image's color profile
+ *
+ * This procedure sets the image's color profile, or unsets it if NULL
+ * is passed as 'color_profile'. This procedure does no color
+ * conversion.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_image_set_color_profile (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *color_profile)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-color-profile",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, num_bytes,
+ GIMP_PDB_INT8ARRAY, color_profile,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_set_color_profile_from_file:
+ * @image_ID: The image.
+ * @uri: The URI of the file containing the new color profile.
+ *
+ * Sets the image's color profile from an ICC file
+ *
+ * This procedure sets the image's color profile from a file containing
+ * an ICC profile, or unsets it if NULL is passed as 'uri'. This
+ * procedure does no color conversion.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_image_set_color_profile_from_file (gint32 image_ID,
+ const gchar *uri)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-color-profile-from-file",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, uri,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_image_convert_color_profile:
+ * @image_ID: The image.
+ * @num_bytes: Number of bytes in the color_profile array.
+ * @color_profile: The serialized color profile.
+ * @intent: Rendering intent.
+ * @bpc: Black point compensation.
+ *
+ * Convert the image's layers to a color profile
+ *
+ * This procedure converts from the image's color profile (or the
+ * default RGB or grayscale profile if none is set) to the given color
+ * profile. Only RGB and grayscale color profiles are accepted,
+ * according to the image's type.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_image_convert_color_profile (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *color_profile,
+ GimpColorRenderingIntent intent,
+ gboolean bpc)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-convert-color-profile",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, num_bytes,
+ GIMP_PDB_INT8ARRAY, color_profile,
+ GIMP_PDB_INT32, intent,
+ GIMP_PDB_INT32, bpc,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_convert_color_profile_from_file:
+ * @image_ID: The image.
+ * @uri: The URI of the file containing the new color profile.
+ * @intent: Rendering intent.
+ * @bpc: Black point compensation.
+ *
+ * Convert the image's layers to a color profile
+ *
+ * This procedure converts from the image's color profile (or the
+ * default RGB or grayscale profile if none is set) to an ICC profile
+ * specified by 'uri'. Only RGB and grayscale color profiles are
+ * accepted, according to the image's type.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_image_convert_color_profile_from_file (gint32 image_ID,
+ const gchar *uri,
+ GimpColorRenderingIntent intent,
+ gboolean bpc)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-convert-color-profile-from-file",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, uri,
+ GIMP_PDB_INT32, intent,
+ GIMP_PDB_INT32, bpc,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpimagecolorprofile_pdb.h b/libgimp/gimpimagecolorprofile_pdb.h
new file mode 100644
index 0000000..4a76cbf
--- /dev/null
+++ b/libgimp/gimpimagecolorprofile_pdb.h
@@ -0,0 +1,57 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagecolorprofile_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_COLOR_PROFILE_PDB_H__
+#define __GIMP_IMAGE_COLOR_PROFILE_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+G_GNUC_INTERNAL guint8* _gimp_image_get_color_profile (gint32 image_ID,
+ gint *num_bytes);
+G_GNUC_INTERNAL guint8* _gimp_image_get_effective_color_profile (gint32 image_ID,
+ gint *num_bytes);
+G_GNUC_INTERNAL gboolean _gimp_image_set_color_profile (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *color_profile);
+gboolean gimp_image_set_color_profile_from_file (gint32 image_ID,
+ const gchar *uri);
+G_GNUC_INTERNAL gboolean _gimp_image_convert_color_profile (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *color_profile,
+ GimpColorRenderingIntent intent,
+ gboolean bpc);
+gboolean gimp_image_convert_color_profile_from_file (gint32 image_ID,
+ const gchar *uri,
+ GimpColorRenderingIntent intent,
+ gboolean bpc);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_COLOR_PROFILE_PDB_H__ */
diff --git a/libgimp/gimpimagecombobox.c b/libgimp/gimpimagecombobox.c
new file mode 100644
index 0000000..99aee7e
--- /dev/null
+++ b/libgimp/gimpimagecombobox.c
@@ -0,0 +1,272 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagecombobox.c
+ * Copyright (C) 2004 Sven Neumann <sven@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimpimagecombobox.h"
+#include "gimppixbuf.h"
+
+
+/**
+ * SECTION: gimpimagecombobox
+ * @title: GimpImageComboBox
+ * @short_description: A widget providing a popup menu of images.
+ *
+ * A widget providing a popup menu of images.
+ **/
+
+
+#define THUMBNAIL_SIZE 24
+#define WIDTH_REQUEST 200
+
+
+typedef struct _GimpImageComboBoxClass GimpImageComboBoxClass;
+
+struct _GimpImageComboBox
+{
+ GimpIntComboBox parent_instance;
+
+ GimpImageConstraintFunc constraint;
+ gpointer data;
+};
+
+struct _GimpImageComboBoxClass
+{
+ GimpIntComboBoxClass parent_class;
+};
+
+
+static void gimp_image_combo_box_populate (GimpImageComboBox *combo_box);
+static void gimp_image_combo_box_model_add (GtkListStore *store,
+ gint num_images,
+ gint32 *images,
+ GimpImageConstraintFunc constraint,
+ gpointer data);
+
+static void gimp_image_combo_box_drag_data_received (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time);
+
+static void gimp_image_combo_box_changed (GimpImageComboBox *combo_box);
+
+
+static const GtkTargetEntry target = { "application/x-gimp-image-id", 0 };
+
+
+G_DEFINE_TYPE (GimpImageComboBox, gimp_image_combo_box, GIMP_TYPE_INT_COMBO_BOX)
+
+
+static void
+gimp_image_combo_box_class_init (GimpImageComboBoxClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ widget_class->drag_data_received = gimp_image_combo_box_drag_data_received;
+}
+
+static void
+gimp_image_combo_box_init (GimpImageComboBox *combo_box)
+{
+ gtk_drag_dest_set (GTK_WIDGET (combo_box),
+ GTK_DEST_DEFAULT_HIGHLIGHT |
+ GTK_DEST_DEFAULT_MOTION |
+ GTK_DEST_DEFAULT_DROP,
+ &target, 1,
+ GDK_ACTION_COPY);
+}
+
+/**
+ * gimp_image_combo_box_new:
+ * @constraint: a #GimpImageConstraintFunc or %NULL
+ * @data: a pointer that is passed to @constraint
+ *
+ * Creates a new #GimpIntComboBox filled with all currently opened
+ * images. If a @constraint function is specified, it is called for
+ * each image and only if the function returns %TRUE, the image is
+ * added to the combobox.
+ *
+ * You should use gimp_int_combo_box_connect() to initialize and
+ * connect the combo. Use gimp_int_combo_box_set_active() to get the
+ * active image ID and gimp_int_combo_box_get_active() to retrieve the
+ * ID of the selected image.
+ *
+ * Return value: a new #GimpIntComboBox.
+ *
+ * Since: 2.2
+ **/
+GtkWidget *
+gimp_image_combo_box_new (GimpImageConstraintFunc constraint,
+ gpointer data)
+{
+ GimpImageComboBox *combo_box;
+
+ combo_box = g_object_new (GIMP_TYPE_IMAGE_COMBO_BOX,
+ "width-request", WIDTH_REQUEST,
+ "ellipsize", PANGO_ELLIPSIZE_MIDDLE,
+ NULL);
+
+ combo_box->constraint = constraint;
+ combo_box->data = data;
+
+ gimp_image_combo_box_populate (combo_box);
+
+ g_signal_connect (combo_box, "changed",
+ G_CALLBACK (gimp_image_combo_box_changed),
+ NULL);
+
+ return GTK_WIDGET (combo_box);
+}
+
+static void
+gimp_image_combo_box_populate (GimpImageComboBox *combo_box)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint32 *images;
+ gint num_images;
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
+
+ images = gimp_image_list (&num_images);
+
+ gimp_image_combo_box_model_add (GTK_LIST_STORE (model),
+ num_images, images,
+ combo_box->constraint,
+ combo_box->data);
+
+ g_free (images);
+
+ if (gtk_tree_model_get_iter_first (model, &iter))
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
+}
+
+static void
+gimp_image_combo_box_model_add (GtkListStore *store,
+ gint num_images,
+ gint32 *images,
+ GimpImageConstraintFunc constraint,
+ gpointer data)
+{
+ GtkTreeIter iter;
+ gint i;
+
+ for (i = 0; i < num_images; i++)
+ {
+ if (! constraint || (* constraint) (images[i], data))
+ {
+ gchar *image_name = gimp_image_get_name (images[i]);
+ gchar *label;
+ GdkPixbuf *thumb;
+
+ label = g_strdup_printf ("%s-%d", image_name, images[i]);
+
+ g_free (image_name);
+
+ thumb = gimp_image_get_thumbnail (images[i],
+ THUMBNAIL_SIZE, THUMBNAIL_SIZE,
+ GIMP_PIXBUF_SMALL_CHECKS);
+
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ GIMP_INT_STORE_VALUE, images[i],
+ GIMP_INT_STORE_LABEL, label,
+ GIMP_INT_STORE_PIXBUF, thumb,
+ -1);
+
+ if (thumb)
+ g_object_unref (thumb);
+
+ g_free (label);
+ }
+ }
+}
+
+static void
+gimp_image_combo_box_drag_data_received (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time)
+{
+ gint length = gtk_selection_data_get_length (selection);
+ gchar *str;
+
+ if (gtk_selection_data_get_format (selection) != 8 || length < 1)
+ {
+ g_warning ("%s: received invalid image ID data", G_STRFUNC);
+ return;
+ }
+
+ str = g_strndup ((const gchar *) gtk_selection_data_get_data (selection),
+ length);
+
+ if (g_utf8_validate (str, -1, NULL))
+ {
+ gint pid;
+ gint ID;
+
+ if (sscanf (str, "%i:%i", &pid, &ID) == 2 &&
+ pid == gimp_getpid ())
+ {
+ gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (widget), ID);
+ }
+ }
+
+ g_free (str);
+}
+
+static void
+gimp_image_combo_box_changed (GimpImageComboBox *combo_box)
+{
+ gint image_ID;
+
+ if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (combo_box),
+ &image_ID))
+ {
+ if (! gimp_image_is_valid (image_ID))
+ {
+ GtkTreeModel *model;
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
+
+ g_signal_stop_emission_by_name (combo_box, "changed");
+
+ gtk_list_store_clear (GTK_LIST_STORE (model));
+ gimp_image_combo_box_populate (combo_box);
+ }
+ }
+}
diff --git a/libgimp/gimpimagecombobox.h b/libgimp/gimpimagecombobox.h
new file mode 100644
index 0000000..146d0da
--- /dev/null
+++ b/libgimp/gimpimagecombobox.h
@@ -0,0 +1,51 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagecombobox.h
+ * Copyright (C) 2004 Sven Neumann <sven@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_COMBO_BOX_H__
+#define __GIMP_IMAGE_COMBO_BOX_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+#define GIMP_TYPE_IMAGE_COMBO_BOX (gimp_image_combo_box_get_type ())
+#define GIMP_IMAGE_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_IMAGE_COMBO_BOX, GimpImageComboBox))
+#define GIMP_IS_IMAGE_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_IMAGE_COMBO_BOX)
+
+
+typedef gboolean (* GimpImageConstraintFunc) (gint32 image_id,
+ gpointer data);
+
+
+GType gimp_image_combo_box_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_image_combo_box_new (GimpImageConstraintFunc constraint,
+ gpointer data);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_COMBO_BOX_H__ */
diff --git a/libgimp/gimpimageconvert_pdb.c b/libgimp/gimpimageconvert_pdb.c
new file mode 100644
index 0000000..df72667
--- /dev/null
+++ b/libgimp/gimpimageconvert_pdb.c
@@ -0,0 +1,233 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimageconvert_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpimageconvert
+ * @title: gimpimageconvert
+ * @short_description: Conversions between RGB, indexed, and grayscale modes.
+ *
+ * Conversions between RGB, indexed, and grayscale modes.
+ **/
+
+
+/**
+ * gimp_image_convert_rgb:
+ * @image_ID: The image.
+ *
+ * Convert specified image to RGB color
+ *
+ * This procedure converts the specified image to RGB color. This
+ * process requires an image in Grayscale or Indexed color mode. No
+ * image content is lost in this process aside from the colormap for an
+ * indexed image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_convert_rgb (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-convert-rgb",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_convert_grayscale:
+ * @image_ID: The image.
+ *
+ * Convert specified image to grayscale
+ *
+ * This procedure converts the specified image to grayscale. This
+ * process requires an image in RGB or Indexed color mode.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_convert_grayscale (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-convert-grayscale",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_convert_indexed:
+ * @image_ID: The image.
+ * @dither_type: The dither type to use.
+ * @palette_type: The type of palette to use.
+ * @num_cols: The number of colors to quantize to, ignored unless (palette_type == GIMP_CONVERT_PALETTE_GENERATE).
+ * @alpha_dither: Dither transparency to fake partial opacity.
+ * @remove_unused: Remove unused or duplicate color entries from final palette, ignored if (palette_type == GIMP_CONVERT_PALETTE_GENERATE).
+ * @palette: The name of the custom palette to use, ignored unless (palette_type == GIMP_CONVERT_PALETTE_CUSTOM).
+ *
+ * Convert specified image to and Indexed image
+ *
+ * This procedure converts the specified image to 'indexed' color. This
+ * process requires an image in RGB or Grayscale mode. The
+ * 'palette_type' specifies what kind of palette to use, A type of '0'
+ * means to use an optimal palette of 'num_cols' generated from the
+ * colors in the image. A type of '1' means to re-use the previous
+ * palette (not currently implemented). A type of '2' means to use the
+ * so-called WWW-optimized palette. Type '3' means to use only black
+ * and white colors. A type of '4' means to use a palette from the gimp
+ * palettes directories. The 'dither type' specifies what kind of
+ * dithering to use. '0' means no dithering, '1' means standard
+ * Floyd-Steinberg error diffusion, '2' means Floyd-Steinberg error
+ * diffusion with reduced bleeding, '3' means dithering based on pixel
+ * location ('Fixed' dithering).
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_convert_indexed (gint32 image_ID,
+ GimpConvertDitherType dither_type,
+ GimpConvertPaletteType palette_type,
+ gint num_cols,
+ gboolean alpha_dither,
+ gboolean remove_unused,
+ const gchar *palette)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-convert-indexed",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, dither_type,
+ GIMP_PDB_INT32, palette_type,
+ GIMP_PDB_INT32, num_cols,
+ GIMP_PDB_INT32, alpha_dither,
+ GIMP_PDB_INT32, remove_unused,
+ GIMP_PDB_STRING, palette,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_convert_set_dither_matrix:
+ * @width: Width of the matrix (0 to reset to default matrix).
+ * @height: Height of the matrix (0 to reset to default matrix).
+ * @matrix_length: The length of 'matrix'.
+ * @matrix: The matrix -- all values must be >= 1.
+ *
+ * Set dither matrix for conversion to indexed
+ *
+ * This procedure sets the dither matrix used when converting images to
+ * INDEXED mode with positional dithering.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_convert_set_dither_matrix (gint width,
+ gint height,
+ gint matrix_length,
+ const guint8 *matrix)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-convert-set-dither-matrix",
+ &nreturn_vals,
+ GIMP_PDB_INT32, width,
+ GIMP_PDB_INT32, height,
+ GIMP_PDB_INT32, matrix_length,
+ GIMP_PDB_INT8ARRAY, matrix,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_convert_precision:
+ * @image_ID: The image.
+ * @precision: The new precision.
+ *
+ * Convert the image to the specified precision
+ *
+ * This procedure converts the image to the specified precision. Note
+ * that indexed images cannot be converted and are always in
+ * GIMP_PRECISION_U8.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_image_convert_precision (gint32 image_ID,
+ GimpPrecision precision)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-convert-precision",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, precision,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpimageconvert_pdb.h b/libgimp/gimpimageconvert_pdb.h
new file mode 100644
index 0000000..6bbcf0c
--- /dev/null
+++ b/libgimp/gimpimageconvert_pdb.h
@@ -0,0 +1,54 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimageconvert_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_CONVERT_PDB_H__
+#define __GIMP_IMAGE_CONVERT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_image_convert_rgb (gint32 image_ID);
+gboolean gimp_image_convert_grayscale (gint32 image_ID);
+gboolean gimp_image_convert_indexed (gint32 image_ID,
+ GimpConvertDitherType dither_type,
+ GimpConvertPaletteType palette_type,
+ gint num_cols,
+ gboolean alpha_dither,
+ gboolean remove_unused,
+ const gchar *palette);
+gboolean gimp_image_convert_set_dither_matrix (gint width,
+ gint height,
+ gint matrix_length,
+ const guint8 *matrix);
+gboolean gimp_image_convert_precision (gint32 image_ID,
+ GimpPrecision precision);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_CONVERT_PDB_H__ */
diff --git a/libgimp/gimpimagegrid_pdb.c b/libgimp/gimpimagegrid_pdb.c
new file mode 100644
index 0000000..c207acb
--- /dev/null
+++ b/libgimp/gimpimagegrid_pdb.c
@@ -0,0 +1,408 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagegrid_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpimagegrid
+ * @title: gimpimagegrid
+ * @short_description: Functions manuipulating an image's grid.
+ *
+ * Functions manuipulating an image's grid.
+ **/
+
+
+/**
+ * gimp_image_grid_get_spacing:
+ * @image_ID: The image.
+ * @xspacing: The image's grid horizontal spacing.
+ * @yspacing: The image's grid vertical spacing.
+ *
+ * Gets the spacing of an image's grid.
+ *
+ * This procedure retrieves the horizontal and vertical spacing of an
+ * image's grid. It takes the image as parameter.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_grid_get_spacing (gint32 image_ID,
+ gdouble *xspacing,
+ gdouble *yspacing)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-grid-get-spacing",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ *xspacing = 0.0;
+ *yspacing = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *xspacing = return_vals[1].data.d_float;
+ *yspacing = return_vals[2].data.d_float;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_grid_set_spacing:
+ * @image_ID: The image.
+ * @xspacing: The image's grid horizontal spacing.
+ * @yspacing: The image's grid vertical spacing.
+ *
+ * Sets the spacing of an image's grid.
+ *
+ * This procedure sets the horizontal and vertical spacing of an
+ * image's grid.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_grid_set_spacing (gint32 image_ID,
+ gdouble xspacing,
+ gdouble yspacing)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-grid-set-spacing",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_FLOAT, xspacing,
+ GIMP_PDB_FLOAT, yspacing,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_grid_get_offset:
+ * @image_ID: The image.
+ * @xoffset: The image's grid horizontal offset.
+ * @yoffset: The image's grid vertical offset.
+ *
+ * Gets the offset of an image's grid.
+ *
+ * This procedure retrieves the horizontal and vertical offset of an
+ * image's grid. It takes the image as parameter.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_grid_get_offset (gint32 image_ID,
+ gdouble *xoffset,
+ gdouble *yoffset)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-grid-get-offset",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ *xoffset = 0.0;
+ *yoffset = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *xoffset = return_vals[1].data.d_float;
+ *yoffset = return_vals[2].data.d_float;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_grid_set_offset:
+ * @image_ID: The image.
+ * @xoffset: The image's grid horizontal offset.
+ * @yoffset: The image's grid vertical offset.
+ *
+ * Sets the offset of an image's grid.
+ *
+ * This procedure sets the horizontal and vertical offset of an image's
+ * grid.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_grid_set_offset (gint32 image_ID,
+ gdouble xoffset,
+ gdouble yoffset)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-grid-set-offset",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_FLOAT, xoffset,
+ GIMP_PDB_FLOAT, yoffset,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_grid_get_foreground_color:
+ * @image_ID: The image.
+ * @fgcolor: The image's grid foreground color.
+ *
+ * Sets the foreground color of an image's grid.
+ *
+ * This procedure gets the foreground color of an image's grid.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_grid_get_foreground_color (gint32 image_ID,
+ GimpRGB *fgcolor)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-grid-get-foreground-color",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *fgcolor = return_vals[1].data.d_color;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_grid_set_foreground_color:
+ * @image_ID: The image.
+ * @fgcolor: The new foreground color.
+ *
+ * Gets the foreground color of an image's grid.
+ *
+ * This procedure sets the foreground color of an image's grid.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_grid_set_foreground_color (gint32 image_ID,
+ const GimpRGB *fgcolor)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-grid-set-foreground-color",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_COLOR, fgcolor,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_grid_get_background_color:
+ * @image_ID: The image.
+ * @bgcolor: The image's grid background color.
+ *
+ * Sets the background color of an image's grid.
+ *
+ * This procedure gets the background color of an image's grid.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_grid_get_background_color (gint32 image_ID,
+ GimpRGB *bgcolor)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-grid-get-background-color",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *bgcolor = return_vals[1].data.d_color;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_grid_set_background_color:
+ * @image_ID: The image.
+ * @bgcolor: The new background color.
+ *
+ * Gets the background color of an image's grid.
+ *
+ * This procedure sets the background color of an image's grid.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_grid_set_background_color (gint32 image_ID,
+ const GimpRGB *bgcolor)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-grid-set-background-color",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_COLOR, bgcolor,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_grid_get_style:
+ * @image_ID: The image.
+ *
+ * Gets the style of an image's grid.
+ *
+ * This procedure retrieves the style of an image's grid.
+ *
+ * Returns: The image's grid style.
+ *
+ * Since: 2.4
+ **/
+GimpGridStyle
+gimp_image_grid_get_style (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpGridStyle style = 0;
+
+ return_vals = gimp_run_procedure ("gimp-image-grid-get-style",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ style = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return style;
+}
+
+/**
+ * gimp_image_grid_set_style:
+ * @image_ID: The image.
+ * @style: The image's grid style.
+ *
+ * Sets the style unit of an image's grid.
+ *
+ * This procedure sets the style of an image's grid. It takes the image
+ * and the new style as parameters.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_image_grid_set_style (gint32 image_ID,
+ GimpGridStyle style)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-grid-set-style",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, style,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpimagegrid_pdb.h b/libgimp/gimpimagegrid_pdb.h
new file mode 100644
index 0000000..f39a88a
--- /dev/null
+++ b/libgimp/gimpimagegrid_pdb.h
@@ -0,0 +1,62 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagegrid_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_GRID_PDB_H__
+#define __GIMP_IMAGE_GRID_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_image_grid_get_spacing (gint32 image_ID,
+ gdouble *xspacing,
+ gdouble *yspacing);
+gboolean gimp_image_grid_set_spacing (gint32 image_ID,
+ gdouble xspacing,
+ gdouble yspacing);
+gboolean gimp_image_grid_get_offset (gint32 image_ID,
+ gdouble *xoffset,
+ gdouble *yoffset);
+gboolean gimp_image_grid_set_offset (gint32 image_ID,
+ gdouble xoffset,
+ gdouble yoffset);
+gboolean gimp_image_grid_get_foreground_color (gint32 image_ID,
+ GimpRGB *fgcolor);
+gboolean gimp_image_grid_set_foreground_color (gint32 image_ID,
+ const GimpRGB *fgcolor);
+gboolean gimp_image_grid_get_background_color (gint32 image_ID,
+ GimpRGB *bgcolor);
+gboolean gimp_image_grid_set_background_color (gint32 image_ID,
+ const GimpRGB *bgcolor);
+GimpGridStyle gimp_image_grid_get_style (gint32 image_ID);
+gboolean gimp_image_grid_set_style (gint32 image_ID,
+ GimpGridStyle style);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_GRID_PDB_H__ */
diff --git a/libgimp/gimpimageguides_pdb.c b/libgimp/gimpimageguides_pdb.c
new file mode 100644
index 0000000..252f970
--- /dev/null
+++ b/libgimp/gimpimageguides_pdb.c
@@ -0,0 +1,243 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimageguides_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpimageguides
+ * @title: gimpimageguides
+ * @short_description: Functions for manipulating an image's guides.
+ *
+ * Functions for manipulating an image's guides.
+ **/
+
+
+/**
+ * gimp_image_add_hguide:
+ * @image_ID: The image.
+ * @yposition: The guide's y-offset from top of image.
+ *
+ * Add a horizontal guide to an image.
+ *
+ * This procedure adds a horizontal guide to an image. It takes the
+ * input image and the y-position of the new guide as parameters. It
+ * returns the guide ID of the new guide.
+ *
+ * Returns: The new guide.
+ **/
+gint32
+gimp_image_add_hguide (gint32 image_ID,
+ gint yposition)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 guide_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-add-hguide",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, yposition,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ guide_ID = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return guide_ID;
+}
+
+/**
+ * gimp_image_add_vguide:
+ * @image_ID: The image.
+ * @xposition: The guide's x-offset from left of image.
+ *
+ * Add a vertical guide to an image.
+ *
+ * This procedure adds a vertical guide to an image. It takes the input
+ * image and the x-position of the new guide as parameters. It returns
+ * the guide ID of the new guide.
+ *
+ * Returns: The new guide.
+ **/
+gint32
+gimp_image_add_vguide (gint32 image_ID,
+ gint xposition)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 guide_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-add-vguide",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, xposition,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ guide_ID = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return guide_ID;
+}
+
+/**
+ * gimp_image_delete_guide:
+ * @image_ID: The image.
+ * @guide_ID: The ID of the guide to be removed.
+ *
+ * Deletes a guide from an image.
+ *
+ * This procedure takes an image and a guide ID as input and removes
+ * the specified guide from the specified image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_delete_guide (gint32 image_ID,
+ gint32 guide_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-delete-guide",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, guide_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_find_next_guide:
+ * @image_ID: The image.
+ * @guide_ID: The ID of the current guide (0 if first invocation).
+ *
+ * Find next guide on an image.
+ *
+ * This procedure takes an image and a guide ID as input and finds the
+ * guide ID of the successor of the given guide ID in the image's guide
+ * list. If the supplied guide ID is 0, the procedure will return the
+ * first Guide. The procedure will return 0 if given the final guide ID
+ * as an argument or the image has no guides.
+ *
+ * Returns: The next guide's ID.
+ **/
+gint32
+gimp_image_find_next_guide (gint32 image_ID,
+ gint32 guide_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 next_guide_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-find-next-guide",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, guide_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ next_guide_ID = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return next_guide_ID;
+}
+
+/**
+ * gimp_image_get_guide_orientation:
+ * @image_ID: The image.
+ * @guide_ID: The guide.
+ *
+ * Get orientation of a guide on an image.
+ *
+ * This procedure takes an image and a guide ID as input and returns
+ * the orientations of the guide.
+ *
+ * Returns: The guide's orientation.
+ **/
+GimpOrientationType
+gimp_image_get_guide_orientation (gint32 image_ID,
+ gint32 guide_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpOrientationType orientation = GIMP_ORIENTATION_UNKNOWN;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-guide-orientation",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, guide_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ orientation = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return orientation;
+}
+
+/**
+ * gimp_image_get_guide_position:
+ * @image_ID: The image.
+ * @guide_ID: The guide.
+ *
+ * Get position of a guide on an image.
+ *
+ * This procedure takes an image and a guide ID as input and returns
+ * the position of the guide relative to the top or left of the image.
+ *
+ * Returns: The guide's position relative to top or left of image.
+ **/
+gint
+gimp_image_get_guide_position (gint32 image_ID,
+ gint32 guide_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint position = G_MININT /* GIMP_GUIDE_POSITION_UNDEFINED */;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-guide-position",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, guide_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ position = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return position;
+}
diff --git a/libgimp/gimpimageguides_pdb.h b/libgimp/gimpimageguides_pdb.h
new file mode 100644
index 0000000..2f52ded
--- /dev/null
+++ b/libgimp/gimpimageguides_pdb.h
@@ -0,0 +1,51 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimageguides_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_GUIDES_PDB_H__
+#define __GIMP_IMAGE_GUIDES_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gint32 gimp_image_add_hguide (gint32 image_ID,
+ gint yposition);
+gint32 gimp_image_add_vguide (gint32 image_ID,
+ gint xposition);
+gboolean gimp_image_delete_guide (gint32 image_ID,
+ gint32 guide_ID);
+gint32 gimp_image_find_next_guide (gint32 image_ID,
+ gint32 guide_ID);
+GimpOrientationType gimp_image_get_guide_orientation (gint32 image_ID,
+ gint32 guide_ID);
+gint gimp_image_get_guide_position (gint32 image_ID,
+ gint32 guide_ID);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_GUIDES_PDB_H__ */
diff --git a/libgimp/gimpimagemetadata.c b/libgimp/gimpimagemetadata.c
new file mode 100644
index 0000000..5adb20d
--- /dev/null
+++ b/libgimp/gimpimagemetadata.c
@@ -0,0 +1,1204 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagemetadata.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <sys/time.h>
+
+#include <gtk/gtk.h>
+#include <gexiv2/gexiv2.h>
+
+#include "gimp.h"
+#include "gimpui.h"
+#include "gimpimagemetadata.h"
+
+#include "libgimp-intl.h"
+
+
+typedef struct
+{
+ gchar *tag;
+ gint type;
+} XmpStructs;
+
+static gchar * gimp_image_metadata_interpret_comment (gchar *comment);
+
+static void gimp_image_metadata_rotate (gint32 image_ID,
+ GExiv2Orientation orientation);
+static GdkPixbuf * gimp_image_metadata_rotate_pixbuf (GdkPixbuf *pixbuf,
+ GExiv2Orientation orientation);
+static void gimp_image_metadata_rotate_query (gint32 image_ID,
+ const gchar *mime_type,
+ GimpMetadata *metadata,
+ gboolean interactive);
+static gboolean gimp_image_metadata_rotate_dialog (gint32 image_ID,
+ GExiv2Orientation orientation,
+ const gchar *parasite_name);
+
+
+/* public functions */
+
+/**
+ * gimp_image_metadata_load_prepare:
+ * @image_ID: The image
+ * @mime_type: The loaded file's mime-type
+ * @file: The file to load the metadata from
+ * @error: Return location for error
+ *
+ * Loads and returns metadata from @file to be passed into
+ * gimp_image_metadata_load_finish().
+ *
+ * Returns: The file's metadata.
+ *
+ * Since: 2.10
+ */
+GimpMetadata *
+gimp_image_metadata_load_prepare (gint32 image_ID,
+ const gchar *mime_type,
+ GFile *file,
+ GError **error)
+{
+ GimpMetadata *metadata;
+
+ g_return_val_if_fail (image_ID > 0, NULL);
+ g_return_val_if_fail (mime_type != NULL, NULL);
+ g_return_val_if_fail (G_IS_FILE (file), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ metadata = gimp_metadata_load_from_file (file, error);
+
+ return metadata;
+}
+
+static gchar *
+gimp_image_metadata_interpret_comment (gchar *comment)
+{
+ /* Exiv2 can return unwanted text at the start of a comment
+ * taken from Exif.Photo.UserComment since 0.27.3.
+ * Let's remove that part and return NULL if there
+ * is nothing else left as comment. */
+
+ if (comment && g_str_has_prefix (comment, "charset=Ascii "))
+ {
+ gchar *real_comment;
+
+ /* Skip "charset=Ascii " (length 14) to find the real comment */
+ real_comment = comment + 14;
+ if (real_comment[0] == '\0' ||
+ ! g_strcmp0 (real_comment, "binary comment"))
+ {
+ g_free (comment);
+ return NULL;
+ }
+ else
+ {
+ real_comment = g_strdup (real_comment);
+ g_free (comment);
+ return real_comment;
+ }
+ }
+
+ return comment;
+}
+
+/**
+ * gimp_image_metadata_load_finish:
+ * @image_ID: The image
+ * @mime_type: The loaded file's mime-type
+ * @metadata: The metadata to set on the image
+ * @flags: Flags to specify what of the metadata to apply to the image
+ * @interactive: Whether this function is allowed to query info with dialogs
+ *
+ * Applies the @metadata previously loaded with
+ * gimp_image_metadata_load_prepare() to the image, taking into account
+ * the passed @flags.
+ *
+ * Since: 2.10
+ */
+void
+gimp_image_metadata_load_finish (gint32 image_ID,
+ const gchar *mime_type,
+ GimpMetadata *metadata,
+ GimpMetadataLoadFlags flags,
+ gboolean interactive)
+{
+ g_return_if_fail (image_ID > 0);
+ g_return_if_fail (mime_type != NULL);
+ g_return_if_fail (GEXIV2_IS_METADATA (metadata));
+
+ if (flags & GIMP_METADATA_LOAD_COMMENT)
+ {
+ gchar *comment;
+
+ comment = gexiv2_metadata_get_tag_interpreted_string (GEXIV2_METADATA (metadata),
+ "Exif.Photo.UserComment");
+ comment = gimp_image_metadata_interpret_comment (comment);
+
+ if (! comment)
+ comment = gexiv2_metadata_get_tag_interpreted_string (GEXIV2_METADATA (metadata),
+ "Exif.Image.ImageDescription");
+
+ if (comment)
+ {
+ GimpParasite *parasite;
+
+ parasite = gimp_parasite_new ("gimp-comment",
+ GIMP_PARASITE_PERSISTENT,
+ strlen (comment) + 1,
+ comment);
+ g_free (comment);
+
+ gimp_image_attach_parasite (image_ID, parasite);
+ gimp_parasite_free (parasite);
+ }
+ }
+
+ if (flags & GIMP_METADATA_LOAD_RESOLUTION)
+ {
+ gdouble xres;
+ gdouble yres;
+ GimpUnit unit;
+
+ if (gimp_metadata_get_resolution (metadata, &xres, &yres, &unit))
+ {
+ gimp_image_set_resolution (image_ID, xres, yres);
+ gimp_image_set_unit (image_ID, unit);
+ }
+ }
+
+ if (flags & GIMP_METADATA_LOAD_ORIENTATION)
+ {
+ gimp_image_metadata_rotate_query (image_ID, mime_type,
+ metadata, interactive);
+ /* Drop the orientation metadata in all cases, whether you rotated
+ * or not. See commit 8dcf258ffc on master.
+ */
+ gexiv2_metadata_set_orientation (GEXIV2_METADATA (metadata),
+ GEXIV2_ORIENTATION_NORMAL);
+ }
+
+ if (flags & GIMP_METADATA_LOAD_COLORSPACE)
+ {
+ GimpColorProfile *profile = gimp_image_get_color_profile (image_ID);
+
+ /* only look for colorspace information from metadata if the
+ * image didn't contain an embedded color profile
+ */
+ if (! profile)
+ {
+ GimpMetadataColorspace colorspace;
+
+ colorspace = gimp_metadata_get_colorspace (metadata);
+
+ switch (colorspace)
+ {
+ case GIMP_METADATA_COLORSPACE_UNSPECIFIED:
+ case GIMP_METADATA_COLORSPACE_UNCALIBRATED:
+ case GIMP_METADATA_COLORSPACE_SRGB:
+ /* use sRGB, a NULL profile will do the right thing */
+ break;
+
+ case GIMP_METADATA_COLORSPACE_ADOBERGB:
+ profile = gimp_color_profile_new_rgb_adobe ();
+ break;
+ }
+
+ if (profile)
+ gimp_image_set_color_profile (image_ID, profile);
+ }
+
+ if (profile)
+ g_object_unref (profile);
+ }
+
+ gimp_image_set_metadata (image_ID, metadata);
+}
+
+/**
+ * gimp_image_metadata_save_prepare:
+ * @image_ID: The image
+ * @mime_type: The saved file's mime-type
+ * @suggested_flags: Suggested default values for the @flags passed to
+ * gimp_image_metadata_save_finish()
+ *
+ * Gets the image metadata for saving it using
+ * gimp_image_metadata_save_finish().
+ *
+ * The @suggested_flags are determined from what kind of metadata
+ * (Exif, XMP, ...) is actually present in the image and the preferences
+ * for metadata exporting.
+ * The calling application may still update @available_flags, for
+ * instance to follow the settings from a previous export in the same
+ * session, or a previous export of the same image. But it should not
+ * override the preferences without a good reason since it is a data
+ * leak.
+ *
+ * The suggested value for GIMP_METADATA_SAVE_THUMBNAIL is determined by
+ * whether there was a thumbnail in the previously imported image.
+ *
+ * Returns: The image's metadata, prepared for saving.
+ *
+ * Since: 2.10
+ */
+GimpMetadata *
+gimp_image_metadata_save_prepare (gint32 image_ID,
+ const gchar *mime_type,
+ GimpMetadataSaveFlags *suggested_flags)
+{
+ GimpMetadata *metadata;
+
+ g_return_val_if_fail (image_ID > 0, NULL);
+ g_return_val_if_fail (mime_type != NULL, NULL);
+ g_return_val_if_fail (suggested_flags != NULL, NULL);
+
+ *suggested_flags = GIMP_METADATA_SAVE_ALL;
+
+ metadata = gimp_image_get_metadata (image_ID);
+
+ if (metadata)
+ {
+ GDateTime *datetime;
+ const GimpParasite *comment_parasite;
+ const gchar *comment = NULL;
+ gint image_width;
+ gint image_height;
+ gdouble xres;
+ gdouble yres;
+ gchar buffer[32];
+ gchar *datetime_buf = NULL;
+ GExiv2Metadata *g2metadata = GEXIV2_METADATA (metadata);
+
+ image_width = gimp_image_width (image_ID);
+ image_height = gimp_image_height (image_ID);
+
+ datetime = g_date_time_new_now_local ();
+
+ comment_parasite = gimp_image_get_parasite (image_ID, "gimp-comment");
+ if (comment_parasite)
+ comment = gimp_parasite_data (comment_parasite);
+
+ /* Exif */
+
+ if (! gimp_export_exif () ||
+ ! gexiv2_metadata_has_exif (g2metadata))
+ *suggested_flags &= ~GIMP_METADATA_SAVE_EXIF;
+
+ if (comment)
+ {
+ gexiv2_metadata_set_tag_string (g2metadata,
+ "Exif.Photo.UserComment",
+ comment);
+ gexiv2_metadata_set_tag_string (g2metadata,
+ "Exif.Image.ImageDescription",
+ comment);
+ }
+
+ g_snprintf (buffer, sizeof (buffer),
+ "%d:%02d:%02d %02d:%02d:%02d",
+ g_date_time_get_year (datetime),
+ g_date_time_get_month (datetime),
+ g_date_time_get_day_of_month (datetime),
+ g_date_time_get_hour (datetime),
+ g_date_time_get_minute (datetime),
+ g_date_time_get_second (datetime));
+ gexiv2_metadata_set_tag_string (g2metadata,
+ "Exif.Image.DateTime",
+ buffer);
+
+ gexiv2_metadata_set_tag_string (g2metadata,
+ "Exif.Image.Software",
+ PACKAGE_STRING);
+
+ gimp_metadata_set_pixel_size (metadata,
+ image_width, image_height);
+
+ gimp_image_get_resolution (image_ID, &xres, &yres);
+ gimp_metadata_set_resolution (metadata, xres, yres,
+ gimp_image_get_unit (image_ID));
+
+ /* XMP */
+
+ if (! gimp_export_xmp () ||
+ ! gexiv2_metadata_has_xmp (g2metadata))
+ *suggested_flags &= ~GIMP_METADATA_SAVE_XMP;
+
+ gexiv2_metadata_set_tag_string (g2metadata,
+ "Xmp.dc.Format",
+ mime_type);
+
+ /* XMP uses datetime in ISO 8601 format */
+ datetime_buf = g_date_time_format (datetime, "%Y:%m:%dT%T\%:z");
+
+ gexiv2_metadata_set_tag_string (g2metadata,
+ "Xmp.xmp.ModifyDate",
+ datetime_buf);
+ gexiv2_metadata_set_tag_string (g2metadata,
+ "Xmp.xmp.MetadataDate",
+ datetime_buf);
+
+ if (! g_strcmp0 (mime_type, "image/tiff"))
+ {
+ /* TIFF specific XMP data */
+
+ g_snprintf (buffer, sizeof (buffer), "%d", image_width);
+ gexiv2_metadata_set_tag_string (g2metadata,
+ "Xmp.tiff.ImageWidth",
+ buffer);
+
+ g_snprintf (buffer, sizeof (buffer), "%d", image_height);
+ gexiv2_metadata_set_tag_string (g2metadata,
+ "Xmp.tiff.ImageLength",
+ buffer);
+
+ gexiv2_metadata_set_tag_string (g2metadata,
+ "Xmp.tiff.DateTime",
+ datetime_buf);
+ }
+
+ /* IPTC */
+
+ if (! gimp_export_iptc () ||
+ ! gexiv2_metadata_has_iptc (g2metadata))
+ *suggested_flags &= ~GIMP_METADATA_SAVE_IPTC;
+
+ g_free (datetime_buf);
+ g_date_time_unref (datetime);
+
+ /* EXIF Thumbnail */
+
+ if (gexiv2_metadata_has_exif (g2metadata))
+ {
+ gchar *value;
+
+ /* Check a required tag for a thumbnail to be present. */
+ value = gexiv2_metadata_get_tag_string (g2metadata,
+ "Exif.Thumbnail.ImageLength");
+
+ if (! value)
+ *suggested_flags &= ~GIMP_METADATA_SAVE_THUMBNAIL;
+ else
+ g_free (value);
+ }
+ else
+ {
+ *suggested_flags &= ~GIMP_METADATA_SAVE_THUMBNAIL;
+ }
+ }
+
+ /* Thumbnail */
+
+ if (FALSE /* FIXME if (original image had a thumbnail) */)
+ *suggested_flags &= ~GIMP_METADATA_SAVE_THUMBNAIL;
+
+ /* Color profile */
+
+ if (! gimp_export_color_profile ())
+ *suggested_flags &= ~GIMP_METADATA_SAVE_COLOR_PROFILE;
+
+ return metadata;
+}
+
+static const gchar *
+gimp_fix_xmp_tag (const gchar *tag)
+{
+ gchar *substring;
+
+ /* Due to problems using /Iptc4xmpExt namespace (/iptcExt is used
+ * instead by Exiv2) we replace all occurrences with /iptcExt which
+ * is valid but less common. Not doing so would cause saving xmp
+ * metadata to fail. This has to be done after getting the values
+ * from the source metadata since that source uses the original
+ * tag names and would otherwise return NULL as value.
+ * /Iptc4xmpExt length = 12
+ * /iptcExt length = 8
+ */
+
+ substring = strstr (tag, "/Iptc4xmpExt");
+ while (substring)
+ {
+ gint len_tag = strlen (tag);
+ gint len_end;
+
+ len_end = len_tag - (substring - tag) - 12;
+ strncpy (substring, "/iptcExt", 8);
+ substring += 8;
+ /* Using memmove: we have overlapping source and dest */
+ memmove (substring, substring+4, len_end);
+ substring[len_end] = '\0';
+ g_debug ("Fixed tag value: %s", tag);
+
+ /* Multiple occurrences are possible: e.g.:
+ * Xmp.iptcExt.ImageRegion[3]/Iptc4xmpExt:RegionBoundary/Iptc4xmpExt:rbVertices[1]/Iptc4xmpExt:rbX
+ */
+ substring = strstr (tag, "/Iptc4xmpExt");
+ }
+ return tag;
+}
+
+static void
+gimp_image_metadata_copy_tag (GExiv2Metadata *src,
+ GExiv2Metadata *dest,
+ const gchar *tag)
+{
+ gchar **values = gexiv2_metadata_get_tag_multiple (src, tag);
+
+ if (values)
+ {
+ gchar *temp_tag;
+
+ /* Xmp always seems to return multiple values */
+ if (g_str_has_prefix (tag, "Xmp."))
+ temp_tag = (gchar *) gimp_fix_xmp_tag (g_strdup (tag));
+ else
+ temp_tag = g_strdup (tag);
+
+ g_debug ("Copy multi tag %s, first value: %s", temp_tag, values[0]);
+ gexiv2_metadata_set_tag_multiple (dest, temp_tag, (const gchar **) values);
+ g_free (temp_tag);
+ g_strfreev (values);
+ }
+ else
+ {
+ gchar *value = gexiv2_metadata_get_tag_string (src, tag);
+
+ if (value)
+ {
+ g_debug ("Copy tag %s, value: %s", tag, value);
+ gexiv2_metadata_set_tag_string (dest, tag, value);
+ g_free (value);
+ }
+ }
+}
+
+static gint
+gimp_natural_sort_compare (gconstpointer left,
+ gconstpointer right)
+{
+ gint compare;
+ gchar *left_key = g_utf8_collate_key_for_filename ((gchar *) left, -1);
+ gchar *right_key = g_utf8_collate_key_for_filename ((gchar *) right, -1);
+
+ compare = g_strcmp0 (left_key, right_key);
+ g_free (left_key);
+ g_free (right_key);
+
+ return compare;
+}
+
+static GList*
+gimp_image_metadata_convert_tags_to_list (gchar **xmp_tags)
+{
+ GList *list = NULL;
+ gint i;
+
+ for (i = 0; xmp_tags[i] != NULL; i++)
+ {
+ g_debug ("Tag: %s, tag type: %s", xmp_tags[i], gexiv2_metadata_get_tag_type(xmp_tags[i]));
+ list = g_list_prepend (list, xmp_tags[i]);
+ }
+ return list;
+}
+
+static GExiv2StructureType
+gimp_image_metadata_get_xmp_struct_type (const gchar *tag)
+{
+ g_debug ("Struct type for tag: %s, type: %s", tag, gexiv2_metadata_get_tag_type (tag));
+
+ if (! g_strcmp0 (gexiv2_metadata_get_tag_type (tag), "XmpSeq"))
+ {
+ return GEXIV2_STRUCTURE_XA_SEQ;
+ }
+
+ return GEXIV2_STRUCTURE_XA_BAG;
+}
+
+static void
+gimp_image_metadata_set_xmp_structs (GList *xmp_list,
+ GExiv2Metadata *metadata)
+{
+ GList *list;
+ gchar *prev_one = NULL;
+ gchar *prev_two = NULL;
+
+ for (list = xmp_list; list != NULL; list = list->next)
+ {
+ gchar **tag_split;
+
+ /*
+ * Most tags with structs have only one struct part, like:
+ * Xmp.xmpMM.History[1]...
+ * However there are also Xmp tags that have two
+ * structs in one tag, e.g.:
+ * Xmp.crs.GradientBasedCorrections[1]/crs:CorrectionMasks[1]...
+ */
+ tag_split = g_strsplit ((gchar *) list->data, "[1]", 3);
+ /* Check if there are at least two parts but don't catch xxx[2]/yyy[1]/zzz */
+ if (tag_split && tag_split[1] && ! strstr (tag_split[0], "["))
+ {
+ if (! prev_one || strcmp (tag_split[0], prev_one) != 0)
+ {
+ GExiv2StructureType type;
+
+ g_free (prev_one);
+ prev_one = g_strdup (tag_split[0]);
+
+ type = gimp_image_metadata_get_xmp_struct_type (gimp_fix_xmp_tag (tag_split[0]));
+ gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (metadata),
+ prev_one, type);
+ }
+ if (tag_split[2] && (!prev_two || strcmp (tag_split[1], prev_two) != 0))
+ {
+ gchar *second_struct;
+ GExiv2StructureType type;
+
+ g_free (prev_two);
+ prev_two = g_strdup (tag_split[1]);
+ second_struct = g_strdup_printf ("%s[1]%s", prev_one, gimp_fix_xmp_tag(prev_two));
+
+ type = gimp_image_metadata_get_xmp_struct_type (gimp_fix_xmp_tag (tag_split[1]));
+ gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (metadata),
+ second_struct, type);
+ g_free (second_struct);
+ }
+ }
+
+ g_strfreev (tag_split);
+ }
+ g_free (prev_one);
+ g_free (prev_two);
+}
+
+/**
+ * gimp_image_metadata_save_finish:
+ * @image_ID: The image
+ * @mime_type: The saved file's mime-type
+ * @metadata: The metadata to set on the image
+ * @flags: Flags to specify what of the metadata to save
+ * @file: The file to load the metadata from
+ * @error: Return location for error message
+ *
+ * Saves the @metadata retrieved from the image with
+ * gimp_image_metadata_save_prepare() to @file, taking into account
+ * the passed @flags.
+ *
+ * Return value: Whether the save was successful.
+ *
+ * Since: 2.10
+ */
+gboolean
+gimp_image_metadata_save_finish (gint32 image_ID,
+ const gchar *mime_type,
+ GimpMetadata *metadata,
+ GimpMetadataSaveFlags flags,
+ GFile *file,
+ GError **error)
+{
+ GimpMetadata *new_metadata;
+ GExiv2Metadata *new_g2metadata;
+ gboolean support_exif;
+ gboolean support_xmp;
+ gboolean support_iptc;
+ gboolean success = FALSE;
+ gint i;
+
+ g_return_val_if_fail (image_ID > 0, FALSE);
+ g_return_val_if_fail (mime_type != NULL, FALSE);
+ g_return_val_if_fail (GEXIV2_IS_METADATA (metadata), FALSE);
+ g_return_val_if_fail (G_IS_FILE (file), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (! (flags & (GIMP_METADATA_SAVE_EXIF |
+ GIMP_METADATA_SAVE_XMP |
+ GIMP_METADATA_SAVE_IPTC |
+ GIMP_METADATA_SAVE_THUMBNAIL)))
+ return TRUE;
+
+ /* read metadata from saved file */
+ new_metadata = gimp_metadata_load_from_file (file, error);
+ new_g2metadata = GEXIV2_METADATA (new_metadata);
+
+ if (! new_metadata)
+ return FALSE;
+
+ support_exif = gexiv2_metadata_get_supports_exif (new_g2metadata);
+ support_xmp = gexiv2_metadata_get_supports_xmp (new_g2metadata);
+ support_iptc = gexiv2_metadata_get_supports_iptc (new_g2metadata);
+
+ if ((flags & GIMP_METADATA_SAVE_EXIF) && support_exif)
+ {
+ gchar **exif_data = gexiv2_metadata_get_exif_tags (GEXIV2_METADATA (metadata));
+
+ for (i = 0; exif_data[i] != NULL; i++)
+ {
+ if (! gexiv2_metadata_has_tag (new_g2metadata, exif_data[i]) &&
+ gimp_metadata_is_tag_supported (exif_data[i], mime_type))
+ {
+ gimp_image_metadata_copy_tag (GEXIV2_METADATA (metadata),
+ new_g2metadata,
+ exif_data[i]);
+ }
+ }
+
+ g_strfreev (exif_data);
+ }
+
+ if ((flags & GIMP_METADATA_SAVE_XMP) && support_xmp)
+ {
+ gchar **xmp_data;
+ struct timeval timer_usec;
+ gint64 timestamp_usec;
+ gchar ts[128];
+ GList *xmp_list = NULL;
+ GList *list;
+
+ gettimeofday (&timer_usec, NULL);
+ timestamp_usec = ((gint64) timer_usec.tv_sec) * 1000000ll +
+ (gint64) timer_usec.tv_usec;
+ g_snprintf (ts, sizeof (ts), "%" G_GINT64_FORMAT, timestamp_usec);
+
+ gimp_metadata_add_xmp_history (metadata, "");
+
+ gexiv2_metadata_set_tag_string (GEXIV2_METADATA (metadata),
+ "Xmp.GIMP.TimeStamp",
+ ts);
+
+ gexiv2_metadata_set_tag_string (GEXIV2_METADATA (metadata),
+ "Xmp.xmp.CreatorTool",
+ N_("GIMP 2.10"));
+
+ gexiv2_metadata_set_tag_string (GEXIV2_METADATA (metadata),
+ "Xmp.GIMP.Version",
+ GIMP_VERSION);
+
+ gexiv2_metadata_set_tag_string (GEXIV2_METADATA (metadata),
+ "Xmp.GIMP.API",
+ GIMP_API_VERSION);
+
+ gexiv2_metadata_set_tag_string (GEXIV2_METADATA (metadata),
+ "Xmp.GIMP.Platform",
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
+ "Windows"
+#elif defined(__linux__)
+ "Linux"
+#elif defined(__APPLE__) && defined(__MACH__)
+ "Mac OS"
+#elif defined(unix) || defined(__unix__) || defined(__unix)
+ "Unix"
+#else
+ "Unknown"
+#endif
+ );
+
+ xmp_data = gexiv2_metadata_get_xmp_tags (GEXIV2_METADATA (metadata));
+
+ xmp_list = gimp_image_metadata_convert_tags_to_list (xmp_data);
+ xmp_list = g_list_sort (xmp_list, (GCompareFunc) gimp_natural_sort_compare);
+ gimp_image_metadata_set_xmp_structs (xmp_list, new_g2metadata);
+
+ for (list = xmp_list; list != NULL; list = list->next)
+ {
+ if (! gexiv2_metadata_has_tag (new_g2metadata, (gchar *) list->data) &&
+ gimp_metadata_is_tag_supported ((gchar *) list->data, mime_type))
+ {
+ gimp_image_metadata_copy_tag (GEXIV2_METADATA (metadata),
+ new_g2metadata,
+ (gchar *) list->data);
+ }
+ else
+ g_debug ("Ignored tag: %s", (gchar *) list->data);
+ }
+
+ g_list_free (xmp_list);
+ g_strfreev (xmp_data);
+ }
+
+ if ((flags & GIMP_METADATA_SAVE_IPTC) && support_iptc)
+ {
+ gchar **iptc_data = gexiv2_metadata_get_iptc_tags (GEXIV2_METADATA (metadata));
+
+ for (i = 0; iptc_data[i] != NULL; i++)
+ {
+ if (! gexiv2_metadata_has_tag (new_g2metadata, iptc_data[i]) &&
+ gimp_metadata_is_tag_supported (iptc_data[i], mime_type))
+ {
+ gimp_image_metadata_copy_tag (GEXIV2_METADATA (metadata),
+ new_g2metadata,
+ iptc_data[i]);
+ }
+ }
+
+ g_strfreev (iptc_data);
+ }
+
+ if (flags & GIMP_METADATA_SAVE_THUMBNAIL && support_exif)
+ {
+ GdkPixbuf *thumb_pixbuf;
+ gchar *thumb_buffer;
+ gint image_width;
+ gint image_height;
+ gsize count;
+ gint thumbw;
+ gint thumbh;
+
+#define EXIF_THUMBNAIL_SIZE 256
+
+ image_width = gimp_image_width (image_ID);
+ image_height = gimp_image_height (image_ID);
+
+ if (image_width > image_height)
+ {
+ thumbw = EXIF_THUMBNAIL_SIZE;
+ thumbh = EXIF_THUMBNAIL_SIZE * image_height / image_width;
+ }
+ else
+ {
+ thumbh = EXIF_THUMBNAIL_SIZE;
+ thumbw = EXIF_THUMBNAIL_SIZE * image_width / image_height;
+ }
+
+ thumb_pixbuf = gimp_image_get_thumbnail (image_ID, thumbw, thumbh,
+ GIMP_PIXBUF_KEEP_ALPHA);
+
+ if (gdk_pixbuf_save_to_buffer (thumb_pixbuf, &thumb_buffer, &count,
+ "jpeg", NULL,
+ "quality", "75",
+ NULL))
+ {
+ gchar buffer[32];
+
+ gexiv2_metadata_set_exif_thumbnail_from_buffer (new_g2metadata,
+ (guchar *) thumb_buffer,
+ count);
+
+ g_snprintf (buffer, sizeof (buffer), "%d", thumbw);
+ gexiv2_metadata_set_tag_string (new_g2metadata,
+ "Exif.Thumbnail.ImageWidth",
+ buffer);
+
+ g_snprintf (buffer, sizeof (buffer), "%d", thumbh);
+ gexiv2_metadata_set_tag_string (new_g2metadata,
+ "Exif.Thumbnail.ImageLength",
+ buffer);
+
+ gexiv2_metadata_set_tag_string (new_g2metadata,
+ "Exif.Thumbnail.BitsPerSample",
+ "8 8 8");
+ gexiv2_metadata_set_tag_string (new_g2metadata,
+ "Exif.Thumbnail.SamplesPerPixel",
+ "3");
+ gexiv2_metadata_set_tag_string (new_g2metadata,
+ "Exif.Thumbnail.PhotometricInterpretation",
+ "6"); /* old jpeg */
+ gexiv2_metadata_set_tag_string (new_g2metadata,
+ "Exif.Thumbnail.NewSubfileType",
+ "1"); /* reduced resolution image */
+
+ g_free (thumb_buffer);
+ }
+
+ g_object_unref (thumb_pixbuf);
+ }
+ else
+ {
+ /* Remove Thumbnail */
+ gexiv2_metadata_erase_exif_thumbnail (new_g2metadata);
+ }
+
+ if (flags & GIMP_METADATA_SAVE_COLOR_PROFILE)
+ {
+ /* nothing to do, but if we ever need to modify metadata based
+ * on the exported color profile, this is probably the place to
+ * add it
+ */
+ }
+
+ success = gimp_metadata_save_to_file (new_metadata, file, error);
+
+ g_object_unref (new_metadata);
+
+ return success;
+}
+
+gint32
+gimp_image_metadata_load_thumbnail (GFile *file,
+ GError **error)
+{
+ GimpMetadata *metadata;
+ GInputStream *input_stream;
+ GdkPixbuf *pixbuf;
+ guint8 *thumbnail_buffer;
+ gint thumbnail_size;
+ gint32 image_ID = -1;
+
+ g_return_val_if_fail (G_IS_FILE (file), -1);
+ g_return_val_if_fail (error == NULL || *error == NULL, -1);
+
+ metadata = gimp_metadata_load_from_file (file, error);
+ if (! metadata)
+ return -1;
+
+ if (! gexiv2_metadata_get_exif_thumbnail (GEXIV2_METADATA (metadata),
+ &thumbnail_buffer,
+ &thumbnail_size))
+ {
+ g_object_unref (metadata);
+ return -1;
+ }
+
+ input_stream = g_memory_input_stream_new_from_data (thumbnail_buffer,
+ thumbnail_size,
+ (GDestroyNotify) g_free);
+ pixbuf = gdk_pixbuf_new_from_stream (input_stream, NULL, error);
+ g_object_unref (input_stream);
+
+ if (pixbuf)
+ {
+ gint32 layer_ID;
+
+ image_ID = gimp_image_new (gdk_pixbuf_get_width (pixbuf),
+ gdk_pixbuf_get_height (pixbuf),
+ GIMP_RGB);
+ gimp_image_undo_disable (image_ID);
+
+ layer_ID = gimp_layer_new_from_pixbuf (image_ID, _("Background"),
+ pixbuf,
+ 100.0,
+ gimp_image_get_default_new_layer_mode (image_ID),
+ 0.0, 0.0);
+ g_object_unref (pixbuf);
+
+ gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
+
+ gimp_image_metadata_rotate (image_ID,
+ gexiv2_metadata_get_orientation (GEXIV2_METADATA (metadata)));
+ }
+
+ g_object_unref (metadata);
+
+ return image_ID;
+}
+
+
+/* private functions */
+
+static void
+gimp_image_metadata_rotate (gint32 image_ID,
+ GExiv2Orientation orientation)
+{
+ switch (orientation)
+ {
+ case GEXIV2_ORIENTATION_UNSPECIFIED:
+ case GEXIV2_ORIENTATION_NORMAL: /* standard orientation, do nothing */
+ break;
+
+ case GEXIV2_ORIENTATION_HFLIP:
+ gimp_image_flip (image_ID, GIMP_ORIENTATION_HORIZONTAL);
+ break;
+
+ case GEXIV2_ORIENTATION_ROT_180:
+ gimp_image_rotate (image_ID, GIMP_ROTATE_180);
+ break;
+
+ case GEXIV2_ORIENTATION_VFLIP:
+ gimp_image_flip (image_ID, GIMP_ORIENTATION_VERTICAL);
+ break;
+
+ case GEXIV2_ORIENTATION_ROT_90_HFLIP: /* flipped diagonally around '\' */
+ gimp_image_rotate (image_ID, GIMP_ROTATE_90);
+ gimp_image_flip (image_ID, GIMP_ORIENTATION_HORIZONTAL);
+ break;
+
+ case GEXIV2_ORIENTATION_ROT_90: /* 90 CW */
+ gimp_image_rotate (image_ID, GIMP_ROTATE_90);
+ break;
+
+ case GEXIV2_ORIENTATION_ROT_90_VFLIP: /* flipped diagonally around '/' */
+ gimp_image_rotate (image_ID, GIMP_ROTATE_90);
+ gimp_image_flip (image_ID, GIMP_ORIENTATION_VERTICAL);
+ break;
+
+ case GEXIV2_ORIENTATION_ROT_270: /* 90 CCW */
+ gimp_image_rotate (image_ID, GIMP_ROTATE_270);
+ break;
+
+ default: /* shouldn't happen */
+ break;
+ }
+}
+
+static GdkPixbuf *
+gimp_image_metadata_rotate_pixbuf (GdkPixbuf *pixbuf,
+ GExiv2Orientation orientation)
+{
+ GdkPixbuf *rotated = NULL;
+ GdkPixbuf *temp;
+
+ switch (orientation)
+ {
+ case GEXIV2_ORIENTATION_UNSPECIFIED:
+ case GEXIV2_ORIENTATION_NORMAL: /* standard orientation, do nothing */
+ rotated = g_object_ref (pixbuf);
+ break;
+
+ case GEXIV2_ORIENTATION_HFLIP:
+ rotated = gdk_pixbuf_flip (pixbuf, TRUE);
+ break;
+
+ case GEXIV2_ORIENTATION_ROT_180:
+ rotated = gdk_pixbuf_rotate_simple (pixbuf, GDK_PIXBUF_ROTATE_UPSIDEDOWN);
+ break;
+
+ case GEXIV2_ORIENTATION_VFLIP:
+ rotated = gdk_pixbuf_flip (pixbuf, FALSE);
+ break;
+
+ case GEXIV2_ORIENTATION_ROT_90_HFLIP: /* flipped diagonally around '\' */
+ temp = gdk_pixbuf_rotate_simple (pixbuf, GDK_PIXBUF_ROTATE_CLOCKWISE);
+ rotated = gdk_pixbuf_flip (temp, TRUE);
+ g_object_unref (temp);
+ break;
+
+ case GEXIV2_ORIENTATION_ROT_90: /* 90 CW */
+ rotated = gdk_pixbuf_rotate_simple (pixbuf, GDK_PIXBUF_ROTATE_CLOCKWISE);
+ break;
+
+ case GEXIV2_ORIENTATION_ROT_90_VFLIP: /* flipped diagonally around '/' */
+ temp = gdk_pixbuf_rotate_simple (pixbuf, GDK_PIXBUF_ROTATE_CLOCKWISE);
+ rotated = gdk_pixbuf_flip (temp, FALSE);
+ g_object_unref (temp);
+ break;
+
+ case GEXIV2_ORIENTATION_ROT_270: /* 90 CCW */
+ rotated = gdk_pixbuf_rotate_simple (pixbuf, GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE);
+ break;
+
+ default: /* shouldn't happen */
+ break;
+ }
+
+ return rotated;
+}
+
+static void
+gimp_image_metadata_rotate_query (gint32 image_ID,
+ const gchar *mime_type,
+ GimpMetadata *metadata,
+ gboolean interactive)
+{
+ GimpParasite *parasite;
+ gchar *parasite_name;
+ GExiv2Orientation orientation;
+ gboolean query = interactive;
+
+ orientation = gexiv2_metadata_get_orientation (GEXIV2_METADATA (metadata));
+
+ if (orientation <= GEXIV2_ORIENTATION_NORMAL ||
+ orientation > GEXIV2_ORIENTATION_MAX)
+ return;
+
+ parasite_name = g_strdup_printf ("gimp-metadata-exif-rotate(%s)", mime_type);
+
+ parasite = gimp_get_parasite (parasite_name);
+
+ if (parasite)
+ {
+ if (strncmp (gimp_parasite_data (parasite), "yes",
+ gimp_parasite_data_size (parasite)) == 0)
+ {
+ query = FALSE;
+ }
+ else if (strncmp (gimp_parasite_data (parasite), "no",
+ gimp_parasite_data_size (parasite)) == 0)
+ {
+ gimp_parasite_free (parasite);
+ g_free (parasite_name);
+ return;
+ }
+
+ gimp_parasite_free (parasite);
+ }
+
+ if (query && ! gimp_image_metadata_rotate_dialog (image_ID,
+ orientation,
+ parasite_name))
+ {
+ g_free (parasite_name);
+ return;
+ }
+
+ g_free (parasite_name);
+
+ gimp_image_metadata_rotate (image_ID, orientation);
+ gexiv2_metadata_set_orientation (GEXIV2_METADATA (metadata),
+ GEXIV2_ORIENTATION_NORMAL);
+}
+
+static gboolean
+gimp_image_metadata_rotate_dialog (gint32 image_ID,
+ GExiv2Orientation orientation,
+ const gchar *parasite_name)
+{
+ GtkWidget *dialog;
+ GtkWidget *main_vbox;
+ GtkWidget *vbox;
+ GtkWidget *label;
+ GtkWidget *toggle;
+ GdkPixbuf *pixbuf;
+ gchar *name;
+ gchar *title;
+ gint response;
+
+ name = gimp_image_get_name (image_ID);
+ title = g_strdup_printf (_("Rotate %s?"), name);
+ g_free (name);
+
+ dialog = gimp_dialog_new (title, "gimp-metadata-rotate-dialog",
+ NULL, 0, NULL, NULL,
+
+ _("_Keep Original"), GTK_RESPONSE_CANCEL,
+ _("_Rotate"), GTK_RESPONSE_OK,
+
+ NULL);
+
+ g_free (title);
+
+ gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+ GTK_RESPONSE_OK,
+ GTK_RESPONSE_CANCEL,
+ -1);
+
+ gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+ gimp_window_set_transient (GTK_WINDOW (dialog));
+
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
+ main_vbox, FALSE, FALSE, 0);
+ gtk_widget_show (main_vbox);
+
+#define THUMBNAIL_SIZE 128
+
+ pixbuf = gimp_image_get_thumbnail (image_ID,
+ THUMBNAIL_SIZE, THUMBNAIL_SIZE,
+ GIMP_PIXBUF_SMALL_CHECKS);
+
+ if (pixbuf)
+ {
+ GdkPixbuf *rotated;
+ GtkWidget *hbox;
+ GtkWidget *image;
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+ gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
+ gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
+ gtk_widget_show (hbox);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+ gtk_widget_show (vbox);
+
+ label = gtk_label_new (_("Original"));
+ gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE);
+ gimp_label_set_attributes (GTK_LABEL (label),
+ PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
+ -1);
+ gtk_box_pack_end (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ image = gtk_image_new_from_pixbuf (pixbuf);
+ gtk_box_pack_end (GTK_BOX (vbox), image, FALSE, FALSE, 0);
+ gtk_widget_show (image);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+ gtk_widget_show (vbox);
+
+ label = gtk_label_new (_("Rotated"));
+ gimp_label_set_attributes (GTK_LABEL (label),
+ PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
+ -1);
+ gtk_box_pack_end (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ rotated = gimp_image_metadata_rotate_pixbuf (pixbuf, orientation);
+ g_object_unref (pixbuf);
+
+ image = gtk_image_new_from_pixbuf (rotated);
+ g_object_unref (rotated);
+
+ gtk_box_pack_end (GTK_BOX (vbox), image, FALSE, FALSE, 0);
+ gtk_widget_show (image);
+ }
+
+ label = g_object_new (GTK_TYPE_LABEL,
+ "label", _("This image contains Exif orientation "
+ "metadata."),
+ "wrap", TRUE,
+ "justify", GTK_JUSTIFY_LEFT,
+ "xalign", 0.0,
+ "yalign", 0.5,
+ NULL);
+ gimp_label_set_attributes (GTK_LABEL (label),
+ PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
+ PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
+ -1);
+ /* eek */
+ gtk_widget_set_size_request (GTK_WIDGET (label),
+ 2 * THUMBNAIL_SIZE + 12, -1);
+ gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ label = g_object_new (GTK_TYPE_LABEL,
+ "label", _("Would you like to rotate the image?"),
+ "wrap", TRUE,
+ "justify", GTK_JUSTIFY_LEFT,
+ "xalign", 0.0,
+ "yalign", 0.5,
+ NULL);
+ /* eek */
+ gtk_widget_set_size_request (GTK_WIDGET (label),
+ 2 * THUMBNAIL_SIZE + 12, -1);
+ gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ toggle = gtk_check_button_new_with_mnemonic (_("_Don't ask me again"));
+ gtk_box_pack_end (GTK_BOX (main_vbox), toggle, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), FALSE);
+ gtk_widget_show (toggle);
+
+ response = gimp_dialog_run (GIMP_DIALOG (dialog));
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)))
+ {
+ GimpParasite *parasite;
+ const gchar *str = (response == GTK_RESPONSE_OK) ? "yes" : "no";
+
+ parasite = gimp_parasite_new (parasite_name,
+ GIMP_PARASITE_PERSISTENT,
+ strlen (str), str);
+ gimp_attach_parasite (parasite);
+ gimp_parasite_free (parasite);
+ }
+
+ gtk_widget_destroy (dialog);
+
+ return (response == GTK_RESPONSE_OK);
+}
diff --git a/libgimp/gimpimagemetadata.h b/libgimp/gimpimagemetadata.h
new file mode 100644
index 0000000..e8de269
--- /dev/null
+++ b/libgimp/gimpimagemetadata.h
@@ -0,0 +1,61 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagemetadata.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_METADATA_H__
+#define __GIMP_IMAGE_METADATA_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+GimpMetadata * gimp_image_metadata_load_prepare (gint32 image_ID,
+ const gchar *mime_type,
+ GFile *file,
+ GError **error);
+void gimp_image_metadata_load_finish (gint32 image_ID,
+ const gchar *mime_type,
+ GimpMetadata *metadata,
+ GimpMetadataLoadFlags flags,
+ gboolean interactive);
+
+GimpMetadata * gimp_image_metadata_save_prepare (gint32 image_ID,
+ const gchar *mime_type,
+ GimpMetadataSaveFlags *suggested_flags);
+gboolean gimp_image_metadata_save_finish (gint32 image_ID,
+ const gchar *mime_type,
+ GimpMetadata *metadata,
+ GimpMetadataSaveFlags flags,
+ GFile *file,
+ GError **error);
+
+
+/* this is experimental API, to be finished for 2.10 */
+
+gint32 gimp_image_metadata_load_thumbnail (GFile *file,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_METADATA_H__ */
diff --git a/libgimp/gimpimagesamplepoints_pdb.c b/libgimp/gimpimagesamplepoints_pdb.c
new file mode 100644
index 0000000..5a8135b
--- /dev/null
+++ b/libgimp/gimpimagesamplepoints_pdb.c
@@ -0,0 +1,192 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagesamplepoints_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpimagesamplepoints
+ * @title: gimpimagesamplepoints
+ * @short_description: Functions for manipulating an image's sample points.
+ *
+ * Functions for manipulating an image's sample points.
+ **/
+
+
+/**
+ * gimp_image_add_sample_point:
+ * @image_ID: The image.
+ * @position_x: The guide'sample points x-offset from left of image.
+ * @position_y: The guide'sample points y-offset from top of image.
+ *
+ * Add a sample point to an image.
+ *
+ * This procedure adds a sample point to an image. It takes the input
+ * image and the position of the new sample points as parameters. It
+ * returns the sample point ID of the new sample point.
+ *
+ * Returns: The new sample point.
+ *
+ * Since: 2.10
+ **/
+gint32
+gimp_image_add_sample_point (gint32 image_ID,
+ gint position_x,
+ gint position_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 sample_point_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-add-sample-point",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, position_x,
+ GIMP_PDB_INT32, position_y,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ sample_point_ID = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return sample_point_ID;
+}
+
+/**
+ * gimp_image_delete_sample_point:
+ * @image_ID: The image.
+ * @sample_point_ID: The ID of the sample point to be removed.
+ *
+ * Deletes a sample point from an image.
+ *
+ * This procedure takes an image and a sample point ID as input and
+ * removes the specified sample point from the specified image.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_image_delete_sample_point (gint32 image_ID,
+ gint32 sample_point_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-delete-sample-point",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, sample_point_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_find_next_sample_point:
+ * @image_ID: The image.
+ * @sample_point_ID: The ID of the current sample point (0 if first invocation).
+ *
+ * Find next sample point on an image.
+ *
+ * This procedure takes an image and a sample point ID as input and
+ * finds the sample point ID of the successor of the given sample point
+ * ID in the image's sample point list. If the supplied sample point ID
+ * is 0, the procedure will return the first sample point. The
+ * procedure will return 0 if given the final sample point ID as an
+ * argument or the image has no sample points.
+ *
+ * Returns: The next sample point's ID.
+ *
+ * Since: 2.10
+ **/
+gint32
+gimp_image_find_next_sample_point (gint32 image_ID,
+ gint32 sample_point_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 next_sample_point_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-image-find-next-sample-point",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, sample_point_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ next_sample_point_ID = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return next_sample_point_ID;
+}
+
+/**
+ * gimp_image_get_sample_point_position:
+ * @image_ID: The image.
+ * @sample_point_ID: The guide.
+ * @position_y: The sample points's position relative to top of image.
+ *
+ * Get position of a sample point on an image.
+ *
+ * This procedure takes an image and a sample point ID as input and
+ * returns the position of the sample point relative to the top and
+ * left of the image.
+ *
+ * Returns: The sample points's position relative to top of image.
+ *
+ * Since: 2.10
+ **/
+gint
+gimp_image_get_sample_point_position (gint32 image_ID,
+ gint32 sample_point_ID,
+ gint *position_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint position_x = G_MININT;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-sample-point-position",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, sample_point_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ position_x = return_vals[1].data.d_int32;
+ *position_y = return_vals[2].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return position_x;
+}
diff --git a/libgimp/gimpimagesamplepoints_pdb.h b/libgimp/gimpimagesamplepoints_pdb.h
new file mode 100644
index 0000000..a1daa69
--- /dev/null
+++ b/libgimp/gimpimagesamplepoints_pdb.h
@@ -0,0 +1,49 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagesamplepoints_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_SAMPLE_POINTS_PDB_H__
+#define __GIMP_IMAGE_SAMPLE_POINTS_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gint32 gimp_image_add_sample_point (gint32 image_ID,
+ gint position_x,
+ gint position_y);
+gboolean gimp_image_delete_sample_point (gint32 image_ID,
+ gint32 sample_point_ID);
+gint32 gimp_image_find_next_sample_point (gint32 image_ID,
+ gint32 sample_point_ID);
+gint gimp_image_get_sample_point_position (gint32 image_ID,
+ gint32 sample_point_ID,
+ gint *position_y);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_SAMPLE_POINTS_PDB_H__ */
diff --git a/libgimp/gimpimageselect_pdb.c b/libgimp/gimpimageselect_pdb.c
new file mode 100644
index 0000000..cc3d431
--- /dev/null
+++ b/libgimp/gimpimageselect_pdb.c
@@ -0,0 +1,417 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimageselect_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpimageselect
+ * @title: gimpimageselect
+ * @short_description: Modify the image's selection.
+ *
+ * Functions to modify the image's selection.
+ **/
+
+
+/**
+ * gimp_image_select_color:
+ * @image_ID: The affected image.
+ * @operation: The selection operation.
+ * @drawable_ID: The affected drawable.
+ * @color: The color to select.
+ *
+ * Create a selection by selecting all pixels (in the specified
+ * drawable) with the same (or similar) color to that specified.
+ *
+ * This tool creates a selection over the specified image. A by-color
+ * selection is determined by the supplied color under the constraints
+ * of the current context settings. Essentially, all pixels (in the
+ * drawable) that have color sufficiently close to the specified color
+ * (as determined by the threshold and criterion context values) are
+ * included in the selection. To select transparent regions, the color
+ * specified must also have minimum alpha.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_antialias(), gimp_context_set_feather(),
+ * gimp_context_set_feather_radius(), gimp_context_set_sample_merged(),
+ * gimp_context_set_sample_criterion(),
+ * gimp_context_set_sample_threshold(),
+ * gimp_context_set_sample_transparent().
+ *
+ * In the case of a merged sampling, the supplied drawable is ignored.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_select_color (gint32 image_ID,
+ GimpChannelOps operation,
+ gint32 drawable_ID,
+ const GimpRGB *color)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-select-color",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_COLOR, color,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_select_contiguous_color:
+ * @image_ID: The affected image.
+ * @operation: The selection operation.
+ * @drawable_ID: The affected drawable.
+ * @x: x coordinate of initial seed fill point: (image coordinates).
+ * @y: y coordinate of initial seed fill point: (image coordinates).
+ *
+ * Create a selection by selecting all pixels around specified
+ * coordinates with the same (or similar) color to that at the
+ * coordinates.
+ *
+ * This tool creates a contiguous selection over the specified image. A
+ * contiguous color selection is determined by a seed fill under the
+ * constraints of the current context settings. Essentially, the color
+ * at the specified coordinates (in the drawable) is measured and the
+ * selection expands outwards from that point to any adjacent pixels
+ * which are not significantly different (as determined by the
+ * threshold and criterion context settings). This process continues
+ * until no more expansion is possible. If antialiasing is turned on,
+ * the final selection mask will contain intermediate values based on
+ * close misses to the threshold bar at pixels along the seed fill
+ * boundary.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_antialias(), gimp_context_set_feather(),
+ * gimp_context_set_feather_radius(), gimp_context_set_sample_merged(),
+ * gimp_context_set_sample_criterion(),
+ * gimp_context_set_sample_threshold(),
+ * gimp_context_set_sample_transparent(),
+ * gimp_context_set_diagonal_neighbors().
+ *
+ * In the case of a merged sampling, the supplied drawable is ignored.
+ * If the sample is merged, the specified coordinates are relative to
+ * the image origin; otherwise, they are relative to the drawable's
+ * origin.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_select_contiguous_color (gint32 image_ID,
+ GimpChannelOps operation,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-select-contiguous-color",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_select_rectangle:
+ * @image_ID: The image.
+ * @operation: The selection operation.
+ * @x: x coordinate of upper-left corner of rectangle.
+ * @y: y coordinate of upper-left corner of rectangle.
+ * @width: The width of the rectangle.
+ * @height: The height of the rectangle.
+ *
+ * Create a rectangular selection over the specified image;
+ *
+ * This tool creates a rectangular selection over the specified image.
+ * The rectangular region can be either added to, subtracted from, or
+ * replace the contents of the previous selection mask.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_feather(), gimp_context_set_feather_radius().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_select_rectangle (gint32 image_ID,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-select-rectangle",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_FLOAT, width,
+ GIMP_PDB_FLOAT, height,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_select_round_rectangle:
+ * @image_ID: The image.
+ * @operation: The selection operation.
+ * @x: x coordinate of upper-left corner of rectangle.
+ * @y: y coordinate of upper-left corner of rectangle.
+ * @width: The width of the rectangle.
+ * @height: The height of the rectangle.
+ * @corner_radius_x: The corner radius in X direction.
+ * @corner_radius_y: The corner radius in Y direction.
+ *
+ * Create a rectangular selection with round corners over the specified
+ * image;
+ *
+ * This tool creates a rectangular selection with round corners over
+ * the specified image. The rectangular region can be either added to,
+ * subtracted from, or replace the contents of the previous selection
+ * mask.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_antialias(), gimp_context_set_feather(),
+ * gimp_context_set_feather_radius().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_select_round_rectangle (gint32 image_ID,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ gdouble corner_radius_x,
+ gdouble corner_radius_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-select-round-rectangle",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_FLOAT, width,
+ GIMP_PDB_FLOAT, height,
+ GIMP_PDB_FLOAT, corner_radius_x,
+ GIMP_PDB_FLOAT, corner_radius_y,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_select_ellipse:
+ * @image_ID: The image.
+ * @operation: The selection operation.
+ * @x: x coordinate of upper-left corner of ellipse bounding box.
+ * @y: y coordinate of upper-left corner of ellipse bounding box.
+ * @width: The width of the ellipse.
+ * @height: The height of the ellipse.
+ *
+ * Create an elliptical selection over the specified image.
+ *
+ * This tool creates an elliptical selection over the specified image.
+ * The elliptical region can be either added to, subtracted from, or
+ * replace the contents of the previous selection mask.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_antialias(), gimp_context_set_feather(),
+ * gimp_context_set_feather_radius().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_select_ellipse (gint32 image_ID,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-select-ellipse",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_FLOAT, width,
+ GIMP_PDB_FLOAT, height,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_select_polygon:
+ * @image_ID: The image.
+ * @operation: The selection operation.
+ * @num_segs: Number of points (count 1 coordinate as two points).
+ * @segs: Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}.
+ *
+ * Create a polygonal selection over the specified image.
+ *
+ * This tool creates a polygonal selection over the specified image.
+ * The polygonal region can be either added to, subtracted from, or
+ * replace the contents of the previous selection mask. The polygon is
+ * specified through an array of floating point numbers and its length.
+ * The length of array must be 2n, where n is the number of points.
+ * Each point is defined by 2 floating point values which correspond to
+ * the x and y coordinates. If the final point does not connect to the
+ * starting point, a connecting segment is automatically added.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_antialias(), gimp_context_set_feather(),
+ * gimp_context_set_feather_radius().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_select_polygon (gint32 image_ID,
+ GimpChannelOps operation,
+ gint num_segs,
+ const gdouble *segs)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-select-polygon",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_INT32, num_segs,
+ GIMP_PDB_FLOATARRAY, segs,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_select_item:
+ * @image_ID: The image.
+ * @operation: The desired operation with current selection.
+ * @item_ID: The item to render to the selection.
+ *
+ * Transforms the specified item into a selection
+ *
+ * This procedure renders the item's outline into the current selection
+ * of the image the item belongs to. What exactly the item's outline is
+ * depends on the item type: for layers, it's the layer's alpha
+ * channel, for vectors the vector's shape.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_antialias(), gimp_context_set_feather(),
+ * gimp_context_set_feather_radius().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_image_select_item (gint32 image_ID,
+ GimpChannelOps operation,
+ gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-select-item",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpimageselect_pdb.h b/libgimp/gimpimageselect_pdb.h
new file mode 100644
index 0000000..a7e5db8
--- /dev/null
+++ b/libgimp/gimpimageselect_pdb.h
@@ -0,0 +1,75 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimageselect_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_SELECT_PDB_H__
+#define __GIMP_IMAGE_SELECT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_image_select_color (gint32 image_ID,
+ GimpChannelOps operation,
+ gint32 drawable_ID,
+ const GimpRGB *color);
+gboolean gimp_image_select_contiguous_color (gint32 image_ID,
+ GimpChannelOps operation,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y);
+gboolean gimp_image_select_rectangle (gint32 image_ID,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height);
+gboolean gimp_image_select_round_rectangle (gint32 image_ID,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ gdouble corner_radius_x,
+ gdouble corner_radius_y);
+gboolean gimp_image_select_ellipse (gint32 image_ID,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height);
+gboolean gimp_image_select_polygon (gint32 image_ID,
+ GimpChannelOps operation,
+ gint num_segs,
+ const gdouble *segs);
+gboolean gimp_image_select_item (gint32 image_ID,
+ GimpChannelOps operation,
+ gint32 item_ID);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_SELECT_PDB_H__ */
diff --git a/libgimp/gimpimagetransform_pdb.c b/libgimp/gimpimagetransform_pdb.c
new file mode 100644
index 0000000..1be6a83
--- /dev/null
+++ b/libgimp/gimpimagetransform_pdb.c
@@ -0,0 +1,303 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagetransform_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpimagetransform
+ * @title: gimpimagetransform
+ * @short_description: Transformations on images.
+ *
+ * Operations to scale, resize, crop, flip and rotate images.
+ **/
+
+
+/**
+ * gimp_image_resize:
+ * @image_ID: The image.
+ * @new_width: New image width.
+ * @new_height: New image height.
+ * @offx: x offset between upper left corner of old and new images: (new - old).
+ * @offy: y offset between upper left corner of old and new images: (new - old).
+ *
+ * Resize the image to the specified extents.
+ *
+ * This procedure resizes the image so that it's new width and height
+ * are equal to the supplied parameters. Offsets are also provided
+ * which describe the position of the previous image's content. All
+ * channels within the image are resized according to the specified
+ * parameters; this includes the image selection mask. All layers
+ * within the image are repositioned according to the specified
+ * offsets.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_resize (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-resize",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, new_width,
+ GIMP_PDB_INT32, new_height,
+ GIMP_PDB_INT32, offx,
+ GIMP_PDB_INT32, offy,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_resize_to_layers:
+ * @image_ID: The image.
+ *
+ * Resize the image to fit all layers.
+ *
+ * This procedure resizes the image to the bounding box of all layers
+ * of the image. All channels within the image are resized to the new
+ * size; this includes the image selection mask. All layers within the
+ * image are repositioned to the new image area.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_image_resize_to_layers (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-resize-to-layers",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_scale:
+ * @image_ID: The image.
+ * @new_width: New image width.
+ * @new_height: New image height.
+ *
+ * Scale the image using the default interpolation method.
+ *
+ * This procedure scales the image so that its new width and height are
+ * equal to the supplied parameters. All layers and channels within the
+ * image are scaled according to the specified parameters; this
+ * includes the image selection mask. The interpolation method used can
+ * be set with gimp_context_set_interpolation().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_scale (gint32 image_ID,
+ gint new_width,
+ gint new_height)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-scale",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, new_width,
+ GIMP_PDB_INT32, new_height,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_scale_full:
+ * @image_ID: The image.
+ * @new_width: New image width.
+ * @new_height: New image height.
+ * @interpolation: Type of interpolation.
+ *
+ * Deprecated: Use gimp_image_scale() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_image_scale_full (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ GimpInterpolationType interpolation)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-scale-full",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, new_width,
+ GIMP_PDB_INT32, new_height,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_crop:
+ * @image_ID: The image.
+ * @new_width: New image width: (0 < new_width <= width).
+ * @new_height: New image height: (0 < new_height <= height).
+ * @offx: X offset: (0 <= offx <= (width - new_width)).
+ * @offy: Y offset: (0 <= offy <= (height - new_height)).
+ *
+ * Crop the image to the specified extents.
+ *
+ * This procedure crops the image so that it's new width and height are
+ * equal to the supplied parameters. Offsets are also provided which
+ * describe the position of the previous image's content. All channels
+ * and layers within the image are cropped to the new image extents;
+ * this includes the image selection mask. If any parameters are out of
+ * range, an error is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_crop (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-crop",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, new_width,
+ GIMP_PDB_INT32, new_height,
+ GIMP_PDB_INT32, offx,
+ GIMP_PDB_INT32, offy,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_flip:
+ * @image_ID: The image.
+ * @flip_type: Type of flip.
+ *
+ * Flips the image horizontally or vertically.
+ *
+ * This procedure flips (mirrors) the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_flip (gint32 image_ID,
+ GimpOrientationType flip_type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-flip",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, flip_type,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_rotate:
+ * @image_ID: The image.
+ * @rotate_type: Angle of rotation.
+ *
+ * Rotates the image by the specified degrees.
+ *
+ * This procedure rotates the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_rotate (gint32 image_ID,
+ GimpRotationType rotate_type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-rotate",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, rotate_type,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpimagetransform_pdb.h b/libgimp/gimpimagetransform_pdb.h
new file mode 100644
index 0000000..02ec951
--- /dev/null
+++ b/libgimp/gimpimagetransform_pdb.h
@@ -0,0 +1,62 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagetransform_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_TRANSFORM_PDB_H__
+#define __GIMP_IMAGE_TRANSFORM_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_image_resize (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy);
+gboolean gimp_image_resize_to_layers (gint32 image_ID);
+gboolean gimp_image_scale (gint32 image_ID,
+ gint new_width,
+ gint new_height);
+GIMP_DEPRECATED_FOR(gimp_image_scale)
+gboolean gimp_image_scale_full (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ GimpInterpolationType interpolation);
+gboolean gimp_image_crop (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy);
+gboolean gimp_image_flip (gint32 image_ID,
+ GimpOrientationType flip_type);
+gboolean gimp_image_rotate (gint32 image_ID,
+ GimpRotationType rotate_type);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_TRANSFORM_PDB_H__ */
diff --git a/libgimp/gimpimageundo_pdb.c b/libgimp/gimpimageundo_pdb.c
new file mode 100644
index 0000000..ec76524
--- /dev/null
+++ b/libgimp/gimpimageundo_pdb.c
@@ -0,0 +1,276 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimageundo_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpimageundo
+ * @title: gimpimageundo
+ * @short_description: Control of image undo/redo.
+ *
+ * Control of image undo/redo.
+ **/
+
+
+/**
+ * gimp_image_undo_group_start:
+ * @image_ID: The ID of the image in which to open an undo group.
+ *
+ * Starts a group undo.
+ *
+ * This function is used to start a group undo--necessary for logically
+ * combining two or more undo operations into a single operation. This
+ * call must be used in conjunction with a gimp_image_undo_group_end()
+ * call.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_undo_group_start (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-undo-group-start",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_undo_group_end:
+ * @image_ID: The ID of the image in which to close an undo group.
+ *
+ * Finish a group undo.
+ *
+ * This function must be called once for each
+ * gimp_image_undo_group_start() call that is made.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_undo_group_end (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-undo-group-end",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_undo_is_enabled:
+ * @image_ID: The image.
+ *
+ * Check if the image's undo stack is enabled.
+ *
+ * This procedure checks if the image's undo stack is currently enabled
+ * or disabled. This is useful when several plug-ins or scripts call
+ * each other and want to check if their caller has already used
+ * gimp_image_undo_disable() or gimp_image_undo_freeze().
+ *
+ * Returns: TRUE if undo is enabled for this image.
+ **/
+gboolean
+gimp_image_undo_is_enabled (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean enabled = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-image-undo-is-enabled",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ enabled = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return enabled;
+}
+
+/**
+ * gimp_image_undo_disable:
+ * @image_ID: The image.
+ *
+ * Disable the image's undo stack.
+ *
+ * This procedure disables the image's undo stack, allowing subsequent
+ * operations to ignore their undo steps. This is generally called in
+ * conjunction with gimp_image_undo_enable() to temporarily disable an
+ * image undo stack. This is advantageous because saving undo steps can
+ * be time and memory intensive.
+ *
+ * Returns: TRUE if the image undo has been disabled.
+ **/
+gboolean
+gimp_image_undo_disable (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean disabled = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-image-undo-disable",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ disabled = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return disabled;
+}
+
+/**
+ * gimp_image_undo_enable:
+ * @image_ID: The image.
+ *
+ * Enable the image's undo stack.
+ *
+ * This procedure enables the image's undo stack, allowing subsequent
+ * operations to store their undo steps. This is generally called in
+ * conjunction with gimp_image_undo_disable() to temporarily disable an
+ * image undo stack.
+ *
+ * Returns: TRUE if the image undo has been enabled.
+ **/
+gboolean
+gimp_image_undo_enable (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean enabled = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-image-undo-enable",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ enabled = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return enabled;
+}
+
+/**
+ * gimp_image_undo_freeze:
+ * @image_ID: The image.
+ *
+ * Freeze the image's undo stack.
+ *
+ * This procedure freezes the image's undo stack, allowing subsequent
+ * operations to ignore their undo steps. This is generally called in
+ * conjunction with gimp_image_undo_thaw() to temporarily disable an
+ * image undo stack. This is advantageous because saving undo steps can
+ * be time and memory intensive. gimp_image_undo_freeze() /
+ * gimp_image_undo_thaw() and gimp_image_undo_disable() /
+ * gimp_image_undo_enable() differ in that the former does not free up
+ * all undo steps when undo is thawed, so is more suited to interactive
+ * in-situ previews. It is important in this case that the image is
+ * back to the same state it was frozen in before thawing, else 'undo'
+ * behaviour is undefined.
+ *
+ * Returns: TRUE if the image undo has been frozen.
+ **/
+gboolean
+gimp_image_undo_freeze (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean frozen = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-image-undo-freeze",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ frozen = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return frozen;
+}
+
+/**
+ * gimp_image_undo_thaw:
+ * @image_ID: The image.
+ *
+ * Thaw the image's undo stack.
+ *
+ * This procedure thaws the image's undo stack, allowing subsequent
+ * operations to store their undo steps. This is generally called in
+ * conjunction with gimp_image_undo_freeze() to temporarily freeze an
+ * image undo stack. gimp_image_undo_thaw() does NOT free the undo
+ * stack as gimp_image_undo_enable() does, so is suited for situations
+ * where one wishes to leave the undo stack in the same state in which
+ * one found it despite non-destructively playing with the image in the
+ * meantime. An example would be in-situ plug-in previews. Balancing
+ * freezes and thaws and ensuring image consistency is the
+ * responsibility of the caller.
+ *
+ * Returns: TRUE if the image undo has been thawed.
+ **/
+gboolean
+gimp_image_undo_thaw (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean thawed = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-image-undo-thaw",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ thawed = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return thawed;
+}
diff --git a/libgimp/gimpimageundo_pdb.h b/libgimp/gimpimageundo_pdb.h
new file mode 100644
index 0000000..fc2bf5e
--- /dev/null
+++ b/libgimp/gimpimageundo_pdb.h
@@ -0,0 +1,46 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimageundo_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_UNDO_PDB_H__
+#define __GIMP_IMAGE_UNDO_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_image_undo_group_start (gint32 image_ID);
+gboolean gimp_image_undo_group_end (gint32 image_ID);
+gboolean gimp_image_undo_is_enabled (gint32 image_ID);
+gboolean gimp_image_undo_disable (gint32 image_ID);
+gboolean gimp_image_undo_enable (gint32 image_ID);
+gboolean gimp_image_undo_freeze (gint32 image_ID);
+gboolean gimp_image_undo_thaw (gint32 image_ID);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_UNDO_PDB_H__ */
diff --git a/libgimp/gimpitem_pdb.c b/libgimp/gimpitem_pdb.c
new file mode 100644
index 0000000..b5ab9e2
--- /dev/null
+++ b/libgimp/gimpitem_pdb.c
@@ -0,0 +1,1152 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpitem_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpitem
+ * @title: gimpitem
+ * @short_description: Functions to manipulate items.
+ *
+ * Functions to manipulate items.
+ **/
+
+
+/**
+ * gimp_item_is_valid:
+ * @item_ID: The item to check.
+ *
+ * Returns TRUE if the item is valid.
+ *
+ * This procedure checks if the given item ID is valid and refers to an
+ * existing item.
+ *
+ * Returns: Whether the item ID is valid.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_is_valid (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean valid = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-is-valid",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ valid = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return valid;
+}
+
+/**
+ * gimp_item_get_image:
+ * @item_ID: The item.
+ *
+ * Returns the item's image.
+ *
+ * This procedure returns the item's image.
+ *
+ * Returns: The item's image.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_item_get_image (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 image_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-item-get-image",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ image_ID = return_vals[1].data.d_image;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return image_ID;
+}
+
+/**
+ * gimp_item_delete:
+ * @item_ID: The item to delete.
+ *
+ * Delete a item.
+ *
+ * This procedure deletes the specified item. This must not be done if
+ * the image containing this item was already deleted or if the item
+ * was already removed from the image. The only case in which this
+ * procedure is useful is if you want to get rid of a item which has
+ * not yet been added to an image.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_delete (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-item-delete",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_is_drawable:
+ * @item_ID: The item.
+ *
+ * Returns whether the item is a drawable.
+ *
+ * This procedure returns TRUE if the specified item is a drawable.
+ *
+ * Returns: TRUE if the item is a drawable, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_is_drawable (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean drawable = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-is-drawable",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ drawable = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return drawable;
+}
+
+/**
+ * gimp_item_is_layer:
+ * @item_ID: The item.
+ *
+ * Returns whether the item is a layer.
+ *
+ * This procedure returns TRUE if the specified item is a layer.
+ *
+ * Returns: TRUE if the item is a layer, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_is_layer (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean layer = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-is-layer",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer;
+}
+
+/**
+ * gimp_item_is_text_layer:
+ * @item_ID: The item.
+ *
+ * Returns whether the item is a text layer.
+ *
+ * This procedure returns TRUE if the specified item is a text layer.
+ *
+ * Returns: TRUE if the item is a text layer, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_is_text_layer (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean text_layer = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-is-text-layer",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ text_layer = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return text_layer;
+}
+
+/**
+ * gimp_item_is_channel:
+ * @item_ID: The item.
+ *
+ * Returns whether the item is a channel.
+ *
+ * This procedure returns TRUE if the specified item is a channel.
+ *
+ * Returns: TRUE if the item is a channel, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_is_channel (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean channel = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-is-channel",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ channel = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return channel;
+}
+
+/**
+ * gimp_item_is_layer_mask:
+ * @item_ID: The item.
+ *
+ * Returns whether the item is a layer mask.
+ *
+ * This procedure returns TRUE if the specified item is a layer mask.
+ *
+ * Returns: TRUE if the item is a layer mask, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_is_layer_mask (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean layer_mask = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-is-layer-mask",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_mask = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_mask;
+}
+
+/**
+ * gimp_item_is_selection:
+ * @item_ID: The item.
+ *
+ * Returns whether the item is a selection.
+ *
+ * This procedure returns TRUE if the specified item is a selection.
+ *
+ * Returns: TRUE if the item is a selection, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_is_selection (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean selection = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-is-selection",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ selection = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return selection;
+}
+
+/**
+ * gimp_item_is_vectors:
+ * @item_ID: The item.
+ *
+ * Returns whether the item is a vectors.
+ *
+ * This procedure returns TRUE if the specified item is a vectors.
+ *
+ * Returns: TRUE if the item is a vectors, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_is_vectors (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean vectors = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-is-vectors",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ vectors = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return vectors;
+}
+
+/**
+ * gimp_item_is_group:
+ * @item_ID: The item.
+ *
+ * Returns whether the item is a group item.
+ *
+ * This procedure returns TRUE if the specified item is a group item
+ * which can have children.
+ *
+ * Returns: TRUE if the item is a group, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_is_group (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean group = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-is-group",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ group = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return group;
+}
+
+/**
+ * gimp_item_get_parent:
+ * @item_ID: The item.
+ *
+ * Returns the item's parent item.
+ *
+ * This procedure returns the item's parent item, if any.
+ *
+ * Returns: The item's parent item.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_item_get_parent (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 parent_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-item-get-parent",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ parent_ID = return_vals[1].data.d_item;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return parent_ID;
+}
+
+/**
+ * gimp_item_get_children:
+ * @item_ID: The item.
+ * @num_children: The item's number of children.
+ *
+ * Returns the item's list of children.
+ *
+ * This procedure returns the list of items which are children of the
+ * specified item. The order is topmost to bottommost.
+ *
+ * Returns: The item's list of children.
+ *
+ * Since: 2.8
+ **/
+gint *
+gimp_item_get_children (gint32 item_ID,
+ gint *num_children)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint *child_ids = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-item-get-children",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ *num_children = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_children = return_vals[1].data.d_int32;
+ child_ids = g_new (gint32, *num_children);
+ memcpy (child_ids,
+ return_vals[2].data.d_int32array,
+ *num_children * sizeof (gint32));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return child_ids;
+}
+
+/**
+ * gimp_item_get_expanded:
+ * @item_ID: The item.
+ *
+ * Returns whether the item is expanded.
+ *
+ * This procedure returns TRUE if the specified item is expanded.
+ *
+ * Returns: TRUE if the item is expanded, FALSE otherwise.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_item_get_expanded (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean expanded = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-get-expanded",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ expanded = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return expanded;
+}
+
+/**
+ * gimp_item_set_expanded:
+ * @item_ID: The item.
+ * @expanded: TRUE to expand the item, FALSE to collapse the item.
+ *
+ * Sets the expanded state of the item.
+ *
+ * This procedure expands or collapses the item.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_item_set_expanded (gint32 item_ID,
+ gboolean expanded)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-item-set-expanded",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_INT32, expanded,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_get_name:
+ * @item_ID: The item.
+ *
+ * Get the name of the specified item.
+ *
+ * This procedure returns the specified item's name.
+ *
+ * Returns: The item name.
+ *
+ * Since: 2.8
+ **/
+gchar *
+gimp_item_get_name (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-item-get-name",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_item_set_name:
+ * @item_ID: The item.
+ * @name: The new item name.
+ *
+ * Set the name of the specified item.
+ *
+ * This procedure sets the specified item's name.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_set_name (gint32 item_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-item-set-name",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_get_visible:
+ * @item_ID: The item.
+ *
+ * Get the visibility of the specified item.
+ *
+ * This procedure returns the specified item's visibility.
+ *
+ * Returns: The item visibility.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_get_visible (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean visible = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-get-visible",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ visible = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return visible;
+}
+
+/**
+ * gimp_item_set_visible:
+ * @item_ID: The item.
+ * @visible: The new item visibility.
+ *
+ * Set the visibility of the specified item.
+ *
+ * This procedure sets the specified item's visibility.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_set_visible (gint32 item_ID,
+ gboolean visible)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-item-set-visible",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_INT32, visible,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_get_linked:
+ * @item_ID: The item.
+ *
+ * Get the linked state of the specified item.
+ *
+ * This procedure returns the specified item's linked state.
+ *
+ * Returns: The item linked state (for moves).
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_get_linked (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean linked = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-get-linked",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ linked = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return linked;
+}
+
+/**
+ * gimp_item_set_linked:
+ * @item_ID: The item.
+ * @linked: The new item linked state.
+ *
+ * Set the linked state of the specified item.
+ *
+ * This procedure sets the specified item's linked state.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_set_linked (gint32 item_ID,
+ gboolean linked)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-item-set-linked",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_INT32, linked,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_get_lock_content:
+ * @item_ID: The item.
+ *
+ * Get the 'lock content' state of the specified item.
+ *
+ * This procedure returns the specified item's lock content state.
+ *
+ * Returns: Whether the item's contents are locked.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_get_lock_content (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean lock_content = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-get-lock-content",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ lock_content = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return lock_content;
+}
+
+/**
+ * gimp_item_set_lock_content:
+ * @item_ID: The item.
+ * @lock_content: The new item 'lock content' state.
+ *
+ * Set the 'lock content' state of the specified item.
+ *
+ * This procedure sets the specified item's lock content state.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_set_lock_content (gint32 item_ID,
+ gboolean lock_content)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-item-set-lock-content",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_INT32, lock_content,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_get_lock_position:
+ * @item_ID: The item.
+ *
+ * Get the 'lock position' state of the specified item.
+ *
+ * This procedure returns the specified item's lock position state.
+ *
+ * Returns: Whether the item's position is locked.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_item_get_lock_position (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean lock_position = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-item-get-lock-position",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ lock_position = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return lock_position;
+}
+
+/**
+ * gimp_item_set_lock_position:
+ * @item_ID: The item.
+ * @lock_position: The new item 'lock position' state.
+ *
+ * Set the 'lock position' state of the specified item.
+ *
+ * This procedure sets the specified item's lock position state.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_item_set_lock_position (gint32 item_ID,
+ gboolean lock_position)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-item-set-lock-position",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_INT32, lock_position,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_get_color_tag:
+ * @item_ID: The item.
+ *
+ * Get the color tag of the specified item.
+ *
+ * This procedure returns the specified item's color tag.
+ *
+ * Returns: The item's color tag.
+ *
+ * Since: 2.10
+ **/
+GimpColorTag
+gimp_item_get_color_tag (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpColorTag color_tag = 0;
+
+ return_vals = gimp_run_procedure ("gimp-item-get-color-tag",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ color_tag = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return color_tag;
+}
+
+/**
+ * gimp_item_set_color_tag:
+ * @item_ID: The item.
+ * @color_tag: The new item color tag.
+ *
+ * Set the color tag of the specified item.
+ *
+ * This procedure sets the specified item's color tag.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_item_set_color_tag (gint32 item_ID,
+ GimpColorTag color_tag)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-item-set-color-tag",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_INT32, color_tag,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_get_tattoo:
+ * @item_ID: The item.
+ *
+ * Get the tattoo of the specified item.
+ *
+ * This procedure returns the specified item's tattoo. A tattoo is a
+ * unique and permanent identifier attached to a item that can be used
+ * to uniquely identify a item within an image even between sessions.
+ *
+ * Returns: The item tattoo.
+ *
+ * Since: 2.8
+ **/
+gint
+gimp_item_get_tattoo (gint32 item_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint tattoo = 0;
+
+ return_vals = gimp_run_procedure ("gimp-item-get-tattoo",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ tattoo = return_vals[1].data.d_tattoo;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return tattoo;
+}
+
+/**
+ * gimp_item_set_tattoo:
+ * @item_ID: The item.
+ * @tattoo: The new item tattoo.
+ *
+ * Set the tattoo of the specified item.
+ *
+ * This procedure sets the specified item's tattoo. A tattoo is a
+ * unique and permanent identifier attached to a item that can be used
+ * to uniquely identify a item within an image even between sessions.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_set_tattoo (gint32 item_ID,
+ gint tattoo)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-item-set-tattoo",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_INT32, tattoo,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_attach_parasite:
+ * @item_ID: The item.
+ * @parasite: The parasite to attach to the item.
+ *
+ * Add a parasite to an item.
+ *
+ * This procedure attaches a parasite to an item. It has no return
+ * values.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_attach_parasite (gint32 item_ID,
+ const GimpParasite *parasite)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-item-attach-parasite",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_PARASITE, parasite,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_detach_parasite:
+ * @item_ID: The item.
+ * @name: The name of the parasite to detach from the item.
+ *
+ * Removes a parasite from an item.
+ *
+ * This procedure detaches a parasite from an item. It has no return
+ * values.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_detach_parasite (gint32 item_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-item-detach-parasite",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_get_parasite:
+ * @item_ID: The item.
+ * @name: The name of the parasite to find.
+ *
+ * Look up a parasite in an item
+ *
+ * Finds and returns the parasite that is attached to an item.
+ *
+ * Returns: The found parasite.
+ *
+ * Since: 2.8
+ **/
+GimpParasite *
+gimp_item_get_parasite (gint32 item_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpParasite *parasite = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-item-get-parasite",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ parasite = gimp_parasite_copy (&return_vals[1].data.d_parasite);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return parasite;
+}
+
+/**
+ * gimp_item_get_parasite_list:
+ * @item_ID: The item.
+ * @num_parasites: The number of attached parasites.
+ *
+ * List all parasites.
+ *
+ * Returns a list of all parasites currently attached the an item.
+ *
+ * Returns: The names of currently attached parasites. The returned
+ * value must be freed with g_strfreev().
+ *
+ * Since: 2.8
+ **/
+gchar **
+gimp_item_get_parasite_list (gint32 item_ID,
+ gint *num_parasites)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar **parasites = NULL;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-item-get-parasite-list",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_END);
+
+ *num_parasites = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_parasites = return_vals[1].data.d_int32;
+ if (*num_parasites > 0)
+ {
+ parasites = g_new0 (gchar *, *num_parasites + 1);
+ for (i = 0; i < *num_parasites; i++)
+ parasites[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return parasites;
+}
diff --git a/libgimp/gimpitem_pdb.h b/libgimp/gimpitem_pdb.h
new file mode 100644
index 0000000..f9c2158
--- /dev/null
+++ b/libgimp/gimpitem_pdb.h
@@ -0,0 +1,85 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpitem_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_ITEM_PDB_H__
+#define __GIMP_ITEM_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_item_is_valid (gint32 item_ID);
+gint32 gimp_item_get_image (gint32 item_ID);
+gboolean gimp_item_delete (gint32 item_ID);
+gboolean gimp_item_is_drawable (gint32 item_ID);
+gboolean gimp_item_is_layer (gint32 item_ID);
+gboolean gimp_item_is_text_layer (gint32 item_ID);
+gboolean gimp_item_is_channel (gint32 item_ID);
+gboolean gimp_item_is_layer_mask (gint32 item_ID);
+gboolean gimp_item_is_selection (gint32 item_ID);
+gboolean gimp_item_is_vectors (gint32 item_ID);
+gboolean gimp_item_is_group (gint32 item_ID);
+gint32 gimp_item_get_parent (gint32 item_ID);
+gint* gimp_item_get_children (gint32 item_ID,
+ gint *num_children);
+gboolean gimp_item_get_expanded (gint32 item_ID);
+gboolean gimp_item_set_expanded (gint32 item_ID,
+ gboolean expanded);
+gchar* gimp_item_get_name (gint32 item_ID);
+gboolean gimp_item_set_name (gint32 item_ID,
+ const gchar *name);
+gboolean gimp_item_get_visible (gint32 item_ID);
+gboolean gimp_item_set_visible (gint32 item_ID,
+ gboolean visible);
+gboolean gimp_item_get_linked (gint32 item_ID);
+gboolean gimp_item_set_linked (gint32 item_ID,
+ gboolean linked);
+gboolean gimp_item_get_lock_content (gint32 item_ID);
+gboolean gimp_item_set_lock_content (gint32 item_ID,
+ gboolean lock_content);
+gboolean gimp_item_get_lock_position (gint32 item_ID);
+gboolean gimp_item_set_lock_position (gint32 item_ID,
+ gboolean lock_position);
+GimpColorTag gimp_item_get_color_tag (gint32 item_ID);
+gboolean gimp_item_set_color_tag (gint32 item_ID,
+ GimpColorTag color_tag);
+gint gimp_item_get_tattoo (gint32 item_ID);
+gboolean gimp_item_set_tattoo (gint32 item_ID,
+ gint tattoo);
+gboolean gimp_item_attach_parasite (gint32 item_ID,
+ const GimpParasite *parasite);
+gboolean gimp_item_detach_parasite (gint32 item_ID,
+ const gchar *name);
+GimpParasite* gimp_item_get_parasite (gint32 item_ID,
+ const gchar *name);
+gchar** gimp_item_get_parasite_list (gint32 item_ID,
+ gint *num_parasites);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_ITEM_PDB_H__ */
diff --git a/libgimp/gimpitemcombobox.c b/libgimp/gimpitemcombobox.c
new file mode 100644
index 0000000..07d5007
--- /dev/null
+++ b/libgimp/gimpitemcombobox.c
@@ -0,0 +1,589 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpitemcombobox.c
+ * Copyright (C) 2004 Sven Neumann <sven@gimp.org>
+ * Copyright (C) 2006 Simon Budig <simon@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimpitemcombobox.h"
+#include "gimppixbuf.h"
+
+
+/**
+ * SECTION: gimpitemcombobox
+ * @title: GimpItemComboBox
+ * @short_description: Widgets providing popup menus of items.
+ *
+ * Widgets providing popup menus of items (layers, channels,
+ * drawables, vectors).
+ **/
+
+
+#define THUMBNAIL_SIZE 24
+#define WIDTH_REQUEST 200
+
+
+#define GET_PRIVATE(obj) (g_object_get_data (G_OBJECT (obj), "gimp-item-combo-box-private"))
+
+
+typedef struct _GimpItemComboBoxPrivate GimpItemComboBoxPrivate;
+
+struct _GimpItemComboBoxPrivate
+{
+ GimpItemConstraintFunc constraint;
+ gpointer data;
+};
+
+typedef struct _GimpDrawableComboBoxClass GimpDrawableComboBoxClass;
+typedef struct _GimpChannelComboBoxClass GimpChannelComboBoxClass;
+typedef struct _GimpLayerComboBoxClass GimpLayerComboBoxClass;
+typedef struct _GimpVectorsComboBoxClass GimpVectorsComboBoxClass;
+
+struct _GimpDrawableComboBox
+{
+ GimpIntComboBox parent_instance;
+};
+
+struct _GimpDrawableComboBoxClass
+{
+ GimpIntComboBoxClass parent_class;
+};
+
+struct _GimpChannelComboBox
+{
+ GimpIntComboBox parent_instance;
+};
+
+struct _GimpChannelComboBoxClass
+{
+ GimpIntComboBoxClass parent_class;
+};
+
+struct _GimpLayerComboBox
+{
+ GimpIntComboBox parent_instance;
+};
+
+struct _GimpLayerComboBoxClass
+{
+ GimpIntComboBoxClass parent_class;
+};
+
+struct _GimpVectorsComboBox
+{
+ GimpIntComboBox parent_instance;
+};
+
+struct _GimpVectorsComboBoxClass
+{
+ GimpIntComboBoxClass parent_class;
+};
+
+
+static GtkWidget * gimp_item_combo_box_new (GType type,
+ GimpItemConstraintFunc constraint,
+ gpointer data);
+
+static void gimp_item_combo_box_populate (GimpIntComboBox *combo_box);
+static void gimp_item_combo_box_model_add (GimpIntComboBox *combo_box,
+ GtkListStore *store,
+ gint32 image,
+ gint num_items,
+ gint32 *items,
+ gint tree_level);
+
+static void gimp_item_combo_box_drag_data_received (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time);
+
+static void gimp_item_combo_box_changed (GimpIntComboBox *combo_box);
+
+
+static const GtkTargetEntry targets[] =
+{
+ { "application/x-gimp-channel-id", 0 },
+ { "application/x-gimp-layer-id", 0 },
+ { "application/x-gimp-vectors-id", 0 }
+};
+
+
+G_DEFINE_TYPE (GimpDrawableComboBox, gimp_drawable_combo_box,
+ GIMP_TYPE_INT_COMBO_BOX)
+
+static void
+gimp_drawable_combo_box_class_init (GimpDrawableComboBoxClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ widget_class->drag_data_received = gimp_item_combo_box_drag_data_received;
+}
+
+static void
+gimp_drawable_combo_box_init (GimpDrawableComboBox *combo_box)
+{
+ gtk_drag_dest_set (GTK_WIDGET (combo_box),
+ GTK_DEST_DEFAULT_HIGHLIGHT |
+ GTK_DEST_DEFAULT_MOTION |
+ GTK_DEST_DEFAULT_DROP,
+ targets, 2,
+ GDK_ACTION_COPY);
+
+ g_object_set_data_full (G_OBJECT (combo_box), "gimp-item-combo-box-private",
+ g_new0 (GimpItemComboBoxPrivate, 1),
+ (GDestroyNotify) g_free);
+}
+
+/**
+ * gimp_drawable_combo_box_new:
+ * @constraint: a #GimpDrawableConstraintFunc or %NULL
+ * @data: a pointer that is passed to @constraint
+ *
+ * Creates a new #GimpIntComboBox filled with all currently opened
+ * drawables. If a @constraint function is specified, it is called for
+ * each drawable and only if the function returns %TRUE, the drawable
+ * is added to the combobox.
+ *
+ * You should use gimp_int_combo_box_connect() to initialize and connect
+ * the combo. Use gimp_int_combo_box_set_active() to get the active
+ * drawable ID and gimp_int_combo_box_get_active() to retrieve the ID
+ * of the selected drawable.
+ *
+ * Return value: a new #GimpIntComboBox.
+ *
+ * Since: 2.2
+ **/
+GtkWidget *
+gimp_drawable_combo_box_new (GimpDrawableConstraintFunc constraint,
+ gpointer data)
+{
+ return gimp_item_combo_box_new (GIMP_TYPE_DRAWABLE_COMBO_BOX,
+ constraint, data);
+}
+
+
+G_DEFINE_TYPE (GimpChannelComboBox, gimp_channel_combo_box,
+ GIMP_TYPE_INT_COMBO_BOX)
+
+static void
+gimp_channel_combo_box_class_init (GimpChannelComboBoxClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ widget_class->drag_data_received = gimp_item_combo_box_drag_data_received;
+}
+
+static void
+gimp_channel_combo_box_init (GimpChannelComboBox *combo_box)
+{
+ gtk_drag_dest_set (GTK_WIDGET (combo_box),
+ GTK_DEST_DEFAULT_HIGHLIGHT |
+ GTK_DEST_DEFAULT_MOTION |
+ GTK_DEST_DEFAULT_DROP,
+ targets, 1,
+ GDK_ACTION_COPY);
+
+ g_object_set_data_full (G_OBJECT (combo_box), "gimp-item-combo-box-private",
+ g_new0 (GimpItemComboBoxPrivate, 1),
+ (GDestroyNotify) g_free);
+}
+
+/**
+ * gimp_channel_combo_box_new:
+ * @constraint: a #GimpDrawableConstraintFunc or %NULL
+ * @data: a pointer that is passed to @constraint
+ *
+ * Creates a new #GimpIntComboBox filled with all currently opened
+ * channels. See gimp_drawable_combo_box_new() for more information.
+ *
+ * Return value: a new #GimpIntComboBox.
+ *
+ * Since: 2.2
+ **/
+GtkWidget *
+gimp_channel_combo_box_new (GimpDrawableConstraintFunc constraint,
+ gpointer data)
+{
+ return gimp_item_combo_box_new (GIMP_TYPE_CHANNEL_COMBO_BOX,
+ constraint, data);
+}
+
+
+G_DEFINE_TYPE (GimpLayerComboBox, gimp_layer_combo_box,
+ GIMP_TYPE_INT_COMBO_BOX)
+
+static void
+gimp_layer_combo_box_class_init (GimpLayerComboBoxClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ widget_class->drag_data_received = gimp_item_combo_box_drag_data_received;
+}
+
+static void
+gimp_layer_combo_box_init (GimpLayerComboBox *combo_box)
+{
+ gtk_drag_dest_set (GTK_WIDGET (combo_box),
+ GTK_DEST_DEFAULT_HIGHLIGHT |
+ GTK_DEST_DEFAULT_MOTION |
+ GTK_DEST_DEFAULT_DROP,
+ targets + 1, 1,
+ GDK_ACTION_COPY);
+
+ g_object_set_data_full (G_OBJECT (combo_box), "gimp-item-combo-box-private",
+ g_new0 (GimpItemComboBoxPrivate, 1),
+ (GDestroyNotify) g_free);
+}
+
+/**
+ * gimp_layer_combo_box_new:
+ * @constraint: a #GimpDrawableConstraintFunc or %NULL
+ * @data: a pointer that is passed to @constraint
+ *
+ * Creates a new #GimpIntComboBox filled with all currently opened
+ * layers. See gimp_drawable_combo_box_new() for more information.
+ *
+ * Return value: a new #GimpIntComboBox.
+ *
+ * Since: 2.2
+ **/
+GtkWidget *
+gimp_layer_combo_box_new (GimpDrawableConstraintFunc constraint,
+ gpointer data)
+{
+ return gimp_item_combo_box_new (GIMP_TYPE_LAYER_COMBO_BOX,
+ constraint, data);
+}
+
+
+G_DEFINE_TYPE (GimpVectorsComboBox, gimp_vectors_combo_box,
+ GIMP_TYPE_INT_COMBO_BOX)
+
+static void
+gimp_vectors_combo_box_class_init (GimpVectorsComboBoxClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ widget_class->drag_data_received = gimp_item_combo_box_drag_data_received;
+}
+
+static void
+gimp_vectors_combo_box_init (GimpVectorsComboBox *combo_box)
+{
+ gtk_drag_dest_set (GTK_WIDGET (combo_box),
+ GTK_DEST_DEFAULT_HIGHLIGHT |
+ GTK_DEST_DEFAULT_MOTION |
+ GTK_DEST_DEFAULT_DROP,
+ targets + 2, 1,
+ GDK_ACTION_COPY);
+
+ g_object_set_data_full (G_OBJECT (combo_box), "gimp-item-combo-box-private",
+ g_new0 (GimpItemComboBoxPrivate, 1),
+ (GDestroyNotify) g_free);
+}
+
+
+/**
+ * gimp_vectors_combo_box_new:
+ * @constraint: a #GimpVectorsConstraintFunc or %NULL
+ * @data: a pointer that is passed to @constraint
+ *
+ * Creates a new #GimpIntComboBox filled with all currently opened
+ * vectors objects. If a @constraint function is specified, it is called for
+ * each vectors object and only if the function returns %TRUE, the vectors
+ * object is added to the combobox.
+ *
+ * You should use gimp_int_combo_box_connect() to initialize and connect
+ * the combo. Use gimp_int_combo_box_set_active() to set the active
+ * vectors ID and gimp_int_combo_box_get_active() to retrieve the ID
+ * of the selected vectors object.
+ *
+ * Return value: a new #GimpIntComboBox.
+ *
+ * Since: 2.4
+ **/
+GtkWidget *
+gimp_vectors_combo_box_new (GimpVectorsConstraintFunc constraint,
+ gpointer data)
+{
+ return gimp_item_combo_box_new (GIMP_TYPE_VECTORS_COMBO_BOX,
+ constraint, data);
+}
+
+
+static GtkWidget *
+gimp_item_combo_box_new (GType type,
+ GimpItemConstraintFunc constraint,
+ gpointer data)
+{
+ GimpIntComboBox *combo_box;
+ GimpItemComboBoxPrivate *private;
+
+ combo_box = g_object_new (type,
+ "width-request", WIDTH_REQUEST,
+ "ellipsize", PANGO_ELLIPSIZE_MIDDLE,
+ NULL);
+
+ private = GET_PRIVATE (combo_box);
+
+ private->constraint = constraint;
+ private->data = data;
+
+ gimp_item_combo_box_populate (combo_box);
+
+ g_signal_connect (combo_box, "changed",
+ G_CALLBACK (gimp_item_combo_box_changed),
+ NULL);
+
+ return GTK_WIDGET (combo_box);
+}
+
+static void
+gimp_item_combo_box_populate (GimpIntComboBox *combo_box)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint32 *images;
+ gint num_images;
+ gint i;
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
+
+ images = gimp_image_list (&num_images);
+
+ for (i = 0; i < num_images; i++)
+ {
+ gint32 *items;
+ gint num_items;
+
+ if (GIMP_IS_DRAWABLE_COMBO_BOX (combo_box) ||
+ GIMP_IS_LAYER_COMBO_BOX (combo_box))
+ {
+ items = gimp_image_get_layers (images[i], &num_items);
+ gimp_item_combo_box_model_add (combo_box, GTK_LIST_STORE (model),
+ images[i],
+ num_items, items, 0);
+ g_free (items);
+ }
+
+ if (GIMP_IS_DRAWABLE_COMBO_BOX (combo_box) ||
+ GIMP_IS_CHANNEL_COMBO_BOX (combo_box))
+ {
+ items = gimp_image_get_channels (images[i], &num_items);
+ gimp_item_combo_box_model_add (combo_box, GTK_LIST_STORE (model),
+ images[i],
+ num_items, items, 0);
+ g_free (items);
+ }
+
+ if (GIMP_IS_VECTORS_COMBO_BOX (combo_box))
+ {
+ items = gimp_image_get_vectors (images[i], &num_items);
+ gimp_item_combo_box_model_add (combo_box, GTK_LIST_STORE (model),
+ images[i],
+ num_items, items, 0);
+ g_free (items);
+ }
+ }
+
+ g_free (images);
+
+ if (gtk_tree_model_get_iter_first (model, &iter))
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
+}
+
+static void
+gimp_item_combo_box_model_add (GimpIntComboBox *combo_box,
+ GtkListStore *store,
+ gint32 image,
+ gint num_items,
+ gint32 *items,
+ gint tree_level)
+{
+ GimpItemComboBoxPrivate *private = GET_PRIVATE (combo_box);
+ GtkTreeIter iter;
+ gint i;
+ gchar *indent;
+
+ if (tree_level > 0)
+ {
+ indent = g_new (gchar, tree_level + 2);
+ memset (indent, '-', tree_level);
+ indent[tree_level] = ' ';
+ indent[tree_level + 1] = '\0';
+ }
+ else
+ {
+ indent = g_strdup ("");
+ }
+
+ for (i = 0; i < num_items; i++)
+ {
+ if (! private->constraint ||
+ (* private->constraint) (image, items[i], private->data))
+ {
+ gchar *image_name = gimp_image_get_name (image);
+ gchar *item_name = gimp_item_get_name (items[i]);
+ gchar *label;
+ GdkPixbuf *thumb;
+
+ label = g_strdup_printf ("%s%s-%d / %s-%d",
+ indent, image_name, image,
+ item_name, items[i]);
+
+ g_free (item_name);
+ g_free (image_name);
+
+ if (GIMP_IS_VECTORS_COMBO_BOX (combo_box))
+ thumb = NULL;
+ else
+ thumb = gimp_drawable_get_thumbnail (items[i],
+ THUMBNAIL_SIZE, THUMBNAIL_SIZE,
+ GIMP_PIXBUF_SMALL_CHECKS);
+
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ GIMP_INT_STORE_VALUE, items[i],
+ GIMP_INT_STORE_LABEL, label,
+ GIMP_INT_STORE_PIXBUF, thumb,
+ -1);
+
+ if (thumb)
+ g_object_unref (thumb);
+
+ g_free (label);
+ }
+
+ if (gimp_item_is_group (items[i]))
+ {
+ gint32 *children;
+ gint n_children;
+
+ children = gimp_item_get_children (items[i], &n_children);
+ gimp_item_combo_box_model_add (combo_box, store,
+ image,
+ n_children, children,
+ tree_level + 1);
+ g_free (children);
+ }
+ }
+
+ g_free (indent);
+}
+
+static void
+gimp_item_combo_box_drag_data_received (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time)
+{
+ gint length = gtk_selection_data_get_length (selection);
+ gchar *str;
+
+ if (gtk_selection_data_get_format (selection) != 8 || length < 1)
+ {
+ g_warning ("%s: received invalid item ID data", G_STRFUNC);
+ return;
+ }
+
+ str = g_strndup ((const gchar *) gtk_selection_data_get_data (selection),
+ length);
+
+ if (g_utf8_validate (str, -1, NULL))
+ {
+ gint pid;
+ gint ID;
+
+ if (sscanf (str, "%i:%i", &pid, &ID) == 2 &&
+ pid == gimp_getpid ())
+ {
+ gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (widget), ID);
+ }
+ }
+
+ g_free (str);
+}
+
+static gboolean
+gimp_item_combo_box_remove_items (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ gint item_ID;
+ GList **remove = data;
+
+ gtk_tree_model_get (model, iter,
+ GIMP_INT_STORE_VALUE, &item_ID,
+ -1);
+
+ if (item_ID > 0)
+ *remove = g_list_prepend (*remove, g_memdup (iter, sizeof (GtkTreeIter)));
+
+ return FALSE;
+}
+
+static void
+gimp_item_combo_box_changed (GimpIntComboBox *combo_box)
+{
+ gint item_ID;
+
+ if (gimp_int_combo_box_get_active (combo_box, &item_ID))
+ {
+ if (item_ID > 0 && ! gimp_item_is_valid (item_ID))
+ {
+ GtkTreeModel *model;
+ GList *remove = NULL;
+ GList *list;
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
+
+ g_signal_stop_emission_by_name (combo_box, "changed");
+
+ gtk_tree_model_foreach (model,
+ gimp_item_combo_box_remove_items,
+ &remove);
+
+ for (list = remove; list; list = g_list_next (list))
+ gtk_list_store_remove (GTK_LIST_STORE (model), list->data);
+
+ g_list_free_full (remove, (GDestroyNotify) g_free);
+
+ gimp_item_combo_box_populate (combo_box);
+ }
+ }
+}
diff --git a/libgimp/gimpitemcombobox.h b/libgimp/gimpitemcombobox.h
new file mode 100644
index 0000000..794846d
--- /dev/null
+++ b/libgimp/gimpitemcombobox.h
@@ -0,0 +1,77 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpitemcombobox.h
+ * Copyright (C) 2004 Sven Neumann <sven@gimp.org>
+ * Copyright (C) 2006 Simon Budig <simon@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_ITEM_COMBO_BOX_H__
+#define __GIMP_ITEM_COMBO_BOX_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+#define GIMP_TYPE_DRAWABLE_COMBO_BOX (gimp_drawable_combo_box_get_type ())
+#define GIMP_DRAWABLE_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DRAWABLE_COMBO_BOX, GimpDrawableComboBox))
+#define GIMP_IS_DRAWABLE_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DRAWABLE_COMBO_BOX))
+
+#define GIMP_TYPE_CHANNEL_COMBO_BOX (gimp_channel_combo_box_get_type ())
+#define GIMP_CHANNEL_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CHANNEL_COMBO_BOX, GimpChannelComboBox))
+#define GIMP_IS_CHANNEL_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CHANNEL_COMBO_BOX))
+
+#define GIMP_TYPE_LAYER_COMBO_BOX (gimp_layer_combo_box_get_type ())
+#define GIMP_LAYER_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LAYER_COMBO_BOX, GimpLayerComboBox))
+#define GIMP_IS_LAYER_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LAYER_COMBO_BOX))
+
+#define GIMP_TYPE_VECTORS_COMBO_BOX (gimp_vectors_combo_box_get_type ())
+#define GIMP_VECTORS_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VECTORS_COMBO_BOX, GimpVectorsComboBox))
+#define GIMP_IS_VECTORS_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VECTORS_COMBO_BOX))
+
+
+typedef gboolean (* GimpItemConstraintFunc) (gint32 image_id,
+ gint32 item_id,
+ gpointer data);
+
+typedef GimpItemConstraintFunc GimpVectorsConstraintFunc;
+typedef GimpItemConstraintFunc GimpDrawableConstraintFunc;
+
+
+GType gimp_drawable_combo_box_get_type (void) G_GNUC_CONST;
+GType gimp_channel_combo_box_get_type (void) G_GNUC_CONST;
+GType gimp_layer_combo_box_get_type (void) G_GNUC_CONST;
+GType gimp_vectors_combo_box_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_drawable_combo_box_new (GimpDrawableConstraintFunc constraint,
+ gpointer data);
+GtkWidget * gimp_channel_combo_box_new (GimpDrawableConstraintFunc constraint,
+ gpointer data);
+GtkWidget * gimp_layer_combo_box_new (GimpDrawableConstraintFunc constraint,
+ gpointer data);
+GtkWidget * gimp_vectors_combo_box_new (GimpVectorsConstraintFunc constraint,
+ gpointer data);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_ITEM_COMBO_BOX_H__ */
diff --git a/libgimp/gimpitemtransform_pdb.c b/libgimp/gimpitemtransform_pdb.c
new file mode 100644
index 0000000..c811bef
--- /dev/null
+++ b/libgimp/gimpitemtransform_pdb.c
@@ -0,0 +1,697 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpitemtransform_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpitemtransform
+ * @title: gimpitemtransform
+ * @short_description: Functions to perform transformations on items.
+ *
+ * Functions to perform transformations on items.
+ **/
+
+
+/**
+ * gimp_item_transform_translate:
+ * @item_ID: The item.
+ * @off_x: Offset in x direction.
+ * @off_y: Offset in y direction.
+ *
+ * Translate the item by the specified offsets.
+ *
+ * This procedure translates the item by the amounts specified in the
+ * off_x and off_y arguments. These can be negative, and are considered
+ * offsets from the current position. The offsets will be rounded to
+ * the nearest pixel unless the item is a path.
+ *
+ * If the item is attached to an image and has its linked flag set to
+ * TRUE, all additional items contained in the image which have the
+ * linked flag set to TRUE will also be translated by the specified
+ * offsets.
+ *
+ * Returns: The translated item.
+ *
+ * Since: 2.10
+ **/
+gint32
+gimp_item_transform_translate (gint32 item_ID,
+ gdouble off_x,
+ gdouble off_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_item_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-item-transform-translate",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_FLOAT, off_x,
+ GIMP_PDB_FLOAT, off_y,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_item_ID = return_vals[1].data.d_item;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_item_ID;
+}
+
+/**
+ * gimp_item_transform_flip_simple:
+ * @item_ID: The affected item.
+ * @flip_type: Type of flip.
+ * @auto_center: Whether to automatically position the axis in the selection center.
+ * @axis: coord. of flip axis.
+ *
+ * Flip the specified item either vertically or horizontally.
+ *
+ * This procedure flips the specified item.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then flipped. If auto_center
+ * is set to TRUE, the flip is around the selection's center.
+ * Otherwise, the coordinate of the axis needs to be specified. The
+ * return value is the ID of the flipped floating selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be flipped around its center if auto_center is set to
+ * TRUE, otherwise the coordinate of the axis needs to be specified.
+ * Additionally, if the item has its linked flag set to TRUE, all
+ * additional items contained in the image which have the linked flag
+ * set to TRUE will also be flipped around the same axis. The return
+ * value will be equal to the item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: The flipped item.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_item_transform_flip_simple (gint32 item_ID,
+ GimpOrientationType flip_type,
+ gboolean auto_center,
+ gdouble axis)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_item_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-item-transform-flip-simple",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_INT32, flip_type,
+ GIMP_PDB_INT32, auto_center,
+ GIMP_PDB_FLOAT, axis,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_item_ID = return_vals[1].data.d_item;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_item_ID;
+}
+
+/**
+ * gimp_item_transform_flip:
+ * @item_ID: The affected item.
+ * @x0: horz. coord. of one end of axis.
+ * @y0: vert. coord. of one end of axis.
+ * @x1: horz. coord. of other end of axis.
+ * @y1: vert. coord. of other end of axis.
+ *
+ * Flip the specified item around a given line.
+ *
+ * This procedure flips the specified item.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then flipped. The axis to
+ * flip around is specified by specifying two points from that line.
+ * The return value is the ID of the flipped floating selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be flipped around the specified axis. Additionally, if the
+ * item has its linked flag set to TRUE, all additional items contained
+ * in the image which have the linked flag set to TRUE will also be
+ * flipped around the same axis. The return value will be equal to the
+ * item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: The flipped item.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_item_transform_flip (gint32 item_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_item_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-item-transform-flip",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_item_ID = return_vals[1].data.d_item;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_item_ID;
+}
+
+/**
+ * gimp_item_transform_perspective:
+ * @item_ID: The affected item.
+ * @x0: The new x coordinate of upper-left corner of original bounding box.
+ * @y0: The new y coordinate of upper-left corner of original bounding box.
+ * @x1: The new x coordinate of upper-right corner of original bounding box.
+ * @y1: The new y coordinate of upper-right corner of original bounding box.
+ * @x2: The new x coordinate of lower-left corner of original bounding box.
+ * @y2: The new y coordinate of lower-left corner of original bounding box.
+ * @x3: The new x coordinate of lower-right corner of original bounding box.
+ * @y3: The new y coordinate of lower-right corner of original bounding box.
+ *
+ * Perform a possibly non-affine transformation on the specified item.
+ *
+ * This procedure performs a possibly non-affine transformation on the
+ * specified item by allowing the corners of the original bounding box
+ * to be arbitrarily remapped to any values.
+ *
+ * The 4 coordinates specify the new locations of each corner of the
+ * original bounding box. By specifying these values, any affine
+ * transformation (rotation, scaling, translation) can be affected.
+ * Additionally, these values can be specified such that the resulting
+ * transformed item will appear to have been projected via a
+ * perspective transform.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then transformed as
+ * specified. The return value is the ID of the transformed floating
+ * selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be transformed according to the specified mapping.
+ * Additionally, if the item has its linked flag set to TRUE, all
+ * additional items contained in the image which have the linked flag
+ * set to TRUE will also be transformed the same way. The return value
+ * will be equal to the item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: The transformed item.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_item_transform_perspective (gint32 item_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ gdouble x3,
+ gdouble y3)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_item_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-item-transform-perspective",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_FLOAT, x2,
+ GIMP_PDB_FLOAT, y2,
+ GIMP_PDB_FLOAT, x3,
+ GIMP_PDB_FLOAT, y3,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_item_ID = return_vals[1].data.d_item;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_item_ID;
+}
+
+/**
+ * gimp_item_transform_rotate_simple:
+ * @item_ID: The affected item.
+ * @rotate_type: Type of rotation.
+ * @auto_center: Whether to automatically rotate around the selection center.
+ * @center_x: The hor. coordinate of the center of rotation.
+ * @center_y: The vert. coordinate of the center of rotation.
+ *
+ * Rotate the specified item about given coordinates through the
+ * specified angle.
+ *
+ * This function rotates the specified item.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then rotated by the
+ * specified amount. If auto_center is set to TRUE, the rotation is
+ * around the selection's center. Otherwise, the coordinate of the
+ * center point needs to be specified. The return value is the ID of
+ * the rotated floating selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be rotated around its center if auto_center is set to
+ * TRUE, otherwise the coordinate of the center point needs to be
+ * specified. Additionally, if the item has its linked flag set to
+ * TRUE, all additional items contained in the image which have the
+ * linked flag set to TRUE will also be rotated around the same center
+ * point. The return value will be equal to the item ID supplied as
+ * input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: The rotated item.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_item_transform_rotate_simple (gint32 item_ID,
+ GimpRotationType rotate_type,
+ gboolean auto_center,
+ gdouble center_x,
+ gdouble center_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_item_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-item-transform-rotate-simple",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_INT32, rotate_type,
+ GIMP_PDB_INT32, auto_center,
+ GIMP_PDB_FLOAT, center_x,
+ GIMP_PDB_FLOAT, center_y,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_item_ID = return_vals[1].data.d_item;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_item_ID;
+}
+
+/**
+ * gimp_item_transform_rotate:
+ * @item_ID: The affected item.
+ * @angle: The angle of rotation (radians).
+ * @auto_center: Whether to automatically rotate around the selection center.
+ * @center_x: The hor. coordinate of the center of rotation.
+ * @center_y: The vert. coordinate of the center of rotation.
+ *
+ * Rotate the specified item about given coordinates through the
+ * specified angle.
+ *
+ * This function rotates the specified item.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then rotated by the
+ * specified amount. If auto_center is set to TRUE, the rotation is
+ * around the selection's center. Otherwise, the coordinate of the
+ * center point needs to be specified. The return value is the ID of
+ * the rotated floating selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be rotated around its center if auto_center is set to
+ * TRUE, otherwise the coordinate of the center point needs to be
+ * specified. Additionally, if the item has its linked flag set to
+ * TRUE, all additional items contained in the image which have the
+ * linked flag set to TRUE will also be rotated around the same center
+ * point. The return value will be equal to the item ID supplied as
+ * input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: The rotated item.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_item_transform_rotate (gint32 item_ID,
+ gdouble angle,
+ gboolean auto_center,
+ gdouble center_x,
+ gdouble center_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_item_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-item-transform-rotate",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_FLOAT, angle,
+ GIMP_PDB_INT32, auto_center,
+ GIMP_PDB_FLOAT, center_x,
+ GIMP_PDB_FLOAT, center_y,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_item_ID = return_vals[1].data.d_item;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_item_ID;
+}
+
+/**
+ * gimp_item_transform_scale:
+ * @item_ID: The affected item.
+ * @x0: The new x coordinate of the upper-left corner of the scaled region.
+ * @y0: The new y coordinate of the upper-left corner of the scaled region.
+ * @x1: The new x coordinate of the lower-right corner of the scaled region.
+ * @y1: The new y coordinate of the lower-right corner of the scaled region.
+ *
+ * Scale the specified item.
+ *
+ * This procedure scales the specified item.
+ *
+ * The 2 coordinates specify the new locations of the top-left and
+ * bottom-roght corners of the original bounding box.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then scaled as specified.
+ * The return value is the ID of the scaled floating selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be scaled according to the specified coordinates.
+ * Additionally, if the item has its linked flag set to TRUE, all
+ * additional items contained in the image which have the linked flag
+ * set to TRUE will also be scaled the same way. The return value will
+ * be equal to the item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: The scaled item.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_item_transform_scale (gint32 item_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_item_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-item-transform-scale",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_item_ID = return_vals[1].data.d_item;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_item_ID;
+}
+
+/**
+ * gimp_item_transform_shear:
+ * @item_ID: The affected item.
+ * @shear_type: Type of shear.
+ * @magnitude: The magnitude of the shear.
+ *
+ * Shear the specified item about its center by the specified
+ * magnitude.
+ *
+ * This procedure shears the specified item.
+ *
+ * The shear type parameter indicates whether the shear will be applied
+ * horizontally or vertically. The magnitude can be either positive or
+ * negative and indicates the extent (in pixels) to shear by.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then sheared as specified.
+ * The return value is the ID of the sheared floating selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be sheared according to the specified parameters.
+ * Additionally, if the item has its linked flag set to TRUE, all
+ * additional items contained in the image which have the linked flag
+ * set to TRUE will also be sheared the same way. The return value will
+ * be equal to the item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: The sheared item.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_item_transform_shear (gint32 item_ID,
+ GimpOrientationType shear_type,
+ gdouble magnitude)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_item_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-item-transform-shear",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_INT32, shear_type,
+ GIMP_PDB_FLOAT, magnitude,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_item_ID = return_vals[1].data.d_item;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_item_ID;
+}
+
+/**
+ * gimp_item_transform_2d:
+ * @item_ID: The affected item.
+ * @source_x: X coordinate of the transformation center.
+ * @source_y: Y coordinate of the transformation center.
+ * @scale_x: Amount to scale in x direction.
+ * @scale_y: Amount to scale in y direction.
+ * @angle: The angle of rotation (radians).
+ * @dest_x: X coordinate of where the center goes.
+ * @dest_y: Y coordinate of where the center goes.
+ *
+ * Transform the specified item in 2d.
+ *
+ * This procedure transforms the specified item.
+ *
+ * The transformation is done by scaling by the x and y scale factors
+ * about the point (source_x, source_y), then rotating around the same
+ * point, then translating that point to the new position (dest_x,
+ * dest_y).
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then transformed as
+ * specified. The return value is the ID of the transformed floating
+ * selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be transformed according to the specified parameters.
+ * Additionally, if the item has its linked flag set to TRUE, all
+ * additional items contained in the image which have the linked flag
+ * set to TRUE will also be transformed the same way. The return value
+ * will be equal to the item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: The transformed item.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_item_transform_2d (gint32 item_ID,
+ gdouble source_x,
+ gdouble source_y,
+ gdouble scale_x,
+ gdouble scale_y,
+ gdouble angle,
+ gdouble dest_x,
+ gdouble dest_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_item_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-item-transform-2d",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_FLOAT, source_x,
+ GIMP_PDB_FLOAT, source_y,
+ GIMP_PDB_FLOAT, scale_x,
+ GIMP_PDB_FLOAT, scale_y,
+ GIMP_PDB_FLOAT, angle,
+ GIMP_PDB_FLOAT, dest_x,
+ GIMP_PDB_FLOAT, dest_y,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_item_ID = return_vals[1].data.d_item;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_item_ID;
+}
+
+/**
+ * gimp_item_transform_matrix:
+ * @item_ID: The affected item.
+ * @coeff_0_0: coefficient (0,0) of the transformation matrix.
+ * @coeff_0_1: coefficient (0,1) of the transformation matrix.
+ * @coeff_0_2: coefficient (0,2) of the transformation matrix.
+ * @coeff_1_0: coefficient (1,0) of the transformation matrix.
+ * @coeff_1_1: coefficient (1,1) of the transformation matrix.
+ * @coeff_1_2: coefficient (1,2) of the transformation matrix.
+ * @coeff_2_0: coefficient (2,0) of the transformation matrix.
+ * @coeff_2_1: coefficient (2,1) of the transformation matrix.
+ * @coeff_2_2: coefficient (2,2) of the transformation matrix.
+ *
+ * Transform the specified item in 2d.
+ *
+ * This procedure transforms the specified item.
+ *
+ * The transformation is done by assembling a 3x3 matrix from the
+ * coefficients passed.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then transformed as
+ * specified. The return value is the ID of the transformed floating
+ * selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be transformed according to the specified matrix.
+ * Additionally, if the item has its linked flag set to TRUE, all
+ * additional items contained in the image which have the linked flag
+ * set to TRUE will also be transformed the same way. The return value
+ * will be equal to the item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: The transformed item.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_item_transform_matrix (gint32 item_ID,
+ gdouble coeff_0_0,
+ gdouble coeff_0_1,
+ gdouble coeff_0_2,
+ gdouble coeff_1_0,
+ gdouble coeff_1_1,
+ gdouble coeff_1_2,
+ gdouble coeff_2_0,
+ gdouble coeff_2_1,
+ gdouble coeff_2_2)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_item_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-item-transform-matrix",
+ &nreturn_vals,
+ GIMP_PDB_ITEM, item_ID,
+ GIMP_PDB_FLOAT, coeff_0_0,
+ GIMP_PDB_FLOAT, coeff_0_1,
+ GIMP_PDB_FLOAT, coeff_0_2,
+ GIMP_PDB_FLOAT, coeff_1_0,
+ GIMP_PDB_FLOAT, coeff_1_1,
+ GIMP_PDB_FLOAT, coeff_1_2,
+ GIMP_PDB_FLOAT, coeff_2_0,
+ GIMP_PDB_FLOAT, coeff_2_1,
+ GIMP_PDB_FLOAT, coeff_2_2,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_item_ID = return_vals[1].data.d_item;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_item_ID;
+}
diff --git a/libgimp/gimpitemtransform_pdb.h b/libgimp/gimpitemtransform_pdb.h
new file mode 100644
index 0000000..18cb9ed
--- /dev/null
+++ b/libgimp/gimpitemtransform_pdb.h
@@ -0,0 +1,96 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpitemtransform_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_ITEM_TRANSFORM_PDB_H__
+#define __GIMP_ITEM_TRANSFORM_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gint32 gimp_item_transform_translate (gint32 item_ID,
+ gdouble off_x,
+ gdouble off_y);
+gint32 gimp_item_transform_flip_simple (gint32 item_ID,
+ GimpOrientationType flip_type,
+ gboolean auto_center,
+ gdouble axis);
+gint32 gimp_item_transform_flip (gint32 item_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1);
+gint32 gimp_item_transform_perspective (gint32 item_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ gdouble x3,
+ gdouble y3);
+gint32 gimp_item_transform_rotate_simple (gint32 item_ID,
+ GimpRotationType rotate_type,
+ gboolean auto_center,
+ gdouble center_x,
+ gdouble center_y);
+gint32 gimp_item_transform_rotate (gint32 item_ID,
+ gdouble angle,
+ gboolean auto_center,
+ gdouble center_x,
+ gdouble center_y);
+gint32 gimp_item_transform_scale (gint32 item_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1);
+gint32 gimp_item_transform_shear (gint32 item_ID,
+ GimpOrientationType shear_type,
+ gdouble magnitude);
+gint32 gimp_item_transform_2d (gint32 item_ID,
+ gdouble source_x,
+ gdouble source_y,
+ gdouble scale_x,
+ gdouble scale_y,
+ gdouble angle,
+ gdouble dest_x,
+ gdouble dest_y);
+gint32 gimp_item_transform_matrix (gint32 item_ID,
+ gdouble coeff_0_0,
+ gdouble coeff_0_1,
+ gdouble coeff_0_2,
+ gdouble coeff_1_0,
+ gdouble coeff_1_1,
+ gdouble coeff_1_2,
+ gdouble coeff_2_0,
+ gdouble coeff_2_1,
+ gdouble coeff_2_2);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_ITEM_TRANSFORM_PDB_H__ */
diff --git a/libgimp/gimplayer.c b/libgimp/gimplayer.c
new file mode 100644
index 0000000..a3f58fd
--- /dev/null
+++ b/libgimp/gimplayer.c
@@ -0,0 +1,415 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimplayer.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#define GIMP_DISABLE_DEPRECATION_WARNINGS
+
+#include "gimp.h"
+
+
+/**
+ * gimp_layer_new:
+ * @image_ID: The image to which to add the layer.
+ * @name: The layer name.
+ * @width: The layer width.
+ * @height: The layer height.
+ * @type: The layer type.
+ * @opacity: The layer opacity.
+ * @mode: The layer combination mode.
+ *
+ * Create a new layer.
+ *
+ * This procedure creates a new layer with the specified width, height,
+ * and type. Name, opacity, and mode are also supplied parameters. The
+ * new layer still needs to be added to the image, as this is not
+ * automatic. Add the new layer with the gimp_image_insert_layer()
+ * command. Other attributes such as layer mask modes, and offsets
+ * should be set with explicit procedure calls.
+ *
+ * Returns: The newly created layer.
+ */
+gint32
+gimp_layer_new (gint32 image_ID,
+ const gchar *name,
+ gint width,
+ gint height,
+ GimpImageType type,
+ gdouble opacity,
+ GimpLayerMode mode)
+{
+ return _gimp_layer_new (image_ID,
+ width,
+ height,
+ type,
+ name,
+ opacity,
+ mode);
+}
+
+/**
+ * gimp_layer_copy:
+ * @layer_ID: The layer to copy.
+ *
+ * Copy a layer.
+ *
+ * This procedure copies the specified layer and returns the copy. The
+ * newly copied layer is for use within the original layer's image. It
+ * should not be subsequently added to any other image.
+ *
+ * Returns: The newly copied layer.
+ */
+gint32
+gimp_layer_copy (gint32 layer_ID)
+{
+ return _gimp_layer_copy (layer_ID, FALSE);
+}
+
+/**
+ * gimp_layer_new_from_pixbuf:
+ * @image_ID: The RGB image to which to add the layer.
+ * @name: The layer name.
+ * @pixbuf: A GdkPixbuf.
+ * @opacity: The layer opacity.
+ * @mode: The layer combination mode.
+ * @progress_start: start of progress
+ * @progress_end: end of progress
+ *
+ * Create a new layer from a %GdkPixbuf.
+ *
+ * This procedure creates a new layer from the given %GdkPixbuf. The
+ * image has to be an RGB image and just like with gimp_layer_new()
+ * you will still need to add the layer to it.
+ *
+ * If you pass @progress_end > @progress_start to this function,
+ * gimp_progress_update() will be called for. You have to call
+ * gimp_progress_init() beforehand then.
+ *
+ * Returns: The newly created layer.
+ *
+ * Since: 2.4
+ */
+gint32
+gimp_layer_new_from_pixbuf (gint32 image_ID,
+ const gchar *name,
+ GdkPixbuf *pixbuf,
+ gdouble opacity,
+ GimpLayerMode mode,
+ gdouble progress_start,
+ gdouble progress_end)
+{
+ gint32 layer;
+ gint width;
+ gint height;
+ gint bpp;
+ gdouble range = progress_end - progress_start;
+
+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
+
+ if (gimp_image_base_type (image_ID) != GIMP_RGB)
+ {
+ g_warning ("gimp_layer_new_from_pixbuf() needs an RGB image");
+ return -1;
+ }
+
+ if (gdk_pixbuf_get_colorspace (pixbuf) != GDK_COLORSPACE_RGB)
+ {
+ g_warning ("gimp_layer_new_from_pixbuf() assumes that GdkPixbuf is RGB");
+ return -1;
+ }
+
+ width = gdk_pixbuf_get_width (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+ bpp = gdk_pixbuf_get_n_channels (pixbuf);
+
+ layer = gimp_layer_new (image_ID, name, width, height,
+ bpp == 3 ? GIMP_RGB_IMAGE : GIMP_RGBA_IMAGE,
+ opacity, mode);
+
+ if (layer == -1)
+ return -1;
+
+ if (gimp_plugin_precision_enabled ())
+ {
+ GeglBuffer *dest_buffer;
+
+ dest_buffer = gimp_drawable_get_buffer (layer);
+
+ gegl_buffer_set (dest_buffer, GEGL_RECTANGLE (0, 0, width, height), 0,
+ gimp_pixbuf_get_format (pixbuf),
+ gdk_pixbuf_get_pixels (pixbuf),
+ gdk_pixbuf_get_rowstride (pixbuf));
+
+ g_object_unref (dest_buffer);
+ }
+ else
+ {
+ GimpDrawable *drawable;
+ GimpPixelRgn rgn;
+ gpointer pr;
+ const guchar *pixels;
+ gint rowstride;
+ guint done = 0;
+ guint count = 0;
+
+ drawable = gimp_drawable_get (layer);
+
+ gimp_pixel_rgn_init (&rgn, drawable, 0, 0, width, height, TRUE, FALSE);
+
+ g_assert (bpp == rgn.bpp);
+
+ rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+ pixels = gdk_pixbuf_get_pixels (pixbuf);
+
+ for (pr = gimp_pixel_rgns_register (1, &rgn);
+ pr != NULL;
+ pr = gimp_pixel_rgns_process (pr))
+ {
+ const guchar *src = pixels + rgn.y * rowstride + rgn.x * bpp;
+ guchar *dest = rgn.data;
+ gint y;
+
+ for (y = 0; y < rgn.h; y++)
+ {
+ memcpy (dest, src, rgn.w * rgn.bpp);
+
+ src += rowstride;
+ dest += rgn.rowstride;
+ }
+
+ if (range > 0.0)
+ {
+ done += rgn.h * rgn.w;
+
+ if (count++ % 32 == 0)
+ gimp_progress_update (progress_start +
+ (gdouble) done / (width * height) * range);
+ }
+ }
+
+ gimp_drawable_detach (drawable);
+ }
+
+ if (range > 0.0)
+ gimp_progress_update (progress_end);
+
+ return layer;
+}
+
+/**
+ * gimp_layer_new_from_surface:
+ * @image_ID: The RGB image to which to add the layer.
+ * @name: The layer name.
+ * @surface: A Cairo image surface.
+ * @progress_start: start of progress
+ * @progress_end: end of progress
+ *
+ * Create a new layer from a #cairo_surface_t.
+ *
+ * This procedure creates a new layer from the given
+ * #cairo_surface_t. The image has to be an RGB image and just like
+ * with gimp_layer_new() you will still need to add the layer to it.
+ *
+ * If you pass @progress_end > @progress_start to this function,
+ * gimp_progress_update() will be called for. You have to call
+ * gimp_progress_init() beforehand then.
+ *
+ * Returns: The newly created layer.
+ *
+ * Since: 2.8
+ */
+gint32
+gimp_layer_new_from_surface (gint32 image_ID,
+ const gchar *name,
+ cairo_surface_t *surface,
+ gdouble progress_start,
+ gdouble progress_end)
+{
+ gint32 layer;
+ gint width;
+ gint height;
+ cairo_format_t format;
+ gdouble range = progress_end - progress_start;
+
+ g_return_val_if_fail (surface != NULL, -1);
+ g_return_val_if_fail (cairo_surface_get_type (surface) ==
+ CAIRO_SURFACE_TYPE_IMAGE, -1);
+
+ if (gimp_image_base_type (image_ID) != GIMP_RGB)
+ {
+ g_warning ("gimp_layer_new_from_surface() needs an RGB image");
+ return -1;
+ }
+
+ width = cairo_image_surface_get_width (surface);
+ height = cairo_image_surface_get_height (surface);
+ format = cairo_image_surface_get_format (surface);
+
+ if (format != CAIRO_FORMAT_ARGB32 &&
+ format != CAIRO_FORMAT_RGB24)
+ {
+ g_warning ("gimp_layer_new_from_surface() assumes that surface is RGB");
+ return -1;
+ }
+
+ layer = gimp_layer_new (image_ID, name, width, height,
+ format == CAIRO_FORMAT_RGB24 ?
+ GIMP_RGB_IMAGE : GIMP_RGBA_IMAGE,
+ 100.0,
+ gimp_image_get_default_new_layer_mode (image_ID));
+
+ if (layer == -1)
+ return -1;
+
+ if (gimp_plugin_precision_enabled ())
+ {
+ GeglBuffer *src_buffer;
+ GeglBuffer *dest_buffer;
+
+ src_buffer = gimp_cairo_surface_create_buffer (surface);
+ dest_buffer = gimp_drawable_get_buffer (layer);
+
+ gegl_buffer_copy (src_buffer, NULL, GEGL_ABYSS_NONE,
+ dest_buffer, NULL);
+
+ g_object_unref (src_buffer);
+ g_object_unref (dest_buffer);
+ }
+ else
+ {
+ GimpDrawable *drawable;
+ GimpPixelRgn rgn;
+ const guchar *pixels;
+ gpointer pr;
+ gsize rowstride;
+ guint count = 0;
+ guint done = 0;
+
+ drawable = gimp_drawable_get (layer);
+
+ gimp_pixel_rgn_init (&rgn, drawable, 0, 0, width, height, TRUE, FALSE);
+
+ rowstride = cairo_image_surface_get_stride (surface);
+ pixels = cairo_image_surface_get_data (surface);
+
+ for (pr = gimp_pixel_rgns_register (1, &rgn);
+ pr != NULL;
+ pr = gimp_pixel_rgns_process (pr))
+ {
+ const guchar *src = pixels + rgn.y * rowstride + rgn.x * 4;
+ guchar *dest = rgn.data;
+ gint y;
+
+ switch (format)
+ {
+ case CAIRO_FORMAT_RGB24:
+ for (y = 0; y < rgn.h; y++)
+ {
+ const guchar *s = src;
+ guchar *d = dest;
+ gint w = rgn.w;
+
+ while (w--)
+ {
+ GIMP_CAIRO_RGB24_GET_PIXEL (s, d[0], d[1], d[2]);
+
+ s += 4;
+ d += 3;
+ }
+
+ src += rowstride;
+ dest += rgn.rowstride;
+ }
+ break;
+
+ case CAIRO_FORMAT_ARGB32:
+ for (y = 0; y < rgn.h; y++)
+ {
+ const guchar *s = src;
+ guchar *d = dest;
+ gint w = rgn.w;
+
+ while (w--)
+ {
+ GIMP_CAIRO_ARGB32_GET_PIXEL (s, d[0], d[1], d[2], d[3]);
+
+ s += 4;
+ d += 4;
+ }
+
+ src += rowstride;
+ dest += rgn.rowstride;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (range > 0.0)
+ {
+ done += rgn.h * rgn.w;
+
+ if (count++ % 32 == 0)
+ gimp_progress_update (progress_start +
+ (gdouble) done / (width * height) * range);
+ }
+ }
+
+ gimp_drawable_detach (drawable);
+ }
+
+ if (range > 0.0)
+ gimp_progress_update (progress_end);
+
+ return layer;
+}
+
+/**
+ * gimp_layer_get_preserve_trans:
+ * @layer_ID: The layer.
+ *
+ * This procedure is deprecated! Use gimp_layer_get_lock_alpha() instead.
+ *
+ * Returns: The layer's preserve transperancy setting.
+ */
+gboolean
+gimp_layer_get_preserve_trans (gint32 layer_ID)
+{
+ return gimp_layer_get_lock_alpha (layer_ID);
+}
+
+/**
+ * gimp_layer_set_preserve_trans:
+ * @layer_ID: The layer.
+ * @preserve_trans: The new layer's preserve transperancy setting.
+ *
+ * This procedure is deprecated! Use gimp_layer_set_lock_alpha() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_layer_set_preserve_trans (gint32 layer_ID,
+ gboolean preserve_trans)
+{
+ return gimp_layer_set_lock_alpha (layer_ID, preserve_trans);
+}
diff --git a/libgimp/gimplayer.h b/libgimp/gimplayer.h
new file mode 100644
index 0000000..f1d006c
--- /dev/null
+++ b/libgimp/gimplayer.h
@@ -0,0 +1,63 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimplayer.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_LAYER_H__
+#define __GIMP_LAYER_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gint32 gimp_layer_new (gint32 image_ID,
+ const gchar *name,
+ gint width,
+ gint height,
+ GimpImageType type,
+ gdouble opacity,
+ GimpLayerMode mode);
+gint32 gimp_layer_copy (gint32 layer_ID);
+
+gint32 gimp_layer_new_from_pixbuf (gint32 image_ID,
+ const gchar *name,
+ GdkPixbuf *pixbuf,
+ gdouble opacity,
+ GimpLayerMode mode,
+ gdouble progress_start,
+ gdouble progress_end);
+gint32 gimp_layer_new_from_surface (gint32 image_ID,
+ const gchar *name,
+ cairo_surface_t *surface,
+ gdouble progress_start,
+ gdouble progress_end);
+
+GIMP_DEPRECATED_FOR(gimp_layer_get_lock_alpha)
+gboolean gimp_layer_get_preserve_trans (gint32 layer_ID);
+GIMP_DEPRECATED_FOR(gimp_layer_set_lock_alpha)
+gboolean gimp_layer_set_preserve_trans (gint32 layer_ID,
+ gboolean preserve_trans);
+
+G_END_DECLS
+
+#endif /* __GIMP_LAYER_H__ */
diff --git a/libgimp/gimplayer_pdb.c b/libgimp/gimplayer_pdb.c
new file mode 100644
index 0000000..7cd2d82
--- /dev/null
+++ b/libgimp/gimplayer_pdb.c
@@ -0,0 +1,1354 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimplayer_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimplayer
+ * @title: gimplayer
+ * @short_description: Operations on a single layer.
+ *
+ * Operations on a single layer.
+ **/
+
+
+/**
+ * _gimp_layer_new:
+ * @image_ID: The image to which to add the layer.
+ * @width: The layer width.
+ * @height: The layer height.
+ * @type: The layer type.
+ * @name: The layer name.
+ * @opacity: The layer opacity.
+ * @mode: The layer combination mode.
+ *
+ * Create a new layer.
+ *
+ * This procedure creates a new layer with the specified width, height,
+ * and type. Name, opacity, and mode are also supplied parameters. The
+ * new layer still needs to be added to the image, as this is not
+ * automatic. Add the new layer with the gimp_image_insert_layer()
+ * command. Other attributes such as layer mask modes, and offsets
+ * should be set with explicit procedure calls.
+ *
+ * Returns: The newly created layer.
+ **/
+gint32
+_gimp_layer_new (gint32 image_ID,
+ gint width,
+ gint height,
+ GimpImageType type,
+ const gchar *name,
+ gdouble opacity,
+ GimpLayerMode mode)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-layer-new",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, width,
+ GIMP_PDB_INT32, height,
+ GIMP_PDB_INT32, type,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_FLOAT, opacity,
+ GIMP_PDB_INT32, mode,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_layer_new_from_visible:
+ * @image_ID: The source image from where the content is copied.
+ * @dest_image_ID: The destination image to which to add the layer.
+ * @name: The layer name.
+ *
+ * Create a new layer from what is visible in an image.
+ *
+ * This procedure creates a new layer from what is visible in the given
+ * image. The new layer still needs to be added to the destination
+ * image, as this is not automatic. Add the new layer with the
+ * gimp_image_insert_layer() command. Other attributes such as layer
+ * mask modes, and offsets should be set with explicit procedure calls.
+ *
+ * Returns: The newly created layer.
+ *
+ * Since: 2.6
+ **/
+gint32
+gimp_layer_new_from_visible (gint32 image_ID,
+ gint32 dest_image_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-layer-new-from-visible",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_IMAGE, dest_image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_layer_new_from_drawable:
+ * @drawable_ID: The source drawable from where the new layer is copied.
+ * @dest_image_ID: The destination image to which to add the layer.
+ *
+ * Create a new layer by copying an existing drawable.
+ *
+ * This procedure creates a new layer as a copy of the specified
+ * drawable. The new layer still needs to be added to the image, as
+ * this is not automatic. Add the new layer with the
+ * gimp_image_insert_layer() command. Other attributes such as layer
+ * mask modes, and offsets should be set with explicit procedure calls.
+ *
+ * Returns: The newly copied layer.
+ **/
+gint32
+gimp_layer_new_from_drawable (gint32 drawable_ID,
+ gint32 dest_image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_copy_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-layer-new-from-drawable",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_IMAGE, dest_image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_copy_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_copy_ID;
+}
+
+/**
+ * gimp_layer_group_new:
+ * @image_ID: The image to which to add the layer group.
+ *
+ * Create a new layer group.
+ *
+ * This procedure creates a new layer group. Attributes such as layer
+ * mode and opacity should be set with explicit procedure calls. Add
+ * the new layer group (which is a kind of layer) with the
+ * gimp_image_insert_layer() command.
+ * Other procedures useful with layer groups:
+ * gimp_image_reorder_item(), gimp_item_get_parent(),
+ * gimp_item_get_children(), gimp_item_is_group().
+ *
+ * Returns: The newly created layer group.
+ *
+ * Since: 2.8
+ **/
+gint32
+gimp_layer_group_new (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_group_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-layer-group-new",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_group_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_group_ID;
+}
+
+/**
+ * _gimp_layer_copy:
+ * @layer_ID: The layer to copy.
+ * @add_alpha: Add an alpha channel to the copied layer.
+ *
+ * Copy a layer.
+ *
+ * This procedure copies the specified layer and returns the copy. The
+ * newly copied layer is for use within the original layer's image. It
+ * should not be subsequently added to any other image. The copied
+ * layer can optionally have an added alpha channel. This is useful if
+ * the background layer in an image is being copied and added to the
+ * same image.
+ *
+ * Returns: The newly copied layer.
+ **/
+gint32
+_gimp_layer_copy (gint32 layer_ID,
+ gboolean add_alpha)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_copy_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-layer-copy",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, add_alpha,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_copy_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_copy_ID;
+}
+
+/**
+ * gimp_layer_add_alpha:
+ * @layer_ID: The layer.
+ *
+ * Add an alpha channel to the layer if it doesn't already have one.
+ *
+ * This procedure adds an additional component to the specified layer
+ * if it does not already possess an alpha channel. An alpha channel
+ * makes it possible to clear and erase to transparency, instead of the
+ * background color. This transforms layers of type RGB to RGBA, GRAY
+ * to GRAYA, and INDEXED to INDEXEDA.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_add_alpha (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-add-alpha",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_flatten:
+ * @layer_ID: The layer.
+ *
+ * Remove the alpha channel from the layer if it has one.
+ *
+ * This procedure removes the alpha channel from a layer, blending all
+ * (partially) transparent pixels in the layer against the background
+ * color. This transforms layers of type RGBA to RGB, GRAYA to GRAY,
+ * and INDEXEDA to INDEXED.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_layer_flatten (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-flatten",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_scale:
+ * @layer_ID: The layer.
+ * @new_width: New layer width.
+ * @new_height: New layer height.
+ * @local_origin: Use a local origin (as opposed to the image origin).
+ *
+ * Scale the layer using the default interpolation method.
+ *
+ * This procedure scales the layer so that its new width and height are
+ * equal to the supplied parameters. The 'local-origin' parameter
+ * specifies whether to scale from the center of the layer, or from the
+ * image origin. This operation only works if the layer has been added
+ * to an image. The interpolation method used can be set with
+ * gimp_context_set_interpolation().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_scale (gint32 layer_ID,
+ gint new_width,
+ gint new_height,
+ gboolean local_origin)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-scale",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, new_width,
+ GIMP_PDB_INT32, new_height,
+ GIMP_PDB_INT32, local_origin,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_scale_full:
+ * @layer_ID: The layer.
+ * @new_width: New layer width.
+ * @new_height: New layer height.
+ * @local_origin: Use a local origin (as opposed to the image origin).
+ * @interpolation: Type of interpolation.
+ *
+ * Deprecated: Use gimp_layer_scale() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_layer_scale_full (gint32 layer_ID,
+ gint new_width,
+ gint new_height,
+ gboolean local_origin,
+ GimpInterpolationType interpolation)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-scale-full",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, new_width,
+ GIMP_PDB_INT32, new_height,
+ GIMP_PDB_INT32, local_origin,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_resize:
+ * @layer_ID: The layer.
+ * @new_width: New layer width.
+ * @new_height: New layer height.
+ * @offx: x offset between upper left corner of old and new layers: (old - new).
+ * @offy: y offset between upper left corner of old and new layers: (old - new).
+ *
+ * Resize the layer to the specified extents.
+ *
+ * This procedure resizes the layer so that its new width and height
+ * are equal to the supplied parameters. Offsets are also provided
+ * which describe the position of the previous layer's content. This
+ * operation only works if the layer has been added to an image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_resize (gint32 layer_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-resize",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, new_width,
+ GIMP_PDB_INT32, new_height,
+ GIMP_PDB_INT32, offx,
+ GIMP_PDB_INT32, offy,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_resize_to_image_size:
+ * @layer_ID: The layer to resize.
+ *
+ * Resize a layer to the image size.
+ *
+ * This procedure resizes the layer so that it's new width and height
+ * are equal to the width and height of its image container.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_resize_to_image_size (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-resize-to-image-size",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_translate:
+ * @layer_ID: The layer.
+ * @offx: Offset in x direction.
+ * @offy: Offset in y direction.
+ *
+ * Translate the layer by the specified offsets.
+ *
+ * This procedure translates the layer by the amounts specified in the
+ * x and y arguments. These can be negative, and are considered offsets
+ * from the current position. This command only works if the layer has
+ * been added to an image. All additional layers contained in the image
+ * which have the linked flag set to TRUE w ill also be translated by
+ * the specified offsets.
+ *
+ * Deprecated: Use gimp_item_transform_translate() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_translate (gint32 layer_ID,
+ gint offx,
+ gint offy)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-translate",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, offx,
+ GIMP_PDB_INT32, offy,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_set_offsets:
+ * @layer_ID: The layer.
+ * @offx: Offset in x direction.
+ * @offy: Offset in y direction.
+ *
+ * Set the layer offsets.
+ *
+ * This procedure sets the offsets for the specified layer. The offsets
+ * are relative to the image origin and can be any values. This
+ * operation is valid only on layers which have been added to an image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_set_offsets (gint32 layer_ID,
+ gint offx,
+ gint offy)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-set-offsets",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, offx,
+ GIMP_PDB_INT32, offy,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_create_mask:
+ * @layer_ID: The layer to which to add the mask.
+ * @mask_type: The type of mask.
+ *
+ * Create a layer mask for the specified layer.
+ *
+ * This procedure creates a layer mask for the specified layer.
+ * Layer masks serve as an additional alpha channel for a layer.
+ * Different types of masks are allowed for initialisation:
+ * - white mask (leaves the layer fully visible);
+ * - black mask (gives the layer complete transparency);
+ * - the layer's alpha channel (either a copy, or a transfer, which
+ * leaves the layer fully visible, but which may be more useful than a
+ * white mask);
+ * - the current selection;
+ * - a grayscale copy of the layer;
+ * - or a copy of the active channel.
+ *
+ * The layer mask still needs to be added to the layer. This can be
+ * done with a call to gimp_layer_add_mask().
+ *
+ * gimp_layer_create_mask() will fail if there are no active channels
+ * on the image, when called with 'ADD-CHANNEL-MASK'. It will return a
+ * black mask when called with 'ADD-ALPHA-MASK' or
+ * 'ADD-ALPHA-TRANSFER-MASK' on a layer with no alpha channels, or with
+ * 'ADD-SELECTION-MASK' when there is no selection on the image.
+ *
+ * Returns: The newly created mask.
+ **/
+gint32
+gimp_layer_create_mask (gint32 layer_ID,
+ GimpAddMaskType mask_type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 mask_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-layer-create-mask",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, mask_type,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ mask_ID = return_vals[1].data.d_layer_mask;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return mask_ID;
+}
+
+/**
+ * gimp_layer_get_mask:
+ * @layer_ID: The layer.
+ *
+ * Get the specified layer's mask if it exists.
+ *
+ * This procedure returns the specified layer's mask, or -1 if none
+ * exists.
+ *
+ * Returns: The layer mask.
+ **/
+gint32
+gimp_layer_get_mask (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 mask_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-layer-get-mask",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ mask_ID = return_vals[1].data.d_layer_mask;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return mask_ID;
+}
+
+/**
+ * gimp_layer_from_mask:
+ * @mask_ID: Mask for which to return the layer.
+ *
+ * Get the specified mask's layer.
+ *
+ * This procedure returns the specified mask's layer , or -1 if none
+ * exists.
+ *
+ * Returns: The mask's layer.
+ *
+ * Since: 2.2
+ **/
+gint32
+gimp_layer_from_mask (gint32 mask_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-layer-from-mask",
+ &nreturn_vals,
+ GIMP_PDB_CHANNEL, mask_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_layer_add_mask:
+ * @layer_ID: The layer to receive the mask.
+ * @mask_ID: The mask to add to the layer.
+ *
+ * Add a layer mask to the specified layer.
+ *
+ * This procedure adds a layer mask to the specified layer. Layer masks
+ * serve as an additional alpha channel for a layer. This procedure
+ * will fail if a number of prerequisites aren't met. The layer cannot
+ * already have a layer mask. The specified mask must exist and have
+ * the same dimensions as the layer. The layer must have been created
+ * for use with the specified image and the mask must have been created
+ * with the procedure 'gimp-layer-create-mask'.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_add_mask (gint32 layer_ID,
+ gint32 mask_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-add-mask",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_CHANNEL, mask_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_remove_mask:
+ * @layer_ID: The layer from which to remove mask.
+ * @mode: Removal mode.
+ *
+ * Remove the specified layer mask from the layer.
+ *
+ * This procedure removes the specified layer mask from the layer. If
+ * the mask doesn't exist, an error is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_remove_mask (gint32 layer_ID,
+ GimpMaskApplyMode mode)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-remove-mask",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, mode,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_is_floating_sel:
+ * @layer_ID: The layer.
+ *
+ * Is the specified layer a floating selection?
+ *
+ * This procedure returns whether the layer is a floating selection.
+ * Floating selections are special cases of layers which are attached
+ * to a specific drawable.
+ *
+ * Returns: TRUE if the layer is a floating selection.
+ **/
+gboolean
+gimp_layer_is_floating_sel (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean is_floating_sel = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-is-floating-sel",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ is_floating_sel = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return is_floating_sel;
+}
+
+/**
+ * gimp_layer_get_lock_alpha:
+ * @layer_ID: The layer.
+ *
+ * Get the lock alpha channel setting of the specified layer.
+ *
+ * This procedure returns the specified layer's lock alpha channel
+ * setting.
+ *
+ * Returns: The layer's lock alpha channel setting.
+ **/
+gboolean
+gimp_layer_get_lock_alpha (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean lock_alpha = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-get-lock-alpha",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ lock_alpha = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return lock_alpha;
+}
+
+/**
+ * gimp_layer_set_lock_alpha:
+ * @layer_ID: The layer.
+ * @lock_alpha: The new layer's lock alpha channel setting.
+ *
+ * Set the lock alpha channel setting of the specified layer.
+ *
+ * This procedure sets the specified layer's lock alpha channel
+ * setting.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_set_lock_alpha (gint32 layer_ID,
+ gboolean lock_alpha)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-set-lock-alpha",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, lock_alpha,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_get_apply_mask:
+ * @layer_ID: The layer.
+ *
+ * Get the apply mask setting of the specified layer.
+ *
+ * This procedure returns the specified layer's apply mask setting. If
+ * the value is TRUE, then the layer mask for this layer is currently
+ * being composited with the layer's alpha channel.
+ *
+ * Returns: The layer's apply mask setting.
+ **/
+gboolean
+gimp_layer_get_apply_mask (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean apply_mask = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-get-apply-mask",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ apply_mask = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return apply_mask;
+}
+
+/**
+ * gimp_layer_set_apply_mask:
+ * @layer_ID: The layer.
+ * @apply_mask: The new layer's apply mask setting.
+ *
+ * Set the apply mask setting of the specified layer.
+ *
+ * This procedure sets the specified layer's apply mask setting. This
+ * controls whether the layer's mask is currently affecting the alpha
+ * channel. If there is no layer mask, this function will return an
+ * error.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_set_apply_mask (gint32 layer_ID,
+ gboolean apply_mask)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-set-apply-mask",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, apply_mask,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_get_show_mask:
+ * @layer_ID: The layer.
+ *
+ * Get the show mask setting of the specified layer.
+ *
+ * This procedure returns the specified layer's show mask setting. This
+ * controls whether the layer or its mask is visible. TRUE indicates
+ * that the mask should be visible. If the layer has no mask, then this
+ * function returns an error.
+ *
+ * Returns: The layer's show mask setting.
+ **/
+gboolean
+gimp_layer_get_show_mask (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean show_mask = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-get-show-mask",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ show_mask = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return show_mask;
+}
+
+/**
+ * gimp_layer_set_show_mask:
+ * @layer_ID: The layer.
+ * @show_mask: The new layer's show mask setting.
+ *
+ * Set the show mask setting of the specified layer.
+ *
+ * This procedure sets the specified layer's show mask setting. This
+ * controls whether the layer or its mask is visible. TRUE indicates
+ * that the mask should be visible. If there is no layer mask, this
+ * function will return an error.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_set_show_mask (gint32 layer_ID,
+ gboolean show_mask)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-set-show-mask",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, show_mask,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_get_edit_mask:
+ * @layer_ID: The layer.
+ *
+ * Get the edit mask setting of the specified layer.
+ *
+ * This procedure returns the specified layer's edit mask setting. If
+ * the value is TRUE, then the layer mask for this layer is currently
+ * active, and not the layer.
+ *
+ * Returns: The layer's edit mask setting.
+ **/
+gboolean
+gimp_layer_get_edit_mask (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean edit_mask = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-get-edit-mask",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ edit_mask = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return edit_mask;
+}
+
+/**
+ * gimp_layer_set_edit_mask:
+ * @layer_ID: The layer.
+ * @edit_mask: The new layer's edit mask setting.
+ *
+ * Set the edit mask setting of the specified layer.
+ *
+ * This procedure sets the specified layer's edit mask setting. This
+ * controls whether the layer or it's mask is currently active for
+ * editing. If the specified layer has no layer mask, then this
+ * procedure will return an error.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_set_edit_mask (gint32 layer_ID,
+ gboolean edit_mask)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-set-edit-mask",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, edit_mask,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_get_opacity:
+ * @layer_ID: The layer.
+ *
+ * Get the opacity of the specified layer.
+ *
+ * This procedure returns the specified layer's opacity.
+ *
+ * Returns: The layer opacity.
+ **/
+gdouble
+gimp_layer_get_opacity (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble opacity = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-layer-get-opacity",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ opacity = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return opacity;
+}
+
+/**
+ * gimp_layer_set_opacity:
+ * @layer_ID: The layer.
+ * @opacity: The new layer opacity.
+ *
+ * Set the opacity of the specified layer.
+ *
+ * This procedure sets the specified layer's opacity.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_set_opacity (gint32 layer_ID,
+ gdouble opacity)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-set-opacity",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_FLOAT, opacity,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_get_mode:
+ * @layer_ID: The layer.
+ *
+ * Get the combination mode of the specified layer.
+ *
+ * This procedure returns the specified layer's combination mode.
+ *
+ * Returns: The layer combination mode.
+ **/
+GimpLayerMode
+gimp_layer_get_mode (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpLayerMode mode = 0;
+
+ return_vals = gimp_run_procedure ("gimp-layer-get-mode",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ mode = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return mode;
+}
+
+/**
+ * gimp_layer_set_mode:
+ * @layer_ID: The layer.
+ * @mode: The new layer combination mode.
+ *
+ * Set the combination mode of the specified layer.
+ *
+ * This procedure sets the specified layer's combination mode.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_set_mode (gint32 layer_ID,
+ GimpLayerMode mode)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-set-mode",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, mode,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_get_blend_space:
+ * @layer_ID: The layer.
+ *
+ * Get the blend space of the specified layer.
+ *
+ * This procedure returns the specified layer's blend space.
+ *
+ * Returns: The layer blend space.
+ *
+ * Since: 2.10
+ **/
+GimpLayerColorSpace
+gimp_layer_get_blend_space (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpLayerColorSpace blend_space = 0;
+
+ return_vals = gimp_run_procedure ("gimp-layer-get-blend-space",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ blend_space = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return blend_space;
+}
+
+/**
+ * gimp_layer_set_blend_space:
+ * @layer_ID: The layer.
+ * @blend_space: The new layer blend space.
+ *
+ * Set the blend space of the specified layer.
+ *
+ * This procedure sets the specified layer's blend space.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_layer_set_blend_space (gint32 layer_ID,
+ GimpLayerColorSpace blend_space)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-set-blend-space",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, blend_space,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_get_composite_space:
+ * @layer_ID: The layer.
+ *
+ * Get the composite space of the specified layer.
+ *
+ * This procedure returns the specified layer's composite space.
+ *
+ * Returns: The layer composite space.
+ *
+ * Since: 2.10
+ **/
+GimpLayerColorSpace
+gimp_layer_get_composite_space (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpLayerColorSpace composite_space = 0;
+
+ return_vals = gimp_run_procedure ("gimp-layer-get-composite-space",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ composite_space = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return composite_space;
+}
+
+/**
+ * gimp_layer_set_composite_space:
+ * @layer_ID: The layer.
+ * @composite_space: The new layer composite space.
+ *
+ * Set the composite space of the specified layer.
+ *
+ * This procedure sets the specified layer's composite space.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_layer_set_composite_space (gint32 layer_ID,
+ GimpLayerColorSpace composite_space)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-set-composite-space",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, composite_space,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_get_composite_mode:
+ * @layer_ID: The layer.
+ *
+ * Get the composite mode of the specified layer.
+ *
+ * This procedure returns the specified layer's composite mode.
+ *
+ * Returns: The layer composite mode.
+ *
+ * Since: 2.10
+ **/
+GimpLayerCompositeMode
+gimp_layer_get_composite_mode (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpLayerCompositeMode composite_mode = 0;
+
+ return_vals = gimp_run_procedure ("gimp-layer-get-composite-mode",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ composite_mode = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return composite_mode;
+}
+
+/**
+ * gimp_layer_set_composite_mode:
+ * @layer_ID: The layer.
+ * @composite_mode: The new layer composite mode.
+ *
+ * Set the composite mode of the specified layer.
+ *
+ * This procedure sets the specified layer's composite mode.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_layer_set_composite_mode (gint32 layer_ID,
+ GimpLayerCompositeMode composite_mode)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-set-composite-mode",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, composite_mode,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimplayer_pdb.h b/libgimp/gimplayer_pdb.h
new file mode 100644
index 0000000..79e34ad
--- /dev/null
+++ b/libgimp/gimplayer_pdb.h
@@ -0,0 +1,115 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimplayer_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_LAYER_PDB_H__
+#define __GIMP_LAYER_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+G_GNUC_INTERNAL gint32 _gimp_layer_new (gint32 image_ID,
+ gint width,
+ gint height,
+ GimpImageType type,
+ const gchar *name,
+ gdouble opacity,
+ GimpLayerMode mode);
+gint32 gimp_layer_new_from_visible (gint32 image_ID,
+ gint32 dest_image_ID,
+ const gchar *name);
+gint32 gimp_layer_new_from_drawable (gint32 drawable_ID,
+ gint32 dest_image_ID);
+gint32 gimp_layer_group_new (gint32 image_ID);
+G_GNUC_INTERNAL gint32 _gimp_layer_copy (gint32 layer_ID,
+ gboolean add_alpha);
+gboolean gimp_layer_add_alpha (gint32 layer_ID);
+gboolean gimp_layer_flatten (gint32 layer_ID);
+gboolean gimp_layer_scale (gint32 layer_ID,
+ gint new_width,
+ gint new_height,
+ gboolean local_origin);
+GIMP_DEPRECATED_FOR(gimp_layer_scale)
+gboolean gimp_layer_scale_full (gint32 layer_ID,
+ gint new_width,
+ gint new_height,
+ gboolean local_origin,
+ GimpInterpolationType interpolation);
+gboolean gimp_layer_resize (gint32 layer_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy);
+gboolean gimp_layer_resize_to_image_size (gint32 layer_ID);
+GIMP_DEPRECATED_FOR(gimp_item_transform_translate)
+gboolean gimp_layer_translate (gint32 layer_ID,
+ gint offx,
+ gint offy);
+gboolean gimp_layer_set_offsets (gint32 layer_ID,
+ gint offx,
+ gint offy);
+gint32 gimp_layer_create_mask (gint32 layer_ID,
+ GimpAddMaskType mask_type);
+gint32 gimp_layer_get_mask (gint32 layer_ID);
+gint32 gimp_layer_from_mask (gint32 mask_ID);
+gboolean gimp_layer_add_mask (gint32 layer_ID,
+ gint32 mask_ID);
+gboolean gimp_layer_remove_mask (gint32 layer_ID,
+ GimpMaskApplyMode mode);
+gboolean gimp_layer_is_floating_sel (gint32 layer_ID);
+gboolean gimp_layer_get_lock_alpha (gint32 layer_ID);
+gboolean gimp_layer_set_lock_alpha (gint32 layer_ID,
+ gboolean lock_alpha);
+gboolean gimp_layer_get_apply_mask (gint32 layer_ID);
+gboolean gimp_layer_set_apply_mask (gint32 layer_ID,
+ gboolean apply_mask);
+gboolean gimp_layer_get_show_mask (gint32 layer_ID);
+gboolean gimp_layer_set_show_mask (gint32 layer_ID,
+ gboolean show_mask);
+gboolean gimp_layer_get_edit_mask (gint32 layer_ID);
+gboolean gimp_layer_set_edit_mask (gint32 layer_ID,
+ gboolean edit_mask);
+gdouble gimp_layer_get_opacity (gint32 layer_ID);
+gboolean gimp_layer_set_opacity (gint32 layer_ID,
+ gdouble opacity);
+GimpLayerMode gimp_layer_get_mode (gint32 layer_ID);
+gboolean gimp_layer_set_mode (gint32 layer_ID,
+ GimpLayerMode mode);
+GimpLayerColorSpace gimp_layer_get_blend_space (gint32 layer_ID);
+gboolean gimp_layer_set_blend_space (gint32 layer_ID,
+ GimpLayerColorSpace blend_space);
+GimpLayerColorSpace gimp_layer_get_composite_space (gint32 layer_ID);
+gboolean gimp_layer_set_composite_space (gint32 layer_ID,
+ GimpLayerColorSpace composite_space);
+GimpLayerCompositeMode gimp_layer_get_composite_mode (gint32 layer_ID);
+gboolean gimp_layer_set_composite_mode (gint32 layer_ID,
+ GimpLayerCompositeMode composite_mode);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_LAYER_PDB_H__ */
diff --git a/libgimp/gimpmenu.c b/libgimp/gimpmenu.c
new file mode 100644
index 0000000..7f788d5
--- /dev/null
+++ b/libgimp/gimpmenu.c
@@ -0,0 +1,509 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpmenu.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "gimp.h"
+
+#include "gimppixbuf.h"
+
+#undef GIMP_DISABLE_DEPRECATED
+#include "gimpmenu.h"
+
+#include "libgimp-intl.h"
+
+
+/**
+ * SECTION: gimpmenu
+ * @title: gimpmenu
+ * @short_description: Menus for selecting images, layers, channels
+ * and drawables.
+ *
+ * Menus for selecting images, layers, channels and drawables.
+ **/
+
+
+#define MENU_THUMBNAIL_WIDTH 24
+#define MENU_THUMBNAIL_HEIGHT 24
+
+
+/* local function prototypes */
+
+static GtkWidget * gimp_menu_make_menu (GimpMenuCallback callback,
+ gpointer data);
+static GtkWidget * gimp_menu_add_item (GtkWidget *menu,
+ const gchar *image_name,
+ const gchar *drawable_name,
+ gint32 any_ID);
+static GtkWidget * gimp_menu_add_empty (GtkWidget *menu);
+static GtkWidget * gimp_menu_make_preview (gint32 any_ID,
+ gboolean is_image,
+ gint width,
+ gint height);
+static void gimp_menu_callback (GtkWidget *widget,
+ gpointer any_ID);
+
+
+/* public functions */
+
+/**
+ * gimp_image_menu_new:
+ * @constraint: a function to filter the menu contents
+ * @callback: the callback to call when an image is selected
+ * @data: the callback's user_data
+ * @active_image: an image to preselect
+ *
+ * Deprecated: Use gimp_image_combo_box_new() instead.
+ *
+ * Returns: the image menu.
+ */
+GtkWidget *
+gimp_image_menu_new (GimpConstraintFunc constraint,
+ GimpMenuCallback callback,
+ gpointer data,
+ gint32 active_image)
+{
+ GtkWidget *menu;
+ gchar *name;
+ gchar *label;
+ gint32 *images;
+ gint32 image = -1;
+ gint n_images;
+ gint i, k;
+
+ g_return_val_if_fail (callback != NULL, NULL);
+
+ menu = gimp_menu_make_menu (callback, data);
+
+ images = gimp_image_list (&n_images);
+
+ for (i = 0, k = 0; i < n_images; i++)
+ if (! constraint || (* constraint) (images[i], -1, data))
+ {
+ name = gimp_image_get_name (images[i]);
+ label = g_strdup_printf ("%s-%d", name, images[i]);
+ g_free (name);
+
+ gimp_menu_add_item (menu, label, NULL, images[i]);
+
+ g_free (label);
+
+ if (images[i] == active_image)
+ {
+ image = active_image;
+ gtk_menu_set_active (GTK_MENU (menu), k);
+ }
+ else if (image == -1)
+ {
+ image = images[i];
+ }
+
+ k += 1;
+ }
+
+ if (k == 0)
+ gimp_menu_add_empty (menu);
+
+ (* callback) (image, data);
+
+ g_free (images);
+
+ return menu;
+}
+
+/**
+ * gimp_layer_menu_new:
+ * @constraint: a function to filter the menu contents
+ * @callback: the callback to call when a channel is selected
+ * @data: the callback's user_data
+ * @active_layer: a layer to preselect
+ *
+ * Deprecated: Use gimp_layer_combo_box_new() instead.
+ *
+ * Returns: the layer menu.
+ */
+GtkWidget *
+gimp_layer_menu_new (GimpConstraintFunc constraint,
+ GimpMenuCallback callback,
+ gpointer data,
+ gint32 active_layer)
+{
+ GtkWidget *menu;
+ gchar *image_label;
+ gint32 *images;
+ gint32 *layers;
+ gint32 layer = -1;
+ gint n_images;
+ gint n_layers;
+ gint i, j, k;
+
+ g_return_val_if_fail (callback != NULL, NULL);
+
+ menu = gimp_menu_make_menu (callback, data);
+
+ images = gimp_image_list (&n_images);
+
+ for (i = 0, k = 0; i < n_images; i++)
+ if (! constraint || (* constraint) (images[i], -1, data))
+ {
+ gchar *name;
+
+ name = gimp_image_get_name (images[i]);
+ image_label = g_strdup_printf ("%s-%d", name, images[i]);
+ g_free (name);
+
+ layers = gimp_image_get_layers (images[i], &n_layers);
+
+ for (j = 0; j < n_layers; j++)
+ if (! constraint || (* constraint) (images[i], layers[j], data))
+ {
+ name = gimp_item_get_name (layers[j]);
+ gimp_menu_add_item (menu, image_label, name, layers[j]);
+ g_free (name);
+
+ if (layers[j] == active_layer)
+ {
+ layer = active_layer;
+ gtk_menu_set_active (GTK_MENU (menu), k);
+ }
+ else if (layer == -1)
+ {
+ layer = layers[j];
+ }
+
+ k += 1;
+ }
+
+ g_free (image_label);
+ g_free (layers);
+ }
+
+ g_free (images);
+
+ if (k == 0)
+ gimp_menu_add_empty (menu);
+
+ (* callback) (layer, data);
+
+ return menu;
+}
+
+/**
+ * gimp_channel_menu_new:
+ * @constraint: a function to filter the menu contents
+ * @callback: the callback to call when a channel is selected
+ * @data: the callback's user_data
+ * @active_channel: a channel to preselect
+ *
+ * Deprecated: Use gimp_channel_combo_box_new() instead.
+ *
+ * Returns: the channel menu.
+ */
+GtkWidget *
+gimp_channel_menu_new (GimpConstraintFunc constraint,
+ GimpMenuCallback callback,
+ gpointer data,
+ gint32 active_channel)
+{
+ GtkWidget *menu;
+ gchar *image_label;
+ gint32 *images;
+ gint32 *channels;
+ gint32 channel;
+ gint n_images;
+ gint n_channels;
+ gint i, j, k;
+
+ g_return_val_if_fail (callback != NULL, NULL);
+
+ menu = gimp_menu_make_menu (callback, data);
+
+ channel = -1;
+
+ images = gimp_image_list (&n_images);
+
+ for (i = 0, k = 0; i < n_images; i++)
+ if (! constraint || (* constraint) (images[i], -1, data))
+ {
+ gchar *name;
+
+ name = gimp_image_get_name (images[i]);
+ image_label = g_strdup_printf ("%s-%d", name, images[i]);
+ g_free (name);
+
+ channels = gimp_image_get_channels (images[i], &n_channels);
+
+ for (j = 0; j < n_channels; j++)
+ if (! constraint || (* constraint) (images[i], channels[j], data))
+ {
+ name = gimp_item_get_name (channels[j]);
+ gimp_menu_add_item (menu, image_label, name, channels[j]);
+ g_free (name);
+
+ if (channels[j] == active_channel)
+ {
+ channel = active_channel;
+ gtk_menu_set_active (GTK_MENU (menu), k);
+ }
+ else if (channel == -1)
+ {
+ channel = channels[j];
+ }
+
+ k += 1;
+ }
+
+ g_free (image_label);
+ g_free (channels);
+ }
+
+ g_free (images);
+
+ if (k == 0)
+ gimp_menu_add_empty (menu);
+
+ (* callback) (channel, data);
+
+ return menu;
+}
+
+/**
+ * gimp_drawable_menu_new:
+ * @constraint: a function to filter the menu contents
+ * @callback: the callback to call when a channel is selected
+ * @data: the callback's user_data
+ * @active_drawable: a drawable to preselect
+ *
+ * Deprecated: Use gimp_drawable_combo_box_new() instead.
+ *
+ * Returns: the drawable menu.
+ */
+GtkWidget *
+gimp_drawable_menu_new (GimpConstraintFunc constraint,
+ GimpMenuCallback callback,
+ gpointer data,
+ gint32 active_drawable)
+{
+ GtkWidget *menu;
+ gchar *name;
+ gchar *image_label;
+ gint32 *images;
+ gint32 *layers;
+ gint32 *channels;
+ gint32 drawable;
+ gint n_images;
+ gint n_layers;
+ gint n_channels;
+ gint i, j, k;
+
+ menu = gimp_menu_make_menu (callback, data);
+
+ drawable = -1;
+
+ images = gimp_image_list (&n_images);
+
+ for (i = 0, k = 0; i < n_images; i++)
+ if (! constraint || (* constraint) (images[i], -1, data))
+ {
+ name = gimp_image_get_name (images[i]);
+ image_label = g_strdup_printf ("%s-%d", name, images[i]);
+ g_free (name);
+
+ layers = gimp_image_get_layers (images[i], &n_layers);
+ channels = gimp_image_get_channels (images[i], &n_channels);
+
+ for (j = 0; j < n_layers; j++)
+ if (! constraint || (* constraint) (images[i], layers[j], data))
+ {
+ name = gimp_item_get_name (layers[j]);
+ gimp_menu_add_item (menu, image_label, name, layers[j]);
+ g_free (name);
+
+ if (layers[j] == active_drawable)
+ {
+ drawable = active_drawable;
+ gtk_menu_set_active (GTK_MENU (menu), k);
+ }
+ else if (drawable == -1)
+ {
+ drawable = layers[j];
+ }
+
+ k += 1;
+ }
+
+ for (j = 0; j < n_channels; j++)
+ if (! constraint || (* constraint) (images[i], channels[j], data))
+ {
+ name = gimp_item_get_name (channels[j]);
+ gimp_menu_add_item (menu, image_label, name, channels[j]);
+ g_free (name);
+
+ if (channels[j] == active_drawable)
+ {
+ drawable = active_drawable;
+ gtk_menu_set_active (GTK_MENU (menu), k);
+ }
+ else if (drawable == -1)
+ {
+ drawable = channels[j];
+ }
+
+ k += 1;
+ }
+
+ g_free (image_label);
+ g_free (layers);
+ g_free (channels);
+ }
+
+ g_free (images);
+
+ if (k == 0)
+ gimp_menu_add_empty (menu);
+
+ (* callback) (drawable, data);
+
+ return menu;
+}
+
+
+/* private functions */
+
+static GtkWidget *
+gimp_menu_make_menu (GimpMenuCallback callback,
+ gpointer data)
+{
+ GtkWidget *menu;
+
+ menu = gtk_menu_new ();
+ g_object_set_data (G_OBJECT (menu), "gimp-menu-callback", callback);
+ g_object_set_data (G_OBJECT (menu), "gimp-menu-callback-data", data);
+
+ return menu;
+}
+
+static GtkWidget *
+gimp_menu_add_item (GtkWidget *menu,
+ const gchar *image_name,
+ const gchar *drawable_name,
+ gint32 any_ID)
+{
+ GtkWidget *menuitem;
+ GtkWidget *hbox;
+ GtkWidget *vbox;
+ GtkWidget *preview;
+ GtkWidget *label;
+ gchar *str;
+
+ if (drawable_name)
+ str = g_strdup_printf ("%s/%s-%d", image_name, drawable_name, any_ID);
+ else
+ str = g_strdup (image_name);
+
+ menuitem = gtk_menu_item_new ();
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+ gtk_widget_show (menuitem);
+
+ g_signal_connect (menuitem, "activate",
+ G_CALLBACK (gimp_menu_callback),
+ GINT_TO_POINTER (any_ID));
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+ gtk_container_add (GTK_CONTAINER (menuitem), hbox);
+ gtk_widget_show (hbox);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
+ gtk_widget_show (vbox);
+
+ preview = gimp_menu_make_preview (any_ID, drawable_name == NULL,
+ MENU_THUMBNAIL_WIDTH,
+ MENU_THUMBNAIL_HEIGHT);
+ gtk_box_pack_start (GTK_BOX (vbox), preview, TRUE, TRUE, 0);
+ gtk_widget_show (preview);
+
+ label = gtk_label_new (str);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ g_free (str);
+
+ return menuitem;
+}
+
+static GtkWidget *
+gimp_menu_add_empty (GtkWidget *menu)
+{
+ GtkWidget *menuitem;
+
+ menuitem = gtk_menu_item_new_with_label (_("(Empty)"));
+ gtk_widget_set_sensitive (menuitem, FALSE);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+ gtk_widget_show (menuitem);
+
+ return menuitem;
+}
+
+static GtkWidget *
+gimp_menu_make_preview (gint32 any_ID,
+ gboolean is_image,
+ gint width,
+ gint height)
+{
+ GtkWidget *image;
+ GdkPixbuf *pixbuf;
+
+ if (is_image)
+ pixbuf = gimp_image_get_thumbnail (any_ID,
+ width, height,
+ GIMP_PIXBUF_SMALL_CHECKS);
+ else
+ pixbuf = gimp_drawable_get_thumbnail (any_ID,
+ width, height,
+ GIMP_PIXBUF_SMALL_CHECKS);
+
+ image = gtk_image_new_from_pixbuf (pixbuf);
+
+ g_object_unref (pixbuf);
+
+ return image;
+}
+
+static void
+gimp_menu_callback (GtkWidget *widget,
+ gpointer any_ID)
+{
+ GtkWidget *parent = gtk_widget_get_parent (widget);
+ GimpMenuCallback callback;
+ gpointer callback_data;
+
+ callback = (GimpMenuCallback) g_object_get_data (G_OBJECT (parent),
+ "gimp-menu-callback");
+ callback_data = g_object_get_data (G_OBJECT (parent),
+ "gimp-menu-callback-data");
+
+ (* callback) (GPOINTER_TO_INT (any_ID), callback_data);
+}
diff --git a/libgimp/gimpmenu.h b/libgimp/gimpmenu.h
new file mode 100644
index 0000000..bb4648a
--- /dev/null
+++ b/libgimp/gimpmenu.h
@@ -0,0 +1,68 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpmenu.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_MENU_H__
+#define __GIMP_MENU_H__
+
+/* These functions are deprecated and should not be used in newly
+ * written code.
+ */
+
+G_BEGIN_DECLS
+
+#ifndef GIMP_DISABLE_DEPRECATED
+
+typedef gboolean (* GimpConstraintFunc) (gint32 image_id,
+ gint32 drawable_id,
+ gpointer data);
+typedef void (* GimpMenuCallback) (gint32 any_id,
+ gpointer data);
+
+
+GIMP_DEPRECATED_FOR(gimp_image_combo_box_new)
+GtkWidget * gimp_image_menu_new (GimpConstraintFunc constraint,
+ GimpMenuCallback callback,
+ gpointer data,
+ gint32 active_image);
+GIMP_DEPRECATED_FOR(gimp_layer_combo_box_new)
+GtkWidget * gimp_layer_menu_new (GimpConstraintFunc constraint,
+ GimpMenuCallback callback,
+ gpointer data,
+ gint32 active_layer);
+GIMP_DEPRECATED_FOR(gimp_channel_combo_box_new)
+GtkWidget * gimp_channel_menu_new (GimpConstraintFunc constraint,
+ GimpMenuCallback callback,
+ gpointer data,
+ gint32 active_channel);
+GIMP_DEPRECATED_FOR(gimp_drawable_combo_box_new)
+GtkWidget * gimp_drawable_menu_new (GimpConstraintFunc constraint,
+ GimpMenuCallback callback,
+ gpointer data,
+ gint32 active_drawable);
+
+#endif /* GIMP_DISABLE_DEPRECATED */
+
+G_END_DECLS
+
+#endif /* __GIMP_MENU_H__ */
diff --git a/libgimp/gimpmessage_pdb.c b/libgimp/gimpmessage_pdb.c
new file mode 100644
index 0000000..3dce5f3
--- /dev/null
+++ b/libgimp/gimpmessage_pdb.c
@@ -0,0 +1,126 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpmessage_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpmessage
+ * @title: gimpmessage
+ * @short_description: Display a dialog box with a message.
+ *
+ * Display a dialog box with a message.
+ **/
+
+
+/**
+ * gimp_message:
+ * @message: Message to display in the dialog.
+ *
+ * Displays a dialog box with a message.
+ *
+ * Displays a dialog box with a message. Useful for status or error
+ * reporting. The message must be in UTF-8 encoding.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_message (const gchar *message)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-message",
+ &nreturn_vals,
+ GIMP_PDB_STRING, message,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_message_get_handler:
+ *
+ * Returns the current state of where warning messages are displayed.
+ *
+ * This procedure returns the way g_message warnings are displayed.
+ * They can be shown in a dialog box or printed on the console where
+ * gimp was started.
+ *
+ * Returns: The current handler type.
+ **/
+GimpMessageHandlerType
+gimp_message_get_handler (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpMessageHandlerType handler = 0;
+
+ return_vals = gimp_run_procedure ("gimp-message-get-handler",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ handler = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return handler;
+}
+
+/**
+ * gimp_message_set_handler:
+ * @handler: The new handler type.
+ *
+ * Controls where warning messages are displayed.
+ *
+ * This procedure controls how g_message warnings are displayed. They
+ * can be shown in a dialog box or printed on the console where gimp
+ * was started.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_message_set_handler (GimpMessageHandlerType handler)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-message-set-handler",
+ &nreturn_vals,
+ GIMP_PDB_INT32, handler,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpmessage_pdb.h b/libgimp/gimpmessage_pdb.h
new file mode 100644
index 0000000..a23fe59
--- /dev/null
+++ b/libgimp/gimpmessage_pdb.h
@@ -0,0 +1,42 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpmessage_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_MESSAGE_PDB_H__
+#define __GIMP_MESSAGE_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_message (const gchar *message);
+GimpMessageHandlerType gimp_message_get_handler (void);
+gboolean gimp_message_set_handler (GimpMessageHandlerType handler);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_MESSAGE_PDB_H__ */
diff --git a/libgimp/gimppainttools_pdb.c b/libgimp/gimppainttools_pdb.c
new file mode 100644
index 0000000..f03b43a
--- /dev/null
+++ b/libgimp/gimppainttools_pdb.c
@@ -0,0 +1,775 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppainttools_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimppainttools
+ * @title: gimppainttools
+ * @short_description: Access to toolbox paint tools.
+ *
+ * Functions giving access to toolbox paint tools.
+ **/
+
+
+/**
+ * gimp_airbrush:
+ * @drawable_ID: The affected drawable.
+ * @pressure: The pressure of the airbrush strokes.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Paint in the current brush with varying pressure. Paint application
+ * is time-dependent.
+ *
+ * This tool simulates the use of an airbrush. Paint pressure
+ * represents the relative intensity of the paint application. High
+ * pressure results in a thicker layer of paint while low pressure
+ * results in a thinner layer.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_airbrush (gint32 drawable_ID,
+ gdouble pressure,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-airbrush",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, pressure,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_airbrush_default:
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Paint in the current brush with varying pressure. Paint application
+ * is time-dependent.
+ *
+ * This tool simulates the use of an airbrush. It is similar to
+ * gimp_airbrush() except that the pressure is derived from the
+ * airbrush tools options box. It the option has not been set the
+ * default for the option will be used.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_airbrush_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-airbrush-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_clone:
+ * @drawable_ID: The affected drawable.
+ * @src_drawable_ID: The source drawable.
+ * @clone_type: The type of clone.
+ * @src_x: The x coordinate in the source image.
+ * @src_y: The y coordinate in the source image.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Clone from the source to the dest drawable using the current brush
+ *
+ * This tool clones (copies) from the source drawable starting at the
+ * specified source coordinates to the dest drawable. If the
+ * \"clone_type\" argument is set to PATTERN-CLONE, then the current
+ * pattern is used as the source and the \"src_drawable\" argument is
+ * ignored. Pattern cloning assumes a tileable pattern and mods the sum
+ * of the src coordinates and subsequent stroke offsets with the width
+ * and height of the pattern. For image cloning, if the sum of the src
+ * coordinates and subsequent stroke offsets exceeds the extents of the
+ * src drawable, then no paint is transferred. The clone tool is
+ * capable of transforming between any image types including
+ * RGB-&gt;Indexed--although converting from any type to indexed is
+ * significantly slower.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_clone (gint32 drawable_ID,
+ gint32 src_drawable_ID,
+ GimpCloneType clone_type,
+ gdouble src_x,
+ gdouble src_y,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-clone",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_DRAWABLE, src_drawable_ID,
+ GIMP_PDB_INT32, clone_type,
+ GIMP_PDB_FLOAT, src_x,
+ GIMP_PDB_FLOAT, src_y,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_clone_default:
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Clone from the source to the dest drawable using the current brush
+ *
+ * This tool clones (copies) from the source drawable starting at the
+ * specified source coordinates to the dest drawable. This function
+ * performs exactly the same as the gimp_clone() function except that
+ * the tools arguments are obtained from the clones option dialog. It
+ * this dialog has not been activated then the dialogs default values
+ * will be used.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_clone_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-clone-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_convolve:
+ * @drawable_ID: The affected drawable.
+ * @pressure: The pressure.
+ * @convolve_type: Convolve type.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Convolve (Blur, Sharpen) using the current brush.
+ *
+ * This tool convolves the specified drawable with either a sharpening
+ * or blurring kernel. The pressure parameter controls the magnitude of
+ * the operation. Like the paintbrush, this tool linearly interpolates
+ * between the specified stroke coordinates.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_convolve (gint32 drawable_ID,
+ gdouble pressure,
+ GimpConvolveType convolve_type,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-convolve",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, pressure,
+ GIMP_PDB_INT32, convolve_type,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_convolve_default:
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Convolve (Blur, Sharpen) using the current brush.
+ *
+ * This tool convolves the specified drawable with either a sharpening
+ * or blurring kernel. This function performs exactly the same as the
+ * gimp_convolve() function except that the tools arguments are
+ * obtained from the convolve option dialog. It this dialog has not
+ * been activated then the dialogs default values will be used.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_convolve_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-convolve-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_dodgeburn:
+ * @drawable_ID: The affected drawable.
+ * @exposure: The exposure of the strokes.
+ * @dodgeburn_type: The type either dodge or burn.
+ * @dodgeburn_mode: The mode.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Dodgeburn image with varying exposure.
+ *
+ * Dodgeburn. More details here later.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_dodgeburn (gint32 drawable_ID,
+ gdouble exposure,
+ GimpDodgeBurnType dodgeburn_type,
+ GimpTransferMode dodgeburn_mode,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-dodgeburn",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, exposure,
+ GIMP_PDB_INT32, dodgeburn_type,
+ GIMP_PDB_INT32, dodgeburn_mode,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_dodgeburn_default:
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Dodgeburn image with varying exposure. This is the same as the
+ * gimp_dodgeburn() function except that the exposure, type and mode
+ * are taken from the tools option dialog. If the dialog has not been
+ * activated then the defaults as used by the dialog will be used.
+ *
+ * Dodgeburn. More details here later.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_dodgeburn_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-dodgeburn-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_eraser:
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @hardness: How to apply the brush.
+ * @method: The paint method to use.
+ *
+ * Erase using the current brush.
+ *
+ * This tool erases using the current brush mask. If the specified
+ * drawable contains an alpha channel, then the erased pixels will
+ * become transparent. Otherwise, the eraser tool replaces the contents
+ * of the drawable with the background color. Like paintbrush, this
+ * tool linearly interpolates between the specified stroke coordinates.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_eraser (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes,
+ GimpBrushApplicationMode hardness,
+ GimpPaintApplicationMode method)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-eraser",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_INT32, hardness,
+ GIMP_PDB_INT32, method,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_eraser_default:
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Erase using the current brush.
+ *
+ * This tool erases using the current brush mask. This function
+ * performs exactly the same as the gimp_eraser() function except that
+ * the tools arguments are obtained from the eraser option dialog. It
+ * this dialog has not been activated then the dialogs default values
+ * will be used.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_eraser_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-eraser-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_heal:
+ * @drawable_ID: The affected drawable.
+ * @src_drawable_ID: The source drawable.
+ * @src_x: The x coordinate in the source image.
+ * @src_y: The y coordinate in the source image.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Heal from the source to the dest drawable using the current brush
+ *
+ * This tool heals the source drawable starting at the specified source
+ * coordinates to the dest drawable. For image healing, if the sum of
+ * the src coordinates and subsequent stroke offsets exceeds the
+ * extents of the src drawable, then no paint is transferred. The
+ * healing tool is capable of transforming between any image types
+ * except RGB-&gt;Indexed.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_heal (gint32 drawable_ID,
+ gint32 src_drawable_ID,
+ gdouble src_x,
+ gdouble src_y,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-heal",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_DRAWABLE, src_drawable_ID,
+ GIMP_PDB_FLOAT, src_x,
+ GIMP_PDB_FLOAT, src_y,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_heal_default:
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Heal from the source to the dest drawable using the current brush
+ *
+ * This tool heals from the source drawable starting at the specified
+ * source coordinates to the dest drawable. This function performs
+ * exactly the same as the gimp_heal() function except that the tools
+ * arguments are obtained from the healing option dialog. It this
+ * dialog has not been activated then the dialogs default values will
+ * be used.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_heal_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-heal-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_paintbrush:
+ * @drawable_ID: The affected drawable.
+ * @fade_out: Fade out parameter.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @method: The paint method to use.
+ * @gradient_length: Length of gradient to draw.
+ *
+ * Paint in the current brush with optional fade out parameter and pull
+ * colors from a gradient.
+ *
+ * This tool is the standard paintbrush. It draws linearly interpolated
+ * lines through the specified stroke coordinates. It operates on the
+ * specified drawable in the foreground color with the active brush.
+ * The 'fade-out' parameter is measured in pixels and allows the brush
+ * stroke to linearly fall off. The pressure is set to the maximum at
+ * the beginning of the stroke. As the distance of the stroke nears the
+ * fade-out value, the pressure will approach zero. The gradient-length
+ * is the distance to spread the gradient over. It is measured in
+ * pixels. If the gradient-length is 0, no gradient is used.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_paintbrush (gint32 drawable_ID,
+ gdouble fade_out,
+ gint num_strokes,
+ const gdouble *strokes,
+ GimpPaintApplicationMode method,
+ gdouble gradient_length)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-paintbrush",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, fade_out,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_INT32, method,
+ GIMP_PDB_FLOAT, gradient_length,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_paintbrush_default:
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Paint in the current brush. The fade out parameter and pull colors
+ * from a gradient parameter are set from the paintbrush options
+ * dialog. If this dialog has not been activated then the dialog
+ * defaults will be used.
+ *
+ * This tool is similar to the standard paintbrush. It draws linearly
+ * interpolated lines through the specified stroke coordinates. It
+ * operates on the specified drawable in the foreground color with the
+ * active brush. The 'fade-out' parameter is measured in pixels and
+ * allows the brush stroke to linearly fall off (value obtained from
+ * the option dialog). The pressure is set to the maximum at the
+ * beginning of the stroke. As the distance of the stroke nears the
+ * fade-out value, the pressure will approach zero. The gradient-length
+ * (value obtained from the option dialog) is the distance to spread
+ * the gradient over. It is measured in pixels. If the gradient-length
+ * is 0, no gradient is used.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_paintbrush_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-paintbrush-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_pencil:
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Paint in the current brush without sub-pixel sampling.
+ *
+ * This tool is the standard pencil. It draws linearly interpolated
+ * lines through the specified stroke coordinates. It operates on the
+ * specified drawable in the foreground color with the active brush.
+ * The brush mask is treated as though it contains only black and white
+ * values. Any value below half is treated as black; any above half, as
+ * white.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_pencil (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-pencil",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_smudge:
+ * @drawable_ID: The affected drawable.
+ * @pressure: The pressure of the smudge strokes.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Smudge image with varying pressure.
+ *
+ * This tool simulates a smudge using the current brush. High pressure
+ * results in a greater smudge of paint while low pressure results in a
+ * lesser smudge.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_smudge (gint32 drawable_ID,
+ gdouble pressure,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-smudge",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, pressure,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_smudge_default:
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Smudge image with varying pressure.
+ *
+ * This tool simulates a smudge using the current brush. It behaves
+ * exactly the same as gimp_smudge() except that the pressure value is
+ * taken from the smudge tool options or the options default if the
+ * tools option dialog has not been activated.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_smudge_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-smudge-default",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, num_strokes,
+ GIMP_PDB_FLOATARRAY, strokes,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimppainttools_pdb.h b/libgimp/gimppainttools_pdb.h
new file mode 100644
index 0000000..3782fbd
--- /dev/null
+++ b/libgimp/gimppainttools_pdb.h
@@ -0,0 +1,109 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppainttools_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PAINT_TOOLS_PDB_H__
+#define __GIMP_PAINT_TOOLS_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_airbrush (gint32 drawable_ID,
+ gdouble pressure,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_airbrush_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_clone (gint32 drawable_ID,
+ gint32 src_drawable_ID,
+ GimpCloneType clone_type,
+ gdouble src_x,
+ gdouble src_y,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_clone_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_convolve (gint32 drawable_ID,
+ gdouble pressure,
+ GimpConvolveType convolve_type,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_convolve_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_dodgeburn (gint32 drawable_ID,
+ gdouble exposure,
+ GimpDodgeBurnType dodgeburn_type,
+ GimpTransferMode dodgeburn_mode,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_dodgeburn_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_eraser (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes,
+ GimpBrushApplicationMode hardness,
+ GimpPaintApplicationMode method);
+gboolean gimp_eraser_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_heal (gint32 drawable_ID,
+ gint32 src_drawable_ID,
+ gdouble src_x,
+ gdouble src_y,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_heal_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_paintbrush (gint32 drawable_ID,
+ gdouble fade_out,
+ gint num_strokes,
+ const gdouble *strokes,
+ GimpPaintApplicationMode method,
+ gdouble gradient_length);
+gboolean gimp_paintbrush_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_pencil (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_smudge (gint32 drawable_ID,
+ gdouble pressure,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean gimp_smudge_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PAINT_TOOLS_PDB_H__ */
diff --git a/libgimp/gimppalette.c b/libgimp/gimppalette.c
new file mode 100644
index 0000000..ad1519d
--- /dev/null
+++ b/libgimp/gimppalette.c
@@ -0,0 +1,130 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppalette.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+/**
+ * gimp_palette_get_foreground:
+ * @foreground: The foreground color.
+ *
+ * Get the current GIMP foreground color.
+ *
+ * This procedure retrieves the current GIMP foreground color. The
+ * foreground color is used in a variety of tools such as paint tools,
+ * blending, and bucket fill.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_palette_get_foreground (GimpRGB *foreground)
+{
+ return gimp_context_get_foreground (foreground);
+}
+
+/**
+ * gimp_palette_get_background:
+ * @background: The background color.
+ *
+ * Get the current GIMP background color.
+ *
+ * This procedure retrieves the current GIMP background color. The
+ * background color is used in a variety of tools such as blending,
+ * erasing (with non-alpha images), and image filling.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_palette_get_background (GimpRGB *background)
+{
+ return gimp_context_get_background (background);
+}
+
+/**
+ * gimp_palette_set_foreground:
+ * @foreground: The foreground color.
+ *
+ * Set the current GIMP foreground color.
+ *
+ * This procedure sets the current GIMP foreground color. After this is
+ * set, operations which use foreground such as paint tools, blending,
+ * and bucket fill will use the new value.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_palette_set_foreground (const GimpRGB *foreground)
+{
+ return gimp_context_set_foreground (foreground);
+}
+
+/**
+ * gimp_palette_set_background:
+ * @background: The background color.
+ *
+ * Set the current GIMP background color.
+ *
+ * This procedure sets the current GIMP background color. After this is
+ * set, operations which use background such as blending, filling
+ * images, clearing, and erasing (in non-alpha images) will use the new
+ * value.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_palette_set_background (const GimpRGB *background)
+{
+ return gimp_context_set_background (background);
+}
+
+/**
+ * gimp_palette_set_default_colors:
+ *
+ * Set the current GIMP foreground and background colors to black and
+ * white.
+ *
+ * This procedure sets the current GIMP foreground and background
+ * colors to their initial default values, black and white.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_palette_set_default_colors (void)
+{
+ return gimp_context_set_default_colors ();
+}
+
+/**
+ * gimp_palette_swap_colors:
+ *
+ * Swap the current GIMP foreground and background colors.
+ *
+ * This procedure swaps the current GIMP foreground and background
+ * colors, so that the new foreground color becomes the old background
+ * color and vice versa.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_palette_swap_colors (void)
+{
+ return gimp_context_swap_colors ();
+}
diff --git a/libgimp/gimppalette.h b/libgimp/gimppalette.h
new file mode 100644
index 0000000..4e6269f
--- /dev/null
+++ b/libgimp/gimppalette.h
@@ -0,0 +1,47 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppalette.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PALETTE_H__
+#define __GIMP_PALETTE_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+GIMP_DEPRECATED_FOR(gimp_context_get_foreground)
+gboolean gimp_palette_get_foreground (GimpRGB *foreground);
+GIMP_DEPRECATED_FOR(gimp_context_get_background)
+gboolean gimp_palette_get_background (GimpRGB *background);
+GIMP_DEPRECATED_FOR(gimp_context_set_foreground)
+gboolean gimp_palette_set_foreground (const GimpRGB *foreground);
+GIMP_DEPRECATED_FOR(gimp_context_set_background)
+gboolean gimp_palette_set_background (const GimpRGB *background);
+GIMP_DEPRECATED_FOR(gimp_context_set_default_colors)
+gboolean gimp_palette_set_default_colors (void);
+GIMP_DEPRECATED_FOR(gimp_context_swap_colors)
+gboolean gimp_palette_swap_colors (void);
+
+G_END_DECLS
+
+#endif /* __GIMP_PALETTE_H__ */
diff --git a/libgimp/gimppalette_pdb.c b/libgimp/gimppalette_pdb.c
new file mode 100644
index 0000000..926ef30
--- /dev/null
+++ b/libgimp/gimppalette_pdb.c
@@ -0,0 +1,591 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppalette_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimppalette
+ * @title: gimppalette
+ * @short_description: Functions operating on a single palette.
+ *
+ * Functions operating on a single palette.
+ **/
+
+
+/**
+ * gimp_palette_new:
+ * @name: The requested name of the new palette.
+ *
+ * Creates a new palette
+ *
+ * This procedure creates a new, uninitialized palette
+ *
+ * Returns: The actual new palette name.
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_palette_new (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *actual_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-palette-new",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ actual_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return actual_name;
+}
+
+/**
+ * gimp_palette_duplicate:
+ * @name: The palette name.
+ *
+ * Duplicates a palette
+ *
+ * This procedure creates an identical palette by a different name
+ *
+ * Returns: The name of the palette's copy.
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_palette_duplicate (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *copy_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-palette-duplicate",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ copy_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return copy_name;
+}
+
+/**
+ * gimp_palette_rename:
+ * @name: The palette name.
+ * @new_name: The new name of the palette.
+ *
+ * Rename a palette
+ *
+ * This procedure renames a palette
+ *
+ * Returns: The actual new name of the palette.
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_palette_rename (const gchar *name,
+ const gchar *new_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *actual_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-palette-rename",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_STRING, new_name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ actual_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return actual_name;
+}
+
+/**
+ * gimp_palette_delete:
+ * @name: The palette name.
+ *
+ * Deletes a palette
+ *
+ * This procedure deletes a palette
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_palette_delete (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-palette-delete",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_palette_is_editable:
+ * @name: The palette name.
+ *
+ * Tests if palette can be edited
+ *
+ * Returns TRUE if you have permission to change the palette
+ *
+ * Returns: TRUE if the palette can be edited.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_palette_is_editable (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean editable = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-palette-is-editable",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ editable = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return editable;
+}
+
+/**
+ * gimp_palette_get_info:
+ * @name: The palette name.
+ * @num_colors: The number of colors in the palette.
+ *
+ * Retrieve information about the specified palette.
+ *
+ * This procedure retrieves information about the specified palette.
+ * This includes the name, and the number of colors.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_palette_get_info (const gchar *name,
+ gint *num_colors)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-palette-get-info",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ *num_colors = 0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *num_colors = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_palette_get_colors:
+ * @name: The palette name.
+ * @num_colors: Length of the colors array.
+ *
+ * Gets all colors from the specified palette.
+ *
+ * This procedure retrieves all color entries of the specified palette.
+ *
+ * Returns: The colors in the palette.
+ *
+ * Since: 2.6
+ **/
+GimpRGB *
+gimp_palette_get_colors (const gchar *name,
+ gint *num_colors)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpRGB *colors = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-palette-get-colors",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ *num_colors = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_colors = return_vals[1].data.d_int32;
+ colors = g_new (GimpRGB, *num_colors);
+ memcpy (colors,
+ return_vals[2].data.d_colorarray,
+ *num_colors * sizeof (GimpRGB));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return colors;
+}
+
+/**
+ * gimp_palette_get_columns:
+ * @name: The palette name.
+ *
+ * Retrieves the number of columns to use to display this palette
+ *
+ * This procedures retrieves the preferred number of columns to use
+ * when the palette is being displayed.
+ *
+ * Returns: The number of columns used to display this palette.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_palette_get_columns (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint num_columns = 0;
+
+ return_vals = gimp_run_procedure ("gimp-palette-get-columns",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ num_columns = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return num_columns;
+}
+
+/**
+ * gimp_palette_set_columns:
+ * @name: The palette name.
+ * @columns: The new number of columns.
+ *
+ * Sets the number of columns to use when displaying the palette
+ *
+ * This procedures controls how many colors are shown per row when the
+ * palette is being displayed. This value can only be changed if the
+ * palette is writable. The maximum allowed value is 64.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_palette_set_columns (const gchar *name,
+ gint columns)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-palette-set-columns",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, columns,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_palette_add_entry:
+ * @name: The palette name.
+ * @entry_name: The name of the entry.
+ * @color: The new entry's color color.
+ * @entry_num: The index of the added entry.
+ *
+ * Adds a palette entry to the specified palette.
+ *
+ * This procedure adds an entry to the specified palette. It returns an
+ * error if the entry palette does not exist.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_palette_add_entry (const gchar *name,
+ const gchar *entry_name,
+ const GimpRGB *color,
+ gint *entry_num)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-palette-add-entry",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_STRING, entry_name,
+ GIMP_PDB_COLOR, color,
+ GIMP_PDB_END);
+
+ *entry_num = 0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *entry_num = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_palette_delete_entry:
+ * @name: The palette name.
+ * @entry_num: The index of the added entry.
+ *
+ * Deletes a palette entry from the specified palette.
+ *
+ * This procedure deletes an entry from the specified palette. It
+ * returns an error if the entry palette does not exist.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_palette_delete_entry (const gchar *name,
+ gint entry_num)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-palette-delete-entry",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, entry_num,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_palette_entry_get_color:
+ * @name: The palette name.
+ * @entry_num: The entry to retrieve.
+ * @color: The color requested.
+ *
+ * Gets the specified palette entry from the specified palette.
+ *
+ * This procedure retrieves the color of the zero-based entry specified
+ * for the specified palette. It returns an error if the entry does not
+ * exist.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_palette_entry_get_color (const gchar *name,
+ gint entry_num,
+ GimpRGB *color)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-palette-entry-get-color",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, entry_num,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *color = return_vals[1].data.d_color;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_palette_entry_set_color:
+ * @name: The palette name.
+ * @entry_num: The entry to retrieve.
+ * @color: The new color.
+ *
+ * Sets the specified palette entry in the specified palette.
+ *
+ * This procedure sets the color of the zero-based entry specified for
+ * the specified palette. It returns an error if the entry does not
+ * exist.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_palette_entry_set_color (const gchar *name,
+ gint entry_num,
+ const GimpRGB *color)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-palette-entry-set-color",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, entry_num,
+ GIMP_PDB_COLOR, color,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_palette_entry_get_name:
+ * @name: The palette name.
+ * @entry_num: The entry to retrieve.
+ * @entry_name: The name requested.
+ *
+ * Gets the specified palette entry from the specified palette.
+ *
+ * This procedure retrieves the name of the zero-based entry specified
+ * for the specified palette. It returns an error if the entry does not
+ * exist.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_palette_entry_get_name (const gchar *name,
+ gint entry_num,
+ gchar **entry_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-palette-entry-get-name",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, entry_num,
+ GIMP_PDB_END);
+
+ *entry_name = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *entry_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_palette_entry_set_name:
+ * @name: The palette name.
+ * @entry_num: The entry to retrieve.
+ * @entry_name: The new name.
+ *
+ * Sets the specified palette entry in the specified palette.
+ *
+ * This procedure sets the name of the zero-based entry specified for
+ * the specified palette. It returns an error if the entry does not
+ * exist.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_palette_entry_set_name (const gchar *name,
+ gint entry_num,
+ const gchar *entry_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-palette-entry-set-name",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, entry_num,
+ GIMP_PDB_STRING, entry_name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimppalette_pdb.h b/libgimp/gimppalette_pdb.h
new file mode 100644
index 0000000..d9dd379
--- /dev/null
+++ b/libgimp/gimppalette_pdb.h
@@ -0,0 +1,70 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppalette_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PALETTE_PDB_H__
+#define __GIMP_PALETTE_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gchar* gimp_palette_new (const gchar *name);
+gchar* gimp_palette_duplicate (const gchar *name);
+gchar* gimp_palette_rename (const gchar *name,
+ const gchar *new_name);
+gboolean gimp_palette_delete (const gchar *name);
+gboolean gimp_palette_is_editable (const gchar *name);
+gboolean gimp_palette_get_info (const gchar *name,
+ gint *num_colors);
+GimpRGB* gimp_palette_get_colors (const gchar *name,
+ gint *num_colors);
+gint gimp_palette_get_columns (const gchar *name);
+gboolean gimp_palette_set_columns (const gchar *name,
+ gint columns);
+gboolean gimp_palette_add_entry (const gchar *name,
+ const gchar *entry_name,
+ const GimpRGB *color,
+ gint *entry_num);
+gboolean gimp_palette_delete_entry (const gchar *name,
+ gint entry_num);
+gboolean gimp_palette_entry_get_color (const gchar *name,
+ gint entry_num,
+ GimpRGB *color);
+gboolean gimp_palette_entry_set_color (const gchar *name,
+ gint entry_num,
+ const GimpRGB *color);
+gboolean gimp_palette_entry_get_name (const gchar *name,
+ gint entry_num,
+ gchar **entry_name);
+gboolean gimp_palette_entry_set_name (const gchar *name,
+ gint entry_num,
+ const gchar *entry_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PALETTE_PDB_H__ */
diff --git a/libgimp/gimppalettemenu.c b/libgimp/gimppalettemenu.c
new file mode 100644
index 0000000..e013d1b
--- /dev/null
+++ b/libgimp/gimppalettemenu.c
@@ -0,0 +1,148 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppalettemenu.c
+ * Copyright (C) 2004 Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimppalettemenu.h"
+#include "gimppaletteselectbutton.h"
+
+
+/**
+ * SECTION: gimppalettemenu
+ * @title: gimppalettemenu
+ * @short_description: A widget for selecting palettes.
+ *
+ * A widget for selecting palettes.
+ **/
+
+
+typedef struct
+{
+ GimpRunPaletteCallback callback;
+ gpointer data;
+} CompatCallbackData;
+
+
+static void compat_callback (GimpPaletteSelectButton *palette_button,
+ const gchar *palette_name,
+ gboolean dialog_closing,
+ CompatCallbackData *data);
+static void compat_callback_data_free (CompatCallbackData *data);
+
+
+/**
+ * gimp_palette_select_widget_new:
+ * @title: Title of the dialog to use or %NULL to use the default title.
+ * @palette_name: Initial palette name.
+ * @callback: A function to call when the selected palette changes.
+ * @data: A pointer to arbitrary data to be used in the call to @callback.
+ *
+ * Creates a new #GtkWidget that completely controls the selection of
+ * a palette. This widget is suitable for placement in a table in a
+ * plug-in dialog.
+ *
+ * Returns: A #GtkWidget that you can use in your UI.
+ *
+ * Since: 2.2
+ */
+GtkWidget *
+gimp_palette_select_widget_new (const gchar *title,
+ const gchar *palette_name,
+ GimpRunPaletteCallback callback,
+ gpointer data)
+{
+ GtkWidget *palette_button;
+ CompatCallbackData *compat_data;
+
+ g_return_val_if_fail (callback != NULL, NULL);
+
+ palette_button = gimp_palette_select_button_new (title, palette_name);
+
+ compat_data = g_slice_new (CompatCallbackData);
+
+ compat_data->callback = callback;
+ compat_data->data = data;
+
+ g_signal_connect_data (palette_button, "palette-set",
+ G_CALLBACK (compat_callback),
+ compat_data,
+ (GClosureNotify) compat_callback_data_free, 0);
+
+ return palette_button;
+}
+
+/**
+ * gimp_palette_select_widget_close:
+ * @widget: A palette select widget.
+ *
+ * Closes the popup window associated with @widget.
+ *
+ * Since: 2.2
+ */
+void
+gimp_palette_select_widget_close (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+
+ gimp_select_button_close_popup (GIMP_SELECT_BUTTON (widget));
+}
+
+/**
+ * gimp_palette_select_widget_set:
+ * @widget: A palette select widget.
+ * @palette_name: Palette name to set; %NULL means no change.
+ *
+ * Sets the current palette for the palette select widget. Calls the
+ * callback function if one was supplied in the call to
+ * gimp_palette_select_widget_new().
+ *
+ * Since: 2.2
+ */
+void
+gimp_palette_select_widget_set (GtkWidget *widget,
+ const gchar *palette_name)
+{
+ g_return_if_fail (widget != NULL);
+
+ gimp_palette_select_button_set_palette (GIMP_PALETTE_SELECT_BUTTON (widget),
+ palette_name);
+}
+
+
+static void
+compat_callback (GimpPaletteSelectButton *palette_button,
+ const gchar *palette_name,
+ gboolean dialog_closing,
+ CompatCallbackData *data)
+{
+ data->callback (palette_name, dialog_closing, data->data);
+}
+
+static void
+compat_callback_data_free (CompatCallbackData *data)
+{
+ g_slice_free (CompatCallbackData, data);
+}
diff --git a/libgimp/gimppalettemenu.h b/libgimp/gimppalettemenu.h
new file mode 100644
index 0000000..af0e5f9
--- /dev/null
+++ b/libgimp/gimppalettemenu.h
@@ -0,0 +1,49 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppalettemenu.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PALETTE_MENU_H__
+#define __GIMP_PALETTE_MENU_H__
+
+/* These functions are deprecated and should not be used in newly
+ * written code.
+ */
+
+G_BEGIN_DECLS
+
+GIMP_DEPRECATED_FOR(gimp_gradient_select_button_new)
+GtkWidget * gimp_palette_select_widget_new (const gchar *title,
+ const gchar *palette_name,
+ GimpRunPaletteCallback callback,
+ gpointer data);
+
+GIMP_DEPRECATED_FOR(gimp_select_button_close_popup)
+void gimp_palette_select_widget_close (GtkWidget *widget);
+GIMP_DEPRECATED_FOR(gimp_gradient_select_button_set_gradient)
+void gimp_palette_select_widget_set (GtkWidget *widget,
+ const gchar *palette_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PALETTE_MENU_H__ */
diff --git a/libgimp/gimppalettes.c b/libgimp/gimppalettes.c
new file mode 100644
index 0000000..f5e479e
--- /dev/null
+++ b/libgimp/gimppalettes.c
@@ -0,0 +1,38 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppalettes.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+#include "gimppalettes.h"
+
+/**
+ * gimp_palettes_set_palette:
+ * @name: The palette name.
+ *
+ * This procedure is deprecated! Use gimp_context_set_palette() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_palettes_set_palette (const gchar *name)
+{
+ return gimp_context_set_palette (name);
+}
diff --git a/libgimp/gimppalettes.h b/libgimp/gimppalettes.h
new file mode 100644
index 0000000..54d9d9b
--- /dev/null
+++ b/libgimp/gimppalettes.h
@@ -0,0 +1,37 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppalettes.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PALETTES_H__
+#define __GIMP_PALETTES_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+GIMP_DEPRECATED_FOR(gimp_context_set_gradient)
+gboolean gimp_palettes_set_palette (const gchar *name);
+
+G_END_DECLS
+
+#endif /* __GIMP_PALETTES_H__ */
diff --git a/libgimp/gimppalettes_pdb.c b/libgimp/gimppalettes_pdb.c
new file mode 100644
index 0000000..80a1c23
--- /dev/null
+++ b/libgimp/gimppalettes_pdb.c
@@ -0,0 +1,178 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppalettes_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimppalettes
+ * @title: gimppalettes
+ * @short_description: Operations related to palettes.
+ *
+ * Operations related to palettes.
+ **/
+
+
+/**
+ * gimp_palettes_refresh:
+ *
+ * Refreshes current palettes. This function always succeeds.
+ *
+ * This procedure retrieves all palettes currently in the user's
+ * palette path and updates the palette dialogs accordingly.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_palettes_refresh (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-palettes-refresh",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_palettes_get_list:
+ * @filter: An optional regular expression used to filter the list.
+ * @num_palettes: The number of palettes in the list.
+ *
+ * Retrieves a list of all of the available palettes
+ *
+ * This procedure returns a complete listing of available palettes.
+ * Each name returned can be used as input to the command
+ * gimp_context_set_palette().
+ *
+ * Returns: The list of palette names. The returned value must be freed
+ * with g_strfreev().
+ **/
+gchar **
+gimp_palettes_get_list (const gchar *filter,
+ gint *num_palettes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar **palette_list = NULL;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-palettes-get-list",
+ &nreturn_vals,
+ GIMP_PDB_STRING, filter,
+ GIMP_PDB_END);
+
+ *num_palettes = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_palettes = return_vals[1].data.d_int32;
+ if (*num_palettes > 0)
+ {
+ palette_list = g_new0 (gchar *, *num_palettes + 1);
+ for (i = 0; i < *num_palettes; i++)
+ palette_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return palette_list;
+}
+
+/**
+ * gimp_palettes_get_palette:
+ * @num_colors: The palette num_colors.
+ *
+ * Deprecated: Use gimp_context_get_palette() instead.
+ *
+ * Returns: The palette name.
+ **/
+gchar *
+gimp_palettes_get_palette (gint *num_colors)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-palettes-get-palette",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ name = g_strdup (return_vals[1].data.d_string);
+ *num_colors = return_vals[2].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_palettes_get_palette_entry:
+ * @name: The palette name (\"\" means currently active palette).
+ * @entry_num: The entry to retrieve.
+ * @num_colors: The palette num_colors.
+ * @color: The color requested.
+ *
+ * Deprecated: Use gimp_palette_entry_get_color() instead.
+ *
+ * Returns: The palette name.
+ **/
+gchar *
+gimp_palettes_get_palette_entry (const gchar *name,
+ gint entry_num,
+ gint *num_colors,
+ GimpRGB *color)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *actual_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-palettes-get-palette-entry",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, entry_num,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ actual_name = g_strdup (return_vals[1].data.d_string);
+ *num_colors = return_vals[2].data.d_int32;
+ *color = return_vals[3].data.d_color;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return actual_name;
+}
diff --git a/libgimp/gimppalettes_pdb.h b/libgimp/gimppalettes_pdb.h
new file mode 100644
index 0000000..ad4d9a3
--- /dev/null
+++ b/libgimp/gimppalettes_pdb.h
@@ -0,0 +1,49 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppalettes_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PALETTES_PDB_H__
+#define __GIMP_PALETTES_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_palettes_refresh (void);
+gchar** gimp_palettes_get_list (const gchar *filter,
+ gint *num_palettes);
+GIMP_DEPRECATED_FOR(gimp_context_get_palette)
+gchar* gimp_palettes_get_palette (gint *num_colors);
+GIMP_DEPRECATED_FOR(gimp_palette_entry_get_color)
+gchar* gimp_palettes_get_palette_entry (const gchar *name,
+ gint entry_num,
+ gint *num_colors,
+ GimpRGB *color);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PALETTES_PDB_H__ */
diff --git a/libgimp/gimppaletteselect.c b/libgimp/gimppaletteselect.c
new file mode 100644
index 0000000..c6ddaaf
--- /dev/null
+++ b/libgimp/gimppaletteselect.c
@@ -0,0 +1,212 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppaletteselect.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+typedef struct
+{
+ gchar *palette_callback;
+ guint idle_id;
+ gchar *palette_name;
+ gint num_colors;
+ GimpRunPaletteCallback callback;
+ gboolean closing;
+ gpointer data;
+} GimpPaletteData;
+
+
+/* local function prototypes */
+
+static void gimp_palette_data_free (GimpPaletteData *data);
+
+static void gimp_temp_palette_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals);
+static gboolean gimp_temp_palette_run_idle (GimpPaletteData *palette_data);
+
+
+/* private variables */
+
+static GHashTable *gimp_palette_select_ht = NULL;
+
+
+/* public functions */
+
+const gchar *
+gimp_palette_select_new (const gchar *title,
+ const gchar *palette_name,
+ GimpRunPaletteCallback callback,
+ gpointer data)
+{
+ static const GimpParamDef args[] =
+ {
+ { GIMP_PDB_STRING, "str", "String" },
+ { GIMP_PDB_INT32, "num-colors", "Number of colors" },
+ { GIMP_PDB_INT32, "dialog-status", "If the dialog was closing "
+ "[0 = No, 1 = Yes]" }
+ };
+
+ gchar *palette_callback = gimp_procedural_db_temp_name ();
+
+ gimp_install_temp_proc (palette_callback,
+ "Temporary palette popup callback procedure",
+ "",
+ "",
+ "",
+ "",
+ NULL,
+ "",
+ GIMP_TEMPORARY,
+ G_N_ELEMENTS (args), 0,
+ args, NULL,
+ gimp_temp_palette_run);
+
+ if (gimp_palettes_popup (palette_callback, title, palette_name))
+ {
+ GimpPaletteData *palette_data;
+
+ gimp_extension_enable (); /* Allow callbacks to be watched */
+
+ /* Now add to hash table so we can find it again */
+ if (! gimp_palette_select_ht)
+ {
+ gimp_palette_select_ht =
+ g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free,
+ (GDestroyNotify) gimp_palette_data_free);
+ }
+
+ palette_data = g_slice_new0 (GimpPaletteData);
+
+ palette_data->palette_callback = palette_callback;
+ palette_data->callback = callback;
+ palette_data->data = data;
+
+ g_hash_table_insert (gimp_palette_select_ht,
+ palette_callback, palette_data);
+
+ return palette_callback;
+ }
+
+ gimp_uninstall_temp_proc (palette_callback);
+ g_free (palette_callback);
+
+ return NULL;
+}
+
+void
+gimp_palette_select_destroy (const gchar *palette_callback)
+{
+ GimpPaletteData *palette_data;
+
+ g_return_if_fail (palette_callback != NULL);
+ g_return_if_fail (gimp_palette_select_ht != NULL);
+
+ palette_data = g_hash_table_lookup (gimp_palette_select_ht, palette_callback);
+
+ if (! palette_data)
+ {
+ g_warning ("Can't find internal palette data");
+ return;
+ }
+
+ if (palette_data->idle_id)
+ g_source_remove (palette_data->idle_id);
+
+ g_free (palette_data->palette_name);
+
+ if (palette_data->palette_callback)
+ gimp_palettes_close_popup (palette_data->palette_callback);
+
+ gimp_uninstall_temp_proc (palette_callback);
+
+ g_hash_table_remove (gimp_palette_select_ht, palette_callback);
+}
+
+
+/* private functions */
+
+static void
+gimp_palette_data_free (GimpPaletteData *data)
+{
+ g_slice_free (GimpPaletteData, data);
+}
+
+static void
+gimp_temp_palette_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals)
+{
+ static GimpParam values[1];
+ GimpPaletteData *palette_data;
+
+ palette_data = g_hash_table_lookup (gimp_palette_select_ht, name);
+
+ if (! palette_data)
+ {
+ g_warning ("Can't find internal palette data");
+ }
+ else
+ {
+ g_free (palette_data->palette_name);
+
+ palette_data->palette_name = g_strdup (param[0].data.d_string);
+ palette_data->num_colors = param[1].data.d_int32;
+ palette_data->closing = param[2].data.d_int32;
+
+ if (! palette_data->idle_id)
+ palette_data->idle_id = g_idle_add ((GSourceFunc) gimp_temp_palette_run_idle,
+ palette_data);
+ }
+
+ *nreturn_vals = 1;
+ *return_vals = values;
+
+ values[0].type = GIMP_PDB_STATUS;
+ values[0].data.d_status = GIMP_PDB_SUCCESS;
+}
+
+static gboolean
+gimp_temp_palette_run_idle (GimpPaletteData *palette_data)
+{
+ palette_data->idle_id = 0;
+
+ if (palette_data->callback)
+ palette_data->callback (palette_data->palette_name,
+ palette_data->closing,
+ palette_data->data);
+
+ if (palette_data->closing)
+ {
+ gchar *palette_callback = palette_data->palette_callback;
+
+ palette_data->palette_callback = NULL;
+ gimp_palette_select_destroy (palette_callback);
+ }
+
+ return FALSE;
+}
diff --git a/libgimp/gimppaletteselect.h b/libgimp/gimppaletteselect.h
new file mode 100644
index 0000000..3e4b6c9
--- /dev/null
+++ b/libgimp/gimppaletteselect.h
@@ -0,0 +1,45 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppaletteselect.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PALETTE_SELECT_H__
+#define __GIMP_PALETTE_SELECT_H__
+
+G_BEGIN_DECLS
+
+
+typedef void (* GimpRunPaletteCallback) (const gchar *palette_name,
+ gboolean dialog_closing,
+ gpointer user_data);
+
+
+const gchar * gimp_palette_select_new (const gchar *title,
+ const gchar *palette_name,
+ GimpRunPaletteCallback callback,
+ gpointer data);
+void gimp_palette_select_destroy (const gchar *palette_callback);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PALETTE_SELECT_H__ */
diff --git a/libgimp/gimppaletteselect_pdb.c b/libgimp/gimppaletteselect_pdb.c
new file mode 100644
index 0000000..0e64e1b
--- /dev/null
+++ b/libgimp/gimppaletteselect_pdb.c
@@ -0,0 +1,131 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppaletteselect_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimppaletteselect
+ * @title: gimppaletteselect
+ * @short_description: Functions providing a palette selection dialog.
+ *
+ * Functions providing a palette selection dialog.
+ **/
+
+
+/**
+ * gimp_palettes_popup:
+ * @palette_callback: The callback PDB proc to call when palette selection is made.
+ * @popup_title: Title of the palette selection dialog.
+ * @initial_palette: The name of the palette to set as the first selected.
+ *
+ * Invokes the Gimp palette selection.
+ *
+ * This procedure opens the palette selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_palettes_popup (const gchar *palette_callback,
+ const gchar *popup_title,
+ const gchar *initial_palette)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-palettes-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, palette_callback,
+ GIMP_PDB_STRING, popup_title,
+ GIMP_PDB_STRING, initial_palette,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_palettes_close_popup:
+ * @palette_callback: The name of the callback registered for this pop-up.
+ *
+ * Close the palette selection dialog.
+ *
+ * This procedure closes an opened palette selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_palettes_close_popup (const gchar *palette_callback)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-palettes-close-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, palette_callback,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_palettes_set_popup:
+ * @palette_callback: The name of the callback registered for this pop-up.
+ * @palette_name: The name of the palette to set as selected.
+ *
+ * Sets the current palette in a palette selection dialog.
+ *
+ * Sets the current palette in a palette selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_palettes_set_popup (const gchar *palette_callback,
+ const gchar *palette_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-palettes-set-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, palette_callback,
+ GIMP_PDB_STRING, palette_name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimppaletteselect_pdb.h b/libgimp/gimppaletteselect_pdb.h
new file mode 100644
index 0000000..221ec4b
--- /dev/null
+++ b/libgimp/gimppaletteselect_pdb.h
@@ -0,0 +1,45 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppaletteselect_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PALETTE_SELECT_PDB_H__
+#define __GIMP_PALETTE_SELECT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_palettes_popup (const gchar *palette_callback,
+ const gchar *popup_title,
+ const gchar *initial_palette);
+gboolean gimp_palettes_close_popup (const gchar *palette_callback);
+gboolean gimp_palettes_set_popup (const gchar *palette_callback,
+ const gchar *palette_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PALETTE_SELECT_PDB_H__ */
diff --git a/libgimp/gimppaletteselectbutton.c b/libgimp/gimppaletteselectbutton.c
new file mode 100644
index 0000000..ad4957f
--- /dev/null
+++ b/libgimp/gimppaletteselectbutton.c
@@ -0,0 +1,488 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppaletteselectbutton.c
+ * Copyright (C) 2004 Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimppaletteselectbutton.h"
+#include "gimpuimarshal.h"
+
+#include "libgimp-intl.h"
+
+
+/**
+ * SECTION: gimppaletteselectbutton
+ * @title: GimpPaletteSelect
+ * @short_description: A button which pops up a palette select dialog.
+ *
+ * A button which pops up a palette select dialog.
+ **/
+
+
+#define GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE(obj) ((GimpPaletteSelectButtonPrivate *) gimp_palette_select_button_get_instance_private ((GimpPaletteSelectButton *) (obj)))
+
+typedef struct _GimpPaletteSelectButtonPrivate GimpPaletteSelectButtonPrivate;
+
+struct _GimpPaletteSelectButtonPrivate
+{
+ gchar *title;
+
+ gchar *palette_name; /* Local copy */
+
+ GtkWidget *inside;
+ GtkWidget *label;
+};
+
+enum
+{
+ PALETTE_SET,
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_TITLE,
+ PROP_PALETTE_NAME
+};
+
+
+/* local function prototypes */
+
+static void gimp_palette_select_button_finalize (GObject *object);
+
+static void gimp_palette_select_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_palette_select_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_palette_select_button_clicked (GimpPaletteSelectButton *button);
+
+static void gimp_palette_select_button_callback (const gchar *palette_name,
+ gboolean dialog_closing,
+ gpointer user_data);
+
+static void gimp_palette_select_drag_data_received (GimpPaletteSelectButton *button,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time);
+
+static GtkWidget * gimp_palette_select_button_create_inside (GimpPaletteSelectButton *palette_button);
+
+
+static const GtkTargetEntry target = { "application/x-gimp-palette-name", 0 };
+
+static guint palette_button_signals[LAST_SIGNAL] = { 0 };
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpPaletteSelectButton, gimp_palette_select_button,
+ GIMP_TYPE_SELECT_BUTTON)
+
+
+static void
+gimp_palette_select_button_class_init (GimpPaletteSelectButtonClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GimpSelectButtonClass *select_button_class = GIMP_SELECT_BUTTON_CLASS (klass);
+
+ object_class->finalize = gimp_palette_select_button_finalize;
+ object_class->set_property = gimp_palette_select_button_set_property;
+ object_class->get_property = gimp_palette_select_button_get_property;
+
+ select_button_class->select_destroy = gimp_palette_select_destroy;
+
+ klass->palette_set = NULL;
+
+ /**
+ * GimpPaletteSelectButton:title:
+ *
+ * The title to be used for the palette selection popup dialog.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_TITLE,
+ g_param_spec_string ("title",
+ "Title",
+ "The title to be used for the palette selection popup dialog",
+ _("Palette Selection"),
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * GimpPaletteSelectButton:palette-name:
+ *
+ * The name of the currently selected palette.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_PALETTE_NAME,
+ g_param_spec_string ("palette-name",
+ "Palette name",
+ "The name of the currently selected palette",
+ NULL,
+ GIMP_PARAM_READWRITE));
+
+ /**
+ * GimpPaletteSelectButton::palette-set:
+ * @widget: the object which received the signal.
+ * @palette_name: the name of the currently selected palette.
+ * @dialog_closing: whether the dialog was closed or not.
+ *
+ * The ::palette-set signal is emitted when the user selects a palette.
+ *
+ * Since: 2.4
+ */
+ palette_button_signals[PALETTE_SET] =
+ g_signal_new ("palette-set",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpPaletteSelectButtonClass, palette_set),
+ NULL, NULL,
+ _gimpui_marshal_VOID__STRING_BOOLEAN,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING,
+ G_TYPE_BOOLEAN);
+}
+
+static void
+gimp_palette_select_button_init (GimpPaletteSelectButton *button)
+{
+ GimpPaletteSelectButtonPrivate *priv;
+
+ priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (button);
+
+ priv->palette_name = NULL;
+
+ priv->inside = gimp_palette_select_button_create_inside (button);
+ gtk_container_add (GTK_CONTAINER (button), priv->inside);
+}
+
+/**
+ * gimp_palette_select_button_new:
+ * @title: Title of the dialog to use or %NULL to use the default title.
+ * @palette_name: Initial palette name.
+ *
+ * Creates a new #GtkWidget that completely controls the selection of
+ * a palette. This widget is suitable for placement in a table in a
+ * plug-in dialog.
+ *
+ * Returns: A #GtkWidget that you can use in your UI.
+ *
+ * Since: 2.4
+ */
+GtkWidget *
+gimp_palette_select_button_new (const gchar *title,
+ const gchar *palette_name)
+{
+ GtkWidget *button;
+
+ if (title)
+ button = g_object_new (GIMP_TYPE_PALETTE_SELECT_BUTTON,
+ "title", title,
+ "palette-name", palette_name,
+ NULL);
+ else
+ button = g_object_new (GIMP_TYPE_PALETTE_SELECT_BUTTON,
+ "palette-name", palette_name,
+ NULL);
+
+ return button;
+}
+
+/**
+ * gimp_palette_select_button_get_palette:
+ * @button: A #GimpPaletteSelectButton
+ *
+ * Retrieves the name of currently selected palette.
+ *
+ * Returns: an internal copy of the palette name which must not be freed.
+ *
+ * Since: 2.4
+ */
+const gchar *
+gimp_palette_select_button_get_palette (GimpPaletteSelectButton *button)
+{
+ GimpPaletteSelectButtonPrivate *priv;
+
+ g_return_val_if_fail (GIMP_IS_PALETTE_SELECT_BUTTON (button), NULL);
+
+ priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (button);
+ return priv->palette_name;
+}
+
+/**
+ * gimp_palette_select_button_set_palette:
+ * @button: A #GimpPaletteSelectButton
+ * @palette_name: Palette name to set; %NULL means no change.
+ *
+ * Sets the current palette for the palette select button.
+ *
+ * Since: 2.4
+ */
+void
+gimp_palette_select_button_set_palette (GimpPaletteSelectButton *button,
+ const gchar *palette_name)
+{
+ GimpSelectButton *select_button;
+
+ g_return_if_fail (GIMP_IS_PALETTE_SELECT_BUTTON (button));
+
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ if (select_button->temp_callback)
+ {
+ gimp_palettes_set_popup (select_button->temp_callback, palette_name);
+ }
+ else
+ {
+ gchar *name;
+ gint num_colors;
+
+ if (palette_name && *palette_name)
+ name = g_strdup (palette_name);
+ else
+ name = gimp_context_get_palette ();
+
+ if (gimp_palette_get_info (name, &num_colors))
+ gimp_palette_select_button_callback (name, FALSE, button);
+
+ g_free (name);
+ }
+}
+
+
+/* private functions */
+
+static void
+gimp_palette_select_button_finalize (GObject *object)
+{
+ GimpPaletteSelectButtonPrivate *priv;
+
+ priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (object);
+
+ g_clear_pointer (&priv->palette_name, g_free);
+ g_clear_pointer (&priv->title, g_free);
+
+ G_OBJECT_CLASS (gimp_palette_select_button_parent_class)->finalize (object);
+}
+
+static void
+gimp_palette_select_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpPaletteSelectButton *button;
+ GimpPaletteSelectButtonPrivate *priv;
+
+ button = GIMP_PALETTE_SELECT_BUTTON (object);
+ priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (button);
+
+ switch (property_id)
+ {
+ case PROP_TITLE:
+ priv->title = g_value_dup_string (value);
+ break;
+ case PROP_PALETTE_NAME:
+ gimp_palette_select_button_set_palette (button,
+ g_value_get_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_palette_select_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpPaletteSelectButton *button;
+ GimpPaletteSelectButtonPrivate *priv;
+
+ button = GIMP_PALETTE_SELECT_BUTTON (object);
+ priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (button);
+
+ switch (property_id)
+ {
+ case PROP_TITLE:
+ g_value_set_string (value, priv->title);
+ break;
+ case PROP_PALETTE_NAME:
+ g_value_set_string (value, priv->palette_name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_palette_select_button_callback (const gchar *palette_name,
+ gboolean dialog_closing,
+ gpointer user_data)
+{
+ GimpPaletteSelectButton *button;
+ GimpPaletteSelectButtonPrivate *priv;
+ GimpSelectButton *select_button;
+
+ button = GIMP_PALETTE_SELECT_BUTTON (user_data);
+
+ priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (button);
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ g_free (priv->palette_name);
+ priv->palette_name = g_strdup (palette_name);
+
+ gtk_label_set_text (GTK_LABEL (priv->label), palette_name);
+
+ if (dialog_closing)
+ select_button->temp_callback = NULL;
+
+ g_signal_emit (button, palette_button_signals[PALETTE_SET], 0,
+ palette_name, dialog_closing);
+ g_object_notify (G_OBJECT (button), "palette-name");
+}
+
+static void
+gimp_palette_select_button_clicked (GimpPaletteSelectButton *button)
+{
+ GimpPaletteSelectButtonPrivate *priv;
+ GimpSelectButton *select_button;
+
+ priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (button);
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ if (select_button->temp_callback)
+ {
+ /* calling gimp_palettes_set_popup() raises the dialog */
+ gimp_palettes_set_popup (select_button->temp_callback,
+ priv->palette_name);
+ }
+ else
+ {
+ select_button->temp_callback =
+ gimp_palette_select_new (priv->title, priv->palette_name,
+ gimp_palette_select_button_callback,
+ button);
+ }
+}
+
+static void
+gimp_palette_select_drag_data_received (GimpPaletteSelectButton *button,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time)
+{
+ gint length = gtk_selection_data_get_length (selection);
+ gchar *str;
+
+ if (gtk_selection_data_get_format (selection) != 8 || length < 1)
+ {
+ g_warning ("%s: received invalid palette data", G_STRFUNC);
+ return;
+ }
+
+ str = g_strndup ((const gchar *) gtk_selection_data_get_data (selection),
+ length);
+
+ if (g_utf8_validate (str, -1, NULL))
+ {
+ gint pid;
+ gpointer unused;
+ gint name_offset = 0;
+
+ if (sscanf (str, "%i:%p:%n", &pid, &unused, &name_offset) >= 2 &&
+ pid == gimp_getpid () && name_offset > 0)
+ {
+ gchar *name = str + name_offset;
+
+ gimp_palette_select_button_set_palette (button, name);
+ }
+ }
+
+ g_free (str);
+}
+
+static GtkWidget *
+gimp_palette_select_button_create_inside (GimpPaletteSelectButton *palette_button)
+{
+ GtkWidget *button;
+ GtkWidget *hbox;
+ GtkWidget *image;
+ GimpPaletteSelectButtonPrivate *priv;
+
+ priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (palette_button);
+
+ gtk_widget_push_composite_child ();
+
+ button = gtk_button_new ();
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+ gtk_container_add (GTK_CONTAINER (button), hbox);
+
+ image = gtk_image_new_from_icon_name (GIMP_ICON_PALETTE,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+
+ priv->label = gtk_label_new (priv->palette_name);
+ gtk_box_pack_start (GTK_BOX (hbox), priv->label, TRUE, TRUE, 4);
+
+ gtk_widget_show_all (button);
+
+ g_signal_connect_swapped (button, "clicked",
+ G_CALLBACK (gimp_palette_select_button_clicked),
+ palette_button);
+
+ gtk_drag_dest_set (GTK_WIDGET (button),
+ GTK_DEST_DEFAULT_HIGHLIGHT |
+ GTK_DEST_DEFAULT_MOTION |
+ GTK_DEST_DEFAULT_DROP,
+ &target, 1,
+ GDK_ACTION_COPY);
+
+ g_signal_connect_swapped (button, "drag-data-received",
+ G_CALLBACK (gimp_palette_select_drag_data_received),
+ palette_button);
+
+ gtk_widget_pop_composite_child ();
+
+ return button;
+}
diff --git a/libgimp/gimppaletteselectbutton.h b/libgimp/gimppaletteselectbutton.h
new file mode 100644
index 0000000..15d411a
--- /dev/null
+++ b/libgimp/gimppaletteselectbutton.h
@@ -0,0 +1,79 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppaletteselectbutton.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PALETTE_SELECT_BUTTON_H__
+#define __GIMP_PALETTE_SELECT_BUTTON_H__
+
+#include <libgimp/gimpselectbutton.h>
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+#define GIMP_TYPE_PALETTE_SELECT_BUTTON (gimp_palette_select_button_get_type ())
+#define GIMP_PALETTE_SELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PALETTE_SELECT_BUTTON, GimpPaletteSelectButton))
+#define GIMP_PALETTE_SELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PALETTE_SELECT_BUTTON, GimpPaletteSelectButtonClass))
+#define GIMP_IS_PALETTE_SELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PALETTE_SELECT_BUTTON))
+#define GIMP_IS_PALETTE_SELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PALETTE_SELECT_BUTTON))
+#define GIMP_PALETTE_SELECT_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PALETTE_SELECT_BUTTON, GimpPaletteSelectButtonClass))
+
+
+typedef struct _GimpPaletteSelectButtonClass GimpPaletteSelectButtonClass;
+
+struct _GimpPaletteSelectButton
+{
+ GimpSelectButton parent_instance;
+};
+
+struct _GimpPaletteSelectButtonClass
+{
+ GimpSelectButtonClass parent_class;
+
+ /* palette_set signal is emitted when palette is chosen */
+ void (* palette_set) (GimpPaletteSelectButton *button,
+ const gchar *palette_name,
+ gboolean dialog_closing);
+
+ /* Padding for future expansion */
+ void (*_gimp_reserved1) (void);
+ void (*_gimp_reserved2) (void);
+ void (*_gimp_reserved3) (void);
+ void (*_gimp_reserved4) (void);
+};
+
+
+GType gimp_palette_select_button_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_palette_select_button_new (const gchar *title,
+ const gchar *palette_name);
+
+const gchar * gimp_palette_select_button_get_palette (GimpPaletteSelectButton *button);
+void gimp_palette_select_button_set_palette (GimpPaletteSelectButton *button,
+ const gchar *palette_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PALETTE_SELECT_BUTTON_H__ */
diff --git a/libgimp/gimppaths_pdb.c b/libgimp/gimppaths_pdb.c
new file mode 100644
index 0000000..01ee26a
--- /dev/null
+++ b/libgimp/gimppaths_pdb.c
@@ -0,0 +1,560 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppaths_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimppaths
+ * @title: gimppaths
+ * @short_description: Deprecated operations related to paths.
+ *
+ * Deprecated operations related to paths.
+ **/
+
+
+/**
+ * gimp_path_list:
+ * @image_ID: The image to list the paths from.
+ * @num_paths: The number of paths returned.
+ *
+ * Deprecated: Use gimp_image_get_vectors() instead.
+ *
+ * Returns: List of the paths belonging to this image. The returned
+ * value must be freed with g_strfreev().
+ **/
+gchar **
+gimp_path_list (gint32 image_ID,
+ gint *num_paths)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar **path_list = NULL;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-path-list",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ *num_paths = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_paths = return_vals[1].data.d_int32;
+ if (*num_paths > 0)
+ {
+ path_list = g_new0 (gchar *, *num_paths + 1);
+ for (i = 0; i < *num_paths; i++)
+ path_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return path_list;
+}
+
+/**
+ * gimp_path_get_current:
+ * @image_ID: The image to get the current path from.
+ *
+ * Deprecated: Use gimp_image_get_active_vectors() instead.
+ *
+ * Returns: The name of the current path.
+ **/
+gchar *
+gimp_path_get_current (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-path-get-current",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_path_set_current:
+ * @image_ID: The image in which a path will become current.
+ * @name: The name of the path to make current.
+ *
+ * Deprecated: Use gimp_image_set_active_vectors() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_path_set_current (gint32 image_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-path-set-current",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_path_delete:
+ * @image_ID: The image to delete the path from.
+ * @name: The name of the path to delete.
+ *
+ * Deprecated: Use gimp_image_remove_vectors() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_path_delete (gint32 image_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-path-delete",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_path_get_points:
+ * @image_ID: The image to list the paths from.
+ * @name: The name of the path whose points should be listed.
+ * @path_closed: Return if the path is closed. (0 = path open, 1 = path closed).
+ * @num_path_point_details: The number of points returned. Each point is made up of (x, y, pnt_type) of floats.
+ * @points_pairs: The points in the path represented as 3 floats. The first is the x pos, next is the y pos, last is the type of the pnt. The type field is dependent on the path type. For beziers (type 1 paths) the type can either be (1.0 = BEZIER_ANCHOR, 2.0 = BEZIER_CONTROL, 3.0 = BEZIER_MOVE). Note all points are returned in pixel resolution.
+ *
+ * Deprecated: Use gimp_vectors_stroke_get_points() instead.
+ *
+ * Returns: The type of the path. Currently only one type (1 = Bezier)
+ * is supported.
+ **/
+gint
+gimp_path_get_points (gint32 image_ID,
+ const gchar *name,
+ gint *path_closed,
+ gint *num_path_point_details,
+ gdouble **points_pairs)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint path_type = 0;
+
+ return_vals = gimp_run_procedure ("gimp-path-get-points",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ *num_path_point_details = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ path_type = return_vals[1].data.d_int32;
+ *path_closed = return_vals[2].data.d_int32;
+ *num_path_point_details = return_vals[3].data.d_int32;
+ *points_pairs = g_new (gdouble, *num_path_point_details);
+ memcpy (*points_pairs,
+ return_vals[4].data.d_floatarray,
+ *num_path_point_details * sizeof (gdouble));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return path_type;
+}
+
+/**
+ * gimp_path_set_points:
+ * @image_ID: The image to set the paths in.
+ * @name: The name of the path to create. If it exists then a unique name will be created - query the list of paths if you want to make sure that the name of the path you create is unique. This will be set as the current path.
+ * @ptype: The type of the path. Currently only one type (1 = Bezier) is supported.
+ * @num_path_points: The number of elements in the array, i.e. the number of points in the path * 3. Each point is made up of (x, y, type) of floats. Currently only the creation of bezier curves is allowed. The type parameter must be set to (1) to indicate a BEZIER type curve. Note that for BEZIER curves, points must be given in the following order: ACCACCAC... If the path is not closed the last control point is missed off. Points consist of three control points (control/anchor/control) so for a curve that is not closed there must be at least two points passed (2 x,y pairs). If (num_path_points/3) % 3 = 0 then the path is assumed to be closed and the points are ACCACCACCACC.
+ * @points_pairs: The points in the path represented as 3 floats. The first is the x pos, next is the y pos, last is the type of the pnt. The type field is dependent on the path type. For beziers (type 1 paths) the type can either be (1.0 = BEZIER_ANCHOR, 2.0 = BEZIER_CONTROL, 3.0= BEZIER_MOVE). Note all points are returned in pixel resolution.
+ *
+ * Deprecated: Use gimp_vectors_stroke_new_from_points() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_path_set_points (gint32 image_ID,
+ const gchar *name,
+ gint ptype,
+ gint num_path_points,
+ const gdouble *points_pairs)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-path-set-points",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, ptype,
+ GIMP_PDB_INT32, num_path_points,
+ GIMP_PDB_FLOATARRAY, points_pairs,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_path_stroke_current:
+ * @image_ID: The image which contains the path to stroke.
+ *
+ * Deprecated: Use gimp_edit_stroke_vectors() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_path_stroke_current (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-path-stroke-current",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_path_get_point_at_dist:
+ * @image_ID: The image the paths belongs to.
+ * @distance: The distance along the path.
+ * @y_point: The y position of the point.
+ * @slope: The slope (dy / dx) at the specified point.
+ *
+ * Deprecated: Use gimp_vectors_stroke_get_point_at_dist() instead.
+ *
+ * Returns: The x position of the point.
+ **/
+gint
+gimp_path_get_point_at_dist (gint32 image_ID,
+ gdouble distance,
+ gint *y_point,
+ gdouble *slope)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint x_point = 0;
+
+ return_vals = gimp_run_procedure ("gimp-path-get-point-at-dist",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_FLOAT, distance,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ x_point = return_vals[1].data.d_int32;
+ *y_point = return_vals[2].data.d_int32;
+ *slope = return_vals[3].data.d_float;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return x_point;
+}
+
+/**
+ * gimp_path_get_tattoo:
+ * @image_ID: The image.
+ * @name: The name of the path whose tattoo should be obtained.
+ *
+ * Deprecated: Use gimp_vectors_get_tattoo() instead.
+ *
+ * Returns: The tattoo associated with the named path.
+ **/
+gint
+gimp_path_get_tattoo (gint32 image_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint tattoo = 0;
+
+ return_vals = gimp_run_procedure ("gimp-path-get-tattoo",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ tattoo = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return tattoo;
+}
+
+/**
+ * gimp_path_set_tattoo:
+ * @image_ID: The image.
+ * @name: the name of the path whose tattoo should be set.
+ * @tattovalue: The tattoo associated with the name path. Only values returned from 'path_get_tattoo' should be used here.
+ *
+ * Deprecated: Use gimp_vectors_set_tattoo() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_path_set_tattoo (gint32 image_ID,
+ const gchar *name,
+ gint tattovalue)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-path-set-tattoo",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, tattovalue,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_get_path_by_tattoo:
+ * @image_ID: The image.
+ * @tattoo: The tattoo of the required path.
+ *
+ * Deprecated: Use gimp_image_get_vectors_by_tattoo() instead.
+ *
+ * Returns: The name of the path with the specified tattoo.
+ **/
+gchar *
+gimp_get_path_by_tattoo (gint32 image_ID,
+ gint tattoo)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-get-path-by-tattoo",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, tattoo,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_path_get_locked:
+ * @image_ID: The image.
+ * @name: The name of the path whose locked status should be obtained.
+ *
+ * Deprecated: Use gimp_vectors_get_linked() instead.
+ *
+ * Returns: TRUE if the path is locked, FALSE otherwise.
+ **/
+gboolean
+gimp_path_get_locked (gint32 image_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean locked = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-path-get-locked",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ locked = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return locked;
+}
+
+/**
+ * gimp_path_set_locked:
+ * @image_ID: The image.
+ * @name: the name of the path whose locked status should be set.
+ * @locked: Whether the path is locked.
+ *
+ * Deprecated: Use gimp_vectors_set_linked() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_path_set_locked (gint32 image_ID,
+ const gchar *name,
+ gboolean locked)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-path-set-locked",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, locked,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_path_to_selection:
+ * @image_ID: The image.
+ * @name: The name of the path which should be made into selection.
+ * @op: The desired operation with current selection.
+ * @antialias: Antialias selection.
+ * @feather: Feather selection.
+ * @feather_radius_x: Feather radius x.
+ * @feather_radius_y: Feather radius y.
+ *
+ * Deprecated: Use gimp_vectors_to_selection() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_path_to_selection (gint32 image_ID,
+ const gchar *name,
+ GimpChannelOps op,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-path-to-selection",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_INT32, op,
+ GIMP_PDB_INT32, antialias,
+ GIMP_PDB_INT32, feather,
+ GIMP_PDB_FLOAT, feather_radius_x,
+ GIMP_PDB_FLOAT, feather_radius_y,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_path_import:
+ * @image_ID: The image.
+ * @filename: The name of the SVG file to import.
+ * @merge: Merge paths into a single vectors object.
+ * @scale: Scale the SVG to image dimensions.
+ *
+ * Deprecated: Use gimp_vectors_import_from_file() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_path_import (gint32 image_ID,
+ const gchar *filename,
+ gboolean merge,
+ gboolean scale)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-path-import",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, filename,
+ GIMP_PDB_INT32, merge,
+ GIMP_PDB_INT32, scale,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimppaths_pdb.h b/libgimp/gimppaths_pdb.h
new file mode 100644
index 0000000..62df9a6
--- /dev/null
+++ b/libgimp/gimppaths_pdb.h
@@ -0,0 +1,99 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppaths_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PATHS_PDB_H__
+#define __GIMP_PATHS_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+GIMP_DEPRECATED_FOR(gimp_image_get_vectors)
+gchar** gimp_path_list (gint32 image_ID,
+ gint *num_paths);
+GIMP_DEPRECATED_FOR(gimp_image_get_active_vectors)
+gchar* gimp_path_get_current (gint32 image_ID);
+GIMP_DEPRECATED_FOR(gimp_image_set_active_vectors)
+gboolean gimp_path_set_current (gint32 image_ID,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_image_remove_vectors)
+gboolean gimp_path_delete (gint32 image_ID,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_vectors_stroke_get_points)
+gint gimp_path_get_points (gint32 image_ID,
+ const gchar *name,
+ gint *path_closed,
+ gint *num_path_point_details,
+ gdouble **points_pairs);
+GIMP_DEPRECATED_FOR(gimp_vectors_stroke_new_from_points)
+gboolean gimp_path_set_points (gint32 image_ID,
+ const gchar *name,
+ gint ptype,
+ gint num_path_points,
+ const gdouble *points_pairs);
+GIMP_DEPRECATED_FOR(gimp_edit_stroke_vectors)
+gboolean gimp_path_stroke_current (gint32 image_ID);
+GIMP_DEPRECATED_FOR(gimp_vectors_stroke_get_point_at_dist)
+gint gimp_path_get_point_at_dist (gint32 image_ID,
+ gdouble distance,
+ gint *y_point,
+ gdouble *slope);
+GIMP_DEPRECATED_FOR(gimp_vectors_get_tattoo)
+gint gimp_path_get_tattoo (gint32 image_ID,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_vectors_set_tattoo)
+gboolean gimp_path_set_tattoo (gint32 image_ID,
+ const gchar *name,
+ gint tattovalue);
+GIMP_DEPRECATED_FOR(gimp_image_get_vectors_by_tattoo)
+gchar* gimp_get_path_by_tattoo (gint32 image_ID,
+ gint tattoo);
+GIMP_DEPRECATED_FOR(gimp_vectors_get_linked)
+gboolean gimp_path_get_locked (gint32 image_ID,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_vectors_set_linked)
+gboolean gimp_path_set_locked (gint32 image_ID,
+ const gchar *name,
+ gboolean locked);
+GIMP_DEPRECATED_FOR(gimp_vectors_to_selection)
+gboolean gimp_path_to_selection (gint32 image_ID,
+ const gchar *name,
+ GimpChannelOps op,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y);
+GIMP_DEPRECATED_FOR(gimp_vectors_import_from_file)
+gboolean gimp_path_import (gint32 image_ID,
+ const gchar *filename,
+ gboolean merge,
+ gboolean scale);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PATHS_PDB_H__ */
diff --git a/libgimp/gimppattern_pdb.c b/libgimp/gimppattern_pdb.c
new file mode 100644
index 0000000..827b70f
--- /dev/null
+++ b/libgimp/gimppattern_pdb.c
@@ -0,0 +1,147 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppattern_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimppattern
+ * @title: gimppattern
+ * @short_description: Functions operating on a single pattern.
+ *
+ * Functions operating on a single pattern.
+ **/
+
+
+/**
+ * gimp_pattern_get_info:
+ * @name: The pattern name.
+ * @width: The pattern width.
+ * @height: The pattern height.
+ * @bpp: The pattern bpp.
+ *
+ * Retrieve information about the specified pattern.
+ *
+ * This procedure retrieves information about the specified pattern.
+ * This includes the pattern extents (width and height).
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_pattern_get_info (const gchar *name,
+ gint *width,
+ gint *height,
+ gint *bpp)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-pattern-get-info",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ *width = 0;
+ *height = 0;
+ *bpp = 0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *width = return_vals[1].data.d_int32;
+ *height = return_vals[2].data.d_int32;
+ *bpp = return_vals[3].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_pattern_get_pixels:
+ * @name: The pattern name.
+ * @width: The pattern width.
+ * @height: The pattern height.
+ * @bpp: The pattern bpp.
+ * @num_color_bytes: Number of pattern bytes.
+ * @color_bytes: The pattern data.
+ *
+ * Retrieve information about the specified pattern (including pixels).
+ *
+ * This procedure retrieves information about the specified. This
+ * includes the pattern extents (width and height), its bpp and its
+ * pixel data.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_pattern_get_pixels (const gchar *name,
+ gint *width,
+ gint *height,
+ gint *bpp,
+ gint *num_color_bytes,
+ guint8 **color_bytes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-pattern-get-pixels",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ *width = 0;
+ *height = 0;
+ *bpp = 0;
+ *num_color_bytes = 0;
+ *color_bytes = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *width = return_vals[1].data.d_int32;
+ *height = return_vals[2].data.d_int32;
+ *bpp = return_vals[3].data.d_int32;
+ *num_color_bytes = return_vals[4].data.d_int32;
+ *color_bytes = g_new (guint8, *num_color_bytes);
+ memcpy (*color_bytes,
+ return_vals[5].data.d_int8array,
+ *num_color_bytes * sizeof (guint8));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimppattern_pdb.h b/libgimp/gimppattern_pdb.h
new file mode 100644
index 0000000..7145798
--- /dev/null
+++ b/libgimp/gimppattern_pdb.h
@@ -0,0 +1,49 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppattern_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PATTERN_PDB_H__
+#define __GIMP_PATTERN_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_pattern_get_info (const gchar *name,
+ gint *width,
+ gint *height,
+ gint *bpp);
+gboolean gimp_pattern_get_pixels (const gchar *name,
+ gint *width,
+ gint *height,
+ gint *bpp,
+ gint *num_color_bytes,
+ guint8 **color_bytes);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PATTERN_PDB_H__ */
diff --git a/libgimp/gimppatternmenu.c b/libgimp/gimppatternmenu.c
new file mode 100644
index 0000000..995ff05
--- /dev/null
+++ b/libgimp/gimppatternmenu.c
@@ -0,0 +1,151 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppatternmenu.c
+ * Copyright (C) 1998 Andy Thomas
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimppatternmenu.h"
+#include "gimppatternselectbutton.h"
+
+
+/**
+ * SECTION: gimppatternmenu
+ * @title: gimppatternmenu
+ * @short_description: A widget for selecting patterns.
+ *
+ * A widget for selecting patterns.
+ **/
+
+
+typedef struct
+{
+ GimpRunPatternCallback callback;
+ gpointer data;
+} CompatCallbackData;
+
+
+static void compat_callback (GimpPatternSelectButton *pattern_button,
+ const gchar *pattern_name,
+ gint width,
+ gint height,
+ gint bytes,
+ const guchar *mask_data,
+ gboolean dialog_closing,
+ CompatCallbackData *data);
+static void compat_callback_data_free (CompatCallbackData *data);
+
+
+/**
+ * gimp_pattern_select_widget_new:
+ * @title: Title of the dialog to use or %NULL to use the default title.
+ * @pattern_name: Initial pattern name or %NULL to use current selection.
+ * @callback: A function to call when the selected pattern changes.
+ * @data: A pointer to arbitrary data to be used in the call to @callback.
+ *
+ * Creates a new #GtkWidget that completely controls the selection of
+ * a pattern. This widget is suitable for placement in a table in a
+ * plug-in dialog.
+ *
+ * Returns: A #GtkWidget that you can use in your UI.
+ */
+GtkWidget *
+gimp_pattern_select_widget_new (const gchar *title,
+ const gchar *pattern_name,
+ GimpRunPatternCallback callback,
+ gpointer data)
+{
+ GtkWidget *pattern_button;
+ CompatCallbackData *compat_data;
+
+ g_return_val_if_fail (callback != NULL, NULL);
+
+ pattern_button = gimp_pattern_select_button_new (title, pattern_name);
+
+ compat_data = g_slice_new (CompatCallbackData);
+
+ compat_data->callback = callback;
+ compat_data->data = data;
+
+ g_signal_connect_data (pattern_button, "pattern-set",
+ G_CALLBACK (compat_callback),
+ compat_data,
+ (GClosureNotify) compat_callback_data_free, 0);
+
+ return pattern_button;
+}
+
+/**
+ * gimp_pattern_select_widget_close:
+ * @widget: A pattern select widget.
+ *
+ * Closes the popup window associated with @widget.
+ */
+void
+gimp_pattern_select_widget_close (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+
+ gimp_select_button_close_popup (GIMP_SELECT_BUTTON (widget));
+}
+
+/**
+ * gimp_pattern_select_widget_set:
+ * @widget: A pattern select widget.
+ * @pattern_name: Pattern name to set. NULL means no change.
+ *
+ * Sets the current pattern for the pattern select widget. Calls the
+ * callback function if one was supplied in the call to
+ * gimp_pattern_select_widget_new().
+ */
+void
+gimp_pattern_select_widget_set (GtkWidget *widget,
+ const gchar *pattern_name)
+{
+ g_return_if_fail (widget != NULL);
+
+ gimp_pattern_select_button_set_pattern (GIMP_PATTERN_SELECT_BUTTON (widget),
+ pattern_name);
+}
+
+
+static void
+compat_callback (GimpPatternSelectButton *pattern_button,
+ const gchar *pattern_name,
+ gint width,
+ gint height,
+ gint bpp,
+ const guchar *mask_data,
+ gboolean dialog_closing,
+ CompatCallbackData *data)
+{
+ data->callback (pattern_name, width, height, bpp, mask_data,
+ dialog_closing, data->data);
+}
+
+static void
+compat_callback_data_free (CompatCallbackData *data)
+{
+ g_slice_free (CompatCallbackData, data);
+}
diff --git a/libgimp/gimppatternmenu.h b/libgimp/gimppatternmenu.h
new file mode 100644
index 0000000..7a25099
--- /dev/null
+++ b/libgimp/gimppatternmenu.h
@@ -0,0 +1,49 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppatternmenu.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PATTERN_MENU_H__
+#define __GIMP_PATTERN_MENU_H__
+
+/* These functions are deprecated and should not be used in newly
+ * written code.
+ */
+
+G_BEGIN_DECLS
+
+GIMP_DEPRECATED_FOR(gimp_pattern_select_button_new)
+GtkWidget * gimp_pattern_select_widget_new (const gchar *title,
+ const gchar *pattern_name,
+ GimpRunPatternCallback callback,
+ gpointer data);
+
+GIMP_DEPRECATED_FOR(gimp_select_button_close_popup)
+void gimp_pattern_select_widget_close (GtkWidget *widget);
+GIMP_DEPRECATED_FOR(gimp_pattern_select_button_set_brush)
+void gimp_pattern_select_widget_set (GtkWidget *widget,
+ const gchar *pattern_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PATTERN_MENU_H__ */
diff --git a/libgimp/gimppatterns.c b/libgimp/gimppatterns.c
new file mode 100644
index 0000000..9638b6b
--- /dev/null
+++ b/libgimp/gimppatterns.c
@@ -0,0 +1,40 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppatterns.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+#include "gimppatterns.h"
+
+/**
+ * gimp_patterns_set_pattern:
+ * @name: The pattern name.
+ *
+ * This procedure is deprecated! Use gimp_context_set_pattern() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_patterns_set_pattern (const gchar *name)
+{
+ return gimp_context_set_pattern (name);
+}
diff --git a/libgimp/gimppatterns.h b/libgimp/gimppatterns.h
new file mode 100644
index 0000000..5433576
--- /dev/null
+++ b/libgimp/gimppatterns.h
@@ -0,0 +1,37 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppatterns.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PATTERNS_H__
+#define __GIMP_PATTERNS_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+GIMP_DEPRECATED_FOR(gimp_context_set_pattern)
+gboolean gimp_patterns_set_pattern (const gchar *name);
+
+G_END_DECLS
+
+#endif /* __GIMP_PATTERNS_H__ */
diff --git a/libgimp/gimppatterns_pdb.c b/libgimp/gimppatterns_pdb.c
new file mode 100644
index 0000000..e30579e
--- /dev/null
+++ b/libgimp/gimppatterns_pdb.c
@@ -0,0 +1,194 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppatterns_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimppatterns
+ * @title: gimppatterns
+ * @short_description: Functions relating to patterns.
+ *
+ * Functions relating to patterns.
+ **/
+
+
+/**
+ * gimp_patterns_refresh:
+ *
+ * Refresh current patterns. This function always succeeds.
+ *
+ * This procedure retrieves all patterns currently in the user's
+ * pattern path and updates all pattern dialogs accordingly.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_patterns_refresh (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-patterns-refresh",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_patterns_get_list:
+ * @filter: An optional regular expression used to filter the list.
+ * @num_patterns: The number of patterns in the pattern list.
+ *
+ * Retrieve a complete listing of the available patterns.
+ *
+ * This procedure returns a complete listing of available GIMP
+ * patterns. Each name returned can be used as input to the
+ * gimp_context_set_pattern().
+ *
+ * Returns: The list of pattern names. The returned value must be freed
+ * with g_strfreev().
+ **/
+gchar **
+gimp_patterns_get_list (const gchar *filter,
+ gint *num_patterns)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar **pattern_list = NULL;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-patterns-get-list",
+ &nreturn_vals,
+ GIMP_PDB_STRING, filter,
+ GIMP_PDB_END);
+
+ *num_patterns = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_patterns = return_vals[1].data.d_int32;
+ if (*num_patterns > 0)
+ {
+ pattern_list = g_new0 (gchar *, *num_patterns + 1);
+ for (i = 0; i < *num_patterns; i++)
+ pattern_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return pattern_list;
+}
+
+/**
+ * gimp_patterns_get_pattern:
+ * @width: The pattern width.
+ * @height: The pattern height.
+ *
+ * Deprecated: Use gimp_context_get_pattern() instead.
+ *
+ * Returns: The pattern name.
+ **/
+gchar *
+gimp_patterns_get_pattern (gint *width,
+ gint *height)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-patterns-get-pattern",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ name = g_strdup (return_vals[1].data.d_string);
+ *width = return_vals[2].data.d_int32;
+ *height = return_vals[3].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return name;
+}
+
+/**
+ * gimp_patterns_get_pattern_data:
+ * @name: The pattern name (\"\" means currently active pattern).
+ * @width: The pattern width.
+ * @height: The pattern height.
+ * @mask_bpp: Pattern bytes per pixel.
+ * @length: Length of pattern mask data.
+ * @mask_data: The pattern mask data.
+ *
+ * Deprecated: Use gimp_pattern_get_pixels() instead.
+ *
+ * Returns: The pattern name.
+ **/
+gchar *
+gimp_patterns_get_pattern_data (const gchar *name,
+ gint *width,
+ gint *height,
+ gint *mask_bpp,
+ gint *length,
+ guint8 **mask_data)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *actual_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-patterns-get-pattern-data",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ *length = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ actual_name = g_strdup (return_vals[1].data.d_string);
+ *width = return_vals[2].data.d_int32;
+ *height = return_vals[3].data.d_int32;
+ *mask_bpp = return_vals[4].data.d_int32;
+ *length = return_vals[5].data.d_int32;
+ *mask_data = g_new (guint8, *length);
+ memcpy (*mask_data,
+ return_vals[6].data.d_int8array,
+ *length * sizeof (guint8));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return actual_name;
+}
diff --git a/libgimp/gimppatterns_pdb.h b/libgimp/gimppatterns_pdb.h
new file mode 100644
index 0000000..a339a88
--- /dev/null
+++ b/libgimp/gimppatterns_pdb.h
@@ -0,0 +1,52 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppatterns_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PATTERNS_PDB_H__
+#define __GIMP_PATTERNS_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_patterns_refresh (void);
+gchar** gimp_patterns_get_list (const gchar *filter,
+ gint *num_patterns);
+GIMP_DEPRECATED_FOR(gimp_context_get_pattern)
+gchar* gimp_patterns_get_pattern (gint *width,
+ gint *height);
+GIMP_DEPRECATED_FOR(gimp_pattern_get_pixels)
+gchar* gimp_patterns_get_pattern_data (const gchar *name,
+ gint *width,
+ gint *height,
+ gint *mask_bpp,
+ gint *length,
+ guint8 **mask_data);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PATTERNS_PDB_H__ */
diff --git a/libgimp/gimppatternselect.c b/libgimp/gimppatternselect.c
new file mode 100644
index 0000000..6cb2783
--- /dev/null
+++ b/libgimp/gimppatternselect.c
@@ -0,0 +1,230 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppatternselect.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+typedef struct
+{
+ gchar *pattern_callback;
+ guint idle_id;
+ gchar *pattern_name;
+ gint width;
+ gint height;
+ gint bytes;
+ guchar *pattern_mask_data;
+ GimpRunPatternCallback callback;
+ gboolean closing;
+ gpointer data;
+} GimpPatternData;
+
+
+/* local function prototypes */
+
+static void gimp_pattern_data_free (GimpPatternData *data);
+
+static void gimp_temp_pattern_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals);
+static gboolean gimp_temp_pattern_run_idle (GimpPatternData *pattern_data);
+
+
+/* private variables */
+
+static GHashTable *gimp_pattern_select_ht = NULL;
+
+
+/* public functions */
+
+const gchar *
+gimp_pattern_select_new (const gchar *title,
+ const gchar *pattern_name,
+ GimpRunPatternCallback callback,
+ gpointer data)
+{
+ static const GimpParamDef args[] =
+ {
+ { GIMP_PDB_STRING, "str", "String" },
+ { GIMP_PDB_INT32, "mask-width", "Pattern width" },
+ { GIMP_PDB_INT32, "mask-height", "Pattern height" },
+ { GIMP_PDB_INT32, "mask-bpp", "Pattern bytes per pixel" },
+ { GIMP_PDB_INT32, "mask-len", "Length of pattern mask data" },
+ { GIMP_PDB_INT8ARRAY,"mask-data", "The pattern mask data" },
+ { GIMP_PDB_INT32, "dialog-status", "If the dialog was closing "
+ "[0 = No, 1 = Yes]" }
+ };
+
+ gchar *pattern_callback = gimp_procedural_db_temp_name ();
+
+ gimp_install_temp_proc (pattern_callback,
+ "Temporary pattern popup callback procedure",
+ "",
+ "",
+ "",
+ "",
+ NULL,
+ "",
+ GIMP_TEMPORARY,
+ G_N_ELEMENTS (args), 0,
+ args, NULL,
+ gimp_temp_pattern_run);
+
+ if (gimp_patterns_popup (pattern_callback, title, pattern_name))
+ {
+ GimpPatternData *pattern_data;
+
+ gimp_extension_enable (); /* Allow callbacks to be watched */
+
+ /* Now add to hash table so we can find it again */
+ if (! gimp_pattern_select_ht)
+ {
+ gimp_pattern_select_ht =
+ g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free,
+ (GDestroyNotify) gimp_pattern_data_free);
+ }
+
+ pattern_data = g_slice_new0 (GimpPatternData);
+
+ pattern_data->pattern_callback = pattern_callback;
+ pattern_data->callback = callback;
+ pattern_data->data = data;
+
+ g_hash_table_insert (gimp_pattern_select_ht,
+ pattern_callback, pattern_data);
+
+ return pattern_callback;
+ }
+
+ gimp_uninstall_temp_proc (pattern_callback);
+ g_free (pattern_callback);
+
+ return NULL;
+}
+
+void
+gimp_pattern_select_destroy (const gchar *pattern_callback)
+{
+ GimpPatternData *pattern_data;
+
+ g_return_if_fail (pattern_callback != NULL);
+ g_return_if_fail (gimp_pattern_select_ht != NULL);
+
+ pattern_data = g_hash_table_lookup (gimp_pattern_select_ht,
+ pattern_callback);
+
+ if (! pattern_data)
+ {
+ g_warning ("Can't find internal pattern data");
+ return;
+ }
+
+ if (pattern_data->idle_id)
+ g_source_remove (pattern_data->idle_id);
+
+ g_free (pattern_data->pattern_name);
+ g_free (pattern_data->pattern_mask_data);
+
+ if (pattern_data->pattern_callback)
+ gimp_patterns_close_popup (pattern_data->pattern_callback);
+
+ gimp_uninstall_temp_proc (pattern_callback);
+
+ g_hash_table_remove (gimp_pattern_select_ht, pattern_callback);
+}
+
+
+/* private functions */
+
+static void
+gimp_pattern_data_free (GimpPatternData *data)
+{
+ g_slice_free (GimpPatternData, data);
+}
+
+static void
+gimp_temp_pattern_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals)
+{
+ static GimpParam values[1];
+ GimpPatternData *pattern_data;
+
+ pattern_data = g_hash_table_lookup (gimp_pattern_select_ht, name);
+
+ if (! pattern_data)
+ {
+ g_warning ("Can't find internal pattern data");
+ }
+ else
+ {
+ g_free (pattern_data->pattern_name);
+ g_free (pattern_data->pattern_mask_data);
+
+ pattern_data->pattern_name = g_strdup (param[0].data.d_string);
+ pattern_data->width = param[1].data.d_int32;
+ pattern_data->height = param[2].data.d_int32;
+ pattern_data->bytes = param[3].data.d_int32;
+ pattern_data->pattern_mask_data = g_memdup (param[5].data.d_int8array,
+ param[4].data.d_int32);
+ pattern_data->closing = param[6].data.d_int32;
+
+ if (! pattern_data->idle_id)
+ pattern_data->idle_id = g_idle_add ((GSourceFunc) gimp_temp_pattern_run_idle,
+ pattern_data);
+ }
+
+ *nreturn_vals = 1;
+ *return_vals = values;
+
+ values[0].type = GIMP_PDB_STATUS;
+ values[0].data.d_status = GIMP_PDB_SUCCESS;
+}
+
+static gboolean
+gimp_temp_pattern_run_idle (GimpPatternData *pattern_data)
+{
+ pattern_data->idle_id = 0;
+
+ if (pattern_data->callback)
+ pattern_data->callback (pattern_data->pattern_name,
+ pattern_data->width,
+ pattern_data->height,
+ pattern_data->bytes,
+ pattern_data->pattern_mask_data,
+ pattern_data->closing,
+ pattern_data->data);
+
+ if (pattern_data->closing)
+ {
+ gchar *pattern_callback = pattern_data->pattern_callback;
+
+ pattern_data->pattern_callback = NULL;
+ gimp_pattern_select_destroy (pattern_callback);
+ }
+
+ return FALSE;
+}
diff --git a/libgimp/gimppatternselect.h b/libgimp/gimppatternselect.h
new file mode 100644
index 0000000..66a91b7
--- /dev/null
+++ b/libgimp/gimppatternselect.h
@@ -0,0 +1,49 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppatternselect.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PATTERN_SELECT_H__
+#define __GIMP_PATTERN_SELECT_H__
+
+G_BEGIN_DECLS
+
+
+typedef void (* GimpRunPatternCallback) (const gchar *pattern_name,
+ gint width,
+ gint height,
+ gint bpp,
+ const guchar *mask_data,
+ gboolean dialog_closing,
+ gpointer user_data);
+
+
+const gchar * gimp_pattern_select_new (const gchar *title,
+ const gchar *pattern_name,
+ GimpRunPatternCallback callback,
+ gpointer data);
+void gimp_pattern_select_destroy (const gchar *pattern_callback);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PATTERN_SELECT_H__ */
diff --git a/libgimp/gimppatternselect_pdb.c b/libgimp/gimppatternselect_pdb.c
new file mode 100644
index 0000000..12ea47f
--- /dev/null
+++ b/libgimp/gimppatternselect_pdb.c
@@ -0,0 +1,131 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppatternselect_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimppatternselect
+ * @title: gimppatternselect
+ * @short_description: Functions providing a pattern selection dialog.
+ *
+ * Functions providing a pattern selection dialog.
+ **/
+
+
+/**
+ * gimp_patterns_popup:
+ * @pattern_callback: The callback PDB proc to call when pattern selection is made.
+ * @popup_title: Title of the pattern selection dialog.
+ * @initial_pattern: The name of the pattern to set as the first selected.
+ *
+ * Invokes the Gimp pattern selection.
+ *
+ * This procedure opens the pattern selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_patterns_popup (const gchar *pattern_callback,
+ const gchar *popup_title,
+ const gchar *initial_pattern)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-patterns-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, pattern_callback,
+ GIMP_PDB_STRING, popup_title,
+ GIMP_PDB_STRING, initial_pattern,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_patterns_close_popup:
+ * @pattern_callback: The name of the callback registered for this pop-up.
+ *
+ * Close the pattern selection dialog.
+ *
+ * This procedure closes an opened pattern selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_patterns_close_popup (const gchar *pattern_callback)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-patterns-close-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, pattern_callback,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_patterns_set_popup:
+ * @pattern_callback: The name of the callback registered for this pop-up.
+ * @pattern_name: The name of the pattern to set as selected.
+ *
+ * Sets the current pattern in a pattern selection dialog.
+ *
+ * Sets the current pattern in a pattern selection dialog.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_patterns_set_popup (const gchar *pattern_callback,
+ const gchar *pattern_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-patterns-set-popup",
+ &nreturn_vals,
+ GIMP_PDB_STRING, pattern_callback,
+ GIMP_PDB_STRING, pattern_name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimppatternselect_pdb.h b/libgimp/gimppatternselect_pdb.h
new file mode 100644
index 0000000..50a0428
--- /dev/null
+++ b/libgimp/gimppatternselect_pdb.h
@@ -0,0 +1,45 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimppatternselect_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PATTERN_SELECT_PDB_H__
+#define __GIMP_PATTERN_SELECT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_patterns_popup (const gchar *pattern_callback,
+ const gchar *popup_title,
+ const gchar *initial_pattern);
+gboolean gimp_patterns_close_popup (const gchar *pattern_callback);
+gboolean gimp_patterns_set_popup (const gchar *pattern_callback,
+ const gchar *pattern_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PATTERN_SELECT_PDB_H__ */
diff --git a/libgimp/gimppatternselectbutton.c b/libgimp/gimppatternselectbutton.c
new file mode 100644
index 0000000..af37fad
--- /dev/null
+++ b/libgimp/gimppatternselectbutton.c
@@ -0,0 +1,730 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppatternselectbutton.c
+ * Copyright (C) 1998 Andy Thomas
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimppatternselectbutton.h"
+#include "gimpuimarshal.h"
+
+#include "libgimp-intl.h"
+
+
+/**
+ * SECTION: gimppatternselectbutton
+ * @title: GimpPatternSelectButton
+ * @short_description: A button which pops up a pattern select dialog.
+ *
+ * A button which pops up a pattern select dialog.
+ **/
+
+
+#define CELL_SIZE 20
+
+
+#define GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE(obj) ((GimpPatternSelectButtonPrivate *) gimp_pattern_select_button_get_instance_private ((GimpPatternSelectButton *) (obj)))
+
+typedef struct _GimpPatternSelectButtonPrivate GimpPatternSelectButtonPrivate;
+
+struct _GimpPatternSelectButtonPrivate
+{
+ gchar *title;
+
+ gchar *pattern_name; /* Local copy */
+ gint width;
+ gint height;
+ gint bytes;
+ guchar *mask_data; /* local copy */
+
+ GtkWidget *inside;
+ GtkWidget *preview;
+ GtkWidget *popup;
+};
+
+enum
+{
+ PATTERN_SET,
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_TITLE,
+ PROP_PATTERN_NAME
+};
+
+
+/* local function prototypes */
+
+static void gimp_pattern_select_button_finalize (GObject *object);
+
+static void gimp_pattern_select_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_pattern_select_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_pattern_select_button_clicked (GimpPatternSelectButton *button);
+
+static void gimp_pattern_select_button_callback (const gchar *pattern_name,
+ gint width,
+ gint height,
+ gint bytes,
+ const guchar *mask_data,
+ gboolean dialog_closing,
+ gpointer user_data);
+
+static void gimp_pattern_select_preview_resize (GimpPatternSelectButton *button);
+static gboolean gimp_pattern_select_preview_events (GtkWidget *widget,
+ GdkEvent *event,
+ GimpPatternSelectButton *button);
+static void gimp_pattern_select_preview_update (GtkWidget *preview,
+ gint width,
+ gint height,
+ gint bytes,
+ const guchar *mask_data);
+
+static void gimp_pattern_select_button_open_popup (GimpPatternSelectButton *button,
+ gint x,
+ gint y);
+static void gimp_pattern_select_button_close_popup (GimpPatternSelectButton *button);
+
+static void gimp_pattern_select_drag_data_received (GimpPatternSelectButton *button,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time);
+
+static GtkWidget * gimp_pattern_select_button_create_inside (GimpPatternSelectButton *button);
+
+
+static const GtkTargetEntry target = { "application/x-gimp-pattern-name", 0 };
+
+static guint pattern_button_signals[LAST_SIGNAL] = { 0 };
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpPatternSelectButton, gimp_pattern_select_button,
+ GIMP_TYPE_SELECT_BUTTON)
+
+static void
+gimp_pattern_select_button_class_init (GimpPatternSelectButtonClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GimpSelectButtonClass *select_button_class = GIMP_SELECT_BUTTON_CLASS (klass);
+
+ object_class->finalize = gimp_pattern_select_button_finalize;
+ object_class->set_property = gimp_pattern_select_button_set_property;
+ object_class->get_property = gimp_pattern_select_button_get_property;
+
+ select_button_class->select_destroy = gimp_pattern_select_destroy;
+
+ klass->pattern_set = NULL;
+
+ /**
+ * GimpPatternSelectButton:title:
+ *
+ * The title to be used for the pattern selection popup dialog.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_TITLE,
+ g_param_spec_string ("title",
+ "Title",
+ "The title to be used for the pattern selection popup dialog",
+ _("Pattern Selection"),
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * GimpPatternSelectButton:pattern-name:
+ *
+ * The name of the currently selected pattern.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_PATTERN_NAME,
+ g_param_spec_string ("pattern-name",
+ "Pattern name",
+ "The name of the currently selected pattern",
+ NULL,
+ GIMP_PARAM_READWRITE));
+
+ /**
+ * GimpPatternSelectButton::pattern-set:
+ * @widget: the object which received the signal.
+ * @pattern_name: the name of the currently selected pattern.
+ * @width: width of the pattern
+ * @height: height of the pattern
+ * @bpp: bpp of the pattern
+ * @mask_data: pattern mask data
+ * @dialog_closing: whether the dialog was closed or not.
+ *
+ * The ::pattern-set signal is emitted when the user selects a pattern.
+ *
+ * Since: 2.4
+ */
+ pattern_button_signals[PATTERN_SET] =
+ g_signal_new ("pattern-set",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpPatternSelectButtonClass, pattern_set),
+ NULL, NULL,
+ _gimpui_marshal_VOID__STRING_INT_INT_INT_POINTER_BOOLEAN,
+ G_TYPE_NONE, 6,
+ G_TYPE_STRING,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ G_TYPE_POINTER,
+ G_TYPE_BOOLEAN);
+}
+
+static void
+gimp_pattern_select_button_init (GimpPatternSelectButton *button)
+{
+ GimpPatternSelectButtonPrivate *priv;
+ gint mask_data_size;
+
+ priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+
+ priv->pattern_name = gimp_context_get_pattern ();
+ gimp_pattern_get_pixels (priv->pattern_name,
+ &priv->width,
+ &priv->height,
+ &priv->bytes,
+ &mask_data_size,
+ &priv->mask_data);
+
+ priv->inside = gimp_pattern_select_button_create_inside (button);
+ gtk_container_add (GTK_CONTAINER (button), priv->inside);
+
+ priv->popup = NULL;
+}
+
+/**
+ * gimp_pattern_select_button_new:
+ * @title: Title of the dialog to use or %NULL to use the default title.
+ * @pattern_name: Initial pattern name or %NULL to use current selection.
+ *
+ * Creates a new #GtkWidget that completely controls the selection of
+ * a pattern. This widget is suitable for placement in a table in a
+ * plug-in dialog.
+ *
+ * Returns: A #GtkWidget that you can use in your UI.
+ *
+ * Since: 2.4
+ */
+GtkWidget *
+gimp_pattern_select_button_new (const gchar *title,
+ const gchar *pattern_name)
+{
+ GtkWidget *button;
+
+ if (title)
+ button = g_object_new (GIMP_TYPE_PATTERN_SELECT_BUTTON,
+ "title", title,
+ "pattern-name", pattern_name,
+ NULL);
+ else
+ button = g_object_new (GIMP_TYPE_PATTERN_SELECT_BUTTON,
+ "pattern-name", pattern_name,
+ NULL);
+
+ return button;
+}
+
+/**
+ * gimp_pattern_select_button_get_pattern:
+ * @button: A #GimpPatternSelectButton
+ *
+ * Retrieves the name of currently selected pattern.
+ *
+ * Returns: an internal copy of the pattern name which must not be freed.
+ *
+ * Since: 2.4
+ */
+const gchar *
+gimp_pattern_select_button_get_pattern (GimpPatternSelectButton *button)
+{
+ GimpPatternSelectButtonPrivate *priv;
+
+ g_return_val_if_fail (GIMP_IS_PATTERN_SELECT_BUTTON (button), NULL);
+
+ priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+ return priv->pattern_name;
+}
+
+/**
+ * gimp_pattern_select_button_set_pattern:
+ * @button: A #GimpPatternSelectButton
+ * @pattern_name: Pattern name to set; %NULL means no change.
+ *
+ * Sets the current pattern for the pattern select button.
+ *
+ * Since: 2.4
+ */
+void
+gimp_pattern_select_button_set_pattern (GimpPatternSelectButton *button,
+ const gchar *pattern_name)
+{
+ GimpSelectButton *select_button;
+
+ g_return_if_fail (GIMP_IS_PATTERN_SELECT_BUTTON (button));
+
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ if (select_button->temp_callback)
+ {
+ gimp_patterns_set_popup (select_button->temp_callback, pattern_name);
+ }
+ else
+ {
+ gchar *name;
+ gint width;
+ gint height;
+ gint bytes;
+ gint mask_data_size;
+ guint8 *mask_data;
+
+ if (pattern_name && *pattern_name)
+ name = g_strdup (pattern_name);
+ else
+ name = gimp_context_get_pattern ();
+
+ if (gimp_pattern_get_pixels (name,
+ &width,
+ &height,
+ &bytes,
+ &mask_data_size,
+ &mask_data))
+ {
+ gimp_pattern_select_button_callback (name,
+ width, height, bytes, mask_data,
+ FALSE, button);
+
+ g_free (mask_data);
+ }
+
+ g_free (name);
+ }
+}
+
+
+/* private functions */
+
+static void
+gimp_pattern_select_button_finalize (GObject *object)
+{
+ GimpPatternSelectButtonPrivate *priv;
+
+ priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (object);
+
+ g_clear_pointer (&priv->pattern_name, g_free);
+ g_clear_pointer (&priv->mask_data, g_free);
+ g_clear_pointer (&priv->title, g_free);
+
+ G_OBJECT_CLASS (gimp_pattern_select_button_parent_class)->finalize (object);
+}
+
+static void
+gimp_pattern_select_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpPatternSelectButton *button;
+ GimpPatternSelectButtonPrivate *priv;
+
+ button = GIMP_PATTERN_SELECT_BUTTON (object);
+ priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+
+ switch (property_id)
+ {
+ case PROP_TITLE:
+ priv->title = g_value_dup_string (value);
+ break;
+ case PROP_PATTERN_NAME:
+ gimp_pattern_select_button_set_pattern (button,
+ g_value_get_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_pattern_select_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpPatternSelectButton *button;
+ GimpPatternSelectButtonPrivate *priv;
+
+ button = GIMP_PATTERN_SELECT_BUTTON (object);
+ priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+
+ switch (property_id)
+ {
+ case PROP_TITLE:
+ g_value_set_string (value, priv->title);
+ break;
+ case PROP_PATTERN_NAME:
+ g_value_set_string (value, priv->pattern_name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_pattern_select_button_callback (const gchar *pattern_name,
+ gint width,
+ gint height,
+ gint bytes,
+ const guchar *mask_data,
+ gboolean dialog_closing,
+ gpointer user_data)
+{
+ GimpPatternSelectButton *button;
+ GimpPatternSelectButtonPrivate *priv;
+ GimpSelectButton *select_button;
+
+ button = GIMP_PATTERN_SELECT_BUTTON (user_data);
+
+ priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ g_free (priv->pattern_name);
+ g_free (priv->mask_data);
+
+ priv->pattern_name = g_strdup (pattern_name);
+ priv->width = width;
+ priv->height = height;
+ priv->bytes = bytes;
+ priv->mask_data = g_memdup (mask_data, width * height * bytes);
+
+ gimp_pattern_select_preview_update (priv->preview,
+ width, height, bytes, mask_data);
+
+ if (dialog_closing)
+ select_button->temp_callback = NULL;
+
+ g_signal_emit (button, pattern_button_signals[PATTERN_SET], 0,
+ pattern_name, width, height, bytes, dialog_closing);
+ g_object_notify (G_OBJECT (button), "pattern-name");
+}
+
+static void
+gimp_pattern_select_button_clicked (GimpPatternSelectButton *button)
+{
+ GimpPatternSelectButtonPrivate *priv;
+ GimpSelectButton *select_button;
+
+ priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+ select_button = GIMP_SELECT_BUTTON (button);
+
+ if (select_button->temp_callback)
+ {
+ /* calling gimp_patterns_set_popup() raises the dialog */
+ gimp_patterns_set_popup (select_button->temp_callback,
+ priv->pattern_name);
+ }
+ else
+ {
+ select_button->temp_callback =
+ gimp_pattern_select_new (priv->title, priv->pattern_name,
+ gimp_pattern_select_button_callback,
+ button);
+ }
+}
+
+static void
+gimp_pattern_select_preview_resize (GimpPatternSelectButton *button)
+{
+ GimpPatternSelectButtonPrivate *priv;
+
+ priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+
+ if (priv->width > 0 && priv->height > 0)
+ gimp_pattern_select_preview_update (priv->preview,
+ priv->width,
+ priv->height,
+ priv->bytes,
+ priv->mask_data);
+}
+
+static gboolean
+gimp_pattern_select_preview_events (GtkWidget *widget,
+ GdkEvent *event,
+ GimpPatternSelectButton *button)
+{
+ GimpPatternSelectButtonPrivate *priv;
+ GdkEventButton *bevent;
+
+ priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+
+ if (priv->mask_data)
+ {
+ switch (event->type)
+ {
+ case GDK_BUTTON_PRESS:
+ bevent = (GdkEventButton *) event;
+
+ if (bevent->button == 1)
+ {
+ gtk_grab_add (widget);
+ gimp_pattern_select_button_open_popup (button,
+ bevent->x, bevent->y);
+ }
+ break;
+
+ case GDK_BUTTON_RELEASE:
+ bevent = (GdkEventButton *) event;
+
+ if (bevent->button == 1)
+ {
+ gtk_grab_remove (widget);
+ gimp_pattern_select_button_close_popup (button);
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return FALSE;
+}
+
+static void
+gimp_pattern_select_preview_update (GtkWidget *preview,
+ gint width,
+ gint height,
+ gint bytes,
+ const guchar *mask_data)
+{
+ GimpImageType type;
+
+ switch (bytes)
+ {
+ case 1: type = GIMP_GRAY_IMAGE; break;
+ case 2: type = GIMP_GRAYA_IMAGE; break;
+ case 3: type = GIMP_RGB_IMAGE; break;
+ case 4: type = GIMP_RGBA_IMAGE; break;
+ default:
+ return;
+ }
+
+ gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview),
+ 0, 0, width, height,
+ type,
+ mask_data,
+ width * bytes);
+}
+
+static void
+gimp_pattern_select_button_open_popup (GimpPatternSelectButton *button,
+ gint x,
+ gint y)
+{
+ GimpPatternSelectButtonPrivate *priv;
+ GtkWidget *frame;
+ GtkWidget *preview;
+ GdkScreen *screen;
+ gint x_org;
+ gint y_org;
+ gint scr_w;
+ gint scr_h;
+
+ priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+
+ if (priv->popup)
+ gimp_pattern_select_button_close_popup (button);
+
+ if (priv->width <= CELL_SIZE && priv->height <= CELL_SIZE)
+ return;
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (button));
+
+ priv->popup = gtk_window_new (GTK_WINDOW_POPUP);
+ gtk_window_set_type_hint (GTK_WINDOW (priv->popup), GDK_WINDOW_TYPE_HINT_DND);
+ gtk_window_set_screen (GTK_WINDOW (priv->popup), screen);
+
+ frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
+ gtk_container_add (GTK_CONTAINER (priv->popup), frame);
+ gtk_widget_show (frame);
+
+ preview = gimp_preview_area_new ();
+ gtk_widget_set_size_request (preview, priv->width, priv->height);
+ gtk_container_add (GTK_CONTAINER (frame), preview);
+ gtk_widget_show (preview);
+
+ /* decide where to put the popup */
+ gdk_window_get_origin (gtk_widget_get_window (priv->preview),
+ &x_org, &y_org);
+
+ scr_w = gdk_screen_get_width (screen);
+ scr_h = gdk_screen_get_height (screen);
+
+ x = x_org + x - (priv->width / 2);
+ y = y_org + y - (priv->height / 2);
+ x = (x < 0) ? 0 : x;
+ y = (y < 0) ? 0 : y;
+ x = (x + priv->width > scr_w) ? scr_w - priv->width : x;
+ y = (y + priv->height > scr_h) ? scr_h - priv->height : y;
+
+ gtk_window_move (GTK_WINDOW (priv->popup), x, y);
+
+ gtk_widget_show (priv->popup);
+
+ /* Draw the pattern */
+ gimp_pattern_select_preview_update (preview,
+ priv->width,
+ priv->height,
+ priv->bytes,
+ priv->mask_data);
+}
+
+static void
+gimp_pattern_select_button_close_popup (GimpPatternSelectButton *button)
+{
+ GimpPatternSelectButtonPrivate *priv;
+
+ priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
+
+ if (priv->popup)
+ {
+ gtk_widget_destroy (priv->popup);
+ priv->popup = NULL;
+ }
+}
+
+static void
+gimp_pattern_select_drag_data_received (GimpPatternSelectButton *button,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection,
+ guint info,
+ guint time)
+{
+ gint length = gtk_selection_data_get_length (selection);
+ gchar *str;
+
+ if (gtk_selection_data_get_format (selection) != 8 || length < 1)
+ {
+ g_warning ("Received invalid pattern data!");
+ return;
+ }
+
+ str = g_strndup ((const gchar *) gtk_selection_data_get_data (selection),
+ length);
+
+ if (g_utf8_validate (str, -1, NULL))
+ {
+ gint pid;
+ gpointer unused;
+ gint name_offset = 0;
+
+ if (sscanf (str, "%i:%p:%n", &pid, &unused, &name_offset) >= 2 &&
+ pid == gimp_getpid () && name_offset > 0)
+ {
+ gchar *name = str + name_offset;
+
+ gimp_pattern_select_button_set_pattern (button, name);
+ }
+ }
+
+ g_free (str);
+}
+
+static GtkWidget *
+gimp_pattern_select_button_create_inside (GimpPatternSelectButton *pattern_button)
+{
+ GtkWidget *hbox;
+ GtkWidget *frame;
+ GtkWidget *button;
+ GimpPatternSelectButtonPrivate *priv;
+
+ priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (pattern_button);
+
+ gtk_widget_push_composite_child ();
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+
+ frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
+ gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
+
+ priv->preview = gimp_preview_area_new ();
+ gtk_widget_add_events (priv->preview,
+ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
+ gtk_widget_set_size_request (priv->preview, CELL_SIZE, CELL_SIZE);
+ gtk_container_add (GTK_CONTAINER (frame), priv->preview);
+
+ g_signal_connect_swapped (priv->preview, "size-allocate",
+ G_CALLBACK (gimp_pattern_select_preview_resize),
+ pattern_button);
+ g_signal_connect (priv->preview, "event",
+ G_CALLBACK (gimp_pattern_select_preview_events),
+ pattern_button);
+
+ gtk_drag_dest_set (GTK_WIDGET (priv->preview),
+ GTK_DEST_DEFAULT_HIGHLIGHT |
+ GTK_DEST_DEFAULT_MOTION |
+ GTK_DEST_DEFAULT_DROP,
+ &target, 1,
+ GDK_ACTION_COPY);
+
+ g_signal_connect_swapped (priv->preview, "drag-data-received",
+ G_CALLBACK (gimp_pattern_select_drag_data_received),
+ pattern_button);
+
+ button = gtk_button_new_with_mnemonic (_("_Browse..."));
+ gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
+
+ g_signal_connect_swapped (button, "clicked",
+ G_CALLBACK (gimp_pattern_select_button_clicked),
+ pattern_button);
+
+ gtk_widget_show_all (hbox);
+
+ gtk_widget_pop_composite_child ();
+
+ return hbox;
+}
diff --git a/libgimp/gimppatternselectbutton.h b/libgimp/gimppatternselectbutton.h
new file mode 100644
index 0000000..934a402
--- /dev/null
+++ b/libgimp/gimppatternselectbutton.h
@@ -0,0 +1,83 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppatternselectbutton.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PATTERN_SELECT_BUTTON_H__
+#define __GIMP_PATTERN_SELECT_BUTTON_H__
+
+#include <libgimp/gimpselectbutton.h>
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+#define GIMP_TYPE_PATTERN_SELECT_BUTTON (gimp_pattern_select_button_get_type ())
+#define GIMP_PATTERN_SELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PATTERN_SELECT_BUTTON, GimpPatternSelectButton))
+#define GIMP_PATTERN_SELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PATTERN_SELECT_BUTTON, GimpPatternSelectButtonClass))
+#define GIMP_IS_PATTERN_SELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PATTERN_SELECT_BUTTON))
+#define GIMP_IS_PATTERN_SELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PATTERN_SELECT_BUTTON))
+#define GIMP_PATTERN_SELECT_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PATTERN_SELECT_BUTTON, GimpPatternSelectButtonClass))
+
+
+typedef struct _GimpPatternSelectButtonClass GimpPatternSelectButtonClass;
+
+struct _GimpPatternSelectButton
+{
+ GimpSelectButton parent_instance;
+};
+
+struct _GimpPatternSelectButtonClass
+{
+ GimpSelectButtonClass parent_class;
+
+ /* pattern_set signal is emitted when pattern is chosen */
+ void (* pattern_set) (GimpPatternSelectButton *button,
+ const gchar *pattern_name,
+ gint width,
+ gint height,
+ gint bpp,
+ const guchar *mask_data,
+ gboolean dialog_closing);
+
+ /* Padding for future expansion */
+ void (*_gimp_reserved1) (void);
+ void (*_gimp_reserved2) (void);
+ void (*_gimp_reserved3) (void);
+ void (*_gimp_reserved4) (void);
+};
+
+
+GType gimp_pattern_select_button_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_pattern_select_button_new (const gchar *title,
+ const gchar *pattern_name);
+
+const gchar * gimp_pattern_select_button_get_pattern (GimpPatternSelectButton *button);
+void gimp_pattern_select_button_set_pattern (GimpPatternSelectButton *button,
+ const gchar *pattern_name);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PATTERN_SELECT_BUTTON_H__ */
diff --git a/libgimp/gimppixbuf.c b/libgimp/gimppixbuf.c
new file mode 100644
index 0000000..bd3cb46
--- /dev/null
+++ b/libgimp/gimppixbuf.c
@@ -0,0 +1,302 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppixbuf.c
+ * Copyright (C) 2004 Sven Neumann <sven@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+#include "gimppixbuf.h"
+
+
+/**
+ * SECTION: gimppixbuf
+ * @title: gimppixbuf
+ * @short_description: Get a thumbnail pixbuf for a drawable or image.
+ *
+ * Get a thumbnail pixbuf for a drawable or image.
+ **/
+
+
+static GdkPixbuf * gimp_pixbuf_from_data (guchar *data,
+ gint width,
+ gint height,
+ gint bpp,
+ GimpPixbufTransparency alpha);
+
+
+/**
+ * gimp_image_get_thumbnail:
+ * @image_ID: the image ID
+ * @width: the requested thumbnail width (<= 1024 pixels)
+ * @height: the requested thumbnail height (<= 1024 pixels)
+ * @alpha: how to handle an alpha channel
+ *
+ * Retrieves a thumbnail pixbuf for the image identified by @image_ID.
+ * The thumbnail will be not larger than the requested size.
+ *
+ * Return value: a new #GdkPixbuf
+ *
+ * Since: 2.2
+ **/
+GdkPixbuf *
+gimp_image_get_thumbnail (gint32 image_ID,
+ gint width,
+ gint height,
+ GimpPixbufTransparency alpha)
+{
+ gint thumb_width = width;
+ gint thumb_height = height;
+ gint thumb_bpp;
+ guchar *data;
+
+ g_return_val_if_fail (width > 0 && width <= 1024, NULL);
+ g_return_val_if_fail (height > 0 && height <= 1024, NULL);
+
+ data = gimp_image_get_thumbnail_data (image_ID,
+ &thumb_width,
+ &thumb_height,
+ &thumb_bpp);
+ if (data)
+ return gimp_pixbuf_from_data (data,
+ thumb_width, thumb_height, thumb_bpp,
+ alpha);
+ else
+ return NULL;
+}
+
+/**
+ * gimp_drawable_get_thumbnail:
+ * @drawable_ID: the drawable ID
+ * @width: the requested thumbnail width (<= 1024 pixels)
+ * @height: the requested thumbnail height (<= 1024 pixels)
+ * @alpha: how to handle an alpha channel
+ *
+ * Retrieves a thumbnail pixbuf for the drawable identified by
+ * @drawable_ID. The thumbnail will be not larger than the requested
+ * size.
+ *
+ * Return value: a new #GdkPixbuf
+ *
+ * Since: 2.2
+ **/
+GdkPixbuf *
+gimp_drawable_get_thumbnail (gint32 drawable_ID,
+ gint width,
+ gint height,
+ GimpPixbufTransparency alpha)
+{
+ gint thumb_width = width;
+ gint thumb_height = height;
+ gint thumb_bpp;
+ guchar *data;
+
+ g_return_val_if_fail (width > 0 && width <= 1024, NULL);
+ g_return_val_if_fail (height > 0 && height <= 1024, NULL);
+
+ data = gimp_drawable_get_thumbnail_data (drawable_ID,
+ &thumb_width,
+ &thumb_height,
+ &thumb_bpp);
+
+ if (data)
+ return gimp_pixbuf_from_data (data,
+ thumb_width, thumb_height, thumb_bpp,
+ alpha);
+
+ return NULL;
+}
+
+/**
+ * gimp_drawable_get_sub_thumbnail:
+ * @drawable_ID: the drawable ID
+ * @src_x: the x coordinate of the area
+ * @src_y: the y coordinate of the area
+ * @src_width: the width of the area
+ * @src_height: the height of the area
+ * @dest_width: the requested thumbnail width (<= 1024 pixels)
+ * @dest_height: the requested thumbnail height (<= 1024 pixels)
+ * @alpha: how to handle an alpha channel
+ *
+ * Retrieves a thumbnail pixbuf for the drawable identified by
+ * @drawable_ID. The thumbnail will be not larger than the requested
+ * size.
+ *
+ * Return value: a new #GdkPixbuf
+ *
+ * Since: 2.2
+ **/
+GdkPixbuf *
+gimp_drawable_get_sub_thumbnail (gint32 drawable_ID,
+ gint src_x,
+ gint src_y,
+ gint src_width,
+ gint src_height,
+ gint dest_width,
+ gint dest_height,
+ GimpPixbufTransparency alpha)
+{
+ gint thumb_width = dest_width;
+ gint thumb_height = dest_height;
+ gint thumb_bpp;
+ guchar *data;
+
+ g_return_val_if_fail (src_x >= 0, NULL);
+ g_return_val_if_fail (src_y >= 0, NULL);
+ g_return_val_if_fail (src_width > 0, NULL);
+ g_return_val_if_fail (src_height > 0, NULL);
+ g_return_val_if_fail (dest_width > 0 && dest_width <= 1024, NULL);
+ g_return_val_if_fail (dest_height > 0 && dest_height <= 1024, NULL);
+
+ data = gimp_drawable_get_sub_thumbnail_data (drawable_ID,
+ src_x, src_y,
+ src_width, src_height,
+ &thumb_width,
+ &thumb_height,
+ &thumb_bpp);
+
+ if (data)
+ return gimp_pixbuf_from_data (data,
+ thumb_width, thumb_height, thumb_bpp,
+ alpha);
+
+ return NULL;
+}
+
+
+/*
+ * The data that is passed to this function is either freed here or
+ * owned by the returned pixbuf.
+ */
+static GdkPixbuf *
+gimp_pixbuf_from_data (guchar *data,
+ gint width,
+ gint height,
+ gint bpp,
+ GimpPixbufTransparency alpha)
+{
+ GdkPixbuf *pixbuf;
+
+ switch (bpp)
+ {
+ case 1:
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
+ {
+ guchar *src = data;
+ guchar *pixels = gdk_pixbuf_get_pixels (pixbuf);
+ gint rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+ gint y;
+
+ for (y = 0; y < height; y++)
+ {
+ guchar *dest = pixels;
+ gint x;
+
+ for (x = 0; x < width; x++, src += 1, dest += 3)
+ {
+ dest[0] = dest[1] = dest[2] = src[0];
+ }
+
+ pixels += rowstride;
+ }
+
+ g_free (data);
+ }
+ bpp = 3;
+ break;
+
+ case 2:
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
+ {
+ guchar *src = data;
+ guchar *pixels = gdk_pixbuf_get_pixels (pixbuf);
+ gint rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+ gint y;
+
+ for (y = 0; y < height; y++)
+ {
+ guchar *dest = pixels;
+ gint x;
+
+ for (x = 0; x < width; x++, src += 2, dest += 4)
+ {
+ dest[0] = dest[1] = dest[2] = src[0];
+ dest[3] = src[1];
+ }
+
+ pixels += rowstride;
+ }
+
+ g_free (data);
+ }
+ bpp = 4;
+ break;
+
+ case 3:
+ pixbuf = gdk_pixbuf_new_from_data (data,
+ GDK_COLORSPACE_RGB, FALSE, 8,
+ width, height, width * bpp,
+ (GdkPixbufDestroyNotify) g_free, NULL);
+ break;
+
+ case 4:
+ pixbuf = gdk_pixbuf_new_from_data (data,
+ GDK_COLORSPACE_RGB, TRUE, 8,
+ width, height, width * bpp,
+ (GdkPixbufDestroyNotify) g_free, NULL);
+ break;
+
+ default:
+ g_return_val_if_reached (NULL);
+ return NULL;
+ }
+
+ if (bpp == 4)
+ {
+ GdkPixbuf *tmp;
+ gint check_size = 0;
+
+ switch (alpha)
+ {
+ case GIMP_PIXBUF_KEEP_ALPHA:
+ return pixbuf;
+
+ case GIMP_PIXBUF_SMALL_CHECKS:
+ check_size = GIMP_CHECK_SIZE_SM;
+ break;
+
+ case GIMP_PIXBUF_LARGE_CHECKS:
+ check_size = GIMP_CHECK_SIZE;
+ break;
+ }
+
+ tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
+
+ gdk_pixbuf_composite_color (pixbuf, tmp,
+ 0, 0, width, height, 0, 0, 1.0, 1.0,
+ GDK_INTERP_NEAREST, 255,
+ 0, 0, check_size, 0x66666666, 0x99999999);
+
+ g_object_unref (pixbuf);
+ pixbuf = tmp;
+ }
+
+ return pixbuf;
+}
diff --git a/libgimp/gimppixbuf.h b/libgimp/gimppixbuf.h
new file mode 100644
index 0000000..b734784
--- /dev/null
+++ b/libgimp/gimppixbuf.h
@@ -0,0 +1,70 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppixbuf.h
+ * Copyright (C) 2004 Sven Neumann <sven@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __LIBGIMP_GIMP_PIXBUF_H__
+#define __LIBGIMP_GIMP_PIXBUF_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+/**
+ * GimpPixbufTransparency:
+ * @GIMP_PIXBUF_KEEP_ALPHA: Create a pixbuf with alpha
+ * @GIMP_PIXBUF_SMALL_CHECKS: Show transparency as small checks
+ * @GIMP_PIXBUF_LARGE_CHECKS: Show transparency as large checks
+ *
+ * How to deal with transparency when creating thubnail pixbufs from
+ * images and drawables.
+ **/
+typedef enum
+{
+ GIMP_PIXBUF_KEEP_ALPHA,
+ GIMP_PIXBUF_SMALL_CHECKS,
+ GIMP_PIXBUF_LARGE_CHECKS
+} GimpPixbufTransparency;
+
+
+GdkPixbuf * gimp_image_get_thumbnail (gint32 image_ID,
+ gint width,
+ gint height,
+ GimpPixbufTransparency alpha);
+GdkPixbuf * gimp_drawable_get_thumbnail (gint32 drawable_ID,
+ gint width,
+ gint height,
+ GimpPixbufTransparency alpha);
+GdkPixbuf * gimp_drawable_get_sub_thumbnail (gint32 drawable_ID,
+ gint src_x,
+ gint src_y,
+ gint src_width,
+ gint src_height,
+ gint dest_width,
+ gint dest_height,
+ GimpPixbufTransparency alpha);
+
+G_END_DECLS
+
+#endif /* __LIBGIMP_GIMP_PIXBUF_H__ */
diff --git a/libgimp/gimppixelfetcher.c b/libgimp/gimppixelfetcher.c
new file mode 100644
index 0000000..c71fdca
--- /dev/null
+++ b/libgimp/gimppixelfetcher.c
@@ -0,0 +1,334 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppixelfetcher.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#define GIMP_DISABLE_DEPRECATION_WARNINGS
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimppixelfetcher
+ * @title: gimppixelfetcher
+ * @short_description: Functions for operating on pixel regions.
+ *
+ * These functions provide neighbourhood-based algorithms which get
+ * dramatically slower on region boundaries, to the point where a
+ * special treatment for neighbourhoods which are completely inside a
+ * tile is called for. It hides the special treatment of tile borders,
+ * making plug-in code more readable and shorter.
+ **/
+
+
+struct _GimpPixelFetcher
+{
+ gint col, row;
+ gint img_width;
+ gint img_height;
+ gint sel_x1, sel_y1, sel_x2, sel_y2;
+ gint img_bpp;
+ gint tile_width, tile_height;
+ guchar bg_color[4];
+ GimpPixelFetcherEdgeMode mode;
+ GimpDrawable *drawable;
+ GimpTile *tile;
+ gboolean tile_dirty;
+ gboolean shadow;
+};
+
+
+/* local function prototypes */
+
+static guchar * gimp_pixel_fetcher_provide_tile (GimpPixelFetcher *pf,
+ gint x,
+ gint y);
+
+
+/* public functions */
+
+/**
+ * gimp_pixel_fetcher_new:
+ * @drawable: the #GimpDrawable the new region will be attached to.
+ * @shadow: a #gboolean indicating whether the region is attached to
+ * the shadow tiles or the real @drawable tiles.
+ *
+ * Initialize a pixel region from the drawable.
+ *
+ * Return value: a pointer to a #GimpPixelRgn structure (or NULL).
+ **/
+GimpPixelFetcher *
+gimp_pixel_fetcher_new (GimpDrawable *drawable,
+ gboolean shadow)
+{
+ GimpPixelFetcher *pf;
+ gint width;
+ gint height;
+ gint bpp;
+
+ g_return_val_if_fail (drawable != NULL, NULL);
+
+ width = gimp_drawable_width (drawable->drawable_id);
+ height = gimp_drawable_height (drawable->drawable_id);
+ bpp = gimp_drawable_bpp (drawable->drawable_id);
+
+ g_return_val_if_fail (width > 0 && height > 0 && bpp > 0, NULL);
+
+ pf = g_slice_new0 (GimpPixelFetcher);
+
+ gimp_drawable_mask_bounds (drawable->drawable_id,
+ &pf->sel_x1, &pf->sel_y1,
+ &pf->sel_x2, &pf->sel_y2);
+
+ pf->col = -1;
+ pf->row = -1;
+ pf->img_width = width;
+ pf->img_height = height;
+ pf->img_bpp = bpp;
+ pf->tile_width = gimp_tile_width ();
+ pf->tile_height = gimp_tile_height ();
+ pf->bg_color[0] = 0;
+ pf->bg_color[1] = 0;
+ pf->bg_color[2] = 0;
+ pf->bg_color[3] = 255;
+ pf->mode = GIMP_PIXEL_FETCHER_EDGE_NONE;
+ pf->drawable = drawable;
+ pf->tile = NULL;
+ pf->tile_dirty = FALSE;
+ pf->shadow = shadow;
+
+ return pf;
+}
+
+/**
+ * gimp_pixel_fetcher_destroy:
+ * @pf: a pointer to a previously initialized #GimpPixelFetcher.
+ *
+ * Close a previously initialized pixel region.
+ **/
+void
+gimp_pixel_fetcher_destroy (GimpPixelFetcher *pf)
+{
+ g_return_if_fail (pf != NULL);
+
+ if (pf->tile)
+ gimp_tile_unref (pf->tile, pf->tile_dirty);
+
+ g_slice_free (GimpPixelFetcher, pf);
+}
+
+/**
+ * gimp_pixel_fetcher_set_edge_mode:
+ * @pf: a pointer to a previously initialized #GimpPixelFetcher.
+ * @mode: the new edge mode from #GimpPixelFetcherEdgeMode.
+ *
+ * Change the edge mode of a previously initialized pixel region.
+ **/
+void
+gimp_pixel_fetcher_set_edge_mode (GimpPixelFetcher *pf,
+ GimpPixelFetcherEdgeMode mode)
+{
+ g_return_if_fail (pf != NULL);
+
+ pf->mode = mode;
+}
+
+/**
+ * gimp_pixel_fetcher_set_bg_color:
+ * @pf: a pointer to a previously initialized #GimpPixelFetcher.
+ * @color: the color to be used as bg color.
+ *
+ * Change the background color of a previously initialized pixel region.
+ **/
+void
+gimp_pixel_fetcher_set_bg_color (GimpPixelFetcher *pf,
+ const GimpRGB *color)
+{
+ g_return_if_fail (pf != NULL);
+ g_return_if_fail (color != NULL);
+
+ switch (pf->img_bpp)
+ {
+ case 2: pf->bg_color[1] = 255;
+ case 1:
+ pf->bg_color[0] = gimp_rgb_luminance_uchar (color);
+ break;
+
+ case 4: pf->bg_color[3] = 255;
+ case 3:
+ gimp_rgb_get_uchar (color,
+ pf->bg_color, pf->bg_color + 1, pf->bg_color + 2);
+ break;
+ }
+}
+
+/**
+ * gimp_pixel_fetcher_get_pixel:
+ * @pf: a pointer to a previously initialized #GimpPixelFetcher.
+ * @x: the x coordinate of the pixel to get.
+ * @y: the y coordinate of the pixel to get.
+ * @pixel: the memory location where to return the pixel.
+ *
+ * Get a pixel from the pixel region.
+ **/
+void
+gimp_pixel_fetcher_get_pixel (GimpPixelFetcher *pf,
+ gint x,
+ gint y,
+ guchar *pixel)
+{
+ guchar *p;
+ gint i;
+
+ g_return_if_fail (pf != NULL);
+ g_return_if_fail (pixel != NULL);
+
+ if (pf->mode == GIMP_PIXEL_FETCHER_EDGE_NONE &&
+ (x < pf->sel_x1 || x >= pf->sel_x2 ||
+ y < pf->sel_y1 || y >= pf->sel_y2))
+ {
+ return;
+ }
+
+ if (x < 0 || x >= pf->img_width ||
+ y < 0 || y >= pf->img_height)
+ {
+ switch (pf->mode)
+ {
+ case GIMP_PIXEL_FETCHER_EDGE_WRAP:
+ if (x < 0 || x >= pf->img_width)
+ {
+ x %= pf->img_width;
+
+ if (x < 0)
+ x += pf->img_width;
+ }
+
+ if (y < 0 || y >= pf->img_height)
+ {
+ y %= pf->img_height;
+
+ if (y < 0)
+ y += pf->img_height;
+ }
+ break;
+
+ case GIMP_PIXEL_FETCHER_EDGE_SMEAR:
+ x = CLAMP (x, 0, pf->img_width - 1);
+ y = CLAMP (y, 0, pf->img_height - 1);
+ break;
+
+ case GIMP_PIXEL_FETCHER_EDGE_BLACK:
+ for (i = 0; i < pf->img_bpp; i++)
+ pixel[i] = 0;
+ return;
+
+ case GIMP_PIXEL_FETCHER_EDGE_BACKGROUND:
+ for (i = 0; i < pf->img_bpp; i++)
+ pixel[i] = pf->bg_color[i];
+ return;
+
+ default:
+ return;
+ }
+ }
+
+ p = gimp_pixel_fetcher_provide_tile (pf, x, y);
+
+ i = pf->img_bpp;
+
+ do
+ {
+ *pixel++ = *p++;
+ }
+ while (--i);
+}
+
+/**
+ * gimp_pixel_fetcher_put_pixel:
+ * @pf: a pointer to a previously initialized #GimpPixelFetcher.
+ * @x: the x coordinate of the pixel to set.
+ * @y: the y coordinate of the pixel to set.
+ * @pixel: the pixel to set.
+ *
+ * Set a pixel in the pixel region.
+ **/
+void
+gimp_pixel_fetcher_put_pixel (GimpPixelFetcher *pf,
+ gint x,
+ gint y,
+ const guchar *pixel)
+{
+ guchar *p;
+ gint i;
+
+ g_return_if_fail (pf != NULL);
+ g_return_if_fail (pixel != NULL);
+
+ if (x < pf->sel_x1 || x >= pf->sel_x2 ||
+ y < pf->sel_y1 || y >= pf->sel_y2)
+ {
+ return;
+ }
+
+ p = gimp_pixel_fetcher_provide_tile (pf, x, y);
+
+ i = pf->img_bpp;
+
+ do
+ {
+ *p++ = *pixel++;
+ }
+ while (--i);
+
+ pf->tile_dirty = TRUE;
+}
+
+
+/* private functions */
+
+static guchar *
+gimp_pixel_fetcher_provide_tile (GimpPixelFetcher *pf,
+ gint x,
+ gint y)
+{
+ gint col, row;
+ gint coloff, rowoff;
+
+ col = x / pf->tile_width;
+ coloff = x % pf->tile_width;
+ row = y / pf->tile_height;
+ rowoff = y % pf->tile_height;
+
+ if ((col != pf->col) || (row != pf->row) || (pf->tile == NULL))
+ {
+ if (pf->tile != NULL)
+ gimp_tile_unref (pf->tile, pf->tile_dirty);
+
+ pf->tile = gimp_drawable_get_tile (pf->drawable, pf->shadow, row, col);
+ pf->tile_dirty = FALSE;
+ gimp_tile_ref (pf->tile);
+
+ pf->col = col;
+ pf->row = row;
+ }
+
+ return pf->tile->data + pf->img_bpp * (pf->tile->ewidth * rowoff + coloff);
+}
diff --git a/libgimp/gimppixelfetcher.h b/libgimp/gimppixelfetcher.h
new file mode 100644
index 0000000..f493613
--- /dev/null
+++ b/libgimp/gimppixelfetcher.h
@@ -0,0 +1,76 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppixelfetcher.h
+ * Contains all kinds of miscellaneous routines factored out from different
+ * plug-ins. They stay here until their API has crystalized a bit and we can
+ * put them into the file where they belong (Maurits Rijk
+ * <lpeek.mrijk@consunet.nl> if you want to blame someone for this mess)
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PIXEL_FETCHER_H__
+#define __GIMP_PIXEL_FETCHER_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+typedef enum
+{
+ GIMP_PIXEL_FETCHER_EDGE_NONE,
+ GIMP_PIXEL_FETCHER_EDGE_WRAP,
+ GIMP_PIXEL_FETCHER_EDGE_SMEAR,
+ GIMP_PIXEL_FETCHER_EDGE_BLACK,
+ GIMP_PIXEL_FETCHER_EDGE_BACKGROUND
+} GimpPixelFetcherEdgeMode;
+
+
+typedef struct _GimpPixelFetcher GimpPixelFetcher;
+
+
+GIMP_DEPRECATED
+GimpPixelFetcher * gimp_pixel_fetcher_new (GimpDrawable *drawable,
+ gboolean shadow);
+GIMP_DEPRECATED
+void gimp_pixel_fetcher_destroy (GimpPixelFetcher *pf);
+
+GIMP_DEPRECATED
+void gimp_pixel_fetcher_set_edge_mode (GimpPixelFetcher *pf,
+ GimpPixelFetcherEdgeMode mode);
+GIMP_DEPRECATED
+void gimp_pixel_fetcher_set_bg_color (GimpPixelFetcher *pf,
+ const GimpRGB *color);
+
+GIMP_DEPRECATED
+void gimp_pixel_fetcher_get_pixel (GimpPixelFetcher *pf,
+ gint x,
+ gint y,
+ guchar *pixel);
+GIMP_DEPRECATED
+void gimp_pixel_fetcher_put_pixel (GimpPixelFetcher *pf,
+ gint x,
+ gint y,
+ const guchar *pixel);
+
+G_END_DECLS
+
+#endif /* __GIMP_PIXEL_FETCHER_H__ */
diff --git a/libgimp/gimppixelrgn.c b/libgimp/gimppixelrgn.c
new file mode 100644
index 0000000..c553089
--- /dev/null
+++ b/libgimp/gimppixelrgn.c
@@ -0,0 +1,965 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppixelrgn.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <stdarg.h>
+
+#define GIMP_DISABLE_DEPRECATION_WARNINGS
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimppixelrgn
+ * @title: gimppixelrgn
+ * @short_description: Functions for operating on pixel regions.
+ *
+ * Functions for operating on pixel regions. These functions provide
+ * fast ways of accessing and modifying portions of a drawable.
+ **/
+
+
+#define TILE_WIDTH gimp_tile_width()
+#define TILE_HEIGHT gimp_tile_height()
+
+
+typedef struct _GimpPixelRgnHolder GimpPixelRgnHolder;
+typedef struct _GimpPixelRgnIterator GimpPixelRgnIterator;
+
+struct _GimpPixelRgnHolder
+{
+ GimpPixelRgn *pr;
+ guchar *original_data;
+ gint startx;
+ gint starty;
+ gint count;
+};
+
+struct _GimpPixelRgnIterator
+{
+ GSList *pixel_regions;
+ gint region_width;
+ gint region_height;
+ gint portion_width;
+ gint portion_height;
+ gint process_count;
+};
+
+
+static gint gimp_get_portion_width (GimpPixelRgnIterator *pri);
+static gint gimp_get_portion_height (GimpPixelRgnIterator *pri);
+static gpointer gimp_pixel_rgns_configure (GimpPixelRgnIterator *pri);
+static void gimp_pixel_rgn_configure (GimpPixelRgnHolder *prh,
+ GimpPixelRgnIterator *pri);
+
+/**
+ * gimp_pixel_rgn_init:
+ * @pr: a pointer to a #GimpPixelRgn variable.
+ * @drawable: the #GimpDrawable the new region will be attached to.
+ * @x: the x coordinate of the top-left pixel of the region in the
+ * @drawable.
+ * @y: the y coordinate of the top-left pixel of the region in the
+ * @drawable.
+ * @width: the width of the region.
+ * @height: the height of the region.
+ * @dirty: a #gboolean indicating whether the @drawable should be marked
+ * as "dirty".
+ * @shadow: a #gboolean indicating whether the region is attached to the
+ * shadow tiles or the real @drawable tiles.
+ *
+ * Initialize the pixel region pointed by @pr with the specified parameters.
+ *
+ * The @dirty and @shadow flags can be used as follows:
+ *
+ * - @dirty = FALSE, @shadow = FALSE: the region will be used to read
+ * the actual drawable datas. This
+ * is useful for save plug-ins or for
+ * filters.
+ *
+ * - @dirty = FALSE, @shadow = TRUE: the region will be used to read the
+ * shadow tiles. This is used in
+ * some filter plug-ins which operate
+ * in two passes such as gaussian
+ * blur. The first pass reads the
+ * actual drawable data and writes to
+ * the shadow tiles, and the second
+ * one reads from and writes to the
+ * shadow tiles.
+ *
+ * - @dirty = TRUE, @shadow = TRUE: the region will be used to write to
+ * the shadow tiles. It is common
+ * practice to write to the shadow
+ * tiles and then use
+ * gimp_drawable_merge_shadow() to
+ * merge the changes from the shadow
+ * tiles using the current selection
+ * as a mask.
+ *
+ * - @dirty = TRUE, @shadow = FALSE: the region will be used to directly
+ * change the drawable content. Don't
+ * do this, since this could prevent
+ * the Undo-System from working as
+ * expected.
+ **/
+void
+gimp_pixel_rgn_init (GimpPixelRgn *pr,
+ GimpDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gboolean dirty,
+ gboolean shadow)
+{
+ g_return_if_fail (pr != NULL);
+ g_return_if_fail (drawable != NULL);
+ g_return_if_fail (x >= 0 && x + width <= drawable->width);
+ g_return_if_fail (y >= 0 && y + height <= drawable->height);
+
+ pr->data = NULL;
+ pr->drawable = drawable;
+ pr->bpp = drawable->bpp;
+ pr->rowstride = 0;
+ pr->x = x;
+ pr->y = y;
+ pr->w = width;
+ pr->h = height;
+ pr->dirty = dirty;
+ pr->shadow = shadow;
+}
+
+/**
+ * gimp_pixel_rgn_resize:
+ * @pr: a pointer to a previously initialized #GimpPixelRgn.
+ * @x: the x coordinate of the new position of the region's
+ * top-left corner.
+ * @y: the y coordinate of the new position of the region's
+ * top-left corner.
+ * @width: the new width of the region.
+ * @height: the new height of the region.
+ *
+ * Change the position and size of a previously initialized pixel region.
+ **/
+void
+gimp_pixel_rgn_resize (GimpPixelRgn *pr,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ g_return_if_fail (pr != NULL && pr->drawable != NULL);
+ g_return_if_fail (x >= 0 && x + width <= pr->drawable->width);
+ g_return_if_fail (y >= 0 && y + height <= pr->drawable->height);
+
+ pr->x = x;
+ pr->y = y;
+ pr->w = width;
+ pr->h = height;
+}
+
+/**
+ * gimp_pixel_rgn_get_pixel:
+ * @pr: a pointer to a previously initialized #GimpPixelRgn.
+ * @buf: a pointer to an array of #guchar
+ * @x: the x coordinate of the wanted pixel (relative to the drawable)
+ * @y: the y coordinate of the wanted pixel (relative to the drawable)
+ *
+ * Fill the buffer pointed by @buf with the value of the pixel at (@x, @y)
+ * in the region @pr. @buf should be large enough to hold the pixel value
+ * (1 #guchar for an indexed or grayscale drawable, 2 #guchar for
+ * indexed with alpha or grayscale with alpha drawable, 3 #guchar for
+ * rgb drawable and 4 #guchar for rgb with alpha drawable.
+ **/
+void
+gimp_pixel_rgn_get_pixel (GimpPixelRgn *pr,
+ guchar *buf,
+ gint x,
+ gint y)
+{
+ GimpTile *tile;
+ const guchar *tile_data;
+ gint b;
+
+ g_return_if_fail (pr != NULL && pr->drawable != NULL);
+ g_return_if_fail (x >= 0 && x < pr->drawable->width);
+ g_return_if_fail (y >= 0 && y < pr->drawable->height);
+
+ tile = gimp_drawable_get_tile2 (pr->drawable, pr->shadow, x, y);
+ gimp_tile_ref (tile);
+
+ tile_data = (tile->data +
+ tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH)));
+
+ for (b = 0; b < tile->bpp; b++)
+ *buf++ = *tile_data++;
+
+ gimp_tile_unref (tile, FALSE);
+}
+
+/**
+ * gimp_pixel_rgn_get_row:
+ * @pr: a pointer to a previously initialized #GimpPixelRgn.
+ * @buf: a pointer to an array of #guchar
+ * @x: the x coordinate of the first pixel (relative to the drawable).
+ * @y: the y coordinate of the first pixel (relative to the drawable).
+ * @width: the number of pixels to get.
+ *
+ * Get several pixels of a region in a row. This function fills the buffer
+ * @buf with the values of the pixels from (@x, @y) to (@x+@width-1, @y).
+ * @buf should be large enough to hold all these values.
+ **/
+void
+gimp_pixel_rgn_get_row (GimpPixelRgn *pr,
+ guchar *buf,
+ gint x,
+ gint y,
+ gint width)
+{
+ gint end;
+
+ g_return_if_fail (pr != NULL && pr->drawable != NULL);
+ g_return_if_fail (buf != NULL);
+ g_return_if_fail (x >= 0 && x + width <= pr->drawable->width);
+ g_return_if_fail (y >= 0 && y < pr->drawable->height);
+ g_return_if_fail (width >= 0);
+
+ end = x + width;
+
+ while (x < end)
+ {
+ GimpTile *tile;
+ const guchar *tile_data;
+ gint inc, min;
+ gint boundary;
+
+ tile = gimp_drawable_get_tile2 (pr->drawable, pr->shadow, x, y);
+ gimp_tile_ref (tile);
+
+ tile_data = (tile->data +
+ tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH)));
+
+ boundary = x + (tile->ewidth - (x % TILE_WIDTH));
+
+ min = MIN (end, boundary);
+ inc = tile->bpp * (min - x);
+
+ memcpy (buf, tile_data, inc);
+
+ x = min;
+ buf += inc;
+
+ gimp_tile_unref (tile, FALSE);
+ }
+}
+
+/**
+ * gimp_pixel_rgn_get_col:
+ * @pr: a pointer to a previously initialized #GimpPixelRgn.
+ * @buf: a pointer to an array of #guchar
+ * @x: the x coordinate of the first pixel (relative to the drawable).
+ * @y: the y coordinate of the first pixel (relative to the drawable).
+ * @height: the number of pixels to get.
+ *
+ * Get several pixels of a region's column. This function fills the buffer
+ * @buf with the values of the pixels from (@x, @y) to (@x, @y+@height-1).
+ * @buf should be large enough to hold all these values.
+ *
+ **/
+void
+gimp_pixel_rgn_get_col (GimpPixelRgn *pr,
+ guchar *buf,
+ gint x,
+ gint y,
+ gint height)
+{
+ gint end;
+
+ g_return_if_fail (pr != NULL && pr->drawable != NULL);
+ g_return_if_fail (buf != NULL);
+ g_return_if_fail (x >= 0 && x < pr->drawable->width);
+ g_return_if_fail (y >= 0 && y + height <= pr->drawable->height);
+ g_return_if_fail (height >= 0);
+
+ end = y + height;
+
+ while (y < end)
+ {
+ GimpTile *tile;
+ const guchar *tile_data;
+ gint inc;
+ gint boundary;
+ gint b;
+
+ tile = gimp_drawable_get_tile2 (pr->drawable, pr->shadow, x, y);
+ gimp_tile_ref (tile);
+
+ tile_data = (tile->data +
+ tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH)));
+
+ boundary = y + (tile->eheight - (y % TILE_HEIGHT));
+ inc = tile->bpp * tile->ewidth;
+
+ for ( ; y < end && y < boundary; y++)
+ {
+ for (b = 0; b < tile->bpp; b++)
+ *buf++ = tile_data[b];
+
+ tile_data += inc;
+ }
+
+ gimp_tile_unref (tile, FALSE);
+ }
+}
+
+/**
+ * gimp_pixel_rgn_get_rect:
+ * @pr: a pointer to a previously initialized #GimpPixelRgn.
+ * @buf: a pointer to an array of #guchar
+ * @x: the x coordinate of the first pixel (relative to the drawable).
+ * @y: the y coordinate of the first pixel (relative to the drawable).
+ * @width: the width of the rectangle.
+ * @height: the height of the rectangle.
+ *
+ * Get all the pixel values from the rectangle defined by @x, @y, @width and
+ * @height. This function fills the buffer @buf with the values of the pixels
+ * from (@x, @y) to (@x+@width-1, @y+@height-1).
+ * @buf should be large enough to hold all these values (@width*@height*bpp).
+ **/
+void
+gimp_pixel_rgn_get_rect (GimpPixelRgn *pr,
+ guchar *buf,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ gulong bufstride;
+ gint xstart, ystart;
+ gint xend, yend;
+ gint xboundary;
+ gint yboundary;
+ gint xstep, ystep;
+ gint ty, bpp;
+
+ g_return_if_fail (pr != NULL && pr->drawable != NULL);
+ g_return_if_fail (buf != NULL);
+ g_return_if_fail (x >= 0 && x + width <= pr->drawable->width);
+ g_return_if_fail (y >= 0 && y + height <= pr->drawable->height);
+ g_return_if_fail (width >= 0);
+ g_return_if_fail (height >= 0);
+
+ bpp = pr->bpp;
+ bufstride = bpp * width;
+
+ xstart = x;
+ ystart = y;
+ xend = x + width;
+ yend = y + height;
+ ystep = 0;
+
+ while (y < yend)
+ {
+ x = xstart;
+
+ while (x < xend)
+ {
+ GimpTile *tile;
+
+ tile = gimp_drawable_get_tile2 (pr->drawable, pr->shadow, x, y);
+ gimp_tile_ref (tile);
+
+ xstep = tile->ewidth - (x % TILE_WIDTH);
+ ystep = tile->eheight - (y % TILE_HEIGHT);
+ xboundary = x + xstep;
+ yboundary = y + ystep;
+ xboundary = MIN (xboundary, xend);
+ yboundary = MIN (yboundary, yend);
+
+ for (ty = y; ty < yboundary; ty++)
+ {
+ const guchar *src;
+ guchar *dest;
+
+ src = (tile->data +
+ tile->bpp * (tile->ewidth * (ty % TILE_HEIGHT) + (x % TILE_WIDTH)));
+ dest = buf + bufstride * (ty - ystart) + bpp * (x - xstart);
+
+ memcpy (dest, src, (xboundary - x) * bpp);
+ }
+
+ gimp_tile_unref (tile, FALSE);
+ x += xstep;
+ }
+
+ y += ystep;
+ }
+}
+
+/**
+ * gimp_pixel_rgn_set_pixel:
+ * @pr: a pointer to a previously initialized #GimpPixelRgn.
+ * @buf: a pointer to an array of #guchar.
+ * @x: the x coordinate of the pixel (relative to the drawable).
+ * @y: the y coordinate of the pixel (relative to the drawable).
+ *
+ * Set the pixel at (@x, @y) to the values from @buf.
+ **/
+void
+gimp_pixel_rgn_set_pixel (GimpPixelRgn *pr,
+ const guchar *buf,
+ gint x,
+ gint y)
+{
+ GimpTile *tile;
+ guchar *tile_data;
+ gint b;
+
+ g_return_if_fail (pr != NULL && pr->drawable != NULL);
+ g_return_if_fail (buf != NULL);
+ g_return_if_fail (x >= 0 && x < pr->drawable->width);
+ g_return_if_fail (y >= 0 && y < pr->drawable->height);
+
+ tile = gimp_drawable_get_tile2 (pr->drawable, pr->shadow, x, y);
+ gimp_tile_ref (tile);
+
+ tile_data = tile->data + tile->bpp * (tile->ewidth *
+ (y % TILE_HEIGHT) + (x % TILE_WIDTH));
+
+ for (b = 0; b < tile->bpp; b++)
+ *tile_data++ = *buf++;
+
+ gimp_tile_unref (tile, TRUE);
+}
+
+/**
+ * gimp_pixel_rgn_set_row:
+ * @pr: a pointer to a previously initialized #GimpPixelRgn.
+ * @buf: a pointer to an array of #guchar
+ * @x: the x coordinate of the first pixel (relative to the drawable).
+ * @y: the y coordinate of the first pixel (relative to the drawable).
+ * @width: the number of pixels to set.
+ *
+ * Set several pixels of a region in a row. This function draws the pixels
+ * from (@x, @y) to (@x+@width-1, @y) using the values of the buffer @buf.
+ * @buf should be large enough to hold all these values.
+ **/
+void
+gimp_pixel_rgn_set_row (GimpPixelRgn *pr,
+ const guchar *buf,
+ gint x,
+ gint y,
+ gint width)
+{
+ GimpTile *tile;
+ guchar *tile_data;
+ gint inc, min;
+ gint end;
+ gint boundary;
+
+ g_return_if_fail (pr != NULL && pr->drawable != NULL);
+ g_return_if_fail (buf != NULL);
+ g_return_if_fail (x >= 0 && x + width <= pr->drawable->width);
+ g_return_if_fail (y >= 0 && y < pr->drawable->height);
+ g_return_if_fail (width >= 0);
+
+ end = x + width;
+
+ while (x < end)
+ {
+ tile = gimp_drawable_get_tile2 (pr->drawable, pr->shadow, x, y);
+ gimp_tile_ref (tile);
+
+ tile_data = (tile->data +
+ tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH)));
+
+ boundary = x + (tile->ewidth - (x % TILE_WIDTH));
+
+ min = MIN (end, boundary);
+ inc = tile->bpp * (min - x);
+
+ memcpy (tile_data, buf, inc);
+
+ x = min;
+ buf += inc;
+
+ gimp_tile_unref (tile, TRUE);
+ }
+}
+
+/**
+ * gimp_pixel_rgn_set_col:
+ * @pr: a pointer to a previously initialized #GimpPixelRgn.
+ * @buf: a pointer to an array of #guchar
+ * @x: the x coordinate of the first pixel (relative to the drawable).
+ * @y: the y coordinate of the first pixel (relative to the drawable).
+ * @height: the number of pixels to set.
+ *
+ * Set several pixels of a region's column. This function draws the pixels
+ * from (@x, @y) to (@x, @y+@height-1) using the values from the buffer @buf.
+ * @buf should be large enough to hold all these values.
+ **/
+void
+gimp_pixel_rgn_set_col (GimpPixelRgn *pr,
+ const guchar *buf,
+ gint x,
+ gint y,
+ gint height)
+{
+ gint end;
+
+ g_return_if_fail (pr != NULL && pr->drawable != NULL);
+ g_return_if_fail (buf != NULL);
+ g_return_if_fail (x >= 0 && x < pr->drawable->width);
+ g_return_if_fail (y >= 0 && y + height <= pr->drawable->height);
+ g_return_if_fail (height >= 0);
+
+ end = y + height;
+
+ while (y < end)
+ {
+ GimpTile *tile;
+ guchar *tile_data;
+ gint inc;
+ gint boundary;
+
+ tile = gimp_drawable_get_tile2 (pr->drawable, pr->shadow, x, y);
+ gimp_tile_ref (tile);
+
+ tile_data = (tile->data +
+ tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH)));
+
+ boundary = y + (tile->eheight - (y % TILE_HEIGHT));
+ inc = tile->bpp * tile->ewidth;
+
+ for ( ; y < end && y < boundary; y++)
+ {
+ gint b;
+
+ for (b = 0; b < tile->bpp; b++)
+ tile_data[b] = *buf++;
+
+ tile_data += inc;
+ }
+
+ gimp_tile_unref (tile, TRUE);
+ }
+}
+
+/**
+ * gimp_pixel_rgn_set_rect:
+ * @pr: a pointer to a previously initialized #GimpPixelRgn.
+ * @buf: a pointer to an array of #guchar
+ * @x: the x coordinate of the first pixel (relative to the drawable).
+ * @y: the y coordinate of the first pixel (relative to the drawable).
+ * @width: the width of the rectangle.
+ * @height: the height of the rectangle.
+ *
+ * Set all the pixel of the rectangle defined by @x, @y, @width and
+ * @height. This function draws the rectangle from (@x, @y) to
+ * (@x+@width-1, @y+@height-1), using the pixel values from the buffer @buf.
+ * @buf should be large enough to hold all these values (@width*@height*bpp).
+ **/
+void
+gimp_pixel_rgn_set_rect (GimpPixelRgn *pr,
+ const guchar *buf,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ gulong bufstride;
+ gint xstart, ystart;
+ gint xend, yend;
+ gint xboundary;
+ gint yboundary;
+ gint xstep, ystep;
+ gint ty, bpp;
+
+ g_return_if_fail (pr != NULL && pr->drawable != NULL);
+ g_return_if_fail (buf != NULL);
+ g_return_if_fail (x >= 0 && x + width <= pr->drawable->width);
+ g_return_if_fail (y >= 0 && y + height <= pr->drawable->height);
+ g_return_if_fail (width >= 0);
+ g_return_if_fail (height >= 0);
+
+ bpp = pr->bpp;
+ bufstride = bpp * width;
+
+ xstart = x;
+ ystart = y;
+ xend = x + width;
+ yend = y + height;
+ ystep = 0;
+
+ while (y < yend)
+ {
+ x = xstart;
+
+ while (x < xend)
+ {
+ GimpTile *tile;
+
+ tile = gimp_drawable_get_tile2 (pr->drawable, pr->shadow, x, y);
+ gimp_tile_ref (tile);
+
+ xstep = tile->ewidth - (x % TILE_WIDTH);
+ ystep = tile->eheight - (y % TILE_HEIGHT);
+ xboundary = x + xstep;
+ yboundary = y + ystep;
+ xboundary = MIN (xboundary, xend);
+ yboundary = MIN (yboundary, yend);
+
+ for (ty = y; ty < yboundary; ty++)
+ {
+ const guchar *src;
+ guchar *dest;
+
+ src = buf + bufstride * (ty - ystart) + bpp * (x - xstart);
+ dest = tile->data + tile->bpp * (tile->ewidth *
+ (ty % TILE_HEIGHT) + (x % TILE_WIDTH));
+
+ memcpy (dest, src, (xboundary - x) * bpp);
+ }
+
+ gimp_tile_unref (tile, TRUE);
+ x += xstep;
+ }
+
+ y += ystep;
+ }
+}
+
+/**
+ * gimp_pixel_rgns_register2:
+ * @nrgns: the number of regions to register.
+ * @prs: an array of @nrgns pointers to initialized #GimpPixelRgn.
+ *
+ * It takes a number of initialized regions of the same size and provides a
+ * pixel region iterator the iterator can be used to iterate over the
+ * registered pixel regions. While iterating the registered pixel regions will
+ * cover subsets of the original pixel regions, chosen for optimized access to
+ * the image data.
+ *
+ * Note that the given regions themselves are changed by this function, so
+ * they are resized to the first subsets.
+ *
+ * This function has to be used together with gimp_pixel_rgns_process in a loop.
+ *
+ * Returns: a #gpointer to a regions iterator.
+ **/
+gpointer
+gimp_pixel_rgns_register2 (gint nrgns,
+ GimpPixelRgn **prs)
+{
+ GimpPixelRgnIterator *pri;
+ gboolean found;
+
+ g_return_val_if_fail (nrgns > 0, NULL);
+ g_return_val_if_fail (prs != NULL, NULL);
+
+ pri = g_slice_new0 (GimpPixelRgnIterator);
+
+ found = FALSE;
+ while (nrgns --)
+ {
+ GimpPixelRgn *pr = prs[nrgns];
+ GimpPixelRgnHolder *prh = g_slice_new0 (GimpPixelRgnHolder);
+
+ prh->pr = pr;
+
+ if (pr != NULL)
+ {
+ /* If there is a defined value for data, make sure tiles is NULL */
+ if (pr->data)
+ pr->drawable = NULL;
+
+ prh->original_data = pr->data;
+ prh->startx = pr->x;
+ prh->starty = pr->y;
+ prh->pr->process_count = 0;
+
+ if (! found)
+ {
+ found = TRUE;
+ pri->region_width = pr->w;
+ pri->region_height = pr->h;
+ }
+ }
+
+ /* Add the pixel Rgn holder to the list */
+ pri->pixel_regions = g_slist_prepend (pri->pixel_regions, prh);
+ }
+
+ return gimp_pixel_rgns_configure (pri);
+}
+
+/**
+ * gimp_pixel_rgns_register:
+ * @nrgns: the number of regions to register.
+ * @...: @nrgns pointers to #GimpPixelRgn.
+ *
+ * This is the varargs version of #gimp_pixel_rgns_register2.
+ *
+ * Returns: a #gpointer to a regions iterator.
+ **/
+gpointer
+gimp_pixel_rgns_register (gint nrgns,
+ ...)
+{
+ GimpPixelRgn **prs;
+ gint n;
+ va_list ap;
+
+ g_return_val_if_fail (nrgns > 0, NULL);
+
+ prs = g_newa (GimpPixelRgn *, nrgns);
+
+ va_start (ap, nrgns);
+
+ for (n = nrgns; n--; )
+ prs[n] = va_arg (ap, GimpPixelRgn *);
+
+ va_end (ap);
+
+ return gimp_pixel_rgns_register2 (nrgns, prs);
+}
+
+/**
+ * gimp_pixel_rgns_process:
+ * @pri_ptr: a regions iterator returned by #gimp_pixel_rgns_register,
+ * #gimp_pixel_rgns_register2 or #gimp_pixel_rgns_process.
+ *
+ * This function update the regions registered previously with one of the
+ * #gimp_pixel_rgns_register* functions to their next tile.
+ *
+ * Returns: a #gpointer to a new regions iterator or #NULL if there isn't
+ * any tiles left.
+ **/
+gpointer
+gimp_pixel_rgns_process (gpointer pri_ptr)
+{
+ GimpPixelRgnIterator *pri;
+ GSList *list;
+
+ g_return_val_if_fail (pri_ptr != NULL, NULL);
+
+ pri = (GimpPixelRgnIterator*) pri_ptr;
+ pri->process_count++;
+
+ /* Unref all referenced tiles and increment the offsets */
+
+ for (list = pri->pixel_regions; list; list = list->next)
+ {
+ GimpPixelRgnHolder *prh = list->data;
+
+ if ((prh->pr != NULL) && (prh->pr->process_count != pri->process_count))
+ {
+ /* This eliminates the possibility of incrementing the
+ * same region twice
+ */
+ prh->pr->process_count++;
+
+ /* Unref the last referenced tile if the underlying region
+ * is a tile manager
+ */
+ if (prh->pr->drawable)
+ {
+ GimpTile *tile = gimp_drawable_get_tile2 (prh->pr->drawable,
+ prh->pr->shadow,
+ prh->pr->x,
+ prh->pr->y);
+ gimp_tile_unref (tile, prh->pr->dirty);
+ }
+
+ prh->pr->x += pri->portion_width;
+
+ if ((prh->pr->x - prh->startx) >= pri->region_width)
+ {
+ prh->pr->x = prh->startx;
+ prh->pr->y += pri->portion_height;
+ }
+ }
+ }
+
+ return gimp_pixel_rgns_configure (pri);
+}
+
+
+static gint
+gimp_get_portion_width (GimpPixelRgnIterator *pri)
+{
+ GSList *list;
+ gint min_width = G_MAXINT;
+ gint width;
+
+ /* Find the minimum width to the next vertical tile (in the case of
+ * a tile manager) or to the end of the pixel region (in the case of
+ * no tile manager)
+ */
+
+ for (list = pri->pixel_regions; list; list = list->next)
+ {
+ GimpPixelRgnHolder *prh = list->data;
+
+ if (prh->pr)
+ {
+ /* Check if we're past the point of no return */
+ if ((prh->pr->x - prh->startx) >= pri->region_width)
+ return 0;
+
+ if (prh->pr->drawable)
+ {
+ width = TILE_WIDTH - (prh->pr->x % TILE_WIDTH);
+ width = CLAMP (width,
+ 0,
+ (pri->region_width - (prh->pr->x - prh->startx)));
+ }
+ else
+ {
+ width = (pri->region_width - (prh->pr->x - prh->startx));
+ }
+
+ if (width < min_width)
+ min_width = width;
+ }
+ }
+
+ return min_width;
+}
+
+static gint
+gimp_get_portion_height (GimpPixelRgnIterator *pri)
+{
+ GSList *list;
+ gint min_height = G_MAXINT;
+ gint height;
+
+ /* Find the minimum height to the next vertical tile (in the case of
+ * a tile manager) or to the end of the pixel region (in the case of
+ * no tile manager)
+ */
+
+ for (list = pri->pixel_regions; list; list = list->next)
+ {
+ GimpPixelRgnHolder *prh = list->data;
+
+ if (prh->pr)
+ {
+ /* Check if we're past the point of no return */
+ if ((prh->pr->y - prh->starty) >= pri->region_height)
+ return 0;
+
+ if (prh->pr->drawable)
+ {
+ height = TILE_HEIGHT - (prh->pr->y % TILE_HEIGHT);
+ height = CLAMP (height,
+ 0,
+ (pri->region_height - (prh->pr->y - prh->starty)));
+ }
+ else
+ {
+ height = (pri->region_height - (prh->pr->y - prh->starty));
+ }
+
+ if (height < min_height)
+ min_height = height;
+ }
+ }
+
+ return min_height;
+}
+
+static gpointer
+gimp_pixel_rgns_configure (GimpPixelRgnIterator *pri)
+{
+ GSList *list;
+
+ /* Determine the portion width and height */
+ pri->portion_width = gimp_get_portion_width (pri);
+ pri->portion_height = gimp_get_portion_height (pri);
+
+ if (pri->portion_width == 0 ||
+ pri->portion_height == 0)
+ {
+ /* free the pixel regions list */
+ for (list = pri->pixel_regions; list; list = list->next)
+ g_slice_free (GimpPixelRgnHolder, list->data);
+
+ g_slist_free (pri->pixel_regions);
+ g_slice_free (GimpPixelRgnIterator, pri);
+
+ return NULL;
+ }
+
+ pri->process_count++;
+
+ for (list = pri->pixel_regions; list; list = list->next)
+ {
+ GimpPixelRgnHolder *prh = list->data;
+
+ if ((prh->pr != NULL) && (prh->pr->process_count != pri->process_count))
+ {
+ prh->pr->process_count++;
+ gimp_pixel_rgn_configure (prh, pri);
+ }
+ }
+
+ return pri;
+}
+
+static void
+gimp_pixel_rgn_configure (GimpPixelRgnHolder *prh,
+ GimpPixelRgnIterator *pri)
+{
+ /* Configure the rowstride and data pointer for the pixel region
+ * based on the current offsets into the region and whether the
+ * region is represented by a tile manager or not
+ */
+ if (prh->pr->drawable)
+ {
+ GimpTile *tile;
+ gint offx;
+ gint offy;
+
+ tile = gimp_drawable_get_tile2 (prh->pr->drawable,
+ prh->pr->shadow,
+ prh->pr->x,
+ prh->pr->y);
+ gimp_tile_ref (tile);
+
+ offx = prh->pr->x % TILE_WIDTH;
+ offy = prh->pr->y % TILE_HEIGHT;
+
+ prh->pr->rowstride = tile->ewidth * prh->pr->bpp;
+ prh->pr->data = (tile->data +
+ offy * prh->pr->rowstride + offx * prh->pr->bpp);
+ }
+ else
+ {
+ prh->pr->data = (prh->original_data +
+ prh->pr->y * prh->pr->rowstride +
+ prh->pr->x * prh->pr->bpp);
+ }
+
+ prh->pr->w = pri->portion_width;
+ prh->pr->h = pri->portion_height;
+}
diff --git a/libgimp/gimppixelrgn.h b/libgimp/gimppixelrgn.h
new file mode 100644
index 0000000..8fb4c4c
--- /dev/null
+++ b/libgimp/gimppixelrgn.h
@@ -0,0 +1,122 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimppixelrgn.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PIXEL_RGN_H__
+#define __GIMP_PIXEL_RGN_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+struct _GimpPixelRgn
+{
+ guchar *data; /* pointer to region data */
+ GimpDrawable *drawable; /* pointer to drawable */
+ gint bpp; /* bytes per pixel */
+ gint rowstride; /* bytes per pixel row */
+ gint x, y; /* origin */
+ gint w, h; /* width and height of region */
+ guint dirty : 1; /* will this region be dirtied? */
+ guint shadow : 1; /* will this region use the shadow or normal tiles */
+ gint process_count; /* used internally */
+};
+
+
+GIMP_DEPRECATED_FOR(gimp_drawable_get_buffer)
+void gimp_pixel_rgn_init (GimpPixelRgn *pr,
+ GimpDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint dirty,
+ gint shadow);
+GIMP_DEPRECATED
+void gimp_pixel_rgn_resize (GimpPixelRgn *pr,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+GIMP_DEPRECATED_FOR(gegl_buffer_sample)
+void gimp_pixel_rgn_get_pixel (GimpPixelRgn *pr,
+ guchar *buf,
+ gint x,
+ gint y);
+GIMP_DEPRECATED_FOR(gegl_buffer_get)
+void gimp_pixel_rgn_get_row (GimpPixelRgn *pr,
+ guchar *buf,
+ gint x,
+ gint y,
+ gint width);
+GIMP_DEPRECATED_FOR(gegl_buffer_get)
+void gimp_pixel_rgn_get_col (GimpPixelRgn *pr,
+ guchar *buf,
+ gint x,
+ gint y,
+ gint height);
+GIMP_DEPRECATED_FOR(gegl_buffer_get)
+void gimp_pixel_rgn_get_rect (GimpPixelRgn *pr,
+ guchar *buf,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+GIMP_DEPRECATED_FOR(gegl_buffer_set)
+void gimp_pixel_rgn_set_pixel (GimpPixelRgn *pr,
+ const guchar *buf,
+ gint x,
+ gint y);
+GIMP_DEPRECATED_FOR(gegl_buffer_set)
+void gimp_pixel_rgn_set_row (GimpPixelRgn *pr,
+ const guchar *buf,
+ gint x,
+ gint y,
+ gint width);
+GIMP_DEPRECATED_FOR(gegl_buffer_set)
+void gimp_pixel_rgn_set_col (GimpPixelRgn *pr,
+ const guchar *buf,
+ gint x,
+ gint y,
+ gint height);
+GIMP_DEPRECATED_FOR(gegl_buffer_set)
+void gimp_pixel_rgn_set_rect (GimpPixelRgn *pr,
+ const guchar *buf,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+GIMP_DEPRECATED_FOR(gegl_buffer_iterator_new)
+gpointer gimp_pixel_rgns_register (gint nrgns,
+ ...);
+GIMP_DEPRECATED_FOR(gegl_buffer_iterator_new)
+gpointer gimp_pixel_rgns_register2 (gint nrgns,
+ GimpPixelRgn **prs);
+GIMP_DEPRECATED_FOR(gegl_buffer_iterator_next)
+gpointer gimp_pixel_rgns_process (gpointer pri_ptr);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PIXEL_RGN_H__ */
diff --git a/libgimp/gimpplugin.c b/libgimp/gimpplugin.c
new file mode 100644
index 0000000..64611f9
--- /dev/null
+++ b/libgimp/gimpplugin.c
@@ -0,0 +1,71 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpplugin.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * gimp_plug_in_error_quark:
+ *
+ * Generic #GQuark error domain for plug-ins. Plug-ins are welcome to
+ * create their own domain when they want to handle advanced error
+ * handling. Often, you just want to pass an error message to the core.
+ * This domain can be used for such simple usage.
+ *
+ * See #GError for information on error domains.
+ */
+G_DEFINE_QUARK (gimp-plug-in-error-quark, gimp_plug_in_error)
+
+
+gboolean
+gimp_plugin_icon_register (const gchar *procedure_name,
+ GimpIconType icon_type,
+ const guint8 *icon_data)
+{
+ gint icon_data_length;
+
+ g_return_val_if_fail (procedure_name != NULL, FALSE);
+ g_return_val_if_fail (icon_data != NULL, FALSE);
+
+ switch (icon_type)
+ {
+ case GIMP_ICON_TYPE_ICON_NAME:
+ case GIMP_ICON_TYPE_IMAGE_FILE:
+ icon_data_length = strlen ((const gchar *) icon_data) + 1;
+ break;
+
+ case GIMP_ICON_TYPE_INLINE_PIXBUF:
+ g_return_val_if_fail (g_ntohl (*((gint32 *) icon_data)) == 0x47646b50,
+ FALSE);
+
+ icon_data_length = g_ntohl (*((gint32 *) (icon_data + 4)));
+ break;
+
+ default:
+ g_return_val_if_reached (FALSE);
+ }
+
+ return _gimp_plugin_icon_register (procedure_name,
+ icon_type, icon_data_length, icon_data);
+}
diff --git a/libgimp/gimpplugin.h b/libgimp/gimpplugin.h
new file mode 100644
index 0000000..434f947
--- /dev/null
+++ b/libgimp/gimpplugin.h
@@ -0,0 +1,44 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpplugin.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PLUG_IN_H__
+#define __GIMP_PLUG_IN_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+#define GIMP_PLUG_IN_ERROR (gimp_plug_in_error_quark ())
+
+
+GQuark gimp_plug_in_error_quark (void);
+
+gboolean gimp_plugin_icon_register (const gchar *procedure_name,
+ GimpIconType icon_type,
+ const guint8 *icon_data);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PLUG_IN_H__ */
diff --git a/libgimp/gimpplugin_pdb.c b/libgimp/gimpplugin_pdb.c
new file mode 100644
index 0000000..0cf6766
--- /dev/null
+++ b/libgimp/gimpplugin_pdb.c
@@ -0,0 +1,357 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpplugin_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpplugin
+ * @title: gimpplugin
+ * @short_description: Functions useful for plug-ins, e.g. registration and progress indicators.
+ *
+ * Functions useful for plug-ins, e.g. registration and progress
+ * indicators.
+ **/
+
+
+/**
+ * gimp_plugin_domain_register:
+ * @domain_name: The name of the textdomain (must be unique).
+ * @domain_path: The absolute path to the compiled message catalog (may be NULL).
+ *
+ * Registers a textdomain for localisation.
+ *
+ * This procedure adds a textdomain to the list of domains Gimp
+ * searches for strings when translating its menu entries. There is no
+ * need to call this function for plug-ins that have their strings
+ * included in the 'gimp-std-plugins' domain as that is used by
+ * default. If the compiled message catalog is not in the standard
+ * location, you may specify an absolute path to another location. This
+ * procedure can only be called in the query function of a plug-in and
+ * it has to be called before any procedure is installed.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_plugin_domain_register (const gchar *domain_name,
+ const gchar *domain_path)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-plugin-domain-register",
+ &nreturn_vals,
+ GIMP_PDB_STRING, domain_name,
+ GIMP_PDB_STRING, domain_path,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_plugin_help_register:
+ * @domain_name: The XML namespace of the plug-in's help pages.
+ * @domain_uri: The root URI of the plug-in's help pages.
+ *
+ * Register a help path for a plug-in.
+ *
+ * This procedure registers user documentation for the calling plug-in
+ * with the GIMP help system. The domain_uri parameter points to the
+ * root directory where the plug-in help is installed. For each
+ * supported language there should be a file called 'gimp-help.xml'
+ * that maps the help IDs to the actual help files.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_plugin_help_register (const gchar *domain_name,
+ const gchar *domain_uri)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-plugin-help-register",
+ &nreturn_vals,
+ GIMP_PDB_STRING, domain_name,
+ GIMP_PDB_STRING, domain_uri,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_plugin_menu_register:
+ * @procedure_name: The procedure for which to install the menu path.
+ * @menu_path: The procedure's additional menu path.
+ *
+ * Register an additional menu path for a plug-in procedure.
+ *
+ * This procedure installs an additional menu entry for the given
+ * procedure.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_plugin_menu_register (const gchar *procedure_name,
+ const gchar *menu_path)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-plugin-menu-register",
+ &nreturn_vals,
+ GIMP_PDB_STRING, procedure_name,
+ GIMP_PDB_STRING, menu_path,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_plugin_menu_branch_register:
+ * @menu_path: The sub-menu's menu path.
+ * @menu_name: The name of the sub-menu.
+ *
+ * Register a sub-menu.
+ *
+ * This procedure installs a sub-menu which does not belong to any
+ * procedure. The menu-name should be the untranslated menu label. GIMP
+ * will look up the translation in the textdomain registered for the
+ * plug-in.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_plugin_menu_branch_register (const gchar *menu_path,
+ const gchar *menu_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-plugin-menu-branch-register",
+ &nreturn_vals,
+ GIMP_PDB_STRING, menu_path,
+ GIMP_PDB_STRING, menu_name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_plugin_icon_register:
+ * @procedure_name: The procedure for which to install the icon.
+ * @icon_type: The type of the icon.
+ * @icon_data_length: The length of 'icon-data'.
+ * @icon_data: The procedure's icon. The format depends on the 'icon_type' parameter.
+ *
+ * Register an icon for a plug-in procedure.
+ *
+ * This procedure installs an icon for the given procedure.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+_gimp_plugin_icon_register (const gchar *procedure_name,
+ GimpIconType icon_type,
+ gint icon_data_length,
+ const guint8 *icon_data)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-plugin-icon-register",
+ &nreturn_vals,
+ GIMP_PDB_STRING, procedure_name,
+ GIMP_PDB_INT32, icon_type,
+ GIMP_PDB_INT32, icon_data_length,
+ GIMP_PDB_INT8ARRAY, icon_data,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_plugin_set_pdb_error_handler:
+ * @handler: Who is responsible for handling procedure call errors.
+ *
+ * Sets an error handler for procedure calls.
+ *
+ * This procedure changes the way that errors in procedure calls are
+ * handled. By default GIMP will raise an error dialog if a procedure
+ * call made by a plug-in fails. Using this procedure the plug-in can
+ * change this behavior. If the error handler is set to
+ * %GIMP_PDB_ERROR_HANDLER_PLUGIN, then the plug-in is responsible for
+ * calling gimp_get_pdb_error() and handling the error whenever one if
+ * its procedure calls fails. It can do this by displaying the error
+ * message or by forwarding it in its own return values.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_plugin_set_pdb_error_handler (GimpPDBErrorHandler handler)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-plugin-set-pdb-error-handler",
+ &nreturn_vals,
+ GIMP_PDB_INT32, handler,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_plugin_get_pdb_error_handler:
+ *
+ * Retrieves the active error handler for procedure calls.
+ *
+ * This procedure retrieves the currently active error handler for
+ * procedure calls made by the calling plug-in. See
+ * gimp_plugin_set_pdb_error_handler() for details.
+ *
+ * Returns: Who is responsible for handling procedure call errors.
+ *
+ * Since: 2.6
+ **/
+GimpPDBErrorHandler
+gimp_plugin_get_pdb_error_handler (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpPDBErrorHandler handler = 0;
+
+ return_vals = gimp_run_procedure ("gimp-plugin-get-pdb-error-handler",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ handler = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return handler;
+}
+
+/**
+ * gimp_plugin_enable_precision:
+ *
+ * Switches this plug-in to using the real bit depth of drawables.
+ *
+ * Switches this plug-in to using the real bit depth of drawables. This
+ * setting can only be enabled, and not disabled again during the
+ * lifetime of the plug-in. Using gimp_drawable_get_buffer(),
+ * gimp_drawable_get_shadow_buffer() or gimp_drawable_get_format() will
+ * automatically call this function.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_plugin_enable_precision (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-plugin-enable-precision",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_plugin_precision_enabled:
+ *
+ * Whether this plug-in is using the real bit depth of drawables.
+ *
+ * Returns whether this plug-in is using the real bit depth of
+ * drawables, which can be more than 8 bits per channel.
+ *
+ * Returns: Whether precision is enabled.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_plugin_precision_enabled (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean enabled = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-plugin-precision-enabled",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ enabled = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return enabled;
+}
diff --git a/libgimp/gimpplugin_pdb.h b/libgimp/gimpplugin_pdb.h
new file mode 100644
index 0000000..97b83d8
--- /dev/null
+++ b/libgimp/gimpplugin_pdb.h
@@ -0,0 +1,55 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpplugin_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PLUG_IN_PDB_H__
+#define __GIMP_PLUG_IN_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_plugin_domain_register (const gchar *domain_name,
+ const gchar *domain_path);
+gboolean gimp_plugin_help_register (const gchar *domain_name,
+ const gchar *domain_uri);
+gboolean gimp_plugin_menu_register (const gchar *procedure_name,
+ const gchar *menu_path);
+gboolean gimp_plugin_menu_branch_register (const gchar *menu_path,
+ const gchar *menu_name);
+G_GNUC_INTERNAL gboolean _gimp_plugin_icon_register (const gchar *procedure_name,
+ GimpIconType icon_type,
+ gint icon_data_length,
+ const guint8 *icon_data);
+gboolean gimp_plugin_set_pdb_error_handler (GimpPDBErrorHandler handler);
+GimpPDBErrorHandler gimp_plugin_get_pdb_error_handler (void);
+gboolean gimp_plugin_enable_precision (void);
+gboolean gimp_plugin_precision_enabled (void);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PLUG_IN_PDB_H__ */
diff --git a/libgimp/gimpprocbrowserdialog.c b/libgimp/gimpprocbrowserdialog.c
new file mode 100644
index 0000000..dbb5b21
--- /dev/null
+++ b/libgimp/gimpprocbrowserdialog.c
@@ -0,0 +1,546 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpprocbrowserdialog.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimpprocbrowserdialog.h"
+#include "gimpprocview.h"
+
+#include "libgimp-intl.h"
+
+
+/**
+ * SECTION: gimpprocbrowserdialog
+ * @title: GimpProcBrowserDialog
+ * @short_description: The dialog for the procedure and plugin browsers.
+ *
+ * The dialog for the procedure and plugin browsers.
+ **/
+
+
+#define DBL_LIST_WIDTH 250
+#define DBL_WIDTH (DBL_LIST_WIDTH + 400)
+#define DBL_HEIGHT 250
+
+
+enum
+{
+ SELECTION_CHANGED,
+ ROW_ACTIVATED,
+ LAST_SIGNAL
+};
+
+typedef enum
+{
+ SEARCH_TYPE_ALL,
+ SEARCH_TYPE_NAME,
+ SEARCH_TYPE_BLURB,
+ SEARCH_TYPE_HELP,
+ SEARCH_TYPE_AUTHOR,
+ SEARCH_TYPE_COPYRIGHT,
+ SEARCH_TYPE_DATE,
+ SEARCH_TYPE_PROC_TYPE
+} SearchType;
+
+enum
+{
+ COLUMN_PROC_NAME,
+ N_COLUMNS
+};
+
+
+static void browser_selection_changed (GtkTreeSelection *sel,
+ GimpProcBrowserDialog *dialog);
+static void browser_row_activated (GtkTreeView *treeview,
+ GtkTreePath *path,
+ GtkTreeViewColumn *column,
+ GimpProcBrowserDialog *dialog);
+static void browser_show_procedure (GimpProcBrowserDialog *dialog,
+ const gchar *proc_name);
+static void browser_search (GimpBrowser *browser,
+ const gchar *query_text,
+ gint search_type,
+ GimpProcBrowserDialog *dialog);
+
+
+G_DEFINE_TYPE (GimpProcBrowserDialog, gimp_proc_browser_dialog,
+ GIMP_TYPE_DIALOG)
+
+#define parent_class gimp_proc_browser_dialog_parent_class
+
+static guint dialog_signals[LAST_SIGNAL] = { 0, };
+
+
+static void
+gimp_proc_browser_dialog_class_init (GimpProcBrowserDialogClass *klass)
+{
+ /**
+ * GimpProcBrowserDialog::selection-changed:
+ * @dialog: the object that received the signal
+ *
+ * Emitted when the selection in the contained #GtkTreeView changes.
+ */
+ dialog_signals[SELECTION_CHANGED] =
+ g_signal_new ("selection-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GimpProcBrowserDialogClass,
+ selection_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ /**
+ * GimpProcBrowserDialog::row-activated:
+ * @dialog: the object that received the signal
+ *
+ * Emitted when one of the rows in the contained #GtkTreeView is activated.
+ */
+ dialog_signals[ROW_ACTIVATED] =
+ g_signal_new ("row-activated",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GimpProcBrowserDialogClass,
+ row_activated),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ klass->selection_changed = NULL;
+ klass->row_activated = NULL;
+}
+
+static void
+gimp_proc_browser_dialog_init (GimpProcBrowserDialog *dialog)
+{
+ GtkWidget *scrolled_window;
+ GtkCellRenderer *renderer;
+ GtkTreeSelection *selection;
+ GtkWidget *parent;
+
+ dialog->browser = gimp_browser_new ();
+ gimp_browser_add_search_types (GIMP_BROWSER (dialog->browser),
+ _("by name"), SEARCH_TYPE_NAME,
+ _("by description"), SEARCH_TYPE_BLURB,
+ _("by help"), SEARCH_TYPE_HELP,
+ _("by author"), SEARCH_TYPE_AUTHOR,
+ _("by copyright"), SEARCH_TYPE_COPYRIGHT,
+ _("by date"), SEARCH_TYPE_DATE,
+ _("by type"), SEARCH_TYPE_PROC_TYPE,
+ NULL);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog->browser), 12);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
+ dialog->browser, TRUE, TRUE, 0);
+ gtk_widget_show (dialog->browser);
+
+ g_signal_connect (dialog->browser, "search",
+ G_CALLBACK (browser_search),
+ dialog);
+
+ /* list : list in a scrolled_win */
+
+ scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
+ GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_ALWAYS);
+ gtk_box_pack_start (GTK_BOX (GIMP_BROWSER (dialog->browser)->left_vbox),
+ scrolled_window, TRUE, TRUE, 0);
+ gtk_widget_show (scrolled_window);
+
+ dialog->tree_view = gtk_tree_view_new ();
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_renderer_text_set_fixed_height_from_font
+ (GTK_CELL_RENDERER_TEXT (renderer), 1);
+
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (dialog->tree_view),
+ -1, NULL,
+ renderer,
+ "text", 0,
+ NULL);
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (dialog->tree_view), FALSE);
+
+ g_signal_connect (dialog->tree_view, "row_activated",
+ G_CALLBACK (browser_row_activated),
+ dialog);
+
+ gtk_widget_set_size_request (dialog->tree_view, DBL_LIST_WIDTH, DBL_HEIGHT);
+ gtk_container_add (GTK_CONTAINER (scrolled_window), dialog->tree_view);
+ gtk_widget_show (dialog->tree_view);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->tree_view));
+
+ g_signal_connect (selection, "changed",
+ G_CALLBACK (browser_selection_changed),
+ dialog);
+
+ parent = gtk_widget_get_parent (GIMP_BROWSER (dialog->browser)->right_vbox);
+ parent = gtk_widget_get_parent (parent);
+
+ gtk_widget_set_size_request (parent, DBL_WIDTH - DBL_LIST_WIDTH, -1);
+}
+
+
+/* public functions */
+
+/**
+ * gimp_proc_browser_dialog_new:
+ * @title: The dialog's title.
+ * @role: The dialog's role, see gtk_window_set_role().
+ * @help_func: The function which will be called if the user presses "F1".
+ * @help_id: The help_id which will be passed to @help_func.
+ * @...: A %NULL-terminated list destribing the action_area buttons.
+ *
+ * Create a new #GimpProcBrowserDialog.
+ *
+ * Return Value: a newly created #GimpProcBrowserDialog.
+ *
+ * Since: 2.4
+ **/
+GtkWidget *
+gimp_proc_browser_dialog_new (const gchar *title,
+ const gchar *role,
+ GimpHelpFunc help_func,
+ const gchar *help_id,
+ ...)
+{
+ GimpProcBrowserDialog *dialog;
+ va_list args;
+
+ va_start (args, help_id);
+
+ dialog = g_object_new (GIMP_TYPE_PROC_BROWSER_DIALOG,
+ "title", title,
+ "role", role,
+ "help-func", help_func,
+ "help-id", help_id,
+ NULL);
+
+ gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args);
+
+ va_end (args);
+
+ /* first search (all procedures) */
+ browser_search (GIMP_BROWSER (dialog->browser), "", SEARCH_TYPE_ALL, dialog);
+
+ return GTK_WIDGET (dialog);
+}
+
+/**
+ * gimp_proc_browser_dialog_get_selected:
+ * @dialog: a #GimpProcBrowserDialog
+ *
+ * Retrieves the name of the currently selected procedure.
+ *
+ * Return Value: The name of the selected procedure of %NULL if no
+ * procedure is selected.
+ *
+ * Since: 2.4
+ **/
+gchar *
+gimp_proc_browser_dialog_get_selected (GimpProcBrowserDialog *dialog)
+{
+ GtkTreeSelection *sel;
+ GtkTreeIter iter;
+
+ g_return_val_if_fail (GIMP_IS_PROC_BROWSER_DIALOG (dialog), NULL);
+
+ sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->tree_view));
+
+ if (gtk_tree_selection_get_selected (sel, NULL, &iter))
+ {
+ gchar *proc_name;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), &iter,
+ COLUMN_PROC_NAME, &proc_name,
+ -1);
+
+ return proc_name;
+ }
+
+ return NULL;
+}
+
+
+/* private functions */
+
+static void
+browser_selection_changed (GtkTreeSelection *sel,
+ GimpProcBrowserDialog *dialog)
+{
+ GtkTreeIter iter;
+
+ if (gtk_tree_selection_get_selected (sel, NULL, &iter))
+ {
+ gchar *proc_name;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), &iter,
+ COLUMN_PROC_NAME, &proc_name,
+ -1);
+ browser_show_procedure (dialog, proc_name);
+ g_free (proc_name);
+ }
+
+ g_signal_emit (dialog, dialog_signals[SELECTION_CHANGED], 0);
+}
+
+static void
+browser_row_activated (GtkTreeView *treeview,
+ GtkTreePath *path,
+ GtkTreeViewColumn *column,
+ GimpProcBrowserDialog *dialog)
+{
+ g_signal_emit (dialog, dialog_signals[ROW_ACTIVATED], 0);
+}
+
+static void
+browser_show_procedure (GimpProcBrowserDialog *dialog,
+ const gchar *proc_name)
+{
+ gchar *proc_blurb;
+ gchar *proc_help;
+ gchar *proc_author;
+ gchar *proc_copyright;
+ gchar *proc_date;
+ GimpPDBProcType proc_type;
+ gint n_params;
+ gint n_return_vals;
+ GimpParamDef *params;
+ GimpParamDef *return_vals;
+
+ gimp_procedural_db_proc_info (proc_name,
+ &proc_blurb,
+ &proc_help,
+ &proc_author,
+ &proc_copyright,
+ &proc_date,
+ &proc_type,
+ &n_params,
+ &n_return_vals,
+ &params,
+ &return_vals);
+
+ gimp_browser_set_widget (GIMP_BROWSER (dialog->browser),
+ gimp_proc_view_new (proc_name,
+ NULL,
+ proc_blurb,
+ proc_help,
+ proc_author,
+ proc_copyright,
+ proc_date,
+ proc_type,
+ n_params,
+ n_return_vals,
+ params,
+ return_vals));
+
+ g_free (proc_blurb);
+ g_free (proc_help);
+ g_free (proc_author);
+ g_free (proc_copyright);
+ g_free (proc_date);
+
+ gimp_destroy_paramdefs (params, n_params);
+ gimp_destroy_paramdefs (return_vals, n_return_vals);
+}
+
+static void
+browser_search (GimpBrowser *browser,
+ const gchar *query_text,
+ gint search_type,
+ GimpProcBrowserDialog *dialog)
+{
+ gchar **proc_list;
+ gint num_procs;
+ gchar *str;
+ GRegex *regex;
+
+ /* first check if the query is a valid regex */
+ regex = g_regex_new (query_text, 0, 0, NULL);
+
+ if (! regex)
+ {
+ gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->tree_view), NULL);
+ dialog->store = NULL;
+
+ gimp_browser_show_message (browser, _("No matches"));
+
+ gtk_label_set_text (GTK_LABEL (browser->count_label),
+ _("Search term invalid or incomplete"));
+ return;
+ }
+
+ g_regex_unref (regex);
+
+ switch (search_type)
+ {
+ case SEARCH_TYPE_ALL:
+ gimp_browser_show_message (browser, _("Searching"));
+
+ gimp_procedural_db_query (".*", ".*", ".*", ".*", ".*", ".*", ".*",
+ &num_procs, &proc_list);
+ break;
+
+ case SEARCH_TYPE_NAME:
+ {
+ GString *query = g_string_new ("");
+ const gchar *q = query_text;
+
+ gimp_browser_show_message (browser, _("Searching by name"));
+
+ while (*q)
+ {
+ if ((*q == '_') || (*q == '-'))
+ g_string_append (query, "-");
+ else
+ g_string_append_c (query, *q);
+
+ q++;
+ }
+
+ gimp_procedural_db_query (query->str,
+ ".*", ".*", ".*", ".*", ".*", ".*",
+ &num_procs, &proc_list);
+
+ g_string_free (query, TRUE);
+ }
+ break;
+
+ case SEARCH_TYPE_BLURB:
+ gimp_browser_show_message (browser, _("Searching by description"));
+
+ gimp_procedural_db_query (".*", query_text, ".*", ".*", ".*", ".*", ".*",
+ &num_procs, &proc_list);
+ break;
+
+ case SEARCH_TYPE_HELP:
+ gimp_browser_show_message (browser, _("Searching by help"));
+
+ gimp_procedural_db_query (".*", ".*", query_text, ".*", ".*", ".*", ".*",
+ &num_procs, &proc_list);
+ break;
+
+ case SEARCH_TYPE_AUTHOR:
+ gimp_browser_show_message (browser, _("Searching by author"));
+
+ gimp_procedural_db_query (".*", ".*", ".*", query_text, ".*", ".*", ".*",
+ &num_procs, &proc_list);
+ break;
+
+ case SEARCH_TYPE_COPYRIGHT:
+ gimp_browser_show_message (browser, _("Searching by copyright"));
+
+ gimp_procedural_db_query (".*", ".*", ".*", ".*", query_text, ".*", ".*",
+ &num_procs, &proc_list);
+ break;
+
+ case SEARCH_TYPE_DATE:
+ gimp_browser_show_message (browser, _("Searching by date"));
+
+ gimp_procedural_db_query (".*", ".*", ".*", ".*", ".*", query_text, ".*",
+ &num_procs, &proc_list);
+ break;
+
+ case SEARCH_TYPE_PROC_TYPE:
+ gimp_browser_show_message (browser, _("Searching by type"));
+
+ gimp_procedural_db_query (".*", ".*", ".*", ".*", ".*", ".*", query_text,
+ &num_procs, &proc_list);
+ break;
+ }
+
+ if (! query_text || strlen (query_text) == 0)
+ {
+ str = g_strdup_printf (dngettext (GETTEXT_PACKAGE "-libgimp",
+ "%d procedure",
+ "%d procedures",
+ num_procs), num_procs);
+ }
+ else
+ {
+ switch (num_procs)
+ {
+ case 0:
+ str = g_strdup (_("No matches for your query"));
+ break;
+ default:
+ str = g_strdup_printf (dngettext (GETTEXT_PACKAGE "-libgimp",
+ "%d procedure matches your query",
+ "%d procedures match your query",
+ num_procs), num_procs);
+ break;
+ }
+ }
+
+ gtk_label_set_text (GTK_LABEL (browser->count_label), str);
+ g_free (str);
+
+ if (num_procs > 0)
+ {
+ GtkTreeSelection *selection;
+ GtkTreeIter iter;
+ gint i;
+
+ dialog->store = gtk_list_store_new (N_COLUMNS,
+ G_TYPE_STRING);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->tree_view),
+ GTK_TREE_MODEL (dialog->store));
+ g_object_unref (dialog->store);
+
+ for (i = 0; i < num_procs; i++)
+ {
+ gtk_list_store_append (dialog->store, &iter);
+ gtk_list_store_set (dialog->store, &iter,
+ COLUMN_PROC_NAME, proc_list[i],
+ -1);
+ }
+
+ g_strfreev (proc_list);
+
+ gtk_tree_view_columns_autosize (GTK_TREE_VIEW (dialog->tree_view));
+
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (dialog->store),
+ COLUMN_PROC_NAME,
+ GTK_SORT_ASCENDING);
+
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->store), &iter);
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->tree_view));
+ gtk_tree_selection_select_iter (selection, &iter);
+ }
+ else
+ {
+ gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->tree_view), NULL);
+ dialog->store = NULL;
+
+ gimp_browser_show_message (browser, _("No matches"));
+ }
+}
diff --git a/libgimp/gimpprocbrowserdialog.h b/libgimp/gimpprocbrowserdialog.h
new file mode 100644
index 0000000..cf096c3
--- /dev/null
+++ b/libgimp/gimpprocbrowserdialog.h
@@ -0,0 +1,82 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpprocbrowserdialog.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PROC_BROWSER_DIALOG_H__
+#define __GIMP_PROC_BROWSER_DIALOG_H__
+
+G_BEGIN_DECLS
+
+
+/* For information look into the C source or the html documentation */
+
+
+#define GIMP_TYPE_PROC_BROWSER_DIALOG (gimp_proc_browser_dialog_get_type ())
+#define GIMP_PROC_BROWSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PROC_BROWSER_DIALOG, GimpProcBrowserDialog))
+#define GIMP_PROC_BROWSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PROC_BROWSER_DIALOG, GimpProcBrowserDialogClass))
+#define GIMP_IS_PROC_BROWSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PROC_BROWSER_DIALOG))
+#define GIMP_IS_PROC_BROWSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PROC_BROWSER_DIALOG))
+#define GIMP_PROC_BROWSER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PROC_BROWSER_DIALOG, GimpProcBrowserDialogClass))
+
+
+typedef struct _GimpProcBrowserDialogClass GimpProcBrowserDialogClass;
+
+struct _GimpProcBrowserDialog
+{
+ GimpDialog parent_instance;
+
+ GtkWidget *browser;
+
+ GtkListStore *store;
+ GtkWidget *tree_view;
+};
+
+struct _GimpProcBrowserDialogClass
+{
+ GimpDialogClass parent_class;
+
+ void (* selection_changed) (GimpProcBrowserDialog *dialog);
+ void (* row_activated) (GimpProcBrowserDialog *dialog);
+
+ /* Padding for future expansion */
+ void (* _gimp_reserved1) (void);
+ void (* _gimp_reserved2) (void);
+ void (* _gimp_reserved3) (void);
+ void (* _gimp_reserved4) (void);
+};
+
+
+GType gimp_proc_browser_dialog_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_proc_browser_dialog_new (const gchar *title,
+ const gchar *role,
+ GimpHelpFunc help_func,
+ const gchar *help_id,
+ ...) G_GNUC_NULL_TERMINATED;
+
+gchar * gimp_proc_browser_dialog_get_selected (GimpProcBrowserDialog *dialog);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PROC_BROWSER_DIALOG_H__ */
diff --git a/libgimp/gimpproceduraldb.c b/libgimp/gimpproceduraldb.c
new file mode 100644
index 0000000..4605af1
--- /dev/null
+++ b/libgimp/gimpproceduraldb.c
@@ -0,0 +1,173 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimpproceduraldb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <string.h> /* memcmp */
+
+#include "gimp.h"
+
+/**
+ * gimp_procedural_db_proc_info:
+ * @procedure: The procedure name.
+ * @blurb: A short blurb.
+ * @help: Detailed procedure help.
+ * @author: Author(s) of the procedure.
+ * @copyright: The copyright.
+ * @date: Copyright date.
+ * @proc_type: The procedure type.
+ * @num_args: The number of input arguments.
+ * @num_values: The number of return values.
+ * @args: The input arguments.
+ * @return_vals: The return values.
+ *
+ * Queries the procedural database for information on the specified
+ * procedure.
+ *
+ * This procedure returns information on the specified procedure. A
+ * short blurb, detailed help, author(s), copyright information,
+ * procedure type, number of input, and number of return values are
+ * returned. Additionally this function returns specific information
+ * about each input argument and return value.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_procedural_db_proc_info (const gchar *procedure,
+ gchar **blurb,
+ gchar **help,
+ gchar **author,
+ gchar **copyright,
+ gchar **date,
+ GimpPDBProcType *proc_type,
+ gint *num_args,
+ gint *num_values,
+ GimpParamDef **args,
+ GimpParamDef **return_vals)
+{
+ gint i;
+ gboolean success = TRUE;
+
+ success = _gimp_procedural_db_proc_info (procedure,
+ blurb,
+ help,
+ author,
+ copyright,
+ date,
+ proc_type,
+ num_args,
+ num_values);
+
+ if (success)
+ {
+ *args = g_new (GimpParamDef, *num_args);
+ *return_vals = g_new (GimpParamDef, *num_values);
+
+ for (i = 0; i < *num_args; i++)
+ {
+ if (! gimp_procedural_db_proc_arg (procedure,
+ i,
+ &(*args)[i].type,
+ &(*args)[i].name,
+ &(*args)[i].description))
+ {
+ g_free (*args);
+ g_free (*return_vals);
+
+ return FALSE;
+ }
+ }
+
+ for (i = 0; i < *num_values; i++)
+ {
+ if (! gimp_procedural_db_proc_val (procedure,
+ i,
+ &(*return_vals)[i].type,
+ &(*return_vals)[i].name,
+ &(*return_vals)[i].description))
+ {
+ g_free (*args);
+ g_free (*return_vals);
+
+ return FALSE;
+ }
+ }
+ }
+
+ return success;
+}
+
+/**
+ * gimp_procedural_db_get_data:
+ * @identifier: The identifier associated with data.
+ * @data: A byte array containing data.
+ *
+ * Returns data associated with the specified identifier.
+ *
+ * This procedure returns any data which may have been associated with
+ * the specified identifier. The data is copied into the given memory
+ * location.
+ *
+ * Returns: TRUE on success, FALSE if no data has been associated with
+ * the identifier
+ */
+gboolean
+gimp_procedural_db_get_data (const gchar *identifier,
+ gpointer data)
+{
+ gint size;
+ guint8 *hack;
+ gboolean success;
+
+ success = _gimp_procedural_db_get_data (identifier,
+ &size,
+ &hack);
+ if (hack)
+ {
+ memcpy (data, (gconstpointer) hack, size * sizeof (guint8));
+ g_free (hack);
+ }
+
+ return success;
+}
+
+/**
+ * gimp_procedural_db_set_data:
+ * @identifier: The identifier associated with data.
+ * @data: A byte array containing data.
+ * @bytes: The number of bytes in the data
+ *
+ * Associates the specified identifier with the supplied data.
+ *
+ * This procedure associates the supplied data with the provided
+ * identifier. The data may be subsequently retrieved by a call to
+ * 'procedural-db-get-data'.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_procedural_db_set_data (const gchar *identifier,
+ gconstpointer data,
+ guint32 bytes)
+{
+ return _gimp_procedural_db_set_data (identifier,
+ bytes,
+ data);
+}
diff --git a/libgimp/gimpproceduraldb.h b/libgimp/gimpproceduraldb.h
new file mode 100644
index 0000000..70e6005
--- /dev/null
+++ b/libgimp/gimpproceduraldb.h
@@ -0,0 +1,53 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimpproceduraldb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PROCEDURAL_DB_H__
+#define __GIMP_PROCEDURAL_DB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_procedural_db_proc_info (const gchar *procedure,
+ gchar **blurb,
+ gchar **help,
+ gchar **author,
+ gchar **copyright,
+ gchar **date,
+ GimpPDBProcType *proc_type,
+ gint *num_args,
+ gint *num_values,
+ GimpParamDef **args,
+ GimpParamDef **return_vals);
+gboolean gimp_procedural_db_get_data (const gchar *identifier,
+ gpointer data);
+gboolean gimp_procedural_db_set_data (const gchar *identifier,
+ gconstpointer data,
+ guint32 bytes);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PROCEDURAL_DB_H__ */
diff --git a/libgimp/gimpproceduraldb_pdb.c b/libgimp/gimpproceduraldb_pdb.c
new file mode 100644
index 0000000..32f47cf
--- /dev/null
+++ b/libgimp/gimpproceduraldb_pdb.c
@@ -0,0 +1,501 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpproceduraldb_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpproceduraldb
+ * @title: gimpproceduraldb
+ * @short_description: Functions for querying and changing procedural database (PDB) entries.
+ *
+ * Functions for querying and changing procedural database (PDB)
+ * entries.
+ **/
+
+
+/**
+ * gimp_procedural_db_temp_name:
+ *
+ * Generates a unique temporary PDB name.
+ *
+ * This procedure generates a temporary PDB entry name that is
+ * guaranteed to be unique.
+ *
+ * Returns: A unique temporary name for a temporary PDB entry.
+ **/
+gchar *
+gimp_procedural_db_temp_name (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *temp_name = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-procedural-db-temp-name",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ temp_name = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return temp_name;
+}
+
+/**
+ * gimp_procedural_db_dump:
+ * @filename: The dump filename.
+ *
+ * Dumps the current contents of the procedural database
+ *
+ * This procedure dumps the contents of the procedural database to the
+ * specified file. The file will contain all of the information
+ * provided for each registered procedure.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_procedural_db_dump (const gchar *filename)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-procedural-db-dump",
+ &nreturn_vals,
+ GIMP_PDB_STRING, filename,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_procedural_db_query:
+ * @name: The regex for procedure name.
+ * @blurb: The regex for procedure blurb.
+ * @help: The regex for procedure help.
+ * @author: The regex for procedure author.
+ * @copyright: The regex for procedure copyright.
+ * @date: The regex for procedure date.
+ * @proc_type: The regex for procedure type: { 'Internal GIMP procedure', 'GIMP Plug-in', 'GIMP Extension', 'Temporary Procedure' }.
+ * @num_matches: The number of matching procedures.
+ * @procedure_names: The list of procedure names.
+ *
+ * Queries the procedural database for its contents using regular
+ * expression matching.
+ *
+ * This procedure queries the contents of the procedural database. It
+ * is supplied with seven arguments matching procedures on { name,
+ * blurb, help, author, copyright, date, procedure type}. This is
+ * accomplished using regular expression matching. For instance, to
+ * find all procedures with \"jpeg\" listed in the blurb, all seven
+ * arguments can be supplied as \".*\", except for the second, which
+ * can be supplied as \".*jpeg.*\". There are two return arguments for
+ * this procedure. The first is the number of procedures matching the
+ * query. The second is a concatenated list of procedure names
+ * corresponding to those matching the query. If no matching entries
+ * are found, then the returned string is NULL and the number of
+ * entries is 0.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_procedural_db_query (const gchar *name,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ const gchar *proc_type,
+ gint *num_matches,
+ gchar ***procedure_names)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-procedural-db-query",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_STRING, blurb,
+ GIMP_PDB_STRING, help,
+ GIMP_PDB_STRING, author,
+ GIMP_PDB_STRING, copyright,
+ GIMP_PDB_STRING, date,
+ GIMP_PDB_STRING, proc_type,
+ GIMP_PDB_END);
+
+ *num_matches = 0;
+ *procedure_names = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *num_matches = return_vals[1].data.d_int32;
+ if (*num_matches > 0)
+ {
+ *procedure_names = g_new0 (gchar *, *num_matches + 1);
+ for (i = 0; i < *num_matches; i++)
+ (*procedure_names)[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_procedural_db_proc_exists:
+ * @procedure_name: The procedure name.
+ *
+ * Checks if the specified procedure exists in the procedural database
+ *
+ * This procedure checks if the specified procedure is registered in
+ * the procedural database.
+ *
+ * Returns: Whether a procedure of that name is registered.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_procedural_db_proc_exists (const gchar *procedure_name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean exists = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-procedural-db-proc-exists",
+ &nreturn_vals,
+ GIMP_PDB_STRING, procedure_name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ exists = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return exists;
+}
+
+/**
+ * _gimp_procedural_db_proc_info:
+ * @procedure_name: The procedure name.
+ * @blurb: A short blurb.
+ * @help: Detailed procedure help.
+ * @author: Author(s) of the procedure.
+ * @copyright: The copyright.
+ * @date: Copyright date.
+ * @proc_type: The procedure type.
+ * @num_args: The number of input arguments.
+ * @num_values: The number of return values.
+ *
+ * Queries the procedural database for information on the specified
+ * procedure.
+ *
+ * This procedure returns information on the specified procedure. A
+ * short blurb, detailed help, author(s), copyright information,
+ * procedure type, number of input, and number of return values are
+ * returned. For specific information on each input argument and return
+ * value, use the gimp_procedural_db_proc_arg() and
+ * gimp_procedural_db_proc_val() procedures.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_procedural_db_proc_info (const gchar *procedure_name,
+ gchar **blurb,
+ gchar **help,
+ gchar **author,
+ gchar **copyright,
+ gchar **date,
+ GimpPDBProcType *proc_type,
+ gint *num_args,
+ gint *num_values)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-procedural-db-proc-info",
+ &nreturn_vals,
+ GIMP_PDB_STRING, procedure_name,
+ GIMP_PDB_END);
+
+ *blurb = NULL;
+ *help = NULL;
+ *author = NULL;
+ *copyright = NULL;
+ *date = NULL;
+ *proc_type = 0;
+ *num_args = 0;
+ *num_values = 0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *blurb = g_strdup (return_vals[1].data.d_string);
+ *help = g_strdup (return_vals[2].data.d_string);
+ *author = g_strdup (return_vals[3].data.d_string);
+ *copyright = g_strdup (return_vals[4].data.d_string);
+ *date = g_strdup (return_vals[5].data.d_string);
+ *proc_type = return_vals[6].data.d_int32;
+ *num_args = return_vals[7].data.d_int32;
+ *num_values = return_vals[8].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_procedural_db_proc_arg:
+ * @procedure_name: The procedure name.
+ * @arg_num: The argument number.
+ * @arg_type: The type of argument.
+ * @arg_name: The name of the argument.
+ * @arg_desc: A description of the argument.
+ *
+ * Queries the procedural database for information on the specified
+ * procedure's argument.
+ *
+ * This procedure returns information on the specified procedure's
+ * argument. The argument type, name, and a description are retrieved.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_procedural_db_proc_arg (const gchar *procedure_name,
+ gint arg_num,
+ GimpPDBArgType *arg_type,
+ gchar **arg_name,
+ gchar **arg_desc)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-procedural-db-proc-arg",
+ &nreturn_vals,
+ GIMP_PDB_STRING, procedure_name,
+ GIMP_PDB_INT32, arg_num,
+ GIMP_PDB_END);
+
+ *arg_type = 0;
+ *arg_name = NULL;
+ *arg_desc = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *arg_type = return_vals[1].data.d_int32;
+ *arg_name = g_strdup (return_vals[2].data.d_string);
+ *arg_desc = g_strdup (return_vals[3].data.d_string);
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_procedural_db_proc_val:
+ * @procedure_name: The procedure name.
+ * @val_num: The return value number.
+ * @val_type: The type of return value.
+ * @val_name: The name of the return value.
+ * @val_desc: A description of the return value.
+ *
+ * Queries the procedural database for information on the specified
+ * procedure's return value.
+ *
+ * This procedure returns information on the specified procedure's
+ * return value. The return value type, name, and a description are
+ * retrieved.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_procedural_db_proc_val (const gchar *procedure_name,
+ gint val_num,
+ GimpPDBArgType *val_type,
+ gchar **val_name,
+ gchar **val_desc)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-procedural-db-proc-val",
+ &nreturn_vals,
+ GIMP_PDB_STRING, procedure_name,
+ GIMP_PDB_INT32, val_num,
+ GIMP_PDB_END);
+
+ *val_type = 0;
+ *val_name = NULL;
+ *val_desc = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *val_type = return_vals[1].data.d_int32;
+ *val_name = g_strdup (return_vals[2].data.d_string);
+ *val_desc = g_strdup (return_vals[3].data.d_string);
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_procedural_db_get_data:
+ * @identifier: The identifier associated with data.
+ * @bytes: The number of bytes in the data.
+ * @data: A byte array containing data.
+ *
+ * Returns data associated with the specified identifier.
+ *
+ * This procedure returns any data which may have been associated with
+ * the specified identifier. The data is a variable length array of
+ * bytes. If no data has been associated with the identifier, an error
+ * is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_procedural_db_get_data (const gchar *identifier,
+ gint *bytes,
+ guint8 **data)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-procedural-db-get-data",
+ &nreturn_vals,
+ GIMP_PDB_STRING, identifier,
+ GIMP_PDB_END);
+
+ *bytes = 0;
+ *data = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *bytes = return_vals[1].data.d_int32;
+ *data = g_new (guint8, *bytes);
+ memcpy (*data,
+ return_vals[2].data.d_int8array,
+ *bytes * sizeof (guint8));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_procedural_db_get_data_size:
+ * @identifier: The identifier associated with data.
+ *
+ * Returns size of data associated with the specified identifier.
+ *
+ * This procedure returns the size of any data which may have been
+ * associated with the specified identifier. If no data has been
+ * associated with the identifier, an error is returned.
+ *
+ * Returns: The number of bytes in the data.
+ **/
+gint
+gimp_procedural_db_get_data_size (const gchar *identifier)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint bytes = 0;
+
+ return_vals = gimp_run_procedure ("gimp-procedural-db-get-data-size",
+ &nreturn_vals,
+ GIMP_PDB_STRING, identifier,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ bytes = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return bytes;
+}
+
+/**
+ * _gimp_procedural_db_set_data:
+ * @identifier: The identifier associated with data.
+ * @bytes: The number of bytes in the data.
+ * @data: A byte array containing data.
+ *
+ * Associates the specified identifier with the supplied data.
+ *
+ * This procedure associates the supplied data with the provided
+ * identifier. The data may be subsequently retrieved by a call to
+ * 'procedural-db-get-data'.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_procedural_db_set_data (const gchar *identifier,
+ gint bytes,
+ const guint8 *data)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-procedural-db-set-data",
+ &nreturn_vals,
+ GIMP_PDB_STRING, identifier,
+ GIMP_PDB_INT32, bytes,
+ GIMP_PDB_INT8ARRAY, data,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpproceduraldb_pdb.h b/libgimp/gimpproceduraldb_pdb.h
new file mode 100644
index 0000000..45b4c7b
--- /dev/null
+++ b/libgimp/gimpproceduraldb_pdb.h
@@ -0,0 +1,77 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpproceduraldb_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PROCEDURAL_DB_PDB_H__
+#define __GIMP_PROCEDURAL_DB_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gchar* gimp_procedural_db_temp_name (void);
+gboolean gimp_procedural_db_dump (const gchar *filename);
+gboolean gimp_procedural_db_query (const gchar *name,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ const gchar *proc_type,
+ gint *num_matches,
+ gchar ***procedure_names);
+gboolean gimp_procedural_db_proc_exists (const gchar *procedure_name);
+G_GNUC_INTERNAL gboolean _gimp_procedural_db_proc_info (const gchar *procedure_name,
+ gchar **blurb,
+ gchar **help,
+ gchar **author,
+ gchar **copyright,
+ gchar **date,
+ GimpPDBProcType *proc_type,
+ gint *num_args,
+ gint *num_values);
+gboolean gimp_procedural_db_proc_arg (const gchar *procedure_name,
+ gint arg_num,
+ GimpPDBArgType *arg_type,
+ gchar **arg_name,
+ gchar **arg_desc);
+gboolean gimp_procedural_db_proc_val (const gchar *procedure_name,
+ gint val_num,
+ GimpPDBArgType *val_type,
+ gchar **val_name,
+ gchar **val_desc);
+G_GNUC_INTERNAL gboolean _gimp_procedural_db_get_data (const gchar *identifier,
+ gint *bytes,
+ guint8 **data);
+gint gimp_procedural_db_get_data_size (const gchar *identifier);
+G_GNUC_INTERNAL gboolean _gimp_procedural_db_set_data (const gchar *identifier,
+ gint bytes,
+ const guint8 *data);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PROCEDURAL_DB_PDB_H__ */
diff --git a/libgimp/gimpprocview.c b/libgimp/gimpprocview.c
new file mode 100644
index 0000000..fab2e6b
--- /dev/null
+++ b/libgimp/gimpprocview.c
@@ -0,0 +1,339 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpprocview.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/*
+ * dbbrowser_utils.c
+ * 0.08 26th sept 97 by Thomas NOEL <thomas@minet.net>
+ *
+ * 98/12/13 Sven Neumann <sven@gimp.org> : added help display
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimpprocview.h"
+
+#include "libgimp-intl.h"
+
+
+/**
+ * SECTION: gimpprocview
+ * @title: GimpProcView
+ * @short_description: A widget showing information about a PDB procedure.
+ *
+ * A widget showing information about a PDB procedure, mainly for the
+ * procedure and plug-in browsers.
+ **/
+
+
+/* local function prototypes */
+
+static GtkWidget * gimp_proc_view_create_params (const GimpParamDef *params,
+ gint n_params,
+ GtkSizeGroup *name_group,
+ GtkSizeGroup *type_group,
+ GtkSizeGroup *desc_group);
+
+
+/* public functions */
+
+
+/**
+ * gimp_proc_view_new:
+ * @name:
+ * @menu_path:
+ * @blurb:
+ * @help:
+ * @author:
+ * @copyright:
+ * @date:
+ * @type:
+ * @n_params:
+ * @n_return_vals:
+ * @params:
+ * @return_vals:
+ *
+ * Return value: a new widget providing a view on a GIMP procedure
+ *
+ * Since: 2.4
+ **/
+GtkWidget *
+gimp_proc_view_new (const gchar *name,
+ const gchar *menu_path,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ GimpPDBProcType type,
+ gint n_params,
+ gint n_return_vals,
+ const GimpParamDef *params,
+ const GimpParamDef *return_vals)
+{
+ GtkWidget *main_vbox;
+ GtkWidget *frame;
+ GtkWidget *vbox;
+ GtkWidget *table;
+ GtkWidget *label;
+ GtkSizeGroup *name_group;
+ GtkSizeGroup *type_group;
+ GtkSizeGroup *desc_group;
+ const gchar *type_str;
+ gint row;
+
+ if (blurb && strlen (blurb) < 2) blurb = NULL;
+ if (help && strlen (help) < 2) help = NULL;
+ if (author && strlen (author) < 2) author = NULL;
+ if (date && strlen (date) < 2) date = NULL;
+ if (copyright && strlen (copyright) < 2) copyright = NULL;
+
+ if (blurb && help && ! strcmp (blurb, help))
+ help = NULL;
+
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
+ /* show the name */
+
+ frame = gimp_frame_new (name);
+ label = gtk_frame_get_label_widget (GTK_FRAME (frame));
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+ gtk_widget_show (vbox);
+
+ if (! gimp_enum_get_value (GIMP_TYPE_PDB_PROC_TYPE, type,
+ NULL, NULL, &type_str, NULL))
+ type_str = "UNKNOWN";
+
+ label = gtk_label_new (type_str);
+ gimp_label_set_attributes (GTK_LABEL (label),
+ PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
+ -1);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ if (menu_path)
+ {
+ label = gtk_label_new_with_mnemonic (menu_path);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+ }
+
+ if (blurb)
+ {
+ label = gtk_label_new (blurb);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+ }
+
+ name_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ type_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ desc_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+
+ /* in parameters */
+ if (n_params)
+ {
+ frame = gimp_frame_new (_("Parameters"));
+ gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ table = gimp_proc_view_create_params (params, n_params,
+ name_group, type_group, desc_group);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+ }
+
+ /* out parameters */
+ if (n_return_vals)
+ {
+ frame = gimp_frame_new (_("Return Values"));
+ gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ table = gimp_proc_view_create_params (return_vals, n_return_vals,
+ name_group, type_group, desc_group);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+ }
+
+ if (! help && ! author && ! date && ! copyright)
+ return main_vbox;
+
+ frame = gimp_frame_new (_("Additional Information"));
+ gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
+ gtk_widget_show (frame);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+ gtk_widget_show (vbox);
+
+ /* show the help */
+ if (help)
+ {
+ label = gtk_label_new (help);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+ }
+
+ /* show the author & the copyright */
+
+ if (! author && ! date && ! copyright)
+ return main_vbox;
+
+ table = gtk_table_new (0, 2, FALSE);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 6);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 4);
+ gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+ gtk_widget_show (table);
+
+ row = 0;
+
+ if (author)
+ {
+ label = gtk_label_new (author);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+
+ gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
+ _("Author:"), 0.0, 0.0,
+ label, 3, FALSE);
+ }
+
+ if (date)
+ {
+ label = gtk_label_new (date);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+
+ gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
+ _("Date:"), 0.0, 0.0,
+ label, 3, FALSE);
+ }
+
+ if (copyright)
+ {
+ label = gtk_label_new (copyright);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+
+ gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
+ _("Copyright:"), 0.0, 0.0,
+ label, 3, FALSE);
+ }
+
+ return main_vbox;
+}
+
+
+/* private functions */
+
+static GtkWidget *
+gimp_proc_view_create_params (const GimpParamDef *params,
+ gint n_params,
+ GtkSizeGroup *name_group,
+ GtkSizeGroup *type_group,
+ GtkSizeGroup *desc_group)
+{
+ GtkWidget *table;
+ gint i;
+
+ table = gtk_table_new (n_params, 3, FALSE);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 6);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 4);
+
+ for (i = 0; i < n_params; i++)
+ {
+ GtkWidget *label;
+ const gchar *type;
+ gchar *upper;
+
+ /* name */
+ label = gtk_label_new (params[i].name);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 0.0);
+ gtk_size_group_add_widget (name_group, label);
+ gtk_table_attach (GTK_TABLE (table), label,
+ 0, 1, i, i + 1, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ /* type */
+ if (! gimp_enum_get_value (GIMP_TYPE_PDB_ARG_TYPE, params[i].type,
+ NULL, &type, NULL, NULL))
+ upper = g_strdup ("UNKNOWN");
+ else
+ upper = g_ascii_strup (type, -1);
+
+ label = gtk_label_new (upper);
+ g_free (upper);
+
+ gimp_label_set_attributes (GTK_LABEL (label),
+ PANGO_ATTR_FAMILY, "monospace",
+ PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
+ -1);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 0.0);
+ gtk_size_group_add_widget (type_group, label);
+ gtk_table_attach (GTK_TABLE (table), label,
+ 1, 2, i, i + 1, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+
+ /* description */
+ label = gtk_label_new (params[i].description);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (label), 0.0);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_size_group_add_widget (desc_group, label);
+ gtk_table_attach (GTK_TABLE (table), label,
+ 2, 3, i, i + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (label);
+ }
+
+ return table;
+}
diff --git a/libgimp/gimpprocview.h b/libgimp/gimpprocview.h
new file mode 100644
index 0000000..7499297
--- /dev/null
+++ b/libgimp/gimpprocview.h
@@ -0,0 +1,50 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpprocview.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PROC_VIEW_H__
+#define __GIMP_PROC_VIEW_H__
+
+G_BEGIN_DECLS
+
+
+/* For information look into the C source or the html documentation */
+
+
+GtkWidget * gimp_proc_view_new (const gchar *name,
+ const gchar *menu_path,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ GimpPDBProcType type,
+ gint n_params,
+ gint n_return_vals,
+ const GimpParamDef *params,
+ const GimpParamDef *return_vals);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PROC_VIEW_H__ */
diff --git a/libgimp/gimpprogress.c b/libgimp/gimpprogress.c
new file mode 100644
index 0000000..58846c4
--- /dev/null
+++ b/libgimp/gimpprogress.c
@@ -0,0 +1,452 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpprogress.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gio/gio.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#undef GIMP_DISABLE_DEPRECATED
+#include "gimpprogress.h"
+#define GIMP_DISABLE_DEPRECATED
+
+#include "gimp.h"
+
+
+typedef struct
+{
+ gchar *progress_callback;
+ GimpProgressVtable vtable;
+ gpointer data;
+} GimpProgressData;
+
+
+/* local function prototypes */
+
+static void gimp_progress_data_free (GimpProgressData *data);
+
+static void gimp_temp_progress_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals);
+
+
+/* private variables */
+
+static GHashTable * gimp_progress_ht = NULL;
+static gdouble gimp_progress_current = 0.0;
+static const gdouble gimp_progress_step = (1.0 / 256.0);
+
+
+/* public functions */
+
+/**
+ * gimp_progress_install:
+ * @start_callback: the function to call when progress starts
+ * @end_callback: the function to call when progress finishes
+ * @text_callback: the function to call to change the text
+ * @value_callback: the function to call to change the value
+ * @user_data: a pointer that is returned when uninstalling the progress
+ *
+ * Note that since GIMP 2.4, @value_callback can be called with
+ * negative values. This is triggered by calls to gimp_progress_pulse().
+ * The callback should then implement a progress indicating business,
+ * e.g. by calling gtk_progress_bar_pulse().
+ *
+ * Return value: the name of the temporary procedure that's been installed
+ *
+ * Since: 2.2
+ **/
+const gchar *
+gimp_progress_install (GimpProgressStartCallback start_callback,
+ GimpProgressEndCallback end_callback,
+ GimpProgressTextCallback text_callback,
+ GimpProgressValueCallback value_callback,
+ gpointer user_data)
+{
+ GimpProgressVtable vtable = { 0, };
+
+ g_return_val_if_fail (start_callback != NULL, NULL);
+ g_return_val_if_fail (end_callback != NULL, NULL);
+ g_return_val_if_fail (text_callback != NULL, NULL);
+ g_return_val_if_fail (value_callback != NULL, NULL);
+
+ vtable.start = start_callback;
+ vtable.end = end_callback;
+ vtable.set_text = text_callback;
+ vtable.set_value = value_callback;
+
+ return gimp_progress_install_vtable (&vtable, user_data);
+}
+
+/**
+ * gimp_progress_install_vtable:
+ * @vtable: a pointer to a @GimpProgressVtable.
+ * @user_data: a pointer that is passed as user_data to all vtable functions.
+ *
+ * Return value: the name of the temporary procedure that's been installed
+ *
+ * Since: 2.4
+ **/
+const gchar *
+gimp_progress_install_vtable (const GimpProgressVtable *vtable,
+ gpointer user_data)
+{
+ static const GimpParamDef args[] =
+ {
+ { GIMP_PDB_INT32, "command", "" },
+ { GIMP_PDB_STRING, "text", "" },
+ { GIMP_PDB_FLOAT, "value", "" }
+ };
+
+ static const GimpParamDef values[] =
+ {
+ { GIMP_PDB_FLOAT, "value", "" }
+ };
+
+ gchar *progress_callback;
+
+ g_return_val_if_fail (vtable != NULL, NULL);
+ g_return_val_if_fail (vtable->start != NULL, NULL);
+ g_return_val_if_fail (vtable->end != NULL, NULL);
+ g_return_val_if_fail (vtable->set_text != NULL, NULL);
+ g_return_val_if_fail (vtable->set_value != NULL, NULL);
+
+ progress_callback = gimp_procedural_db_temp_name ();
+
+ gimp_install_temp_proc (progress_callback,
+ "Temporary progress callback procedure",
+ "",
+ "",
+ "",
+ "",
+ NULL,
+ "",
+ GIMP_TEMPORARY,
+ G_N_ELEMENTS (args), G_N_ELEMENTS (values),
+ args, values,
+ gimp_temp_progress_run);
+
+ if (_gimp_progress_install (progress_callback))
+ {
+ GimpProgressData *progress_data;
+
+ gimp_extension_enable (); /* Allow callbacks to be watched */
+
+ /* Now add to hash table so we can find it again */
+ if (! gimp_progress_ht)
+ {
+ gimp_progress_ht =
+ g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free,
+ (GDestroyNotify) gimp_progress_data_free);
+ }
+
+ progress_data = g_slice_new0 (GimpProgressData);
+
+ progress_data->progress_callback = progress_callback;
+ progress_data->vtable.start = vtable->start;
+ progress_data->vtable.end = vtable->end;
+ progress_data->vtable.set_text = vtable->set_text;
+ progress_data->vtable.set_value = vtable->set_value;
+ progress_data->vtable.pulse = vtable->pulse;
+ progress_data->vtable.get_window = vtable->get_window;
+ progress_data->data = user_data;
+
+ g_hash_table_insert (gimp_progress_ht, progress_callback, progress_data);
+
+ return progress_callback;
+ }
+
+ gimp_uninstall_temp_proc (progress_callback);
+ g_free (progress_callback);
+
+ return NULL;
+}
+
+/**
+ * gimp_progress_uninstall:
+ * @progress_callback: the name of the temporary procedure to uninstall
+ *
+ * Uninstalls a temporary progress procedure that was installed using
+ * gimp_progress_install().
+ *
+ * Return value: the @user_data that was passed to gimp_progress_install().
+ *
+ * Since: 2.2
+ **/
+gpointer
+gimp_progress_uninstall (const gchar *progress_callback)
+{
+ GimpProgressData *progress_data;
+ gpointer user_data;
+
+ g_return_val_if_fail (progress_callback != NULL, NULL);
+ g_return_val_if_fail (gimp_progress_ht != NULL, NULL);
+
+ progress_data = g_hash_table_lookup (gimp_progress_ht, progress_callback);
+
+ if (! progress_data)
+ {
+ g_warning ("Can't find internal progress data");
+ return NULL;
+ }
+
+ _gimp_progress_uninstall (progress_callback);
+ gimp_uninstall_temp_proc (progress_callback);
+
+ user_data = progress_data->data;
+
+ g_hash_table_remove (gimp_progress_ht, progress_callback);
+
+ return user_data;
+}
+
+
+/**
+ * gimp_progress_init:
+ * @message: Message to use in the progress dialog.
+ *
+ * Initializes the progress bar for the current plug-in.
+ *
+ * Initializes the progress bar for the current plug-in. It is only
+ * valid to call this procedure from a plug-in.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_progress_init (const gchar *message)
+{
+ gimp_progress_current = 0.0;
+
+ return _gimp_progress_init (message, gimp_default_display ());
+}
+
+/**
+ * gimp_progress_init_printf:
+ * @format: a standard printf() format string
+ * @...: arguments for @format
+ *
+ * Initializes the progress bar for the current plug-in.
+ *
+ * Initializes the progress bar for the current plug-in. It is only
+ * valid to call this procedure from a plug-in.
+ *
+ * Returns: %TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_progress_init_printf (const gchar *format,
+ ...)
+{
+ gchar *text;
+ gboolean retval;
+ va_list args;
+
+ g_return_val_if_fail (format != NULL, FALSE);
+
+ va_start (args, format);
+ text = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ retval = gimp_progress_init (text);
+
+ g_free (text);
+
+ return retval;
+}
+
+/**
+ * gimp_progress_set_text_printf:
+ * @format: a standard printf() format string
+ * @...: arguments for @format
+ *
+ * Changes the text in the progress bar for the current plug-in.
+ *
+ * This function changes the text in the progress bar for the current
+ * plug-in. Unlike gimp_progress_init() it does not change the
+ * displayed value.
+ *
+ * Returns: %TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_progress_set_text_printf (const gchar *format,
+ ...)
+{
+ gchar *text;
+ gboolean retval;
+ va_list args;
+
+ g_return_val_if_fail (format != NULL, FALSE);
+
+ va_start (args, format);
+ text = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ retval = gimp_progress_set_text (text);
+
+ g_free (text);
+
+ return retval;
+}
+
+/**
+ * gimp_progress_update:
+ * @percentage: Percentage of progress completed (in the range from 0.0 to 1.0).
+ *
+ * Updates the progress bar for the current plug-in.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_progress_update (gdouble percentage)
+{
+ gboolean changed;
+
+ if (percentage <= 0.0)
+ {
+ changed = (gimp_progress_current != 0.0);
+ percentage = 0.0;
+ }
+ else if (percentage >= 1.0)
+ {
+ changed = (gimp_progress_current != 1.0);
+ percentage = 1.0;
+ }
+ else
+ {
+ changed =
+ (fabs (gimp_progress_current - percentage) > gimp_progress_step);
+
+#ifdef GIMP_UNSTABLE
+ if (! changed)
+ {
+ static gboolean warned = FALSE;
+ static gint count = 0;
+
+ count++;
+
+ if (count > 3 && ! warned)
+ {
+ g_printerr ("%s is updating the progress too often\n",
+ g_get_prgname ());
+ warned = TRUE;
+ }
+ }
+#endif
+ }
+
+ /* Suppress the update if the change was only marginal. */
+ if (! changed)
+ return TRUE;
+
+ gimp_progress_current = percentage;
+
+ return _gimp_progress_update (gimp_progress_current);
+}
+
+
+/* private functions */
+
+static void
+gimp_progress_data_free (GimpProgressData *data)
+{
+ g_slice_free (GimpProgressData, data);
+}
+
+static void
+gimp_temp_progress_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals)
+{
+ static GimpParam values[2];
+ GimpProgressData *progress_data;
+
+ *nreturn_vals = 1;
+ *return_vals = values;
+
+ values[0].type = GIMP_PDB_STATUS;
+ values[0].data.d_status = GIMP_PDB_SUCCESS;
+
+ progress_data = g_hash_table_lookup (gimp_progress_ht, name);
+
+ if (! progress_data)
+ {
+ g_warning ("Can't find internal progress data");
+
+ values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
+ }
+ else
+ {
+ GimpProgressCommand command = param[0].data.d_int32;
+
+ switch (command)
+ {
+ case GIMP_PROGRESS_COMMAND_START:
+ progress_data->vtable.start (param[1].data.d_string,
+ param[2].data.d_float != 0.0,
+ progress_data->data);
+ break;
+
+ case GIMP_PROGRESS_COMMAND_END:
+ progress_data->vtable.end (progress_data->data);
+ break;
+
+ case GIMP_PROGRESS_COMMAND_SET_TEXT:
+ progress_data->vtable.set_text (param[1].data.d_string,
+ progress_data->data);
+ break;
+
+ case GIMP_PROGRESS_COMMAND_SET_VALUE:
+ progress_data->vtable.set_value (param[2].data.d_float,
+ progress_data->data);
+ break;
+
+ case GIMP_PROGRESS_COMMAND_PULSE:
+ if (progress_data->vtable.pulse)
+ progress_data->vtable.pulse (progress_data->data);
+ else
+ progress_data->vtable.set_value (-1, progress_data->data);
+ break;
+
+ case GIMP_PROGRESS_COMMAND_GET_WINDOW:
+ *nreturn_vals = 2;
+ values[1].type = GIMP_PDB_FLOAT;
+
+ if (progress_data->vtable.get_window)
+ values[1].data.d_float =
+ (gdouble) progress_data->vtable.get_window (progress_data->data);
+ else
+ values[1].data.d_float = 0;
+ break;
+
+ default:
+ values[0].data.d_status = GIMP_PDB_CALLING_ERROR;
+ break;
+ }
+ }
+}
diff --git a/libgimp/gimpprogress.h b/libgimp/gimpprogress.h
new file mode 100644
index 0000000..3808f05
--- /dev/null
+++ b/libgimp/gimpprogress.h
@@ -0,0 +1,94 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpprogress.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PROGRESS_H__
+#define __GIMP_PROGRESS_H__
+
+G_BEGIN_DECLS
+
+
+typedef struct _GimpProgressVtable GimpProgressVtable;
+
+struct _GimpProgressVtable
+{
+ void (* start) (const gchar *message,
+ gboolean cancelable,
+ gpointer user_data);
+ void (* end) (gpointer user_data);
+ void (* set_text) (const gchar *message,
+ gpointer user_data);
+ void (* set_value) (gdouble percentage,
+ gpointer user_data);
+ void (* pulse) (gpointer user_data);
+
+ guint32 (* get_window) (gpointer user_data);
+
+ /* Padding for future expansion. Must be initialized with NULL! */
+ void (* _gimp_reserved1) (void);
+ void (* _gimp_reserved2) (void);
+ void (* _gimp_reserved3) (void);
+ void (* _gimp_reserved4) (void);
+ void (* _gimp_reserved5) (void);
+ void (* _gimp_reserved6) (void);
+ void (* _gimp_reserved7) (void);
+ void (* _gimp_reserved8) (void);
+};
+
+
+const gchar * gimp_progress_install_vtable (const GimpProgressVtable *vtable,
+ gpointer user_data);
+gpointer gimp_progress_uninstall (const gchar *progress_callback);
+
+gboolean gimp_progress_init (const gchar *message);
+gboolean gimp_progress_init_printf (const gchar *format,
+ ...) G_GNUC_PRINTF (1, 2);
+
+gboolean gimp_progress_set_text_printf (const gchar *format,
+ ...) G_GNUC_PRINTF (1, 2);
+
+gboolean gimp_progress_update (gdouble percentage);
+
+
+#ifndef GIMP_DISABLE_DEPRECATED
+typedef void (* GimpProgressStartCallback) (const gchar *message,
+ gboolean cancelable,
+ gpointer user_data);
+typedef void (* GimpProgressEndCallback) (gpointer user_data);
+typedef void (* GimpProgressTextCallback) (const gchar *message,
+ gpointer user_data);
+typedef void (* GimpProgressValueCallback) (gdouble percentage,
+ gpointer user_data);
+
+GIMP_DEPRECATED_FOR(gimp_progress_install_vtable)
+const gchar * gimp_progress_install (GimpProgressStartCallback start_callback,
+ GimpProgressEndCallback end_callback,
+ GimpProgressTextCallback text_callback,
+ GimpProgressValueCallback value_callback,
+ gpointer user_data);
+#endif /* GIMP_DISABLE_DEPRECATED */
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PROGRESS_H__ */
diff --git a/libgimp/gimpprogress_pdb.c b/libgimp/gimpprogress_pdb.c
new file mode 100644
index 0000000..a35df17
--- /dev/null
+++ b/libgimp/gimpprogress_pdb.c
@@ -0,0 +1,324 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpprogress_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpprogress
+ * @title: gimpprogress
+ * @short_description: Functions for embedding the progress bar into a plug-in's GUI.
+ *
+ * Functions for embedding the progress bar into a plug-in's GUI.
+ **/
+
+
+/**
+ * _gimp_progress_init:
+ * @message: Message to use in the progress dialog.
+ * @gdisplay_ID: GimpDisplay to update progressbar in, or -1 for a separate window.
+ *
+ * Initializes the progress bar for the current plug-in.
+ *
+ * Initializes the progress bar for the current plug-in. It is only
+ * valid to call this procedure from a plug-in.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_progress_init (const gchar *message,
+ gint32 gdisplay_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-progress-init",
+ &nreturn_vals,
+ GIMP_PDB_STRING, message,
+ GIMP_PDB_DISPLAY, gdisplay_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_progress_update:
+ * @percentage: Percentage of progress completed which must be between 0.0 and 1.0.
+ *
+ * Updates the progress bar for the current plug-in.
+ *
+ * Updates the progress bar for the current plug-in. It is only valid
+ * to call this procedure from a plug-in.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_progress_update (gdouble percentage)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-progress-update",
+ &nreturn_vals,
+ GIMP_PDB_FLOAT, percentage,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_progress_pulse:
+ *
+ * Pulses the progress bar for the current plug-in.
+ *
+ * Updates the progress bar for the current plug-in. It is only valid
+ * to call this procedure from a plug-in. Use this function instead of
+ * gimp_progress_update() if you cannot tell how much progress has been
+ * made. This usually causes the the progress bar to enter \"activity
+ * mode\", where a block bounces back and forth.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_progress_pulse (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-progress-pulse",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_progress_set_text:
+ * @message: Message to use in the progress dialog.
+ *
+ * Changes the text in the progress bar for the current plug-in.
+ *
+ * This function changes the text in the progress bar for the current
+ * plug-in. Unlike gimp_progress_init() it does not change the
+ * displayed value.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_progress_set_text (const gchar *message)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-progress-set-text",
+ &nreturn_vals,
+ GIMP_PDB_STRING, message,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_progress_end:
+ *
+ * Ends the progress bar for the current plug-in.
+ *
+ * Ends the progress display for the current plug-in. Most plug-ins
+ * don't need to call this, they just exit when the work is done. It is
+ * only valid to call this procedure from a plug-in.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_progress_end (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-progress-end",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_progress_get_window_handle:
+ *
+ * Returns the native window ID of the toplevel window this plug-in's
+ * progress is displayed in.
+ *
+ * This function returns the native window ID of the toplevel window
+ * this plug-in\'s progress is displayed in.
+ *
+ * Returns: The progress bar's toplevel window.
+ *
+ * Since: 2.2
+ **/
+gint
+gimp_progress_get_window_handle (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint window = 0;
+
+ return_vals = gimp_run_procedure ("gimp-progress-get-window-handle",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ window = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return window;
+}
+
+/**
+ * _gimp_progress_install:
+ * @progress_callback: The callback PDB proc to call.
+ *
+ * Installs a progress callback for the current plug-in.
+ *
+ * This function installs a temporary PDB procedure which will handle
+ * all progress calls made by this plug-in and any procedure it calls.
+ * Calling this function multiple times simply replaces the old
+ * progress callbacks.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+_gimp_progress_install (const gchar *progress_callback)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-progress-install",
+ &nreturn_vals,
+ GIMP_PDB_STRING, progress_callback,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_progress_uninstall:
+ * @progress_callback: The name of the callback registered for this progress.
+ *
+ * Uninstalls the progress callback for the current plug-in.
+ *
+ * This function uninstalls any progress callback installed with
+ * gimp_progress_install() before.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+_gimp_progress_uninstall (const gchar *progress_callback)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-progress-uninstall",
+ &nreturn_vals,
+ GIMP_PDB_STRING, progress_callback,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_progress_cancel:
+ * @progress_callback: The name of the callback registered for this progress.
+ *
+ * Cancels a running progress.
+ *
+ * This function cancels the currently running progress.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_progress_cancel (const gchar *progress_callback)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-progress-cancel",
+ &nreturn_vals,
+ GIMP_PDB_STRING, progress_callback,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpprogress_pdb.h b/libgimp/gimpprogress_pdb.h
new file mode 100644
index 0000000..010533a
--- /dev/null
+++ b/libgimp/gimpprogress_pdb.h
@@ -0,0 +1,49 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpprogress_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PROGRESS_PDB_H__
+#define __GIMP_PROGRESS_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+G_GNUC_INTERNAL gboolean _gimp_progress_init (const gchar *message,
+ gint32 gdisplay_ID);
+G_GNUC_INTERNAL gboolean _gimp_progress_update (gdouble percentage);
+gboolean gimp_progress_pulse (void);
+gboolean gimp_progress_set_text (const gchar *message);
+gboolean gimp_progress_end (void);
+gint gimp_progress_get_window_handle (void);
+G_GNUC_INTERNAL gboolean _gimp_progress_install (const gchar *progress_callback);
+G_GNUC_INTERNAL gboolean _gimp_progress_uninstall (const gchar *progress_callback);
+gboolean gimp_progress_cancel (const gchar *progress_callback);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PROGRESS_PDB_H__ */
diff --git a/libgimp/gimpprogressbar.c b/libgimp/gimpprogressbar.c
new file mode 100644
index 0000000..f989d2a
--- /dev/null
+++ b/libgimp/gimpprogressbar.c
@@ -0,0 +1,230 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpprogressbar.c
+ * Copyright (C) 2004 Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#ifdef GDK_WINDOWING_WIN32
+#include <gdk/gdkwin32.h>
+#endif
+
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#endif
+
+#include "gimpuitypes.h"
+
+#include "gimp.h"
+
+#include "gimpprogressbar.h"
+
+
+/**
+ * SECTION: gimpprogressbar
+ * @title: GimpProgressBar
+ * @short_description: A widget providing a progress bar.
+ *
+ * A widget providing a progress bar that automatically redirects any
+ * progress calls to itself.
+ **/
+
+
+static void gimp_progress_bar_dispose (GObject *object);
+
+static void gimp_progress_bar_start (const gchar *message,
+ gboolean cancelable,
+ gpointer user_data);
+static void gimp_progress_bar_end (gpointer user_data);
+static void gimp_progress_bar_set_text (const gchar *message,
+ gpointer user_data);
+static void gimp_progress_bar_set_value (gdouble percentage,
+ gpointer user_data);
+static void gimp_progress_bar_pulse (gpointer user_data);
+static guint32 gimp_progress_bar_get_window (gpointer user_data);
+
+
+G_DEFINE_TYPE (GimpProgressBar, gimp_progress_bar, GTK_TYPE_PROGRESS_BAR)
+
+#define parent_class gimp_progress_bar_parent_class
+
+
+static void
+gimp_progress_bar_class_init (GimpProgressBarClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->dispose = gimp_progress_bar_dispose;
+}
+
+static void
+gimp_progress_bar_init (GimpProgressBar *bar)
+{
+ GimpProgressVtable vtable = { 0, };
+
+ gtk_progress_bar_set_text (GTK_PROGRESS_BAR (bar), " ");
+ gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR (bar), PANGO_ELLIPSIZE_END);
+
+ vtable.start = gimp_progress_bar_start;
+ vtable.end = gimp_progress_bar_end;
+ vtable.set_text = gimp_progress_bar_set_text;
+ vtable.set_value = gimp_progress_bar_set_value;
+ vtable.pulse = gimp_progress_bar_pulse;
+ vtable.get_window = gimp_progress_bar_get_window;
+
+ bar->progress_callback = gimp_progress_install_vtable (&vtable, bar);
+}
+
+static void
+gimp_progress_bar_dispose (GObject *object)
+{
+ GimpProgressBar *bar = GIMP_PROGRESS_BAR (object);
+
+ if (bar->progress_callback)
+ {
+ gimp_progress_uninstall (bar->progress_callback);
+ bar->progress_callback = NULL;
+ }
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+gimp_progress_bar_start (const gchar *message,
+ gboolean cancelable,
+ gpointer user_data)
+{
+ GimpProgressBar *bar = GIMP_PROGRESS_BAR (user_data);
+
+ gtk_progress_bar_set_text (GTK_PROGRESS_BAR (bar), message ? message : " ");
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), 0.0);
+
+ if (gtk_widget_is_drawable (GTK_WIDGET (bar)))
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+}
+
+static void
+gimp_progress_bar_end (gpointer user_data)
+{
+ GimpProgressBar *bar = GIMP_PROGRESS_BAR (user_data);
+
+ gtk_progress_bar_set_text (GTK_PROGRESS_BAR (bar), " ");
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), 0.0);
+
+ if (gtk_widget_is_drawable (GTK_WIDGET (bar)))
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+}
+
+static void
+gimp_progress_bar_set_text (const gchar *message,
+ gpointer user_data)
+{
+ GimpProgressBar *bar = GIMP_PROGRESS_BAR (user_data);
+
+ gtk_progress_bar_set_text (GTK_PROGRESS_BAR (bar), message ? message : " ");
+
+ if (gtk_widget_is_drawable (GTK_WIDGET (bar)))
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+}
+
+static void
+gimp_progress_bar_set_value (gdouble percentage,
+ gpointer user_data)
+{
+ GimpProgressBar *bar = GIMP_PROGRESS_BAR (user_data);
+
+ if (percentage >= 0.0)
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), percentage);
+ else
+ gtk_progress_bar_pulse (GTK_PROGRESS_BAR (bar));
+
+ if (gtk_widget_is_drawable (GTK_WIDGET (bar)))
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+}
+
+static void
+gimp_progress_bar_pulse (gpointer user_data)
+{
+ GimpProgressBar *bar = GIMP_PROGRESS_BAR (user_data);
+
+ gtk_progress_bar_pulse (GTK_PROGRESS_BAR (bar));
+
+ if (gtk_widget_is_drawable (GTK_WIDGET (bar)))
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+}
+
+static guint32
+gimp_window_get_native_id (GtkWindow *window)
+{
+ g_return_val_if_fail (GTK_IS_WINDOW (window), 0);
+
+#ifdef GDK_NATIVE_WINDOW_POINTER
+#ifdef __GNUC__
+#warning gimp_window_get_native() unimplementable for the target windowing system
+#endif
+#endif
+
+#ifdef GDK_WINDOWING_WIN32
+ if (window && gtk_widget_get_realized (GTK_WIDGET (window)))
+ return GDK_WINDOW_HWND (gtk_widget_get_window (GTK_WIDGET (window)));
+#endif
+
+#ifdef GDK_WINDOWING_X11
+ if (window && gtk_widget_get_realized (GTK_WIDGET (window)))
+ return GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (window)));
+#endif
+
+ return 0;
+}
+
+static guint32
+gimp_progress_bar_get_window (gpointer user_data)
+{
+ GimpProgressBar *bar = GIMP_PROGRESS_BAR (user_data);
+ GtkWidget *toplevel;
+
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (bar));
+
+ if (GTK_IS_WINDOW (toplevel))
+ return gimp_window_get_native_id (GTK_WINDOW (toplevel));
+
+ return 0;
+}
+
+/**
+ * gimp_progress_bar_new:
+ *
+ * Creates a new #GimpProgressBar widget.
+ *
+ * Return value: the new widget.
+ *
+ * Since: 2.2
+ **/
+GtkWidget *
+gimp_progress_bar_new (void)
+{
+ return g_object_new (GIMP_TYPE_PROGRESS_BAR, NULL);
+}
diff --git a/libgimp/gimpprogressbar.h b/libgimp/gimpprogressbar.h
new file mode 100644
index 0000000..3af45f2
--- /dev/null
+++ b/libgimp/gimpprogressbar.h
@@ -0,0 +1,69 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpprogressbar.h
+ * Copyright (C) 2004 Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_PROGRESS_BAR_H__
+#define __GIMP_PROGRESS_BAR_H__
+
+G_BEGIN_DECLS
+
+
+#define GIMP_TYPE_PROGRESS_BAR (gimp_progress_bar_get_type ())
+#define GIMP_PROGRESS_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PROGRESS_BAR, GimpProgressBar))
+#define GIMP_PROGRESS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PROGRESS_BAR, GimpProgressBarClass))
+#define GIMP_IS_PROGRESS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PROGRESS_BAR))
+#define GIMP_IS_PROGRESS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PROGRESS_BAR))
+#define GIMP_PROGRESS_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PROGRESS_BAR, GimpProgressBarClass))
+
+
+typedef struct _GimpProgressBarClass GimpProgressBarClass;
+
+struct _GimpProgressBar
+{
+ GtkProgressBar parent_instance;
+
+ const gchar *progress_callback;
+ gboolean cancelable;
+};
+
+struct _GimpProgressBarClass
+{
+ GtkProgressBarClass parent_class;
+
+ /* Padding for future expansion */
+ void (* _gimp_reserved1) (void);
+ void (* _gimp_reserved2) (void);
+ void (* _gimp_reserved3) (void);
+ void (* _gimp_reserved4) (void);
+};
+
+
+GType gimp_progress_bar_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_progress_bar_new (void);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_PROGRESS_BAR_H__ */
diff --git a/libgimp/gimpregioniterator.c b/libgimp/gimpregioniterator.c
new file mode 100644
index 0000000..ad866c5
--- /dev/null
+++ b/libgimp/gimpregioniterator.c
@@ -0,0 +1,397 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpregioniterator.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+
+#define GIMP_DISABLE_DEPRECATION_WARNINGS
+
+#include "gimp.h"
+#include "gimpregioniterator.h"
+
+
+/**
+ * SECTION: gimpregioniterator
+ * @title: gimpregioniterator
+ * @short_description: Functions to traverse a pixel regions.
+ *
+ * The GimpRgnIterator functions provide a variety of common ways to
+ * traverse a PixelRegion, using a pre-defined function pointer per
+ * pixel.
+ **/
+
+
+struct _GimpRgnIterator
+{
+ GimpDrawable *drawable;
+ gint x1;
+ gint y1;
+ gint x2;
+ gint y2;
+};
+
+
+static void gimp_rgn_iterator_iter_single (GimpRgnIterator *iter,
+ GimpPixelRgn *srcPR,
+ GimpRgnFuncSrc func,
+ gpointer data);
+static void gimp_rgn_render_row (const guchar *src,
+ guchar *dest,
+ gint col,
+ gint bpp,
+ GimpRgnFunc2 func,
+ gpointer data);
+static void gimp_rgn_render_region (const GimpPixelRgn *srcPR,
+ const GimpPixelRgn *destPR,
+ GimpRgnFunc2 func,
+ gpointer data);
+
+
+/**
+ * gimp_rgn_iterator_new:
+ * @drawable: a #GimpDrawable
+ * @unused: ignored
+ *
+ * Creates a new #GimpRgnIterator for @drawable. The #GimpRunMode
+ * parameter is ignored. Use gimp_rgn_iterator_free() to free this
+ * iterator.
+ *
+ * Return value: a newly allocated #GimpRgnIterator.
+ **/
+GimpRgnIterator *
+gimp_rgn_iterator_new (GimpDrawable *drawable,
+ GimpRunMode unused)
+{
+ GimpRgnIterator *iter;
+
+ g_return_val_if_fail (drawable != NULL, NULL);
+
+ iter = g_slice_new (GimpRgnIterator);
+
+ iter->drawable = drawable;
+
+ gimp_drawable_mask_bounds (drawable->drawable_id,
+ &iter->x1, &iter->y1,
+ &iter->x2, &iter->y2);
+
+ return iter;
+}
+
+/**
+ * gimp_rgn_iterator_free:
+ * @iter: a #GimpRgnIterator
+ *
+ * Frees the resources allocated for @iter.
+ **/
+void
+gimp_rgn_iterator_free (GimpRgnIterator *iter)
+{
+ g_return_if_fail (iter != NULL);
+
+ g_slice_free (GimpRgnIterator, iter);
+}
+
+void
+gimp_rgn_iterator_src (GimpRgnIterator *iter,
+ GimpRgnFuncSrc func,
+ gpointer data)
+{
+ GimpPixelRgn srcPR;
+
+ g_return_if_fail (iter != NULL);
+
+ gimp_pixel_rgn_init (&srcPR, iter->drawable,
+ iter->x1, iter->y1,
+ iter->x2 - iter->x1, iter->y2 - iter->y1,
+ FALSE, FALSE);
+ gimp_rgn_iterator_iter_single (iter, &srcPR, func, data);
+}
+
+void
+gimp_rgn_iterator_src_dest (GimpRgnIterator *iter,
+ GimpRgnFuncSrcDest func,
+ gpointer data)
+{
+ GimpPixelRgn srcPR, destPR;
+ gint x1, y1, x2, y2;
+ gint bpp;
+ gint count;
+ gpointer pr;
+ gint total_area;
+ gint area_so_far;
+
+ g_return_if_fail (iter != NULL);
+
+ x1 = iter->x1;
+ y1 = iter->y1;
+ x2 = iter->x2;
+ y2 = iter->y2;
+
+ total_area = (x2 - x1) * (y2 - y1);
+ area_so_far = 0;
+
+ gimp_pixel_rgn_init (&srcPR, iter->drawable, x1, y1, x2 - x1, y2 - y1,
+ FALSE, FALSE);
+ gimp_pixel_rgn_init (&destPR, iter->drawable, x1, y1, x2 - x1, y2 - y1,
+ TRUE, TRUE);
+
+ bpp = srcPR.bpp;
+
+ for (pr = gimp_pixel_rgns_register (2, &srcPR, &destPR), count = 0;
+ pr != NULL;
+ pr = gimp_pixel_rgns_process (pr), count++)
+ {
+ const guchar *src = srcPR.data;
+ guchar *dest = destPR.data;
+ gint y;
+
+ for (y = srcPR.y; y < srcPR.y + srcPR.h; y++)
+ {
+ const guchar *s = src;
+ guchar *d = dest;
+ gint x;
+
+ for (x = srcPR.x; x < srcPR.x + srcPR.w; x++)
+ {
+ func (x, y, s, d, bpp, data);
+
+ s += bpp;
+ d += bpp;
+ }
+
+ src += srcPR.rowstride;
+ dest += destPR.rowstride;
+ }
+
+ area_so_far += srcPR.w * srcPR.h;
+
+ if ((count % 16) == 0)
+ gimp_progress_update ((gdouble) area_so_far / (gdouble) total_area);
+ }
+
+ gimp_drawable_flush (iter->drawable);
+ gimp_drawable_merge_shadow (iter->drawable->drawable_id, TRUE);
+ gimp_drawable_update (iter->drawable->drawable_id,
+ x1, y1, x2 - x1, y2 - y1);
+}
+
+void
+gimp_rgn_iterator_dest (GimpRgnIterator *iter,
+ GimpRgnFuncDest func,
+ gpointer data)
+{
+ GimpPixelRgn destPR;
+
+ g_return_if_fail (iter != NULL);
+
+ gimp_pixel_rgn_init (&destPR, iter->drawable,
+ iter->x1, iter->y1,
+ iter->x2 - iter->x1, iter->y2 - iter->y1,
+ TRUE, TRUE);
+ gimp_rgn_iterator_iter_single (iter, &destPR, (GimpRgnFuncSrc) func, data);
+
+ /* update the processed region */
+ gimp_drawable_flush (iter->drawable);
+ gimp_drawable_merge_shadow (iter->drawable->drawable_id, TRUE);
+ gimp_drawable_update (iter->drawable->drawable_id,
+ iter->x1, iter->y1,
+ iter->x2 - iter->x1, iter->y2 - iter->y1);
+}
+
+
+void
+gimp_rgn_iterate1 (GimpDrawable *drawable,
+ GimpRunMode unused,
+ GimpRgnFunc1 func,
+ gpointer data)
+{
+ GimpPixelRgn srcPR;
+ gint x1, y1, x2, y2;
+ gpointer pr;
+ gint total_area;
+ gint area_so_far;
+ gint count;
+
+ g_return_if_fail (drawable != NULL);
+
+ gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
+
+ total_area = (x2 - x1) * (y2 - y1);
+ area_so_far = 0;
+
+ if (total_area <= 0)
+ return;
+
+ gimp_pixel_rgn_init (&srcPR, drawable,
+ x1, y1, (x2 - x1), (y2 - y1), FALSE, FALSE);
+
+ for (pr = gimp_pixel_rgns_register (1, &srcPR), count = 0;
+ pr != NULL;
+ pr = gimp_pixel_rgns_process (pr), count++)
+ {
+ const guchar *src = srcPR.data;
+ gint y;
+
+ for (y = 0; y < srcPR.h; y++)
+ {
+ const guchar *s = src;
+ gint x;
+
+ for (x = 0; x < srcPR.w; x++)
+ {
+ func (s, srcPR.bpp, data);
+ s += srcPR.bpp;
+ }
+
+ src += srcPR.rowstride;
+ }
+
+ area_so_far += srcPR.w * srcPR.h;
+
+ if ((count % 16) == 0)
+ gimp_progress_update ((gdouble) area_so_far / (gdouble) total_area);
+ }
+}
+
+void
+gimp_rgn_iterate2 (GimpDrawable *drawable,
+ GimpRunMode unused,
+ GimpRgnFunc2 func,
+ gpointer data)
+{
+ GimpPixelRgn srcPR, destPR;
+ gint x1, y1, x2, y2;
+ gpointer pr;
+ gint total_area;
+ gint area_so_far;
+ gint count;
+
+ g_return_if_fail (drawable != NULL);
+
+ gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
+
+ total_area = (x2 - x1) * (y2 - y1);
+ area_so_far = 0;
+
+ if (total_area <= 0)
+ return;
+
+ /* Initialize the pixel regions. */
+ gimp_pixel_rgn_init (&srcPR, drawable, x1, y1, (x2 - x1), (y2 - y1),
+ FALSE, FALSE);
+ gimp_pixel_rgn_init (&destPR, drawable, x1, y1, (x2 - x1), (y2 - y1),
+ TRUE, TRUE);
+
+ for (pr = gimp_pixel_rgns_register (2, &srcPR, &destPR), count = 0;
+ pr != NULL;
+ pr = gimp_pixel_rgns_process (pr), count++)
+ {
+ gimp_rgn_render_region (&srcPR, &destPR, func, data);
+
+ area_so_far += srcPR.w * srcPR.h;
+
+ if ((count % 16) == 0)
+ gimp_progress_update ((gdouble) area_so_far / (gdouble) total_area);
+ }
+
+ /* update the processed region */
+ gimp_drawable_flush (drawable);
+ gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
+ gimp_drawable_update (drawable->drawable_id, x1, y1, (x2 - x1), (y2 - y1));
+}
+
+static void
+gimp_rgn_iterator_iter_single (GimpRgnIterator *iter,
+ GimpPixelRgn *srcPR,
+ GimpRgnFuncSrc func,
+ gpointer data)
+{
+ gpointer pr;
+ gint total_area;
+ gint area_so_far;
+ gint count;
+
+ total_area = (iter->x2 - iter->x1) * (iter->y2 - iter->y1);
+ area_so_far = 0;
+
+ for (pr = gimp_pixel_rgns_register (1, srcPR), count = 0;
+ pr != NULL;
+ pr = gimp_pixel_rgns_process (pr), count++)
+ {
+ const guchar *src = srcPR->data;
+ gint y;
+
+ for (y = srcPR->y; y < srcPR->y + srcPR->h; y++)
+ {
+ const guchar *s = src;
+ gint x;
+
+ for (x = srcPR->x; x < srcPR->x + srcPR->w; x++)
+ {
+ func (x, y, s, srcPR->bpp, data);
+ s += srcPR->bpp;
+ }
+
+ src += srcPR->rowstride;
+ }
+
+ area_so_far += srcPR->w * srcPR->h;
+
+ if ((count % 16) == 0)
+ gimp_progress_update ((gdouble) area_so_far / (gdouble) total_area);
+ }
+}
+
+static void
+gimp_rgn_render_row (const guchar *src,
+ guchar *dest,
+ gint col, /* row width in pixels */
+ gint bpp,
+ GimpRgnFunc2 func,
+ gpointer data)
+{
+ while (col--)
+ {
+ func (src, dest, bpp, data);
+
+ src += bpp;
+ dest += bpp;
+ }
+}
+
+static void
+gimp_rgn_render_region (const GimpPixelRgn *srcPR,
+ const GimpPixelRgn *destPR,
+ GimpRgnFunc2 func,
+ gpointer data)
+{
+ const guchar *src = srcPR->data;
+ guchar *dest = destPR->data;
+ gint row;
+
+ for (row = 0; row < srcPR->h; row++)
+ {
+ gimp_rgn_render_row (src, dest, srcPR->w, srcPR->bpp, func, data);
+
+ src += srcPR->rowstride;
+ dest += destPR->rowstride;
+ }
+}
diff --git a/libgimp/gimpregioniterator.h b/libgimp/gimpregioniterator.h
new file mode 100644
index 0000000..68ebb9f
--- /dev/null
+++ b/libgimp/gimpregioniterator.h
@@ -0,0 +1,95 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpregioniterator.h
+ * Contains all kinds of miscellaneous routines factored out from different
+ * plug-ins. They stay here until their API has crystalized a bit and we can
+ * put them into the file where they belong (Maurits Rijk
+ * <lpeek.mrijk@consunet.nl> if you want to blame someone for this mess)
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_REGION_ITERATOR_H__
+#define __GIMP_REGION_ITERATOR_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+typedef struct _GimpRgnIterator GimpRgnIterator;
+
+typedef void (* GimpRgnFunc1) (const guchar *src,
+ gint bpp,
+ gpointer data);
+typedef void (* GimpRgnFunc2) (const guchar *src,
+ guchar *dest,
+ gint bpp,
+ gpointer data);
+typedef void (* GimpRgnFuncSrc) (gint x,
+ gint y,
+ const guchar *src,
+ gint bpp,
+ gpointer data);
+typedef void (* GimpRgnFuncDest) (gint x,
+ gint y,
+ guchar *dest,
+ gint bpp,
+ gpointer data);
+typedef void (* GimpRgnFuncSrcDest) (gint x,
+ gint y,
+ const guchar *src,
+ guchar *dest,
+ gint bpp,
+ gpointer data);
+
+GIMP_DEPRECATED_FOR(GeglBufferIterator)
+GimpRgnIterator * gimp_rgn_iterator_new (GimpDrawable *drawable,
+ GimpRunMode unused);
+GIMP_DEPRECATED_FOR(GeglBufferIterator)
+void gimp_rgn_iterator_free (GimpRgnIterator *iter);
+GIMP_DEPRECATED_FOR(GeglBufferIterator)
+void gimp_rgn_iterator_src (GimpRgnIterator *iter,
+ GimpRgnFuncSrc func,
+ gpointer data);
+GIMP_DEPRECATED_FOR(GeglBufferIterator)
+void gimp_rgn_iterator_dest (GimpRgnIterator *iter,
+ GimpRgnFuncDest func,
+ gpointer data);
+GIMP_DEPRECATED_FOR(GeglBufferIterator)
+void gimp_rgn_iterator_src_dest (GimpRgnIterator *iter,
+ GimpRgnFuncSrcDest func,
+ gpointer data);
+
+
+GIMP_DEPRECATED_FOR(GeglBufferIterator)
+void gimp_rgn_iterate1 (GimpDrawable *drawable,
+ GimpRunMode unused,
+ GimpRgnFunc1 func,
+ gpointer data);
+
+GIMP_DEPRECATED_FOR(GeglBufferIterator)
+void gimp_rgn_iterate2 (GimpDrawable *drawable,
+ GimpRunMode unused,
+ GimpRgnFunc2 func,
+ gpointer data);
+
+G_END_DECLS
+
+#endif /* __GIMP_REGION_ITERATOR_H__ */
diff --git a/libgimp/gimpselectbutton.c b/libgimp/gimpselectbutton.c
new file mode 100644
index 0000000..33d743c
--- /dev/null
+++ b/libgimp/gimpselectbutton.c
@@ -0,0 +1,95 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpselectbutton.c
+ * Copyright (C) 2003 Sven Neumann <sven@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "gimp.h"
+
+#include "gimpuitypes.h"
+#include "gimpselectbutton.h"
+
+
+/**
+ * SECTION: gimpselectbutton
+ * @title: GimpSelectButton
+ * @short_description: The base class of the data select buttons.
+ *
+ * The base class of the brush, pattern, gradient, palette and font
+ * select buttons.
+ **/
+
+
+/* local function prototypes */
+
+static void gimp_select_button_dispose (GObject *object);
+
+
+G_DEFINE_TYPE (GimpSelectButton, gimp_select_button, GTK_TYPE_BOX)
+
+static void
+gimp_select_button_class_init (GimpSelectButtonClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->dispose = gimp_select_button_dispose;
+}
+
+static void
+gimp_select_button_init (GimpSelectButton *select_button)
+{
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (select_button),
+ GTK_ORIENTATION_HORIZONTAL);
+
+ select_button->temp_callback = NULL;
+}
+
+static void
+gimp_select_button_dispose (GObject *object)
+{
+ gimp_select_button_close_popup (GIMP_SELECT_BUTTON (object));
+
+ G_OBJECT_CLASS (gimp_select_button_parent_class)->dispose (object);
+}
+
+/**
+ * gimp_select_button_close_popup:
+ * @button: A #GimpSelectButton
+ *
+ * Closes the popup window associated with @button.
+ *
+ * Since: 2.4
+ */
+void
+gimp_select_button_close_popup (GimpSelectButton *button)
+{
+ g_return_if_fail (GIMP_IS_SELECT_BUTTON (button));
+
+ if (button->temp_callback)
+ {
+ GimpSelectButtonClass *klass = GIMP_SELECT_BUTTON_GET_CLASS (button);
+
+ klass->select_destroy (button->temp_callback);
+
+ button->temp_callback = NULL;
+ }
+}
diff --git a/libgimp/gimpselectbutton.h b/libgimp/gimpselectbutton.h
new file mode 100644
index 0000000..2c8b335
--- /dev/null
+++ b/libgimp/gimpselectbutton.h
@@ -0,0 +1,76 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpselectbutton.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_SELECT_BUTTON_H__
+#define __GIMP_SELECT_BUTTON_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+#define GIMP_TYPE_SELECT_BUTTON (gimp_select_button_get_type ())
+#define GIMP_SELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_SELECT_BUTTON, GimpSelectButton))
+#define GIMP_SELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SELECT_BUTTON, GimpSelectButtonClass))
+#define GIMP_IS_SELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_SELECT_BUTTON))
+#define GIMP_IS_SELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SELECT_BUTTON))
+#define GIMP_SELECT_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SELECT_BUTTON, GimpSelectButtonClass))
+
+
+typedef struct _GimpSelectButtonClass GimpSelectButtonClass;
+
+struct _GimpSelectButton
+{
+ GtkBox parent_instance;
+
+ const gchar *temp_callback;
+};
+
+struct _GimpSelectButtonClass
+{
+ GtkBoxClass parent_class;
+
+ gchar *default_title;
+
+ void (*select_destroy) (const gchar *callback);
+
+ /* Padding for future expansion */
+ void (*_gimp_reserved1) (void);
+ void (*_gimp_reserved2) (void);
+ void (*_gimp_reserved3) (void);
+ void (*_gimp_reserved4) (void);
+ void (*_gimp_reserved5) (void);
+ void (*_gimp_reserved6) (void);
+ void (*_gimp_reserved7) (void);
+};
+
+
+GType gimp_select_button_get_type (void) G_GNUC_CONST;
+
+void gimp_select_button_close_popup (GimpSelectButton *button);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_SELECT_BUTTON_H__ */
diff --git a/libgimp/gimpselection.c b/libgimp/gimpselection.c
new file mode 100644
index 0000000..c8e1bbb
--- /dev/null
+++ b/libgimp/gimpselection.c
@@ -0,0 +1,66 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimpselection.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+/**
+ * gimp_selection_float:
+ * @image_ID: ignored
+ * @drawable_ID: The drawable from which to float selection.
+ * @offx: x offset for translation.
+ * @offy: y offset for translation.
+ *
+ * Float the selection from the specified drawable with initial offsets
+ * as specified.
+ *
+ * This procedure determines the region of the specified drawable that
+ * lies beneath the current selection. The region is then cut from the
+ * drawable and the resulting data is made into a new layer which is
+ * instantiated as a floating selection. The offsets allow initial
+ * positioning of the new floating selection.
+ *
+ * Returns: The floated layer.
+ */
+gint32
+gimp_selection_float (gint32 image_ID,
+ gint32 drawable_ID,
+ gint offx,
+ gint offy)
+{
+ return _gimp_selection_float (drawable_ID,
+ offx,
+ offy);
+}
+
+/**
+ * gimp_selection_clear:
+ * @image_ID: The image.
+ *
+ * This procedure is deprecated! Use gimp_selection_none() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_selection_clear (gint32 image_ID)
+{
+ return gimp_selection_none (image_ID);
+}
diff --git a/libgimp/gimpselection.h b/libgimp/gimpselection.h
new file mode 100644
index 0000000..6a95572
--- /dev/null
+++ b/libgimp/gimpselection.h
@@ -0,0 +1,45 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimpselection.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_SELECTION_H__
+#define __GIMP_SELECTION_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gint32 gimp_selection_float (gint32 image_ID,
+ gint32 drawable_ID,
+ gint offx,
+ gint offy);
+
+GIMP_DEPRECATED_FOR(gimp_selection_none)
+gboolean gimp_selection_clear (gint32 image_ID);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_SELECTION_H__ */
+
diff --git a/libgimp/gimpselection_pdb.c b/libgimp/gimpselection_pdb.c
new file mode 100644
index 0000000..de159c3
--- /dev/null
+++ b/libgimp/gimpselection_pdb.c
@@ -0,0 +1,650 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpselection_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpselection
+ * @title: gimpselection
+ * @short_description: Functions for manipulating selections.
+ *
+ * Functions for manipulating selections.
+ **/
+
+
+/**
+ * gimp_selection_bounds:
+ * @image_ID: The image.
+ * @non_empty: TRUE if there is a selection.
+ * @x1: x coordinate of upper left corner of selection bounds.
+ * @y1: y coordinate of upper left corner of selection bounds.
+ * @x2: x coordinate of lower right corner of selection bounds.
+ * @y2: y coordinate of lower right corner of selection bounds.
+ *
+ * Find the bounding box of the current selection.
+ *
+ * This procedure returns whether there is a selection for the
+ * specified image. If there is one, the upper left and lower right
+ * corners of the bounding box are returned. These coordinates are
+ * relative to the image. Please note that the pixel specified by the
+ * lower right coordinate of the bounding box is not part of the
+ * selection. The selection ends at the upper left corner of this
+ * pixel. This means the width of the selection can be calculated as
+ * (x2 - x1), its height as (y2 - y1).
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_bounds (gint32 image_ID,
+ gboolean *non_empty,
+ gint *x1,
+ gint *y1,
+ gint *x2,
+ gint *y2)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-bounds",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ *non_empty = FALSE;
+ *x1 = 0;
+ *y1 = 0;
+ *x2 = 0;
+ *y2 = 0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *non_empty = return_vals[1].data.d_int32;
+ *x1 = return_vals[2].data.d_int32;
+ *y1 = return_vals[3].data.d_int32;
+ *x2 = return_vals[4].data.d_int32;
+ *y2 = return_vals[5].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_selection_value:
+ * @image_ID: The image.
+ * @x: x coordinate of value.
+ * @y: y coordinate of value.
+ *
+ * Find the value of the selection at the specified coordinates.
+ *
+ * This procedure returns the value of the selection at the specified
+ * coordinates. If the coordinates lie out of bounds, 0 is returned.
+ *
+ * Returns: Value of the selection.
+ **/
+gint
+gimp_selection_value (gint32 image_ID,
+ gint x,
+ gint y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint value = 0;
+
+ return_vals = gimp_run_procedure ("gimp-selection-value",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, x,
+ GIMP_PDB_INT32, y,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ value = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return value;
+}
+
+/**
+ * gimp_selection_is_empty:
+ * @image_ID: The image.
+ *
+ * Determine whether the selection is empty.
+ *
+ * This procedure returns TRUE if the selection for the specified image
+ * is empty.
+ *
+ * Returns: Is the selection empty?
+ **/
+gboolean
+gimp_selection_is_empty (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean is_empty = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-is-empty",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ is_empty = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return is_empty;
+}
+
+/**
+ * gimp_selection_translate:
+ * @image_ID: The image.
+ * @offx: x offset for translation.
+ * @offy: y offset for translation.
+ *
+ * Translate the selection by the specified offsets.
+ *
+ * This procedure actually translates the selection for the specified
+ * image by the specified offsets. Regions that are translated from
+ * beyond the bounds of the image are set to empty. Valid regions of
+ * the selection which are translated beyond the bounds of the image
+ * because of this call are lost.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_translate (gint32 image_ID,
+ gint offx,
+ gint offy)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-translate",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, offx,
+ GIMP_PDB_INT32, offy,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_selection_float:
+ * @drawable_ID: The drawable from which to float selection.
+ * @offx: x offset for translation.
+ * @offy: y offset for translation.
+ *
+ * Float the selection from the specified drawable with initial offsets
+ * as specified.
+ *
+ * This procedure determines the region of the specified drawable that
+ * lies beneath the current selection. The region is then cut from the
+ * drawable and the resulting data is made into a new layer which is
+ * instantiated as a floating selection. The offsets allow initial
+ * positioning of the new floating selection.
+ *
+ * Returns: The floated layer.
+ **/
+gint32
+_gimp_selection_float (gint32 drawable_ID,
+ gint offx,
+ gint offy)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-selection-float",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, offx,
+ GIMP_PDB_INT32, offy,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_selection_invert:
+ * @image_ID: The image.
+ *
+ * Invert the selection mask.
+ *
+ * This procedure inverts the selection mask. For every pixel in the
+ * selection channel, its new value is calculated as (255 - old-value).
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_invert (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-invert",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_selection_sharpen:
+ * @image_ID: The image.
+ *
+ * Sharpen the selection mask.
+ *
+ * This procedure sharpens the selection mask. For every pixel in the
+ * selection channel, if the value is &gt; 127, the new pixel is
+ * assigned a value of 255. This removes any \"anti-aliasing\" that
+ * might exist in the selection mask's boundary.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_sharpen (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-sharpen",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_selection_all:
+ * @image_ID: The image.
+ *
+ * Select all of the image.
+ *
+ * This procedure sets the selection mask to completely encompass the
+ * image. Every pixel in the selection channel is set to 255.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_all (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-all",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_selection_none:
+ * @image_ID: The image.
+ *
+ * Deselect the entire image.
+ *
+ * This procedure deselects the entire image. Every pixel in the
+ * selection channel is set to 0.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_none (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-none",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_selection_feather:
+ * @image_ID: The image.
+ * @radius: Radius of feather (in pixels).
+ *
+ * Feather the image's selection
+ *
+ * This procedure feathers the selection. Feathering is implemented
+ * using a gaussian blur.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_feather (gint32 image_ID,
+ gdouble radius)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-feather",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_FLOAT, radius,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_selection_border:
+ * @image_ID: The image.
+ * @radius: Radius of border (in pixels).
+ *
+ * Border the image's selection
+ *
+ * This procedure borders the selection. Bordering creates a new
+ * selection which is defined along the boundary of the previous
+ * selection at every point within the specified radius.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_border (gint32 image_ID,
+ gint radius)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-border",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, radius,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_selection_grow:
+ * @image_ID: The image.
+ * @steps: Steps of grow (in pixels).
+ *
+ * Grow the image's selection
+ *
+ * This procedure grows the selection. Growing involves expanding the
+ * boundary in all directions by the specified pixel amount.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_grow (gint32 image_ID,
+ gint steps)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-grow",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, steps,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_selection_shrink:
+ * @image_ID: The image.
+ * @steps: Steps of shrink (in pixels).
+ *
+ * Shrink the image's selection
+ *
+ * This procedure shrinks the selection. Shrinking involves trimming
+ * the existing selection boundary on all sides by the specified number
+ * of pixels.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_shrink (gint32 image_ID,
+ gint steps)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-shrink",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, steps,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_selection_flood:
+ * @image_ID: The image.
+ *
+ * Remove holes from the image's selection
+ *
+ * This procedure removes holes from the selection, that can come from
+ * selecting a patchy area with the Fuzzy Select Tool. In technical
+ * terms this procedure floods the selection. See the Algorithms page
+ * in the developer wiki for details.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_selection_flood (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-flood",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_selection_layer_alpha:
+ * @layer_ID: Layer with alpha.
+ *
+ * Deprecated: Use gimp_image_select_item() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_layer_alpha (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-layer-alpha",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_selection_load:
+ * @channel_ID: The channel.
+ *
+ * Deprecated: Use gimp_image_select_item() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_load (gint32 channel_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-load",
+ &nreturn_vals,
+ GIMP_PDB_CHANNEL, channel_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_selection_save:
+ * @image_ID: The image.
+ *
+ * Copy the selection mask to a new channel.
+ *
+ * This procedure copies the selection mask and stores the content in a
+ * new channel. The new channel is automatically inserted into the
+ * image's list of channels.
+ *
+ * Returns: The new channel.
+ **/
+gint32
+gimp_selection_save (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 channel_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-selection-save",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ channel_ID = return_vals[1].data.d_channel;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return channel_ID;
+}
+
+/**
+ * gimp_selection_combine:
+ * @channel_ID: The channel.
+ * @operation: The selection operation.
+ *
+ * Deprecated: Use gimp_image_select_item() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_combine (gint32 channel_ID,
+ GimpChannelOps operation)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-selection-combine",
+ &nreturn_vals,
+ GIMP_PDB_CHANNEL, channel_ID,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpselection_pdb.h b/libgimp/gimpselection_pdb.h
new file mode 100644
index 0000000..8440859
--- /dev/null
+++ b/libgimp/gimpselection_pdb.h
@@ -0,0 +1,76 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpselection_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_SELECTION_PDB_H__
+#define __GIMP_SELECTION_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_selection_bounds (gint32 image_ID,
+ gboolean *non_empty,
+ gint *x1,
+ gint *y1,
+ gint *x2,
+ gint *y2);
+gint gimp_selection_value (gint32 image_ID,
+ gint x,
+ gint y);
+gboolean gimp_selection_is_empty (gint32 image_ID);
+gboolean gimp_selection_translate (gint32 image_ID,
+ gint offx,
+ gint offy);
+G_GNUC_INTERNAL gint32 _gimp_selection_float (gint32 drawable_ID,
+ gint offx,
+ gint offy);
+gboolean gimp_selection_invert (gint32 image_ID);
+gboolean gimp_selection_sharpen (gint32 image_ID);
+gboolean gimp_selection_all (gint32 image_ID);
+gboolean gimp_selection_none (gint32 image_ID);
+gboolean gimp_selection_feather (gint32 image_ID,
+ gdouble radius);
+gboolean gimp_selection_border (gint32 image_ID,
+ gint radius);
+gboolean gimp_selection_grow (gint32 image_ID,
+ gint steps);
+gboolean gimp_selection_shrink (gint32 image_ID,
+ gint steps);
+gboolean gimp_selection_flood (gint32 image_ID);
+GIMP_DEPRECATED_FOR(gimp_image_select_item)
+gboolean gimp_selection_layer_alpha (gint32 layer_ID);
+GIMP_DEPRECATED_FOR(gimp_image_select_item)
+gboolean gimp_selection_load (gint32 channel_ID);
+gint32 gimp_selection_save (gint32 image_ID);
+GIMP_DEPRECATED_FOR(gimp_image_select_item)
+gboolean gimp_selection_combine (gint32 channel_ID,
+ GimpChannelOps operation);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_SELECTION_PDB_H__ */
diff --git a/libgimp/gimpselectiontools_pdb.c b/libgimp/gimpselectiontools_pdb.c
new file mode 100644
index 0000000..1d5a324
--- /dev/null
+++ b/libgimp/gimpselectiontools_pdb.c
@@ -0,0 +1,461 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpselectiontools_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpselectiontools
+ * @title: gimpselectiontools
+ * @short_description: Access to toolbox selection tools.
+ *
+ * Functions giving access to toolbox selection tools.
+ **/
+
+
+/**
+ * gimp_by_color_select:
+ * @drawable_ID: The affected drawable.
+ * @color: The color to select.
+ * @threshold: Threshold in intensity levels.
+ * @operation: The selection operation.
+ * @antialias: Antialiasing.
+ * @feather: Feather option for selections.
+ * @feather_radius: Radius for feather operation.
+ * @sample_merged: Use the composite image, not the drawable.
+ *
+ * Deprecated: Use gimp_image_select_color() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_by_color_select (gint32 drawable_ID,
+ const GimpRGB *color,
+ gint threshold,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius,
+ gboolean sample_merged)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-by-color-select",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_COLOR, color,
+ GIMP_PDB_INT32, threshold,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_INT32, antialias,
+ GIMP_PDB_INT32, feather,
+ GIMP_PDB_FLOAT, feather_radius,
+ GIMP_PDB_INT32, sample_merged,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_by_color_select_full:
+ * @drawable_ID: The affected drawable.
+ * @color: The color to select.
+ * @threshold: Threshold in intensity levels.
+ * @operation: The selection operation.
+ * @antialias: Antialiasing.
+ * @feather: Feather option for selections.
+ * @feather_radius_x: Radius for feather operation in X direction.
+ * @feather_radius_y: Radius for feather operation in Y direction.
+ * @sample_merged: Use the composite image, not the drawable.
+ * @select_transparent: Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.
+ * @select_criterion: The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.
+ *
+ * Deprecated: Use gimp_image_select_color() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_by_color_select_full (gint32 drawable_ID,
+ const GimpRGB *color,
+ gint threshold,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y,
+ gboolean sample_merged,
+ gboolean select_transparent,
+ GimpSelectCriterion select_criterion)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-by-color-select-full",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_COLOR, color,
+ GIMP_PDB_INT32, threshold,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_INT32, antialias,
+ GIMP_PDB_INT32, feather,
+ GIMP_PDB_FLOAT, feather_radius_x,
+ GIMP_PDB_FLOAT, feather_radius_y,
+ GIMP_PDB_INT32, sample_merged,
+ GIMP_PDB_INT32, select_transparent,
+ GIMP_PDB_INT32, select_criterion,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_ellipse_select:
+ * @image_ID: The image.
+ * @x: x coordinate of upper-left corner of ellipse bounding box.
+ * @y: y coordinate of upper-left corner of ellipse bounding box.
+ * @width: The width of the ellipse.
+ * @height: The height of the ellipse.
+ * @operation: The selection operation.
+ * @antialias: Antialiasing.
+ * @feather: Feather option for selections.
+ * @feather_radius: Radius for feather operation.
+ *
+ * Deprecated: Use gimp_image_select_ellipse() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_ellipse_select (gint32 image_ID,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-ellipse-select",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_FLOAT, width,
+ GIMP_PDB_FLOAT, height,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_INT32, antialias,
+ GIMP_PDB_INT32, feather,
+ GIMP_PDB_FLOAT, feather_radius,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_free_select:
+ * @image_ID: The image.
+ * @num_segs: Number of points (count 1 coordinate as two points).
+ * @segs: Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}.
+ * @operation: The selection operation.
+ * @antialias: Antialiasing.
+ * @feather: Feather option for selections.
+ * @feather_radius: Radius for feather operation.
+ *
+ * Deprecated: Use gimp_image_select_polygon() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_free_select (gint32 image_ID,
+ gint num_segs,
+ const gdouble *segs,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-free-select",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, num_segs,
+ GIMP_PDB_FLOATARRAY, segs,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_INT32, antialias,
+ GIMP_PDB_INT32, feather,
+ GIMP_PDB_FLOAT, feather_radius,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_fuzzy_select:
+ * @drawable_ID: The affected drawable.
+ * @x: x coordinate of initial seed fill point: (image coordinates).
+ * @y: y coordinate of initial seed fill point: (image coordinates).
+ * @threshold: Threshold in intensity levels.
+ * @operation: The selection operation.
+ * @antialias: Antialiasing.
+ * @feather: Feather option for selections.
+ * @feather_radius: Radius for feather operation.
+ * @sample_merged: Use the composite image, not the drawable.
+ *
+ * Deprecated: Use gimp_image_select_contiguous_color() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_fuzzy_select (gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ gint threshold,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius,
+ gboolean sample_merged)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-fuzzy-select",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_INT32, threshold,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_INT32, antialias,
+ GIMP_PDB_INT32, feather,
+ GIMP_PDB_FLOAT, feather_radius,
+ GIMP_PDB_INT32, sample_merged,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_fuzzy_select_full:
+ * @drawable_ID: The affected drawable.
+ * @x: x coordinate of initial seed fill point: (image coordinates).
+ * @y: y coordinate of initial seed fill point: (image coordinates).
+ * @threshold: Threshold in intensity levels.
+ * @operation: The selection operation.
+ * @antialias: Antialiasing.
+ * @feather: Feather option for selections.
+ * @feather_radius_x: Radius for feather operation in X direction.
+ * @feather_radius_y: Radius for feather operation in Y direction.
+ * @sample_merged: Use the composite image, not the drawable.
+ * @select_transparent: Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.
+ * @select_criterion: The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.
+ *
+ * Deprecated: Use gimp_image_select_contiguous_color() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_fuzzy_select_full (gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ gint threshold,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y,
+ gboolean sample_merged,
+ gboolean select_transparent,
+ GimpSelectCriterion select_criterion)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-fuzzy-select-full",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_INT32, threshold,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_INT32, antialias,
+ GIMP_PDB_INT32, feather,
+ GIMP_PDB_FLOAT, feather_radius_x,
+ GIMP_PDB_FLOAT, feather_radius_y,
+ GIMP_PDB_INT32, sample_merged,
+ GIMP_PDB_INT32, select_transparent,
+ GIMP_PDB_INT32, select_criterion,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_rect_select:
+ * @image_ID: The image.
+ * @x: x coordinate of upper-left corner of rectangle.
+ * @y: y coordinate of upper-left corner of rectangle.
+ * @width: The width of the rectangle.
+ * @height: The height of the rectangle.
+ * @operation: The selection operation.
+ * @feather: Feather option for selections.
+ * @feather_radius: Radius for feather operation.
+ *
+ * Deprecated: Use gimp_image_select_rectangle() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_rect_select (gint32 image_ID,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GimpChannelOps operation,
+ gboolean feather,
+ gdouble feather_radius)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-rect-select",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_FLOAT, width,
+ GIMP_PDB_FLOAT, height,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_INT32, feather,
+ GIMP_PDB_FLOAT, feather_radius,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_round_rect_select:
+ * @image_ID: The image.
+ * @x: x coordinate of upper-left corner of rectangle.
+ * @y: y coordinate of upper-left corner of rectangle.
+ * @width: The width of the rectangle.
+ * @height: The height of the rectangle.
+ * @corner_radius_x: The corner radius in X direction.
+ * @corner_radius_y: The corner radius in Y direction.
+ * @operation: The selection operation.
+ * @antialias: Antialiasing.
+ * @feather: Feather option for selections.
+ * @feather_radius_x: Radius for feather operation in X direction.
+ * @feather_radius_y: Radius for feather operation in Y direction.
+ *
+ * Deprecated: Use gimp_image_select_round_rectangle() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_round_rect_select (gint32 image_ID,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ gdouble corner_radius_x,
+ gdouble corner_radius_y,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-round-rect-select",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_FLOAT, width,
+ GIMP_PDB_FLOAT, height,
+ GIMP_PDB_FLOAT, corner_radius_x,
+ GIMP_PDB_FLOAT, corner_radius_y,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_INT32, antialias,
+ GIMP_PDB_INT32, feather,
+ GIMP_PDB_FLOAT, feather_radius_x,
+ GIMP_PDB_FLOAT, feather_radius_y,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpselectiontools_pdb.h b/libgimp/gimpselectiontools_pdb.h
new file mode 100644
index 0000000..50c886a
--- /dev/null
+++ b/libgimp/gimpselectiontools_pdb.h
@@ -0,0 +1,123 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpselectiontools_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_SELECTION_TOOLS_PDB_H__
+#define __GIMP_SELECTION_TOOLS_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+GIMP_DEPRECATED_FOR(gimp_image_select_color)
+gboolean gimp_by_color_select (gint32 drawable_ID,
+ const GimpRGB *color,
+ gint threshold,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius,
+ gboolean sample_merged);
+GIMP_DEPRECATED_FOR(gimp_image_select_color)
+gboolean gimp_by_color_select_full (gint32 drawable_ID,
+ const GimpRGB *color,
+ gint threshold,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y,
+ gboolean sample_merged,
+ gboolean select_transparent,
+ GimpSelectCriterion select_criterion);
+GIMP_DEPRECATED_FOR(gimp_image_select_ellipse)
+gboolean gimp_ellipse_select (gint32 image_ID,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius);
+GIMP_DEPRECATED_FOR(gimp_image_select_polygon)
+gboolean gimp_free_select (gint32 image_ID,
+ gint num_segs,
+ const gdouble *segs,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius);
+GIMP_DEPRECATED_FOR(gimp_image_select_contiguous_color)
+gboolean gimp_fuzzy_select (gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ gint threshold,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius,
+ gboolean sample_merged);
+GIMP_DEPRECATED_FOR(gimp_image_select_contiguous_color)
+gboolean gimp_fuzzy_select_full (gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ gint threshold,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y,
+ gboolean sample_merged,
+ gboolean select_transparent,
+ GimpSelectCriterion select_criterion);
+GIMP_DEPRECATED_FOR(gimp_image_select_rectangle)
+gboolean gimp_rect_select (gint32 image_ID,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GimpChannelOps operation,
+ gboolean feather,
+ gdouble feather_radius);
+GIMP_DEPRECATED_FOR(gimp_image_select_round_rectangle)
+gboolean gimp_round_rect_select (gint32 image_ID,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ gdouble corner_radius_x,
+ gdouble corner_radius_y,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_SELECTION_TOOLS_PDB_H__ */
diff --git a/libgimp/gimptextlayer_pdb.c b/libgimp/gimptextlayer_pdb.c
new file mode 100644
index 0000000..95da141
--- /dev/null
+++ b/libgimp/gimptextlayer_pdb.c
@@ -0,0 +1,1127 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimptextlayer_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimptextlayer
+ * @title: gimptextlayer
+ * @short_description: Functions for querying and manipulating text layers.
+ *
+ * Functions for querying and manipulating text layers.
+ **/
+
+
+/**
+ * gimp_text_layer_new:
+ * @image_ID: The image.
+ * @text: The text to generate (in UTF-8 encoding).
+ * @fontname: The name of the font.
+ * @size: The size of text in either pixels or points.
+ * @unit: The units of specified size.
+ *
+ * Creates a new text layer.
+ *
+ * This procedure creates a new text layer. The arguments are kept as
+ * simple as necessary for the normal case. All text attributes,
+ * however, can be modified with the appropriate
+ * gimp_text_layer_set_*() procedures. The new layer still needs to be
+ * added to the image, as this is not automatic. Add the new layer
+ * using gimp_image_insert_layer().
+ *
+ * Returns: The new text layer.
+ *
+ * Since: 2.6
+ **/
+gint32
+gimp_text_layer_new (gint32 image_ID,
+ const gchar *text,
+ const gchar *fontname,
+ gdouble size,
+ GimpUnit unit)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-new",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, text,
+ GIMP_PDB_STRING, fontname,
+ GIMP_PDB_FLOAT, size,
+ GIMP_PDB_INT32, unit,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_text_layer_get_text:
+ * @layer_ID: The text layer.
+ *
+ * Get the text from a text layer as string.
+ *
+ * This procedure returns the text from a text layer as a string.
+ *
+ * Returns: The text from the specified text layer.
+ *
+ * Since: 2.6
+ **/
+gchar *
+gimp_text_layer_get_text (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *text = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-text",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ text = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return text;
+}
+
+/**
+ * gimp_text_layer_set_text:
+ * @layer_ID: The text layer.
+ * @text: The new text to set.
+ *
+ * Set the text of a text layer.
+ *
+ * This procedure changes the text of a text layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_text (gint32 layer_ID,
+ const gchar *text)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-text",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_STRING, text,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_markup:
+ * @layer_ID: The text layer.
+ *
+ * Get the markup from a text layer as string.
+ *
+ * This procedure returns the markup of the styles from a text layer.
+ * The markup will be in the form of Pango's markup - See
+ * https://www.pango.org/ for more information about Pango and its
+ * markup. Note: Setting the markup of a text layer using Pango's
+ * markup is not supported for now.
+ *
+ * Returns: The markup which represents the style of the specified text
+ * layer.
+ *
+ * Since: 2.8
+ **/
+gchar *
+gimp_text_layer_get_markup (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *markup = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-markup",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ markup = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return markup;
+}
+
+/**
+ * gimp_text_layer_get_font:
+ * @layer_ID: The text layer.
+ *
+ * Get the font from a text layer as string.
+ *
+ * This procedure returns the name of the font from a text layer.
+ *
+ * Returns: The font which is used in the specified text layer.
+ *
+ * Since: 2.6
+ **/
+gchar *
+gimp_text_layer_get_font (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *font = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-font",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ font = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return font;
+}
+
+/**
+ * gimp_text_layer_set_font:
+ * @layer_ID: The text layer.
+ * @font: The new font to use.
+ *
+ * Set the font of a text layer.
+ *
+ * This procedure modifies the font used in the specified text layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_font (gint32 layer_ID,
+ const gchar *font)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-font",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_STRING, font,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_font_size:
+ * @layer_ID: The text layer.
+ * @unit: The unit used for the font size.
+ *
+ * Get the font size from a text layer.
+ *
+ * This procedure returns the size of the font which is used in a text
+ * layer. You will receive the size as a float 'font-size' in 'unit'
+ * units.
+ *
+ * Returns: The font size.
+ *
+ * Since: 2.6
+ **/
+gdouble
+gimp_text_layer_get_font_size (gint32 layer_ID,
+ GimpUnit *unit)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble font_size = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-font-size",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ font_size = return_vals[1].data.d_float;
+ *unit = return_vals[2].data.d_unit;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return font_size;
+}
+
+/**
+ * gimp_text_layer_set_font_size:
+ * @layer_ID: The text layer.
+ * @font_size: The font size.
+ * @unit: The unit to use for the font size.
+ *
+ * Set the font size.
+ *
+ * This procedure changes the font size of a text layer. The size of
+ * your font will be a double 'font-size' of 'unit' units.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_font_size (gint32 layer_ID,
+ gdouble font_size,
+ GimpUnit unit)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-font-size",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_FLOAT, font_size,
+ GIMP_PDB_INT32, unit,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_antialias:
+ * @layer_ID: The text layer.
+ *
+ * Check if antialiasing is used in the text layer.
+ *
+ * This procedure checks if antialiasing is enabled in the specified
+ * text layer.
+ *
+ * Returns: A flag which is true if antialiasing is used for rendering
+ * the font in the text layer.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_get_antialias (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean antialias = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-antialias",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ antialias = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return antialias;
+}
+
+/**
+ * gimp_text_layer_set_antialias:
+ * @layer_ID: The text layer.
+ * @antialias: Enable/disable antialiasing of the text.
+ *
+ * Enable/disable anti-aliasing in a text layer.
+ *
+ * This procedure enables or disables anti-aliasing of the text in a
+ * text layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_antialias (gint32 layer_ID,
+ gboolean antialias)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-antialias",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, antialias,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_hint_style:
+ * @layer_ID: The text layer.
+ *
+ * Get information about hinting in the specified text layer.
+ *
+ * This procedure provides information about the hinting that is being
+ * used in a text layer. Hinting can be optimized for fidelity or
+ * contrast or it can be turned entirely off.
+ *
+ * Returns: The hint style used for font outlines.
+ *
+ * Since: 2.8
+ **/
+GimpTextHintStyle
+gimp_text_layer_get_hint_style (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpTextHintStyle style = 0;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-hint-style",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ style = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return style;
+}
+
+/**
+ * gimp_text_layer_set_hint_style:
+ * @layer_ID: The text layer.
+ * @style: The new hint style.
+ *
+ * Control how font outlines are hinted in a text layer.
+ *
+ * This procedure sets the hint style for font outlines in a text
+ * layer. This controls whether to fit font outlines to the pixel grid,
+ * and if so, whether to optimize for fidelity or contrast.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_text_layer_set_hint_style (gint32 layer_ID,
+ GimpTextHintStyle style)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-hint-style",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, style,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_kerning:
+ * @layer_ID: The text layer.
+ *
+ * Check if kerning is used in the text layer.
+ *
+ * This procedure checks if kerning is enabled in the specified text
+ * layer.
+ *
+ * Returns: A flag which is true if kerning is used in the text layer.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_get_kerning (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean kerning = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-kerning",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ kerning = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return kerning;
+}
+
+/**
+ * gimp_text_layer_set_kerning:
+ * @layer_ID: The text layer.
+ * @kerning: Enable/disable kerning in the text.
+ *
+ * Enable/disable kerning in a text layer.
+ *
+ * This procedure enables or disables kerning in a text layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_kerning (gint32 layer_ID,
+ gboolean kerning)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-kerning",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, kerning,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_language:
+ * @layer_ID: The text layer.
+ *
+ * Get the language used in the text layer.
+ *
+ * This procedure returns the language string which is set for the text
+ * in the text layer.
+ *
+ * Returns: The language used in the text layer.
+ *
+ * Since: 2.6
+ **/
+gchar *
+gimp_text_layer_get_language (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *language = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-language",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ language = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return language;
+}
+
+/**
+ * gimp_text_layer_set_language:
+ * @layer_ID: The text layer.
+ * @language: The new language to use for the text layer.
+ *
+ * Set the language of the text layer.
+ *
+ * This procedure sets the language of the text in text layer. For some
+ * scripts the language has an influence of how the text is rendered.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_language (gint32 layer_ID,
+ const gchar *language)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-language",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_STRING, language,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_base_direction:
+ * @layer_ID: The text layer.
+ *
+ * Get the base direction used for rendering the text layer.
+ *
+ * This procedure returns the base direction used for rendering the
+ * text in the text layer
+ *
+ * Returns: The based direction used for the text layer.
+ *
+ * Since: 2.6
+ **/
+GimpTextDirection
+gimp_text_layer_get_base_direction (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpTextDirection direction = 0;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-base-direction",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ direction = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return direction;
+}
+
+/**
+ * gimp_text_layer_set_base_direction:
+ * @layer_ID: The text layer.
+ * @direction: The base direction of the text.
+ *
+ * Set the base direction in the text layer.
+ *
+ * This procedure sets the base direction used in applying the Unicode
+ * bidirectional algorithm when rendering the text.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_base_direction (gint32 layer_ID,
+ GimpTextDirection direction)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-base-direction",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, direction,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_justification:
+ * @layer_ID: The text layer.
+ *
+ * Get the text justification information of the text layer.
+ *
+ * This procedure returns the alignment of the lines in the text layer
+ * relative to each other.
+ *
+ * Returns: The justification used in the text layer.
+ *
+ * Since: 2.6
+ **/
+GimpTextJustification
+gimp_text_layer_get_justification (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpTextJustification justify = 0;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-justification",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ justify = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return justify;
+}
+
+/**
+ * gimp_text_layer_set_justification:
+ * @layer_ID: The text layer.
+ * @justify: The justification for your text.
+ *
+ * Set the justification of the text in a text layer.
+ *
+ * This procedure sets the alignment of the lines in the text layer
+ * relative to each other.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_justification (gint32 layer_ID,
+ GimpTextJustification justify)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-justification",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, justify,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_color:
+ * @layer_ID: The text layer.
+ * @color: The color of the text.
+ *
+ * Get the color of the text in a text layer.
+ *
+ * This procedure returns the color of the text in a text layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_get_color (gint32 layer_ID,
+ GimpRGB *color)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-color",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ *color = return_vals[1].data.d_color;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_set_color:
+ * @layer_ID: The text layer.
+ * @color: The color to use for the text.
+ *
+ * Set the color of the text in the text layer.
+ *
+ * This procedure sets the text color in the text layer 'layer'.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_color (gint32 layer_ID,
+ const GimpRGB *color)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-color",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_COLOR, color,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_indent:
+ * @layer_ID: The text layer.
+ *
+ * Get the line indentation of text layer.
+ *
+ * This procedure returns the indentation of the first line in a text
+ * layer.
+ *
+ * Returns: The indentation value of the first line.
+ *
+ * Since: 2.6
+ **/
+gdouble
+gimp_text_layer_get_indent (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble indent = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-indent",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ indent = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return indent;
+}
+
+/**
+ * gimp_text_layer_set_indent:
+ * @layer_ID: The text layer.
+ * @indent: The indentation for the first line.
+ *
+ * Set the indentation of the first line in a text layer.
+ *
+ * This procedure sets the indentation of the first line in the text
+ * layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_indent (gint32 layer_ID,
+ gdouble indent)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-indent",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_FLOAT, indent,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_line_spacing:
+ * @layer_ID: The text layer.
+ *
+ * Get the spacing between lines of text.
+ *
+ * This procedure returns the line-spacing between lines of text in a
+ * text layer.
+ *
+ * Returns: The line-spacing value.
+ *
+ * Since: 2.6
+ **/
+gdouble
+gimp_text_layer_get_line_spacing (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble line_spacing = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-line-spacing",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ line_spacing = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return line_spacing;
+}
+
+/**
+ * gimp_text_layer_set_line_spacing:
+ * @layer_ID: The text layer.
+ * @line_spacing: The additional line spacing to use.
+ *
+ * Adjust the line spacing in a text layer.
+ *
+ * This procedure sets the additional spacing used between lines a text
+ * layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_line_spacing (gint32 layer_ID,
+ gdouble line_spacing)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-line-spacing",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_FLOAT, line_spacing,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_letter_spacing:
+ * @layer_ID: The text layer.
+ *
+ * Get the letter spacing used in a text layer.
+ *
+ * This procedure returns the additional spacing between the single
+ * glyphs in a text layer.
+ *
+ * Returns: The letter-spacing value.
+ *
+ * Since: 2.6
+ **/
+gdouble
+gimp_text_layer_get_letter_spacing (gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble letter_spacing = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-letter-spacing",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ letter_spacing = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return letter_spacing;
+}
+
+/**
+ * gimp_text_layer_set_letter_spacing:
+ * @layer_ID: The text layer.
+ * @letter_spacing: The additional letter spacing to use.
+ *
+ * Adjust the letter spacing in a text layer.
+ *
+ * This procedure sets the additional spacing between the single glyphs
+ * in a text layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_letter_spacing (gint32 layer_ID,
+ gdouble letter_spacing)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-letter-spacing",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_FLOAT, letter_spacing,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_resize:
+ * @layer_ID: The text layer.
+ * @width: The new box width in pixels.
+ * @height: The new box height in pixels.
+ *
+ * Resize the box of a text layer.
+ *
+ * This procedure changes the width and height of a text layer while
+ * keeping it as a text layer and not converting it to a bitmap like
+ * gimp_layer_resize() would do.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_text_layer_resize (gint32 layer_ID,
+ gdouble width,
+ gdouble height)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-resize",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_FLOAT, width,
+ GIMP_PDB_FLOAT, height,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_hinting:
+ * @layer_ID: The text layer.
+ * @autohint: A flag which is true if the text layer is forced to use the autohinter from FreeType.
+ *
+ * Deprecated: Use gimp_text_layer_get_hint_style() instead.
+ *
+ * Returns: A flag which is true if hinting is used on the font.
+ **/
+gboolean
+gimp_text_layer_get_hinting (gint32 layer_ID,
+ gboolean *autohint)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean hinting = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-get-hinting",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ hinting = return_vals[1].data.d_int32;
+ *autohint = return_vals[2].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return hinting;
+}
+
+/**
+ * gimp_text_layer_set_hinting:
+ * @layer_ID: The text layer.
+ * @hinting: Enable/disable the use of hinting on the text.
+ * @autohint: Force the use of the autohinter provided through FreeType.
+ *
+ * Enable/disable the use of hinting in a text layer.
+ *
+ * This procedure enables or disables hinting on the text of a text
+ * layer. If you enable 'auto-hint', FreeType\'s automatic hinter will
+ * be used and hinting information from the font will be ignored.
+ *
+ * Deprecated: Use gimp_text_layer_set_hint_style() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_hinting (gint32 layer_ID,
+ gboolean hinting,
+ gboolean autohint)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-layer-set-hinting",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, hinting,
+ GIMP_PDB_INT32, autohint,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimptextlayer_pdb.h b/libgimp/gimptextlayer_pdb.h
new file mode 100644
index 0000000..0f286e8
--- /dev/null
+++ b/libgimp/gimptextlayer_pdb.h
@@ -0,0 +1,97 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimptextlayer_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_TEXT_LAYER_PDB_H__
+#define __GIMP_TEXT_LAYER_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gint32 gimp_text_layer_new (gint32 image_ID,
+ const gchar *text,
+ const gchar *fontname,
+ gdouble size,
+ GimpUnit unit);
+gchar* gimp_text_layer_get_text (gint32 layer_ID);
+gboolean gimp_text_layer_set_text (gint32 layer_ID,
+ const gchar *text);
+gchar* gimp_text_layer_get_markup (gint32 layer_ID);
+gchar* gimp_text_layer_get_font (gint32 layer_ID);
+gboolean gimp_text_layer_set_font (gint32 layer_ID,
+ const gchar *font);
+gdouble gimp_text_layer_get_font_size (gint32 layer_ID,
+ GimpUnit *unit);
+gboolean gimp_text_layer_set_font_size (gint32 layer_ID,
+ gdouble font_size,
+ GimpUnit unit);
+gboolean gimp_text_layer_get_antialias (gint32 layer_ID);
+gboolean gimp_text_layer_set_antialias (gint32 layer_ID,
+ gboolean antialias);
+GimpTextHintStyle gimp_text_layer_get_hint_style (gint32 layer_ID);
+gboolean gimp_text_layer_set_hint_style (gint32 layer_ID,
+ GimpTextHintStyle style);
+gboolean gimp_text_layer_get_kerning (gint32 layer_ID);
+gboolean gimp_text_layer_set_kerning (gint32 layer_ID,
+ gboolean kerning);
+gchar* gimp_text_layer_get_language (gint32 layer_ID);
+gboolean gimp_text_layer_set_language (gint32 layer_ID,
+ const gchar *language);
+GimpTextDirection gimp_text_layer_get_base_direction (gint32 layer_ID);
+gboolean gimp_text_layer_set_base_direction (gint32 layer_ID,
+ GimpTextDirection direction);
+GimpTextJustification gimp_text_layer_get_justification (gint32 layer_ID);
+gboolean gimp_text_layer_set_justification (gint32 layer_ID,
+ GimpTextJustification justify);
+gboolean gimp_text_layer_get_color (gint32 layer_ID,
+ GimpRGB *color);
+gboolean gimp_text_layer_set_color (gint32 layer_ID,
+ const GimpRGB *color);
+gdouble gimp_text_layer_get_indent (gint32 layer_ID);
+gboolean gimp_text_layer_set_indent (gint32 layer_ID,
+ gdouble indent);
+gdouble gimp_text_layer_get_line_spacing (gint32 layer_ID);
+gboolean gimp_text_layer_set_line_spacing (gint32 layer_ID,
+ gdouble line_spacing);
+gdouble gimp_text_layer_get_letter_spacing (gint32 layer_ID);
+gboolean gimp_text_layer_set_letter_spacing (gint32 layer_ID,
+ gdouble letter_spacing);
+gboolean gimp_text_layer_resize (gint32 layer_ID,
+ gdouble width,
+ gdouble height);
+GIMP_DEPRECATED_FOR(gimp_text_layer_get_hint_style)
+gboolean gimp_text_layer_get_hinting (gint32 layer_ID,
+ gboolean *autohint);
+GIMP_DEPRECATED_FOR(gimp_text_layer_set_hint_style)
+gboolean gimp_text_layer_set_hinting (gint32 layer_ID,
+ gboolean hinting,
+ gboolean autohint);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_TEXT_LAYER_PDB_H__ */
diff --git a/libgimp/gimptexttool_pdb.c b/libgimp/gimptexttool_pdb.c
new file mode 100644
index 0000000..12fd893
--- /dev/null
+++ b/libgimp/gimptexttool_pdb.c
@@ -0,0 +1,324 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimptexttool_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimptexttool
+ * @title: gimptexttool
+ * @short_description: Functions for controlling the text tool.
+ *
+ * Functions for controlling the text tool.
+ **/
+
+
+/**
+ * gimp_text_fontname:
+ * @image_ID: The image.
+ * @drawable_ID: The affected drawable: (-1 for a new text layer).
+ * @x: The x coordinate for the left of the text bounding box.
+ * @y: The y coordinate for the top of the text bounding box.
+ * @text: The text to generate (in UTF-8 encoding).
+ * @border: The size of the border.
+ * @antialias: Antialiasing.
+ * @size: The size of text in either pixels or points.
+ * @size_type: The units of specified size.
+ * @fontname: The name of the font.
+ *
+ * Add text at the specified location as a floating selection or a new
+ * layer.
+ *
+ * This tool requires a fontname matching an installed PangoFT2 font.
+ * You can specify the fontsize in units of pixels or points, and the
+ * appropriate metric is specified using the size_type argument. The x
+ * and y parameters together control the placement of the new text by
+ * specifying the upper left corner of the text bounding box. If the
+ * specified drawable parameter is valid, the text will be created as a
+ * floating selection attached to the drawable. If the drawable
+ * parameter is not valid (-1), the text will appear as a new layer.
+ * Finally, a border can be specified around the final rendered text.
+ * The border is measured in pixels. Parameter size-type is not used
+ * and is currently ignored. If you need to display a font in points,
+ * divide the size in points by 72.0 and multiply it by the image's
+ * vertical resolution.
+ *
+ * Returns: The new text layer or -1 if no layer was created.
+ **/
+gint32
+gimp_text_fontname (gint32 image_ID,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ const gchar *text,
+ gint border,
+ gboolean antialias,
+ gdouble size,
+ GimpSizeType size_type,
+ const gchar *fontname)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 text_layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-text-fontname",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_STRING, text,
+ GIMP_PDB_INT32, border,
+ GIMP_PDB_INT32, antialias,
+ GIMP_PDB_FLOAT, size,
+ GIMP_PDB_INT32, size_type,
+ GIMP_PDB_STRING, fontname,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ text_layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return text_layer_ID;
+}
+
+/**
+ * gimp_text_get_extents_fontname:
+ * @text: The text to generate (in UTF-8 encoding).
+ * @size: The size of text in either pixels or points.
+ * @size_type: The units of specified size.
+ * @fontname: The name of the font.
+ * @width: The width of the specified font.
+ * @height: The height of the specified font.
+ * @ascent: The ascent of the specified font.
+ * @descent: The descent of the specified font.
+ *
+ * Get extents of the bounding box for the specified text.
+ *
+ * This tool returns the width and height of a bounding box for the
+ * specified text string with the specified font information. Ascent
+ * and descent for the specified font are returned as well. Parameter
+ * size-type is not used and is currently ignored. If you need to
+ * display a font in points, divide the size in points by 72.0 and
+ * multiply it by the vertical resolution of the image you are taking
+ * into account.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_text_get_extents_fontname (const gchar *text,
+ gdouble size,
+ GimpSizeType size_type,
+ const gchar *fontname,
+ gint *width,
+ gint *height,
+ gint *ascent,
+ gint *descent)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-get-extents-fontname",
+ &nreturn_vals,
+ GIMP_PDB_STRING, text,
+ GIMP_PDB_FLOAT, size,
+ GIMP_PDB_INT32, size_type,
+ GIMP_PDB_STRING, fontname,
+ GIMP_PDB_END);
+
+ *width = 0;
+ *height = 0;
+ *ascent = 0;
+ *descent = 0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *width = return_vals[1].data.d_int32;
+ *height = return_vals[2].data.d_int32;
+ *ascent = return_vals[3].data.d_int32;
+ *descent = return_vals[4].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text:
+ * @image_ID: The image.
+ * @drawable_ID: The affected drawable: (-1 for a new text layer).
+ * @x: The x coordinate for the left of the text bounding box.
+ * @y: The y coordinate for the top of the text bounding box.
+ * @text: The text to generate (in UTF-8 encoding).
+ * @border: The size of the border.
+ * @antialias: Antialiasing.
+ * @size: The size of text in either pixels or points.
+ * @size_type: The units of specified size.
+ * @foundry: The font foundry.
+ * @family: The font family.
+ * @weight: The font weight.
+ * @slant: The font slant.
+ * @set_width: The font set-width.
+ * @spacing: The font spacing.
+ * @registry: The font registry.
+ * @encoding: The font encoding.
+ *
+ * Deprecated: Use gimp_text_fontname() instead.
+ *
+ * Returns: The new text layer or -1 if no layer was created.
+ **/
+gint32
+gimp_text (gint32 image_ID,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ const gchar *text,
+ gint border,
+ gboolean antialias,
+ gdouble size,
+ GimpSizeType size_type,
+ const gchar *foundry,
+ const gchar *family,
+ const gchar *weight,
+ const gchar *slant,
+ const gchar *set_width,
+ const gchar *spacing,
+ const gchar *registry,
+ const gchar *encoding)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 text_layer_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-text",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, x,
+ GIMP_PDB_FLOAT, y,
+ GIMP_PDB_STRING, text,
+ GIMP_PDB_INT32, border,
+ GIMP_PDB_INT32, antialias,
+ GIMP_PDB_FLOAT, size,
+ GIMP_PDB_INT32, size_type,
+ GIMP_PDB_STRING, foundry,
+ GIMP_PDB_STRING, family,
+ GIMP_PDB_STRING, weight,
+ GIMP_PDB_STRING, slant,
+ GIMP_PDB_STRING, set_width,
+ GIMP_PDB_STRING, spacing,
+ GIMP_PDB_STRING, registry,
+ GIMP_PDB_STRING, encoding,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ text_layer_ID = return_vals[1].data.d_layer;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return text_layer_ID;
+}
+
+/**
+ * gimp_text_get_extents:
+ * @text: The text to generate (in UTF-8 encoding).
+ * @size: The size of text in either pixels or points.
+ * @size_type: The units of specified size.
+ * @foundry: The font foundry.
+ * @family: The font family.
+ * @weight: The font weight.
+ * @slant: The font slant.
+ * @set_width: The font set-width.
+ * @spacing: The font spacing.
+ * @registry: The font registry.
+ * @encoding: The font encoding.
+ * @width: The width of the specified font.
+ * @height: The height of the specified font.
+ * @ascent: The ascent of the specified font.
+ * @descent: The descent of the specified font.
+ *
+ * Deprecated: Use gimp_text_get_extents_fontname() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_text_get_extents (const gchar *text,
+ gdouble size,
+ GimpSizeType size_type,
+ const gchar *foundry,
+ const gchar *family,
+ const gchar *weight,
+ const gchar *slant,
+ const gchar *set_width,
+ const gchar *spacing,
+ const gchar *registry,
+ const gchar *encoding,
+ gint *width,
+ gint *height,
+ gint *ascent,
+ gint *descent)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-text-get-extents",
+ &nreturn_vals,
+ GIMP_PDB_STRING, text,
+ GIMP_PDB_FLOAT, size,
+ GIMP_PDB_INT32, size_type,
+ GIMP_PDB_STRING, foundry,
+ GIMP_PDB_STRING, family,
+ GIMP_PDB_STRING, weight,
+ GIMP_PDB_STRING, slant,
+ GIMP_PDB_STRING, set_width,
+ GIMP_PDB_STRING, spacing,
+ GIMP_PDB_STRING, registry,
+ GIMP_PDB_STRING, encoding,
+ GIMP_PDB_END);
+
+ *width = 0;
+ *height = 0;
+ *ascent = 0;
+ *descent = 0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *width = return_vals[1].data.d_int32;
+ *height = return_vals[2].data.d_int32;
+ *ascent = return_vals[3].data.d_int32;
+ *descent = return_vals[4].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimptexttool_pdb.h b/libgimp/gimptexttool_pdb.h
new file mode 100644
index 0000000..05d1dfb
--- /dev/null
+++ b/libgimp/gimptexttool_pdb.h
@@ -0,0 +1,91 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimptexttool_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_TEXT_TOOL_PDB_H__
+#define __GIMP_TEXT_TOOL_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gint32 gimp_text_fontname (gint32 image_ID,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ const gchar *text,
+ gint border,
+ gboolean antialias,
+ gdouble size,
+ GimpSizeType size_type,
+ const gchar *fontname);
+gboolean gimp_text_get_extents_fontname (const gchar *text,
+ gdouble size,
+ GimpSizeType size_type,
+ const gchar *fontname,
+ gint *width,
+ gint *height,
+ gint *ascent,
+ gint *descent);
+GIMP_DEPRECATED_FOR(gimp_text_fontname)
+gint32 gimp_text (gint32 image_ID,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ const gchar *text,
+ gint border,
+ gboolean antialias,
+ gdouble size,
+ GimpSizeType size_type,
+ const gchar *foundry,
+ const gchar *family,
+ const gchar *weight,
+ const gchar *slant,
+ const gchar *set_width,
+ const gchar *spacing,
+ const gchar *registry,
+ const gchar *encoding);
+GIMP_DEPRECATED_FOR(gimp_text_get_extents_fontname)
+gboolean gimp_text_get_extents (const gchar *text,
+ gdouble size,
+ GimpSizeType size_type,
+ const gchar *foundry,
+ const gchar *family,
+ const gchar *weight,
+ const gchar *slant,
+ const gchar *set_width,
+ const gchar *spacing,
+ const gchar *registry,
+ const gchar *encoding,
+ gint *width,
+ gint *height,
+ gint *ascent,
+ gint *descent);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_TEXT_TOOL_PDB_H__ */
diff --git a/libgimp/gimptile.c b/libgimp/gimptile.c
new file mode 100644
index 0000000..4570ebb
--- /dev/null
+++ b/libgimp/gimptile.c
@@ -0,0 +1,433 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimptile.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gio/gio.h>
+
+#define GIMP_DISABLE_DEPRECATION_WARNINGS
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpbase/gimpprotocol.h"
+#include "libgimpbase/gimpwire.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimptile
+ * @title: gimptile
+ * @short_description: Functions for working with tiles.
+ *
+ * Functions for working with tiles.
+ **/
+
+
+/* This is the percentage of the maximum cache size that
+ * should be cleared from the cache when an eviction is
+ * necessary.
+ */
+#define FREE_QUANTUM 0.1
+
+
+void gimp_read_expect_msg (GimpWireMessage *msg,
+ gint type);
+
+static void gimp_tile_get (GimpTile *tile);
+static void gimp_tile_put (GimpTile *tile);
+static void gimp_tile_cache_insert (GimpTile *tile);
+static void gimp_tile_cache_flush (GimpTile *tile);
+
+
+/* private variables */
+
+static GHashTable * tile_hash_table = NULL;
+static GList * tile_list_head = NULL;
+static GList * tile_list_tail = NULL;
+static gulong max_tile_size = 0;
+static gulong cur_cache_size = 0;
+static gulong max_cache_size = 0;
+
+
+/* public functions */
+
+void
+gimp_tile_ref (GimpTile *tile)
+{
+ g_return_if_fail (tile != NULL);
+
+ tile->ref_count++;
+
+ if (tile->ref_count == 1)
+ {
+ gimp_tile_get (tile);
+ tile->dirty = FALSE;
+ }
+
+ gimp_tile_cache_insert (tile);
+}
+
+void
+gimp_tile_ref_zero (GimpTile *tile)
+{
+ g_return_if_fail (tile != NULL);
+
+ tile->ref_count++;
+
+ if (tile->ref_count == 1)
+ tile->data = g_new0 (guchar, tile->ewidth * tile->eheight * tile->bpp);
+
+ gimp_tile_cache_insert (tile);
+}
+
+void
+_gimp_tile_ref_nocache (GimpTile *tile,
+ gboolean init)
+{
+ g_return_if_fail (tile != NULL);
+
+ tile->ref_count++;
+
+ if (tile->ref_count == 1)
+ {
+ if (init)
+ {
+ gimp_tile_get (tile);
+ tile->dirty = FALSE;
+ }
+ else
+ {
+ tile->data = g_new (guchar, tile->ewidth * tile->eheight * tile->bpp);
+ }
+ }
+}
+
+void
+gimp_tile_unref (GimpTile *tile,
+ gboolean dirty)
+{
+ g_return_if_fail (tile != NULL);
+ g_return_if_fail (tile->ref_count > 0);
+
+ tile->ref_count--;
+ tile->dirty |= dirty;
+
+ if (tile->ref_count == 0)
+ {
+ gimp_tile_flush (tile);
+ g_free (tile->data);
+ tile->data = NULL;
+ }
+}
+
+void
+gimp_tile_flush (GimpTile *tile)
+{
+ g_return_if_fail (tile != NULL);
+
+ if (tile->data && tile->dirty)
+ {
+ gimp_tile_put (tile);
+ tile->dirty = FALSE;
+ }
+}
+
+/**
+ * gimp_tile_cache_size:
+ * @kilobytes: new cache size in kilobytes
+ *
+ * Sets the size of the tile cache on the plug-in side. The tile cache
+ * is used to reduce the number of tiles exchanged between the GIMP core
+ * and the plug-in. See also gimp_tile_cache_ntiles().
+ **/
+void
+gimp_tile_cache_size (gulong kilobytes)
+{
+ max_cache_size = kilobytes * 1024;
+}
+
+/**
+ * gimp_tile_cache_ntiles:
+ * @ntiles: number of tiles that should fit into the cache
+ *
+ * Sets the size of the tile cache on the plug-in side. This function
+ * is similar to gimp_tile_cache_size() but supports specifying the
+ * number of tiles directly.
+ *
+ * If your plug-in access pixels tile-by-tile, it doesn't need a tile
+ * cache at all. If however the plug-in accesses drawable pixel data
+ * row-by-row, it should set the tile cache large enough to hold the
+ * number of tiles per row. Double this size if your plug-in uses
+ * shadow tiles.
+ **/
+void
+gimp_tile_cache_ntiles (gulong ntiles)
+{
+ gimp_tile_cache_size ((ntiles *
+ gimp_tile_width () *
+ gimp_tile_height () * 4 + 1023) / 1024);
+}
+
+void
+_gimp_tile_cache_flush_drawable (GimpDrawable *drawable)
+{
+ GList *list;
+
+ g_return_if_fail (drawable != NULL);
+
+ list = tile_list_head;
+ while (list)
+ {
+ GimpTile *tile = list->data;
+
+ list = list->next;
+
+ if (tile->drawable == drawable)
+ gimp_tile_cache_flush (tile);
+ }
+}
+
+
+/* private functions */
+
+static void
+gimp_tile_get (GimpTile *tile)
+{
+ extern GIOChannel *_writechannel;
+
+ GPTileReq tile_req;
+ GPTileData *tile_data;
+ GimpWireMessage msg;
+
+ tile_req.drawable_ID = tile->drawable->drawable_id;
+ tile_req.tile_num = tile->tile_num;
+ tile_req.shadow = tile->shadow;
+
+ if (! gp_tile_req_write (_writechannel, &tile_req, NULL))
+ gimp_quit ();
+
+ gimp_read_expect_msg (&msg, GP_TILE_DATA);
+
+ tile_data = msg.data;
+ if (tile_data->drawable_ID != tile->drawable->drawable_id ||
+ tile_data->tile_num != tile->tile_num ||
+ tile_data->shadow != tile->shadow ||
+ tile_data->width != tile->ewidth ||
+ tile_data->height != tile->eheight ||
+ tile_data->bpp != tile->bpp)
+ {
+ g_message ("received tile info did not match computed tile info");
+ gimp_quit ();
+ }
+
+ if (tile_data->use_shm)
+ {
+ tile->data = g_memdup (gimp_shm_addr (),
+ tile->ewidth * tile->eheight * tile->bpp);
+ }
+ else
+ {
+ tile->data = tile_data->data;
+ tile_data->data = NULL;
+ }
+
+ if (! gp_tile_ack_write (_writechannel, NULL))
+ gimp_quit ();
+
+ gimp_wire_destroy (&msg);
+}
+
+static void
+gimp_tile_put (GimpTile *tile)
+{
+ extern GIOChannel *_writechannel;
+
+ GPTileReq tile_req;
+ GPTileData tile_data;
+ GPTileData *tile_info;
+ GimpWireMessage msg;
+
+ tile_req.drawable_ID = -1;
+ tile_req.tile_num = 0;
+ tile_req.shadow = 0;
+
+ if (! gp_tile_req_write (_writechannel, &tile_req, NULL))
+ gimp_quit ();
+
+ gimp_read_expect_msg (&msg, GP_TILE_DATA);
+
+ tile_info = msg.data;
+
+ tile_data.drawable_ID = tile->drawable->drawable_id;
+ tile_data.tile_num = tile->tile_num;
+ tile_data.shadow = tile->shadow;
+ tile_data.bpp = tile->bpp;
+ tile_data.width = tile->ewidth;
+ tile_data.height = tile->eheight;
+ tile_data.use_shm = tile_info->use_shm;
+ tile_data.data = NULL;
+
+ if (tile_info->use_shm)
+ memcpy (gimp_shm_addr (),
+ tile->data,
+ tile->ewidth * tile->eheight * tile->bpp);
+ else
+ tile_data.data = tile->data;
+
+ if (! gp_tile_data_write (_writechannel, &tile_data, NULL))
+ gimp_quit ();
+
+ if (! tile_info->use_shm)
+ tile_data.data = NULL;
+
+ gimp_wire_destroy (&msg);
+
+ gimp_read_expect_msg (&msg, GP_TILE_ACK);
+
+ gimp_wire_destroy (&msg);
+}
+
+/* This function is nearly identical to the function 'tile_cache_insert'
+ * in the file 'tile_cache.c' which is part of the main gimp application.
+ */
+static void
+gimp_tile_cache_insert (GimpTile *tile)
+{
+ GList *list;
+
+ if (!tile_hash_table)
+ {
+ tile_hash_table = g_hash_table_new (g_direct_hash, NULL);
+ max_tile_size = gimp_tile_width () * gimp_tile_height () * 4;
+ }
+
+ /* First check and see if the tile is already
+ * in the cache. In that case we will simply place
+ * it at the end of the tile list to indicate that
+ * it was the most recently accessed tile.
+ */
+ list = g_hash_table_lookup (tile_hash_table, tile);
+
+ if (list)
+ {
+ /* The tile was already in the cache. Place it at
+ * the end of the tile list.
+ */
+
+ /* If the tile is already at the end of the list, we are done */
+ if (list == tile_list_tail)
+ return;
+
+ /* At this point we have at least two elements in our list */
+ g_assert (tile_list_head != tile_list_tail);
+
+ tile_list_head = g_list_remove_link (tile_list_head, list);
+
+ tile_list_tail = g_list_last (g_list_concat (tile_list_tail, list));
+ }
+ else
+ {
+ /* The tile was not in the cache. First check and see
+ * if there is room in the cache. If not then we'll have
+ * to make room first. Note: it might be the case that the
+ * cache is smaller than the size of a tile in which case
+ * it won't be possible to put it in the cache.
+ */
+
+ if ((cur_cache_size + max_tile_size) > max_cache_size)
+ {
+ while (tile_list_head &&
+ (cur_cache_size +
+ max_cache_size * FREE_QUANTUM) > max_cache_size)
+ {
+ gimp_tile_cache_flush ((GimpTile *) tile_list_head->data);
+ }
+
+ if ((cur_cache_size + max_tile_size) > max_cache_size)
+ return;
+ }
+
+ /* Place the tile at the end of the tile list.
+ */
+ tile_list_tail = g_list_append (tile_list_tail, tile);
+
+ if (! tile_list_head)
+ tile_list_head = tile_list_tail;
+
+ tile_list_tail = g_list_last (tile_list_tail);
+
+ /* Add the tiles list node to the tile hash table.
+ */
+ g_hash_table_insert (tile_hash_table, tile, tile_list_tail);
+
+ /* Note the increase in the number of bytes the cache
+ * is referencing.
+ */
+ cur_cache_size += max_tile_size;
+
+ /* Reference the tile so that it won't be returned to
+ * the main gimp application immediately.
+ */
+ tile->ref_count++;
+ }
+}
+
+static void
+gimp_tile_cache_flush (GimpTile *tile)
+{
+ GList *list;
+
+ if (! tile_hash_table)
+ return;
+
+ /* Find where the tile is in the cache.
+ */
+ list = g_hash_table_lookup (tile_hash_table, tile);
+
+ if (list)
+ {
+ /* If the tile is in the cache, then remove it from the
+ * tile list.
+ */
+ if (list == tile_list_tail)
+ tile_list_tail = tile_list_tail->prev;
+
+ tile_list_head = g_list_remove_link (tile_list_head, list);
+
+ if (! tile_list_head)
+ tile_list_tail = NULL;
+
+ /* Remove the tile from the tile hash table.
+ */
+ g_hash_table_remove (tile_hash_table, tile);
+ g_list_free (list);
+
+ /* Note the decrease in the number of bytes the cache
+ * is referencing.
+ */
+ cur_cache_size -= max_tile_size;
+
+ /* Unreference the tile.
+ */
+ gimp_tile_unref (tile, FALSE);
+ }
+}
diff --git a/libgimp/gimptile.h b/libgimp/gimptile.h
new file mode 100644
index 0000000..50b54da
--- /dev/null
+++ b/libgimp/gimptile.h
@@ -0,0 +1,73 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimptile.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_TILE_H__
+#define __GIMP_TILE_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+struct _GimpTile
+{
+ guint ewidth; /* the effective width of the tile */
+ guint eheight; /* the effective height of the tile */
+ guint bpp; /* the bytes per pixel (1, 2, 3 or 4 ) */
+ guint tile_num; /* the number of this tile within the drawable */
+ guint16 ref_count; /* reference count for the tile */
+ guint dirty : 1; /* is the tile dirty? has it been modified? */
+ guint shadow: 1; /* is this a shadow tile */
+ guchar *data; /* the pixel data for the tile */
+ GimpDrawable *drawable; /* the drawable this tile came from */
+};
+
+
+GIMP_DEPRECATED
+void gimp_tile_ref (GimpTile *tile);
+GIMP_DEPRECATED
+void gimp_tile_ref_zero (GimpTile *tile);
+GIMP_DEPRECATED
+void gimp_tile_unref (GimpTile *tile,
+ gboolean dirty);
+GIMP_DEPRECATED
+void gimp_tile_flush (GimpTile *tile);
+
+GIMP_DEPRECATED
+void gimp_tile_cache_size (gulong kilobytes);
+GIMP_DEPRECATED
+void gimp_tile_cache_ntiles (gulong ntiles);
+
+
+/* private function */
+
+G_GNUC_INTERNAL void _gimp_tile_ref_nocache (GimpTile *tile,
+ gboolean init);
+
+G_GNUC_INTERNAL void _gimp_tile_cache_flush_drawable (GimpDrawable *drawable);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_TILE_H__ */
diff --git a/libgimp/gimptilebackendplugin.c b/libgimp/gimptilebackendplugin.c
new file mode 100644
index 0000000..d1767fa
--- /dev/null
+++ b/libgimp/gimptilebackendplugin.c
@@ -0,0 +1,313 @@
+/* gimptilebackendtilemanager.c
+ * Copyright (C) 2012 Øyvind Kolås <pippin@gimp.org>
+ *
+ * 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 <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <gegl.h>
+
+#define GIMP_DISABLE_DEPRECATION_WARNINGS
+
+#include "gimp.h"
+#include "gimptilebackendplugin.h"
+
+
+#define TILE_WIDTH gimp_tile_width()
+#define TILE_HEIGHT gimp_tile_height()
+
+
+struct _GimpTileBackendPluginPrivate
+{
+ GimpDrawable *drawable;
+ gboolean shadow;
+ gint mul;
+};
+
+
+static gint
+gimp_gegl_tile_mul (void)
+{
+ static gint mul = 1;
+ static gboolean inited = FALSE;
+
+ if (G_LIKELY (inited))
+ return mul;
+
+ inited = TRUE;
+
+ if (g_getenv ("GIMP_GEGL_TILE_MUL"))
+ mul = atoi (g_getenv ("GIMP_GEGL_TILE_MUL"));
+
+ if (mul < 1)
+ mul = 1;
+
+ return mul;
+}
+
+static void gimp_tile_backend_plugin_finalize (GObject *object);
+static gpointer gimp_tile_backend_plugin_command (GeglTileSource *tile_store,
+ GeglTileCommand command,
+ gint x,
+ gint y,
+ gint z,
+ gpointer data);
+
+static void gimp_tile_write_mul (GimpTileBackendPlugin *backend_plugin,
+ gint x,
+ gint y,
+ guchar *source);
+
+static GeglTile * gimp_tile_read_mul (GimpTileBackendPlugin *backend_plugin,
+ gint x,
+ gint y);
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpTileBackendPlugin, _gimp_tile_backend_plugin,
+ GEGL_TYPE_TILE_BACKEND)
+
+#define parent_class _gimp_tile_backend_plugin_parent_class
+
+
+static GMutex backend_plugin_mutex;
+
+
+static void
+_gimp_tile_backend_plugin_class_init (GimpTileBackendPluginClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gimp_tile_backend_plugin_finalize;
+}
+
+static void
+_gimp_tile_backend_plugin_init (GimpTileBackendPlugin *backend)
+{
+ GeglTileSource *source = GEGL_TILE_SOURCE (backend);
+
+ backend->priv = _gimp_tile_backend_plugin_get_instance_private (backend);
+
+ source->command = gimp_tile_backend_plugin_command;
+}
+
+static void
+gimp_tile_backend_plugin_finalize (GObject *object)
+{
+ GimpTileBackendPlugin *backend = GIMP_TILE_BACKEND_PLUGIN (object);
+
+ if (backend->priv->drawable) /* This also causes a flush */
+ gimp_drawable_detach (backend->priv->drawable);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gpointer
+gimp_tile_backend_plugin_command (GeglTileSource *tile_store,
+ GeglTileCommand command,
+ gint x,
+ gint y,
+ gint z,
+ gpointer data)
+{
+ GimpTileBackendPlugin *backend_plugin = GIMP_TILE_BACKEND_PLUGIN (tile_store);
+ gpointer result = NULL;
+
+ switch (command)
+ {
+ case GEGL_TILE_GET:
+ /* TODO: fetch mipmapped tiles directly from gimp, instead of returning
+ * NULL to render them locally
+ */
+ if (z == 0)
+ {
+ g_mutex_lock (&backend_plugin_mutex);
+
+ result = gimp_tile_read_mul (backend_plugin, x, y);
+
+ g_mutex_unlock (&backend_plugin_mutex);
+ }
+ break;
+
+ case GEGL_TILE_SET:
+ /* TODO: actually store mipmapped tiles */
+ if (z == 0)
+ {
+ g_mutex_lock (&backend_plugin_mutex);
+
+ gimp_tile_write_mul (backend_plugin, x, y, gegl_tile_get_data (data));
+
+ g_mutex_unlock (&backend_plugin_mutex);
+ }
+
+ gegl_tile_mark_as_stored (data);
+ break;
+
+ case GEGL_TILE_FLUSH:
+ g_mutex_lock (&backend_plugin_mutex);
+
+ gimp_drawable_flush (backend_plugin->priv->drawable);
+
+ g_mutex_unlock (&backend_plugin_mutex);
+ break;
+
+ default:
+ result = gegl_tile_backend_command (GEGL_TILE_BACKEND (tile_store),
+ command, x, y, z, data);
+ break;
+ }
+
+ return result;
+}
+
+static GeglTile *
+gimp_tile_read_mul (GimpTileBackendPlugin *backend_plugin,
+ gint x,
+ gint y)
+{
+ GimpTileBackendPluginPrivate *priv = backend_plugin->priv;
+ GeglTileBackend *backend = GEGL_TILE_BACKEND (backend_plugin);
+ GeglTile *tile;
+ gint tile_size;
+ gint u, v;
+ gint mul = priv->mul;
+ guchar *tile_data;
+
+ x *= mul;
+ y *= mul;
+
+ tile_size = gegl_tile_backend_get_tile_size (backend);
+ tile = gegl_tile_new (tile_size);
+ tile_data = gegl_tile_get_data (tile);
+
+ for (u = 0; u < mul; u++)
+ {
+ for (v = 0; v < mul; v++)
+ {
+ GimpTile *gimp_tile;
+
+ if (x + u >= priv->drawable->ntile_cols ||
+ y + v >= priv->drawable->ntile_rows)
+ continue;
+
+ gimp_tile = gimp_drawable_get_tile (priv->drawable,
+ priv->shadow,
+ y + v, x + u);
+ _gimp_tile_ref_nocache (gimp_tile, TRUE);
+
+ {
+ gint ewidth = gimp_tile->ewidth;
+ gint eheight = gimp_tile->eheight;
+ gint bpp = gimp_tile->bpp;
+ gint tile_stride = mul * TILE_WIDTH * bpp;
+ gint gimp_tile_stride = ewidth * bpp;
+ gint row;
+
+ for (row = 0; row < eheight; row++)
+ {
+ memcpy (tile_data + (row + TILE_HEIGHT * v) *
+ tile_stride + u * TILE_WIDTH * bpp,
+ ((gchar *) gimp_tile->data) + row * gimp_tile_stride,
+ gimp_tile_stride);
+ }
+ }
+
+ gimp_tile_unref (gimp_tile, FALSE);
+ }
+ }
+
+ return tile;
+}
+
+static void
+gimp_tile_write_mul (GimpTileBackendPlugin *backend_plugin,
+ gint x,
+ gint y,
+ guchar *source)
+{
+ GimpTileBackendPluginPrivate *priv = backend_plugin->priv;
+ gint u, v;
+ gint mul = priv->mul;
+
+ x *= mul;
+ y *= mul;
+
+ for (v = 0; v < mul; v++)
+ {
+ for (u = 0; u < mul; u++)
+ {
+ GimpTile *gimp_tile;
+
+ if (x + u >= priv->drawable->ntile_cols ||
+ y + v >= priv->drawable->ntile_rows)
+ continue;
+
+ gimp_tile = gimp_drawable_get_tile (priv->drawable,
+ priv->shadow,
+ y+v, x+u);
+ _gimp_tile_ref_nocache (gimp_tile, FALSE);
+
+ {
+ gint ewidth = gimp_tile->ewidth;
+ gint eheight = gimp_tile->eheight;
+ gint bpp = gimp_tile->bpp;
+ gint tile_stride = mul * TILE_WIDTH * bpp;
+ gint gimp_tile_stride = ewidth * bpp;
+ gint row;
+
+ for (row = 0; row < eheight; row++)
+ memcpy (((gchar *)gimp_tile->data) + row * gimp_tile_stride,
+ source + (row + v * TILE_HEIGHT) *
+ tile_stride + u * TILE_WIDTH * bpp,
+ gimp_tile_stride);
+ }
+
+ gimp_tile_unref (gimp_tile, TRUE);
+ }
+ }
+}
+
+GeglTileBackend *
+_gimp_tile_backend_plugin_new (GimpDrawable *drawable,
+ gint shadow)
+{
+ GeglTileBackend *backend;
+ GimpTileBackendPlugin *backend_plugin;
+ const Babl *format;
+ gint width = gimp_drawable_width (drawable->drawable_id);
+ gint height = gimp_drawable_height (drawable->drawable_id);
+ gint mul = gimp_gegl_tile_mul ();
+
+ format = gimp_drawable_get_format (drawable->drawable_id);
+
+ backend = g_object_new (GIMP_TYPE_TILE_BACKEND_PLUGIN,
+ "tile-width", TILE_WIDTH * mul,
+ "tile-height", TILE_HEIGHT * mul,
+ "format", format,
+ NULL);
+
+ backend_plugin = GIMP_TILE_BACKEND_PLUGIN (backend);
+
+ backend_plugin->priv->drawable = drawable;
+ backend_plugin->priv->mul = mul;
+ backend_plugin->priv->shadow = shadow;
+
+ gegl_tile_backend_set_extent (backend,
+ GEGL_RECTANGLE (0, 0, width, height));
+
+ return backend;
+}
diff --git a/libgimp/gimptilebackendplugin.h b/libgimp/gimptilebackendplugin.h
new file mode 100644
index 0000000..7ed9fad
--- /dev/null
+++ b/libgimp/gimptilebackendplugin.h
@@ -0,0 +1,59 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimptilebackendtilemanager.h
+ * Copyright (C) 2011 Øyvind Kolås <pippin@gimp.org>
+ *
+ * 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 <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_TILE_BACKEND_PLUGIN_H__
+#define __GIMP_TILE_BACKEND_PLUGIN_H__
+
+#include <gegl-buffer-backend.h>
+
+G_BEGIN_DECLS
+
+#define GIMP_TYPE_TILE_BACKEND_PLUGIN (_gimp_tile_backend_plugin_get_type ())
+#define GIMP_TILE_BACKEND_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_TILE_BACKEND_PLUGIN, GimpTileBackendPlugin))
+#define GIMP_TILE_BACKEND_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TILE_BACKEND_PLUGIN, GimpTileBackendPluginClass))
+#define GIMP_IS_TILE_BACKEND_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_TILE_BACKEND_PLUGIN))
+#define GIMP_IS_TILE_BACKEND_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TILE_BACKEND_PLUGIN))
+#define GIMP_TILE_BACKEND_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_TILE_BACKEND_PLUGIN, GimpTileBackendPluginClass))
+
+
+typedef struct _GimpTileBackendPlugin GimpTileBackendPlugin;
+typedef struct _GimpTileBackendPluginClass GimpTileBackendPluginClass;
+typedef struct _GimpTileBackendPluginPrivate GimpTileBackendPluginPrivate;
+
+struct _GimpTileBackendPlugin
+{
+ GeglTileBackend parent_instance;
+
+ GimpTileBackendPluginPrivate *priv;
+};
+
+struct _GimpTileBackendPluginClass
+{
+ GeglTileBackendClass parent_class;
+};
+
+GType _gimp_tile_backend_plugin_get_type (void) G_GNUC_CONST;
+
+GeglTileBackend * _gimp_tile_backend_plugin_new (GimpDrawable *drawable,
+ gint shadow);
+
+G_END_DECLS
+
+#endif /* __GIMP_TILE_BACKEND_plugin_H__ */
diff --git a/libgimp/gimptransformtools_pdb.c b/libgimp/gimptransformtools_pdb.c
new file mode 100644
index 0000000..759a768
--- /dev/null
+++ b/libgimp/gimptransformtools_pdb.c
@@ -0,0 +1,287 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimptransformtools_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimptransformtools
+ * @title: gimptransformtools
+ * @short_description: Access to toolbox transform tools.
+ *
+ * Functions giving access to toolbox transform tools.
+ **/
+
+
+/**
+ * gimp_flip:
+ * @drawable_ID: The affected drawable.
+ * @flip_type: Type of flip.
+ *
+ * Deprecated: Use gimp_item_transform_flip_simple() instead.
+ *
+ * Returns: The flipped drawable.
+ **/
+gint32
+gimp_flip (gint32 drawable_ID,
+ GimpOrientationType flip_type)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-flip",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, flip_type,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_perspective:
+ * @drawable_ID: The affected drawable.
+ * @interpolation: Whether to use interpolation.
+ * @x0: The new x coordinate of upper-left corner of original bounding box.
+ * @y0: The new y coordinate of upper-left corner of original bounding box.
+ * @x1: The new x coordinate of upper-right corner of original bounding box.
+ * @y1: The new y coordinate of upper-right corner of original bounding box.
+ * @x2: The new x coordinate of lower-left corner of original bounding box.
+ * @y2: The new y coordinate of lower-left corner of original bounding box.
+ * @x3: The new x coordinate of lower-right corner of original bounding box.
+ * @y3: The new y coordinate of lower-right corner of original bounding box.
+ *
+ * Deprecated: Use gimp_item_transform_perspective() instead.
+ *
+ * Returns: The newly mapped drawable.
+ **/
+gint32
+gimp_perspective (gint32 drawable_ID,
+ gboolean interpolation,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ gdouble x3,
+ gdouble y3)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-perspective",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_FLOAT, x2,
+ GIMP_PDB_FLOAT, y2,
+ GIMP_PDB_FLOAT, x3,
+ GIMP_PDB_FLOAT, y3,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_rotate:
+ * @drawable_ID: The affected drawable.
+ * @interpolation: Whether to use interpolation.
+ * @angle: The angle of rotation (radians).
+ *
+ * Deprecated: Use gimp_item_transform_rotate() instead.
+ *
+ * Returns: The rotated drawable.
+ **/
+gint32
+gimp_rotate (gint32 drawable_ID,
+ gboolean interpolation,
+ gdouble angle)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-rotate",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_FLOAT, angle,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_scale:
+ * @drawable_ID: The affected drawable.
+ * @interpolation: Whether to use interpolation.
+ * @x0: The new x coordinate of the upper-left corner of the scaled region.
+ * @y0: The new y coordinate of the upper-left corner of the scaled region.
+ * @x1: The new x coordinate of the lower-right corner of the scaled region.
+ * @y1: The new y coordinate of the lower-right corner of the scaled region.
+ *
+ * Deprecated: Use gimp_item_transform_scale() instead.
+ *
+ * Returns: The scaled drawable.
+ **/
+gint32
+gimp_scale (gint32 drawable_ID,
+ gboolean interpolation,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-scale",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_shear:
+ * @drawable_ID: The affected drawable.
+ * @interpolation: Whether to use interpolation.
+ * @shear_type: Type of shear.
+ * @magnitude: The magnitude of the shear.
+ *
+ * Deprecated: Use gimp_item_transform_shear() instead.
+ *
+ * Returns: The sheared drawable.
+ **/
+gint32
+gimp_shear (gint32 drawable_ID,
+ gboolean interpolation,
+ GimpOrientationType shear_type,
+ gdouble magnitude)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-shear",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_INT32, shear_type,
+ GIMP_PDB_FLOAT, magnitude,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
+
+/**
+ * gimp_transform_2d:
+ * @drawable_ID: The affected drawable.
+ * @interpolation: Whether to use interpolation.
+ * @source_x: X coordinate of the transformation center.
+ * @source_y: Y coordinate of the transformation center.
+ * @scale_x: Amount to scale in x direction.
+ * @scale_y: Amount to scale in y direction.
+ * @angle: The angle of rotation (radians).
+ * @dest_x: X coordinate of where the centre goes.
+ * @dest_y: Y coordinate of where the centre goes.
+ *
+ * Deprecated: Use gimp_item_transform_2d() instead.
+ *
+ * Returns: The transformed drawable.
+ **/
+gint32
+gimp_transform_2d (gint32 drawable_ID,
+ gboolean interpolation,
+ gdouble source_x,
+ gdouble source_y,
+ gdouble scale_x,
+ gdouble scale_y,
+ gdouble angle,
+ gdouble dest_x,
+ gdouble dest_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 ret_drawable_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-transform-2d",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_FLOAT, source_x,
+ GIMP_PDB_FLOAT, source_y,
+ GIMP_PDB_FLOAT, scale_x,
+ GIMP_PDB_FLOAT, scale_y,
+ GIMP_PDB_FLOAT, angle,
+ GIMP_PDB_FLOAT, dest_x,
+ GIMP_PDB_FLOAT, dest_y,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ ret_drawable_ID = return_vals[1].data.d_drawable;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return ret_drawable_ID;
+}
diff --git a/libgimp/gimptransformtools_pdb.h b/libgimp/gimptransformtools_pdb.h
new file mode 100644
index 0000000..6f53890
--- /dev/null
+++ b/libgimp/gimptransformtools_pdb.h
@@ -0,0 +1,79 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimptransformtools_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_TRANSFORM_TOOLS_PDB_H__
+#define __GIMP_TRANSFORM_TOOLS_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+GIMP_DEPRECATED_FOR(gimp_item_transform_flip_simple)
+gint32 gimp_flip (gint32 drawable_ID,
+ GimpOrientationType flip_type);
+GIMP_DEPRECATED_FOR(gimp_item_transform_perspective)
+gint32 gimp_perspective (gint32 drawable_ID,
+ gboolean interpolation,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ gdouble x3,
+ gdouble y3);
+GIMP_DEPRECATED_FOR(gimp_item_transform_rotate)
+gint32 gimp_rotate (gint32 drawable_ID,
+ gboolean interpolation,
+ gdouble angle);
+GIMP_DEPRECATED_FOR(gimp_item_transform_scale)
+gint32 gimp_scale (gint32 drawable_ID,
+ gboolean interpolation,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1);
+GIMP_DEPRECATED_FOR(gimp_item_transform_shear)
+gint32 gimp_shear (gint32 drawable_ID,
+ gboolean interpolation,
+ GimpOrientationType shear_type,
+ gdouble magnitude);
+GIMP_DEPRECATED_FOR(gimp_item_transform_2d)
+gint32 gimp_transform_2d (gint32 drawable_ID,
+ gboolean interpolation,
+ gdouble source_x,
+ gdouble source_y,
+ gdouble scale_x,
+ gdouble scale_y,
+ gdouble angle,
+ gdouble dest_x,
+ gdouble dest_y);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_TRANSFORM_TOOLS_PDB_H__ */
diff --git a/libgimp/gimptypes.h b/libgimp/gimptypes.h
new file mode 100644
index 0000000..6866dbe
--- /dev/null
+++ b/libgimp/gimptypes.h
@@ -0,0 +1,82 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimptypes.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#ifndef __GIMP_TYPES_H__
+#define __GIMP_TYPES_H__
+
+#include <libgimpbase/gimpbasetypes.h>
+
+G_BEGIN_DECLS
+
+/* For information look into the html documentation */
+
+
+typedef struct _GimpPlugInInfo GimpPlugInInfo;
+typedef struct _GimpTile GimpTile;
+typedef struct _GimpDrawable GimpDrawable;
+typedef struct _GimpPixelRgn GimpPixelRgn;
+typedef struct _GimpParamDef GimpParamDef;
+typedef struct _GimpParamRegion GimpParamRegion;
+typedef union _GimpParamData GimpParamData;
+typedef struct _GimpParam GimpParam;
+
+
+#ifndef GIMP_DISABLE_DEPRECATED
+
+/* This is so ugly it hurts. C++ won't let us have enum GimpLayerMode
+ * in the API where we used to have enum GimpLayerModeEffects, so
+ * typedef and define around to make it happy:
+ */
+typedef GimpLayerMode GimpLayerModeEffects;
+
+#define GIMP_NORMAL_MODE GIMP_LAYER_MODE_NORMAL_LEGACY
+#define GIMP_DISSOLVE_MODE GIMP_LAYER_MODE_DISSOLVE
+#define GIMP_BEHIND_MODE GIMP_LAYER_MODE_BEHIND_LEGACY
+#define GIMP_MULTIPLY_MODE GIMP_LAYER_MODE_MULTIPLY_LEGACY
+#define GIMP_SCREEN_MODE GIMP_LAYER_MODE_SCREEN_LEGACY
+#define GIMP_OVERLAY_MODE GIMP_LAYER_MODE_OVERLAY_LEGACY
+#define GIMP_DIFFERENCE_MODE GIMP_LAYER_MODE_DIFFERENCE_LEGACY
+#define GIMP_ADDITION_MODE GIMP_LAYER_MODE_ADDITION_LEGACY
+#define GIMP_SUBTRACT_MODE GIMP_LAYER_MODE_SUBTRACT_LEGACY
+#define GIMP_DARKEN_ONLY_MODE GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY
+#define GIMP_LIGHTEN_ONLY_MODE GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY
+#define GIMP_HUE_MODE GIMP_LAYER_MODE_HSV_HUE_LEGACY
+#define GIMP_SATURATION_MODE GIMP_LAYER_MODE_HSV_SATURATION_LEGACY
+#define GIMP_COLOR_MODE GIMP_LAYER_MODE_HSL_COLOR_LEGACY
+#define GIMP_VALUE_MODE GIMP_LAYER_MODE_HSV_VALUE_LEGACY
+#define GIMP_DIVIDE_MODE GIMP_LAYER_MODE_DIVIDE_LEGACY
+#define GIMP_DODGE_MODE GIMP_LAYER_MODE_DODGE_LEGACY
+#define GIMP_BURN_MODE GIMP_LAYER_MODE_BURN_LEGACY
+#define GIMP_HARDLIGHT_MODE GIMP_LAYER_MODE_HARDLIGHT_LEGACY
+#define GIMP_SOFTLIGHT_MODE GIMP_LAYER_MODE_SOFTLIGHT_LEGACY
+#define GIMP_GRAIN_EXTRACT_MODE GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY
+#define GIMP_GRAIN_MERGE_MODE GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY
+#define GIMP_COLOR_ERASE_MODE GIMP_LAYER_MODE_COLOR_ERASE_LEGACY
+
+#define GIMP_NO_DITHER GIMP_CONVERT_DITHER_NONE
+#define GIMP_FS_DITHER GIMP_CONVERT_DITHER_FS
+#define GIMP_FSLOWBLEED_DITHER GIMP_CONVERT_DITHER_FS_LOWBLEED
+#define GIMP_FIXED_DITHER GIMP_CONVERT_DITHER_FIXED
+
+#endif /* ! GIMP_DISABLE_DEPRECATED */
+
+G_END_DECLS
+
+#endif /* __GIMP_TYPES_H__ */
diff --git a/libgimp/gimpui.c b/libgimp/gimpui.c
new file mode 100644
index 0000000..04c316a
--- /dev/null
+++ b/libgimp/gimpui.c
@@ -0,0 +1,505 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#ifdef GDK_DISABLE_DEPRECATED
+#undef GDK_DISABLE_DEPRECATED
+#endif
+#include <gtk/gtk.h>
+
+#ifdef GDK_WINDOWING_WIN32
+#include <gdk/gdkwin32.h>
+#endif
+
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#endif
+
+#ifdef GDK_WINDOWING_QUARTZ
+#include <Cocoa/Cocoa.h>
+#endif
+
+#include "gimp.h"
+#include "gimpui.h"
+
+#include "libgimpmodule/gimpmodule.h"
+
+#include "libgimpwidgets/gimpwidgets.h"
+#include "libgimpwidgets/gimpwidgets-private.h"
+
+
+/**
+ * SECTION: gimpui
+ * @title: gimpui
+ * @short_description: Common user interface functions. This header includes
+ * all other GIMP User Interface Library headers.
+ * @see_also: gtk_init(), gdk_set_use_xshm(), gdk_rgb_get_visual(),
+ * gdk_rgb_get_cmap(), gtk_widget_set_default_visual(),
+ * gtk_widget_set_default_colormap(), gtk_preview_set_gamma().
+ *
+ * Common user interface functions. This header includes all other
+ * GIMP User Interface Library headers.
+ **/
+
+
+/* local function prototypes */
+
+static void gimp_ui_help_func (const gchar *help_id,
+ gpointer help_data);
+static void gimp_ensure_modules (void);
+static void gimp_window_transient_realized (GtkWidget *window,
+ GdkWindow *parent);
+static gboolean gimp_window_set_transient_for (GtkWindow *window,
+ GdkWindow *parent);
+
+static void gimp_ui_theme_changed (void);
+static void gimp_ui_fix_pixbuf_style (void);
+static void gimp_ui_draw_pixbuf_layout (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type,
+ gboolean use_text,
+ GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ gint x,
+ gint y,
+ PangoLayout *layout);
+#ifdef GDK_WINDOWING_QUARTZ
+static gboolean gimp_osx_focus_window (gpointer);
+#endif
+
+static gboolean gimp_ui_initialized = FALSE;
+
+
+/* public functions */
+
+/**
+ * gimp_ui_init:
+ * @prog_name: The name of the plug-in which will be passed as argv[0] to
+ * gtk_init(). It's a convention to use the name of the
+ * executable and _not_ the PDB procedure name.
+ * @preview: This parameter is unused and exists for historical
+ * reasons only.
+ *
+ * This function initializes GTK+ with gtk_init() and initializes GDK's
+ * image rendering subsystem (GdkRGB) to follow the GIMP main program's
+ * colormap allocation/installation policy.
+ *
+ * It also sets up various other things so that the plug-in user looks
+ * and behaves like the GIMP core. This includes selecting the GTK+
+ * theme and setting up the help system as chosen in the GIMP
+ * preferences. Any plug-in that provides a user interface should call
+ * this function.
+ **/
+void
+gimp_ui_init (const gchar *prog_name,
+ gboolean preview)
+{
+ GdkScreen *screen;
+ const gchar *display_name;
+ gchar *themerc;
+ GFileMonitor *rc_monitor;
+ GFile *file;
+
+ g_return_if_fail (prog_name != NULL);
+
+ if (gimp_ui_initialized)
+ return;
+
+ g_set_prgname (prog_name);
+
+ display_name = gimp_display_name ();
+
+ if (display_name)
+ {
+#if defined (GDK_WINDOWING_X11)
+ g_setenv ("DISPLAY", display_name, TRUE);
+#else
+ g_setenv ("GDK_DISPLAY", display_name, TRUE);
+#endif
+ }
+
+ if (gimp_user_time ())
+ {
+ /* Construct a fake startup ID as we only want to pass the
+ * interaction timestamp, see _gdk_windowing_set_default_display().
+ */
+ gchar *startup_id = g_strdup_printf ("_TIME%u", gimp_user_time ());
+
+ g_setenv ("DESKTOP_STARTUP_ID", startup_id, TRUE);
+ g_free (startup_id);
+ }
+
+ gtk_init (NULL, NULL);
+
+ themerc = gimp_personal_rc_file ("themerc");
+ gtk_rc_parse (themerc);
+
+ file = g_file_new_for_path (themerc);
+ g_free (themerc);
+
+ rc_monitor = g_file_monitor (file, G_FILE_MONITOR_NONE, NULL, NULL);
+ g_object_unref (file);
+
+ g_signal_connect (rc_monitor, "changed",
+ G_CALLBACK (gimp_ui_theme_changed),
+ NULL);
+
+ gdk_set_program_class (gimp_wm_class ());
+
+ screen = gdk_screen_get_default ();
+ gtk_widget_set_default_colormap (gdk_screen_get_rgb_colormap (screen));
+
+ if (gimp_icon_theme_dir ())
+ {
+ file = g_file_new_for_path (gimp_icon_theme_dir ());
+ gimp_icons_set_icon_theme (file);
+ g_object_unref (file);
+ }
+
+ gimp_widgets_init (gimp_ui_help_func,
+ gimp_context_get_foreground,
+ gimp_context_get_background,
+ gimp_ensure_modules);
+
+ if (! gimp_show_tool_tips ())
+ gimp_help_disable_tooltips ();
+
+ gimp_dialogs_show_help_button (gimp_show_help_button ());
+
+#ifdef GDK_WINDOWING_QUARTZ
+ g_idle_add (gimp_osx_focus_window, NULL);
+#endif
+
+ gimp_ui_fix_pixbuf_style ();
+ gimp_ui_initialized = TRUE;
+}
+
+static GdkWindow *
+gimp_ui_get_foreign_window (guint32 window)
+{
+#ifdef GDK_WINDOWING_X11
+ return gdk_x11_window_foreign_new_for_display (gdk_display_get_default (),
+ window);
+#endif
+
+#ifdef GDK_WINDOWING_WIN32
+ return gdk_win32_window_foreign_new_for_display (gdk_display_get_default (),
+ (HWND) (uintptr_t) window);
+#endif
+
+ return NULL;
+}
+
+/**
+ * gimp_ui_get_display_window:
+ * @gdisp_ID: a GimpDisplay ID.
+ *
+ * Returns the #GdkWindow of a display window. The purpose is to allow
+ * to make plug-in dialogs transient to the image display as explained
+ * with gdk_window_set_transient_for().
+ *
+ * You shouldn't have to call this function directly. Use
+ * gimp_window_set_transient_for_display() instead.
+ *
+ * Return value: A reference to a #GdkWindow or %NULL. You should
+ * unref the window using g_object_unref() as soon as
+ * you don't need it any longer.
+ *
+ * Since: 2.4
+ */
+GdkWindow *
+gimp_ui_get_display_window (guint32 gdisp_ID)
+{
+ guint32 window;
+
+ g_return_val_if_fail (gimp_ui_initialized, NULL);
+
+ window = gimp_display_get_window_handle (gdisp_ID);
+ if (window)
+ return gimp_ui_get_foreign_window (window);
+
+ return NULL;
+}
+
+/**
+ * gimp_ui_get_progress_window:
+ *
+ * Returns the #GdkWindow of the window this plug-in's progress bar is
+ * shown in. Use it to make plug-in dialogs transient to this window
+ * as explained with gdk_window_set_transient_for().
+ *
+ * You shouldn't have to call this function directly. Use
+ * gimp_window_set_transient() instead.
+ *
+ * Return value: A reference to a #GdkWindow or %NULL. You should
+ * unref the window using g_object_unref() as soon as
+ * you don't need it any longer.
+ *
+ * Since: 2.4
+ */
+GdkWindow *
+gimp_ui_get_progress_window (void)
+{
+ guint32 window;
+
+ g_return_val_if_fail (gimp_ui_initialized, NULL);
+
+ window = gimp_progress_get_window_handle ();
+ if (window)
+ return gimp_ui_get_foreign_window (window);
+
+ return NULL;
+}
+
+#ifdef GDK_WINDOWING_QUARTZ
+static void
+gimp_window_transient_show (GtkWidget *window)
+{
+ g_signal_handlers_disconnect_by_func (window,
+ gimp_window_transient_show,
+ NULL);
+ [NSApp arrangeInFront: nil];
+}
+#endif
+
+/**
+ * gimp_window_set_transient_for_display:
+ * @window: the #GtkWindow that should become transient
+ * @gdisp_ID: display ID of the image window that should become the parent
+ *
+ * Indicates to the window manager that @window is a transient dialog
+ * associated with the GIMP image window that is identified by it's
+ * display ID. See gdk_window_set_transient_for () for more information.
+ *
+ * Most of the time you will want to use the convenience function
+ * gimp_window_set_transient().
+ *
+ * Since: 2.4
+ */
+void
+gimp_window_set_transient_for_display (GtkWindow *window,
+ guint32 gdisp_ID)
+{
+ g_return_if_fail (gimp_ui_initialized);
+ g_return_if_fail (GTK_IS_WINDOW (window));
+
+ if (! gimp_window_set_transient_for (window,
+ gimp_ui_get_display_window (gdisp_ID)))
+ {
+ /* if setting the window transient failed, at least set
+ * WIN_POS_CENTER, which will center the window on the screen
+ * where the mouse is (see bug #684003).
+ */
+ gtk_window_set_position (window, GTK_WIN_POS_CENTER);
+
+#ifdef GDK_WINDOWING_QUARTZ
+ g_signal_connect (window, "show",
+ G_CALLBACK (gimp_window_transient_show),
+ NULL);
+#endif
+ }
+}
+
+/**
+ * gimp_window_set_transient:
+ * @window: the #GtkWindow that should become transient
+ *
+ * Indicates to the window manager that @window is a transient dialog
+ * associated with the GIMP window that the plug-in has been
+ * started from. See also gimp_window_set_transient_for_display().
+ *
+ * Since: 2.4
+ */
+void
+gimp_window_set_transient (GtkWindow *window)
+{
+ g_return_if_fail (gimp_ui_initialized);
+ g_return_if_fail (GTK_IS_WINDOW (window));
+
+ if (! gimp_window_set_transient_for (window, gimp_ui_get_progress_window ()))
+ {
+ /* see above */
+ gtk_window_set_position (window, GTK_WIN_POS_CENTER);
+
+#ifdef GDK_WINDOWING_QUARTZ
+ g_signal_connect (window, "show",
+ G_CALLBACK (gimp_window_transient_show),
+ NULL);
+#endif
+ }
+}
+
+
+/* private functions */
+
+static void
+gimp_ui_help_func (const gchar *help_id,
+ gpointer help_data)
+{
+ gimp_help (NULL, help_id);
+}
+
+static void
+gimp_ensure_modules (void)
+{
+ static GimpModuleDB *module_db = NULL;
+
+ if (! module_db)
+ {
+ gchar *load_inhibit = gimp_get_module_load_inhibit ();
+ gchar *module_path = gimp_gimprc_query ("module-path");
+
+ module_db = gimp_module_db_new (FALSE);
+
+ gimp_module_db_set_load_inhibit (module_db, load_inhibit);
+ gimp_module_db_load (module_db, module_path);
+
+ g_free (module_path);
+ g_free (load_inhibit);
+ }
+}
+
+static void
+gimp_window_transient_realized (GtkWidget *window,
+ GdkWindow *parent)
+{
+ if (gtk_widget_get_realized (window))
+ gdk_window_set_transient_for (gtk_widget_get_window (window), parent);
+}
+
+static gboolean
+gimp_window_set_transient_for (GtkWindow *window,
+ GdkWindow *parent)
+{
+ gtk_window_set_transient_for (window, NULL);
+
+#ifndef GDK_WINDOWING_WIN32
+ g_signal_handlers_disconnect_matched (window, G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL,
+ gimp_window_transient_realized,
+ NULL);
+
+ if (! parent)
+ return FALSE;
+
+ if (gtk_widget_get_realized (GTK_WIDGET (window)))
+ gdk_window_set_transient_for (gtk_widget_get_window (GTK_WIDGET (window)),
+ parent);
+
+ g_signal_connect_object (window, "realize",
+ G_CALLBACK (gimp_window_transient_realized),
+ parent, 0);
+ g_object_unref (parent);
+
+ return TRUE;
+#endif
+
+ return FALSE;
+}
+
+static void
+gimp_ui_theme_changed (void)
+{
+ gtk_rc_reparse_all ();
+
+ gimp_ui_fix_pixbuf_style ();
+}
+
+static void
+gimp_ui_fix_pixbuf_style (void)
+{
+ /* Same hack as in app/gui/themes.c, to be removed for GTK+ 3.x */
+
+ static GtkStyleClass *pixbuf_style_class = NULL;
+
+ if (! pixbuf_style_class)
+ {
+ GType type = g_type_from_name ("PixbufStyle");
+
+ if (type)
+ {
+ pixbuf_style_class = g_type_class_ref (type);
+
+ if (pixbuf_style_class)
+ pixbuf_style_class->draw_layout = gimp_ui_draw_pixbuf_layout;
+ }
+ }
+}
+
+static void
+gimp_ui_draw_pixbuf_layout (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type,
+ gboolean use_text,
+ GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ gint x,
+ gint y,
+ PangoLayout *layout)
+{
+ GdkGC *gc;
+
+ gc = use_text ? style->text_gc[state_type] : style->fg_gc[state_type];
+
+ if (area)
+ gdk_gc_set_clip_rectangle (gc, area);
+
+ if (state_type == GTK_STATE_INSENSITIVE)
+ {
+ GdkGC *copy = gdk_gc_new (window);
+ GdkGCValues orig;
+ GdkColor fore;
+ guint16 r, g, b;
+
+ gdk_gc_copy (copy, gc);
+ gdk_gc_get_values (gc, &orig);
+
+ r = 0x40 + (((orig.foreground.pixel >> 16) & 0xff) >> 1);
+ g = 0x40 + (((orig.foreground.pixel >> 8) & 0xff) >> 1);
+ b = 0x40 + (((orig.foreground.pixel >> 0) & 0xff) >> 1);
+
+ fore.pixel = (r << 16) | (g << 8) | b;
+ fore.red = r * 257;
+ fore.green = g * 257;
+ fore.blue = b * 257;
+
+ gdk_gc_set_foreground (copy, &fore);
+ gdk_draw_layout (window, copy, x, y, layout);
+
+ g_object_unref (copy);
+ }
+ else
+ {
+ gdk_draw_layout (window, gc, x, y, layout);
+ }
+
+ if (area)
+ gdk_gc_set_clip_rectangle (gc, NULL);
+}
+
+#ifdef GDK_WINDOWING_QUARTZ
+static gboolean
+gimp_osx_focus_window (gpointer user_data)
+{
+ [NSApp activateIgnoringOtherApps:YES];
+ return FALSE;
+}
+#endif
diff --git a/libgimp/gimpui.def b/libgimp/gimpui.def
new file mode 100644
index 0000000..b0ba21a
--- /dev/null
+++ b/libgimp/gimpui.def
@@ -0,0 +1,90 @@
+EXPORTS
+ gimp_aspect_preview_get_type
+ gimp_aspect_preview_new
+ gimp_aspect_preview_new_from_drawable_id
+ gimp_brush_select_button_get_brush
+ gimp_brush_select_button_get_type
+ gimp_brush_select_button_new
+ gimp_brush_select_button_set_brush
+ gimp_brush_select_widget_close
+ gimp_brush_select_widget_new
+ gimp_brush_select_widget_set
+ gimp_channel_combo_box_get_type
+ gimp_channel_combo_box_new
+ gimp_channel_menu_new
+ gimp_drawable_combo_box_get_type
+ gimp_drawable_combo_box_new
+ gimp_drawable_menu_new
+ gimp_drawable_preview_draw_region
+ gimp_drawable_preview_get_drawable
+ gimp_drawable_preview_get_drawable_id
+ gimp_drawable_preview_get_type
+ gimp_drawable_preview_new
+ gimp_drawable_preview_new_from_drawable_id
+ gimp_export_dialog_get_content_area
+ gimp_export_dialog_new
+ gimp_export_image
+ gimp_font_select_button_get_font
+ gimp_font_select_button_get_type
+ gimp_font_select_button_new
+ gimp_font_select_button_set_font
+ gimp_font_select_widget_close
+ gimp_font_select_widget_new
+ gimp_font_select_widget_set
+ gimp_gradient_select_button_get_gradient
+ gimp_gradient_select_button_get_type
+ gimp_gradient_select_button_new
+ gimp_gradient_select_button_set_gradient
+ gimp_gradient_select_widget_close
+ gimp_gradient_select_widget_new
+ gimp_gradient_select_widget_set
+ gimp_image_combo_box_get_type
+ gimp_image_combo_box_new
+ gimp_image_menu_new
+ gimp_image_metadata_load_finish
+ gimp_image_metadata_load_prepare
+ gimp_image_metadata_load_thumbnail
+ gimp_image_metadata_save_finish
+ gimp_image_metadata_save_prepare
+ gimp_layer_combo_box_get_type
+ gimp_layer_combo_box_new
+ gimp_layer_menu_new
+ gimp_palette_select_button_get_palette
+ gimp_palette_select_button_get_type
+ gimp_palette_select_button_new
+ gimp_palette_select_button_set_palette
+ gimp_palette_select_widget_close
+ gimp_palette_select_widget_new
+ gimp_palette_select_widget_set
+ gimp_pattern_select_button_get_pattern
+ gimp_pattern_select_button_get_type
+ gimp_pattern_select_button_new
+ gimp_pattern_select_button_set_pattern
+ gimp_pattern_select_widget_close
+ gimp_pattern_select_widget_new
+ gimp_pattern_select_widget_set
+ gimp_proc_browser_dialog_get_selected
+ gimp_proc_browser_dialog_get_type
+ gimp_proc_browser_dialog_new
+ gimp_proc_view_new
+ gimp_progress_bar_get_type
+ gimp_progress_bar_new
+ gimp_select_button_close_popup
+ gimp_select_button_get_type
+ gimp_ui_get_display_window
+ gimp_ui_get_progress_window
+ gimp_ui_init
+ gimp_vectors_combo_box_get_type
+ gimp_vectors_combo_box_new
+ gimp_window_set_transient
+ gimp_window_set_transient_for_display
+ gimp_zoom_preview_get_drawable
+ gimp_zoom_preview_get_drawable_id
+ gimp_zoom_preview_get_factor
+ gimp_zoom_preview_get_model
+ gimp_zoom_preview_get_source
+ gimp_zoom_preview_get_type
+ gimp_zoom_preview_new
+ gimp_zoom_preview_new_from_drawable_id
+ gimp_zoom_preview_new_with_model
+ gimp_zoom_preview_new_with_model_from_drawable_id
diff --git a/libgimp/gimpui.h b/libgimp/gimpui.h
new file mode 100644
index 0000000..29b722a
--- /dev/null
+++ b/libgimp/gimpui.h
@@ -0,0 +1,72 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#ifndef __GIMP_UI_H__
+#define __GIMP_UI_H__
+
+#include <gtk/gtk.h>
+
+#include <libgimpwidgets/gimpwidgets.h>
+
+#define __GIMP_UI_H_INSIDE__
+
+#include <libgimp/gimpuitypes.h>
+
+#include <libgimp/gimpaspectpreview.h>
+#include <libgimp/gimpbrushmenu.h>
+#include <libgimp/gimpbrushselectbutton.h>
+#include <libgimp/gimpdrawablepreview.h>
+#include <libgimp/gimpexport.h>
+#include <libgimp/gimpfontmenu.h>
+#include <libgimp/gimpfontselectbutton.h>
+#include <libgimp/gimpgradientmenu.h>
+#include <libgimp/gimpgradientselectbutton.h>
+#include <libgimp/gimpimagecombobox.h>
+#include <libgimp/gimpimagemetadata.h>
+#include <libgimp/gimpitemcombobox.h>
+#include <libgimp/gimpmenu.h>
+#include <libgimp/gimppalettemenu.h>
+#include <libgimp/gimppaletteselectbutton.h>
+#include <libgimp/gimppatternmenu.h>
+#include <libgimp/gimppatternselectbutton.h>
+#include <libgimp/gimpprocbrowserdialog.h>
+#include <libgimp/gimpprocview.h>
+#include <libgimp/gimpprogressbar.h>
+#include <libgimp/gimpselectbutton.h>
+#include <libgimp/gimpzoompreview.h>
+
+#undef __GIMP_UI_H_INSIDE__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+void gimp_ui_init (const gchar *prog_name,
+ gboolean preview);
+
+GdkWindow * gimp_ui_get_display_window (guint32 gdisp_ID);
+GdkWindow * gimp_ui_get_progress_window (void);
+
+void gimp_window_set_transient_for_display (GtkWindow *window,
+ guint32 gdisp_ID);
+void gimp_window_set_transient (GtkWindow *window);
+
+G_END_DECLS
+
+#endif /* __GIMP_UI_H__ */
diff --git a/libgimp/gimpuimarshal.c b/libgimp/gimpuimarshal.c
new file mode 100644
index 0000000..30f4d38
--- /dev/null
+++ b/libgimp/gimpuimarshal.c
@@ -0,0 +1,261 @@
+/* This file is generated by glib-genmarshal, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+#include <glib-object.h>
+
+#ifdef G_ENABLE_DEBUG
+#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
+#define g_marshal_value_peek_char(v) g_value_get_schar (v)
+#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
+#define g_marshal_value_peek_int(v) g_value_get_int (v)
+#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
+#define g_marshal_value_peek_long(v) g_value_get_long (v)
+#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
+#define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
+#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
+#define g_marshal_value_peek_enum(v) g_value_get_enum (v)
+#define g_marshal_value_peek_flags(v) g_value_get_flags (v)
+#define g_marshal_value_peek_float(v) g_value_get_float (v)
+#define g_marshal_value_peek_double(v) g_value_get_double (v)
+#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
+#define g_marshal_value_peek_param(v) g_value_get_param (v)
+#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
+#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
+#define g_marshal_value_peek_object(v) g_value_get_object (v)
+#define g_marshal_value_peek_variant(v) g_value_get_variant (v)
+#else /* !G_ENABLE_DEBUG */
+/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
+ * Do not access GValues directly in your code. Instead, use the
+ * g_value_get_*() functions
+ */
+#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
+#define g_marshal_value_peek_char(v) (v)->data[0].v_int
+#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
+#define g_marshal_value_peek_int(v) (v)->data[0].v_int
+#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
+#define g_marshal_value_peek_long(v) (v)->data[0].v_long
+#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
+#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
+#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
+#define g_marshal_value_peek_enum(v) (v)->data[0].v_long
+#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
+#define g_marshal_value_peek_float(v) (v)->data[0].v_float
+#define g_marshal_value_peek_double(v) (v)->data[0].v_double
+#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer
+#endif /* !G_ENABLE_DEBUG */
+
+/* VOID: STRING, BOOLEAN (../../libgimp/gimpuimarshal.list:25) */
+/* Prototype for -Wmissing-prototypes */
+G_BEGIN_DECLS
+extern
+void _gimpui_marshal_VOID__STRING_BOOLEAN (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+G_END_DECLS
+void
+_gimpui_marshal_VOID__STRING_BOOLEAN (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ typedef void (*GMarshalFunc_VOID__STRING_BOOLEAN) (gpointer data1,
+ gpointer arg1,
+ gboolean arg2,
+ gpointer data2);
+ GCClosure *cc = (GCClosure *) closure;
+ gpointer data1, data2;
+ GMarshalFunc_VOID__STRING_BOOLEAN callback;
+
+ g_return_if_fail (n_param_values == 3);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_VOID__STRING_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
+
+ callback (data1,
+ g_marshal_value_peek_string (param_values + 1),
+ g_marshal_value_peek_boolean (param_values + 2),
+ data2);
+}
+
+/* VOID: STRING, INT, POINTER, BOOLEAN (../../libgimp/gimpuimarshal.list:26) */
+/* Prototype for -Wmissing-prototypes */
+G_BEGIN_DECLS
+extern
+void _gimpui_marshal_VOID__STRING_INT_POINTER_BOOLEAN (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+G_END_DECLS
+void
+_gimpui_marshal_VOID__STRING_INT_POINTER_BOOLEAN (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ typedef void (*GMarshalFunc_VOID__STRING_INT_POINTER_BOOLEAN) (gpointer data1,
+ gpointer arg1,
+ gint arg2,
+ gpointer arg3,
+ gboolean arg4,
+ gpointer data2);
+ GCClosure *cc = (GCClosure *) closure;
+ gpointer data1, data2;
+ GMarshalFunc_VOID__STRING_INT_POINTER_BOOLEAN callback;
+
+ g_return_if_fail (n_param_values == 5);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_VOID__STRING_INT_POINTER_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
+
+ callback (data1,
+ g_marshal_value_peek_string (param_values + 1),
+ g_marshal_value_peek_int (param_values + 2),
+ g_marshal_value_peek_pointer (param_values + 3),
+ g_marshal_value_peek_boolean (param_values + 4),
+ data2);
+}
+
+/* VOID: STRING, INT, INT, INT, POINTER, BOOLEAN (../../libgimp/gimpuimarshal.list:27) */
+/* Prototype for -Wmissing-prototypes */
+G_BEGIN_DECLS
+extern
+void _gimpui_marshal_VOID__STRING_INT_INT_INT_POINTER_BOOLEAN (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+G_END_DECLS
+void
+_gimpui_marshal_VOID__STRING_INT_INT_INT_POINTER_BOOLEAN (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ typedef void (*GMarshalFunc_VOID__STRING_INT_INT_INT_POINTER_BOOLEAN) (gpointer data1,
+ gpointer arg1,
+ gint arg2,
+ gint arg3,
+ gint arg4,
+ gpointer arg5,
+ gboolean arg6,
+ gpointer data2);
+ GCClosure *cc = (GCClosure *) closure;
+ gpointer data1, data2;
+ GMarshalFunc_VOID__STRING_INT_INT_INT_POINTER_BOOLEAN callback;
+
+ g_return_if_fail (n_param_values == 7);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_VOID__STRING_INT_INT_INT_POINTER_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
+
+ callback (data1,
+ g_marshal_value_peek_string (param_values + 1),
+ g_marshal_value_peek_int (param_values + 2),
+ g_marshal_value_peek_int (param_values + 3),
+ g_marshal_value_peek_int (param_values + 4),
+ g_marshal_value_peek_pointer (param_values + 5),
+ g_marshal_value_peek_boolean (param_values + 6),
+ data2);
+}
+
+/* VOID: STRING, DOUBLE, INT, INT, INT, INT, POINTER, BOOLEAN (../../libgimp/gimpuimarshal.list:28) */
+/* Prototype for -Wmissing-prototypes */
+G_BEGIN_DECLS
+extern
+void _gimpui_marshal_VOID__STRING_DOUBLE_INT_INT_INT_INT_POINTER_BOOLEAN (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+G_END_DECLS
+void
+_gimpui_marshal_VOID__STRING_DOUBLE_INT_INT_INT_INT_POINTER_BOOLEAN (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ typedef void (*GMarshalFunc_VOID__STRING_DOUBLE_INT_INT_INT_INT_POINTER_BOOLEAN) (gpointer data1,
+ gpointer arg1,
+ gdouble arg2,
+ gint arg3,
+ gint arg4,
+ gint arg5,
+ gint arg6,
+ gpointer arg7,
+ gboolean arg8,
+ gpointer data2);
+ GCClosure *cc = (GCClosure *) closure;
+ gpointer data1, data2;
+ GMarshalFunc_VOID__STRING_DOUBLE_INT_INT_INT_INT_POINTER_BOOLEAN callback;
+
+ g_return_if_fail (n_param_values == 9);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_VOID__STRING_DOUBLE_INT_INT_INT_INT_POINTER_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
+
+ callback (data1,
+ g_marshal_value_peek_string (param_values + 1),
+ g_marshal_value_peek_double (param_values + 2),
+ g_marshal_value_peek_int (param_values + 3),
+ g_marshal_value_peek_int (param_values + 4),
+ g_marshal_value_peek_int (param_values + 5),
+ g_marshal_value_peek_int (param_values + 6),
+ g_marshal_value_peek_pointer (param_values + 7),
+ g_marshal_value_peek_boolean (param_values + 8),
+ data2);
+}
+
diff --git a/libgimp/gimpuimarshal.h b/libgimp/gimpuimarshal.h
new file mode 100644
index 0000000..3575a79
--- /dev/null
+++ b/libgimp/gimpuimarshal.h
@@ -0,0 +1,48 @@
+/* This file is generated by glib-genmarshal, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */
+#ifndef ___GIMPUI_MARSHAL_MARSHAL_H__
+#define ___GIMPUI_MARSHAL_MARSHAL_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* VOID: STRING, BOOLEAN (../../libgimp/gimpuimarshal.list:25) */
+extern
+void _gimpui_marshal_VOID__STRING_BOOLEAN (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+
+/* VOID: STRING, INT, POINTER, BOOLEAN (../../libgimp/gimpuimarshal.list:26) */
+extern
+void _gimpui_marshal_VOID__STRING_INT_POINTER_BOOLEAN (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+
+/* VOID: STRING, INT, INT, INT, POINTER, BOOLEAN (../../libgimp/gimpuimarshal.list:27) */
+extern
+void _gimpui_marshal_VOID__STRING_INT_INT_INT_POINTER_BOOLEAN (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+
+/* VOID: STRING, DOUBLE, INT, INT, INT, INT, POINTER, BOOLEAN (../../libgimp/gimpuimarshal.list:28) */
+extern
+void _gimpui_marshal_VOID__STRING_DOUBLE_INT_INT_INT_INT_POINTER_BOOLEAN (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+
+
+G_END_DECLS
+
+#endif /* ___GIMPUI_MARSHAL_MARSHAL_H__ */
diff --git a/libgimp/gimpuimarshal.list b/libgimp/gimpuimarshal.list
new file mode 100644
index 0000000..59ec674
--- /dev/null
+++ b/libgimp/gimpuimarshal.list
@@ -0,0 +1,28 @@
+# see glib-genmarshal(1) for a detailed description of the file format,
+# possible parameter types are:
+# VOID indicates no return type, or no extra
+# parameters. if VOID is used as the parameter
+# list, no additional parameters may be present.
+# BOOLEAN for boolean types (gboolean)
+# CHAR for signed char types (gchar)
+# UCHAR for unsigned char types (guchar)
+# INT for signed integer types (gint)
+# UINT for unsigned integer types (guint)
+# LONG for signed long integer types (glong)
+# ULONG for unsigned long integer types (gulong)
+# ENUM for enumeration types (gint)
+# FLAGS for flag enumeration types (guint)
+# FLOAT for single-precision float types (gfloat)
+# DOUBLE for double-precision float types (gdouble)
+# STRING for string types (gchar*)
+# BOXED for boxed (anonymous but reference counted) types (GBoxed*)
+# POINTER for anonymous pointer types (gpointer)
+# PARAM for GParamSpec or derived types (GParamSpec*)
+# OBJECT for GObject or derived types (GObject*)
+# NONE deprecated alias for VOID
+# BOOL deprecated alias for BOOLEAN
+
+VOID: STRING, BOOLEAN
+VOID: STRING, INT, POINTER, BOOLEAN
+VOID: STRING, INT, INT, INT, POINTER, BOOLEAN
+VOID: STRING, DOUBLE, INT, INT, INT, INT, POINTER, BOOLEAN
diff --git a/libgimp/gimpuitypes.h b/libgimp/gimpuitypes.h
new file mode 100644
index 0000000..06178d1
--- /dev/null
+++ b/libgimp/gimpuitypes.h
@@ -0,0 +1,53 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpuitypes.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#ifndef __GIMP_UI_TYPES_H__
+#define __GIMP_UI_TYPES_H__
+
+#include <libgimpwidgets/gimpwidgetstypes.h>
+
+G_BEGIN_DECLS
+
+/* For information look into the html documentation */
+
+
+typedef struct _GimpAspectPreview GimpAspectPreview;
+typedef struct _GimpDrawablePreview GimpDrawablePreview;
+typedef struct _GimpProcBrowserDialog GimpProcBrowserDialog;
+typedef struct _GimpProgressBar GimpProgressBar;
+typedef struct _GimpZoomPreview GimpZoomPreview;
+
+typedef struct _GimpDrawableComboBox GimpDrawableComboBox;
+typedef struct _GimpChannelComboBox GimpChannelComboBox;
+typedef struct _GimpLayerComboBox GimpLayerComboBox;
+typedef struct _GimpVectorsComboBox GimpVectorsComboBox;
+typedef struct _GimpImageComboBox GimpImageComboBox;
+
+typedef struct _GimpSelectButton GimpSelectButton;
+typedef struct _GimpBrushSelectButton GimpBrushSelectButton;
+typedef struct _GimpFontSelectButton GimpFontSelectButton;
+typedef struct _GimpGradientSelectButton GimpGradientSelectButton;
+typedef struct _GimpPaletteSelectButton GimpPaletteSelectButton;
+typedef struct _GimpPatternSelectButton GimpPatternSelectButton;
+
+
+G_END_DECLS
+
+#endif /* __GIMP_UI_TYPES_H__ */
diff --git a/libgimp/gimpunit_pdb.c b/libgimp/gimpunit_pdb.c
new file mode 100644
index 0000000..fff9e12
--- /dev/null
+++ b/libgimp/gimpunit_pdb.c
@@ -0,0 +1,427 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpunit_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpunit
+ * @title: gimpunit
+ * @short_description: Provides a collection of predefined units and functions for creating user-defined units.
+ *
+ * Provides a collection of predefined units and functions for creating
+ * user-defined units.
+ **/
+
+
+/**
+ * _gimp_unit_get_number_of_units:
+ *
+ * Returns the number of units.
+ *
+ * This procedure returns the number of defined units.
+ *
+ * Returns: The number of units.
+ **/
+gint
+_gimp_unit_get_number_of_units (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint num_units = GIMP_UNIT_END;
+
+ return_vals = gimp_run_procedure ("gimp-unit-get-number-of-units",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ num_units = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return num_units;
+}
+
+/**
+ * _gimp_unit_get_number_of_built_in_units:
+ *
+ * Returns the number of built-in units.
+ *
+ * This procedure returns the number of defined units built-in to GIMP.
+ *
+ * Returns: The number of built-in units.
+ **/
+gint
+_gimp_unit_get_number_of_built_in_units (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint num_units = GIMP_UNIT_END;
+
+ return_vals = gimp_run_procedure ("gimp-unit-get-number-of-built-in-units",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ num_units = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return num_units;
+}
+
+/**
+ * _gimp_unit_new:
+ * @identifier: The new unit's identifier.
+ * @factor: The new unit's factor.
+ * @digits: The new unit's digits.
+ * @symbol: The new unit's symbol.
+ * @abbreviation: The new unit's abbreviation.
+ * @singular: The new unit's singular form.
+ * @plural: The new unit's plural form.
+ *
+ * Creates a new unit and returns it's integer ID.
+ *
+ * This procedure creates a new unit and returns it's integer ID. Note
+ * that the new unit will have it's deletion flag set to TRUE, so you
+ * will have to set it to FALSE with gimp_unit_set_deletion_flag() to
+ * make it persistent.
+ *
+ * Returns: The new unit's ID.
+ **/
+GimpUnit
+_gimp_unit_new (const gchar *identifier,
+ gdouble factor,
+ gint digits,
+ const gchar *symbol,
+ const gchar *abbreviation,
+ const gchar *singular,
+ const gchar *plural)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpUnit unit_id = GIMP_UNIT_INCH;
+
+ return_vals = gimp_run_procedure ("gimp-unit-new",
+ &nreturn_vals,
+ GIMP_PDB_STRING, identifier,
+ GIMP_PDB_FLOAT, factor,
+ GIMP_PDB_INT32, digits,
+ GIMP_PDB_STRING, symbol,
+ GIMP_PDB_STRING, abbreviation,
+ GIMP_PDB_STRING, singular,
+ GIMP_PDB_STRING, plural,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ unit_id = return_vals[1].data.d_unit;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return unit_id;
+}
+
+/**
+ * _gimp_unit_get_deletion_flag:
+ * @unit_id: The unit's integer ID.
+ *
+ * Returns the deletion flag of the unit.
+ *
+ * This procedure returns the deletion flag of the unit. If this value
+ * is TRUE the unit's definition will not be saved in the user's unitrc
+ * file on gimp exit.
+ *
+ * Returns: The unit's deletion flag.
+ **/
+gboolean
+_gimp_unit_get_deletion_flag (GimpUnit unit_id)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean deletion_flag = FALSE;
+
+ return_vals = gimp_run_procedure ("gimp-unit-get-deletion-flag",
+ &nreturn_vals,
+ GIMP_PDB_INT32, unit_id,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ deletion_flag = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return deletion_flag;
+}
+
+/**
+ * _gimp_unit_set_deletion_flag:
+ * @unit_id: The unit's integer ID.
+ * @deletion_flag: The new deletion flag of the unit.
+ *
+ * Sets the deletion flag of a unit.
+ *
+ * This procedure sets the unit's deletion flag. If the deletion flag
+ * of a unit is TRUE on gimp exit, this unit's definition will not be
+ * saved in the user's unitrc.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_unit_set_deletion_flag (GimpUnit unit_id,
+ gboolean deletion_flag)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-unit-set-deletion-flag",
+ &nreturn_vals,
+ GIMP_PDB_INT32, unit_id,
+ GIMP_PDB_INT32, deletion_flag,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_unit_get_identifier:
+ * @unit_id: The unit's integer ID.
+ *
+ * Returns the textual identifier of the unit.
+ *
+ * This procedure returns the textual identifier of the unit. For
+ * built-in units it will be the english singular form of the unit's
+ * name. For user-defined units this should equal to the singular form.
+ *
+ * Returns: The unit's textual identifier.
+ **/
+gchar *
+_gimp_unit_get_identifier (GimpUnit unit_id)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *identifier = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-unit-get-identifier",
+ &nreturn_vals,
+ GIMP_PDB_INT32, unit_id,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ identifier = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return identifier;
+}
+
+/**
+ * _gimp_unit_get_factor:
+ * @unit_id: The unit's integer ID.
+ *
+ * Returns the factor of the unit.
+ *
+ * This procedure returns the unit's factor which indicates how many
+ * units make up an inch. Note that asking for the factor of \"pixels\"
+ * will produce an error.
+ *
+ * Returns: The unit's factor.
+ **/
+gdouble
+_gimp_unit_get_factor (GimpUnit unit_id)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble factor = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-unit-get-factor",
+ &nreturn_vals,
+ GIMP_PDB_INT32, unit_id,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ factor = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return factor;
+}
+
+/**
+ * _gimp_unit_get_digits:
+ * @unit_id: The unit's integer ID.
+ *
+ * Returns the number of digits of the unit.
+ *
+ * This procedure returns the number of digits you should provide in
+ * input or output functions to get approximately the same accuracy as
+ * with two digits and inches. Note that asking for the digits of
+ * \"pixels\" will produce an error.
+ *
+ * Returns: The unit's number of digits.
+ **/
+gint
+_gimp_unit_get_digits (GimpUnit unit_id)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint digits = 0;
+
+ return_vals = gimp_run_procedure ("gimp-unit-get-digits",
+ &nreturn_vals,
+ GIMP_PDB_INT32, unit_id,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ digits = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return digits;
+}
+
+/**
+ * _gimp_unit_get_symbol:
+ * @unit_id: The unit's integer ID.
+ *
+ * Returns the symbol of the unit.
+ *
+ * This procedure returns the symbol of the unit (\"''\" for inches).
+ *
+ * Returns: The unit's symbol.
+ **/
+gchar *
+_gimp_unit_get_symbol (GimpUnit unit_id)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *symbol = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-unit-get-symbol",
+ &nreturn_vals,
+ GIMP_PDB_INT32, unit_id,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ symbol = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return symbol;
+}
+
+/**
+ * _gimp_unit_get_abbreviation:
+ * @unit_id: The unit's integer ID.
+ *
+ * Returns the abbreviation of the unit.
+ *
+ * This procedure returns the abbreviation of the unit (\"in\" for
+ * inches).
+ *
+ * Returns: The unit's abbreviation.
+ **/
+gchar *
+_gimp_unit_get_abbreviation (GimpUnit unit_id)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *abbreviation = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-unit-get-abbreviation",
+ &nreturn_vals,
+ GIMP_PDB_INT32, unit_id,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ abbreviation = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return abbreviation;
+}
+
+/**
+ * _gimp_unit_get_singular:
+ * @unit_id: The unit's integer ID.
+ *
+ * Returns the singular form of the unit.
+ *
+ * This procedure returns the singular form of the unit.
+ *
+ * Returns: The unit's singular form.
+ **/
+gchar *
+_gimp_unit_get_singular (GimpUnit unit_id)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *singular = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-unit-get-singular",
+ &nreturn_vals,
+ GIMP_PDB_INT32, unit_id,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ singular = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return singular;
+}
+
+/**
+ * _gimp_unit_get_plural:
+ * @unit_id: The unit's integer ID.
+ *
+ * Returns the plural form of the unit.
+ *
+ * This procedure returns the plural form of the unit.
+ *
+ * Returns: The unit's plural form.
+ **/
+gchar *
+_gimp_unit_get_plural (GimpUnit unit_id)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *plural = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-unit-get-plural",
+ &nreturn_vals,
+ GIMP_PDB_INT32, unit_id,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ plural = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return plural;
+}
diff --git a/libgimp/gimpunit_pdb.h b/libgimp/gimpunit_pdb.h
new file mode 100644
index 0000000..3481649
--- /dev/null
+++ b/libgimp/gimpunit_pdb.h
@@ -0,0 +1,58 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpunit_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_UNIT_PDB_H__
+#define __GIMP_UNIT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+G_GNUC_INTERNAL gint _gimp_unit_get_number_of_units (void);
+G_GNUC_INTERNAL gint _gimp_unit_get_number_of_built_in_units (void);
+G_GNUC_INTERNAL GimpUnit _gimp_unit_new (const gchar *identifier,
+ gdouble factor,
+ gint digits,
+ const gchar *symbol,
+ const gchar *abbreviation,
+ const gchar *singular,
+ const gchar *plural);
+G_GNUC_INTERNAL gboolean _gimp_unit_get_deletion_flag (GimpUnit unit_id);
+G_GNUC_INTERNAL gboolean _gimp_unit_set_deletion_flag (GimpUnit unit_id,
+ gboolean deletion_flag);
+G_GNUC_INTERNAL gchar* _gimp_unit_get_identifier (GimpUnit unit_id);
+G_GNUC_INTERNAL gdouble _gimp_unit_get_factor (GimpUnit unit_id);
+G_GNUC_INTERNAL gint _gimp_unit_get_digits (GimpUnit unit_id);
+G_GNUC_INTERNAL gchar* _gimp_unit_get_symbol (GimpUnit unit_id);
+G_GNUC_INTERNAL gchar* _gimp_unit_get_abbreviation (GimpUnit unit_id);
+G_GNUC_INTERNAL gchar* _gimp_unit_get_singular (GimpUnit unit_id);
+G_GNUC_INTERNAL gchar* _gimp_unit_get_plural (GimpUnit unit_id);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_UNIT_PDB_H__ */
diff --git a/libgimp/gimpunitcache.c b/libgimp/gimpunitcache.c
new file mode 100644
index 0000000..95bca08
--- /dev/null
+++ b/libgimp/gimpunitcache.c
@@ -0,0 +1,236 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpunitcache.c
+ * Copyright (C) 1999-2000 Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+
+#include <gio/gio.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "gimpunitcache.h"
+#include "gimpunit_pdb.h"
+
+#include "libgimp-intl.h"
+
+/* internal structures */
+
+typedef struct
+{
+ gdouble factor;
+ gint digits;
+ const gchar *identifier;
+ const gchar *symbol;
+ const gchar *abbreviation;
+ const gchar *singular;
+ const gchar *plural;
+} GimpUnitDef;
+
+
+static GimpUnitDef * gimp_unit_defs = NULL;
+static GimpUnit gimp_units_initialized = 0;
+
+/* not a unit at all but kept here to have the strings in one place
+ */
+static const GimpUnitDef gimp_unit_percent =
+{
+ 0.0, 0, "percent", "%", "%", N_("percent"), N_("percent")
+};
+
+
+static void gimp_unit_def_init (GimpUnitDef *unit_def,
+ GimpUnit unit);
+
+
+static gboolean
+gimp_unit_init (GimpUnit unit)
+{
+ gint i, n;
+
+ if (unit < gimp_units_initialized)
+ return TRUE;
+
+ n = _gimp_unit_get_number_of_units ();
+
+ if (unit >= n)
+ return FALSE;
+
+ gimp_unit_defs = g_renew (GimpUnitDef, gimp_unit_defs, n);
+
+ for (i = gimp_units_initialized; i < n; i++)
+ {
+ gimp_unit_def_init (&gimp_unit_defs[i], i);
+ }
+
+ gimp_units_initialized = n;
+
+ return TRUE;
+}
+
+static void
+gimp_unit_def_init (GimpUnitDef *unit_def,
+ GimpUnit unit)
+{
+ unit_def->factor = _gimp_unit_get_factor (unit);
+ unit_def->digits = _gimp_unit_get_digits (unit);
+ unit_def->identifier = _gimp_unit_get_identifier (unit);
+ unit_def->symbol = _gimp_unit_get_symbol (unit);
+ unit_def->abbreviation = _gimp_unit_get_abbreviation (unit);
+ unit_def->singular = _gimp_unit_get_singular (unit);
+ unit_def->plural = _gimp_unit_get_plural (unit);
+}
+
+gint
+_gimp_unit_cache_get_number_of_units (void)
+{
+ return _gimp_unit_get_number_of_units ();
+}
+
+gint
+_gimp_unit_cache_get_number_of_built_in_units (void)
+{
+ return GIMP_UNIT_END;
+}
+
+GimpUnit
+_gimp_unit_cache_new (gchar *identifier,
+ gdouble factor,
+ gint digits,
+ gchar *symbol,
+ gchar *abbreviation,
+ gchar *singular,
+ gchar *plural)
+{
+ return _gimp_unit_new (identifier,
+ factor,
+ digits,
+ symbol,
+ abbreviation,
+ singular,
+ plural);
+}
+
+gboolean
+_gimp_unit_cache_get_deletion_flag (GimpUnit unit)
+{
+ if (unit < GIMP_UNIT_END)
+ return FALSE;
+
+ return _gimp_unit_get_deletion_flag (unit);
+}
+
+void
+_gimp_unit_cache_set_deletion_flag (GimpUnit unit,
+ gboolean deletion_flag)
+{
+ if (unit < GIMP_UNIT_END)
+ return;
+
+ _gimp_unit_set_deletion_flag (unit,
+ deletion_flag);
+}
+
+gdouble
+_gimp_unit_cache_get_factor (GimpUnit unit)
+{
+ g_return_val_if_fail (unit >= GIMP_UNIT_INCH, 1.0);
+
+ if (unit == GIMP_UNIT_PERCENT)
+ return gimp_unit_percent.factor;
+
+ if (!gimp_unit_init (unit))
+ return 1.0;
+
+ return gimp_unit_defs[unit].factor;
+}
+
+gint
+_gimp_unit_cache_get_digits (GimpUnit unit)
+{
+ g_return_val_if_fail (unit >= GIMP_UNIT_INCH, 0);
+
+ if (unit == GIMP_UNIT_PERCENT)
+ return gimp_unit_percent.digits;
+
+ if (!gimp_unit_init (unit))
+ return 0;
+
+ return gimp_unit_defs[unit].digits;
+}
+
+const gchar *
+_gimp_unit_cache_get_identifier (GimpUnit unit)
+{
+ if (unit == GIMP_UNIT_PERCENT)
+ return gimp_unit_percent.identifier;
+
+ if (!gimp_unit_init (unit))
+ return NULL;
+
+ return gimp_unit_defs[unit].identifier;
+}
+
+const gchar *
+_gimp_unit_cache_get_symbol (GimpUnit unit)
+{
+ if (unit == GIMP_UNIT_PERCENT)
+ return gimp_unit_percent.symbol;
+
+ if (!gimp_unit_init (unit))
+ return NULL;
+
+ return gimp_unit_defs[unit].symbol;
+}
+
+const gchar *
+_gimp_unit_cache_get_abbreviation (GimpUnit unit)
+{
+ if (unit == GIMP_UNIT_PERCENT)
+ return gimp_unit_percent.abbreviation;
+
+ if (!gimp_unit_init (unit))
+ return NULL;
+
+ return gimp_unit_defs[unit].abbreviation;
+}
+
+const gchar *
+_gimp_unit_cache_get_singular (GimpUnit unit)
+{
+ if (unit == GIMP_UNIT_PERCENT)
+ return gettext (gimp_unit_percent.singular);
+
+ if (!gimp_unit_init (unit))
+ return NULL;
+
+ return gettext (gimp_unit_defs[unit].singular);
+}
+
+const gchar *
+_gimp_unit_cache_get_plural (GimpUnit unit)
+{
+ if (unit == GIMP_UNIT_PERCENT)
+ return gettext (gimp_unit_percent.plural);
+
+ if (!gimp_unit_init (unit))
+ return NULL;
+
+ return gettext (gimp_unit_defs[unit].plural);
+}
diff --git a/libgimp/gimpunitcache.h b/libgimp/gimpunitcache.h
new file mode 100644
index 0000000..245127f
--- /dev/null
+++ b/libgimp/gimpunitcache.h
@@ -0,0 +1,52 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpunitcache.c
+ * Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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/>.
+ */
+
+#ifndef __GIMP_UNIT_CACHE_H__
+#define __GIMP_UNIT_CACHE_H__
+
+G_BEGIN_DECLS
+
+
+G_GNUC_INTERNAL gint _gimp_unit_cache_get_number_of_units (void);
+G_GNUC_INTERNAL gint _gimp_unit_cache_get_number_of_built_in_units (void) G_GNUC_CONST;
+
+G_GNUC_INTERNAL GimpUnit _gimp_unit_cache_new (gchar *identifier,
+ gdouble factor,
+ gint digits,
+ gchar *symbol,
+ gchar *abbreviation,
+ gchar *singular,
+ gchar *plural);
+G_GNUC_INTERNAL gboolean _gimp_unit_cache_get_deletion_flag (GimpUnit unit);
+G_GNUC_INTERNAL void _gimp_unit_cache_set_deletion_flag (GimpUnit unit,
+ gboolean deletion_flag);
+G_GNUC_INTERNAL gdouble _gimp_unit_cache_get_factor (GimpUnit unit);
+G_GNUC_INTERNAL gint _gimp_unit_cache_get_digits (GimpUnit unit);
+G_GNUC_INTERNAL const gchar * _gimp_unit_cache_get_identifier (GimpUnit unit);
+G_GNUC_INTERNAL const gchar * _gimp_unit_cache_get_symbol (GimpUnit unit);
+G_GNUC_INTERNAL const gchar * _gimp_unit_cache_get_abbreviation (GimpUnit unit);
+G_GNUC_INTERNAL const gchar * _gimp_unit_cache_get_singular (GimpUnit unit);
+G_GNUC_INTERNAL const gchar * _gimp_unit_cache_get_plural (GimpUnit unit);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_UNIT_CACHE_H__ */
diff --git a/libgimp/gimpvectors.c b/libgimp/gimpvectors.c
new file mode 100644
index 0000000..05105a0
--- /dev/null
+++ b/libgimp/gimpvectors.c
@@ -0,0 +1,271 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpvectors.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+#include "gimpvectors.h"
+
+
+/**
+ * gimp_vectors_is_valid:
+ * @vectors_ID: The vectors object to check.
+ *
+ * Deprecated: Use gimp_item_is_valid() instead.
+ *
+ * Returns: Whether the vectors ID is valid.
+ *
+ * Since: 2.4
+ */
+gboolean
+gimp_vectors_is_valid (gint32 vectors_ID)
+{
+ return gimp_item_is_valid (vectors_ID);
+}
+
+/**
+ * gimp_vectors_get_image:
+ * @vectors_ID: The vectors object.
+ *
+ * Deprecated: Use gimp_item_get_image() instead.
+ *
+ * Returns: The vectors image.
+ *
+ * Since: 2.4
+ */
+gint32
+gimp_vectors_get_image (gint32 vectors_ID)
+{
+ return gimp_item_get_image (vectors_ID);
+}
+
+/**
+ * gimp_vectors_get_name:
+ * @vectors_ID: The vectors object.
+ *
+ * Deprecated: Use gimp_item_get_name() instead.
+ *
+ * Returns: The name of the vectors object.
+ *
+ * Since: 2.4
+ */
+gchar *
+gimp_vectors_get_name (gint32 vectors_ID)
+{
+ return gimp_item_get_name (vectors_ID);
+}
+
+/**
+ * gimp_vectors_set_name:
+ * @vectors_ID: The vectors object.
+ * @name: the new name of the path.
+ *
+ * Deprecated: Use gimp_item_set_name() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ */
+gboolean
+gimp_vectors_set_name (gint32 vectors_ID,
+ const gchar *name)
+{
+ return gimp_item_set_name (vectors_ID, name);
+}
+
+/**
+ * gimp_vectors_get_visible:
+ * @vectors_ID: The vectors object.
+ *
+ * Deprecated: Use gimp_item_get_visible() instead.
+ *
+ * Returns: TRUE if the path is visible, FALSE otherwise.
+ *
+ * Since: 2.4
+ */
+gboolean
+gimp_vectors_get_visible (gint32 vectors_ID)
+{
+ return gimp_item_get_visible (vectors_ID);
+}
+
+/**
+ * gimp_vectors_set_visible:
+ * @vectors_ID: The vectors object.
+ * @visible: Whether the path is visible.
+ *
+ * Deprecated: Use gimp_item_set_visible() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ */
+gboolean
+gimp_vectors_set_visible (gint32 vectors_ID,
+ gboolean visible)
+{
+ return gimp_item_set_visible (vectors_ID, visible);
+}
+
+/**
+ * gimp_vectors_get_linked:
+ * @vectors_ID: The vectors object.
+ *
+ * Deprecated: Use gimp_item_get_linked() instead.
+ *
+ * Returns: TRUE if the path is linked, FALSE otherwise.
+ *
+ * Since: 2.4
+ */
+gboolean
+gimp_vectors_get_linked (gint32 vectors_ID)
+{
+ return gimp_item_get_linked (vectors_ID);
+}
+
+/**
+ * gimp_vectors_set_linked:
+ * @vectors_ID: The vectors object.
+ * @linked: Whether the path is linked.
+ *
+ * Deprecated: Use gimp_item_set_linked() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ */
+gboolean
+gimp_vectors_set_linked (gint32 vectors_ID,
+ gboolean linked)
+{
+ return gimp_item_set_linked (vectors_ID, linked);
+}
+
+/**
+ * gimp_vectors_get_tattoo:
+ * @vectors_ID: The vectors object.
+ *
+ * Deprecated: Use gimp_item_get_tattoo() instead.
+ *
+ * Returns: The vectors tattoo.
+ *
+ * Since: 2.4
+ */
+gint
+gimp_vectors_get_tattoo (gint32 vectors_ID)
+{
+ return gimp_item_get_tattoo (vectors_ID);
+}
+
+/**
+ * gimp_vectors_set_tattoo:
+ * @vectors_ID: The vectors object.
+ * @tattoo: the new tattoo.
+ *
+ * Deprecated: Use gimp_item_set_tattoo() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ */
+gboolean
+gimp_vectors_set_tattoo (gint32 vectors_ID,
+ gint tattoo)
+{
+ return gimp_item_set_tattoo (vectors_ID, tattoo);
+}
+
+/**
+ * gimp_vectors_parasite_find:
+ * @vectors_ID: The vectors object.
+ * @name: The name of the parasite to find.
+ *
+ * Deprecated: Use gimp_item_get_parasite() instead.
+ *
+ * Returns: The found parasite.
+ *
+ * Since: 2.4
+ **/
+GimpParasite *
+gimp_vectors_parasite_find (gint32 vectors_ID,
+ const gchar *name)
+{
+ return gimp_item_get_parasite (vectors_ID, name);
+}
+
+/**
+ * gimp_vectors_parasite_attach:
+ * @vectors_ID: The vectors object.
+ * @parasite: The parasite to attach to a vectors object.
+ *
+ * Deprecated: Use gimp_item_attach_parasite() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_parasite_attach (gint32 vectors_ID,
+ const GimpParasite *parasite)
+{
+ return gimp_item_attach_parasite (vectors_ID, parasite);
+}
+
+/**
+ * gimp_vectors_parasite_detach:
+ * @vectors_ID: The vectors object.
+ * @name: The name of the parasite to detach from a vectors object.
+ *
+ * Deprecated: Use gimp_item_detach_parasite() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_parasite_detach (gint32 vectors_ID,
+ const gchar *name)
+{
+ return gimp_item_detach_parasite (vectors_ID, name);
+}
+
+/**
+ * gimp_vectors_parasite_list:
+ * @vectors_ID: The vectors object.
+ * @num_parasites: The number of attached parasites.
+ * @parasites: The names of currently attached parasites.
+ *
+ * Deprecated: Use gimp_item_get_parasite_list() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_parasite_list (gint32 vectors_ID,
+ gint *num_parasites,
+ gchar ***parasites)
+{
+ *parasites = gimp_item_get_parasite_list (vectors_ID, num_parasites);
+
+ return *parasites != NULL;
+}
diff --git a/libgimp/gimpvectors.h b/libgimp/gimpvectors.h
new file mode 100644
index 0000000..0608cbc
--- /dev/null
+++ b/libgimp/gimpvectors.h
@@ -0,0 +1,73 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpvectors.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_VECTORS_H__
+#define __GIMP_VECTORS_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+GIMP_DEPRECATED_FOR(gimp_item_is_valid)
+gboolean gimp_vectors_is_valid (gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_item_get_image)
+gint32 gimp_vectors_get_image (gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_item_get_name)
+gchar * gimp_vectors_get_name (gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_item_set_name)
+gboolean gimp_vectors_set_name (gint32 vectors_ID,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_item_get_visible)
+gboolean gimp_vectors_get_visible (gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_item_get_visible)
+gboolean gimp_vectors_set_visible (gint32 vectors_ID,
+ gboolean visible);
+GIMP_DEPRECATED_FOR(gimp_item_get_linked)
+gboolean gimp_vectors_get_linked (gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_item_set_linked)
+gboolean gimp_vectors_set_linked (gint32 vectors_ID,
+ gboolean linked);
+GIMP_DEPRECATED_FOR(gimp_item_get_tattoo)
+gint gimp_vectors_get_tattoo (gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_item_set_tattoo)
+gboolean gimp_vectors_set_tattoo (gint32 vectors_ID,
+ gint tattoo);
+GIMP_DEPRECATED_FOR(gimp_item_get_parasite)
+GimpParasite * gimp_vectors_parasite_find (gint32 vectors_ID,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_item_attach_parasite)
+gboolean gimp_vectors_parasite_attach (gint32 vectors_ID,
+ const GimpParasite *parasite);
+GIMP_DEPRECATED_FOR(gimp_item_detach_parasite)
+gboolean gimp_vectors_parasite_detach (gint32 vectors_ID,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_item_get_parasite_list)
+gboolean gimp_vectors_parasite_list (gint32 vectors_ID,
+ gint *num_parasites,
+ gchar ***parasites);
+
+G_END_DECLS
+
+#endif /* __GIMP_VECTORS_H__ */
diff --git a/libgimp/gimpvectors_pdb.c b/libgimp/gimpvectors_pdb.c
new file mode 100644
index 0000000..94c1d22
--- /dev/null
+++ b/libgimp/gimpvectors_pdb.c
@@ -0,0 +1,1191 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpvectors_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpvectors
+ * @title: gimpvectors
+ * @short_description: Functions for querying and manipulating vectors.
+ *
+ * Functions for querying and manipulating vectors.
+ **/
+
+
+/**
+ * gimp_vectors_new:
+ * @image_ID: The image.
+ * @name: the name of the new vector object.
+ *
+ * Creates a new empty vectors object.
+ *
+ * Creates a new empty vectors object. The vectors object needs to be
+ * added to the image using gimp_image_insert_vectors().
+ *
+ * Returns: the current vector object, 0 if no vector exists in the
+ * image.
+ *
+ * Since: 2.4
+ **/
+gint32
+gimp_vectors_new (gint32 image_ID,
+ const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 vectors_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-new",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ vectors_ID = return_vals[1].data.d_vectors;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return vectors_ID;
+}
+
+/**
+ * gimp_vectors_new_from_text_layer:
+ * @image_ID: The image.
+ * @layer_ID: The text layer.
+ *
+ * Creates a new vectors object from a text layer.
+ *
+ * Creates a new vectors object from a text layer. The vectors object
+ * needs to be added to the image using gimp_image_insert_vectors().
+ *
+ * Returns: The vectors of the text layer.
+ *
+ * Since: 2.6
+ **/
+gint32
+gimp_vectors_new_from_text_layer (gint32 image_ID,
+ gint32 layer_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 vectors_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-new-from-text-layer",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ vectors_ID = return_vals[1].data.d_vectors;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return vectors_ID;
+}
+
+/**
+ * gimp_vectors_copy:
+ * @vectors_ID: The vectors object to copy.
+ *
+ * Copy a vectors object.
+ *
+ * This procedure copies the specified vectors object and returns the
+ * copy.
+ *
+ * Returns: The newly copied vectors object.
+ *
+ * Since: 2.6
+ **/
+gint32
+gimp_vectors_copy (gint32 vectors_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint32 vectors_copy_ID = -1;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-copy",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ vectors_copy_ID = return_vals[1].data.d_vectors;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return vectors_copy_ID;
+}
+
+/**
+ * gimp_vectors_get_strokes:
+ * @vectors_ID: The vectors object.
+ * @num_strokes: The number of strokes returned.
+ *
+ * List the strokes associated with the passed path.
+ *
+ * Returns an Array with the stroke-IDs associated with the passed
+ * path.
+ *
+ * Returns: List of the strokes belonging to the path.
+ *
+ * Since: 2.4
+ **/
+gint *
+gimp_vectors_get_strokes (gint32 vectors_ID,
+ gint *num_strokes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint *stroke_ids = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-get-strokes",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_END);
+
+ *num_strokes = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_strokes = return_vals[1].data.d_int32;
+ stroke_ids = g_new (gint32, *num_strokes);
+ memcpy (stroke_ids,
+ return_vals[2].data.d_int32array,
+ *num_strokes * sizeof (gint32));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return stroke_ids;
+}
+
+/**
+ * gimp_vectors_stroke_get_length:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ * @precision: The precision used for the approximation.
+ *
+ * Measure the length of the given stroke.
+ *
+ * Measure the length of the given stroke.
+ *
+ * Returns: The length (in pixels) of the given stroke.
+ *
+ * Since: 2.4
+ **/
+gdouble
+gimp_vectors_stroke_get_length (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble precision)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble length = 0.0;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-stroke-get-length",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_FLOAT, precision,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ length = return_vals[1].data.d_float;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return length;
+}
+
+/**
+ * gimp_vectors_stroke_get_point_at_dist:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ * @dist: The given distance.
+ * @precision: The precision used for the approximation.
+ * @x_point: The x position of the point.
+ * @y_point: The y position of the point.
+ * @slope: The slope (dy / dx) at the specified point.
+ * @valid: Indicator for the validity of the returned data.
+ *
+ * Get point at a specified distance along the stroke.
+ *
+ * This will return the x,y position of a point at a given distance
+ * along the stroke. The distance will be obtained by first digitizing
+ * the curve internally and then walking along the curve. For a closed
+ * stroke the start of the path is the first point on the path that was
+ * created. This might not be obvious. If the stroke is not long
+ * enough, a \"valid\" flag will be FALSE.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_stroke_get_point_at_dist (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble dist,
+ gdouble precision,
+ gdouble *x_point,
+ gdouble *y_point,
+ gdouble *slope,
+ gboolean *valid)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-stroke-get-point-at-dist",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_FLOAT, dist,
+ GIMP_PDB_FLOAT, precision,
+ GIMP_PDB_END);
+
+ *x_point = 0.0;
+ *y_point = 0.0;
+ *slope = 0.0;
+ *valid = FALSE;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *x_point = return_vals[1].data.d_float;
+ *y_point = return_vals[2].data.d_float;
+ *slope = return_vals[3].data.d_float;
+ *valid = return_vals[4].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_remove_stroke:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ *
+ * remove the stroke from a vectors object.
+ *
+ * Remove the stroke from a vectors object.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_remove_stroke (gint32 vectors_ID,
+ gint stroke_id)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-remove-stroke",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_stroke_close:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ *
+ * closes the specified stroke.
+ *
+ * Closes the specified stroke.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_stroke_close (gint32 vectors_ID,
+ gint stroke_id)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-stroke-close",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_stroke_translate:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ * @off_x: Offset in x direction.
+ * @off_y: Offset in y direction.
+ *
+ * translate the given stroke.
+ *
+ * Translate the given stroke.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_stroke_translate (gint32 vectors_ID,
+ gint stroke_id,
+ gint off_x,
+ gint off_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-stroke-translate",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_INT32, off_x,
+ GIMP_PDB_INT32, off_y,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_stroke_scale:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ * @scale_x: Scale factor in x direction.
+ * @scale_y: Scale factor in y direction.
+ *
+ * scales the given stroke.
+ *
+ * Scale the given stroke.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_stroke_scale (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble scale_x,
+ gdouble scale_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-stroke-scale",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_FLOAT, scale_x,
+ GIMP_PDB_FLOAT, scale_y,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_stroke_rotate:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ * @center_x: X coordinate of the rotation center.
+ * @center_y: Y coordinate of the rotation center.
+ * @angle: angle to rotate about.
+ *
+ * rotates the given stroke.
+ *
+ * Rotates the given stroke around given center by angle (in degrees).
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_stroke_rotate (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble center_x,
+ gdouble center_y,
+ gdouble angle)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-stroke-rotate",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_FLOAT, center_x,
+ GIMP_PDB_FLOAT, center_y,
+ GIMP_PDB_FLOAT, angle,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_stroke_flip:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ * @flip_type: Flip orientation, either vertical or horizontal.
+ * @axis: axis coordinate about which to flip, in pixels.
+ *
+ * flips the given stroke.
+ *
+ * Rotates the given stroke around given center by angle (in degrees).
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_stroke_flip (gint32 vectors_ID,
+ gint stroke_id,
+ GimpOrientationType flip_type,
+ gdouble axis)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-stroke-flip",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_INT32, flip_type,
+ GIMP_PDB_FLOAT, axis,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_stroke_flip_free:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ * @x1: X coordinate of the first point of the flipping axis.
+ * @y1: Y coordinate of the first point of the flipping axis.
+ * @x2: X coordinate of the second point of the flipping axis.
+ * @y2: Y coordinate of the second point of the flipping axis.
+ *
+ * flips the given stroke about an arbitrary axis.
+ *
+ * Flips the given stroke about an arbitrary axis. Axis is defined by
+ * two coordinates in the image (in pixels), through which the flipping
+ * axis passes.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_stroke_flip_free (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-stroke-flip-free",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_FLOAT, x2,
+ GIMP_PDB_FLOAT, y2,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_stroke_get_points:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ * @num_points: The number of floats returned.
+ * @controlpoints: List of the control points for the stroke (x0, y0, x1, y1, ...).
+ * @closed: Whether the stroke is closed or not.
+ *
+ * returns the control points of a stroke.
+ *
+ * returns the control points of a stroke. The interpretation of the
+ * coordinates returned depends on the type of the stroke. For Gimp 2.4
+ * this is always a bezier stroke, where the coordinates are the
+ * control points.
+ *
+ * Returns: type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER
+ * for now).
+ *
+ * Since: 2.4
+ **/
+GimpVectorsStrokeType
+gimp_vectors_stroke_get_points (gint32 vectors_ID,
+ gint stroke_id,
+ gint *num_points,
+ gdouble **controlpoints,
+ gboolean *closed)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpVectorsStrokeType type = 0;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-stroke-get-points",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_END);
+
+ *num_points = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ type = return_vals[1].data.d_int32;
+ *num_points = return_vals[2].data.d_int32;
+ *controlpoints = g_new (gdouble, *num_points);
+ memcpy (*controlpoints,
+ return_vals[3].data.d_floatarray,
+ *num_points * sizeof (gdouble));
+ *closed = return_vals[4].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return type;
+}
+
+/**
+ * gimp_vectors_stroke_new_from_points:
+ * @vectors_ID: The vectors object.
+ * @type: type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now).
+ * @num_points: The number of elements in the array, i.e. the number of controlpoints in the stroke * 2 (x- and y-coordinate).
+ * @controlpoints: List of the x- and y-coordinates of the control points.
+ * @closed: Whether the stroke is to be closed or not.
+ *
+ * Adds a stroke of a given type to the vectors object.
+ *
+ * Adds a stroke of a given type to the vectors object. The coordinates
+ * of the control points can be specified. For now only strokes of the
+ * type GIMP_VECTORS_STROKE_TYPE_BEZIER are supported. The control
+ * points are specified as a pair of float values for the x- and
+ * y-coordinate. The Bezier stroke type needs a multiple of three
+ * control points. Each Bezier segment endpoint (anchor, A) has two
+ * additional control points (C) associated. They are specified in the
+ * order CACCACCAC...
+ *
+ * Returns: The stroke ID of the newly created stroke.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_vectors_stroke_new_from_points (gint32 vectors_ID,
+ GimpVectorsStrokeType type,
+ gint num_points,
+ const gdouble *controlpoints,
+ gboolean closed)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint stroke_id = 0;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-stroke-new-from-points",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, type,
+ GIMP_PDB_INT32, num_points,
+ GIMP_PDB_FLOATARRAY, controlpoints,
+ GIMP_PDB_INT32, closed,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ stroke_id = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return stroke_id;
+}
+
+/**
+ * gimp_vectors_stroke_interpolate:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ * @precision: The precision used for the approximation.
+ * @num_coords: The number of floats returned.
+ * @closed: Whether the stroke is closed or not.
+ *
+ * returns polygonal approximation of the stroke.
+ *
+ * returns polygonal approximation of the stroke.
+ *
+ * Returns: List of the coords along the path (x0, y0, x1, y1, ...).
+ *
+ * Since: 2.4
+ **/
+gdouble *
+gimp_vectors_stroke_interpolate (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble precision,
+ gint *num_coords,
+ gboolean *closed)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gdouble *coords = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-stroke-interpolate",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_FLOAT, precision,
+ GIMP_PDB_END);
+
+ *num_coords = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_coords = return_vals[1].data.d_int32;
+ coords = g_new (gdouble, *num_coords);
+ memcpy (coords,
+ return_vals[2].data.d_floatarray,
+ *num_coords * sizeof (gdouble));
+ *closed = return_vals[3].data.d_int32;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return coords;
+}
+
+/**
+ * gimp_vectors_bezier_stroke_new_moveto:
+ * @vectors_ID: The vectors object.
+ * @x0: The x-coordinate of the moveto.
+ * @y0: The y-coordinate of the moveto.
+ *
+ * Adds a bezier stroke with a single moveto to the vectors object.
+ *
+ * Adds a bezier stroke with a single moveto to the vectors object.
+ *
+ * Returns: The resulting stroke.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_vectors_bezier_stroke_new_moveto (gint32 vectors_ID,
+ gdouble x0,
+ gdouble y0)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint stroke_id = 0;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-bezier-stroke-new-moveto",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ stroke_id = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return stroke_id;
+}
+
+/**
+ * gimp_vectors_bezier_stroke_lineto:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ * @x0: The x-coordinate of the lineto.
+ * @y0: The y-coordinate of the lineto.
+ *
+ * Extends a bezier stroke with a lineto.
+ *
+ * Extends a bezier stroke with a lineto.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_bezier_stroke_lineto (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble x0,
+ gdouble y0)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-bezier-stroke-lineto",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_bezier_stroke_conicto:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ * @x0: The x-coordinate of the control point.
+ * @y0: The y-coordinate of the control point.
+ * @x1: The x-coordinate of the end point.
+ * @y1: The y-coordinate of the end point.
+ *
+ * Extends a bezier stroke with a conic bezier spline.
+ *
+ * Extends a bezier stroke with a conic bezier spline. Actually a cubic
+ * bezier spline gets added that realizes the shape of a conic bezier
+ * spline.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_bezier_stroke_conicto (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-bezier-stroke-conicto",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_bezier_stroke_cubicto:
+ * @vectors_ID: The vectors object.
+ * @stroke_id: The stroke ID.
+ * @x0: The x-coordinate of the first control point.
+ * @y0: The y-coordinate of the first control point.
+ * @x1: The x-coordinate of the second control point.
+ * @y1: The y-coordinate of the second control point.
+ * @x2: The x-coordinate of the end point.
+ * @y2: The y-coordinate of the end point.
+ *
+ * Extends a bezier stroke with a cubic bezier spline.
+ *
+ * Extends a bezier stroke with a cubic bezier spline.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_bezier_stroke_cubicto (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-bezier-stroke-cubicto",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, stroke_id,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, x1,
+ GIMP_PDB_FLOAT, y1,
+ GIMP_PDB_FLOAT, x2,
+ GIMP_PDB_FLOAT, y2,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_bezier_stroke_new_ellipse:
+ * @vectors_ID: The vectors object.
+ * @x0: The x-coordinate of the center.
+ * @y0: The y-coordinate of the center.
+ * @radius_x: The radius in x direction.
+ * @radius_y: The radius in y direction.
+ * @angle: The angle the x-axis of the ellipse (radians, counterclockwise).
+ *
+ * Adds a bezier stroke describing an ellipse the vectors object.
+ *
+ * Adds a bezier stroke describing an ellipse the vectors object.
+ *
+ * Returns: The resulting stroke.
+ *
+ * Since: 2.4
+ **/
+gint
+gimp_vectors_bezier_stroke_new_ellipse (gint32 vectors_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble radius_x,
+ gdouble radius_y,
+ gdouble angle)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gint stroke_id = 0;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-bezier-stroke-new-ellipse",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_FLOAT, x0,
+ GIMP_PDB_FLOAT, y0,
+ GIMP_PDB_FLOAT, radius_x,
+ GIMP_PDB_FLOAT, radius_y,
+ GIMP_PDB_FLOAT, angle,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ stroke_id = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return stroke_id;
+}
+
+/**
+ * gimp_vectors_to_selection:
+ * @vectors_ID: The vectors object to render to the selection.
+ * @operation: The desired operation with current selection.
+ * @antialias: Antialias selection.
+ * @feather: Feather selection.
+ * @feather_radius_x: Feather radius x.
+ * @feather_radius_y: Feather radius y.
+ *
+ * Deprecated: Use gimp_image_select_item() instead.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_to_selection (gint32 vectors_ID,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-to-selection",
+ &nreturn_vals,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_INT32, operation,
+ GIMP_PDB_INT32, antialias,
+ GIMP_PDB_INT32, feather,
+ GIMP_PDB_FLOAT, feather_radius_x,
+ GIMP_PDB_FLOAT, feather_radius_y,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_import_from_file:
+ * @image_ID: The image.
+ * @filename: The name of the SVG file to import.
+ * @merge: Merge paths into a single vectors object.
+ * @scale: Scale the SVG to image dimensions.
+ * @num_vectors: The number of newly created vectors.
+ * @vectors_ids: The list of newly created vectors.
+ *
+ * Import paths from an SVG file.
+ *
+ * This procedure imports paths from an SVG file. SVG elements other
+ * than paths and basic shapes are ignored.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_import_from_file (gint32 image_ID,
+ const gchar *filename,
+ gboolean merge,
+ gboolean scale,
+ gint *num_vectors,
+ gint32 **vectors_ids)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-import-from-file",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, filename,
+ GIMP_PDB_INT32, merge,
+ GIMP_PDB_INT32, scale,
+ GIMP_PDB_END);
+
+ *num_vectors = 0;
+ *vectors_ids = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *num_vectors = return_vals[1].data.d_int32;
+ *vectors_ids = g_new (gint32, *num_vectors);
+ memcpy (*vectors_ids,
+ return_vals[2].data.d_int32array,
+ *num_vectors * sizeof (gint32));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_import_from_string:
+ * @image_ID: The image.
+ * @string: A string that must be a complete and valid SVG document.
+ * @length: Number of bytes in string or -1 if the string is NULL terminated.
+ * @merge: Merge paths into a single vectors object.
+ * @scale: Scale the SVG to image dimensions.
+ * @num_vectors: The number of newly created vectors.
+ * @vectors_ids: The list of newly created vectors.
+ *
+ * Import paths from an SVG string.
+ *
+ * This procedure works like gimp_vectors_import_from_file() but takes
+ * a string rather than reading the SVG from a file. This allows you to
+ * write scripts that generate SVG and feed it to GIMP.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_vectors_import_from_string (gint32 image_ID,
+ const gchar *string,
+ gint length,
+ gboolean merge,
+ gboolean scale,
+ gint *num_vectors,
+ gint32 **vectors_ids)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-import-from-string",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, string,
+ GIMP_PDB_INT32, length,
+ GIMP_PDB_INT32, merge,
+ GIMP_PDB_INT32, scale,
+ GIMP_PDB_END);
+
+ *num_vectors = 0;
+ *vectors_ids = NULL;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *num_vectors = return_vals[1].data.d_int32;
+ *vectors_ids = g_new (gint32, *num_vectors);
+ memcpy (*vectors_ids,
+ return_vals[2].data.d_int32array,
+ *num_vectors * sizeof (gint32));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_export_to_file:
+ * @image_ID: The image.
+ * @filename: The name of the SVG file to create.
+ * @vectors_ID: The vectors object to be saved, or 0 for all in the image.
+ *
+ * save a path as an SVG file.
+ *
+ * This procedure creates an SVG file to save a Vectors object, that
+ * is, a path. The resulting file can be edited using a vector graphics
+ * application, or later reloaded into GIMP. If you pass 0 as the
+ * 'vectors' argument, then all paths in the image will be exported.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_vectors_export_to_file (gint32 image_ID,
+ const gchar *filename,
+ gint32 vectors_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-export-to-file",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_STRING, filename,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_vectors_export_to_string:
+ * @image_ID: The image.
+ * @vectors_ID: The vectors object to save, or 0 for all in the image.
+ *
+ * Save a path as an SVG string.
+ *
+ * This procedure works like gimp_vectors_export_to_file() but creates
+ * a string rather than a file. The contents are a NUL-terminated
+ * string that holds a complete XML document. If you pass 0 as the
+ * 'vectors' argument, then all paths in the image will be exported.
+ *
+ * Returns: A string whose contents are a complete SVG document.
+ *
+ * Since: 2.6
+ **/
+gchar *
+gimp_vectors_export_to_string (gint32 image_ID,
+ gint32 vectors_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar *string = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-vectors-export-to-string",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_VECTORS, vectors_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ string = g_strdup (return_vals[1].data.d_string);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return string;
+}
diff --git a/libgimp/gimpvectors_pdb.h b/libgimp/gimpvectors_pdb.h
new file mode 100644
index 0000000..c425185
--- /dev/null
+++ b/libgimp/gimpvectors_pdb.h
@@ -0,0 +1,151 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpvectors_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_VECTORS_PDB_H__
+#define __GIMP_VECTORS_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gint32 gimp_vectors_new (gint32 image_ID,
+ const gchar *name);
+gint32 gimp_vectors_new_from_text_layer (gint32 image_ID,
+ gint32 layer_ID);
+gint32 gimp_vectors_copy (gint32 vectors_ID);
+gint* gimp_vectors_get_strokes (gint32 vectors_ID,
+ gint *num_strokes);
+gdouble gimp_vectors_stroke_get_length (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble precision);
+gboolean gimp_vectors_stroke_get_point_at_dist (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble dist,
+ gdouble precision,
+ gdouble *x_point,
+ gdouble *y_point,
+ gdouble *slope,
+ gboolean *valid);
+gboolean gimp_vectors_remove_stroke (gint32 vectors_ID,
+ gint stroke_id);
+gboolean gimp_vectors_stroke_close (gint32 vectors_ID,
+ gint stroke_id);
+gboolean gimp_vectors_stroke_translate (gint32 vectors_ID,
+ gint stroke_id,
+ gint off_x,
+ gint off_y);
+gboolean gimp_vectors_stroke_scale (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble scale_x,
+ gdouble scale_y);
+gboolean gimp_vectors_stroke_rotate (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble center_x,
+ gdouble center_y,
+ gdouble angle);
+gboolean gimp_vectors_stroke_flip (gint32 vectors_ID,
+ gint stroke_id,
+ GimpOrientationType flip_type,
+ gdouble axis);
+gboolean gimp_vectors_stroke_flip_free (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2);
+GimpVectorsStrokeType gimp_vectors_stroke_get_points (gint32 vectors_ID,
+ gint stroke_id,
+ gint *num_points,
+ gdouble **controlpoints,
+ gboolean *closed);
+gint gimp_vectors_stroke_new_from_points (gint32 vectors_ID,
+ GimpVectorsStrokeType type,
+ gint num_points,
+ const gdouble *controlpoints,
+ gboolean closed);
+gdouble* gimp_vectors_stroke_interpolate (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble precision,
+ gint *num_coords,
+ gboolean *closed);
+gint gimp_vectors_bezier_stroke_new_moveto (gint32 vectors_ID,
+ gdouble x0,
+ gdouble y0);
+gboolean gimp_vectors_bezier_stroke_lineto (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble x0,
+ gdouble y0);
+gboolean gimp_vectors_bezier_stroke_conicto (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1);
+gboolean gimp_vectors_bezier_stroke_cubicto (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2);
+gint gimp_vectors_bezier_stroke_new_ellipse (gint32 vectors_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble radius_x,
+ gdouble radius_y,
+ gdouble angle);
+GIMP_DEPRECATED_FOR(gimp_image_select_item)
+gboolean gimp_vectors_to_selection (gint32 vectors_ID,
+ GimpChannelOps operation,
+ gboolean antialias,
+ gboolean feather,
+ gdouble feather_radius_x,
+ gdouble feather_radius_y);
+gboolean gimp_vectors_import_from_file (gint32 image_ID,
+ const gchar *filename,
+ gboolean merge,
+ gboolean scale,
+ gint *num_vectors,
+ gint32 **vectors_ids);
+gboolean gimp_vectors_import_from_string (gint32 image_ID,
+ const gchar *string,
+ gint length,
+ gboolean merge,
+ gboolean scale,
+ gint *num_vectors,
+ gint32 **vectors_ids);
+gboolean gimp_vectors_export_to_file (gint32 image_ID,
+ const gchar *filename,
+ gint32 vectors_ID);
+gchar* gimp_vectors_export_to_string (gint32 image_ID,
+ gint32 vectors_ID);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_VECTORS_PDB_H__ */
diff --git a/libgimp/gimpzoompreview.c b/libgimp/gimpzoompreview.c
new file mode 100644
index 0000000..eb0735a
--- /dev/null
+++ b/libgimp/gimpzoompreview.c
@@ -0,0 +1,1013 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpzoompreview.c
+ * Copyright (C) 2005 David Odin <dindinx@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+/* we use our own deprecated API here */
+#define GIMP_DISABLE_DEPRECATION_WARNINGS
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "gimpuitypes.h"
+
+#include "gimp.h"
+
+#include "gimpdrawablepreview.h"
+#include "gimpzoompreview.h"
+
+
+/**
+ * SECTION: gimpzoompreview
+ * @title: GimpZoomPreview
+ * @short_description: A drawable preview with zooming capabilities.
+ *
+ * A drawable preview with zooming capabilities.
+ **/
+
+
+enum
+{
+ PROP_0,
+ PROP_DRAWABLE,
+ PROP_DRAWABLE_ID,
+ PROP_MODEL
+};
+
+
+struct _GimpZoomPreviewPrivate
+{
+ gint32 drawable_ID;
+ GimpDrawable *drawable;
+ GimpZoomModel *model;
+ GdkRectangle extents;
+};
+
+typedef struct
+{
+ gboolean update;
+} PreviewSettings;
+
+
+#define GIMP_ZOOM_PREVIEW_GET_PRIVATE(obj) \
+ ((GimpZoomPreviewPrivate *) ((GimpZoomPreview *) (obj))->priv)
+
+static void gimp_zoom_preview_constructed (GObject *object);
+static void gimp_zoom_preview_finalize (GObject *object);
+static void gimp_zoom_preview_dispose (GObject *object);
+static void gimp_zoom_preview_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_zoom_preview_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_zoom_preview_set_adjustments (GimpZoomPreview *preview,
+ gdouble old_factor,
+ gdouble new_factor);
+static void gimp_zoom_preview_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation,
+ GimpZoomPreview *preview);
+static void gimp_zoom_preview_style_set (GtkWidget *widget,
+ GtkStyle *prev_style);
+static gboolean gimp_zoom_preview_scroll_event (GtkWidget *widget,
+ GdkEventScroll *event,
+ GimpZoomPreview *preview);
+static void gimp_zoom_preview_draw (GimpPreview *preview);
+static void gimp_zoom_preview_draw_buffer (GimpPreview *preview,
+ const guchar *buffer,
+ gint rowstride);
+static void gimp_zoom_preview_draw_thumb (GimpPreview *preview,
+ GimpPreviewArea *area,
+ gint width,
+ gint height);
+static void gimp_zoom_preview_set_cursor (GimpPreview *preview);
+static void gimp_zoom_preview_transform (GimpPreview *preview,
+ gint src_x,
+ gint src_y,
+ gint *dest_x,
+ gint *dest_y);
+static void gimp_zoom_preview_untransform (GimpPreview *preview,
+ gint src_x,
+ gint src_y,
+ gint *dest_x,
+ gint *dest_y);
+
+static void gimp_zoom_preview_set_drawable (GimpZoomPreview *preview,
+ GimpDrawable *drawable);
+static void gimp_zoom_preview_set_drawable_id (GimpZoomPreview *preview,
+ gint32 drawable_ID);
+static void gimp_zoom_preview_set_model (GimpZoomPreview *preview,
+ GimpZoomModel *model);
+
+static void gimp_zoom_preview_get_source_area (GimpPreview *preview,
+ gint *x,
+ gint *y,
+ gint *w,
+ gint *h);
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (GimpZoomPreview, gimp_zoom_preview,
+ GIMP_TYPE_SCROLLED_PREVIEW)
+
+#define parent_class gimp_zoom_preview_parent_class
+
+static gint gimp_zoom_preview_counter = 0;
+
+
+static void
+gimp_zoom_preview_class_init (GimpZoomPreviewClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
+
+ object_class->constructed = gimp_zoom_preview_constructed;
+ object_class->finalize = gimp_zoom_preview_finalize;
+ object_class->dispose = gimp_zoom_preview_dispose;
+ object_class->get_property = gimp_zoom_preview_get_property;
+ object_class->set_property = gimp_zoom_preview_set_property;
+
+ widget_class->style_set = gimp_zoom_preview_style_set;
+
+ preview_class->draw = gimp_zoom_preview_draw;
+ preview_class->draw_buffer = gimp_zoom_preview_draw_buffer;
+ preview_class->draw_thumb = gimp_zoom_preview_draw_thumb;
+ preview_class->set_cursor = gimp_zoom_preview_set_cursor;
+ preview_class->transform = gimp_zoom_preview_transform;
+ preview_class->untransform = gimp_zoom_preview_untransform;
+
+ /**
+ * GimpZoomPreview:drawable:
+ *
+ * The drawable the #GimpZoomPreview is attached to.
+ *
+ * Deprecated: use the drawable-id property instead.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_DRAWABLE,
+ g_param_spec_pointer ("drawable",
+ "Drawable",
+ "Deprecated: use the drawable-id property instead",
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * GimpZoomPreview:drawable-id:
+ *
+ * The drawable the #GimpZoomPreview is attached to.
+ *
+ * Since: 2.10
+ */
+ g_object_class_install_property (object_class, PROP_DRAWABLE_ID,
+ g_param_spec_int ("drawable-id",
+ "Drawable ID",
+ "The drawable this preview is attached to",
+ -1, G_MAXINT, -1,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * GimpZoomPreview:model:
+ *
+ * The #GimpZoomModel used by this #GimpZoomPreview.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class, PROP_MODEL,
+ g_param_spec_object ("model",
+ "Model",
+ "The zoom preview's GimpZoomModel",
+ GIMP_TYPE_ZOOM_MODEL,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+gimp_zoom_preview_init (GimpZoomPreview *preview)
+{
+ preview->priv = gimp_zoom_preview_get_instance_private (preview);
+
+ g_signal_connect (GIMP_PREVIEW (preview)->area, "size-allocate",
+ G_CALLBACK (gimp_zoom_preview_size_allocate),
+ preview);
+ g_signal_connect (GIMP_PREVIEW (preview)->area, "scroll-event",
+ G_CALLBACK (gimp_zoom_preview_scroll_event),
+ preview);
+
+ g_object_set (GIMP_PREVIEW (preview)->area,
+ "check-size", gimp_check_size (),
+ "check-type", gimp_check_type (),
+ NULL);
+
+ gimp_scrolled_preview_set_policy (GIMP_SCROLLED_PREVIEW (preview),
+ GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
+}
+
+static void
+gimp_zoom_preview_constructed (GObject *object)
+{
+ GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (object);
+ gchar *data_name;
+ PreviewSettings settings;
+
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ data_name = g_strdup_printf ("%s-zoom-preview-%d",
+ g_get_prgname (),
+ gimp_zoom_preview_counter++);
+
+ if (gimp_get_data (data_name, &settings))
+ {
+ gimp_preview_set_update (GIMP_PREVIEW (object), settings.update);
+ }
+
+ g_object_set_data_full (object, "gimp-zoom-preview-data-name",
+ data_name, (GDestroyNotify) g_free);
+
+ if (! priv->model)
+ {
+ GimpZoomModel *model = gimp_zoom_model_new ();
+
+ gimp_zoom_model_set_range (model, 1.0, 256.0);
+ gimp_zoom_preview_set_model (GIMP_ZOOM_PREVIEW (object), model);
+
+ g_object_unref (model);
+ }
+
+ gimp_zoom_preview_set_adjustments (GIMP_ZOOM_PREVIEW (object), 1.0, 1.0);
+}
+
+static void
+gimp_zoom_preview_finalize (GObject *object)
+{
+ GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (object);
+
+ g_clear_object (&priv->model);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gimp_zoom_preview_dispose (GObject *object)
+{
+ const gchar *data_name = g_object_get_data (G_OBJECT (object),
+ "gimp-zoom-preview-data-name");
+
+ if (data_name)
+ {
+ GimpPreview *preview = GIMP_PREVIEW (object);
+ PreviewSettings settings;
+
+ settings.update = gimp_preview_get_update (preview);
+
+ gimp_set_data (data_name, &settings, sizeof (PreviewSettings));
+ }
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+gimp_zoom_preview_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpZoomPreview *preview = GIMP_ZOOM_PREVIEW (object);
+
+ switch (property_id)
+ {
+ case PROP_DRAWABLE:
+ g_value_set_pointer (value, gimp_zoom_preview_get_drawable (preview));
+ break;
+
+ case PROP_DRAWABLE_ID:
+ g_value_set_int (value, gimp_zoom_preview_get_drawable_id (preview));
+ break;
+
+ case PROP_MODEL:
+ g_value_set_object (value, gimp_zoom_preview_get_model (preview));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_zoom_preview_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpZoomPreview *preview = GIMP_ZOOM_PREVIEW (object);
+
+ switch (property_id)
+ {
+ case PROP_DRAWABLE:
+ g_return_if_fail (preview->priv->drawable_ID < 1);
+ if (g_value_get_pointer (value))
+ gimp_zoom_preview_set_drawable (preview, g_value_get_pointer (value));
+ break;
+
+ case PROP_DRAWABLE_ID:
+ gimp_zoom_preview_set_drawable_id (preview, g_value_get_int (value));
+ break;
+
+ case PROP_MODEL:
+ gimp_zoom_preview_set_model (preview, g_value_get_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_zoom_preview_set_adjustments (GimpZoomPreview *preview,
+ gdouble old_factor,
+ gdouble new_factor)
+{
+ GimpScrolledPreview *scrolled_preview = GIMP_SCROLLED_PREVIEW (preview);
+ GtkAdjustment *adj;
+ gdouble width;
+ gdouble height;
+ gdouble ratio;
+
+ gimp_scrolled_preview_freeze (scrolled_preview);
+
+ width = GIMP_PREVIEW (preview)->width;
+ height = GIMP_PREVIEW (preview)->height;
+
+ ratio = new_factor / old_factor;
+
+ adj = gtk_range_get_adjustment (GTK_RANGE (scrolled_preview->hscr));
+ gtk_adjustment_configure (adj,
+ (gtk_adjustment_get_value (adj) + width / 2.0) * ratio
+ - width / 2.0,
+ 0,
+ width * new_factor,
+ new_factor,
+ MAX (width / 2.0, new_factor),
+ width);
+
+ adj = gtk_range_get_adjustment (GTK_RANGE (scrolled_preview->vscr));
+ gtk_adjustment_configure (adj,
+ (gtk_adjustment_get_value (adj) + height / 2.0) * ratio
+ - height / 2.0,
+ 0,
+ height * new_factor,
+ new_factor,
+ MAX (height / 2.0, new_factor),
+ height);
+
+ gimp_scrolled_preview_thaw (scrolled_preview);
+}
+
+static void
+gimp_zoom_preview_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation,
+ GimpZoomPreview *preview)
+{
+ gdouble zoom;
+
+ gint width = GIMP_PREVIEW (preview)->xmax - GIMP_PREVIEW (preview)->xmin;
+ gint height = GIMP_PREVIEW (preview)->ymax - GIMP_PREVIEW (preview)->ymin;
+
+ GIMP_PREVIEW (preview)->width = MIN (width, allocation->width);
+ GIMP_PREVIEW (preview)->height = MIN (height, allocation->height);
+
+ zoom = gimp_zoom_model_get_factor (preview->priv->model);
+
+ gimp_zoom_preview_set_adjustments (preview, zoom, zoom);
+}
+
+static void
+gimp_zoom_preview_style_set (GtkWidget *widget,
+ GtkStyle *prev_style)
+{
+ GimpPreview *preview = GIMP_PREVIEW (widget);
+ GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW (preview)->priv;
+ gint size;
+ gint width, height;
+ gint x1, y1;
+ gint x2, y2;
+
+ if (GTK_WIDGET_CLASS (parent_class)->style_set)
+ GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+
+ gtk_widget_style_get (widget, "size", &size, NULL);
+
+ if (_gimp_drawable_preview_get_bounds (priv->drawable_ID,
+ &x1, &y1, &x2, &y2))
+ {
+ width = x2 - x1;
+ height = y2 - y1;
+ }
+ else
+ {
+ width = gimp_drawable_width (priv->drawable_ID);
+ height = gimp_drawable_height (priv->drawable_ID);
+ }
+
+ if (width > height)
+ {
+ preview->width = MIN (width, size);
+ preview->height = (height * preview->width) / width;
+ }
+ else
+ {
+ preview->height = MIN (height, size);
+ preview->width = (width * preview->height) / height;
+ }
+
+ gtk_widget_set_size_request (preview->area,
+ preview->width, preview->height);
+}
+
+static gboolean
+gimp_zoom_preview_scroll_event (GtkWidget *widget,
+ GdkEventScroll *event,
+ GimpZoomPreview *preview)
+{
+ if (event->state & GDK_CONTROL_MASK)
+ {
+ GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (preview);
+
+ gimp_scrolled_preview_freeze (GIMP_SCROLLED_PREVIEW (preview));
+
+ switch (event->direction)
+ {
+ case GDK_SCROLL_UP:
+ gimp_zoom_model_zoom (priv->model, GIMP_ZOOM_IN, 0.0);
+ break;
+
+ case GDK_SCROLL_DOWN:
+ gimp_zoom_model_zoom (priv->model, GIMP_ZOOM_OUT, 0.0);
+ break;
+
+ default:
+ break;
+ }
+
+ gimp_scrolled_preview_thaw (GIMP_SCROLLED_PREVIEW (preview));
+ }
+
+ return FALSE;
+}
+
+static void
+gimp_zoom_preview_draw (GimpPreview *preview)
+{
+ GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW (preview)->priv;
+ guchar *data;
+ gint width;
+ gint height;
+ gint bpp;
+
+ if (! priv->model)
+ return;
+
+ if (priv->drawable_ID < 1)
+ return;
+
+ data = gimp_zoom_preview_get_source (GIMP_ZOOM_PREVIEW (preview),
+ &width, &height, &bpp);
+
+ if (data)
+ {
+ gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview->area),
+ 0, 0, width, height,
+ gimp_drawable_type (priv->drawable_ID),
+ data, width * bpp);
+ g_free (data);
+ }
+}
+
+static void
+gimp_zoom_preview_draw_buffer (GimpPreview *preview,
+ const guchar *buffer,
+ gint rowstride)
+{
+ GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW (preview)->priv;
+ gint32 image_ID;
+
+ image_ID = gimp_item_get_image (priv->drawable_ID);
+
+ if (gimp_selection_is_empty (image_ID))
+ {
+ gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview->area),
+ 0, 0,
+ preview->width, preview->height,
+ gimp_drawable_type (priv->drawable_ID),
+ buffer,
+ rowstride);
+ }
+ else
+ {
+ guchar *sel;
+ guchar *src;
+ gint selection_ID;
+ gint width, height;
+ gint bpp;
+ gint src_x;
+ gint src_y;
+ gint src_width;
+ gint src_height;
+ gint offsx = 0;
+ gint offsy = 0;
+
+ selection_ID = gimp_image_get_selection (image_ID);
+
+ width = preview->width;
+ height = preview->height;
+
+ gimp_zoom_preview_get_source_area (preview,
+ &src_x, &src_y,
+ &src_width, &src_height);
+
+ src = gimp_drawable_get_sub_thumbnail_data (priv->drawable_ID,
+ src_x, src_y,
+ src_width, src_height,
+ &width, &height, &bpp);
+ gimp_drawable_offsets (priv->drawable_ID, &offsx, &offsy);
+ sel = gimp_drawable_get_sub_thumbnail_data (selection_ID,
+ src_x + offsx, src_y + offsy,
+ src_width, src_height,
+ &width, &height, &bpp);
+
+ gimp_preview_area_mask (GIMP_PREVIEW_AREA (preview->area),
+ 0, 0, preview->width, preview->height,
+ gimp_drawable_type (priv->drawable_ID),
+ src, width * gimp_drawable_bpp (priv->drawable_ID),
+ buffer, rowstride,
+ sel, width);
+
+ g_free (sel);
+ g_free (src);
+ }
+
+}
+
+static void
+gimp_zoom_preview_draw_thumb (GimpPreview *preview,
+ GimpPreviewArea *area,
+ gint width,
+ gint height)
+{
+ GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW (preview)->priv;
+
+ if (priv->drawable_ID > 0)
+ _gimp_drawable_preview_area_draw_thumb (area, priv->drawable_ID,
+ width, height);
+}
+
+static void
+gimp_zoom_preview_set_cursor (GimpPreview *preview)
+{
+ if (! gtk_widget_get_realized (preview->area))
+ return;
+
+ if (gimp_zoom_preview_get_factor (GIMP_ZOOM_PREVIEW (preview)) > 1.0)
+ {
+ gdk_window_set_cursor (gtk_widget_get_window (preview->area),
+ GIMP_SCROLLED_PREVIEW (preview)->cursor_move);
+ }
+ else
+ {
+ gdk_window_set_cursor (gtk_widget_get_window (preview->area),
+ preview->default_cursor);
+ }
+}
+
+static void
+gimp_zoom_preview_transform (GimpPreview *preview,
+ gint src_x,
+ gint src_y,
+ gint *dest_x,
+ gint *dest_y)
+{
+ GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW (preview)->priv;
+
+ gdouble zoom = gimp_zoom_preview_get_factor (GIMP_ZOOM_PREVIEW (preview));
+
+ *dest_x = ((gdouble) (src_x - priv->extents.x) *
+ preview->width / priv->extents.width * zoom) - preview->xoff;
+
+ *dest_y = ((gdouble) (src_y - priv->extents.y) *
+ preview->height / priv->extents.height * zoom) - preview->yoff;
+}
+
+static void
+gimp_zoom_preview_untransform (GimpPreview *preview,
+ gint src_x,
+ gint src_y,
+ gint *dest_x,
+ gint *dest_y)
+{
+ GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW (preview)->priv;
+
+ gdouble zoom = gimp_zoom_preview_get_factor (GIMP_ZOOM_PREVIEW (preview));
+
+ *dest_x = (priv->extents.x +
+ ((gdouble) (src_x + preview->xoff) *
+ priv->extents.width / preview->width / zoom));
+
+ *dest_y = (priv->extents.y +
+ ((gdouble) (src_y + preview->yoff) *
+ priv->extents.height / preview->height / zoom));
+}
+
+static void
+gimp_zoom_preview_set_drawable (GimpZoomPreview *preview,
+ GimpDrawable *drawable)
+{
+ g_return_if_fail (preview->priv->drawable == NULL);
+ g_return_if_fail (preview->priv->drawable_ID < 1);
+
+ preview->priv->drawable = drawable;
+
+ gimp_zoom_preview_set_drawable_id (preview, drawable->drawable_id);
+}
+
+static void
+gimp_zoom_preview_set_drawable_id (GimpZoomPreview *preview,
+ gint32 drawable_ID)
+{
+ GimpZoomPreviewPrivate *priv = preview->priv;
+ gint x, y;
+ gint width, height;
+ gint max_width, max_height;
+
+ g_return_if_fail (preview->priv->drawable_ID < 1);
+
+ priv->drawable_ID = drawable_ID;
+
+ if (gimp_drawable_mask_intersect (drawable_ID, &x, &y, &width, &height))
+ {
+ priv->extents.x = x;
+ priv->extents.y = y;
+ }
+ else
+ {
+ width = gimp_drawable_width (drawable_ID);
+ height = gimp_drawable_height (drawable_ID);
+
+ priv->extents.x = 0;
+ priv->extents.y = 0;
+ }
+
+ priv->extents.width = width;
+ priv->extents.height = height;
+
+ if (width > height)
+ {
+ max_width = MIN (width, 512);
+ max_height = (height * max_width) / width;
+ }
+ else
+ {
+ max_height = MIN (height, 512);
+ max_width = (width * max_height) / height;
+ }
+
+ gimp_preview_set_bounds (GIMP_PREVIEW (preview),
+ 0, 0, max_width, max_height);
+
+ g_object_set (GIMP_PREVIEW (preview)->frame,
+ "ratio", (gdouble) width / (gdouble) height,
+ NULL);
+}
+
+static void
+gimp_zoom_preview_set_model (GimpZoomPreview *preview,
+ GimpZoomModel *model)
+{
+ GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (preview);
+ GtkWidget *button_bar;
+ GtkWidget *button;
+ GtkWidget *box;
+
+ g_return_if_fail (priv->model == NULL);
+
+ if (! model)
+ return;
+
+ priv->model = g_object_ref (model);
+
+ g_signal_connect_swapped (priv->model, "zoomed",
+ G_CALLBACK (gimp_zoom_preview_set_adjustments),
+ preview);
+
+ box = gimp_preview_get_controls (GIMP_PREVIEW (preview));
+ g_return_if_fail (GTK_IS_BOX (box));
+
+ button_bar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+ gtk_box_pack_end (GTK_BOX (box), button_bar, FALSE, FALSE, 0);
+ gtk_widget_show (button_bar);
+
+ /* zoom out */
+ button = gimp_zoom_button_new (priv->model,
+ GIMP_ZOOM_OUT, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_box_pack_start (GTK_BOX (button_bar), button, FALSE, FALSE, 0);
+ gtk_widget_show (button);
+
+ /* zoom in */
+ button = gimp_zoom_button_new (priv->model,
+ GIMP_ZOOM_IN, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_box_pack_start (GTK_BOX (button_bar), button, FALSE, FALSE, 0);
+ gtk_widget_show (button);
+}
+
+static void
+gimp_zoom_preview_get_source_area (GimpPreview *preview,
+ gint *x,
+ gint *y,
+ gint *w,
+ gint *h)
+{
+ GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (preview);
+ gdouble zoom = gimp_zoom_model_get_factor (priv->model);
+
+ gimp_zoom_preview_untransform (preview, 0, 0, x, y);
+
+ *w = priv->extents.width / zoom;
+ *h = priv->extents.height / zoom;
+}
+
+
+/**
+ * gimp_zoom_preview_new_from_drawable_id:
+ * @drawable_ID: a drawable ID
+ *
+ * Creates a new #GimpZoomPreview widget for @drawable_ID.
+ *
+ * Since: 2.10
+ *
+ * Returns: a new #GimpZoomPreview.
+ **/
+GtkWidget *
+gimp_zoom_preview_new_from_drawable_id (gint32 drawable_ID)
+{
+ g_return_val_if_fail (gimp_item_is_valid (drawable_ID), NULL);
+ g_return_val_if_fail (gimp_item_is_drawable (drawable_ID), NULL);
+
+ return g_object_new (GIMP_TYPE_ZOOM_PREVIEW,
+ "drawable-id", drawable_ID,
+ NULL);
+}
+
+/**
+ * gimp_zoom_preview_new_with_model_from_drawable_id:
+ * @drawable_ID: a drawable ID
+ * @model: a #GimpZoomModel
+ *
+ * Creates a new #GimpZoomPreview widget for @drawable_ID using the
+ * given @model.
+ *
+ * This variant of gimp_zoom_preview_new_from_drawable_id() allows you
+ * to create a preview using an existing zoom model. This may be
+ * useful if for example you want to have two zoom previews that keep
+ * their zoom factor in sync.
+ *
+ * Since: 2.10
+ *
+ * Returns: a new #GimpZoomPreview.
+ **/
+GtkWidget *
+gimp_zoom_preview_new_with_model_from_drawable_id (gint32 drawable_ID,
+ GimpZoomModel *model)
+
+{
+ g_return_val_if_fail (gimp_item_is_valid (drawable_ID), NULL);
+ g_return_val_if_fail (gimp_item_is_drawable (drawable_ID), NULL);
+ g_return_val_if_fail (GIMP_IS_ZOOM_MODEL (model), NULL);
+
+ return g_object_new (GIMP_TYPE_ZOOM_PREVIEW,
+ "drawable-id", drawable_ID,
+ "model", model,
+ NULL);
+}
+
+/**
+ * gimp_zoom_preview_new:
+ * @drawable: a #GimpDrawable
+ *
+ * Creates a new #GimpZoomPreview widget for @drawable.
+ *
+ * Deprecated: 2.10: Use gimp_zoom_preview_new_from_drawable_id() instead.
+ *
+ * Since: 2.4
+ *
+ * Returns: a new #GimpZoomPreview.
+ **/
+GtkWidget *
+gimp_zoom_preview_new (GimpDrawable *drawable)
+{
+ g_return_val_if_fail (drawable != NULL, NULL);
+
+ return g_object_new (GIMP_TYPE_ZOOM_PREVIEW,
+ "drawable", drawable,
+ NULL);
+}
+
+/**
+ * gimp_zoom_preview_new_with_model:
+ * @drawable: a #GimpDrawable
+ * @model: a #GimpZoomModel
+ *
+ * Creates a new #GimpZoomPreview widget for @drawable using the
+ * given @model.
+ *
+ * This variant of gimp_zoom_preview_new() allows you to create a
+ * preview using an existing zoom model. This may be useful if for
+ * example you want to have two zoom previews that keep their zoom
+ * factor in sync.
+ *
+ * Deprecated: 2.10: Use gimp_zoom_preview_new_with_model_from_drawable_id()
+ * instead.
+ *
+ * Since: 2.4
+ *
+ * Returns: a new #GimpZoomPreview.
+ **/
+GtkWidget *
+gimp_zoom_preview_new_with_model (GimpDrawable *drawable,
+ GimpZoomModel *model)
+
+{
+ g_return_val_if_fail (drawable != NULL, NULL);
+ g_return_val_if_fail (GIMP_IS_ZOOM_MODEL (model), NULL);
+
+ return g_object_new (GIMP_TYPE_ZOOM_PREVIEW,
+ "drawable", drawable,
+ "model", model,
+ NULL);
+}
+
+
+/**
+ * gimp_zoom_preview_get_drawable_id:
+ * @preview: a #GimpZoomPreview widget
+ *
+ * Returns the drawable_ID the #GimpZoomPreview is attached to.
+ *
+ * Return Value: the drawable_ID that was passed to
+ * gimp_zoom_preview_new_from_drawable_id().
+ *
+ * Since: 2.10
+ **/
+gint32
+gimp_zoom_preview_get_drawable_id (GimpZoomPreview *preview)
+{
+ g_return_val_if_fail (GIMP_IS_ZOOM_PREVIEW (preview), -1);
+
+ return GIMP_ZOOM_PREVIEW_GET_PRIVATE (preview)->drawable_ID;
+}
+
+/**
+ * gimp_zoom_preview_get_drawable:
+ * @preview: a #GimpZoomPreview widget
+ *
+ * Returns the #GimpDrawable the #GimpZoomPreview is attached to.
+ *
+ * Return Value: the #GimpDrawable that was passed to gimp_zoom_preview_new().
+ *
+ * Deprecated: 2.10: Use gimp_zoom_preview_get_drawable_id() instead.
+ *
+ * Since: 2.4
+ **/
+GimpDrawable *
+gimp_zoom_preview_get_drawable (GimpZoomPreview *preview)
+{
+ g_return_val_if_fail (GIMP_IS_ZOOM_PREVIEW (preview), NULL);
+
+ return GIMP_ZOOM_PREVIEW_GET_PRIVATE (preview)->drawable;
+}
+
+/**
+ * gimp_zoom_preview_get_model:
+ * @preview: a #GimpZoomPreview widget
+ *
+ * Returns the #GimpZoomModel the preview is using.
+ *
+ * Return Value: a pointer to the #GimpZoomModel owned by the @preview
+ *
+ * Since: 2.4
+ **/
+GimpZoomModel *
+gimp_zoom_preview_get_model (GimpZoomPreview *preview)
+{
+ g_return_val_if_fail (GIMP_IS_ZOOM_PREVIEW (preview), NULL);
+
+ return GIMP_ZOOM_PREVIEW_GET_PRIVATE (preview)->model;
+}
+
+/**
+ * gimp_zoom_preview_get_factor:
+ * @preview: a #GimpZoomPreview widget
+ *
+ * Returns the zoom factor the preview is currently using.
+ *
+ * Return Value: the current zoom factor
+ *
+ * Since: 2.4
+ **/
+gdouble
+gimp_zoom_preview_get_factor (GimpZoomPreview *preview)
+{
+ GimpZoomPreviewPrivate *priv;
+
+ g_return_val_if_fail (GIMP_IS_ZOOM_PREVIEW (preview), 1.0);
+
+ priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (preview);
+
+ return priv->model ? gimp_zoom_model_get_factor (priv->model) : 1.0;
+}
+
+/**
+ * gimp_zoom_preview_get_source:
+ * @preview: a #GimpZoomPreview widget
+ * @width: a pointer to an int where the current width of the zoom widget
+ * will be put.
+ * @height: a pointer to an int where the current width of the zoom widget
+ * will be put.
+ * @bpp: return location for the number of bytes per pixel
+ *
+ * Returns the scaled image data of the part of the drawable the
+ * #GimpZoomPreview is currently showing, as a newly allocated array of guchar.
+ * This function also allow to get the current width, height and bpp of the
+ * #GimpZoomPreview.
+ *
+ * Return Value: newly allocated data that should be released using g_free()
+ * when it is not any longer needed
+ *
+ * Since: 2.4
+ */
+guchar *
+gimp_zoom_preview_get_source (GimpZoomPreview *preview,
+ gint *width,
+ gint *height,
+ gint *bpp)
+{
+ gint32 drawable_ID;
+
+ g_return_val_if_fail (GIMP_IS_ZOOM_PREVIEW (preview), NULL);
+ g_return_val_if_fail (width != NULL && height != NULL && bpp != NULL, NULL);
+
+ drawable_ID = gimp_zoom_preview_get_drawable_id (preview);
+
+ if (drawable_ID > 0)
+ {
+ GimpPreview *gimp_preview = GIMP_PREVIEW (preview);
+ gint src_x;
+ gint src_y;
+ gint src_width;
+ gint src_height;
+
+ *width = gimp_preview->width;
+ *height = gimp_preview->height;
+
+ gimp_zoom_preview_get_source_area (gimp_preview,
+ &src_x, &src_y,
+ &src_width, &src_height);
+
+ return gimp_drawable_get_sub_thumbnail_data (drawable_ID,
+ src_x, src_y,
+ src_width, src_height,
+ width, height, bpp);
+ }
+ else
+ {
+ *width = 0;
+ *height = 0;
+ *bpp = 0;
+
+ return NULL;
+ }
+}
diff --git a/libgimp/gimpzoompreview.h b/libgimp/gimpzoompreview.h
new file mode 100644
index 0000000..5fdf228
--- /dev/null
+++ b/libgimp/gimpzoompreview.h
@@ -0,0 +1,95 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpzoompreview.h
+ * Copyright (C) 2005 David Odin <dindinx@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimpui.h> can be included directly."
+#endif
+
+#ifndef __GIMP_ZOOM_PREVIEW_H__
+#define __GIMP_ZOOM_PREVIEW_H__
+
+G_BEGIN_DECLS
+
+
+/* For information look into the C source or the html documentation */
+
+
+#define GIMP_TYPE_ZOOM_PREVIEW (gimp_zoom_preview_get_type ())
+#define GIMP_ZOOM_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ZOOM_PREVIEW, GimpZoomPreview))
+#define GIMP_ZOOM_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ZOOM_PREVIEW, GimpZoomPreviewClass))
+#define GIMP_IS_ZOOM_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ZOOM_PREVIEW))
+#define GIMP_IS_ZOOM_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ZOOM_PREVIEW))
+#define GIMP_ZOOM_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ZOOM_PREVIEW, GimpZoomPreviewClass))
+
+
+typedef struct _GimpZoomPreviewPrivate GimpZoomPreviewPrivate;
+typedef struct _GimpZoomPreviewClass GimpZoomPreviewClass;
+
+struct _GimpZoomPreview
+{
+ GimpScrolledPreview parent_instance;
+
+ /*< private >*/
+ GimpZoomPreviewPrivate *priv;
+};
+
+struct _GimpZoomPreviewClass
+{
+ GimpScrolledPreviewClass parent_class;
+
+ /* Padding for future expansion */
+ void (* _gimp_reserved1) (void);
+ void (* _gimp_reserved2) (void);
+ void (* _gimp_reserved3) (void);
+ void (* _gimp_reserved4) (void);
+};
+
+
+GType gimp_zoom_preview_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_zoom_preview_new_from_drawable_id
+ (gint32 drawable_ID);
+GtkWidget * gimp_zoom_preview_new_with_model_from_drawable_id
+ (gint32 drawable_ID,
+ GimpZoomModel *model);
+
+guchar * gimp_zoom_preview_get_source (GimpZoomPreview *preview,
+ gint *width,
+ gint *height,
+ gint *bpp);
+
+gint32 gimp_zoom_preview_get_drawable_id(GimpZoomPreview *preview);
+GimpZoomModel * gimp_zoom_preview_get_model (GimpZoomPreview *preview);
+gdouble gimp_zoom_preview_get_factor (GimpZoomPreview *preview);
+
+GIMP_DEPRECATED_FOR(gimp_zoom_preview_new_from_drawable_id)
+GtkWidget * gimp_zoom_preview_new (GimpDrawable *drawable);
+GIMP_DEPRECATED_FOR(gimp_zoom_preview_new_with_model_from_drawable_id)
+GtkWidget * gimp_zoom_preview_new_with_model (GimpDrawable *drawable,
+ GimpZoomModel *model);
+
+GIMP_DEPRECATED_FOR(gimp_zoom_preview_get_drawable_id)
+GimpDrawable * gimp_zoom_preview_get_drawable (GimpZoomPreview *preview);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_ZOOM_PREVIEW_H__ */
diff --git a/libgimp/libgimp-intl.h b/libgimp/libgimp-intl.h
new file mode 100644
index 0000000..2ae01d9
--- /dev/null
+++ b/libgimp/libgimp-intl.h
@@ -0,0 +1,45 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * libgimp-intl.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#ifndef __LIBGIMP_INTL_H__
+#define __LIBGIMP_INTL_H__
+
+#ifndef GETTEXT_PACKAGE
+#error "config.h must be included prior to libgimp-intl.h"
+#endif
+
+#include <libintl.h>
+
+
+#define _(String) dgettext (GETTEXT_PACKAGE "-libgimp", String)
+#define Q_(String) g_dpgettext (GETTEXT_PACKAGE "-libgimp", String, 0)
+#define C_(Context,String) g_dpgettext (GETTEXT_PACKAGE "-libgimp", Context "\004" String, strlen (Context) + 1)
+
+#undef gettext
+#define gettext(String) dgettext (GETTEXT_PACKAGE "-libgimp", String)
+
+#undef ngettext
+#define ngettext(String1, String2, number) dngettext (GETTEXT_PACKAGE "-libgimp", String1, String2, number)
+
+#define N_(String) (String)
+#define NC_(Context,String) (String)
+
+
+#endif /* __LIBGIMP_INTL_H__ */
diff --git a/libgimp/stdplugins-intl.h b/libgimp/stdplugins-intl.h
new file mode 100644
index 0000000..6aad80e
--- /dev/null
+++ b/libgimp/stdplugins-intl.h
@@ -0,0 +1,42 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * stdplugins-intl.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser 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/>.
+ */
+
+#ifndef __STDPLUGINS_INTL_H__
+#define __STDPLUGINS_INTL_H__
+
+#ifndef GETTEXT_PACKAGE
+#error "config.h must be included prior to stdplugins-intl.h"
+#endif
+
+#include <glib/gi18n.h>
+
+#ifndef HAVE_BIND_TEXTDOMAIN_CODESET
+# define bind_textdomain_codeset(Domain, Codeset) (Domain)
+#endif
+
+#define INIT_I18N() G_STMT_START{ \
+ bindtextdomain (GETTEXT_PACKAGE"-std-plug-ins", \
+ gimp_locale_directory ()); \
+ bind_textdomain_codeset (GETTEXT_PACKAGE"-std-plug-ins", "UTF-8"); \
+ textdomain (GETTEXT_PACKAGE"-std-plug-ins"); \
+}G_STMT_END
+
+
+#endif /* __STDPLUGINS_INTL_H__ */