summaryrefslogtreecommitdiffstats
path: root/app/pdb
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:13:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:13:10 +0000
commit3c57dd931145d43f2b0aef96c4d178135956bf91 (patch)
tree3de698981e9f0cc2c4f9569b19a5f3595e741f6b /app/pdb
parentInitial commit. (diff)
downloadgimp-3c57dd931145d43f2b0aef96c4d178135956bf91.tar.xz
gimp-3c57dd931145d43f2b0aef96c4d178135956bf91.zip
Adding upstream version 2.10.36.upstream/2.10.36
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--app/pdb/Makefile.am93
-rw-r--r--app/pdb/Makefile.in1264
-rw-r--r--app/pdb/README7
-rw-r--r--app/pdb/brush-cmds.c1677
-rw-r--r--app/pdb/brush-select-cmds.c285
-rw-r--r--app/pdb/brushes-cmds.c470
-rw-r--r--app/pdb/buffer-cmds.c507
-rw-r--r--app/pdb/channel-cmds.c736
-rw-r--r--app/pdb/color-cmds.c1413
-rw-r--r--app/pdb/context-cmds.c5752
-rw-r--r--app/pdb/debug-cmds.c140
-rw-r--r--app/pdb/display-cmds.c363
-rw-r--r--app/pdb/drawable-cmds.c1976
-rw-r--r--app/pdb/drawable-color-cmds.c1551
-rw-r--r--app/pdb/drawable-edit-cmds.c620
-rw-r--r--app/pdb/drawable-transform-cmds.c2894
-rw-r--r--app/pdb/dynamics-cmds.c144
-rw-r--r--app/pdb/edit-cmds.c1653
-rw-r--r--app/pdb/fileops-cmds.c1184
-rw-r--r--app/pdb/floating-sel-cmds.c366
-rw-r--r--app/pdb/font-select-cmds.c227
-rw-r--r--app/pdb/fonts-cmds.c151
-rw-r--r--app/pdb/gimp-cmds.c444
-rw-r--r--app/pdb/gimp-pdb-compat.c562
-rw-r--r--app/pdb/gimp-pdb-compat.h36
-rw-r--r--app/pdb/gimppdb-query.c649
-rw-r--r--app/pdb/gimppdb-query.h49
-rw-r--r--app/pdb/gimppdb-utils.c846
-rw-r--r--app/pdb/gimppdb-utils.h117
-rw-r--r--app/pdb/gimppdb.c518
-rw-r--r--app/pdb/gimppdb.h90
-rw-r--r--app/pdb/gimppdbcontext.c554
-rw-r--r--app/pdb/gimppdbcontext.h83
-rw-r--r--app/pdb/gimppdberror.c36
-rw-r--r--app/pdb/gimppdberror.h38
-rw-r--r--app/pdb/gimpprocedure.c897
-rw-r--r--app/pdb/gimpprocedure.h164
-rw-r--r--app/pdb/gimprc-cmds.c502
-rw-r--r--app/pdb/gradient-cmds.c2658
-rw-r--r--app/pdb/gradient-select-cmds.c236
-rw-r--r--app/pdb/gradients-cmds.c492
-rw-r--r--app/pdb/help-cmds.c108
-rw-r--r--app/pdb/image-cmds.c5894
-rw-r--r--app/pdb/image-color-profile-cmds.c549
-rw-r--r--app/pdb/image-convert-cmds.c450
-rw-r--r--app/pdb/image-grid-cmds.c708
-rw-r--r--app/pdb/image-guides-cmds.c477
-rw-r--r--app/pdb/image-sample-points-cmds.c350
-rw-r--r--app/pdb/image-select-cmds.c718
-rw-r--r--app/pdb/image-transform-cmds.c522
-rw-r--r--app/pdb/image-undo-cmds.c477
-rw-r--r--app/pdb/internal-procs.c95
-rw-r--r--app/pdb/internal-procs.h85
-rw-r--r--app/pdb/item-cmds.c1970
-rw-r--r--app/pdb/item-transform-cmds.c1669
-rw-r--r--app/pdb/layer-cmds.c2540
-rw-r--r--app/pdb/message-cmds.c188
-rw-r--r--app/pdb/paint-tools-cmds.c1645
-rw-r--r--app/pdb/palette-cmds.c1107
-rw-r--r--app/pdb/palette-select-cmds.c223
-rw-r--r--app/pdb/palettes-cmds.c324
-rw-r--r--app/pdb/paths-cmds.c1283
-rw-r--r--app/pdb/pattern-cmds.c252
-rw-r--r--app/pdb/pattern-select-cmds.c223
-rw-r--r--app/pdb/patterns-cmds.c341
-rw-r--r--app/pdb/pdb-types.h54
-rw-r--r--app/pdb/plug-in-cmds.c751
-rw-r--r--app/pdb/plug-in-compat-cmds.c9622
-rw-r--r--app/pdb/procedural-db-cmds.c926
-rw-r--r--app/pdb/progress-cmds.c502
-rw-r--r--app/pdb/selection-cmds.c1112
-rw-r--r--app/pdb/selection-tools-cmds.c1052
-rw-r--r--app/pdb/text-layer-cmds.c2196
-rw-r--r--app/pdb/text-tool-cmds.c670
-rw-r--r--app/pdb/transform-tools-cmds.c934
-rw-r--r--app/pdb/unit-cmds.c782
-rw-r--r--app/pdb/vectors-cmds.c2518
77 files changed, 75761 insertions, 0 deletions
diff --git a/app/pdb/Makefile.am b/app/pdb/Makefile.am
new file mode 100644
index 0000000..f4b9dcd
--- /dev/null
+++ b/app/pdb/Makefile.am
@@ -0,0 +1,93 @@
+## Process this file with automake to produce Makefile.in
+
+AM_CPPFLAGS = \
+ -DG_LOG_DOMAIN=\"Gimp-PDB\" \
+ -I$(top_builddir) \
+ -I$(top_srcdir) \
+ -I$(top_builddir)/app \
+ -I$(top_srcdir)/app \
+ $(CAIRO_CFLAGS) \
+ $(GEGL_CFLAGS) \
+ $(GDK_PIXBUF_CFLAGS) \
+ -I$(includedir)
+
+noinst_LIBRARIES = libapppdb.a libappinternal-procs.a
+
+libapppdb_a_SOURCES = \
+ pdb-types.h \
+ \
+ gimp-pdb-compat.c \
+ gimp-pdb-compat.h \
+ gimppdb.c \
+ gimppdb.h \
+ gimppdb-query.c \
+ gimppdb-query.h \
+ gimppdb-utils.c \
+ gimppdb-utils.h \
+ gimppdbcontext.c \
+ gimppdbcontext.h \
+ gimppdberror.c \
+ gimppdberror.h \
+ gimpprocedure.c \
+ gimpprocedure.h
+
+libappinternal_procs_a_SOURCES = \
+ internal-procs.c \
+ internal-procs.h \
+ brush-cmds.c \
+ brush-select-cmds.c \
+ brushes-cmds.c \
+ buffer-cmds.c \
+ channel-cmds.c \
+ color-cmds.c \
+ context-cmds.c \
+ debug-cmds.c \
+ display-cmds.c \
+ drawable-cmds.c \
+ drawable-color-cmds.c \
+ drawable-edit-cmds.c \
+ drawable-transform-cmds.c \
+ dynamics-cmds.c \
+ edit-cmds.c \
+ fileops-cmds.c \
+ floating-sel-cmds.c \
+ font-select-cmds.c \
+ fonts-cmds.c \
+ gimp-cmds.c \
+ gimprc-cmds.c \
+ gradient-cmds.c \
+ gradient-select-cmds.c \
+ gradients-cmds.c \
+ help-cmds.c \
+ image-cmds.c \
+ image-color-profile-cmds.c \
+ image-convert-cmds.c \
+ image-grid-cmds.c \
+ image-guides-cmds.c \
+ image-sample-points-cmds.c \
+ image-select-cmds.c \
+ image-transform-cmds.c \
+ image-undo-cmds.c \
+ item-cmds.c \
+ item-transform-cmds.c \
+ layer-cmds.c \
+ message-cmds.c \
+ paint-tools-cmds.c \
+ palette-cmds.c \
+ palette-select-cmds.c \
+ palettes-cmds.c \
+ paths-cmds.c \
+ pattern-cmds.c \
+ pattern-select-cmds.c \
+ patterns-cmds.c \
+ plug-in-cmds.c \
+ plug-in-compat-cmds.c \
+ procedural-db-cmds.c \
+ progress-cmds.c \
+ selection-cmds.c \
+ selection-tools-cmds.c \
+ text-layer-cmds.c \
+ text-tool-cmds.c \
+ transform-tools-cmds.c \
+ unit-cmds.c \
+ vectors-cmds.c
diff --git a/app/pdb/Makefile.in b/app/pdb/Makefile.in
new file mode 100644
index 0000000..b6e339d
--- /dev/null
+++ b/app/pdb/Makefile.in
@@ -0,0 +1,1264 @@
+# 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 = app/pdb
+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 $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+AM_V_AR = $(am__v_AR_@AM_V@)
+am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
+am__v_AR_0 = @echo " AR " $@;
+am__v_AR_1 =
+libappinternal_procs_a_AR = $(AR) $(ARFLAGS)
+libappinternal_procs_a_LIBADD =
+am_libappinternal_procs_a_OBJECTS = internal-procs.$(OBJEXT) \
+ brush-cmds.$(OBJEXT) brush-select-cmds.$(OBJEXT) \
+ brushes-cmds.$(OBJEXT) buffer-cmds.$(OBJEXT) \
+ channel-cmds.$(OBJEXT) color-cmds.$(OBJEXT) \
+ context-cmds.$(OBJEXT) debug-cmds.$(OBJEXT) \
+ display-cmds.$(OBJEXT) drawable-cmds.$(OBJEXT) \
+ drawable-color-cmds.$(OBJEXT) drawable-edit-cmds.$(OBJEXT) \
+ drawable-transform-cmds.$(OBJEXT) dynamics-cmds.$(OBJEXT) \
+ edit-cmds.$(OBJEXT) fileops-cmds.$(OBJEXT) \
+ floating-sel-cmds.$(OBJEXT) font-select-cmds.$(OBJEXT) \
+ fonts-cmds.$(OBJEXT) gimp-cmds.$(OBJEXT) gimprc-cmds.$(OBJEXT) \
+ gradient-cmds.$(OBJEXT) gradient-select-cmds.$(OBJEXT) \
+ gradients-cmds.$(OBJEXT) help-cmds.$(OBJEXT) \
+ image-cmds.$(OBJEXT) image-color-profile-cmds.$(OBJEXT) \
+ image-convert-cmds.$(OBJEXT) image-grid-cmds.$(OBJEXT) \
+ image-guides-cmds.$(OBJEXT) image-sample-points-cmds.$(OBJEXT) \
+ image-select-cmds.$(OBJEXT) image-transform-cmds.$(OBJEXT) \
+ image-undo-cmds.$(OBJEXT) item-cmds.$(OBJEXT) \
+ item-transform-cmds.$(OBJEXT) layer-cmds.$(OBJEXT) \
+ message-cmds.$(OBJEXT) paint-tools-cmds.$(OBJEXT) \
+ palette-cmds.$(OBJEXT) palette-select-cmds.$(OBJEXT) \
+ palettes-cmds.$(OBJEXT) paths-cmds.$(OBJEXT) \
+ pattern-cmds.$(OBJEXT) pattern-select-cmds.$(OBJEXT) \
+ patterns-cmds.$(OBJEXT) plug-in-cmds.$(OBJEXT) \
+ plug-in-compat-cmds.$(OBJEXT) procedural-db-cmds.$(OBJEXT) \
+ progress-cmds.$(OBJEXT) selection-cmds.$(OBJEXT) \
+ selection-tools-cmds.$(OBJEXT) text-layer-cmds.$(OBJEXT) \
+ text-tool-cmds.$(OBJEXT) transform-tools-cmds.$(OBJEXT) \
+ unit-cmds.$(OBJEXT) vectors-cmds.$(OBJEXT)
+libappinternal_procs_a_OBJECTS = $(am_libappinternal_procs_a_OBJECTS)
+libapppdb_a_AR = $(AR) $(ARFLAGS)
+libapppdb_a_LIBADD =
+am_libapppdb_a_OBJECTS = gimp-pdb-compat.$(OBJEXT) gimppdb.$(OBJEXT) \
+ gimppdb-query.$(OBJEXT) gimppdb-utils.$(OBJEXT) \
+ gimppdbcontext.$(OBJEXT) gimppdberror.$(OBJEXT) \
+ gimpprocedure.$(OBJEXT)
+libapppdb_a_OBJECTS = $(am_libapppdb_a_OBJECTS)
+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)/brush-cmds.Po \
+ ./$(DEPDIR)/brush-select-cmds.Po ./$(DEPDIR)/brushes-cmds.Po \
+ ./$(DEPDIR)/buffer-cmds.Po ./$(DEPDIR)/channel-cmds.Po \
+ ./$(DEPDIR)/color-cmds.Po ./$(DEPDIR)/context-cmds.Po \
+ ./$(DEPDIR)/debug-cmds.Po ./$(DEPDIR)/display-cmds.Po \
+ ./$(DEPDIR)/drawable-cmds.Po \
+ ./$(DEPDIR)/drawable-color-cmds.Po \
+ ./$(DEPDIR)/drawable-edit-cmds.Po \
+ ./$(DEPDIR)/drawable-transform-cmds.Po \
+ ./$(DEPDIR)/dynamics-cmds.Po ./$(DEPDIR)/edit-cmds.Po \
+ ./$(DEPDIR)/fileops-cmds.Po ./$(DEPDIR)/floating-sel-cmds.Po \
+ ./$(DEPDIR)/font-select-cmds.Po ./$(DEPDIR)/fonts-cmds.Po \
+ ./$(DEPDIR)/gimp-cmds.Po ./$(DEPDIR)/gimp-pdb-compat.Po \
+ ./$(DEPDIR)/gimppdb-query.Po ./$(DEPDIR)/gimppdb-utils.Po \
+ ./$(DEPDIR)/gimppdb.Po ./$(DEPDIR)/gimppdbcontext.Po \
+ ./$(DEPDIR)/gimppdberror.Po ./$(DEPDIR)/gimpprocedure.Po \
+ ./$(DEPDIR)/gimprc-cmds.Po ./$(DEPDIR)/gradient-cmds.Po \
+ ./$(DEPDIR)/gradient-select-cmds.Po \
+ ./$(DEPDIR)/gradients-cmds.Po ./$(DEPDIR)/help-cmds.Po \
+ ./$(DEPDIR)/image-cmds.Po \
+ ./$(DEPDIR)/image-color-profile-cmds.Po \
+ ./$(DEPDIR)/image-convert-cmds.Po \
+ ./$(DEPDIR)/image-grid-cmds.Po \
+ ./$(DEPDIR)/image-guides-cmds.Po \
+ ./$(DEPDIR)/image-sample-points-cmds.Po \
+ ./$(DEPDIR)/image-select-cmds.Po \
+ ./$(DEPDIR)/image-transform-cmds.Po \
+ ./$(DEPDIR)/image-undo-cmds.Po ./$(DEPDIR)/internal-procs.Po \
+ ./$(DEPDIR)/item-cmds.Po ./$(DEPDIR)/item-transform-cmds.Po \
+ ./$(DEPDIR)/layer-cmds.Po ./$(DEPDIR)/message-cmds.Po \
+ ./$(DEPDIR)/paint-tools-cmds.Po ./$(DEPDIR)/palette-cmds.Po \
+ ./$(DEPDIR)/palette-select-cmds.Po \
+ ./$(DEPDIR)/palettes-cmds.Po ./$(DEPDIR)/paths-cmds.Po \
+ ./$(DEPDIR)/pattern-cmds.Po ./$(DEPDIR)/pattern-select-cmds.Po \
+ ./$(DEPDIR)/patterns-cmds.Po ./$(DEPDIR)/plug-in-cmds.Po \
+ ./$(DEPDIR)/plug-in-compat-cmds.Po \
+ ./$(DEPDIR)/procedural-db-cmds.Po ./$(DEPDIR)/progress-cmds.Po \
+ ./$(DEPDIR)/selection-cmds.Po \
+ ./$(DEPDIR)/selection-tools-cmds.Po \
+ ./$(DEPDIR)/text-layer-cmds.Po ./$(DEPDIR)/text-tool-cmds.Po \
+ ./$(DEPDIR)/transform-tools-cmds.Po ./$(DEPDIR)/unit-cmds.Po \
+ ./$(DEPDIR)/vectors-cmds.Po
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+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 =
+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 = $(libappinternal_procs_a_SOURCES) $(libapppdb_a_SOURCES)
+DIST_SOURCES = $(libappinternal_procs_a_SOURCES) \
+ $(libapppdb_a_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+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 README
+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@
+AM_CPPFLAGS = \
+ -DG_LOG_DOMAIN=\"Gimp-PDB\" \
+ -I$(top_builddir) \
+ -I$(top_srcdir) \
+ -I$(top_builddir)/app \
+ -I$(top_srcdir)/app \
+ $(CAIRO_CFLAGS) \
+ $(GEGL_CFLAGS) \
+ $(GDK_PIXBUF_CFLAGS) \
+ -I$(includedir)
+
+noinst_LIBRARIES = libapppdb.a libappinternal-procs.a
+libapppdb_a_SOURCES = \
+ pdb-types.h \
+ \
+ gimp-pdb-compat.c \
+ gimp-pdb-compat.h \
+ gimppdb.c \
+ gimppdb.h \
+ gimppdb-query.c \
+ gimppdb-query.h \
+ gimppdb-utils.c \
+ gimppdb-utils.h \
+ gimppdbcontext.c \
+ gimppdbcontext.h \
+ gimppdberror.c \
+ gimppdberror.h \
+ gimpprocedure.c \
+ gimpprocedure.h
+
+libappinternal_procs_a_SOURCES = \
+ internal-procs.c \
+ internal-procs.h \
+ brush-cmds.c \
+ brush-select-cmds.c \
+ brushes-cmds.c \
+ buffer-cmds.c \
+ channel-cmds.c \
+ color-cmds.c \
+ context-cmds.c \
+ debug-cmds.c \
+ display-cmds.c \
+ drawable-cmds.c \
+ drawable-color-cmds.c \
+ drawable-edit-cmds.c \
+ drawable-transform-cmds.c \
+ dynamics-cmds.c \
+ edit-cmds.c \
+ fileops-cmds.c \
+ floating-sel-cmds.c \
+ font-select-cmds.c \
+ fonts-cmds.c \
+ gimp-cmds.c \
+ gimprc-cmds.c \
+ gradient-cmds.c \
+ gradient-select-cmds.c \
+ gradients-cmds.c \
+ help-cmds.c \
+ image-cmds.c \
+ image-color-profile-cmds.c \
+ image-convert-cmds.c \
+ image-grid-cmds.c \
+ image-guides-cmds.c \
+ image-sample-points-cmds.c \
+ image-select-cmds.c \
+ image-transform-cmds.c \
+ image-undo-cmds.c \
+ item-cmds.c \
+ item-transform-cmds.c \
+ layer-cmds.c \
+ message-cmds.c \
+ paint-tools-cmds.c \
+ palette-cmds.c \
+ palette-select-cmds.c \
+ palettes-cmds.c \
+ paths-cmds.c \
+ pattern-cmds.c \
+ pattern-select-cmds.c \
+ patterns-cmds.c \
+ plug-in-cmds.c \
+ plug-in-compat-cmds.c \
+ procedural-db-cmds.c \
+ progress-cmds.c \
+ selection-cmds.c \
+ selection-tools-cmds.c \
+ text-layer-cmds.c \
+ text-tool-cmds.c \
+ transform-tools-cmds.c \
+ unit-cmds.c \
+ vectors-cmds.c
+
+all: 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 app/pdb/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu app/pdb/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):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+
+libappinternal-procs.a: $(libappinternal_procs_a_OBJECTS) $(libappinternal_procs_a_DEPENDENCIES) $(EXTRA_libappinternal_procs_a_DEPENDENCIES)
+ $(AM_V_at)-rm -f libappinternal-procs.a
+ $(AM_V_AR)$(libappinternal_procs_a_AR) libappinternal-procs.a $(libappinternal_procs_a_OBJECTS) $(libappinternal_procs_a_LIBADD)
+ $(AM_V_at)$(RANLIB) libappinternal-procs.a
+
+libapppdb.a: $(libapppdb_a_OBJECTS) $(libapppdb_a_DEPENDENCIES) $(EXTRA_libapppdb_a_DEPENDENCIES)
+ $(AM_V_at)-rm -f libapppdb.a
+ $(AM_V_AR)$(libapppdb_a_AR) libapppdb.a $(libapppdb_a_OBJECTS) $(libapppdb_a_LIBADD)
+ $(AM_V_at)$(RANLIB) libapppdb.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/brush-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/brush-select-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/brushes-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/channel-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/color-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/context-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/display-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drawable-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drawable-color-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drawable-edit-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drawable-transform-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynamics-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edit-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileops-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/floating-sel-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/font-select-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fonts-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimp-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimp-pdb-compat.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppdb-query.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppdb-utils.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppdb.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppdbcontext.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimppdberror.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpprocedure.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimprc-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gradient-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gradient-select-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gradients-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image-color-profile-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image-convert-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image-grid-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image-guides-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image-sample-points-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image-select-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image-transform-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image-undo-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/internal-procs.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/item-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/item-transform-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layer-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/message-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paint-tools-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/palette-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/palette-select-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/palettes-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paths-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pattern-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pattern-select-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/patterns-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plug-in-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plug-in-compat-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procedural-db-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progress-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/selection-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/selection-tools-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text-layer-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text-tool-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transform-tools-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unit-cmds.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vectors-cmds.Po@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
+
+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: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: install-am
+install-exec: 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:
+
+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."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f ./$(DEPDIR)/brush-cmds.Po
+ -rm -f ./$(DEPDIR)/brush-select-cmds.Po
+ -rm -f ./$(DEPDIR)/brushes-cmds.Po
+ -rm -f ./$(DEPDIR)/buffer-cmds.Po
+ -rm -f ./$(DEPDIR)/channel-cmds.Po
+ -rm -f ./$(DEPDIR)/color-cmds.Po
+ -rm -f ./$(DEPDIR)/context-cmds.Po
+ -rm -f ./$(DEPDIR)/debug-cmds.Po
+ -rm -f ./$(DEPDIR)/display-cmds.Po
+ -rm -f ./$(DEPDIR)/drawable-cmds.Po
+ -rm -f ./$(DEPDIR)/drawable-color-cmds.Po
+ -rm -f ./$(DEPDIR)/drawable-edit-cmds.Po
+ -rm -f ./$(DEPDIR)/drawable-transform-cmds.Po
+ -rm -f ./$(DEPDIR)/dynamics-cmds.Po
+ -rm -f ./$(DEPDIR)/edit-cmds.Po
+ -rm -f ./$(DEPDIR)/fileops-cmds.Po
+ -rm -f ./$(DEPDIR)/floating-sel-cmds.Po
+ -rm -f ./$(DEPDIR)/font-select-cmds.Po
+ -rm -f ./$(DEPDIR)/fonts-cmds.Po
+ -rm -f ./$(DEPDIR)/gimp-cmds.Po
+ -rm -f ./$(DEPDIR)/gimp-pdb-compat.Po
+ -rm -f ./$(DEPDIR)/gimppdb-query.Po
+ -rm -f ./$(DEPDIR)/gimppdb-utils.Po
+ -rm -f ./$(DEPDIR)/gimppdb.Po
+ -rm -f ./$(DEPDIR)/gimppdbcontext.Po
+ -rm -f ./$(DEPDIR)/gimppdberror.Po
+ -rm -f ./$(DEPDIR)/gimpprocedure.Po
+ -rm -f ./$(DEPDIR)/gimprc-cmds.Po
+ -rm -f ./$(DEPDIR)/gradient-cmds.Po
+ -rm -f ./$(DEPDIR)/gradient-select-cmds.Po
+ -rm -f ./$(DEPDIR)/gradients-cmds.Po
+ -rm -f ./$(DEPDIR)/help-cmds.Po
+ -rm -f ./$(DEPDIR)/image-cmds.Po
+ -rm -f ./$(DEPDIR)/image-color-profile-cmds.Po
+ -rm -f ./$(DEPDIR)/image-convert-cmds.Po
+ -rm -f ./$(DEPDIR)/image-grid-cmds.Po
+ -rm -f ./$(DEPDIR)/image-guides-cmds.Po
+ -rm -f ./$(DEPDIR)/image-sample-points-cmds.Po
+ -rm -f ./$(DEPDIR)/image-select-cmds.Po
+ -rm -f ./$(DEPDIR)/image-transform-cmds.Po
+ -rm -f ./$(DEPDIR)/image-undo-cmds.Po
+ -rm -f ./$(DEPDIR)/internal-procs.Po
+ -rm -f ./$(DEPDIR)/item-cmds.Po
+ -rm -f ./$(DEPDIR)/item-transform-cmds.Po
+ -rm -f ./$(DEPDIR)/layer-cmds.Po
+ -rm -f ./$(DEPDIR)/message-cmds.Po
+ -rm -f ./$(DEPDIR)/paint-tools-cmds.Po
+ -rm -f ./$(DEPDIR)/palette-cmds.Po
+ -rm -f ./$(DEPDIR)/palette-select-cmds.Po
+ -rm -f ./$(DEPDIR)/palettes-cmds.Po
+ -rm -f ./$(DEPDIR)/paths-cmds.Po
+ -rm -f ./$(DEPDIR)/pattern-cmds.Po
+ -rm -f ./$(DEPDIR)/pattern-select-cmds.Po
+ -rm -f ./$(DEPDIR)/patterns-cmds.Po
+ -rm -f ./$(DEPDIR)/plug-in-cmds.Po
+ -rm -f ./$(DEPDIR)/plug-in-compat-cmds.Po
+ -rm -f ./$(DEPDIR)/procedural-db-cmds.Po
+ -rm -f ./$(DEPDIR)/progress-cmds.Po
+ -rm -f ./$(DEPDIR)/selection-cmds.Po
+ -rm -f ./$(DEPDIR)/selection-tools-cmds.Po
+ -rm -f ./$(DEPDIR)/text-layer-cmds.Po
+ -rm -f ./$(DEPDIR)/text-tool-cmds.Po
+ -rm -f ./$(DEPDIR)/transform-tools-cmds.Po
+ -rm -f ./$(DEPDIR)/unit-cmds.Po
+ -rm -f ./$(DEPDIR)/vectors-cmds.Po
+ -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-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+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)/brush-cmds.Po
+ -rm -f ./$(DEPDIR)/brush-select-cmds.Po
+ -rm -f ./$(DEPDIR)/brushes-cmds.Po
+ -rm -f ./$(DEPDIR)/buffer-cmds.Po
+ -rm -f ./$(DEPDIR)/channel-cmds.Po
+ -rm -f ./$(DEPDIR)/color-cmds.Po
+ -rm -f ./$(DEPDIR)/context-cmds.Po
+ -rm -f ./$(DEPDIR)/debug-cmds.Po
+ -rm -f ./$(DEPDIR)/display-cmds.Po
+ -rm -f ./$(DEPDIR)/drawable-cmds.Po
+ -rm -f ./$(DEPDIR)/drawable-color-cmds.Po
+ -rm -f ./$(DEPDIR)/drawable-edit-cmds.Po
+ -rm -f ./$(DEPDIR)/drawable-transform-cmds.Po
+ -rm -f ./$(DEPDIR)/dynamics-cmds.Po
+ -rm -f ./$(DEPDIR)/edit-cmds.Po
+ -rm -f ./$(DEPDIR)/fileops-cmds.Po
+ -rm -f ./$(DEPDIR)/floating-sel-cmds.Po
+ -rm -f ./$(DEPDIR)/font-select-cmds.Po
+ -rm -f ./$(DEPDIR)/fonts-cmds.Po
+ -rm -f ./$(DEPDIR)/gimp-cmds.Po
+ -rm -f ./$(DEPDIR)/gimp-pdb-compat.Po
+ -rm -f ./$(DEPDIR)/gimppdb-query.Po
+ -rm -f ./$(DEPDIR)/gimppdb-utils.Po
+ -rm -f ./$(DEPDIR)/gimppdb.Po
+ -rm -f ./$(DEPDIR)/gimppdbcontext.Po
+ -rm -f ./$(DEPDIR)/gimppdberror.Po
+ -rm -f ./$(DEPDIR)/gimpprocedure.Po
+ -rm -f ./$(DEPDIR)/gimprc-cmds.Po
+ -rm -f ./$(DEPDIR)/gradient-cmds.Po
+ -rm -f ./$(DEPDIR)/gradient-select-cmds.Po
+ -rm -f ./$(DEPDIR)/gradients-cmds.Po
+ -rm -f ./$(DEPDIR)/help-cmds.Po
+ -rm -f ./$(DEPDIR)/image-cmds.Po
+ -rm -f ./$(DEPDIR)/image-color-profile-cmds.Po
+ -rm -f ./$(DEPDIR)/image-convert-cmds.Po
+ -rm -f ./$(DEPDIR)/image-grid-cmds.Po
+ -rm -f ./$(DEPDIR)/image-guides-cmds.Po
+ -rm -f ./$(DEPDIR)/image-sample-points-cmds.Po
+ -rm -f ./$(DEPDIR)/image-select-cmds.Po
+ -rm -f ./$(DEPDIR)/image-transform-cmds.Po
+ -rm -f ./$(DEPDIR)/image-undo-cmds.Po
+ -rm -f ./$(DEPDIR)/internal-procs.Po
+ -rm -f ./$(DEPDIR)/item-cmds.Po
+ -rm -f ./$(DEPDIR)/item-transform-cmds.Po
+ -rm -f ./$(DEPDIR)/layer-cmds.Po
+ -rm -f ./$(DEPDIR)/message-cmds.Po
+ -rm -f ./$(DEPDIR)/paint-tools-cmds.Po
+ -rm -f ./$(DEPDIR)/palette-cmds.Po
+ -rm -f ./$(DEPDIR)/palette-select-cmds.Po
+ -rm -f ./$(DEPDIR)/palettes-cmds.Po
+ -rm -f ./$(DEPDIR)/paths-cmds.Po
+ -rm -f ./$(DEPDIR)/pattern-cmds.Po
+ -rm -f ./$(DEPDIR)/pattern-select-cmds.Po
+ -rm -f ./$(DEPDIR)/patterns-cmds.Po
+ -rm -f ./$(DEPDIR)/plug-in-cmds.Po
+ -rm -f ./$(DEPDIR)/plug-in-compat-cmds.Po
+ -rm -f ./$(DEPDIR)/procedural-db-cmds.Po
+ -rm -f ./$(DEPDIR)/progress-cmds.Po
+ -rm -f ./$(DEPDIR)/selection-cmds.Po
+ -rm -f ./$(DEPDIR)/selection-tools-cmds.Po
+ -rm -f ./$(DEPDIR)/text-layer-cmds.Po
+ -rm -f ./$(DEPDIR)/text-tool-cmds.Po
+ -rm -f ./$(DEPDIR)/transform-tools-cmds.Po
+ -rm -f ./$(DEPDIR)/unit-cmds.Po
+ -rm -f ./$(DEPDIR)/vectors-cmds.Po
+ -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:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+ clean-generic clean-libtool clean-noinstLIBRARIES \
+ 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-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am 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
+
+.PRECIOUS: Makefile
+
+
+# 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/app/pdb/README b/app/pdb/README
new file mode 100644
index 0000000..2205ba6
--- /dev/null
+++ b/app/pdb/README
@@ -0,0 +1,7 @@
+This directory contains the PDB-wrappers for various internal
+Gimp functions.
+
+THESE FILES ARE AUTOGENERATED AND CHANGES HERE ARE USELESS!
+
+If you need to change the code please have a look in ../../pdb/groups.
+
diff --git a/app/pdb/brush-cmds.c b/app/pdb/brush-cmds.c
new file mode 100644
index 0000000..2415d63
--- /dev/null
+++ b/app/pdb/brush-cmds.c
@@ -0,0 +1,1677 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpbrush.h"
+#include "core/gimpbrushgenerated.h"
+#include "core/gimpcontext.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimptempbuf.h"
+#include "gegl/gimp-babl-compat.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+brush_new_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gchar *actual_name = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpData *data = gimp_data_factory_data_new (gimp->brush_factory,
+ context, name);
+
+ if (data)
+ actual_name = g_strdup (gimp_object_get_name (data));
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), actual_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_duplicate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gchar *copy_name = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush)
+ {
+ GimpBrush *brush_copy = (GimpBrush *)
+ gimp_data_factory_data_duplicate (gimp->brush_factory,
+ GIMP_DATA (brush));
+
+ if (brush_copy)
+ copy_name = g_strdup (gimp_object_get_name (brush_copy));
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), copy_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_is_generated_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gboolean generated = FALSE;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush)
+ generated = GIMP_IS_BRUSH_GENERATED (brush);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), generated);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_rename_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ const gchar *new_name;
+ gchar *actual_name = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ new_name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_RENAME, error);
+
+ if (brush)
+ {
+ gimp_object_set_name (GIMP_OBJECT (brush), new_name);
+ actual_name = g_strdup (gimp_object_get_name (brush));
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), actual_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_delete_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush && gimp_data_is_deletable (GIMP_DATA (brush)))
+ success = gimp_data_factory_data_delete (gimp->brush_factory,
+ GIMP_DATA (brush),
+ TRUE, error);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+brush_is_editable_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gboolean editable = FALSE;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush)
+ editable = gimp_data_is_writable (GIMP_DATA (brush));
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), editable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_get_info_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 width = 0;
+ gint32 height = 0;
+ gint32 mask_bpp = 0;
+ gint32 color_bpp = 0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush)
+ {
+ GimpTempBuf *mask = gimp_brush_get_mask (brush);
+ GimpTempBuf *pixmap = gimp_brush_get_pixmap (brush);
+ const Babl *format;
+
+ format = gimp_babl_compat_u8_mask_format (
+ gimp_temp_buf_get_format (mask));
+
+ width = gimp_brush_get_width (brush);
+ height = gimp_brush_get_height (brush);
+ mask_bpp = babl_format_get_bytes_per_pixel (format);
+
+ if (pixmap)
+ {
+ format = gimp_babl_compat_u8_format (
+ gimp_temp_buf_get_format (pixmap));
+
+ color_bpp = babl_format_get_bytes_per_pixel (format);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), width);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), height);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), mask_bpp);
+ g_value_set_int (gimp_value_array_index (return_vals, 4), color_bpp);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_get_pixels_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 width = 0;
+ gint32 height = 0;
+ gint32 mask_bpp = 0;
+ gint32 num_mask_bytes = 0;
+ guint8 *mask_bytes = NULL;
+ gint32 color_bpp = 0;
+ gint32 num_color_bytes = 0;
+ guint8 *color_bytes = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush)
+ {
+ GimpTempBuf *mask = gimp_brush_get_mask (brush);
+ GimpTempBuf *pixmap = gimp_brush_get_pixmap (brush);
+ const Babl *format;
+ gpointer data;
+
+ format = gimp_babl_compat_u8_mask_format (
+ gimp_temp_buf_get_format (mask));
+ data = gimp_temp_buf_lock (mask, format, GEGL_ACCESS_READ);
+
+ width = gimp_temp_buf_get_width (mask);
+ height = gimp_temp_buf_get_height (mask);
+ mask_bpp = babl_format_get_bytes_per_pixel (format);
+ num_mask_bytes = gimp_temp_buf_get_height (mask) *
+ gimp_temp_buf_get_width (mask) * mask_bpp;
+ mask_bytes = g_memdup (data, num_mask_bytes);
+
+ gimp_temp_buf_unlock (mask, data);
+
+ if (pixmap)
+ {
+ format = gimp_babl_compat_u8_format (
+ gimp_temp_buf_get_format (pixmap));
+ data = gimp_temp_buf_lock (pixmap, format, GEGL_ACCESS_READ);
+
+ color_bpp = babl_format_get_bytes_per_pixel (format);
+ num_color_bytes = gimp_temp_buf_get_height (pixmap) *
+ gimp_temp_buf_get_width (pixmap) *
+ color_bpp;
+ color_bytes = g_memdup (data, num_color_bytes);
+
+ gimp_temp_buf_unlock (pixmap, data);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), width);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), height);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), mask_bpp);
+ g_value_set_int (gimp_value_array_index (return_vals, 4), num_mask_bytes);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 5), mask_bytes, num_mask_bytes);
+ g_value_set_int (gimp_value_array_index (return_vals, 6), color_bpp);
+ g_value_set_int (gimp_value_array_index (return_vals, 7), num_color_bytes);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 8), color_bytes, num_color_bytes);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_get_spacing_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 spacing = 0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush)
+ spacing = gimp_brush_get_spacing (brush);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), spacing);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_set_spacing_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 spacing;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ spacing = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
+
+ if (brush)
+ gimp_brush_set_spacing (brush, spacing);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+brush_get_shape_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 shape = 0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush)
+ shape = GIMP_BRUSH_GENERATED (brush)->shape;
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), shape);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_set_shape_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 shape_in;
+ gint32 shape_out = 0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ shape_in = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
+
+ if (brush)
+ {
+ gimp_brush_generated_set_shape (GIMP_BRUSH_GENERATED (brush),
+ shape_in);
+ shape_out = GIMP_BRUSH_GENERATED (brush)->shape;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), shape_out);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_get_radius_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gdouble radius = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush)
+ radius = GIMP_BRUSH_GENERATED (brush)->radius;
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), radius);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_set_radius_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gdouble radius_in;
+ gdouble radius_out = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ radius_in = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
+
+ if (brush)
+ {
+ gimp_brush_generated_set_radius (GIMP_BRUSH_GENERATED (brush),
+ radius_in);
+ radius_out = GIMP_BRUSH_GENERATED (brush)->radius;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), radius_out);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_get_spikes_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 spikes = 0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush)
+ spikes = GIMP_BRUSH_GENERATED (brush)->spikes;
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), spikes);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_set_spikes_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 spikes_in;
+ gint32 spikes_out = 0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ spikes_in = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
+
+ if (brush)
+ {
+ gimp_brush_generated_set_spikes (GIMP_BRUSH_GENERATED (brush),
+ spikes_in);
+ spikes_out = GIMP_BRUSH_GENERATED (brush)->spikes;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), spikes_out);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_get_hardness_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gdouble hardness = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush)
+ hardness = GIMP_BRUSH_GENERATED (brush)->hardness;
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), hardness);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_set_hardness_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gdouble hardness_in;
+ gdouble hardness_out = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ hardness_in = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
+
+ if (brush)
+ {
+ gimp_brush_generated_set_hardness (GIMP_BRUSH_GENERATED (brush),
+ hardness_in);
+ hardness_out = GIMP_BRUSH_GENERATED (brush)->hardness;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), hardness_out);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_get_aspect_ratio_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gdouble aspect_ratio = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush)
+ aspect_ratio = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), aspect_ratio);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_set_aspect_ratio_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gdouble aspect_ratio_in;
+ gdouble aspect_ratio_out = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ aspect_ratio_in = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
+
+ if (brush)
+ {
+ gimp_brush_generated_set_aspect_ratio (GIMP_BRUSH_GENERATED (brush),
+ aspect_ratio_in);
+ aspect_ratio_out = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), aspect_ratio_out);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_get_angle_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gdouble angle = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush)
+ angle = GIMP_BRUSH_GENERATED (brush)->angle;
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), angle);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brush_set_angle_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gdouble angle_in;
+ gdouble angle_out = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ angle_in = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
+
+ if (brush)
+ {
+ gimp_brush_generated_set_angle (GIMP_BRUSH_GENERATED (brush),
+ angle_in);
+ angle_out = GIMP_BRUSH_GENERATED (brush)->angle;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), angle_out);
+
+ return return_vals;
+}
+
+void
+register_brush_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-brush-new
+ */
+ procedure = gimp_procedure_new (brush_new_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-new");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-new",
+ "Creates a new brush.",
+ "This procedure creates a new, uninitialized brush.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The requested name of the new brush",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("actual-name",
+ "actual name",
+ "The actual new brush name. The returned value must be freed with g_free()",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-duplicate
+ */
+ procedure = gimp_procedure_new (brush_duplicate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-duplicate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-duplicate",
+ "Duplicates a brush.",
+ "This procedure creates an identical brush by a different name.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("copy-name",
+ "copy name",
+ "The name of the brush's copy. The returned value must be freed with g_free()",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-is-generated
+ */
+ procedure = gimp_procedure_new (brush_is_generated_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-is-generated");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-is-generated",
+ "Tests if brush is generated.",
+ "Returns TRUE if this brush is parametric, FALSE for other types.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("generated",
+ "generated",
+ "TRUE if the brush is generated",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-rename
+ */
+ procedure = gimp_procedure_new (brush_rename_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-rename");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-rename",
+ "Renames a brush.",
+ "This procedure renames a brush.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("new-name",
+ "new name",
+ "The new name of the brush",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("actual-name",
+ "actual name",
+ "The actual new name of the brush. The returned value must be freed with g_free()",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-delete
+ */
+ procedure = gimp_procedure_new (brush_delete_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-delete");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-delete",
+ "Deletes a brush.",
+ "This procedure deletes a brush.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-is-editable
+ */
+ procedure = gimp_procedure_new (brush_is_editable_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-is-editable");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-is-editable",
+ "Tests if brush can be edited.",
+ "Returns TRUE if you have permission to change the brush.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("editable",
+ "editable",
+ "TRUE if the brush can be edited",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-get-info
+ */
+ procedure = gimp_procedure_new (brush_get_info_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-get-info");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-get-info",
+ "Retrieves information about the specified brush.",
+ "This procedure retrieves information about the specified brush: brush extents (width and height), color depth and mask depth.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The brush width",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The brush height",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("mask-bpp",
+ "mask bpp",
+ "The brush mask bpp",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("color-bpp",
+ "color bpp",
+ "The brush color bpp",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-get-pixels
+ */
+ procedure = gimp_procedure_new (brush_get_pixels_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-get-pixels");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-get-pixels",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The brush width",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The brush height",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("mask-bpp",
+ "mask bpp",
+ "The brush mask bpp",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-mask-bytes",
+ "num mask bytes",
+ "Length of brush mask data",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("mask-bytes",
+ "mask bytes",
+ "The brush mask data",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("color-bpp",
+ "color bpp",
+ "The brush color bpp",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-color-bytes",
+ "num color bytes",
+ "Length of brush color data",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("color-bytes",
+ "color bytes",
+ "The brush color data",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-get-spacing
+ */
+ procedure = gimp_procedure_new (brush_get_spacing_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-get-spacing");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-get-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("spacing",
+ "spacing",
+ "The brush spacing",
+ 0, 1000, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-set-spacing
+ */
+ procedure = gimp_procedure_new (brush_set_spacing_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-set-spacing");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-set-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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("spacing",
+ "spacing",
+ "The brush spacing",
+ 0, 1000, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-get-shape
+ */
+ procedure = gimp_procedure_new (brush_get_shape_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-get-shape");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-get-shape",
+ "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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("shape",
+ "shape",
+ "The brush shape",
+ GIMP_TYPE_BRUSH_GENERATED_SHAPE,
+ GIMP_BRUSH_GENERATED_CIRCLE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-set-shape
+ */
+ procedure = gimp_procedure_new (brush_set_shape_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-set-shape");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-set-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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("shape-in",
+ "shape in",
+ "The brush shape",
+ GIMP_TYPE_BRUSH_GENERATED_SHAPE,
+ GIMP_BRUSH_GENERATED_CIRCLE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("shape-out",
+ "shape out",
+ "The brush shape actually assigned",
+ GIMP_TYPE_BRUSH_GENERATED_SHAPE,
+ GIMP_BRUSH_GENERATED_CIRCLE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-get-radius
+ */
+ procedure = gimp_procedure_new (brush_get_radius_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-get-radius");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-get-radius",
+ "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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("radius",
+ "radius",
+ "The radius of the brush in pixels",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-set-radius
+ */
+ procedure = gimp_procedure_new (brush_set_radius_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-set-radius");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-set-radius",
+ "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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("radius-in",
+ "radius in",
+ "The desired brush radius in pixel",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("radius-out",
+ "radius out",
+ "The brush radius actually assigned",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-get-spikes
+ */
+ procedure = gimp_procedure_new (brush_get_spikes_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-get-spikes");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-get-spikes",
+ "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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("spikes",
+ "spikes",
+ "The number of spikes on the brush.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-set-spikes
+ */
+ procedure = gimp_procedure_new (brush_set_spikes_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-set-spikes");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-set-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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("spikes-in",
+ "spikes in",
+ "The desired number of spikes",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("spikes-out",
+ "spikes out",
+ "The number of spikes actually assigned",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-get-hardness
+ */
+ procedure = gimp_procedure_new (brush_get_hardness_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-get-hardness");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-get-hardness",
+ "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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("hardness",
+ "hardness",
+ "The hardness of the brush.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-set-hardness
+ */
+ procedure = gimp_procedure_new (brush_set_hardness_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-set-hardness");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-set-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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("hardness-in",
+ "hardness in",
+ "The desired brush hardness",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("hardness-out",
+ "hardness out",
+ "The brush hardness actually assigned",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-get-aspect-ratio
+ */
+ procedure = gimp_procedure_new (brush_get_aspect_ratio_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-get-aspect-ratio");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-get-aspect-ratio",
+ "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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("aspect-ratio",
+ "aspect ratio",
+ "The aspect ratio of the brush.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-set-aspect-ratio
+ */
+ procedure = gimp_procedure_new (brush_set_aspect_ratio_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-set-aspect-ratio");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-set-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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("aspect-ratio-in",
+ "aspect ratio in",
+ "The desired brush aspect ratio",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("aspect-ratio-out",
+ "aspect ratio out",
+ "The brush aspect ratio actually assigned",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-get-angle
+ */
+ procedure = gimp_procedure_new (brush_get_angle_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-get-angle");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-get-angle",
+ "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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "The rotation angle of the brush in degree.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brush-set-angle
+ */
+ procedure = gimp_procedure_new (brush_set_angle_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brush-set-angle");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brush-set-angle",
+ "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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle-in",
+ "angle in",
+ "The desired brush rotation angle in degree",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("angle-out",
+ "angle out",
+ "The brush rotation angle actually assigned",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/brush-select-cmds.c b/app/pdb/brush-select-cmds.c
new file mode 100644
index 0000000..180bcbf
--- /dev/null
+++ b/app/pdb/brush-select-cmds.c
@@ -0,0 +1,285 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+brushes_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *brush_callback;
+ const gchar *popup_title;
+ const gchar *initial_brush;
+ gdouble opacity;
+ gint32 spacing;
+ gint32 paint_mode;
+
+ brush_callback = g_value_get_string (gimp_value_array_index (args, 0));
+ popup_title = g_value_get_string (gimp_value_array_index (args, 1));
+ initial_brush = g_value_get_string (gimp_value_array_index (args, 2));
+ opacity = g_value_get_double (gimp_value_array_index (args, 3));
+ spacing = g_value_get_int (gimp_value_array_index (args, 4));
+ paint_mode = g_value_get_enum (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
+ paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
+
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
+ ! gimp_pdb_dialog_new (gimp, context, progress,
+ gimp_data_factory_get_container (gimp->brush_factory),
+ popup_title, brush_callback, initial_brush,
+ "opacity", opacity / 100.0,
+ "paint-mode", paint_mode,
+ "spacing", spacing,
+ NULL))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+brushes_close_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *brush_callback;
+
+ brush_callback = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
+ ! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->brush_factory),
+ brush_callback))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+brushes_set_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *brush_callback;
+ const gchar *brush_name;
+ gdouble opacity;
+ gint32 spacing;
+ gint32 paint_mode;
+
+ brush_callback = g_value_get_string (gimp_value_array_index (args, 0));
+ brush_name = g_value_get_string (gimp_value_array_index (args, 1));
+ opacity = g_value_get_double (gimp_value_array_index (args, 2));
+ spacing = g_value_get_int (gimp_value_array_index (args, 3));
+ paint_mode = g_value_get_enum (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
+ paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
+
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) ||
+ ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->brush_factory),
+ brush_callback, brush_name,
+ "opacity", opacity / 100.0,
+ "paint-mode", paint_mode,
+ "spacing", spacing,
+ NULL))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_brush_select_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-brushes-popup
+ */
+ procedure = gimp_procedure_new (brushes_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brushes-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brushes-popup",
+ "Invokes the Gimp brush selection.",
+ "This procedure opens the brush selection dialog.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("brush-callback",
+ "brush callback",
+ "The callback PDB proc to call when brush selection is made",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("popup-title",
+ "popup title",
+ "Title of the brush selection dialog",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("initial-brush",
+ "initial brush",
+ "The name of the brush to set as the first selected",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The initial opacity of the brush",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("spacing",
+ "spacing",
+ "The initial spacing of the brush (if < 0 then use brush default spacing)",
+ G_MININT32, 1000, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("paint-mode",
+ "paint mode",
+ "The initial paint mode",
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brushes-close-popup
+ */
+ procedure = gimp_procedure_new (brushes_close_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brushes-close-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brushes-close-popup",
+ "Close the brush selection dialog.",
+ "This procedure closes an opened brush selection dialog.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("brush-callback",
+ "brush callback",
+ "The name of the callback registered for this pop-up",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brushes-set-popup
+ */
+ procedure = gimp_procedure_new (brushes_set_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brushes-set-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brushes-set-popup",
+ "Sets the current brush in a brush selection dialog.",
+ "Sets the current brush in a brush selection dialog.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("brush-callback",
+ "brush callback",
+ "The name of the callback registered for this pop-up",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("brush-name",
+ "brush name",
+ "The name of the brush to set as selected",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The initial opacity of the brush",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("spacing",
+ "spacing",
+ "The initial spacing of the brush (if < 0 then use brush default spacing)",
+ G_MININT32, 1000, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("paint-mode",
+ "paint mode",
+ "The initial paint mode",
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/brushes-cmds.c b/app/pdb/brushes-cmds.c
new file mode 100644
index 0000000..c6444c0
--- /dev/null
+++ b/app/pdb/brushes-cmds.c
@@ -0,0 +1,470 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpbrush.h"
+#include "core/gimpcontainer-filter.h"
+#include "core/gimpcontext.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimptempbuf.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+brushes_refresh_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_data_factory_data_refresh (gimp->brush_factory, context);
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+brushes_get_list_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *filter;
+ gint32 num_brushes = 0;
+ gchar **brush_list = NULL;
+
+ filter = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ brush_list = gimp_container_get_filtered_name_array (gimp_data_factory_get_container (gimp->brush_factory),
+ filter, &num_brushes);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_brushes);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), brush_list, num_brushes);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brushes_get_brush_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+ gint32 width = 0;
+ gint32 height = 0;
+ gint32 spacing = 0;
+
+ GimpBrush *brush = gimp_context_get_brush (context);
+
+ if (brush)
+ {
+ name = g_strdup (gimp_object_get_name (brush));
+ width = gimp_brush_get_width (brush);
+ height = gimp_brush_get_height (brush);
+ spacing = gimp_brush_get_spacing (brush);
+ }
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), width);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), height);
+ g_value_set_int (gimp_value_array_index (return_vals, 4), spacing);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brushes_get_spacing_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gint32 spacing = 0;
+
+ GimpBrush *brush = gimp_context_get_brush (context);
+
+ if (brush)
+ spacing = gimp_brush_get_spacing (brush);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), spacing);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+brushes_set_spacing_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 spacing;
+
+ spacing = g_value_get_int (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ gimp_brush_set_spacing (gimp_context_get_brush (context), spacing);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+brushes_get_brush_data_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gchar *actual_name = NULL;
+ gdouble opacity = 0.0;
+ gint32 spacing = 0;
+ gint32 paint_mode = 0;
+ gint32 width = 0;
+ gint32 height = 0;
+ gint32 length = 0;
+ guint8 *mask_data = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush;
+
+ if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
+ paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
+
+ if (name && strlen (name))
+ brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+ else
+ brush = gimp_context_get_brush (context);
+
+ if (brush)
+ {
+ GimpTempBuf *mask = gimp_brush_get_mask (brush);
+
+ actual_name = g_strdup (gimp_object_get_name (brush));
+ opacity = 1.0;
+ spacing = gimp_brush_get_spacing (brush);
+ paint_mode = 0;
+ width = gimp_brush_get_width (brush);
+ height = gimp_brush_get_height (brush);
+ length = gimp_temp_buf_get_data_size (mask);
+ mask_data = g_memdup (gimp_temp_buf_get_data (mask), length);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_take_string (gimp_value_array_index (return_vals, 1), actual_name);
+ g_value_set_double (gimp_value_array_index (return_vals, 2), opacity);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), spacing);
+ g_value_set_enum (gimp_value_array_index (return_vals, 4), paint_mode);
+ g_value_set_int (gimp_value_array_index (return_vals, 5), width);
+ g_value_set_int (gimp_value_array_index (return_vals, 6), height);
+ g_value_set_int (gimp_value_array_index (return_vals, 7), length);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 8), mask_data, length);
+ }
+
+ return return_vals;
+}
+
+void
+register_brushes_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-brushes-refresh
+ */
+ procedure = gimp_procedure_new (brushes_refresh_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brushes-refresh");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Seth Burgess",
+ "Seth Burgess",
+ "1997",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brushes-get-list
+ */
+ procedure = gimp_procedure_new (brushes_get_list_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brushes-get-list");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brushes-get-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filter",
+ "filter",
+ "An optional regular expression used to filter the list",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-brushes",
+ "num brushes",
+ "The number of brushes in the brush list",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("brush-list",
+ "brush list",
+ "The list of brush names",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brushes-get-brush
+ */
+ procedure = gimp_procedure_new (brushes_get_brush_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brushes-get-brush");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brushes-get-brush",
+ "Deprecated: Use 'gimp-context-get-brush' instead.",
+ "Deprecated: Use 'gimp-context-get-brush' instead.",
+ "",
+ "",
+ "",
+ "gimp-context-get-brush");
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The brush width",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The brush height",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("spacing",
+ "spacing",
+ "The brush spacing",
+ 0, 1000, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brushes-get-spacing
+ */
+ procedure = gimp_procedure_new (brushes_get_spacing_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brushes-get-spacing");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brushes-get-spacing",
+ "Deprecated: Use 'gimp-brush-get-spacing' instead.",
+ "Deprecated: Use 'gimp-brush-get-spacing' instead.",
+ "",
+ "",
+ "",
+ "gimp-brush-get-spacing");
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("spacing",
+ "spacing",
+ "The brush spacing",
+ 0, 1000, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brushes-set-spacing
+ */
+ procedure = gimp_procedure_new (brushes_set_spacing_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brushes-set-spacing");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brushes-set-spacing",
+ "Deprecated: Use 'gimp-brush-set-spacing' instead.",
+ "Deprecated: Use 'gimp-brush-set-spacing' instead.",
+ "",
+ "",
+ "",
+ "gimp-brush-set-spacing");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("spacing",
+ "spacing",
+ "The brush spacing",
+ 0, 1000, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-brushes-get-brush-data
+ */
+ procedure = gimp_procedure_new (brushes_get_brush_data_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brushes-get-brush-data");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brushes-get-brush-data",
+ "Deprecated: Use 'gimp-brush-get-pixels' instead.",
+ "Deprecated: Use 'gimp-brush-get-pixels' instead.",
+ "",
+ "",
+ "",
+ "gimp-brush-get-pixels");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The brush name (\"\" means current active brush)",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("actual-name",
+ "actual name",
+ "The brush name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The brush opacity",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("spacing",
+ "spacing",
+ "The brush spacing",
+ 0, 1000, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("paint-mode",
+ "paint mode",
+ "The paint mode",
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The brush width",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The brush height",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("length",
+ "length",
+ "Length of brush mask data",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("mask-data",
+ "mask data",
+ "The brush mask data",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/buffer-cmds.c b/app/pdb/buffer-cmds.c
new file mode 100644
index 0000000..23f5a8f
--- /dev/null
+++ b/app/pdb/buffer-cmds.c
@@ -0,0 +1,507 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpbuffer.h"
+#include "core/gimpcontainer-filter.h"
+#include "core/gimpcontainer.h"
+#include "core/gimpparamspecs.h"
+#include "gegl/gimp-babl-compat.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+buffers_get_list_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *filter;
+ gint32 num_buffers = 0;
+ gchar **buffer_list = NULL;
+
+ filter = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ buffer_list = gimp_container_get_filtered_name_array (gimp->named_buffers,
+ filter, &num_buffers);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_buffers);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), buffer_list, num_buffers);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+buffer_rename_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *buffer_name;
+ const gchar *new_name;
+ gchar *real_name = NULL;
+
+ buffer_name = g_value_get_string (gimp_value_array_index (args, 0));
+ new_name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
+
+ if (buffer)
+ {
+ gimp_object_set_name (GIMP_OBJECT (buffer), new_name);
+ real_name = g_strdup (gimp_object_get_name (buffer));
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), real_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+buffer_delete_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *buffer_name;
+
+ buffer_name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
+
+ if (buffer)
+ success = gimp_container_remove (gimp->named_buffers, GIMP_OBJECT (buffer));
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+buffer_get_width_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *buffer_name;
+ gint32 width = 0;
+
+ buffer_name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
+
+ if (buffer)
+ width = gimp_buffer_get_width (buffer);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), width);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+buffer_get_height_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *buffer_name;
+ gint32 height = 0;
+
+ buffer_name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
+
+ if (buffer)
+ height = gimp_buffer_get_height (buffer);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), height);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+buffer_get_bytes_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *buffer_name;
+ gint32 bytes = 0;
+
+ buffer_name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
+
+ if (buffer)
+ {
+ const Babl *format = gimp_buffer_get_format (buffer);
+
+ bytes = babl_format_get_bytes_per_pixel (format);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), bytes);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+buffer_get_image_type_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *buffer_name;
+ gint32 image_type = 0;
+
+ buffer_name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
+
+ if (buffer)
+ image_type = gimp_babl_format_get_image_type (gimp_buffer_get_format (buffer));
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), image_type);
+
+ return return_vals;
+}
+
+void
+register_buffer_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-buffers-get-list
+ */
+ procedure = gimp_procedure_new (buffers_get_list_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-buffers-get-list");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-buffers-get-list",
+ "Retrieve a complete listing of the available buffers.",
+ "This procedure returns a complete listing of available named buffers.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filter",
+ "filter",
+ "An optional regular expression used to filter the list",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-buffers",
+ "num buffers",
+ "The number of buffers",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("buffer-list",
+ "buffer list",
+ "The list of buffer names",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-buffer-rename
+ */
+ procedure = gimp_procedure_new (buffer_rename_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-buffer-rename");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-buffer-rename",
+ "Renames a named buffer.",
+ "This procedure renames a named buffer.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("buffer-name",
+ "buffer name",
+ "The buffer name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("new-name",
+ "new name",
+ "The buffer's new name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("real-name",
+ "real name",
+ "The real name given to the buffer",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-buffer-delete
+ */
+ procedure = gimp_procedure_new (buffer_delete_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-buffer-delete");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-buffer-delete",
+ "Deletes a named buffer.",
+ "This procedure deletes a named buffer.",
+ "David Gowers <neota@softhome.net>",
+ "David Gowers <neota@softhome.net>",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("buffer-name",
+ "buffer name",
+ "The buffer name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-buffer-get-width
+ */
+ procedure = gimp_procedure_new (buffer_get_width_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-buffer-get-width");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-buffer-get-width",
+ "Retrieves the specified buffer's width.",
+ "This procedure retrieves the specified named buffer's width.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("buffer-name",
+ "buffer name",
+ "The buffer name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The buffer width",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-buffer-get-height
+ */
+ procedure = gimp_procedure_new (buffer_get_height_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-buffer-get-height");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-buffer-get-height",
+ "Retrieves the specified buffer's height.",
+ "This procedure retrieves the specified named buffer's height.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("buffer-name",
+ "buffer name",
+ "The buffer name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The buffer height",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-buffer-get-bytes
+ */
+ procedure = gimp_procedure_new (buffer_get_bytes_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-buffer-get-bytes");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-buffer-get-bytes",
+ "Retrieves the specified buffer's bytes.",
+ "This procedure retrieves the specified named buffer's bytes.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("buffer-name",
+ "buffer name",
+ "The buffer name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("bytes",
+ "bytes",
+ "The buffer bpp",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-buffer-get-image-type
+ */
+ procedure = gimp_procedure_new (buffer_get_image_type_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-buffer-get-image-type");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-buffer-get-image-type",
+ "Retrieves the specified buffer's image type.",
+ "This procedure retrieves the specified named buffer's image type.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("buffer-name",
+ "buffer name",
+ "The buffer name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("image-type",
+ "image type",
+ "The buffer image type",
+ GIMP_TYPE_IMAGE_BASE_TYPE,
+ GIMP_RGB,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/channel-cmds.c b/app/pdb/channel-cmds.c
new file mode 100644
index 0000000..8d706b6
--- /dev/null
+++ b/app/pdb/channel-cmds.c
@@ -0,0 +1,736 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <cairo.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpcolor/gimpcolor.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpchannel-combine.h"
+#include "core/gimpchannel.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+channel_new_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 width;
+ gint32 height;
+ const gchar *name;
+ gdouble opacity;
+ GimpRGB color;
+ GimpChannel *channel = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ width = g_value_get_int (gimp_value_array_index (args, 1));
+ height = g_value_get_int (gimp_value_array_index (args, 2));
+ name = g_value_get_string (gimp_value_array_index (args, 3));
+ opacity = g_value_get_double (gimp_value_array_index (args, 4));
+ gimp_value_get_rgb (gimp_value_array_index (args, 5), &color);
+
+ if (success)
+ {
+ GimpRGB rgb_color = color;
+
+ rgb_color.a = opacity / 100.0;
+ channel = gimp_channel_new (image, width, height, name, &rgb_color);
+
+ if (! channel)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_channel (gimp_value_array_index (return_vals, 1), channel);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+channel_new_from_component_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 component;
+ const gchar *name;
+ GimpChannel *channel = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ component = g_value_get_enum (gimp_value_array_index (args, 1));
+ name = g_value_get_string (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_image_get_component_format (image, component) != NULL)
+ channel = gimp_channel_new_from_component (image,
+ component, name, NULL);
+
+ if (channel)
+ gimp_item_set_visible (GIMP_ITEM (channel), FALSE, FALSE);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_channel (gimp_value_array_index (return_vals, 1), channel);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+channel_copy_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpChannel *channel;
+ GimpChannel *channel_copy = NULL;
+
+ channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (channel));
+ gint width = gimp_image_get_width (image);
+ gint height = gimp_image_get_height (image);
+
+ if (gimp_item_get_width (GIMP_ITEM (channel)) == width &&
+ gimp_item_get_height (GIMP_ITEM (channel)) == height)
+ {
+ channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
+ GIMP_TYPE_CHANNEL));
+
+ if (! channel_copy)
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_channel (gimp_value_array_index (return_vals, 1), channel_copy);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+channel_combine_masks_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpChannel *channel1;
+ GimpChannel *channel2;
+ gint32 operation;
+ gint32 offx;
+ gint32 offy;
+
+ channel1 = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);
+ channel2 = gimp_value_get_channel (gimp_value_array_index (args, 1), gimp);
+ operation = g_value_get_enum (gimp_value_array_index (args, 2));
+ offx = g_value_get_int (gimp_value_array_index (args, 3));
+ offy = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (channel1)))
+ gimp_channel_push_undo (channel1, _("Combine Masks"));
+
+ gimp_channel_combine_mask (channel1, channel2, operation, offx, offy);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+channel_get_show_masked_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpChannel *channel;
+ gboolean show_masked = FALSE;
+
+ channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ show_masked = gimp_channel_get_show_masked (channel);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), show_masked);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+channel_set_show_masked_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpChannel *channel;
+ gboolean show_masked;
+
+ channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);
+ show_masked = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_channel_set_show_masked (channel, show_masked);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+channel_get_opacity_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpChannel *channel;
+ gdouble opacity = 0.0;
+
+ channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ opacity = gimp_channel_get_opacity (channel) * 100;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), opacity);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+channel_set_opacity_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpChannel *channel;
+ gdouble opacity;
+
+ channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);
+ opacity = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_channel_set_opacity (channel, opacity / 100.0, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+channel_get_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpChannel *channel;
+ GimpRGB color = { 0.0, 0.0, 0.0, 1.0 };
+
+ channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_channel_get_color (channel, &color);
+ gimp_rgb_set_alpha (&color, 1.0);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &color);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+channel_set_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpChannel *channel;
+ GimpRGB color;
+
+ channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);
+ gimp_value_get_rgb (gimp_value_array_index (args, 1), &color);
+
+ if (success)
+ {
+ GimpRGB rgb_color = color;
+
+ rgb_color.a = channel->color.a;
+ gimp_channel_set_color (channel, &rgb_color, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_channel_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-channel-new
+ */
+ procedure = gimp_procedure_new (channel_new_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-channel-new");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-channel-new",
+ "Create a new channel.",
+ "This procedure creates a new channel with the specified width, height, name, opacity and color.\n"
+ "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.\n"
+ "The channel's contents are undefined initially.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image to which to add the channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The channel width",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The channel height",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The channel name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The channel opacity",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The channel compositing color",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The newly created channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-channel-new-from-component
+ */
+ procedure = gimp_procedure_new (channel_new_from_component_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-channel-new-from-component");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-channel-new-from-component",
+ "Create a new channel from a color component",
+ "This procedure creates a new channel from a color component.\n"
+ "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.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image to which to add the channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("component",
+ "component",
+ "The image component",
+ GIMP_TYPE_CHANNEL_TYPE,
+ GIMP_CHANNEL_RED,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The channel name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The newly created channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-channel-copy
+ */
+ procedure = gimp_procedure_new (channel_copy_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-channel-copy");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-channel-copy",
+ "Copy a channel.",
+ "This procedure copies the specified channel and returns the copy.\n"
+ "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'.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel to copy",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_channel_id ("channel-copy",
+ "channel copy",
+ "The newly copied channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-channel-combine-masks
+ */
+ procedure = gimp_procedure_new (channel_combine_masks_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-channel-combine-masks");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-channel-combine-masks",
+ "Combine two channel masks.",
+ "This procedure combines two channel masks. The result is stored in the first channel.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel1",
+ "channel1",
+ "The channel1",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel2",
+ "channel2",
+ "The channel2",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offx",
+ "offx",
+ "x offset between upper left corner of channels: (second - first)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offy",
+ "offy",
+ "y offset between upper left corner of channels: (second - first)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-channel-get-show-masked
+ */
+ procedure = gimp_procedure_new (channel_get_show_masked_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-channel-get-show-masked");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-channel-get-show-masked",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("show-masked",
+ "show masked",
+ "The channel composite method",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-channel-set-show-masked
+ */
+ procedure = gimp_procedure_new (channel_set_show_masked_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-channel-set-show-masked");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-channel-set-show-masked",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("show-masked",
+ "show masked",
+ "The new channel composite method",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-channel-get-opacity
+ */
+ procedure = gimp_procedure_new (channel_get_opacity_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-channel-get-opacity");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-channel-get-opacity",
+ "Get the opacity of the specified channel.",
+ "This procedure returns the specified channel's opacity.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The channel opacity",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-channel-set-opacity
+ */
+ procedure = gimp_procedure_new (channel_set_opacity_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-channel-set-opacity");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-channel-set-opacity",
+ "Set the opacity of the specified channel.",
+ "This procedure sets the specified channel's opacity.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The new channel opacity",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-channel-get-color
+ */
+ procedure = gimp_procedure_new (channel_get_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-channel-get-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-channel-get-color",
+ "Get the compositing color of the specified channel.",
+ "This procedure returns the specified channel's compositing color.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The channel compositing color",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-channel-set-color
+ */
+ procedure = gimp_procedure_new (channel_set_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-channel-set-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-channel-set-color",
+ "Set the compositing color of the specified channel.",
+ "This procedure sets the specified channel's compositing color.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The new channel compositing color",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/color-cmds.c b/app/pdb/color-cmds.c
new file mode 100644
index 0000000..50949f7
--- /dev/null
+++ b/app/pdb/color-cmds.c
@@ -0,0 +1,1413 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpmath/gimpmath.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpdrawable-equalize.h"
+#include "core/gimpdrawable-histogram.h"
+#include "core/gimpdrawable-levels.h"
+#include "core/gimpdrawable-operation.h"
+#include "core/gimpdrawable.h"
+#include "core/gimphistogram.h"
+#include "core/gimpparamspecs.h"
+#include "operations/gimpbrightnesscontrastconfig.h"
+#include "operations/gimpcolorbalanceconfig.h"
+#include "operations/gimpcurvesconfig.h"
+#include "operations/gimphuesaturationconfig.h"
+#include "operations/gimplevelsconfig.h"
+#include "plug-in/gimpplugin.h"
+#include "plug-in/gimppluginmanager.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+brightness_contrast_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 brightness;
+ gint32 contrast;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ brightness = g_value_get_int (gimp_value_array_index (args, 1));
+ contrast = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG,
+ "brightness", brightness / 127.0,
+ "contrast", contrast / 127.0,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Brightness-Contrast"),
+ "gimp:brightness-contrast",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+levels_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 channel;
+ gint32 low_input;
+ gint32 high_input;
+ gdouble gamma;
+ gint32 low_output;
+ gint32 high_output;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ channel = g_value_get_enum (gimp_value_array_index (args, 1));
+ low_input = g_value_get_int (gimp_value_array_index (args, 2));
+ high_input = g_value_get_int (gimp_value_array_index (args, 3));
+ gamma = g_value_get_double (gimp_value_array_index (args, 4));
+ low_output = g_value_get_int (gimp_value_array_index (args, 5));
+ high_output = g_value_get_int (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ channel != GIMP_HISTOGRAM_LUMINANCE &&
+ (gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
+ (! gimp_drawable_is_gray (drawable) ||
+ channel == GIMP_HISTOGRAM_VALUE || channel == GIMP_HISTOGRAM_ALPHA))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_LEVELS_CONFIG,
+ "channel", channel,
+ NULL);
+
+ g_object_set (config,
+ "low-input", low_input / 255.0,
+ "high-input", high_input / 255.0,
+ "clamp-input", TRUE,
+ "gamma", gamma,
+ "low-output", low_output / 255.0,
+ "high-output", high_output / 255.0,
+ "clamp-input", TRUE,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Levels"),
+ "gimp:levels",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = TRUE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+levels_auto_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ gimp_drawable_levels_stretch (drawable, progress);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+levels_stretch_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ gimp_drawable_levels_stretch (drawable, progress);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+posterize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 levels;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ levels = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gimp:posterize",
+ "levels", levels,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Posterize"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+desaturate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_drawable_is_rgb (drawable))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gimp:desaturate",
+ "mode", GIMP_DESATURATE_LIGHTNESS,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Desaturate"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+desaturate_full_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 desaturate_mode;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ desaturate_mode = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_drawable_is_rgb (drawable))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gimp:desaturate",
+ "mode", desaturate_mode,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Desaturate"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+equalize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gboolean mask_only;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ mask_only = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) ||
+ ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ success = FALSE;
+
+ if (success)
+ gimp_drawable_equalize (drawable, mask_only);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+invert_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ _("Invert"),
+ "gegl:invert-gamma",
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+curves_spline_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 channel;
+ gint32 num_points;
+ const guint8 *control_pts;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ channel = g_value_get_enum (gimp_value_array_index (args, 1));
+ num_points = g_value_get_int (gimp_value_array_index (args, 2));
+ control_pts = gimp_value_get_int8array (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ ! (num_points & 1) &&
+ (gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
+ (! gimp_drawable_is_gray (drawable) ||
+ channel == GIMP_HISTOGRAM_VALUE || channel == GIMP_HISTOGRAM_ALPHA) &&
+ channel != GIMP_HISTOGRAM_LUMINANCE)
+ {
+ GObject *config = gimp_curves_config_new_spline_cruft (channel,
+ control_pts,
+ num_points / 2);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Curves"),
+ "gimp:curves",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+curves_explicit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 channel;
+ gint32 num_bytes;
+ const guint8 *curve;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ channel = g_value_get_enum (gimp_value_array_index (args, 1));
+ num_bytes = g_value_get_int (gimp_value_array_index (args, 2));
+ curve = gimp_value_get_int8array (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ (num_bytes == 256) &&
+ (gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
+ (! gimp_drawable_is_gray (drawable) ||
+ channel == GIMP_HISTOGRAM_VALUE || channel == GIMP_HISTOGRAM_ALPHA) &&
+ channel != GIMP_HISTOGRAM_LUMINANCE)
+ {
+ GObject *config = gimp_curves_config_new_explicit_cruft (channel,
+ curve,
+ num_bytes);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Curves"),
+ "gimp:curves",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+color_balance_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 transfer_mode;
+ gboolean preserve_lum;
+ gdouble cyan_red;
+ gdouble magenta_green;
+ gdouble yellow_blue;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ transfer_mode = g_value_get_enum (gimp_value_array_index (args, 1));
+ preserve_lum = g_value_get_boolean (gimp_value_array_index (args, 2));
+ cyan_red = g_value_get_double (gimp_value_array_index (args, 3));
+ magenta_green = g_value_get_double (gimp_value_array_index (args, 4));
+ yellow_blue = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_COLOR_BALANCE_CONFIG,
+ "range", transfer_mode,
+ "preserve-luminosity", preserve_lum,
+ NULL);
+
+ g_object_set (config,
+ "cyan-red", cyan_red / 100.0,
+ "magenta-green", magenta_green / 100.0,
+ "yellow-blue", yellow_blue / 100.0,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Color Balance"),
+ "gimp:color-balance",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+colorize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble hue;
+ gdouble saturation;
+ gdouble lightness;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ hue = g_value_get_double (gimp_value_array_index (args, 1));
+ saturation = g_value_get_double (gimp_value_array_index (args, 2));
+ lightness = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ ! gimp_drawable_is_gray (drawable))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gimp:colorize",
+ "hue", hue / 360.0,
+ "saturation", saturation / 100.0,
+ "lightness", lightness / 100.0,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Colorize"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+histogram_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 channel;
+ gint32 start_range;
+ gint32 end_range;
+ gdouble mean = 0.0;
+ gdouble std_dev = 0.0;
+ gdouble median = 0.0;
+ gdouble pixels = 0.0;
+ gdouble count = 0.0;
+ gdouble percentile = 0.0;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ channel = g_value_get_enum (gimp_value_array_index (args, 1));
+ start_range = g_value_get_int (gimp_value_array_index (args, 2));
+ end_range = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error) ||
+ (! gimp_drawable_has_alpha (drawable) &&
+ channel == GIMP_HISTOGRAM_ALPHA) ||
+ (gimp_drawable_is_gray (drawable) &&
+ channel != GIMP_HISTOGRAM_VALUE && channel != GIMP_HISTOGRAM_ALPHA))
+ success = FALSE;
+
+ if (success)
+ {
+ GimpHistogram *histogram;
+ gint start = start_range;
+ gint end = end_range;
+ gboolean precision_enabled;
+ gboolean linear;
+ gint n_bins;
+
+ precision_enabled =
+ gimp->plug_in_manager->current_plug_in &&
+ gimp_plug_in_precision_enabled (gimp->plug_in_manager->current_plug_in);
+
+ if (precision_enabled)
+ linear = gimp_drawable_get_linear (drawable);
+ else
+ linear = FALSE;
+
+ histogram = gimp_histogram_new (linear);
+ gimp_drawable_calculate_histogram (drawable, histogram, FALSE);
+
+ n_bins = gimp_histogram_n_bins (histogram);
+
+ if (n_bins != 256)
+ {
+ start = ROUND ((gdouble) start * (n_bins - 1) / 255);
+ end = ROUND ((gdouble) end * (n_bins - 1) / 255);
+ }
+
+ mean = gimp_histogram_get_mean (histogram, channel,
+ start, end);
+ std_dev = gimp_histogram_get_std_dev (histogram, channel,
+ start, end);
+ median = gimp_histogram_get_median (histogram, channel,
+ start, end);
+ pixels = gimp_histogram_get_count (histogram, channel, 0, n_bins - 1);
+ count = gimp_histogram_get_count (histogram, channel,
+ start, end);
+ percentile = count / pixels;
+
+ g_object_unref (histogram);
+
+ if (n_bins == 256 || ! precision_enabled)
+ {
+ mean *= 255;
+ std_dev *= 255;
+ median *= 255;
+ }
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_double (gimp_value_array_index (return_vals, 1), mean);
+ g_value_set_double (gimp_value_array_index (return_vals, 2), std_dev);
+ g_value_set_double (gimp_value_array_index (return_vals, 3), median);
+ g_value_set_double (gimp_value_array_index (return_vals, 4), pixels);
+ g_value_set_double (gimp_value_array_index (return_vals, 5), count);
+ g_value_set_double (gimp_value_array_index (return_vals, 6), percentile);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+hue_saturation_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 hue_range;
+ gdouble hue_offset;
+ gdouble lightness;
+ gdouble saturation;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ hue_range = g_value_get_enum (gimp_value_array_index (args, 1));
+ hue_offset = g_value_get_double (gimp_value_array_index (args, 2));
+ lightness = g_value_get_double (gimp_value_array_index (args, 3));
+ saturation = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_HUE_SATURATION_CONFIG,
+ "range", hue_range,
+ NULL);
+
+ g_object_set (config,
+ "hue", hue_offset / 180.0,
+ "saturation", saturation / 100.0,
+ "lightness", lightness / 100.0,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ _("Hue-Saturation"),
+ "gimp:hue-saturation",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+threshold_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 low_threshold;
+ gint32 high_threshold;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ low_threshold = g_value_get_int (gimp_value_array_index (args, 1));
+ high_threshold = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gimp:threshold",
+ "low", low_threshold / 255.0,
+ "high", high_threshold / 255.0,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Threshold"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_color_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-brightness-contrast
+ */
+ procedure = gimp_procedure_new (brightness_contrast_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-brightness-contrast");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-brightness-contrast",
+ "Deprecated: Use 'gimp-drawable-brightness-contrast' instead.",
+ "Deprecated: Use 'gimp-drawable-brightness-contrast' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-brightness-contrast");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("brightness",
+ "brightness",
+ "Brightness adjustment",
+ -127, 127, -127,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("contrast",
+ "contrast",
+ "Contrast adjustment",
+ -127, 127, -127,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-levels
+ */
+ procedure = gimp_procedure_new (levels_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-levels");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-levels",
+ "Deprecated: Use 'gimp-drawable-levels' instead.",
+ "Deprecated: Use 'gimp-drawable-levels' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-levels");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("channel",
+ "channel",
+ "The channel to modify",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("low-input",
+ "low input",
+ "Intensity of lowest input",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("high-input",
+ "high input",
+ "Intensity of highest input",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("gamma",
+ "gamma",
+ "Gamma adjustment factor",
+ 0.1, 10, 0.1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("low-output",
+ "low output",
+ "Intensity of lowest output",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("high-output",
+ "high output",
+ "Intensity of highest output",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-levels-auto
+ */
+ procedure = gimp_procedure_new (levels_auto_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-levels-auto");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-levels-auto",
+ "Deprecated: Use 'gimp-drawable-levels-stretch' instead.",
+ "Deprecated: Use 'gimp-drawable-levels-stretch' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-levels-stretch");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-levels-stretch
+ */
+ procedure = gimp_procedure_new (levels_stretch_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-levels-stretch");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-levels-stretch",
+ "Deprecated: Use 'gimp-drawable-levels-stretch' instead.",
+ "Deprecated: Use 'gimp-drawable-levels-stretch' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-levels-stretch");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-posterize
+ */
+ procedure = gimp_procedure_new (posterize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-posterize");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-posterize",
+ "Deprecated: Use 'gimp-drawable-posterize' instead.",
+ "Deprecated: Use 'gimp-drawable-posterize' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-posterize");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("levels",
+ "levels",
+ "Levels of posterization",
+ 2, 255, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-desaturate
+ */
+ procedure = gimp_procedure_new (desaturate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-desaturate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-desaturate",
+ "Deprecated: Use 'gimp-drawable-desaturate' instead.",
+ "Deprecated: Use 'gimp-drawable-desaturate' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-desaturate");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-desaturate-full
+ */
+ procedure = gimp_procedure_new (desaturate_full_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-desaturate-full");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-desaturate-full",
+ "Deprecated: Use 'gimp-drawable-desaturate' instead.",
+ "Deprecated: Use 'gimp-drawable-desaturate' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-desaturate");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("desaturate-mode",
+ "desaturate mode",
+ "The formula to use to desaturate",
+ GIMP_TYPE_DESATURATE_MODE,
+ GIMP_DESATURATE_LIGHTNESS,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-equalize
+ */
+ procedure = gimp_procedure_new (equalize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-equalize");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-equalize",
+ "Deprecated: Use 'gimp-drawable-equalize' instead.",
+ "Deprecated: Use 'gimp-drawable-equalize' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-equalize");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("mask-only",
+ "mask only",
+ "Equalization option",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-invert
+ */
+ procedure = gimp_procedure_new (invert_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-invert");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-invert",
+ "Deprecated: Use 'gimp-drawable-invert' instead.",
+ "Deprecated: Use 'gimp-drawable-invert' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-invert");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-curves-spline
+ */
+ procedure = gimp_procedure_new (curves_spline_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-curves-spline");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-curves-spline",
+ "Deprecated: Use 'gimp-drawable-curves-spline' instead.",
+ "Deprecated: Use 'gimp-drawable-curves-spline' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-curves-spline");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("channel",
+ "channel",
+ "The channel to modify",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-points",
+ "num points",
+ "The number of values in the control point array",
+ 4, 34, 4,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8_array ("control-pts",
+ "control pts",
+ "The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y, ... }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-curves-explicit
+ */
+ procedure = gimp_procedure_new (curves_explicit_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-curves-explicit");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-curves-explicit",
+ "Deprecated: Use 'gimp-drawable-curves-explicit' instead.",
+ "Deprecated: Use 'gimp-drawable-curves-explicit' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-curves-explicit");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("channel",
+ "channel",
+ "The channel to modify",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-bytes",
+ "num bytes",
+ "The number of bytes in the new curve (always 256)",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8_array ("curve",
+ "curve",
+ "The explicit curve",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-color-balance
+ */
+ procedure = gimp_procedure_new (color_balance_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-color-balance");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-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.\n"
+ "\n"
+ "Deprecated: Use 'gimp-drawable-color-color-balance' instead.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ "gimp-drawable-color-color-balance");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("transfer-mode",
+ "transfer mode",
+ "Transfer mode",
+ GIMP_TYPE_TRANSFER_MODE,
+ GIMP_TRANSFER_SHADOWS,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("preserve-lum",
+ "preserve lum",
+ "Preserve luminosity values at each pixel",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("cyan-red",
+ "cyan red",
+ "Cyan-Red color balance",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("magenta-green",
+ "magenta green",
+ "Magenta-Green color balance",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("yellow-blue",
+ "yellow blue",
+ "Yellow-Blue color balance",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-colorize
+ */
+ procedure = gimp_procedure_new (colorize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-colorize");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-colorize",
+ "Deprecated: Use 'gimp-drawable-colorize-hsl' instead.",
+ "Deprecated: Use 'gimp-drawable-colorize-hsl' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-colorize-hsl");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("hue",
+ "hue",
+ "Hue in degrees",
+ 0, 360, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("saturation",
+ "saturation",
+ "Saturation in percent",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("lightness",
+ "lightness",
+ "Lightness in percent",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-histogram
+ */
+ procedure = gimp_procedure_new (histogram_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-histogram");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-histogram",
+ "Deprecated: Use 'gimp-drawable-histogram' instead.",
+ "Deprecated: Use 'gimp-drawable-histogram' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-histogram");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("channel",
+ "channel",
+ "The channel to modify",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("start-range",
+ "start range",
+ "Start of the intensity measurement range",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("end-range",
+ "end range",
+ "End of the intensity measurement range",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("mean",
+ "mean",
+ "Mean intensity value",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("std-dev",
+ "std dev",
+ "Standard deviation of intensity values",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("median",
+ "median",
+ "Median intensity value",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("pixels",
+ "pixels",
+ "Alpha-weighted pixel count for entire image",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("count",
+ "count",
+ "Alpha-weighted pixel count for range",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("percentile",
+ "percentile",
+ "Percentile that range falls under",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-hue-saturation
+ */
+ procedure = gimp_procedure_new (hue_saturation_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-hue-saturation");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-hue-saturation",
+ "Deprecated: Use 'gimp-drawable-hue-saturation' instead.",
+ "Deprecated: Use 'gimp-drawable-hue-saturation' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-hue-saturation");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("hue-range",
+ "hue range",
+ "Range of affected hues",
+ GIMP_TYPE_HUE_RANGE,
+ GIMP_HUE_RANGE_ALL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("hue-offset",
+ "hue offset",
+ "Hue offset in degrees",
+ -180, 180, -180,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("lightness",
+ "lightness",
+ "Lightness modification",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("saturation",
+ "saturation",
+ "Saturation modification",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-threshold
+ */
+ procedure = gimp_procedure_new (threshold_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-threshold");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-threshold",
+ "Deprecated: Use 'gimp-drawable-threshold' instead.",
+ "Deprecated: Use 'gimp-drawable-threshold' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-threshold");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("low-threshold",
+ "low threshold",
+ "The low threshold value",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("high-threshold",
+ "high threshold",
+ "The high threshold value",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/context-cmds.c b/app/pdb/context-cmds.c
new file mode 100644
index 0000000..1d36703
--- /dev/null
+++ b/app/pdb/context-cmds.c
@@ -0,0 +1,5752 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <cairo.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpcolor/gimpcolor.h"
+#include "libgimpconfig/gimpconfig.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp-gradients.h"
+#include "core/gimp.h"
+#include "core/gimpcontainer.h"
+#include "core/gimpdashpattern.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimplist.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimpstrokeoptions.h"
+#include "paint/gimppaintoptions.h"
+#include "plug-in/gimpplugin-context.h"
+#include "plug-in/gimpplugin.h"
+#include "plug-in/gimppluginmanager.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+context_push_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->open)
+ success = gimp_plug_in_context_push (plug_in);
+ else
+ success = FALSE;
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_pop_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->open)
+ success = gimp_plug_in_context_pop (plug_in);
+ else
+ success = FALSE;
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_set_defaults_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_config_reset (GIMP_CONFIG (context));
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+context_list_paint_methods_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 num_paint_methods = 0;
+ gchar **paint_methods = NULL;
+
+ paint_methods = gimp_container_get_name_array (gimp->paint_info_list,
+ &num_paint_methods);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_paint_methods);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), paint_methods, num_paint_methods);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_get_paint_method_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+
+ GimpPaintInfo *paint_info = gimp_context_get_paint_info (context);
+
+ if (paint_info)
+ name = g_strdup (gimp_object_get_name (paint_info));
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_paint_method_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPaintInfo *paint_info = gimp_pdb_get_paint_info (gimp, name, error);
+
+ if (paint_info)
+ gimp_context_set_paint_info (context, paint_info);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_stroke_method_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 stroke_method = 0;
+
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_get (options,
+ "method", &stroke_method,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), stroke_method);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_stroke_method_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 stroke_method;
+
+ stroke_method = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_set (options,
+ "method", stroke_method,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_foreground_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ GimpRGB foreground = { 0.0, 0.0, 0.0, 1.0 };
+
+ gimp_context_get_foreground (context, &foreground);
+ gimp_rgb_set_alpha (&foreground, 1.0);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &foreground);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_foreground_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpRGB foreground;
+
+ gimp_value_get_rgb (gimp_value_array_index (args, 0), &foreground);
+
+ if (success)
+ {
+ gimp_rgb_set_alpha (&foreground, 1.0);
+ gimp_context_set_foreground (context, &foreground);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_background_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ GimpRGB background = { 0.0, 0.0, 0.0, 1.0 };
+
+ gimp_context_get_background (context, &background);
+ gimp_rgb_set_alpha (&background, 1.0);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &background);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_background_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpRGB background;
+
+ gimp_value_get_rgb (gimp_value_array_index (args, 0), &background);
+
+ if (success)
+ {
+ gimp_rgb_set_alpha (&background, 1.0);
+ gimp_context_set_background (context, &background);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_set_default_colors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_context_set_default_colors (context);
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+context_swap_colors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_context_swap_colors (context);
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+context_get_opacity_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gdouble opacity = 0.0;
+
+ opacity = gimp_context_get_opacity (context) * 100.0;
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_double (gimp_value_array_index (return_vals, 1), opacity);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_opacity_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble opacity;
+
+ opacity = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ gimp_context_set_opacity (context, opacity / 100.0);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_paint_mode_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 paint_mode = 0;
+
+ paint_mode = gimp_context_get_paint_mode (context);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), paint_mode);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_paint_mode_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 paint_mode;
+
+ paint_mode = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
+ paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
+
+ gimp_context_set_paint_mode (context, paint_mode);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_line_width_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gdouble line_width = 0.0;
+
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_get (options,
+ "width", &line_width,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_double (gimp_value_array_index (return_vals, 1), line_width);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_width_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble line_width;
+
+ line_width = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_set (options,
+ "width", line_width,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_line_width_unit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ GimpUnit line_width_unit = 0;
+
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_get (options,
+ "unit", &line_width_unit,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_int (gimp_value_array_index (return_vals, 1), line_width_unit);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_width_unit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpUnit line_width_unit;
+
+ line_width_unit = g_value_get_int (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_set (options,
+ "unit", line_width_unit,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_line_cap_style_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 cap_style = 0;
+
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_get (options,
+ "cap-style", &cap_style,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), cap_style);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_cap_style_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 cap_style;
+
+ cap_style = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_set (options,
+ "cap-style", cap_style,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_line_join_style_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 join_style = 0;
+
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_get (options,
+ "join-style", &join_style,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), join_style);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_join_style_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 join_style;
+
+ join_style = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_set (options,
+ "join-style", join_style,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_line_miter_limit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gdouble miter_limit = 0.0;
+
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_get (options,
+ "miter-limit", &miter_limit,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_double (gimp_value_array_index (return_vals, 1), miter_limit);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_miter_limit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble miter_limit;
+
+ miter_limit = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_set (options,
+ "miter-limit", miter_limit,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_line_dash_offset_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gdouble dash_offset = 0.0;
+
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_get (options,
+ "dash-offset", &dash_offset,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_double (gimp_value_array_index (return_vals, 1), dash_offset);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_dash_offset_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble dash_offset;
+
+ dash_offset = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ g_object_set (options,
+ "dash-offset", dash_offset,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_line_dash_pattern_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 num_dashes = 0;
+ gdouble *dashes = NULL;
+
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ GArray *pattern = gimp_stroke_options_get_dash_info (options);
+
+ dashes = gimp_dash_pattern_to_double_array (pattern, &num_dashes);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_dashes);
+ gimp_value_take_floatarray (gimp_value_array_index (return_vals, 2), dashes, num_dashes);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_dash_pattern_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 num_dashes;
+ const gdouble *dashes;
+
+ num_dashes = g_value_get_int (gimp_value_array_index (args, 0));
+ dashes = gimp_value_get_floatarray (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpStrokeOptions *options =
+ gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ GArray *pattern = NULL;
+
+ if (num_dashes > 0)
+ {
+ pattern = gimp_dash_pattern_from_double_array (num_dashes, dashes);
+
+ if (! pattern)
+ success = FALSE;
+ }
+
+ if (success)
+ gimp_stroke_options_take_dash_pattern (options, GIMP_DASH_CUSTOM, pattern);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_brush_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+
+ GimpBrush *brush = gimp_context_get_brush (context);
+
+ if (brush)
+ name = g_strdup (gimp_object_get_name (brush));
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_brush_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBrush *brush = gimp_pdb_get_brush (gimp, name, FALSE, error);
+
+ if (brush)
+ gimp_context_set_brush (context, brush);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_brush_size_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble size = 0.0;
+
+ /* all options should have the same value, so pick a random one */
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-paintbrush");
+
+ if (options)
+ g_object_get (options,
+ "brush-size", &size,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), size);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_brush_size_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble size;
+
+ size = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GList *options;
+ GList *list;
+
+ options = gimp_pdb_context_get_brush_options (GIMP_PDB_CONTEXT (context));
+
+ for (list = options; list; list = g_list_next (list))
+ g_object_set (list->data,
+ "brush-size", (gdouble) size,
+ NULL);
+
+ g_list_free (options);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_set_brush_default_size_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpBrush *brush = gimp_context_get_brush (context);
+
+ if (brush)
+ {
+ GList *options;
+ GList *list;
+
+ options = gimp_pdb_context_get_brush_options (GIMP_PDB_CONTEXT (context));
+
+ for (list = options; list; list = g_list_next (list))
+ gimp_paint_options_set_default_brush_size (list->data, brush);
+
+ g_list_free (options);
+ }
+ else
+ {
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_brush_aspect_ratio_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble aspect = 0.0;
+
+ /* all options should have the same value, so pick a random one */
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-paintbrush");
+
+ if (options)
+ g_object_get (options,
+ "brush-aspect-ratio", &aspect,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), aspect);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_brush_aspect_ratio_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble aspect;
+
+ aspect = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GList *options;
+ GList *list;
+
+ options = gimp_pdb_context_get_brush_options (GIMP_PDB_CONTEXT (context));
+
+ for (list = options; list; list = g_list_next (list))
+ g_object_set (list->data,
+ "brush-aspect-ratio", (gdouble) aspect,
+ NULL);
+
+ g_list_free (options);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_brush_angle_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble angle = 0.0;
+
+ /* all options should have the same value, so pick a random one */
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-paintbrush");
+
+ if (options)
+ g_object_get (options,
+ "brush-angle", &angle,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), angle);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_brush_angle_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble angle;
+
+ angle = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GList *options;
+ GList *list;
+
+ options = gimp_pdb_context_get_brush_options (GIMP_PDB_CONTEXT (context));
+
+ for (list = options; list; list = g_list_next (list))
+ g_object_set (list->data,
+ "brush-angle", (gdouble) angle,
+ NULL);
+
+ g_list_free (options);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_brush_spacing_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble spacing = 0.0;
+
+ /* all options should have the same value, so pick a random one */
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-paintbrush");
+
+ if (options)
+ g_object_get (options,
+ "brush-spacing", &spacing,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), spacing);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_brush_spacing_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble spacing;
+
+ spacing = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GList *options;
+ GList *list;
+
+ options = gimp_pdb_context_get_brush_options (GIMP_PDB_CONTEXT (context));
+
+ for (list = options; list; list = g_list_next (list))
+ g_object_set (list->data,
+ "brush-spacing", (gdouble) spacing,
+ NULL);
+
+ g_list_free (options);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_set_brush_default_spacing_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpBrush *brush = gimp_context_get_brush (context);
+
+ if (brush)
+ {
+ GList *options;
+ GList *list;
+
+ options = gimp_pdb_context_get_brush_options (GIMP_PDB_CONTEXT (context));
+
+ for (list = options; list; list = g_list_next (list))
+ gimp_paint_options_set_default_brush_spacing (list->data, brush);
+
+ g_list_free (options);
+ }
+ else
+ {
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_brush_hardness_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble hardness = 0.0;
+
+ /* all options should have the same value, so pick a random one */
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-paintbrush");
+
+ if (options)
+ g_object_get (options,
+ "brush-hardness", &hardness,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), hardness);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_brush_hardness_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble hardness;
+
+ hardness = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GList *options;
+ GList *list;
+
+ options = gimp_pdb_context_get_brush_options (GIMP_PDB_CONTEXT (context));
+
+ for (list = options; list; list = g_list_next (list))
+ g_object_set (list->data,
+ "brush-hardness", (gdouble) hardness,
+ NULL);
+
+ g_list_free (options);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_set_brush_default_hardness_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpBrush *brush = gimp_context_get_brush (context);
+
+ if (brush)
+ {
+ GList *options;
+ GList *list;
+
+ options = gimp_pdb_context_get_brush_options (GIMP_PDB_CONTEXT (context));
+
+ for (list = options; list; list = g_list_next (list))
+ gimp_paint_options_set_default_brush_hardness (list->data, brush);
+
+ g_list_free (options);
+ }
+ else
+ {
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_brush_force_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble force = 0.0;
+
+ /* all options should have the same value, so pick a random one */
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-paintbrush");
+
+ if (options)
+ g_object_get (options,
+ "brush-force", &force,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), force);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_brush_force_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble force;
+
+ force = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GList *options;
+ GList *list;
+
+ options = gimp_pdb_context_get_brush_options (GIMP_PDB_CONTEXT (context));
+
+ for (list = options; list; list = g_list_next (list))
+ g_object_set (list->data,
+ "brush-force", (gdouble) force,
+ NULL);
+
+ g_list_free (options);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_dynamics_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+
+ GimpDynamics *dynamics = gimp_context_get_dynamics (context);
+
+ if (dynamics)
+ name = g_strdup (gimp_object_get_name (dynamics));
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_dynamics_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpDynamics *dynamics = gimp_pdb_get_dynamics (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (dynamics)
+ gimp_context_set_dynamics (context, dynamics);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_mypaint_brush_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+
+ GimpMybrush *brush = gimp_context_get_mybrush (context);
+
+ if (brush)
+ name = g_strdup (gimp_object_get_name (brush));
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_mypaint_brush_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpMybrush *brush = gimp_pdb_get_mybrush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (brush)
+ gimp_context_set_mybrush (context, brush);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_pattern_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+
+ GimpPattern *pattern = gimp_context_get_pattern (context);
+
+ if (pattern)
+ name = g_strdup (gimp_object_get_name (pattern));
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_pattern_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPattern *pattern = gimp_pdb_get_pattern (gimp, name, error);
+
+ if (pattern)
+ gimp_context_set_pattern (context, pattern);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_gradient_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+
+ GimpGradient *gradient = gimp_context_get_gradient (context);
+
+ if (gradient)
+ name = g_strdup (gimp_object_get_name (gradient));
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_gradient_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+
+ if (gradient)
+ gimp_context_set_gradient (context, gradient);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_set_gradient_fg_bg_rgb_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_context_set_gradient (context,
+ gimp_gradients_get_fg_bg_rgb (gimp));
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+context_set_gradient_fg_bg_hsv_cw_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_context_set_gradient (context,
+ gimp_gradients_get_fg_bg_hsv_cw (gimp));
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+context_set_gradient_fg_bg_hsv_ccw_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_context_set_gradient (context,
+ gimp_gradients_get_fg_bg_hsv_ccw (gimp));
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+context_set_gradient_fg_transparent_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_context_set_gradient (context,
+ gimp_gradients_get_fg_transparent (gimp));
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+context_get_gradient_blend_color_space_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gint32 blend_color_space = 0;
+
+ /* all options should have the same value, so pick a random one */
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-paintbrush");
+
+ if (options)
+ g_object_get (options,
+ "gradient-blend-color-space", &blend_color_space,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), blend_color_space);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_gradient_blend_color_space_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 blend_color_space;
+
+ blend_color_space = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpContainer *options;
+ GList *list;
+
+ options = gimp_pdb_context_get_paint_options_list (GIMP_PDB_CONTEXT (context));
+
+ for (list = GIMP_LIST (options)->queue->head; list; list = g_list_next (list))
+ g_object_set (list->data,
+ "gradient-blend-color-space", blend_color_space,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_gradient_repeat_mode_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gint32 repeat_mode = 0;
+
+ /* all options should have the same value, so pick a random one */
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-paintbrush");
+
+ if (options)
+ g_object_get (options,
+ "gradient-repeat", &repeat_mode,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), repeat_mode);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_gradient_repeat_mode_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 repeat_mode;
+
+ repeat_mode = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpContainer *options;
+ GList *list;
+
+ options = gimp_pdb_context_get_paint_options_list (GIMP_PDB_CONTEXT (context));
+
+ for (list = GIMP_LIST (options)->queue->head; list; list = g_list_next (list))
+ g_object_set (list->data,
+ "gradient-repeat", repeat_mode,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_gradient_reverse_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gboolean reverse = FALSE;
+
+ /* all options should have the same value, so pick a random one */
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-paintbrush");
+
+ if (options)
+ g_object_get (options,
+ "gradient-reverse", &reverse,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), reverse);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_gradient_reverse_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gboolean reverse;
+
+ reverse = g_value_get_boolean (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpContainer *options;
+ GList *list;
+
+ options = gimp_pdb_context_get_paint_options_list (GIMP_PDB_CONTEXT (context));
+
+ for (list = GIMP_LIST (options)->queue->head; list; list = g_list_next (list))
+ g_object_set (list->data,
+ "gradient-reverse", reverse,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_palette_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+
+ GimpPalette *palette = gimp_context_get_palette (context);
+
+ if (palette)
+ name = g_strdup (gimp_object_get_name (palette));
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_palette_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+
+ if (palette)
+ gimp_context_set_palette (context, palette);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_font_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+
+ GimpFont *font = gimp_context_get_font (context);
+
+ if (font)
+ name = g_strdup (gimp_object_get_name (font));
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_font_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpFont *font = gimp_pdb_get_font (gimp, name, error);
+
+ if (font)
+ gimp_context_set_font (context, font);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_antialias_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gboolean antialias = FALSE;
+
+ g_object_get (context,
+ "antialias", &antialias,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), antialias);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_antialias_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gboolean antialias;
+
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ g_object_set (context,
+ "antialias", antialias,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_feather_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gboolean feather = FALSE;
+
+ g_object_get (context,
+ "feather", &feather,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), feather);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_feather_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gboolean feather;
+
+ feather = g_value_get_boolean (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ g_object_set (context,
+ "feather", feather,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_feather_radius_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gdouble feather_radius_x = 0.0;
+ gdouble feather_radius_y = 0.0;
+
+ g_object_get (context,
+ "feather-radius-x", &feather_radius_x,
+ "feather-radius-y", &feather_radius_y,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+
+ g_value_set_double (gimp_value_array_index (return_vals, 1), feather_radius_x);
+ g_value_set_double (gimp_value_array_index (return_vals, 2), feather_radius_y);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_feather_radius_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble feather_radius_x;
+ gdouble feather_radius_y;
+
+ feather_radius_x = g_value_get_double (gimp_value_array_index (args, 0));
+ feather_radius_y = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ g_object_set (context,
+ "feather-radius-x", feather_radius_x,
+ "feather-radius-y", feather_radius_y,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_sample_merged_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gboolean sample_merged = FALSE;
+
+ g_object_get (context,
+ "sample-merged", &sample_merged,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), sample_merged);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_sample_merged_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gboolean sample_merged;
+
+ sample_merged = g_value_get_boolean (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ g_object_set (context,
+ "sample-merged", sample_merged,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_sample_criterion_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 sample_criterion = 0;
+
+ g_object_get (context,
+ "sample-criterion", &sample_criterion,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), sample_criterion);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_sample_criterion_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 sample_criterion;
+
+ sample_criterion = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ g_object_set (context,
+ "sample-criterion", sample_criterion,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_sample_threshold_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gdouble sample_threshold = 0.0;
+
+ g_object_get (context,
+ "sample-threshold", &sample_threshold,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_double (gimp_value_array_index (return_vals, 1), sample_threshold);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_sample_threshold_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble sample_threshold;
+
+ sample_threshold = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ g_object_set (context,
+ "sample-threshold", sample_threshold,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_sample_threshold_int_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 sample_threshold = 0;
+
+ gdouble threshold;
+
+ g_object_get (context,
+ "sample-threshold", &threshold,
+ NULL);
+
+ sample_threshold = (gint) (threshold * 255.99);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_int (gimp_value_array_index (return_vals, 1), sample_threshold);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_sample_threshold_int_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 sample_threshold;
+
+ sample_threshold = g_value_get_int (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ g_object_set (context,
+ "sample-threshold", (gdouble) sample_threshold / 255.0,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_sample_transparent_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gboolean sample_transparent = FALSE;
+
+ g_object_get (context,
+ "sample-transparent", &sample_transparent,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), sample_transparent);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_sample_transparent_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gboolean sample_transparent;
+
+ sample_transparent = g_value_get_boolean (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ g_object_set (context,
+ "sample-transparent", sample_transparent,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_diagonal_neighbors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gboolean diagonal_neighbors = FALSE;
+
+ g_object_get (context,
+ "diagonal-neighbors", &diagonal_neighbors,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), diagonal_neighbors);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_diagonal_neighbors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gboolean diagonal_neighbors;
+
+ diagonal_neighbors = g_value_get_boolean (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ g_object_set (context,
+ "diagonal-neighbors", diagonal_neighbors,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_distance_metric_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 metric = 0;
+
+ g_object_get (context,
+ "distance-metric", &metric,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), metric);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_distance_metric_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 metric;
+
+ metric = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ g_object_set (context,
+ "distance-metric", metric,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_interpolation_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 interpolation = 0;
+
+ g_object_get (context,
+ "interpolation", &interpolation,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), interpolation);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_interpolation_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 interpolation;
+
+ interpolation = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ g_object_set (context,
+ "interpolation", interpolation,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_transform_direction_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 transform_direction = 0;
+
+ g_object_get (context,
+ "transform-direction", &transform_direction,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), transform_direction);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_transform_direction_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 transform_direction;
+
+ transform_direction = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ g_object_set (context,
+ "transform-direction", transform_direction,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_transform_resize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 transform_resize = 0;
+
+ g_object_get (context,
+ "transform-resize", &transform_resize,
+ NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), transform_resize);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_transform_resize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 transform_resize;
+
+ transform_resize = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ g_object_set (context,
+ "transform-resize", transform_resize,
+ NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_transform_recursion_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 transform_recursion = 0;
+
+ transform_recursion = 3;
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_int (gimp_value_array_index (return_vals, 1), transform_recursion);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_transform_recursion_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ if (success)
+ {
+ }
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_ink_size_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble size = 0.0;
+
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_get (options,
+ "size", &size,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), size);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_ink_size_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble size;
+
+ size = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_set (options,
+ "size", size,
+ NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_ink_angle_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble angle = 0.0;
+
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_get (options,
+ "tilt-angle", &angle,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), angle);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_ink_angle_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble angle;
+
+ angle = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_set (options,
+ "tilt-angle", angle,
+ NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_ink_size_sensitivity_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble size = 0.0;
+
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_get (options,
+ "size-sensitivity", &size,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), size);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_ink_size_sensitivity_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble size;
+
+ size = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_set (options,
+ "size-sensitivity", size,
+ NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_ink_tilt_sensitivity_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble tilt = 0.0;
+
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_get (options,
+ "tilt-sensitivity", &tilt,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), tilt);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_ink_tilt_sensitivity_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble tilt;
+
+ tilt = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_set (options,
+ "tilt-sensitivity", tilt,
+ NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_ink_speed_sensitivity_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble speed = 0.0;
+
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_get (options,
+ "vel-sensitivity", &speed,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), speed);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_ink_speed_sensitivity_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble speed;
+
+ speed = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_set (options,
+ "vel-sensitivity", speed,
+ NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_ink_blob_type_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gint32 type = 0;
+
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_get (options,
+ "blob-type", &type,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), type);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_ink_blob_type_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 type;
+
+ type = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_set (options,
+ "blob-type", type,
+ NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_ink_blob_aspect_ratio_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble aspect = 0.0;
+
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_get (options,
+ "blob-aspect", &aspect,
+ NULL);
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), aspect);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_ink_blob_aspect_ratio_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble aspect;
+
+ aspect = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_set (options,
+ "blob-aspect", aspect,
+ NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_ink_blob_angle_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble angle = 0.0;
+
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ {
+ g_object_get (options,
+ "blob-angle", &angle,
+ NULL);
+ angle *= (180-0 / G_PI);
+ }
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), angle);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+context_set_ink_blob_angle_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble angle;
+
+ angle = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-ink");
+
+ if (options)
+ g_object_set (options,
+ "blob-angle", (gdouble) angle * G_PI / 180.0,
+ NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_context_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-context-push
+ */
+ procedure = gimp_procedure_new (context_push_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-push");
+ gimp_procedure_set_static_strings (procedure,
+ "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'.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-pop
+ */
+ procedure = gimp_procedure_new (context_pop_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-pop");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-defaults
+ */
+ procedure = gimp_procedure_new (context_set_defaults_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-defaults");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Kevin Cozens <kcozens@svn.gnome.org>",
+ "Kevin Cozens",
+ "2011",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-list-paint-methods
+ */
+ procedure = gimp_procedure_new (context_list_paint_methods_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-list-paint-methods");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-list-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'.",
+ "Simon Budig",
+ "Simon Budig",
+ "2007",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-paint-methods",
+ "num paint methods",
+ "The number of the available paint methods",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("paint-methods",
+ "paint methods",
+ "The names of the available paint methods",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-paint-method
+ */
+ procedure = gimp_procedure_new (context_get_paint_method_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-paint-method");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-paint-method",
+ "Retrieve the currently active paint method.",
+ "This procedure returns the name of the currently active paint method.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the active paint method",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-paint-method
+ */
+ procedure = gimp_procedure_new (context_set_paint_method_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-paint-method");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the paint method",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-stroke-method
+ */
+ procedure = gimp_procedure_new (context_get_stroke_method_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-stroke-method");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-stroke-method",
+ "Retrieve the currently active stroke method.",
+ "This procedure returns the currently active stroke method.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("stroke-method",
+ "stroke method",
+ "The active stroke method",
+ GIMP_TYPE_STROKE_METHOD,
+ GIMP_STROKE_LINE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-stroke-method
+ */
+ procedure = gimp_procedure_new (context_set_stroke_method_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-stroke-method");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("stroke-method",
+ "stroke method",
+ "The new stroke method",
+ GIMP_TYPE_STROKE_METHOD,
+ GIMP_STROKE_LINE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-foreground
+ */
+ procedure = gimp_procedure_new (context_get_foreground_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-foreground");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-foreground",
+ "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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_rgb ("foreground",
+ "foreground",
+ "The foreground color",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-foreground
+ */
+ procedure = gimp_procedure_new (context_set_foreground_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-foreground");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-foreground",
+ "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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("foreground",
+ "foreground",
+ "The foreground color",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-background
+ */
+ procedure = gimp_procedure_new (context_get_background_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-background");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-background",
+ "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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_rgb ("background",
+ "background",
+ "The background color",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-background
+ */
+ procedure = gimp_procedure_new (context_set_background_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-background");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-background",
+ "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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("background",
+ "background",
+ "The background color",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-default-colors
+ */
+ procedure = gimp_procedure_new (context_set_default_colors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-default-colors");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-swap-colors
+ */
+ procedure = gimp_procedure_new (context_swap_colors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-swap-colors");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-opacity
+ */
+ procedure = gimp_procedure_new (context_get_opacity_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-opacity");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The opacity",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-opacity
+ */
+ procedure = gimp_procedure_new (context_set_opacity_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-opacity");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-opacity",
+ "Set the opacity.",
+ "This procedure modifies the opacity setting. The value should be a floating point number between 0 and 100.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The opacity",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-paint-mode
+ */
+ procedure = gimp_procedure_new (context_get_paint_mode_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-paint-mode");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("paint-mode",
+ "paint mode",
+ "The paint mode",
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-paint-mode
+ */
+ procedure = gimp_procedure_new (context_set_paint_mode_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-paint-mode");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-paint-mode",
+ "Set the paint mode.",
+ "This procedure modifies the paint_mode setting.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("paint-mode",
+ "paint mode",
+ "The paint mode",
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-line-width
+ */
+ procedure = gimp_procedure_new (context_get_line_width_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-line-width");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-line-width",
+ "Get the line width setting.",
+ "This procedure returns the line width setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("line-width",
+ "line width",
+ "The line width setting",
+ 0.0, 2000.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-line-width
+ */
+ procedure = gimp_procedure_new (context_set_line_width_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-line-width");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-line-width",
+ "Set the line width setting.",
+ "This procedure modifies the line width setting for stroking lines.\n"
+ "\n"
+ "This setting affects the following procedures: 'gimp-drawable-edit-stroke-selection', 'gimp-drawable-edit-stroke-item'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("line-width",
+ "line width",
+ "The line width setting",
+ 0.0, 2000.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-line-width-unit
+ */
+ procedure = gimp_procedure_new (context_get_line_width_unit_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-line-width-unit");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-line-width-unit",
+ "Get the line width unit setting.",
+ "This procedure returns the line width unit setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_unit ("line-width-unit",
+ "line width unit",
+ "The line width unit setting",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-line-width-unit
+ */
+ procedure = gimp_procedure_new (context_set_line_width_unit_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-line-width-unit");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-line-width-unit",
+ "Set the line width unit setting.",
+ "This procedure modifies the line width unit setting for stroking lines.\n"
+ "\n"
+ "This setting affects the following procedures: 'gimp-drawable-edit-stroke-selection', 'gimp-drawable-edit-stroke-item'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("line-width-unit",
+ "line width unit",
+ "The line width setting unit",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-line-cap-style
+ */
+ procedure = gimp_procedure_new (context_get_line_cap_style_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-line-cap-style");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-line-cap-style",
+ "Get the line cap style setting.",
+ "This procedure returns the line cap style setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("cap-style",
+ "cap style",
+ "The line cap style setting",
+ GIMP_TYPE_CAP_STYLE,
+ GIMP_CAP_BUTT,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-line-cap-style
+ */
+ procedure = gimp_procedure_new (context_set_line_cap_style_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-line-cap-style");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-line-cap-style",
+ "Set the line cap style setting.",
+ "This procedure modifies the line cap style setting for stroking lines.\n"
+ "\n"
+ "This setting affects the following procedures: 'gimp-drawable-edit-stroke-selection', 'gimp-drawable-edit-stroke-item'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("cap-style",
+ "cap style",
+ "The line cap style setting",
+ GIMP_TYPE_CAP_STYLE,
+ GIMP_CAP_BUTT,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-line-join-style
+ */
+ procedure = gimp_procedure_new (context_get_line_join_style_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-line-join-style");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-line-join-style",
+ "Get the line join style setting.",
+ "This procedure returns the line join style setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("join-style",
+ "join style",
+ "The line join style setting",
+ GIMP_TYPE_JOIN_STYLE,
+ GIMP_JOIN_MITER,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-line-join-style
+ */
+ procedure = gimp_procedure_new (context_set_line_join_style_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-line-join-style");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-line-join-style",
+ "Set the line join style setting.",
+ "This procedure modifies the line join style setting for stroking lines.\n"
+ "\n"
+ "This setting affects the following procedures: 'gimp-drawable-edit-stroke-selection', 'gimp-drawable-edit-stroke-item'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("join-style",
+ "join style",
+ "The line join style setting",
+ GIMP_TYPE_JOIN_STYLE,
+ GIMP_JOIN_MITER,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-line-miter-limit
+ */
+ procedure = gimp_procedure_new (context_get_line_miter_limit_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-line-miter-limit");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-line-miter-limit",
+ "Get the line miter limit setting.",
+ "This procedure returns the line miter limit setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("miter-limit",
+ "miter limit",
+ "The line miter limit setting",
+ 0.0, 100.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-line-miter-limit
+ */
+ procedure = gimp_procedure_new (context_set_line_miter_limit_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-line-miter-limit");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-line-miter-limit",
+ "Set the line miter limit setting.",
+ "This procedure modifies the line miter limit setting for stroking lines.\n"
+ "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.\n"
+ "\n"
+ "This setting affects the following procedures: 'gimp-drawable-edit-stroke-selection', 'gimp-drawable-edit-stroke-item'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("miter-limit",
+ "miter limit",
+ "The line miter limit setting",
+ 0.0, 100.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-line-dash-offset
+ */
+ procedure = gimp_procedure_new (context_get_line_dash_offset_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-line-dash-offset");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-line-dash-offset",
+ "Get the line dash offset setting.",
+ "This procedure returns the line dash offset setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("dash-offset",
+ "dash offset",
+ "The line dash offset setting",
+ 0.0, 2000.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-line-dash-offset
+ */
+ procedure = gimp_procedure_new (context_set_line_dash_offset_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-line-dash-offset");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-line-dash-offset",
+ "Set the line dash offset setting.",
+ "This procedure modifies the line dash offset setting for stroking lines.\n"
+ "\n"
+ "This setting affects the following procedures: 'gimp-drawable-edit-stroke-selection', 'gimp-drawable-edit-stroke-item'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("dash-offset",
+ "dash offset",
+ "The line dash offset setting",
+ 0.0, 100.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-line-dash-pattern
+ */
+ procedure = gimp_procedure_new (context_get_line_dash_pattern_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-line-dash-pattern");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-line-dash-pattern",
+ "Get the line dash pattern setting.",
+ "This procedure returns the line dash pattern setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-dashes",
+ "num dashes",
+ "The number of dashes in the dash_pattern array",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_float_array ("dashes",
+ "dashes",
+ "The line dash pattern setting",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-line-dash-pattern
+ */
+ procedure = gimp_procedure_new (context_set_line_dash_pattern_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-line-dash-pattern");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-line-dash-pattern",
+ "Set the line dash pattern setting.",
+ "This procedure modifies the line dash pattern setting for stroking lines.\n"
+ "\n"
+ "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).\n"
+ "\n"
+ "This setting affects the following procedures: 'gimp-drawable-edit-stroke-selection-', 'gimp-drawable-edit-stroke-item'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-dashes",
+ "num dashes",
+ "The number of dashes in the dash_pattern array",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("dashes",
+ "dashes",
+ "The line dash pattern setting",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-brush
+ */
+ procedure = gimp_procedure_new (context_get_brush_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-brush");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the active brush",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-brush
+ */
+ procedure = gimp_procedure_new (context_set_brush_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-brush");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the brush",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-brush-size
+ */
+ procedure = gimp_procedure_new (context_get_brush_size_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-brush-size");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-brush-size",
+ "Get brush size in pixels.",
+ "Get the brush size in pixels for brush based paint tools.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("size",
+ "size",
+ "Brush size in pixels",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-brush-size
+ */
+ procedure = gimp_procedure_new (context_set_brush_size_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-brush-size");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-brush-size",
+ "Set brush size in pixels.",
+ "Set the brush size in pixels for brush based paint tools.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("size",
+ "size",
+ "Brush size in pixels",
+ 1, 10000, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-brush-default-size
+ */
+ procedure = gimp_procedure_new (context_set_brush_default_size_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-brush-default-size");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-brush-aspect-ratio
+ */
+ procedure = gimp_procedure_new (context_get_brush_aspect_ratio_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-brush-aspect-ratio");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-brush-aspect-ratio",
+ "Get brush aspect ratio.",
+ "Set the aspect ratio for brush based paint tools.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("aspect",
+ "aspect",
+ "Aspect ratio",
+ -20, 20, -20,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-brush-aspect-ratio
+ */
+ procedure = gimp_procedure_new (context_set_brush_aspect_ratio_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-brush-aspect-ratio");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-brush-aspect-ratio",
+ "Set brush aspect ratio.",
+ "Set the aspect ratio for brush based paint tools.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("aspect",
+ "aspect",
+ "Aspect ratio",
+ -20, 20, -20,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-brush-angle
+ */
+ procedure = gimp_procedure_new (context_get_brush_angle_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-brush-angle");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-brush-angle",
+ "Get brush angle in degrees.",
+ "Set the angle in degrees for brush based paint tools.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "Angle in degrees",
+ -180, 180, -180,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-brush-angle
+ */
+ procedure = gimp_procedure_new (context_set_brush_angle_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-brush-angle");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-brush-angle",
+ "Set brush angle in degrees.",
+ "Set the angle in degrees for brush based paint tools.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "Angle in degrees",
+ -180, 180, -180,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-brush-spacing
+ */
+ procedure = gimp_procedure_new (context_get_brush_spacing_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-brush-spacing");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Alexia Death",
+ "Alexia Death",
+ "2014",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("spacing",
+ "spacing",
+ "Brush spacing as fraction of size",
+ 0.01, 50.0, 0.01,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-brush-spacing
+ */
+ procedure = gimp_procedure_new (context_set_brush_spacing_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-brush-spacing");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-brush-spacing",
+ "Set brush spacing as percent of size.",
+ "Set the brush spacing as percent of size for brush based paint tools.",
+ "Alexia Death",
+ "Alexia Death",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("spacing",
+ "spacing",
+ "Brush spacing as fraction of size",
+ 0.01, 50.0, 0.01,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-brush-default-spacing
+ */
+ procedure = gimp_procedure_new (context_set_brush_default_spacing_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-brush-default-spacing");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Alexia Death",
+ "Alexia Death",
+ "2014",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-brush-hardness
+ */
+ procedure = gimp_procedure_new (context_get_brush_hardness_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-brush-hardness");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-brush-hardness",
+ "Get brush hardness in paint options.",
+ "Get the brush hardness for brush based paint tools.",
+ "Alexia Death",
+ "Alexia Death",
+ "2014",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("hardness",
+ "hardness",
+ "Brush hardness",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-brush-hardness
+ */
+ procedure = gimp_procedure_new (context_set_brush_hardness_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-brush-hardness");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-brush-hardness",
+ "Set brush hardness.",
+ "Set the brush hardness for brush based paint tools.",
+ "Alexia Death",
+ "Alexia Death",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("hardness",
+ "hardness",
+ "Brush hardness",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-brush-default-hardness
+ */
+ procedure = gimp_procedure_new (context_set_brush_default_hardness_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-brush-default-hardness");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Alexia Death",
+ "Alexia Death",
+ "2014",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-brush-force
+ */
+ procedure = gimp_procedure_new (context_get_brush_force_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-brush-force");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-brush-force",
+ "Get brush force in paint options.",
+ "Get the brush application force for brush based paint tools.",
+ "Alexia Death",
+ "Alexia Death",
+ "2014",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("force",
+ "force",
+ "Brush application force",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-brush-force
+ */
+ procedure = gimp_procedure_new (context_set_brush_force_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-brush-force");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-brush-force",
+ "Set brush application force.",
+ "Set the brush application force for brush based paint tools.",
+ "Alexia Death",
+ "Alexia Death",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("force",
+ "force",
+ "Brush application force",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-dynamics
+ */
+ procedure = gimp_procedure_new (context_get_dynamics_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-dynamics");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the active paint dynamics",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-dynamics
+ */
+ procedure = gimp_procedure_new (context_set_dynamics_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-dynamics");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the paint dynamics",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-mypaint-brush
+ */
+ procedure = gimp_procedure_new (context_get_mypaint_brush_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-mypaint-brush");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-mypaint-brush",
+ "Retrieve the currently active MyPaint brush.",
+ "This procedure returns the name of the currently active MyPaint brush.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2016",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the active MyPaint brush",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-mypaint-brush
+ */
+ procedure = gimp_procedure_new (context_set_mypaint_brush_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-mypaint-brush");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2016",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the MyPaint brush",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-pattern
+ */
+ procedure = gimp_procedure_new (context_get_pattern_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-pattern");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the active pattern",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-pattern
+ */
+ procedure = gimp_procedure_new (context_set_pattern_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-pattern");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the pattern",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-gradient
+ */
+ procedure = gimp_procedure_new (context_get_gradient_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-gradient");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-gradient",
+ "Retrieve the currently active gradient.",
+ "This procedure returns the name of the currently active gradient.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the active gradient",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-gradient
+ */
+ procedure = gimp_procedure_new (context_set_gradient_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-gradient");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the gradient",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-gradient-fg-bg-rgb
+ */
+ procedure = gimp_procedure_new (context_set_gradient_fg_bg_rgb_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-gradient-fg-bg-rgb");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-gradient-fg-bg-hsv-cw
+ */
+ procedure = gimp_procedure_new (context_set_gradient_fg_bg_hsv_cw_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-gradient-fg-bg-hsv-cw");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-gradient-fg-bg-hsv-ccw
+ */
+ procedure = gimp_procedure_new (context_set_gradient_fg_bg_hsv_ccw_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-gradient-fg-bg-hsv-ccw");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-gradient-fg-transparent
+ */
+ procedure = gimp_procedure_new (context_set_gradient_fg_transparent_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-gradient-fg-transparent");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-gradient-blend-color-space
+ */
+ procedure = gimp_procedure_new (context_get_gradient_blend_color_space_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-gradient-blend-color-space");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("blend-color-space",
+ "blend color space",
+ "Color blend space",
+ GIMP_TYPE_GRADIENT_BLEND_COLOR_SPACE,
+ GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-gradient-blend-color-space
+ */
+ procedure = gimp_procedure_new (context_set_gradient_blend_color_space_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-gradient-blend-color-space");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-gradient-blend-color-space",
+ "Set the gradient blend color space.",
+ "Set the gradient blend color space for paint tools and the gradient tool.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("blend-color-space",
+ "blend color space",
+ "Blend color space",
+ GIMP_TYPE_GRADIENT_BLEND_COLOR_SPACE,
+ GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-gradient-repeat-mode
+ */
+ procedure = gimp_procedure_new (context_get_gradient_repeat_mode_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-gradient-repeat-mode");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-gradient-repeat-mode",
+ "Get the gradient repeat mode.",
+ "Get the gradient repeat mode for paint tools and the gradient tool.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("repeat-mode",
+ "repeat mode",
+ "Repeat mode",
+ GIMP_TYPE_REPEAT_MODE,
+ GIMP_REPEAT_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-gradient-repeat-mode
+ */
+ procedure = gimp_procedure_new (context_set_gradient_repeat_mode_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-gradient-repeat-mode");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-gradient-repeat-mode",
+ "Set the gradient repeat mode.",
+ "Set the gradient repeat mode for paint tools and the gradient tool.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("repeat-mode",
+ "repeat mode",
+ "Repeat mode",
+ GIMP_TYPE_REPEAT_MODE,
+ GIMP_REPEAT_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-gradient-reverse
+ */
+ procedure = gimp_procedure_new (context_get_gradient_reverse_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-gradient-reverse");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-gradient-reverse",
+ "Get the gradient reverse setting.",
+ "Get the gradient reverse setting for paint tools and the gradient tool.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("reverse",
+ "reverse",
+ "Reverse",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-gradient-reverse
+ */
+ procedure = gimp_procedure_new (context_set_gradient_reverse_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-gradient-reverse");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-gradient-reverse",
+ "Set the gradient reverse setting.",
+ "Set the gradient reverse setting for paint tools and the gradient tool.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("reverse",
+ "reverse",
+ "Reverse",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-palette
+ */
+ procedure = gimp_procedure_new (context_get_palette_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-palette");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-palette",
+ "Retrieve the currently active palette.",
+ "This procedure returns the name of the the currently active palette.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the active palette",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-palette
+ */
+ procedure = gimp_procedure_new (context_set_palette_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-palette");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the palette",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-font
+ */
+ procedure = gimp_procedure_new (context_get_font_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-font");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-font",
+ "Retrieve the currently active font.",
+ "This procedure returns the name of the currently active font.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the active font",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-font
+ */
+ procedure = gimp_procedure_new (context_set_font_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-font");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-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.",
+ "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
+ "Michael Natterer & Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the font",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-antialias
+ */
+ procedure = gimp_procedure_new (context_get_antialias_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-antialias");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-antialias",
+ "Get the antialias setting.",
+ "This procedure returns the antialias setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "The antialias setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-antialias
+ */
+ procedure = gimp_procedure_new (context_set_antialias_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-antialias");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-antialias",
+ "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.\n"
+ "\n"
+ "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'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "The antialias setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-feather
+ */
+ procedure = gimp_procedure_new (context_get_feather_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-feather");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-feather",
+ "Get the feather setting.",
+ "This procedure returns the feather setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("feather",
+ "feather",
+ "The feather setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-feather
+ */
+ procedure = gimp_procedure_new (context_set_feather_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-feather");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-feather",
+ "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'.\n"
+ "\n"
+ "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'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("feather",
+ "feather",
+ "The feather setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-feather-radius
+ */
+ procedure = gimp_procedure_new (context_get_feather_radius_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-feather-radius");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-feather-radius",
+ "Get the feather radius setting.",
+ "This procedure returns the feather radius setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("feather-radius-x",
+ "feather radius x",
+ "The horizontal feather radius",
+ 0, 1000, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("feather-radius-y",
+ "feather radius y",
+ "The vertical feather radius",
+ 0, 1000, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-feather-radius
+ */
+ procedure = gimp_procedure_new (context_set_feather_radius_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-feather-radius");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-feather-radius",
+ "Set the feather radius setting.",
+ "This procedure modifies the feather radius setting.\n"
+ "\n"
+ "This setting affects all procedures that are affected by 'gimp-context-set-feather'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius-x",
+ "feather radius x",
+ "The horizontal feather radius",
+ 0, 1000, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius-y",
+ "feather radius y",
+ "The vertical feather radius",
+ 0, 1000, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-sample-merged
+ */
+ procedure = gimp_procedure_new (context_get_sample_merged_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-sample-merged");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-sample-merged",
+ "Get the sample merged setting.",
+ "This procedure returns the sample merged setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("sample-merged",
+ "sample merged",
+ "The sample merged setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-sample-merged
+ */
+ procedure = gimp_procedure_new (context_set_sample_merged_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-sample-merged");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-sample-merged",
+ "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).\n"
+ "\n"
+ "This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-contiguous-color', 'gimp-drawable-edit-bucket-fill'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("sample-merged",
+ "sample merged",
+ "The sample merged setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-sample-criterion
+ */
+ procedure = gimp_procedure_new (context_get_sample_criterion_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-sample-criterion");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-sample-criterion",
+ "Get the sample criterion setting.",
+ "This procedure returns the sample criterion setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("sample-criterion",
+ "sample criterion",
+ "The sample criterion setting",
+ GIMP_TYPE_SELECT_CRITERION,
+ GIMP_SELECT_CRITERION_COMPOSITE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-sample-criterion
+ */
+ procedure = gimp_procedure_new (context_set_sample_criterion_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-sample-criterion");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-sample-criterion",
+ "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.\n"
+ "\n"
+ "This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-contiguous-color', 'gimp-drawable-edit-bucket-fill'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("sample-criterion",
+ "sample criterion",
+ "The sample criterion setting",
+ GIMP_TYPE_SELECT_CRITERION,
+ GIMP_SELECT_CRITERION_COMPOSITE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-sample-threshold
+ */
+ procedure = gimp_procedure_new (context_get_sample_threshold_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-sample-threshold");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-sample-threshold",
+ "Get the sample threshold setting.",
+ "This procedure returns the sample threshold setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("sample-threshold",
+ "sample threshold",
+ "The sample threshold setting",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-sample-threshold
+ */
+ procedure = gimp_procedure_new (context_set_sample_threshold_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-sample-threshold");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-sample-threshold",
+ "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.\n"
+ "\n"
+ "This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-contiguous-color', 'gimp-drawable-edit-bucket-fill'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("sample-threshold",
+ "sample threshold",
+ "The sample threshold setting",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-sample-threshold-int
+ */
+ procedure = gimp_procedure_new (context_get_sample_threshold_int_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-sample-threshold-int");
+ gimp_procedure_set_static_strings (procedure,
+ "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'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("sample-threshold",
+ "sample threshold",
+ "The sample threshold setting",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-sample-threshold-int
+ */
+ procedure = gimp_procedure_new (context_set_sample_threshold_int_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-sample-threshold-int");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-sample-threshold-int",
+ "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'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("sample-threshold",
+ "sample threshold",
+ "The sample threshold setting",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-sample-transparent
+ */
+ procedure = gimp_procedure_new (context_get_sample_transparent_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-sample-transparent");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-sample-transparent",
+ "Get the sample transparent setting.",
+ "This procedure returns the sample transparent setting.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("sample-transparent",
+ "sample transparent",
+ "The sample transparent setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-sample-transparent
+ */
+ procedure = gimp_procedure_new (context_set_sample_transparent_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-sample-transparent");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-sample-transparent",
+ "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.\n"
+ "\n"
+ "This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-contiguous-color', 'gimp-drawable-edit-bucket-fill'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("sample-transparent",
+ "sample transparent",
+ "The sample transparent setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-diagonal-neighbors
+ */
+ procedure = gimp_procedure_new (context_get_diagonal_neighbors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-diagonal-neighbors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-diagonal-neighbors",
+ "Get the diagonal neighbors setting.",
+ "This procedure returns the diagonal neighbors setting.",
+ "Ell",
+ "Ell",
+ "2016",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("diagonal-neighbors",
+ "diagonal neighbors",
+ "The diagonal neighbors setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-diagonal-neighbors
+ */
+ procedure = gimp_procedure_new (context_set_diagonal_neighbors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-diagonal-neighbors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-diagonal-neighbors",
+ "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.\n"
+ "\n"
+ "This setting affects the following procedures: 'gimp-image-select-contiguous-color', 'gimp-drawable-edit-bucket-fill'.",
+ "Ell",
+ "Ell",
+ "2016",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("diagonal-neighbors",
+ "diagonal neighbors",
+ "The diagonal neighbors setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-distance-metric
+ */
+ procedure = gimp_procedure_new (context_get_distance_metric_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-distance-metric");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Jehan",
+ "Jehan",
+ "2018",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("metric",
+ "metric",
+ "The distance metric",
+ GEGL_TYPE_DISTANCE_METRIC,
+ GEGL_DISTANCE_METRIC_EUCLIDEAN,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-distance-metric
+ */
+ procedure = gimp_procedure_new (context_set_distance_metric_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-distance-metric");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-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.\n"
+ "\n"
+ "This setting affects the following procedures: 'gimp-drawable-edit-gradient-fill'.",
+ "Jehan",
+ "Jehan",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("metric",
+ "metric",
+ "The distance metric",
+ GEGL_TYPE_DISTANCE_METRIC,
+ GEGL_DISTANCE_METRIC_EUCLIDEAN,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-interpolation
+ */
+ procedure = gimp_procedure_new (context_get_interpolation_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-interpolation");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "The interpolation type",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-interpolation
+ */
+ procedure = gimp_procedure_new (context_set_interpolation_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-interpolation");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-interpolation",
+ "Set the interpolation type.",
+ "This procedure modifies the interpolation setting.\n"
+ "\n"
+ "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'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "The interpolation type",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-transform-direction
+ */
+ procedure = gimp_procedure_new (context_get_transform_direction_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-transform-direction");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("transform-direction",
+ "transform direction",
+ "The transform direction",
+ GIMP_TYPE_TRANSFORM_DIRECTION,
+ GIMP_TRANSFORM_FORWARD,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-transform-direction
+ */
+ procedure = gimp_procedure_new (context_set_transform_direction_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-transform-direction");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-transform-direction",
+ "Set the transform direction.",
+ "This procedure modifies the transform direction setting.\n"
+ "\n"
+ "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'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("transform-direction",
+ "transform direction",
+ "The transform direction",
+ GIMP_TYPE_TRANSFORM_DIRECTION,
+ GIMP_TRANSFORM_FORWARD,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-transform-resize
+ */
+ procedure = gimp_procedure_new (context_get_transform_resize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-transform-resize");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("transform-resize",
+ "transform resize",
+ "The transform resize type",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-transform-resize
+ */
+ procedure = gimp_procedure_new (context_set_transform_resize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-transform-resize");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-transform-resize",
+ "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.\n"
+ "\n"
+ "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'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("transform-resize",
+ "transform resize",
+ "The transform resize type",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-transform-recursion
+ */
+ procedure = gimp_procedure_new (context_get_transform_recursion_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-transform-recursion");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-transform-recursion",
+ "Deprecated: There is no replacement for this procedure.",
+ "Deprecated: There is no replacement for this procedure.",
+ "",
+ "",
+ "",
+ "NONE");
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("transform-recursion",
+ "transform recursion",
+ "This returns always 3 and is meaningless",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-transform-recursion
+ */
+ procedure = gimp_procedure_new (context_set_transform_recursion_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-transform-recursion");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-transform-recursion",
+ "Deprecated: There is no replacement for this procedure.",
+ "Deprecated: There is no replacement for this procedure.",
+ "",
+ "",
+ "",
+ "NONE");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("transform-recursion",
+ "transform recursion",
+ "This parameter is ignored",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-ink-size
+ */
+ procedure = gimp_procedure_new (context_get_ink_size_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-ink-size");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-ink-size",
+ "Get ink blob size in pixels.",
+ "Get the ink blob size in pixels for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("size",
+ "size",
+ "ink blob size in pixels",
+ 0, 200, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-ink-size
+ */
+ procedure = gimp_procedure_new (context_set_ink_size_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-ink-size");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-ink-size",
+ "Set ink blob size in pixels.",
+ "Set the ink blob size in pixels for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("size",
+ "size",
+ "ink blob size in pixels",
+ 0, 200, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-ink-angle
+ */
+ procedure = gimp_procedure_new (context_get_ink_angle_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-ink-angle");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-ink-angle",
+ "Get ink angle in degrees.",
+ "Get the ink angle in degrees for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "ink angle in degrees",
+ -90, 90, -90,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-ink-angle
+ */
+ procedure = gimp_procedure_new (context_set_ink_angle_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-ink-angle");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-ink-angle",
+ "Set ink angle in degrees.",
+ "Set the ink angle in degrees for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "ink angle in degrees",
+ -90, 90, -90,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-ink-size-sensitivity
+ */
+ procedure = gimp_procedure_new (context_get_ink_size_sensitivity_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-ink-size-sensitivity");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-ink-size-sensitivity",
+ "Get ink size sensitivity.",
+ "Get the ink size sensitivity for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("size",
+ "size",
+ "ink size sensitivity",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-ink-size-sensitivity
+ */
+ procedure = gimp_procedure_new (context_set_ink_size_sensitivity_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-ink-size-sensitivity");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-ink-size-sensitivity",
+ "Set ink size sensitivity.",
+ "Set the ink size sensitivity for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("size",
+ "size",
+ "ink size sensitivity",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-ink-tilt-sensitivity
+ */
+ procedure = gimp_procedure_new (context_get_ink_tilt_sensitivity_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-ink-tilt-sensitivity");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-ink-tilt-sensitivity",
+ "Get ink tilt sensitivity.",
+ "Get the ink tilt sensitivity for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("tilt",
+ "tilt",
+ "ink tilt sensitivity",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-ink-tilt-sensitivity
+ */
+ procedure = gimp_procedure_new (context_set_ink_tilt_sensitivity_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-ink-tilt-sensitivity");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-ink-tilt-sensitivity",
+ "Set ink tilt sensitivity.",
+ "Set the ink tilt sensitivity for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("tilt",
+ "tilt",
+ "ink tilt sensitivity",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-ink-speed-sensitivity
+ */
+ procedure = gimp_procedure_new (context_get_ink_speed_sensitivity_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-ink-speed-sensitivity");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-ink-speed-sensitivity",
+ "Get ink speed sensitivity.",
+ "Get the ink speed sensitivity for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("speed",
+ "speed",
+ "ink speed sensitivity",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-ink-speed-sensitivity
+ */
+ procedure = gimp_procedure_new (context_set_ink_speed_sensitivity_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-ink-speed-sensitivity");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-ink-speed-sensitivity",
+ "Set ink speed sensitivity.",
+ "Set the ink speed sensitivity for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("speed",
+ "speed",
+ "ink speed sensitivity",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-ink-blob-type
+ */
+ procedure = gimp_procedure_new (context_get_ink_blob_type_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-ink-blob-type");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-ink-blob-type",
+ "Get ink blob type.",
+ "Get the ink blob type for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("type",
+ "type",
+ "Ink blob type",
+ GIMP_TYPE_INK_BLOB_TYPE,
+ GIMP_INK_BLOB_TYPE_CIRCLE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-ink-blob-type
+ */
+ procedure = gimp_procedure_new (context_set_ink_blob_type_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-ink-blob-type");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-ink-blob-type",
+ "Set ink blob type.",
+ "Set the ink blob type for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("type",
+ "type",
+ "Ink blob type",
+ GIMP_TYPE_INK_BLOB_TYPE,
+ GIMP_INK_BLOB_TYPE_CIRCLE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-ink-blob-aspect-ratio
+ */
+ procedure = gimp_procedure_new (context_get_ink_blob_aspect_ratio_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-ink-blob-aspect-ratio");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-ink-blob-aspect-ratio",
+ "Get ink blob aspect ratio.",
+ "Get the ink blob aspect ratio for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("aspect",
+ "aspect",
+ "ink blob aspect ratio",
+ 1, 10, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-ink-blob-aspect-ratio
+ */
+ procedure = gimp_procedure_new (context_set_ink_blob_aspect_ratio_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-ink-blob-aspect-ratio");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-ink-blob-aspect-ratio",
+ "Set ink blob aspect ratio.",
+ "Set the ink blob aspect ratio for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("aspect",
+ "aspect",
+ "ink blob aspect ratio",
+ 1, 10, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-get-ink-blob-angle
+ */
+ procedure = gimp_procedure_new (context_get_ink_blob_angle_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-get-ink-blob-angle");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-get-ink-blob-angle",
+ "Get ink blob angle in degrees.",
+ "Get the ink blob angle in degrees for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "ink blob angle in degrees",
+ -180, 180, -180,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-context-set-ink-blob-angle
+ */
+ procedure = gimp_procedure_new (context_set_ink_blob_angle_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-context-set-ink-blob-angle");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-context-set-ink-blob-angle",
+ "Set ink blob angle in degrees.",
+ "Set the ink blob angle in degrees for ink tool.",
+ "Ed Swartz",
+ "Ed Swartz",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "ink blob angle in degrees",
+ -180, 180, -180,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/debug-cmds.c b/app/pdb/debug-cmds.c
new file mode 100644
index 0000000..bf72795
--- /dev/null
+++ b/app/pdb/debug-cmds.c
@@ -0,0 +1,140 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GTimer *gimp_debug_timer = NULL;
+static gint gimp_debug_timer_counter = 0;
+
+static GimpValueArray *
+debug_timer_start_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ if (gimp_debug_timer_counter++ == 0)
+ gimp_debug_timer = g_timer_new ();
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+debug_timer_end_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gdouble elapsed = 0.0;
+
+ elapsed = 0.0;
+
+ if (gimp_debug_timer_counter == 0)
+ success = FALSE;
+ else if (--gimp_debug_timer_counter == 0)
+ {
+ elapsed = g_timer_elapsed (gimp_debug_timer, NULL);
+
+ g_printerr ("GIMP debug timer: %g seconds\n", elapsed);
+
+ g_timer_destroy (gimp_debug_timer);
+
+ gimp_debug_timer = NULL;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), elapsed);
+
+ return return_vals;
+}
+
+void
+register_debug_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-debug-timer-start
+ */
+ procedure = gimp_procedure_new (debug_timer_start_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-debug-timer-start");
+ gimp_procedure_set_static_strings (procedure,
+ "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.\n"
+ "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.\n"
+ "\n"
+ "This is a debug utility procedure. It is subject to change at any point, and should not be used in production.",
+ "Ell",
+ "Ell",
+ "2017",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-debug-timer-end
+ */
+ procedure = gimp_procedure_new (debug_timer_end_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-debug-timer-end");
+ gimp_procedure_set_static_strings (procedure,
+ "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.\n"
+ "If there was already an active timer at the time of corresponding call to 'gimp-debug-timer-start', a dummy value is returned.\n"
+ "\n"
+ "This is a debug utility procedure. It is subject to change at any point, and should not be used in production.",
+ "Ell",
+ "Ell",
+ "2017",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("elapsed",
+ "elapsed",
+ "The elapsed time, in seconds",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/display-cmds.c b/app/pdb/display-cmds.c
new file mode 100644
index 0000000..57ab41c
--- /dev/null
+++ b/app/pdb/display-cmds.c
@@ -0,0 +1,363 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontainer.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+display_is_valid_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ GimpObject *display;
+ gboolean valid = FALSE;
+
+ display = gimp_value_get_display (gimp_value_array_index (args, 0), gimp);
+
+ valid = (display != NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), valid);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+display_new_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpObject *display = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_image_flush (image);
+
+ display = gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0, NULL, 0);
+
+ if (display)
+ {
+ /* the first display takes ownership of the image */
+ if (gimp_image_get_display_count (image) == 1)
+ g_object_unref (image);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_display (gimp_value_array_index (return_vals, 1), display);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+display_delete_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpObject *display;
+
+ display = gimp_value_get_display (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_delete_display (gimp, display);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+display_get_window_handle_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpObject *display;
+ gint32 window = 0;
+
+ display = gimp_value_get_display (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ window = (gint32) gimp_get_display_window_id (gimp, display);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), window);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+displays_flush_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_container_foreach (gimp->images, (GFunc) gimp_image_flush, NULL);
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+displays_reconnect_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *old_image;
+ GimpImage *new_image;
+
+ old_image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ new_image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ success = (old_image != new_image &&
+ gimp_image_get_display_count (old_image) > 0 &&
+ gimp_image_get_display_count (new_image) == 0);
+
+ if (success)
+ {
+ gimp_reconnect_displays (gimp, old_image, new_image);
+
+ /* take ownership of the image */
+ if (gimp_image_get_display_count (new_image) > 0)
+ g_object_unref (new_image);
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_display_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-display-is-valid
+ */
+ procedure = gimp_procedure_new (display_is_valid_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-display-is-valid");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-display-is-valid",
+ "Returns TRUE if the display is valid.",
+ "This procedure checks if the given display ID is valid and refers to an existing display.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2007",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_display_id ("display",
+ "display",
+ "The display to check",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("valid",
+ "valid",
+ "Whether the display ID is valid",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-display-new
+ */
+ procedure = gimp_procedure_new (display_new_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-display-new");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-display-new",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_display_id ("display",
+ "display",
+ "The new display",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-display-delete
+ */
+ procedure = gimp_procedure_new (display_delete_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-display-delete");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-display-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_display_id ("display",
+ "display",
+ "The display to delete",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-display-get-window-handle
+ */
+ procedure = gimp_procedure_new (display_get_window_handle_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-display-get-window-handle");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-display-get-window-handle",
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_display_id ("display",
+ "display",
+ "The display to get the window handle from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("window",
+ "window",
+ "The native window handle or 0",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-displays-flush
+ */
+ procedure = gimp_procedure_new (displays_flush_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-displays-flush");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-displays-reconnect
+ */
+ procedure = gimp_procedure_new (displays_reconnect_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-displays-reconnect");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-displays-reconnect",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("old-image",
+ "old image",
+ "The old image (must have at least one display)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("new-image",
+ "new image",
+ "The new image (must not have a display)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/drawable-cmds.c b/app/pdb/drawable-cmds.c
new file mode 100644
index 0000000..9a25f3d
--- /dev/null
+++ b/app/pdb/drawable-cmds.c
@@ -0,0 +1,1976 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "config/gimpcoreconfig.h"
+#include "core/gimp.h"
+#include "core/gimpchannel-select.h"
+#include "core/gimpdrawable-fill.h"
+#include "core/gimpdrawable-foreground-extract.h"
+#include "core/gimpdrawable-offset.h"
+#include "core/gimpdrawable-preview.h"
+#include "core/gimpdrawable-shadow.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimptempbuf.h"
+#include "gegl/gimp-babl-compat.h"
+#include "gegl/gimp-babl.h"
+#include "plug-in/gimpplugin-cleanup.h"
+#include "plug-in/gimpplugin.h"
+#include "plug-in/gimppluginmanager.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+drawable_get_format_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gchar *format = NULL;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp->plug_in_manager->current_plug_in)
+ gimp_plug_in_enable_precision (gimp->plug_in_manager->current_plug_in);
+
+ format = g_strdup (babl_get_name (gimp_drawable_get_format (drawable)));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), format);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_get_thumbnail_format_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gchar *format = NULL;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ format = g_strdup (babl_format_get_encoding (gimp_drawable_get_preview_format (drawable)));
+
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), format);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_type_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 type = 0;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ type = gimp_babl_format_get_image_type (gimp_drawable_get_format (drawable));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), type);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_type_with_alpha_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 type_with_alpha = 0;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ const Babl *format = gimp_drawable_get_format_with_alpha (drawable);
+
+ type_with_alpha = gimp_babl_format_get_image_type (format);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), type_with_alpha);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_has_alpha_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean has_alpha = FALSE;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ has_alpha = gimp_drawable_has_alpha (drawable);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), has_alpha);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_is_rgb_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean is_rgb = FALSE;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ is_rgb = gimp_drawable_is_rgb (drawable);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), is_rgb);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_is_gray_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean is_gray = FALSE;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ is_gray = gimp_drawable_is_gray (drawable);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), is_gray);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_is_indexed_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean is_indexed = FALSE;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ is_indexed = gimp_drawable_is_indexed (drawable);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), is_indexed);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_bpp_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 bpp = 0;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ const Babl *format = gimp_drawable_get_format (drawable);
+
+ if (! gimp->plug_in_manager->current_plug_in ||
+ ! gimp_plug_in_precision_enabled (gimp->plug_in_manager->current_plug_in))
+ {
+ format = gimp_babl_compat_u8_format (format);
+ }
+
+ bpp = babl_format_get_bytes_per_pixel (format);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), bpp);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_width_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 width = 0;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ width = gimp_item_get_width (GIMP_ITEM (drawable));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), width);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_height_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 height = 0;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ height = gimp_item_get_height (GIMP_ITEM (drawable));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), height);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_offsets_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 offset_x = 0;
+ gint32 offset_y = 0;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_item_get_offset (GIMP_ITEM (drawable), &offset_x, &offset_y);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), offset_x);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), offset_y);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_set_image_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ GimpImage *image;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (image != gimp_item_get_image (GIMP_ITEM (drawable)))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_mask_bounds_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean non_empty = FALSE;
+ gint32 x1 = 0;
+ gint32 y1 = 0;
+ gint32 x2 = 0;
+ gint32 y2 = 0;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error))
+ non_empty = gimp_item_mask_bounds (GIMP_ITEM (drawable), &x1, &y1, &x2, &y2);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), non_empty);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), x1);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), y1);
+ g_value_set_int (gimp_value_array_index (return_vals, 4), x2);
+ g_value_set_int (gimp_value_array_index (return_vals, 5), y2);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_mask_intersect_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean non_empty = FALSE;
+ gint32 x = 0;
+ gint32 y = 0;
+ gint32 width = 0;
+ gint32 height = 0;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error))
+ non_empty = gimp_item_mask_intersect (GIMP_ITEM (drawable),
+ &x, &y, &width, &height);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), non_empty);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), x);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), y);
+ g_value_set_int (gimp_value_array_index (return_vals, 4), width);
+ g_value_set_int (gimp_value_array_index (return_vals, 5), height);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_merge_shadow_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gboolean undo;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ undo = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ const gchar *undo_desc = _("Plug-in");
+
+ if (gimp->plug_in_manager->current_plug_in)
+ undo_desc = gimp_plug_in_get_undo_desc (gimp->plug_in_manager->current_plug_in);
+
+ gimp_drawable_merge_shadow_buffer (drawable, undo, undo_desc);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_free_shadow_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp->plug_in_manager->current_plug_in)
+ gimp_plug_in_cleanup_remove_shadow (gimp->plug_in_manager->current_plug_in,
+ drawable);
+
+ gimp_drawable_free_shadow_buffer (drawable);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_update_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 x;
+ gint32 y;
+ gint32 width;
+ gint32 height;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ x = g_value_get_int (gimp_value_array_index (args, 1));
+ y = g_value_get_int (gimp_value_array_index (args, 2));
+ width = g_value_get_int (gimp_value_array_index (args, 3));
+ height = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ gimp_drawable_update (drawable, x, y, width, height);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_get_pixel_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 x_coord;
+ gint32 y_coord;
+ gint32 num_channels = 0;
+ guint8 *pixel = NULL;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ x_coord = g_value_get_int (gimp_value_array_index (args, 1));
+ y_coord = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ const Babl *format = gimp_drawable_get_format (drawable);
+
+ if (! gimp->plug_in_manager->current_plug_in ||
+ ! gimp_plug_in_precision_enabled (gimp->plug_in_manager->current_plug_in))
+ {
+ format = gimp_babl_compat_u8_format (format);
+ }
+
+ if (x_coord < gimp_item_get_width (GIMP_ITEM (drawable)) &&
+ y_coord < gimp_item_get_height (GIMP_ITEM (drawable)))
+ {
+ num_channels = babl_format_get_bytes_per_pixel (format);
+ pixel = g_new0 (guint8, num_channels);
+
+ gegl_buffer_sample (gimp_drawable_get_buffer (drawable),
+ x_coord, y_coord, NULL, pixel, format,
+ GEGL_SAMPLER_NEAREST, GEGL_ABYSS_NONE);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_channels);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 2), pixel, num_channels);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_set_pixel_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 x_coord;
+ gint32 y_coord;
+ gint32 num_channels;
+ const guint8 *pixel;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ x_coord = g_value_get_int (gimp_value_array_index (args, 1));
+ y_coord = g_value_get_int (gimp_value_array_index (args, 2));
+ num_channels = g_value_get_int (gimp_value_array_index (args, 3));
+ pixel = gimp_value_get_int8array (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ const Babl *format = gimp_drawable_get_format (drawable);
+
+ if (! gimp->plug_in_manager->current_plug_in ||
+ ! gimp_plug_in_precision_enabled (gimp->plug_in_manager->current_plug_in))
+ {
+ format = gimp_babl_compat_u8_format (format);
+ }
+
+ if (gimp_pdb_item_is_modifiable (GIMP_ITEM (drawable),
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ x_coord < gimp_item_get_width (GIMP_ITEM (drawable)) &&
+ y_coord < gimp_item_get_height (GIMP_ITEM (drawable)) &&
+ num_channels == babl_format_get_bytes_per_pixel (format))
+ {
+ gegl_buffer_set (gimp_drawable_get_buffer (drawable),
+ GEGL_RECTANGLE (x_coord, y_coord, 1, 1),
+ 0, format, pixel, GEGL_AUTO_ROWSTRIDE);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_fill_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 fill_type;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ fill_type = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_modifiable (GIMP_ITEM (drawable),
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ gimp_drawable_fill (drawable, context, (GimpFillType) fill_type);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_offset_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gboolean wrap_around;
+ gint32 fill_type;
+ gint32 offset_x;
+ gint32 offset_y;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ wrap_around = g_value_get_boolean (gimp_value_array_index (args, 1));
+ fill_type = g_value_get_enum (gimp_value_array_index (args, 2));
+ offset_x = g_value_get_int (gimp_value_array_index (args, 3));
+ offset_y = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ gimp_drawable_offset (drawable, context, wrap_around, fill_type,
+ offset_x, offset_y);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_thumbnail_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 width;
+ gint32 height;
+ gint32 actual_width = 0;
+ gint32 actual_height = 0;
+ gint32 bpp = 0;
+ gint32 thumbnail_data_count = 0;
+ guint8 *thumbnail_data = NULL;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ width = g_value_get_int (gimp_value_array_index (args, 1));
+ height = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpTempBuf *buf;
+ gint dwidth, dheight;
+
+ gimp_assert (GIMP_VIEWABLE_MAX_PREVIEW_SIZE >= 1024);
+
+ /* Adjust the width/height ratio */
+ dwidth = gimp_item_get_width (GIMP_ITEM (drawable));
+ dheight = gimp_item_get_height (GIMP_ITEM (drawable));
+
+ if (dwidth > dheight)
+ height = MAX (1, (width * dheight) / dwidth);
+ else
+ width = MAX (1, (height * dwidth) / dheight);
+
+ if (image->gimp->config->layer_previews)
+ buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (drawable), context,
+ width, height);
+ else
+ buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
+ width, height,
+ gimp_drawable_get_preview_format (drawable));
+
+ if (buf)
+ {
+ actual_width = gimp_temp_buf_get_width (buf);
+ actual_height = gimp_temp_buf_get_height (buf);
+ bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf));
+ thumbnail_data_count = gimp_temp_buf_get_data_size (buf);
+ thumbnail_data = g_memdup (gimp_temp_buf_get_data (buf),
+ thumbnail_data_count);
+
+ gimp_temp_buf_unref (buf);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), actual_width);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), actual_height);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), bpp);
+ g_value_set_int (gimp_value_array_index (return_vals, 4), thumbnail_data_count);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 5), thumbnail_data, thumbnail_data_count);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_sub_thumbnail_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 src_x;
+ gint32 src_y;
+ gint32 src_width;
+ gint32 src_height;
+ gint32 dest_width;
+ gint32 dest_height;
+ gint32 width = 0;
+ gint32 height = 0;
+ gint32 bpp = 0;
+ gint32 thumbnail_data_count = 0;
+ guint8 *thumbnail_data = NULL;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ src_x = g_value_get_int (gimp_value_array_index (args, 1));
+ src_y = g_value_get_int (gimp_value_array_index (args, 2));
+ src_width = g_value_get_int (gimp_value_array_index (args, 3));
+ src_height = g_value_get_int (gimp_value_array_index (args, 4));
+ dest_width = g_value_get_int (gimp_value_array_index (args, 5));
+ dest_height = g_value_get_int (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ if ((src_x + src_width) <= gimp_item_get_width (GIMP_ITEM (drawable)) &&
+ (src_y + src_height) <= gimp_item_get_height (GIMP_ITEM (drawable)))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpTempBuf *buf;
+
+ if (image->gimp->config->layer_previews)
+ buf = gimp_drawable_get_sub_preview (drawable,
+ src_x, src_y,
+ src_width, src_height,
+ dest_width, dest_height);
+ else
+ buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
+ dest_width, dest_height,
+ gimp_drawable_get_preview_format (drawable));
+
+ if (buf)
+ {
+ width = gimp_temp_buf_get_width (buf);
+ height = gimp_temp_buf_get_height (buf);
+ bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf));
+ thumbnail_data_count = gimp_temp_buf_get_data_size (buf);
+ thumbnail_data = g_memdup (gimp_temp_buf_get_data (buf),
+ thumbnail_data_count);
+
+ gimp_temp_buf_unref (buf);
+ }
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), width);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), height);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), bpp);
+ g_value_set_int (gimp_value_array_index (return_vals, 4), thumbnail_data_count);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 5), thumbnail_data, thumbnail_data_count);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_foreground_extract_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 mode;
+ GimpDrawable *mask;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ mode = g_value_get_enum (gimp_value_array_index (args, 1));
+ mask = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (mode == GIMP_FOREGROUND_EXTRACT_MATTING &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error))
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GeglBuffer *buffer;
+
+ buffer = gimp_drawable_foreground_extract (drawable,
+ GIMP_MATTING_ENGINE_GLOBAL,
+ 2,
+ 2,
+ 2,
+ gimp_drawable_get_buffer (mask),
+ progress);
+
+ gimp_channel_select_buffer (gimp_image_get_mask (image),
+ C_("command", "Foreground Select"),
+ buffer,
+ 0, /* x offset */
+ 0, /* y offset */
+ GIMP_CHANNEL_OP_REPLACE,
+ pdb_context->feather,
+ pdb_context->feather_radius_x,
+ pdb_context->feather_radius_y);
+
+ g_object_unref (buffer);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_drawable_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-drawable-get-format
+ */
+ procedure = gimp_procedure_new (drawable_get_format_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-get-format");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-get-format",
+ "Returns the drawable's Babl format",
+ "This procedure returns the drawable's Babl format.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("format",
+ "format",
+ "The drawable's Babl format",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-get-thumbnail-format
+ */
+ procedure = gimp_procedure_new (drawable_get_thumbnail_format_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-get-thumbnail-format");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-get-thumbnail-format",
+ "Returns the drawable's thumbnail Babl format",
+ "This procedure returns the drawable's thumbnail Babl format.\n"
+ "Thumbnails are always 8-bit images, see 'gimp-drawable-thumbnail' and 'gimp-drawable-sub-thmbnail'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2019",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("format",
+ "format",
+ "The drawable's thumbnail Babl format",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-type
+ */
+ procedure = gimp_procedure_new (drawable_type_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-type");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-type",
+ "Returns the drawable's type.",
+ "This procedure returns the drawable's type.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("type",
+ "type",
+ "The drawable's type",
+ GIMP_TYPE_IMAGE_TYPE,
+ GIMP_RGB_IMAGE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-type-with-alpha
+ */
+ procedure = gimp_procedure_new (drawable_type_with_alpha_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-type-with-alpha");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-type-with-alpha",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_enum ("type-with-alpha",
+ "type with alpha",
+ "The drawable's type with alpha",
+ GIMP_TYPE_IMAGE_TYPE,
+ GIMP_RGB_IMAGE,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->values[0]),
+ GIMP_RGB_IMAGE);
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->values[0]),
+ GIMP_GRAY_IMAGE);
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->values[0]),
+ GIMP_INDEXED_IMAGE);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-has-alpha
+ */
+ procedure = gimp_procedure_new (drawable_has_alpha_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-has-alpha");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-has-alpha",
+ "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 }.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("has-alpha",
+ "has alpha",
+ "Does the drawable have an alpha channel?",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-is-rgb
+ */
+ procedure = gimp_procedure_new (drawable_is_rgb_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-is-rgb");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-is-rgb",
+ "Returns whether the drawable is an RGB type.",
+ "This procedure returns TRUE if the specified drawable is of type { RGB, RGBA }.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("is-rgb",
+ "is rgb",
+ "TRUE if the drawable is an RGB type",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-is-gray
+ */
+ procedure = gimp_procedure_new (drawable_is_gray_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-is-gray");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-is-gray",
+ "Returns whether the drawable is a grayscale type.",
+ "This procedure returns TRUE if the specified drawable is of type { Gray, GrayA }.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("is-gray",
+ "is gray",
+ "TRUE if the drawable is a grayscale type",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-is-indexed
+ */
+ procedure = gimp_procedure_new (drawable_is_indexed_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-is-indexed");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-is-indexed",
+ "Returns whether the drawable is an indexed type.",
+ "This procedure returns TRUE if the specified drawable is of type { Indexed, IndexedA }.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("is-indexed",
+ "is indexed",
+ "TRUE if the drawable is an indexed type",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-bpp
+ */
+ procedure = gimp_procedure_new (drawable_bpp_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-bpp");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-bpp",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("bpp",
+ "bpp",
+ "Bytes per pixel",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-width
+ */
+ procedure = gimp_procedure_new (drawable_width_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-width");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-width",
+ "Returns the width of the drawable.",
+ "This procedure returns the specified drawable's width in pixels.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "Width of drawable",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-height
+ */
+ procedure = gimp_procedure_new (drawable_height_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-height");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-height",
+ "Returns the height of the drawable.",
+ "This procedure returns the specified drawable's height in pixels.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "Height of drawable",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-offsets
+ */
+ procedure = gimp_procedure_new (drawable_offsets_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-offsets");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-offsets",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("offset-x",
+ "offset x",
+ "x offset of drawable",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("offset-y",
+ "offset y",
+ "y offset of drawable",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-set-image
+ */
+ procedure = gimp_procedure_new (drawable_set_image_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-set-image");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-set-image",
+ "Deprecated: There is no replacement for this procedure.",
+ "Deprecated: There is no replacement for this procedure.",
+ "",
+ "",
+ "",
+ "NONE");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-mask-bounds
+ */
+ procedure = gimp_procedure_new (drawable_mask_bounds_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-mask-bounds");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-mask-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).\n"
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("non-empty",
+ "non empty",
+ "TRUE if there is a selection",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("x1",
+ "x1",
+ "x coordinate of the upper left corner of selection bounds",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("y1",
+ "y1",
+ "y coordinate of the upper left corner of selection bounds",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("x2",
+ "x2",
+ "x coordinate of the lower right corner of selection bounds",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("y2",
+ "y2",
+ "y coordinate of the lower right corner of selection bounds",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-mask-intersect
+ */
+ procedure = gimp_procedure_new (drawable_mask_intersect_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-mask-intersect");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-mask-intersect",
+ "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.\n"
+ "If there is no selection this function returns TRUE and the returned bounds are the extents of the whole drawable.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("non-empty",
+ "non empty",
+ "TRUE if the returned area is not empty",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("x",
+ "x",
+ "x coordinate of the upper left corner of the intersection",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("y",
+ "y",
+ "y coordinate of the upper left corner of the intersection",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "width of the intersection",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "height of the intersection",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-merge-shadow
+ */
+ procedure = gimp_procedure_new (drawable_merge_shadow_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-merge-shadow");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-merge-shadow",
+ "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'.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("undo",
+ "undo",
+ "Push merge to undo stack?",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-free-shadow
+ */
+ procedure = gimp_procedure_new (drawable_free_shadow_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-free-shadow");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-free-shadow",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-update
+ */
+ procedure = gimp_procedure_new (drawable_update_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-update");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-update",
+ "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).",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("x",
+ "x",
+ "x coordinate of upper left corner of update region",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("y",
+ "y",
+ "y coordinate of upper left corner of update region",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "Width of update region",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "Height of update region",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-get-pixel
+ */
+ procedure = gimp_procedure_new (drawable_get_pixel_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-get-pixel");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-get-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("x-coord",
+ "x coord",
+ "The x coordinate",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("y-coord",
+ "y coord",
+ "The y coordinate",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-channels",
+ "num channels",
+ "The number of channels for the pixel",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("pixel",
+ "pixel",
+ "The pixel value",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-set-pixel
+ */
+ procedure = gimp_procedure_new (drawable_set_pixel_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-set-pixel");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-set-pixel",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("x-coord",
+ "x coord",
+ "The x coordinate",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("y-coord",
+ "y coord",
+ "The y coordinate",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-channels",
+ "num channels",
+ "The number of channels for the pixel",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8_array ("pixel",
+ "pixel",
+ "The pixel value",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-fill
+ */
+ procedure = gimp_procedure_new (drawable_fill_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-fill");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-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.\n"
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("fill-type",
+ "fill type",
+ "The type of fill",
+ GIMP_TYPE_FILL_TYPE,
+ GIMP_FILL_FOREGROUND,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-offset
+ */
+ procedure = gimp_procedure_new (drawable_offset_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-offset");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-offset",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to offset",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("wrap-around",
+ "wrap around",
+ "wrap image around or fill vacated regions",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("fill-type",
+ "fill type",
+ "fill vacated regions of drawable with background or transparent",
+ GIMP_TYPE_OFFSET_TYPE,
+ GIMP_OFFSET_BACKGROUND,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offset-x",
+ "offset x",
+ "offset by this amount in X direction",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offset-y",
+ "offset y",
+ "offset by this amount in Y direction",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-thumbnail
+ */
+ procedure = gimp_procedure_new (drawable_thumbnail_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-thumbnail");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-thumbnail",
+ "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.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The requested thumbnail width",
+ 1, 1024, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The requested thumbnail height",
+ 1, 1024, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("actual-width",
+ "actual width",
+ "The previews width",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("actual-height",
+ "actual height",
+ "The previews height",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("bpp",
+ "bpp",
+ "The previews bpp",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("thumbnail-data-count",
+ "thumbnail data count",
+ "The number of bytes in thumbnail data",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("thumbnail-data",
+ "thumbnail data",
+ "The thumbnail data",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-sub-thumbnail
+ */
+ procedure = gimp_procedure_new (drawable_sub_thumbnail_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-sub-thumbnail");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-sub-thumbnail",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("src-x",
+ "src x",
+ "The x coordinate of the area",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("src-y",
+ "src y",
+ "The y coordinate of the area",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("src-width",
+ "src width",
+ "The width of the area",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("src-height",
+ "src height",
+ "The height of the area",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("dest-width",
+ "dest width",
+ "The thumbnail width",
+ 1, 1024, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("dest-height",
+ "dest height",
+ "The thumbnail height",
+ 1, 1024, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The previews width",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The previews height",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("bpp",
+ "bpp",
+ "The previews bpp",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("thumbnail-data-count",
+ "thumbnail data count",
+ "The number of bytes in thumbnail data",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("thumbnail-data",
+ "thumbnail data",
+ "The thumbnail data",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-foreground-extract
+ */
+ procedure = gimp_procedure_new (drawable_foreground_extract_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-foreground-extract");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-foreground-extract",
+ "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",
+ "Gerald Friedland <fland@inf.fu-berlin.de>, Kristian Jantz <jantz@inf.fu-berlin.de>, Sven Neumann <sven@gimp.org>",
+ "Gerald Friedland",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("mode",
+ "mode",
+ "The algorithm to use",
+ GIMP_TYPE_FOREGROUND_EXTRACT_MODE,
+ GIMP_FOREGROUND_EXTRACT_SIOX,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("mask",
+ "mask",
+ "Tri-Map",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/drawable-color-cmds.c b/app/pdb/drawable-color-cmds.c
new file mode 100644
index 0000000..3f6010f
--- /dev/null
+++ b/app/pdb/drawable-color-cmds.c
@@ -0,0 +1,1551 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpmath/gimpmath.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpdrawable-equalize.h"
+#include "core/gimpdrawable-histogram.h"
+#include "core/gimpdrawable-levels.h"
+#include "core/gimpdrawable-operation.h"
+#include "core/gimpdrawable.h"
+#include "core/gimphistogram.h"
+#include "core/gimpparamspecs.h"
+#include "operations/gimpbrightnesscontrastconfig.h"
+#include "operations/gimpcolorbalanceconfig.h"
+#include "operations/gimpcurvesconfig.h"
+#include "operations/gimphuesaturationconfig.h"
+#include "operations/gimplevelsconfig.h"
+#include "plug-in/gimpplugin.h"
+#include "plug-in/gimppluginmanager.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+drawable_brightness_contrast_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble brightness;
+ gdouble contrast;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ brightness = g_value_get_double (gimp_value_array_index (args, 1));
+ contrast = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG,
+ "brightness", brightness,
+ "contrast", contrast,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Brightness-Contrast"),
+ "gimp:brightness-contrast",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_color_balance_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 transfer_mode;
+ gboolean preserve_lum;
+ gdouble cyan_red;
+ gdouble magenta_green;
+ gdouble yellow_blue;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ transfer_mode = g_value_get_enum (gimp_value_array_index (args, 1));
+ preserve_lum = g_value_get_boolean (gimp_value_array_index (args, 2));
+ cyan_red = g_value_get_double (gimp_value_array_index (args, 3));
+ magenta_green = g_value_get_double (gimp_value_array_index (args, 4));
+ yellow_blue = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_COLOR_BALANCE_CONFIG,
+ "range", transfer_mode,
+ "preserve-luminosity", preserve_lum,
+ NULL);
+
+ g_object_set (config,
+ "cyan-red", cyan_red / 100.0,
+ "magenta-green", magenta_green / 100.0,
+ "yellow-blue", yellow_blue / 100.0,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Color Balance"),
+ "gimp:color-balance",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_colorize_hsl_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble hue;
+ gdouble saturation;
+ gdouble lightness;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ hue = g_value_get_double (gimp_value_array_index (args, 1));
+ saturation = g_value_get_double (gimp_value_array_index (args, 2));
+ lightness = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ ! gimp_drawable_is_gray (drawable))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gimp:colorize",
+ "hue", hue / 360.0,
+ "saturation", saturation / 100.0,
+ "lightness", lightness / 100.0,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Colorize"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_curves_explicit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 channel;
+ gint32 num_values;
+ const gdouble *values;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ channel = g_value_get_enum (gimp_value_array_index (args, 1));
+ num_values = g_value_get_int (gimp_value_array_index (args, 2));
+ values = gimp_value_get_floatarray (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ (num_values >= 256) &&
+ (num_values <= 4096) &&
+ (gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
+ (! gimp_drawable_is_gray (drawable) ||
+ channel == GIMP_HISTOGRAM_VALUE || channel == GIMP_HISTOGRAM_ALPHA) &&
+ channel != GIMP_HISTOGRAM_LUMINANCE)
+ {
+ GObject *config = gimp_curves_config_new_explicit (channel,
+ values,
+ num_values);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Curves"),
+ "gimp:curves",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_curves_spline_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 channel;
+ gint32 num_points;
+ const gdouble *points;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ channel = g_value_get_enum (gimp_value_array_index (args, 1));
+ num_points = g_value_get_int (gimp_value_array_index (args, 2));
+ points = gimp_value_get_floatarray (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ ! (num_points & 1) &&
+ (gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
+ (! gimp_drawable_is_gray (drawable) ||
+ channel == GIMP_HISTOGRAM_VALUE || channel == GIMP_HISTOGRAM_ALPHA) &&
+ channel != GIMP_HISTOGRAM_LUMINANCE)
+ {
+ GObject *config = gimp_curves_config_new_spline (channel,
+ points,
+ num_points / 2);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Curves"),
+ "gimp:curves",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_extract_component_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ guint8 component;
+ gboolean invert;
+ gboolean linear;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ component = g_value_get_uint (gimp_value_array_index (args, 1));
+ invert = g_value_get_boolean (gimp_value_array_index (args, 2));
+ linear = g_value_get_boolean (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_drawable_is_rgb (drawable))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:component-extract",
+ "component", component,
+ "invert", invert,
+ "linear", linear,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Extract Component"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_desaturate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 desaturate_mode;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ desaturate_mode = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_drawable_is_rgb (drawable))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gimp:desaturate",
+ "mode", desaturate_mode,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Desaturate"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_equalize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gboolean mask_only;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ mask_only = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) ||
+ ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ success = FALSE;
+
+ if (success)
+ gimp_drawable_equalize (drawable, mask_only);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_histogram_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 channel;
+ gdouble start_range;
+ gdouble end_range;
+ gdouble mean = 0.0;
+ gdouble std_dev = 0.0;
+ gdouble median = 0.0;
+ gdouble pixels = 0.0;
+ gdouble count = 0.0;
+ gdouble percentile = 0.0;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ channel = g_value_get_enum (gimp_value_array_index (args, 1));
+ start_range = g_value_get_double (gimp_value_array_index (args, 2));
+ end_range = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error) ||
+ (! gimp_drawable_has_alpha (drawable) &&
+ channel == GIMP_HISTOGRAM_ALPHA) ||
+ (gimp_drawable_is_gray (drawable) &&
+ channel != GIMP_HISTOGRAM_VALUE && channel != GIMP_HISTOGRAM_ALPHA))
+ success = FALSE;
+
+ if (success)
+ {
+ GimpHistogram *histogram;
+ gint n_bins;
+ gint start;
+ gboolean precision_enabled;
+ gboolean linear;
+ gint end;
+
+ precision_enabled =
+ gimp->plug_in_manager->current_plug_in &&
+ gimp_plug_in_precision_enabled (gimp->plug_in_manager->current_plug_in);
+
+ if (precision_enabled)
+ linear = gimp_drawable_get_linear (drawable);
+ else
+ linear = FALSE;
+
+ histogram = gimp_histogram_new (linear);
+ gimp_drawable_calculate_histogram (drawable, histogram, FALSE);
+
+ n_bins = gimp_histogram_n_bins (histogram);
+
+ start = ROUND (start_range * (n_bins - 1));
+ end = ROUND (end_range * (n_bins - 1));
+
+ mean = gimp_histogram_get_mean (histogram, channel,
+ start, end);
+ std_dev = gimp_histogram_get_std_dev (histogram, channel,
+ start, end);
+ median = gimp_histogram_get_median (histogram, channel,
+ start, end);
+ pixels = gimp_histogram_get_count (histogram, channel, 0, n_bins - 1);
+ count = gimp_histogram_get_count (histogram, channel,
+ start, end);
+ percentile = count / pixels;
+
+ g_object_unref (histogram);
+
+ if (n_bins == 256 || ! precision_enabled)
+ {
+ mean *= 255;
+ std_dev *= 255;
+ median *= 255;
+ }
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_double (gimp_value_array_index (return_vals, 1), mean);
+ g_value_set_double (gimp_value_array_index (return_vals, 2), std_dev);
+ g_value_set_double (gimp_value_array_index (return_vals, 3), median);
+ g_value_set_double (gimp_value_array_index (return_vals, 4), pixels);
+ g_value_set_double (gimp_value_array_index (return_vals, 5), count);
+ g_value_set_double (gimp_value_array_index (return_vals, 6), percentile);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_hue_saturation_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 hue_range;
+ gdouble hue_offset;
+ gdouble lightness;
+ gdouble saturation;
+ gdouble overlap;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ hue_range = g_value_get_enum (gimp_value_array_index (args, 1));
+ hue_offset = g_value_get_double (gimp_value_array_index (args, 2));
+ lightness = g_value_get_double (gimp_value_array_index (args, 3));
+ saturation = g_value_get_double (gimp_value_array_index (args, 4));
+ overlap = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_HUE_SATURATION_CONFIG,
+ "range", hue_range,
+ NULL);
+
+ g_object_set (config,
+ "hue", hue_offset / 180.0,
+ "saturation", saturation / 100.0,
+ "lightness", lightness / 100.0,
+ "overlap", overlap / 100.0,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Hue-Saturation"),
+ "gimp:hue-saturation",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_invert_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gboolean linear;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ linear = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Invert"),
+ linear ?
+ "gegl:invert-linear" :
+ "gegl:invert-gamma",
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_levels_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 channel;
+ gdouble low_input;
+ gdouble high_input;
+ gboolean clamp_input;
+ gdouble gamma;
+ gdouble low_output;
+ gdouble high_output;
+ gboolean clamp_output;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ channel = g_value_get_enum (gimp_value_array_index (args, 1));
+ low_input = g_value_get_double (gimp_value_array_index (args, 2));
+ high_input = g_value_get_double (gimp_value_array_index (args, 3));
+ clamp_input = g_value_get_boolean (gimp_value_array_index (args, 4));
+ gamma = g_value_get_double (gimp_value_array_index (args, 5));
+ low_output = g_value_get_double (gimp_value_array_index (args, 6));
+ high_output = g_value_get_double (gimp_value_array_index (args, 7));
+ clamp_output = g_value_get_boolean (gimp_value_array_index (args, 8));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ (gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
+ (! gimp_drawable_is_gray (drawable) ||
+ channel == GIMP_HISTOGRAM_VALUE || channel == GIMP_HISTOGRAM_ALPHA) &&
+ channel != GIMP_HISTOGRAM_LUMINANCE)
+ {
+ GObject *config = g_object_new (GIMP_TYPE_LEVELS_CONFIG,
+ "channel", channel,
+ NULL);
+
+ g_object_set (config,
+ "low-input", low_input,
+ "high-input", high_input,
+ "clamp-input", clamp_input,
+ "gamma", gamma,
+ "low-output", low_output,
+ "high-output", high_output,
+ "clamp-output", clamp_output,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Levels"),
+ "gimp:levels",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = TRUE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_levels_stretch_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ gimp_drawable_levels_stretch (drawable, progress);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_shadows_highlights_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble shadows;
+ gdouble highlights;
+ gdouble whitepoint;
+ gdouble radius;
+ gdouble compress;
+ gdouble shadows_ccorrect;
+ gdouble highlights_ccorrect;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ shadows = g_value_get_double (gimp_value_array_index (args, 1));
+ highlights = g_value_get_double (gimp_value_array_index (args, 2));
+ whitepoint = g_value_get_double (gimp_value_array_index (args, 3));
+ radius = g_value_get_double (gimp_value_array_index (args, 4));
+ compress = g_value_get_double (gimp_value_array_index (args, 5));
+ shadows_ccorrect = g_value_get_double (gimp_value_array_index (args, 6));
+ highlights_ccorrect = g_value_get_double (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:shadows-highlights",
+ "shadows", shadows,
+ "highlights", highlights,
+ "whitepoint", whitepoint,
+ "radius", radius,
+ "compress", compress,
+ "shadows-ccorrect", shadows_ccorrect,
+ "highlights-ccorrect", highlights_ccorrect,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Shadows-Highlights"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_posterize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 levels;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ levels = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gimp:posterize",
+ "levels", levels,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Posterize"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_threshold_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 channel;
+ gdouble low_threshold;
+ gdouble high_threshold;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ channel = g_value_get_enum (gimp_value_array_index (args, 1));
+ low_threshold = g_value_get_double (gimp_value_array_index (args, 2));
+ high_threshold = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gimp:threshold",
+ "channel", channel,
+ "low", low_threshold,
+ "high", high_threshold,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Threshold"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_drawable_color_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-drawable-brightness-contrast
+ */
+ procedure = gimp_procedure_new (drawable_brightness_contrast_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-brightness-contrast");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-brightness-contrast",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("brightness",
+ "brightness",
+ "Brightness adjustment",
+ -1.0, 1.0, -1.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("contrast",
+ "contrast",
+ "Contrast adjustment",
+ -1.0, 1.0, -1.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-color-balance
+ */
+ procedure = gimp_procedure_new (drawable_color_balance_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-color-balance");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("transfer-mode",
+ "transfer mode",
+ "Transfer mode",
+ GIMP_TYPE_TRANSFER_MODE,
+ GIMP_TRANSFER_SHADOWS,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("preserve-lum",
+ "preserve lum",
+ "Preserve luminosity values at each pixel",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("cyan-red",
+ "cyan red",
+ "Cyan-Red color balance",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("magenta-green",
+ "magenta green",
+ "Magenta-Green color balance",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("yellow-blue",
+ "yellow blue",
+ "Yellow-Blue color balance",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-colorize-hsl
+ */
+ procedure = gimp_procedure_new (drawable_colorize_hsl_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-colorize-hsl");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-colorize-hsl",
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("hue",
+ "hue",
+ "Hue in degrees",
+ 0, 360, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("saturation",
+ "saturation",
+ "Saturation in percent",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("lightness",
+ "lightness",
+ "Lightness in percent",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-curves-explicit
+ */
+ procedure = gimp_procedure_new (drawable_curves_explicit_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-curves-explicit");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-curves-explicit",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("channel",
+ "channel",
+ "The channel to modify",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-values",
+ "num values",
+ "The number of values in the new curve",
+ 256, 2096, 256,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("values",
+ "values",
+ "The explicit curve",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-curves-spline
+ */
+ procedure = gimp_procedure_new (drawable_curves_spline_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-curves-spline");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-curves-spline",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("channel",
+ "channel",
+ "The channel to modify",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-points",
+ "num points",
+ "The number of values in the control point array",
+ 4, 2048, 4,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("points",
+ "points",
+ "The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y, ... }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-extract-component
+ */
+ procedure = gimp_procedure_new (drawable_extract_component_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-extract-component");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-extract-component",
+ "Extract a color model component.",
+ "Extract a color model component.",
+ "Compatibility procedure. Please see 'gegl:component-extract' for credits.",
+ "Compatibility procedure. Please see 'gegl:component-extract' for credits.",
+ "2021",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("component",
+ "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))",
+ 0, 20, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("invert",
+ "invert",
+ "Invert the extracted component",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("linear",
+ "linear",
+ "Use linear output instead of gamma corrected",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-desaturate
+ */
+ procedure = gimp_procedure_new (drawable_desaturate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-desaturate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-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.",
+ "Karine Delvare",
+ "Karine Delvare",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("desaturate-mode",
+ "desaturate mode",
+ "The formula to use to desaturate",
+ GIMP_TYPE_DESATURATE_MODE,
+ GIMP_DESATURATE_LIGHTNESS,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-equalize
+ */
+ procedure = gimp_procedure_new (drawable_equalize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-equalize");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-equalize",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("mask-only",
+ "mask only",
+ "Equalization option",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-histogram
+ */
+ procedure = gimp_procedure_new (drawable_histogram_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-histogram");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-histogram",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("channel",
+ "channel",
+ "The channel to query",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("start-range",
+ "start range",
+ "Start of the intensity measurement range",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("end-range",
+ "end range",
+ "End of the intensity measurement range",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("mean",
+ "mean",
+ "Mean intensity value",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("std-dev",
+ "std dev",
+ "Standard deviation of intensity values",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("median",
+ "median",
+ "Median intensity value",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("pixels",
+ "pixels",
+ "Alpha-weighted pixel count for entire image",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("count",
+ "count",
+ "Alpha-weighted pixel count for range",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("percentile",
+ "percentile",
+ "Percentile that range falls under",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-hue-saturation
+ */
+ procedure = gimp_procedure_new (drawable_hue_saturation_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-hue-saturation");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-hue-saturation",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("hue-range",
+ "hue range",
+ "Range of affected hues",
+ GIMP_TYPE_HUE_RANGE,
+ GIMP_HUE_RANGE_ALL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("hue-offset",
+ "hue offset",
+ "Hue offset in degrees",
+ -180, 180, -180,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("lightness",
+ "lightness",
+ "Lightness modification",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("saturation",
+ "saturation",
+ "Saturation modification",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("overlap",
+ "overlap",
+ "Overlap other hue channels",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-invert
+ */
+ procedure = gimp_procedure_new (drawable_invert_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-invert");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-invert",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("linear",
+ "linear",
+ "Whether to invert in linear space",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-levels
+ */
+ procedure = gimp_procedure_new (drawable_levels_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-levels");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-levels",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("channel",
+ "channel",
+ "The channel to modify",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("low-input",
+ "low input",
+ "Intensity of lowest input",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("high-input",
+ "high input",
+ "Intensity of highest input",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("clamp-input",
+ "clamp input",
+ "Clamp input values before applying output levels",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("gamma",
+ "gamma",
+ "Gamma adjustment factor",
+ 0.1, 10, 0.1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("low-output",
+ "low output",
+ "Intensity of lowest output",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("high-output",
+ "high output",
+ "Intensity of highest output",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("clamp-output",
+ "clamp output",
+ "Clamp final output values",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-levels-stretch
+ */
+ procedure = gimp_procedure_new (drawable_levels_stretch_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-levels-stretch");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-levels-stretch",
+ "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.",
+ "Joao S.O. Bueno, Shawn Willden",
+ "Joao S.O. Bueno, Shawn Willden",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-shadows-highlights
+ */
+ procedure = gimp_procedure_new (drawable_shadows_highlights_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-shadows-highlights");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-shadows-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.",
+ "Compatibility procedure. Please see 'gegl:shadows-highlights' for credits.",
+ "Compatibility procedure. Please see 'gegl:shadows-highlights' for credits.",
+ "2021",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("shadows",
+ "shadows",
+ "Adjust exposure of shadows",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("highlights",
+ "highlights",
+ "Adjust exposure of highlights",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("whitepoint",
+ "whitepoint",
+ "Shift white point",
+ -10, 10, -10,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("radius",
+ "radius",
+ "Spatial extent",
+ 0.1, 1500, 0.1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("compress",
+ "compress",
+ "Compress the effect on shadows/highlights and preserve midtones",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("shadows-ccorrect",
+ "shadows ccorrect",
+ "Adjust saturation of shadows",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("highlights-ccorrect",
+ "highlights ccorrect",
+ "Adjust saturation of highlights",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-posterize
+ */
+ procedure = gimp_procedure_new (drawable_posterize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-posterize");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-posterize",
+ "Posterize the specified drawable.",
+ "This procedures reduces the number of shades allows in each intensity channel to the specified 'levels' parameter.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("levels",
+ "levels",
+ "Levels of posterization",
+ 2, 255, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-threshold
+ */
+ procedure = gimp_procedure_new (drawable_threshold_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-threshold");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-threshold",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("channel",
+ "channel",
+ "The channel to base the threshold on",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("low-threshold",
+ "low threshold",
+ "The low threshold value",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("high-threshold",
+ "high threshold",
+ "The high threshold value",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/drawable-edit-cmds.c b/app/pdb/drawable-edit-cmds.c
new file mode 100644
index 0000000..43a0a4d
--- /dev/null
+++ b/app/pdb/drawable-edit-cmds.c
@@ -0,0 +1,620 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpconfig/gimpconfig.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp-gradients.h"
+#include "core/gimp.h"
+#include "core/gimpbuffer.h"
+#include "core/gimpdrawable-bucket-fill.h"
+#include "core/gimpdrawable-edit.h"
+#include "core/gimpdrawable-gradient.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
+#include "core/gimpitem.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimpprogress.h"
+#include "core/gimpstrokeoptions.h"
+#include "paint/gimppaintoptions.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+drawable_edit_clear_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ gimp_drawable_edit_clear (drawable, context);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_edit_fill_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 fill_type;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ fill_type = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
+
+ gimp_context_set_opacity (GIMP_CONTEXT (options),
+ gimp_context_get_opacity (context));
+ gimp_context_set_paint_mode (GIMP_CONTEXT (options),
+ gimp_context_get_paint_mode (context));
+
+ if (gimp_fill_options_set_by_fill_type (options, context,
+ fill_type, error))
+ {
+ gimp_drawable_edit_fill (drawable, options, NULL);
+ }
+ else
+ success = FALSE;
+
+ g_object_unref (options);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_edit_bucket_fill_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 fill_type;
+ gdouble x;
+ gdouble y;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ fill_type = g_value_get_enum (gimp_value_array_index (args, 1));
+ x = g_value_get_double (gimp_value_array_index (args, 2));
+ y = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
+
+ gimp_context_set_opacity (GIMP_CONTEXT (options),
+ gimp_context_get_opacity (context));
+ gimp_context_set_paint_mode (GIMP_CONTEXT (options),
+ gimp_context_get_paint_mode (context));
+
+ gimp_fill_options_set_antialias (options,
+ GIMP_PDB_CONTEXT (context)->antialias);
+
+ if (gimp_fill_options_set_by_fill_type (options, context,
+ fill_type, error))
+ {
+ gimp_drawable_bucket_fill (drawable, options,
+ GIMP_PDB_CONTEXT (context)->sample_transparent,
+ GIMP_PDB_CONTEXT (context)->sample_criterion,
+ GIMP_PDB_CONTEXT (context)->sample_threshold,
+ GIMP_PDB_CONTEXT (context)->sample_merged,
+ GIMP_PDB_CONTEXT (context)->diagonal_neighbors,
+ x, y);
+ }
+ else
+ success = FALSE;
+
+ g_object_unref (options);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_edit_gradient_fill_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 gradient_type;
+ gdouble offset;
+ gboolean supersample;
+ gint32 supersample_max_depth;
+ gdouble supersample_threshold;
+ gboolean dither;
+ gdouble x1;
+ gdouble y1;
+ gdouble x2;
+ gdouble y2;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ gradient_type = g_value_get_enum (gimp_value_array_index (args, 1));
+ offset = g_value_get_double (gimp_value_array_index (args, 2));
+ supersample = g_value_get_boolean (gimp_value_array_index (args, 3));
+ supersample_max_depth = g_value_get_int (gimp_value_array_index (args, 4));
+ supersample_threshold = g_value_get_double (gimp_value_array_index (args, 5));
+ dither = g_value_get_boolean (gimp_value_array_index (args, 6));
+ x1 = g_value_get_double (gimp_value_array_index (args, 7));
+ y1 = g_value_get_double (gimp_value_array_index (args, 8));
+ x2 = g_value_get_double (gimp_value_array_index (args, 9));
+ y2 = g_value_get_double (gimp_value_array_index (args, 10));
+
+ if (success)
+ {
+ success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error));
+
+ if (success)
+ {
+ if (supersample)
+ {
+ if (supersample_max_depth < 1 || supersample_max_depth > 9)
+ success = FALSE;
+
+ if (supersample_threshold < 0.0 || supersample_threshold > 4.0)
+ success = FALSE;
+ }
+ else
+ {
+ supersample_max_depth = CLAMP (supersample_max_depth, 1, 9);
+ supersample_threshold = CLAMP (supersample_threshold, 0.0, 4.0);
+ }
+ }
+
+ if (success)
+ {
+ /* all options should have the same value, so pick a random one */
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-paintbrush");
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Gradient"));
+
+ gimp_drawable_gradient (drawable,
+ context,
+ gimp_context_get_gradient (context),
+ GIMP_PDB_CONTEXT (context)->distance_metric,
+ gimp_context_get_paint_mode (context),
+ gradient_type,
+ gimp_context_get_opacity (context),
+ offset,
+ options->gradient_options->gradient_repeat,
+ options->gradient_options->gradient_reverse,
+ options->gradient_options->gradient_blend_color_space,
+ supersample,
+ supersample_max_depth,
+ supersample_threshold,
+ dither,
+ x1, y1, x2, y2,
+ progress);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_edit_stroke_selection_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpStrokeOptions *options;
+ GimpPaintOptions *paint_options;
+
+ options = gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ paint_options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context), NULL);
+ paint_options = gimp_config_duplicate (GIMP_CONFIG (paint_options));
+
+ success = gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
+ drawable, context, options, paint_options,
+ TRUE, progress, error);
+
+ g_object_unref (paint_options);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_edit_stroke_item_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ GimpItem *item;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ item = gimp_value_get_item (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_pdb_item_is_attached (item,
+ gimp_item_get_image (GIMP_ITEM (drawable)),
+ 0, error))
+ {
+ GimpStrokeOptions *options;
+ GimpPaintOptions *paint_options;
+
+ options = gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ paint_options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context), NULL);
+ paint_options = gimp_config_duplicate (GIMP_CONFIG (paint_options));
+
+ success = gimp_item_stroke (item, drawable,
+ context, options, paint_options,
+ TRUE, progress, error);
+
+ g_object_unref (paint_options);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_drawable_edit_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-drawable-edit-clear
+ */
+ procedure = gimp_procedure_new (drawable_edit_clear_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-edit-clear");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-edit-clear",
+ "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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-background'.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to clear from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-edit-fill
+ */
+ procedure = gimp_procedure_new (drawable_edit_fill_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-edit-fill");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-edit-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'.\n"
+ "\n"
+ "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'.",
+ "Spencer Kimball & Peter Mattis & Raphael Quinet",
+ "Spencer Kimball & Peter Mattis",
+ "1995-2000",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to fill to",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("fill-type",
+ "fill type",
+ "The type of fill",
+ GIMP_TYPE_FILL_TYPE,
+ GIMP_FILL_FOREGROUND,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-edit-bucket-fill
+ */
+ procedure = gimp_procedure_new (drawable_edit_bucket_fill_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-edit-bucket-fill");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-edit-bucket-fill",
+ "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.\n"
+ "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.\n"
+ "\n"
+ "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'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("fill-type",
+ "fill type",
+ "The type of fill",
+ GIMP_TYPE_FILL_TYPE,
+ GIMP_FILL_FOREGROUND,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "The x coordinate of this bucket fill's application.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "The y coordinate of this bucket fill's application.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-edit-gradient-fill
+ */
+ procedure = gimp_procedure_new (drawable_edit_gradient_fill_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-edit-gradient-fill");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-edit-gradient-fill",
+ "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'.\n"
+ "\n"
+ "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'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("gradient-type",
+ "gradient type",
+ "The type of gradient",
+ GIMP_TYPE_GRADIENT_TYPE,
+ GIMP_GRADIENT_LINEAR,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("offset",
+ "offset",
+ "Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode dependent.",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("supersample",
+ "supersample",
+ "Do adaptive supersampling",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("supersample-max-depth",
+ "supersample max depth",
+ "Maximum recursion levels for supersampling",
+ 1, 9, 1,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("supersample-threshold",
+ "supersample threshold",
+ "Supersampling threshold",
+ 0, 4, 0,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("dither",
+ "dither",
+ "Use dithering to reduce banding",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "The x coordinate of this gradient's starting point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "The y coordinate of this gradient's starting point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x2",
+ "x2",
+ "The x coordinate of this gradient's ending point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y2",
+ "y2",
+ "The y coordinate of this gradient's ending point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-edit-stroke-selection
+ */
+ procedure = gimp_procedure_new (drawable_edit_stroke_selection_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-edit-stroke-selection");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-edit-stroke-selection",
+ "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.\n"
+ "\n"
+ "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'.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to stroke to",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-edit-stroke-item
+ */
+ procedure = gimp_procedure_new (drawable_edit_stroke_item_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-edit-stroke-item");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-edit-stroke-item",
+ "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.\n"
+ "\n"
+ "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'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to stroke to",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item to stroke",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/drawable-transform-cmds.c b/app/pdb/drawable-transform-cmds.c
new file mode 100644
index 0000000..60e0919
--- /dev/null
+++ b/app/pdb/drawable-transform-cmds.c
@@ -0,0 +1,2894 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpmath/gimpmath.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "config/gimpcoreconfig.h"
+#include "core/gimp-transform-utils.h"
+#include "core/gimp.h"
+#include "core/gimpchannel.h"
+#include "core/gimpdrawable-transform.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimpprogress.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+drawable_transform_flip_simple_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 flip_type;
+ gboolean auto_center;
+ gdouble axis;
+ gboolean clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ flip_type = g_value_get_enum (gimp_value_array_index (args, 1));
+ auto_center = g_value_get_boolean (gimp_value_array_index (args, 2));
+ axis = g_value_get_double (gimp_value_array_index (args, 3));
+ clip_result = g_value_get_boolean (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+
+ gimp_transform_get_flip_axis (x, y, width, height,
+ flip_type, auto_center, &axis);
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_flip (drawable, context,
+ flip_type, axis, clip_result))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_flip (GIMP_ITEM (drawable), context,
+ flip_type, axis, clip_result);
+ }
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_flip_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gdouble x0;
+ gdouble y0;
+ gdouble x1;
+ gdouble y1;
+ gint32 transform_direction;
+ gint32 interpolation;
+ gboolean clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ x0 = g_value_get_double (gimp_value_array_index (args, 1));
+ y0 = g_value_get_double (gimp_value_array_index (args, 2));
+ x1 = g_value_get_double (gimp_value_array_index (args, 3));
+ y1 = g_value_get_double (gimp_value_array_index (args, 4));
+ transform_direction = g_value_get_enum (gimp_value_array_index (args, 5));
+ interpolation = g_value_get_enum (gimp_value_array_index (args, 6));
+ clip_result = g_value_get_boolean (gimp_value_array_index (args, 9));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION,
+ error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_flip_free (&matrix,
+ x0, y0, x1, y1);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Flipping"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, transform_direction,
+ interpolation,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ transform_direction,
+ interpolation,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_flip_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gdouble x0;
+ gdouble y0;
+ gdouble x1;
+ gdouble y1;
+ gboolean interpolate;
+ gboolean clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ x0 = g_value_get_double (gimp_value_array_index (args, 1));
+ y0 = g_value_get_double (gimp_value_array_index (args, 2));
+ x1 = g_value_get_double (gimp_value_array_index (args, 3));
+ y1 = g_value_get_double (gimp_value_array_index (args, 4));
+ interpolate = g_value_get_boolean (gimp_value_array_index (args, 5));
+ clip_result = g_value_get_boolean (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_flip_free (&matrix,
+ x0, y0, x1, y1);
+
+ if (interpolate)
+ interpolation_type = gimp->config->interpolation_type;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Flipping"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_perspective_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gdouble x0;
+ gdouble y0;
+ gdouble x1;
+ gdouble y1;
+ gdouble x2;
+ gdouble y2;
+ gdouble x3;
+ gdouble y3;
+ gint32 transform_direction;
+ gint32 interpolation;
+ gint32 clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ x0 = g_value_get_double (gimp_value_array_index (args, 1));
+ y0 = g_value_get_double (gimp_value_array_index (args, 2));
+ x1 = g_value_get_double (gimp_value_array_index (args, 3));
+ y1 = g_value_get_double (gimp_value_array_index (args, 4));
+ x2 = g_value_get_double (gimp_value_array_index (args, 5));
+ y2 = g_value_get_double (gimp_value_array_index (args, 6));
+ x3 = g_value_get_double (gimp_value_array_index (args, 7));
+ y3 = g_value_get_double (gimp_value_array_index (args, 8));
+ transform_direction = g_value_get_enum (gimp_value_array_index (args, 9));
+ interpolation = g_value_get_enum (gimp_value_array_index (args, 10));
+ clip_result = g_value_get_enum (gimp_value_array_index (args, 13));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION,
+ error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_perspective (&matrix,
+ x, y, width, height,
+ x0, y0, x1, y1,
+ x2, y2, x3, y3);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Perspective"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, transform_direction,
+ interpolation,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ transform_direction,
+ interpolation,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_perspective_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gdouble x0;
+ gdouble y0;
+ gdouble x1;
+ gdouble y1;
+ gdouble x2;
+ gdouble y2;
+ gdouble x3;
+ gdouble y3;
+ gboolean interpolate;
+ gint32 clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ x0 = g_value_get_double (gimp_value_array_index (args, 1));
+ y0 = g_value_get_double (gimp_value_array_index (args, 2));
+ x1 = g_value_get_double (gimp_value_array_index (args, 3));
+ y1 = g_value_get_double (gimp_value_array_index (args, 4));
+ x2 = g_value_get_double (gimp_value_array_index (args, 5));
+ y2 = g_value_get_double (gimp_value_array_index (args, 6));
+ x3 = g_value_get_double (gimp_value_array_index (args, 7));
+ y3 = g_value_get_double (gimp_value_array_index (args, 8));
+ interpolate = g_value_get_boolean (gimp_value_array_index (args, 9));
+ clip_result = g_value_get_enum (gimp_value_array_index (args, 10));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_perspective (&matrix,
+ x, y, width, height,
+ x0, y0, x1, y1,
+ x2, y2, x3, y3);
+
+ if (interpolate)
+ interpolation_type = gimp->config->interpolation_type;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Perspective"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_rotate_simple_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 rotate_type;
+ gboolean auto_center;
+ gint32 center_x;
+ gint32 center_y;
+ gboolean clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ rotate_type = g_value_get_enum (gimp_value_array_index (args, 1));
+ auto_center = g_value_get_boolean (gimp_value_array_index (args, 2));
+ center_x = g_value_get_int (gimp_value_array_index (args, 3));
+ center_y = g_value_get_int (gimp_value_array_index (args, 4));
+ clip_result = g_value_get_boolean (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ gdouble cx = center_x;
+ gdouble cy = center_y;
+
+ gimp_transform_get_rotate_center (x, y, width, height,
+ auto_center, &cx, &cy);
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_rotate (drawable, context,
+ rotate_type, cx, cy,
+ clip_result))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_rotate (GIMP_ITEM (drawable), context,
+ rotate_type, cx, cy,
+ clip_result);
+ }
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_rotate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gdouble angle;
+ gboolean auto_center;
+ gint32 center_x;
+ gint32 center_y;
+ gint32 transform_direction;
+ gint32 interpolation;
+ gint32 clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ angle = g_value_get_double (gimp_value_array_index (args, 1));
+ auto_center = g_value_get_boolean (gimp_value_array_index (args, 2));
+ center_x = g_value_get_int (gimp_value_array_index (args, 3));
+ center_y = g_value_get_int (gimp_value_array_index (args, 4));
+ transform_direction = g_value_get_enum (gimp_value_array_index (args, 5));
+ interpolation = g_value_get_enum (gimp_value_array_index (args, 6));
+ clip_result = g_value_get_enum (gimp_value_array_index (args, 9));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION,
+ error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ if (auto_center)
+ gimp_transform_matrix_rotate_rect (&matrix,
+ x, y, width, height, angle);
+ else
+ gimp_transform_matrix_rotate_center (&matrix,
+ center_x, center_y, angle);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Rotating"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, transform_direction,
+ interpolation,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ transform_direction,
+ interpolation,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_rotate_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gdouble angle;
+ gboolean auto_center;
+ gint32 center_x;
+ gint32 center_y;
+ gboolean interpolate;
+ gint32 clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ angle = g_value_get_double (gimp_value_array_index (args, 1));
+ auto_center = g_value_get_boolean (gimp_value_array_index (args, 2));
+ center_x = g_value_get_int (gimp_value_array_index (args, 3));
+ center_y = g_value_get_int (gimp_value_array_index (args, 4));
+ interpolate = g_value_get_boolean (gimp_value_array_index (args, 5));
+ clip_result = g_value_get_enum (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ if (auto_center)
+ gimp_transform_matrix_rotate_rect (&matrix,
+ x, y, width, height, angle);
+ else
+ gimp_transform_matrix_rotate_center (&matrix,
+ center_x, center_y, angle);
+
+ if (interpolate)
+ interpolation_type = gimp->config->interpolation_type;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Rotating"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_scale_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gdouble x0;
+ gdouble y0;
+ gdouble x1;
+ gdouble y1;
+ gint32 transform_direction;
+ gint32 interpolation;
+ gint32 clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ x0 = g_value_get_double (gimp_value_array_index (args, 1));
+ y0 = g_value_get_double (gimp_value_array_index (args, 2));
+ x1 = g_value_get_double (gimp_value_array_index (args, 3));
+ y1 = g_value_get_double (gimp_value_array_index (args, 4));
+ transform_direction = g_value_get_enum (gimp_value_array_index (args, 5));
+ interpolation = g_value_get_enum (gimp_value_array_index (args, 6));
+ clip_result = g_value_get_enum (gimp_value_array_index (args, 9));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error) && x0 < x1 && y0 < y1);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_scale (&matrix,
+ x, y, width, height,
+ x0, y0, x1 - x0, y1 - y0);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Scaling"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, transform_direction,
+ interpolation,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ transform_direction,
+ interpolation,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_scale_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gdouble x0;
+ gdouble y0;
+ gdouble x1;
+ gdouble y1;
+ gboolean interpolate;
+ gint32 clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ x0 = g_value_get_double (gimp_value_array_index (args, 1));
+ y0 = g_value_get_double (gimp_value_array_index (args, 2));
+ x1 = g_value_get_double (gimp_value_array_index (args, 3));
+ y1 = g_value_get_double (gimp_value_array_index (args, 4));
+ interpolate = g_value_get_boolean (gimp_value_array_index (args, 5));
+ clip_result = g_value_get_enum (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error) && x0 < x1 && y0 < y1);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_scale (&matrix,
+ x, y, width, height,
+ x0, y0, x1 - x0, y1 - y0);
+
+ if (interpolate)
+ interpolation_type = gimp->config->interpolation_type;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Scaling"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_shear_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 shear_type;
+ gdouble magnitude;
+ gint32 transform_direction;
+ gint32 interpolation;
+ gint32 clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ shear_type = g_value_get_enum (gimp_value_array_index (args, 1));
+ magnitude = g_value_get_double (gimp_value_array_index (args, 2));
+ transform_direction = g_value_get_enum (gimp_value_array_index (args, 3));
+ interpolation = g_value_get_enum (gimp_value_array_index (args, 4));
+ clip_result = g_value_get_enum (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION,
+ error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_shear (&matrix,
+ x, y, width, height,
+ shear_type, magnitude);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Shearing"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, transform_direction,
+ interpolation,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ transform_direction,
+ interpolation,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_shear_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 shear_type;
+ gdouble magnitude;
+ gboolean interpolate;
+ gint32 clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ shear_type = g_value_get_enum (gimp_value_array_index (args, 1));
+ magnitude = g_value_get_double (gimp_value_array_index (args, 2));
+ interpolate = g_value_get_boolean (gimp_value_array_index (args, 3));
+ clip_result = g_value_get_enum (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_shear (&matrix,
+ x, y, width, height,
+ shear_type, magnitude);
+
+ if (interpolate)
+ interpolation_type = gimp->config->interpolation_type;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Shearing"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_2d_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gdouble source_x;
+ gdouble source_y;
+ gdouble scale_x;
+ gdouble scale_y;
+ gdouble angle;
+ gdouble dest_x;
+ gdouble dest_y;
+ gint32 transform_direction;
+ gint32 interpolation;
+ gint32 clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ source_x = g_value_get_double (gimp_value_array_index (args, 1));
+ source_y = g_value_get_double (gimp_value_array_index (args, 2));
+ scale_x = g_value_get_double (gimp_value_array_index (args, 3));
+ scale_y = g_value_get_double (gimp_value_array_index (args, 4));
+ angle = g_value_get_double (gimp_value_array_index (args, 5));
+ dest_x = g_value_get_double (gimp_value_array_index (args, 6));
+ dest_y = g_value_get_double (gimp_value_array_index (args, 7));
+ transform_direction = g_value_get_enum (gimp_value_array_index (args, 8));
+ interpolation = g_value_get_enum (gimp_value_array_index (args, 9));
+ clip_result = g_value_get_enum (gimp_value_array_index (args, 12));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION,
+ error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_matrix3_translate (&matrix, -source_x, -source_y);
+ gimp_matrix3_scale (&matrix, scale_x, scale_y);
+ gimp_matrix3_rotate (&matrix, angle);
+ gimp_matrix3_translate (&matrix, dest_x, dest_y);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("2D Transform"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, transform_direction,
+ interpolation,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ transform_direction,
+ interpolation,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_2d_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gdouble source_x;
+ gdouble source_y;
+ gdouble scale_x;
+ gdouble scale_y;
+ gdouble angle;
+ gdouble dest_x;
+ gdouble dest_y;
+ gboolean interpolate;
+ gint32 clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ source_x = g_value_get_double (gimp_value_array_index (args, 1));
+ source_y = g_value_get_double (gimp_value_array_index (args, 2));
+ scale_x = g_value_get_double (gimp_value_array_index (args, 3));
+ scale_y = g_value_get_double (gimp_value_array_index (args, 4));
+ angle = g_value_get_double (gimp_value_array_index (args, 5));
+ dest_x = g_value_get_double (gimp_value_array_index (args, 6));
+ dest_y = g_value_get_double (gimp_value_array_index (args, 7));
+ interpolate = g_value_get_boolean (gimp_value_array_index (args, 8));
+ clip_result = g_value_get_enum (gimp_value_array_index (args, 9));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_matrix3_translate (&matrix, -source_x, -source_y);
+ gimp_matrix3_scale (&matrix, scale_x, scale_y);
+ gimp_matrix3_rotate (&matrix, angle);
+ gimp_matrix3_translate (&matrix, dest_x, dest_y);
+
+ if (interpolate)
+ interpolation_type = gimp->config->interpolation_type;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("2D Transforming"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_matrix_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ 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;
+ gint32 transform_direction;
+ gint32 interpolation;
+ gint32 clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ coeff_0_0 = g_value_get_double (gimp_value_array_index (args, 1));
+ coeff_0_1 = g_value_get_double (gimp_value_array_index (args, 2));
+ coeff_0_2 = g_value_get_double (gimp_value_array_index (args, 3));
+ coeff_1_0 = g_value_get_double (gimp_value_array_index (args, 4));
+ coeff_1_1 = g_value_get_double (gimp_value_array_index (args, 5));
+ coeff_1_2 = g_value_get_double (gimp_value_array_index (args, 6));
+ coeff_2_0 = g_value_get_double (gimp_value_array_index (args, 7));
+ coeff_2_1 = g_value_get_double (gimp_value_array_index (args, 8));
+ coeff_2_2 = g_value_get_double (gimp_value_array_index (args, 9));
+ transform_direction = g_value_get_enum (gimp_value_array_index (args, 10));
+ interpolation = g_value_get_enum (gimp_value_array_index (args, 11));
+ clip_result = g_value_get_enum (gimp_value_array_index (args, 14));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION,
+ error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ matrix.coeff[0][0] = coeff_0_0;
+ matrix.coeff[0][1] = coeff_0_1;
+ matrix.coeff[0][2] = coeff_0_2;
+ matrix.coeff[1][0] = coeff_1_0;
+ matrix.coeff[1][1] = coeff_1_1;
+ matrix.coeff[1][2] = coeff_1_2;
+ matrix.coeff[2][0] = coeff_2_0;
+ matrix.coeff[2][1] = coeff_2_1;
+ matrix.coeff[2][2] = coeff_2_2;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("2D Transforming"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, transform_direction,
+ interpolation,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ transform_direction,
+ interpolation,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_transform_matrix_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ 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;
+ gint32 clip_result;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ coeff_0_0 = g_value_get_double (gimp_value_array_index (args, 1));
+ coeff_0_1 = g_value_get_double (gimp_value_array_index (args, 2));
+ coeff_0_2 = g_value_get_double (gimp_value_array_index (args, 3));
+ coeff_1_0 = g_value_get_double (gimp_value_array_index (args, 4));
+ coeff_1_1 = g_value_get_double (gimp_value_array_index (args, 5));
+ coeff_1_2 = g_value_get_double (gimp_value_array_index (args, 6));
+ coeff_2_0 = g_value_get_double (gimp_value_array_index (args, 7));
+ coeff_2_1 = g_value_get_double (gimp_value_array_index (args, 8));
+ coeff_2_2 = g_value_get_double (gimp_value_array_index (args, 9));
+ interpolate = g_value_get_boolean (gimp_value_array_index (args, 10));
+ clip_result = g_value_get_enum (gimp_value_array_index (args, 11));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ matrix.coeff[0][0] = coeff_0_0;
+ matrix.coeff[0][1] = coeff_0_1;
+ matrix.coeff[0][2] = coeff_0_2;
+ matrix.coeff[1][0] = coeff_1_0;
+ matrix.coeff[1][1] = coeff_1_1;
+ matrix.coeff[1][2] = coeff_1_2;
+ matrix.coeff[2][0] = coeff_2_0;
+ matrix.coeff[2][1] = coeff_2_1;
+ matrix.coeff[2][2] = coeff_2_2;
+
+ if (interpolate)
+ interpolation_type = gimp->config->interpolation_type;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("2D Transforming"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ clip_result, progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+void
+register_drawable_transform_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-drawable-transform-flip-simple
+ */
+ procedure = gimp_procedure_new (drawable_transform_flip_simple_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-flip-simple");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-flip-simple",
+ "Deprecated: Use 'gimp-item-transform-flip-simple' instead.",
+ "Deprecated: Use 'gimp-item-transform-flip-simple' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-flip-simple");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("flip-type",
+ "flip type",
+ "Type of flip",
+ GIMP_TYPE_ORIENTATION_TYPE,
+ GIMP_ORIENTATION_HORIZONTAL,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
+ GIMP_ORIENTATION_UNKNOWN);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("auto-center",
+ "auto center",
+ "Whether to automatically position the axis in the selection center",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("axis",
+ "axis",
+ "coord. of flip axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("clip-result",
+ "clip result",
+ "Whether to clip results",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The flipped drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-flip
+ */
+ procedure = gimp_procedure_new (drawable_transform_flip_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-flip");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-flip",
+ "Deprecated: Use 'gimp-item-transform-flip' instead.",
+ "Deprecated: Use 'gimp-item-transform-flip' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-flip");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "horz. coord. of one end of axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "vert. coord. of one end of axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "horz. coord. of other end of axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "vert. coord. of other end of axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("transform-direction",
+ "transform direction",
+ "Direction of transformation",
+ GIMP_TYPE_TRANSFORM_DIRECTION,
+ GIMP_TRANSFORM_FORWARD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "Type of interpolation",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("supersample",
+ "supersample",
+ "This parameter is ignored",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("recursion-level",
+ "recursion level",
+ "This parameter is ignored",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("clip-result",
+ "clip result",
+ "Whether to clip results",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The flipped drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-flip-default
+ */
+ procedure = gimp_procedure_new (drawable_transform_flip_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-flip-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-flip-default",
+ "Deprecated: Use 'gimp-item-transform-flip' instead.",
+ "Deprecated: Use 'gimp-item-transform-flip' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-flip");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "horz. coord. of one end of axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "vert. coord. of one end of axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "horz. coord. of other end of axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "vert. coord. of other end of axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("interpolate",
+ "interpolate",
+ "Whether to use interpolation and supersampling",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("clip-result",
+ "clip result",
+ "Whether to clip results",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The flipped drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-perspective
+ */
+ procedure = gimp_procedure_new (drawable_transform_perspective_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-perspective");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-perspective",
+ "Deprecated: Use 'gimp-item-transform-perspective' instead.",
+ "Deprecated: Use 'gimp-item-transform-perspective' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-perspective");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "The new x coordinate of upper-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "The new y coordinate of upper-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "The new x coordinate of upper-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "The new y coordinate of upper-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x2",
+ "x2",
+ "The new x coordinate of lower-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y2",
+ "y2",
+ "The new y coordinate of lower-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x3",
+ "x3",
+ "The new x coordinate of lower-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y3",
+ "y3",
+ "The new y coordinate of lower-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("transform-direction",
+ "transform direction",
+ "Direction of transformation",
+ GIMP_TYPE_TRANSFORM_DIRECTION,
+ GIMP_TRANSFORM_FORWARD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "Type of interpolation",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("supersample",
+ "supersample",
+ "This parameter is ignored",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("recursion-level",
+ "recursion level",
+ "This parameter is ignored",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("clip-result",
+ "clip result",
+ "How to clip results",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The newly mapped drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-perspective-default
+ */
+ procedure = gimp_procedure_new (drawable_transform_perspective_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-perspective-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-perspective-default",
+ "Deprecated: Use 'gimp-item-transform-perspective' instead.",
+ "Deprecated: Use 'gimp-item-transform-perspective' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-perspective");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "The new x coordinate of upper-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "The new y coordinate of upper-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "The new x coordinate of upper-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "The new y coordinate of upper-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x2",
+ "x2",
+ "The new x coordinate of lower-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y2",
+ "y2",
+ "The new y coordinate of lower-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x3",
+ "x3",
+ "The new x coordinate of lower-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y3",
+ "y3",
+ "The new y coordinate of lower-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("interpolate",
+ "interpolate",
+ "Whether to use interpolation and supersampling",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("clip-result",
+ "clip result",
+ "How to clip results",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The newly mapped drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-rotate-simple
+ */
+ procedure = gimp_procedure_new (drawable_transform_rotate_simple_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-rotate-simple");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-rotate-simple",
+ "Deprecated: Use 'gimp-item-transform-rotate-simple' instead.",
+ "Deprecated: Use 'gimp-item-transform-rotate-simple' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-rotate-simple");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("rotate-type",
+ "rotate type",
+ "Type of rotation",
+ GIMP_TYPE_ROTATION_TYPE,
+ GIMP_ROTATE_90,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("auto-center",
+ "auto center",
+ "Whether to automatically rotate around the selection center",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("center-x",
+ "center x",
+ "The hor. coordinate of the center of rotation",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("center-y",
+ "center y",
+ "The vert. coordinate of the center of rotation",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("clip-result",
+ "clip result",
+ "Whether to clip results",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The rotated drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-rotate
+ */
+ procedure = gimp_procedure_new (drawable_transform_rotate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-rotate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-rotate",
+ "Deprecated: Use 'gimp-item-transform-rotate' instead.",
+ "Deprecated: Use 'gimp-item-transform-rotate' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-rotate");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "The angle of rotation (radians)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("auto-center",
+ "auto center",
+ "Whether to automatically rotate around the selection center",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("center-x",
+ "center x",
+ "The hor. coordinate of the center of rotation",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("center-y",
+ "center y",
+ "The vert. coordinate of the center of rotation",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("transform-direction",
+ "transform direction",
+ "Direction of transformation",
+ GIMP_TYPE_TRANSFORM_DIRECTION,
+ GIMP_TRANSFORM_FORWARD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "Type of interpolation",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("supersample",
+ "supersample",
+ "This parameter is ignored",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("recursion-level",
+ "recursion level",
+ "This parameter is ignored",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("clip-result",
+ "clip result",
+ "How to clip results",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The rotated drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-rotate-default
+ */
+ procedure = gimp_procedure_new (drawable_transform_rotate_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-rotate-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-rotate-default",
+ "Deprecated: Use 'gimp-item-transform-rotate' instead.",
+ "Deprecated: Use 'gimp-item-transform-rotate' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-rotate");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "The angle of rotation (radians)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("auto-center",
+ "auto center",
+ "Whether to automatically rotate around the selection center",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("center-x",
+ "center x",
+ "The hor. coordinate of the center of rotation",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("center-y",
+ "center y",
+ "The vert. coordinate of the center of rotation",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("interpolate",
+ "interpolate",
+ "Whether to use interpolation and supersampling",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("clip-result",
+ "clip result",
+ "How to clip results",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The rotated drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-scale
+ */
+ procedure = gimp_procedure_new (drawable_transform_scale_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-scale");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-scale",
+ "Deprecated: Use 'gimp-item-transform-scale' instead.",
+ "Deprecated: Use 'gimp-item-transform-scale' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-scale");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "The new x coordinate of the upper-left corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "The new y coordinate of the upper-left corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "The new x coordinate of the lower-right corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "The new y coordinate of the lower-right corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("transform-direction",
+ "transform direction",
+ "Direction of transformation",
+ GIMP_TYPE_TRANSFORM_DIRECTION,
+ GIMP_TRANSFORM_FORWARD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "Type of interpolation",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("supersample",
+ "supersample",
+ "This parameter is ignored",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("recursion-level",
+ "recursion level",
+ "This parameter is ignored",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("clip-result",
+ "clip result",
+ "How to clip results",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The scaled drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-scale-default
+ */
+ procedure = gimp_procedure_new (drawable_transform_scale_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-scale-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-scale-default",
+ "Deprecated: Use 'gimp-item-transform-scale' instead.",
+ "Deprecated: Use 'gimp-item-transform-scale' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-scale");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "The new x coordinate of the upper-left corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "The new y coordinate of the upper-left corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "The new x coordinate of the lower-right corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "The new y coordinate of the lower-right corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("interpolate",
+ "interpolate",
+ "Whether to use interpolation and supersampling",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("clip-result",
+ "clip result",
+ "How to clip results",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The scaled drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-shear
+ */
+ procedure = gimp_procedure_new (drawable_transform_shear_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-shear");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-shear",
+ "Deprecated: Use 'gimp-item-transform-shear' instead.",
+ "Deprecated: Use 'gimp-item-transform-shear' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-shear");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("shear-type",
+ "shear type",
+ "Type of shear",
+ GIMP_TYPE_ORIENTATION_TYPE,
+ GIMP_ORIENTATION_HORIZONTAL,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
+ GIMP_ORIENTATION_UNKNOWN);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("magnitude",
+ "magnitude",
+ "The magnitude of the shear",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("transform-direction",
+ "transform direction",
+ "Direction of transformation",
+ GIMP_TYPE_TRANSFORM_DIRECTION,
+ GIMP_TRANSFORM_FORWARD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "Type of interpolation",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("supersample",
+ "supersample",
+ "This parameter is ignored",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("recursion-level",
+ "recursion level",
+ "This parameter is ignored",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("clip-result",
+ "clip result",
+ "How to clip results",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The sheared drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-shear-default
+ */
+ procedure = gimp_procedure_new (drawable_transform_shear_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-shear-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-shear-default",
+ "Deprecated: Use 'gimp-item-transform-shear' instead.",
+ "Deprecated: Use 'gimp-item-transform-shear' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-shear");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("shear-type",
+ "shear type",
+ "Type of shear",
+ GIMP_TYPE_ORIENTATION_TYPE,
+ GIMP_ORIENTATION_HORIZONTAL,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
+ GIMP_ORIENTATION_UNKNOWN);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("magnitude",
+ "magnitude",
+ "The magnitude of the shear",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("interpolate",
+ "interpolate",
+ "Whether to use interpolation and supersampling",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("clip-result",
+ "clip result",
+ "How to clip results",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The sheared drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-2d
+ */
+ procedure = gimp_procedure_new (drawable_transform_2d_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-2d");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-2d",
+ "Deprecated: Use 'gimp-item-transform-2d' instead.",
+ "Deprecated: Use 'gimp-item-transform-2d' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-2d");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("source-x",
+ "source x",
+ "X coordinate of the transformation center",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("source-y",
+ "source y",
+ "Y coordinate of the transformation center",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("scale-x",
+ "scale x",
+ "Amount to scale in x direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("scale-y",
+ "scale y",
+ "Amount to scale in y direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "The angle of rotation (radians)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("dest-x",
+ "dest x",
+ "X coordinate of where the center goes",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("dest-y",
+ "dest y",
+ "Y coordinate of where the center goes",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("transform-direction",
+ "transform direction",
+ "Direction of transformation",
+ GIMP_TYPE_TRANSFORM_DIRECTION,
+ GIMP_TRANSFORM_FORWARD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "Type of interpolation",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("supersample",
+ "supersample",
+ "This parameter is ignored",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("recursion-level",
+ "recursion level",
+ "This parameter is ignored",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("clip-result",
+ "clip result",
+ "How to clip results",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The transformed drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-2d-default
+ */
+ procedure = gimp_procedure_new (drawable_transform_2d_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-2d-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-2d-default",
+ "Deprecated: Use 'gimp-item-transform-2d' instead.",
+ "Deprecated: Use 'gimp-item-transform-2d' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-2d");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("source-x",
+ "source x",
+ "X coordinate of the transformation center",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("source-y",
+ "source y",
+ "Y coordinate of the transformation center",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("scale-x",
+ "scale x",
+ "Amount to scale in x direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("scale-y",
+ "scale y",
+ "Amount to scale in y direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "The angle of rotation (radians)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("dest-x",
+ "dest x",
+ "X coordinate of where the center goes",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("dest-y",
+ "dest y",
+ "Y coordinate of where the center goes",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("interpolate",
+ "interpolate",
+ "Whether to use interpolation and supersampling",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("clip-result",
+ "clip result",
+ "How to clip results",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The transformed drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-matrix
+ */
+ procedure = gimp_procedure_new (drawable_transform_matrix_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-matrix");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-matrix",
+ "Deprecated: Use 'gimp-item-transform-matrix' instead.",
+ "Deprecated: Use 'gimp-item-transform-matrix' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-matrix");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-0-0",
+ "coeff 0 0",
+ "coefficient (0,0) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-0-1",
+ "coeff 0 1",
+ "coefficient (0,1) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-0-2",
+ "coeff 0 2",
+ "coefficient (0,2) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-1-0",
+ "coeff 1 0",
+ "coefficient (1,0) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-1-1",
+ "coeff 1 1",
+ "coefficient (1,1) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-1-2",
+ "coeff 1 2",
+ "coefficient (1,2) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-2-0",
+ "coeff 2 0",
+ "coefficient (2,0) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-2-1",
+ "coeff 2 1",
+ "coefficient (2,1) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-2-2",
+ "coeff 2 2",
+ "coefficient (2,2) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("transform-direction",
+ "transform direction",
+ "Direction of transformation",
+ GIMP_TYPE_TRANSFORM_DIRECTION,
+ GIMP_TRANSFORM_FORWARD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "Type of interpolation",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("supersample",
+ "supersample",
+ "This parameter is ignored",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("recursion-level",
+ "recursion level",
+ "This parameter is ignored",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("clip-result",
+ "clip result",
+ "How to clip results",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The transformed drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-transform-matrix-default
+ */
+ procedure = gimp_procedure_new (drawable_transform_matrix_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-transform-matrix-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-transform-matrix-default",
+ "Deprecated: Use 'gimp-item-transform-matrix' instead.",
+ "Deprecated: Use 'gimp-item-transform-matrix' instead.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2004",
+ "gimp-item-transform-matrix");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-0-0",
+ "coeff 0 0",
+ "coefficient (0,0) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-0-1",
+ "coeff 0 1",
+ "coefficient (0,1) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-0-2",
+ "coeff 0 2",
+ "coefficient (0,2) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-1-0",
+ "coeff 1 0",
+ "coefficient (1,0) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-1-1",
+ "coeff 1 1",
+ "coefficient (1,1) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-1-2",
+ "coeff 1 2",
+ "coefficient (1,2) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-2-0",
+ "coeff 2 0",
+ "coefficient (2,0) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-2-1",
+ "coeff 2 1",
+ "coefficient (2,1) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-2-2",
+ "coeff 2 2",
+ "coefficient (2,2) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("interpolate",
+ "interpolate",
+ "Whether to use interpolation and supersampling",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("clip-result",
+ "clip result",
+ "How to clip results",
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The transformed drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/dynamics-cmds.c b/app/pdb/dynamics-cmds.c
new file mode 100644
index 0000000..e071afa
--- /dev/null
+++ b/app/pdb/dynamics-cmds.c
@@ -0,0 +1,144 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontainer-filter.h"
+#include "core/gimpcontainer.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+dynamics_refresh_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_data_factory_data_refresh (gimp->dynamics_factory, context);
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+dynamics_get_list_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *filter;
+ gint32 num_dynamics = 0;
+ gchar **dynamics_list = NULL;
+
+ filter = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ dynamics_list = gimp_container_get_filtered_name_array (gimp_data_factory_get_container (gimp->dynamics_factory),
+ filter, &num_dynamics);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_dynamics);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), dynamics_list, num_dynamics);
+ }
+
+ return return_vals;
+}
+
+void
+register_dynamics_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-dynamics-refresh
+ */
+ procedure = gimp_procedure_new (dynamics_refresh_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-dynamics-refresh");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-dynamics-get-list
+ */
+ procedure = gimp_procedure_new (dynamics_get_list_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-dynamics-get-list");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-dynamics-get-list",
+ "Retrieve the list of loaded paint dynamics.",
+ "This procedure returns a list of the paint dynamics that are currently available.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filter",
+ "filter",
+ "An optional regular expression used to filter the list",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-dynamics",
+ "num dynamics",
+ "The number of available paint dynamics",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("dynamics-list",
+ "dynamics list",
+ "The list of paint dynamics names",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/edit-cmds.c b/app/pdb/edit-cmds.c
new file mode 100644
index 0000000..04468b0
--- /dev/null
+++ b/app/pdb/edit-cmds.c
@@ -0,0 +1,1653 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpconfig/gimpconfig.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp-edit.h"
+#include "core/gimp-gradients.h"
+#include "core/gimp.h"
+#include "core/gimpbuffer.h"
+#include "core/gimpchannel.h"
+#include "core/gimpdrawable-bucket-fill.h"
+#include "core/gimpdrawable-edit.h"
+#include "core/gimpdrawable-gradient.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
+#include "core/gimplayer.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimpprogress.h"
+#include "core/gimpstrokeoptions.h"
+#include "vectors/gimpvectors.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+edit_cut_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean non_empty = FALSE;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GError *my_error = NULL;
+
+ non_empty = gimp_edit_cut (image, drawable, context, &my_error) != NULL;
+
+ if (! non_empty)
+ {
+ gimp_message_literal (gimp,
+ G_OBJECT (progress), GIMP_MESSAGE_WARNING,
+ my_error->message);
+ g_clear_error (&my_error);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), non_empty);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+edit_copy_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean non_empty = FALSE;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GError *my_error = NULL;
+
+ non_empty = gimp_edit_copy (image, drawable, context, &my_error) != NULL;
+
+ if (! non_empty)
+ {
+ gimp_message_literal (gimp,
+ G_OBJECT (progress), GIMP_MESSAGE_WARNING,
+ my_error->message);
+ g_clear_error (&my_error);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), non_empty);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+edit_copy_visible_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gboolean non_empty = FALSE;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GError *my_error = NULL;
+
+ non_empty = gimp_edit_copy_visible (image, context, &my_error) != NULL;
+
+ if (! non_empty)
+ {
+ gimp_message_literal (gimp,
+ G_OBJECT (progress), GIMP_MESSAGE_WARNING,
+ my_error->message);
+ g_clear_error (&my_error);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), non_empty);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+edit_paste_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean paste_into;
+ GimpLayer *floating_sel = NULL;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ paste_into = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpObject *paste = gimp_get_clipboard_object (gimp);
+
+ if (paste &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ floating_sel = gimp_edit_paste (gimp_item_get_image (GIMP_ITEM (drawable)),
+ drawable, paste,
+ paste_into ?
+ GIMP_PASTE_TYPE_FLOATING_INTO :
+ GIMP_PASTE_TYPE_FLOATING,
+ -1, -1, -1, -1);
+
+ if (! floating_sel)
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), floating_sel);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+edit_paste_as_new_image_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image = NULL;
+
+ GimpObject *paste = gimp_get_clipboard_object (gimp);
+
+ if (paste)
+ {
+ image = gimp_edit_paste_as_new_image (gimp, paste);
+
+ if (! image)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_image (gimp_value_array_index (return_vals, 1), image);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+edit_named_cut_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ const gchar *buffer_name;
+ gchar *real_name = NULL;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ buffer_name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GError *my_error = NULL;
+
+ real_name = (gchar *) gimp_edit_named_cut (image, buffer_name,
+ drawable, context, &my_error);
+
+ if (real_name)
+ {
+ real_name = g_strdup (real_name);
+ }
+ else
+ {
+ gimp_message_literal (gimp,
+ G_OBJECT (progress), GIMP_MESSAGE_WARNING,
+ my_error->message);
+ g_clear_error (&my_error);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), real_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+edit_named_copy_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ const gchar *buffer_name;
+ gchar *real_name = NULL;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ buffer_name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GError *my_error = NULL;
+
+ real_name = (gchar *) gimp_edit_named_copy (image, buffer_name,
+ drawable, context, &my_error);
+
+ if (real_name)
+ {
+ real_name = g_strdup (real_name);
+ }
+ else
+ {
+ gimp_message_literal (gimp,
+ G_OBJECT (progress), GIMP_MESSAGE_WARNING,
+ my_error->message);
+ g_clear_error (&my_error);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), real_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+edit_named_copy_visible_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ const gchar *buffer_name;
+ gchar *real_name = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ buffer_name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GError *my_error = NULL;
+
+ real_name = (gchar *) gimp_edit_named_copy_visible (image, buffer_name,
+ context, &my_error);
+
+ if (real_name)
+ {
+ real_name = g_strdup (real_name);
+ }
+ else
+ {
+ gimp_message_literal (gimp,
+ G_OBJECT (progress), GIMP_MESSAGE_WARNING,
+ my_error->message);
+ g_clear_error (&my_error);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), real_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+edit_named_paste_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ const gchar *buffer_name;
+ gboolean paste_into;
+ GimpLayer *floating_sel = NULL;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ buffer_name = g_value_get_string (gimp_value_array_index (args, 1));
+ paste_into = g_value_get_boolean (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
+
+ if (buffer &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ floating_sel = gimp_edit_paste (gimp_item_get_image (GIMP_ITEM (drawable)),
+ drawable, GIMP_OBJECT (buffer),
+ paste_into ?
+ GIMP_PASTE_TYPE_FLOATING_INTO :
+ GIMP_PASTE_TYPE_FLOATING,
+ -1, -1, -1, -1);
+ if (! floating_sel)
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), floating_sel);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+edit_named_paste_as_new_image_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *buffer_name;
+ GimpImage *image = NULL;
+
+ buffer_name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
+
+ if (buffer)
+ {
+ image = gimp_edit_paste_as_new_image (gimp, GIMP_OBJECT (buffer));
+
+ if (! image)
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_image (gimp_value_array_index (return_vals, 1), image);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+edit_clear_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ gimp_drawable_edit_clear (drawable, context);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+edit_fill_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 fill_type;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ fill_type = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
+
+ if (gimp_fill_options_set_by_fill_type (options, context,
+ fill_type, error))
+ {
+ gimp_drawable_edit_fill (drawable, options, NULL);
+ }
+ else
+ success = FALSE;
+
+ g_object_unref (options);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+edit_bucket_fill_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 fill_mode;
+ gint32 paint_mode;
+ gdouble opacity;
+ gdouble threshold;
+ gboolean sample_merged;
+ gdouble x;
+ gdouble y;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ fill_mode = g_value_get_enum (gimp_value_array_index (args, 1));
+ paint_mode = g_value_get_enum (gimp_value_array_index (args, 2));
+ opacity = g_value_get_double (gimp_value_array_index (args, 3));
+ threshold = g_value_get_double (gimp_value_array_index (args, 4));
+ sample_merged = g_value_get_boolean (gimp_value_array_index (args, 5));
+ x = g_value_get_double (gimp_value_array_index (args, 6));
+ y = g_value_get_double (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
+
+ if (gimp_fill_options_set_by_fill_mode (options, context,
+ fill_mode, error))
+ {
+ if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
+ paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
+
+ gimp_context_set_opacity (GIMP_CONTEXT (options), opacity / 100.0);
+ gimp_context_set_paint_mode (GIMP_CONTEXT (options), paint_mode);
+
+ if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
+ {
+ gimp_drawable_edit_fill (drawable, options, NULL);
+ }
+ else
+ {
+ gimp_drawable_bucket_fill (drawable, options,
+ FALSE /* don't fill transparent */,
+ GIMP_SELECT_CRITERION_COMPOSITE,
+ threshold / 255.0,
+ sample_merged,
+ FALSE /* no diagonal neighbors */,
+ x, y);
+ }
+ }
+ else
+ success = FALSE;
+
+ g_object_unref (options);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+edit_bucket_fill_full_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 fill_mode;
+ gint32 paint_mode;
+ gdouble opacity;
+ gdouble threshold;
+ gboolean sample_merged;
+ gboolean fill_transparent;
+ gint32 select_criterion;
+ gdouble x;
+ gdouble y;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ fill_mode = g_value_get_enum (gimp_value_array_index (args, 1));
+ paint_mode = g_value_get_enum (gimp_value_array_index (args, 2));
+ opacity = g_value_get_double (gimp_value_array_index (args, 3));
+ threshold = g_value_get_double (gimp_value_array_index (args, 4));
+ sample_merged = g_value_get_boolean (gimp_value_array_index (args, 5));
+ fill_transparent = g_value_get_boolean (gimp_value_array_index (args, 6));
+ select_criterion = g_value_get_enum (gimp_value_array_index (args, 7));
+ x = g_value_get_double (gimp_value_array_index (args, 8));
+ y = g_value_get_double (gimp_value_array_index (args, 9));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
+
+ if (gimp_fill_options_set_by_fill_mode (options, context,
+ fill_mode, error))
+ {
+ if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
+ paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
+
+ gimp_context_set_opacity (GIMP_CONTEXT (options), opacity / 100.0);
+ gimp_context_set_paint_mode (GIMP_CONTEXT (options), paint_mode);
+
+ if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
+ {
+ gimp_drawable_edit_fill (drawable, options, NULL);
+ }
+ else
+ {
+ gimp_drawable_bucket_fill (drawable, options,
+ fill_transparent,
+ select_criterion,
+ threshold / 255.0,
+ sample_merged,
+ FALSE /* no diagonal neighbors */,
+ x, y);
+ }
+ }
+ else
+ success = FALSE;
+
+ g_object_unref (options);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+edit_blend_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 blend_mode;
+ gint32 paint_mode;
+ gint32 gradient_type;
+ gdouble opacity;
+ gdouble offset;
+ gint32 repeat;
+ gboolean reverse;
+ gboolean supersample;
+ gint32 max_depth;
+ gdouble threshold;
+ gboolean dither;
+ gdouble x1;
+ gdouble y1;
+ gdouble x2;
+ gdouble y2;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ blend_mode = g_value_get_enum (gimp_value_array_index (args, 1));
+ paint_mode = g_value_get_enum (gimp_value_array_index (args, 2));
+ gradient_type = g_value_get_enum (gimp_value_array_index (args, 3));
+ opacity = g_value_get_double (gimp_value_array_index (args, 4));
+ offset = g_value_get_double (gimp_value_array_index (args, 5));
+ repeat = g_value_get_enum (gimp_value_array_index (args, 6));
+ reverse = g_value_get_boolean (gimp_value_array_index (args, 7));
+ supersample = g_value_get_boolean (gimp_value_array_index (args, 8));
+ max_depth = g_value_get_int (gimp_value_array_index (args, 9));
+ threshold = g_value_get_double (gimp_value_array_index (args, 10));
+ dither = g_value_get_boolean (gimp_value_array_index (args, 11));
+ x1 = g_value_get_double (gimp_value_array_index (args, 12));
+ y1 = g_value_get_double (gimp_value_array_index (args, 13));
+ x2 = g_value_get_double (gimp_value_array_index (args, 14));
+ y2 = g_value_get_double (gimp_value_array_index (args, 15));
+
+ if (success)
+ {
+ success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error));
+
+ if (success)
+ {
+ if (supersample)
+ {
+ if (max_depth < 1 || max_depth > 9)
+ success = FALSE;
+
+ if (threshold < 0.0 || threshold > 4.0)
+ success = FALSE;
+ }
+ else
+ {
+ max_depth = CLAMP (max_depth, 1, 9);
+ threshold = CLAMP (threshold, 0.0, 4.0);
+ }
+ }
+
+ if (success)
+ {
+ GimpGradient *gradient;
+
+ if (paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
+ paint_mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Gradient"));
+
+ switch (blend_mode)
+ {
+ case GIMP_BLEND_FG_BG_RGB:
+ gradient = gimp_gradients_get_fg_bg_rgb (context->gimp);
+ break;
+
+ case GIMP_BLEND_FG_BG_HSV:
+ gradient = gimp_gradients_get_fg_bg_hsv_cw (context->gimp);
+ break;
+
+ case GIMP_BLEND_FG_TRANSPARENT:
+ gradient = gimp_gradients_get_fg_transparent (context->gimp);
+ break;
+
+ case GIMP_BLEND_CUSTOM:
+ default:
+ gradient = gimp_context_get_gradient (context);
+ break;
+ }
+
+ gimp_drawable_gradient (drawable,
+ context,
+ gradient,
+ GIMP_PDB_CONTEXT (context)->distance_metric,
+ paint_mode,
+ gradient_type,
+ opacity / 100.0,
+ offset, repeat, reverse,
+ GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
+ supersample, max_depth,
+ threshold, dither,
+ x1, y1, x2, y2,
+ progress);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+edit_stroke_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpStrokeOptions *options;
+ GimpPaintOptions *paint_options;
+
+ options = gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ paint_options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context), NULL);
+ paint_options = gimp_config_duplicate (GIMP_CONFIG (paint_options));
+
+ success = gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
+ drawable, context, options, paint_options,
+ TRUE, progress, error);
+
+ g_object_unref (paint_options);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+edit_stroke_vectors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ GimpVectors *vectors;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (vectors),
+ gimp_item_get_image (GIMP_ITEM (drawable)),
+ 0, error))
+ {
+ GimpStrokeOptions *options;
+ GimpPaintOptions *paint_options;
+
+ options = gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+ paint_options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context), NULL);
+ paint_options = gimp_config_duplicate (GIMP_CONFIG (paint_options));
+
+ success = gimp_item_stroke (GIMP_ITEM (vectors),
+ drawable, context, options, paint_options,
+ TRUE, progress, error);
+
+ g_object_unref (paint_options);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_edit_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-edit-cut
+ */
+ procedure = gimp_procedure_new (edit_cut_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-cut");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-cut",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to cut from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("non-empty",
+ "non empty",
+ "TRUE if the cut was successful, FALSE if there was nothing to copy from",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-copy
+ */
+ procedure = gimp_procedure_new (edit_copy_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-copy");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-copy",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to copy from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("non-empty",
+ "non empty",
+ "TRUE if the cut was successful, FALSE if there was nothing to copy from",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-copy-visible
+ */
+ procedure = gimp_procedure_new (edit_copy_visible_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-copy-visible");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-copy-visible",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image to copy from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("non-empty",
+ "non empty",
+ "TRUE if the copy was successful",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-paste
+ */
+ procedure = gimp_procedure_new (edit_paste_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-paste");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-paste",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to paste to",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("paste-into",
+ "paste into",
+ "Clear selection, or paste behind it?",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("floating-sel",
+ "floating sel",
+ "The new floating selection",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-paste-as-new-image
+ */
+ procedure = gimp_procedure_new (edit_paste_as_new_image_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-paste-as-new-image");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The new image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-named-cut
+ */
+ procedure = gimp_procedure_new (edit_named_cut_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-named-cut");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-named-cut",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to cut from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("buffer-name",
+ "buffer name",
+ "The name of the buffer to create",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("real-name",
+ "real name",
+ "The real name given to the buffer, or NULL if the cut failed",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-named-copy
+ */
+ procedure = gimp_procedure_new (edit_named_copy_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-named-copy");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-named-copy",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to copy from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("buffer-name",
+ "buffer name",
+ "The name of the buffer to create",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("real-name",
+ "real name",
+ "The real name given to the buffer, or NULL if the copy failed",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-named-copy-visible
+ */
+ procedure = gimp_procedure_new (edit_named_copy_visible_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-named-copy-visible");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-named-copy-visible",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image to copy from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("buffer-name",
+ "buffer name",
+ "The name of the buffer to create",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("real-name",
+ "real name",
+ "The real name given to the buffer, or NULL if the copy failed",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-named-paste
+ */
+ procedure = gimp_procedure_new (edit_named_paste_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-named-paste");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-named-paste",
+ "Paste named buffer to the specified drawable.",
+ "This procedure works like 'gimp-edit-paste' but pastes a named buffer instead of the global buffer.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to paste to",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("buffer-name",
+ "buffer name",
+ "The name of the buffer to paste",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("paste-into",
+ "paste into",
+ "Clear selection, or paste behind it?",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("floating-sel",
+ "floating sel",
+ "The new floating selection",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-named-paste-as-new-image
+ */
+ procedure = gimp_procedure_new (edit_named_paste_as_new_image_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-named-paste-as-new-image");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-named-paste-as-new-image",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("buffer-name",
+ "buffer name",
+ "The name of the buffer to paste",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The new image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-clear
+ */
+ procedure = gimp_procedure_new (edit_clear_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-clear");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-clear",
+ "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.\n"
+ "\n"
+ "Deprecated: Use 'gimp-drawable-edit-clear' instead.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ "gimp-drawable-edit-clear");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to clear from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-fill
+ */
+ procedure = gimp_procedure_new (edit_fill_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-fill");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-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'.\n"
+ "\n"
+ "Deprecated: Use 'gimp-drawable-edit-fill' instead.",
+ "Spencer Kimball & Peter Mattis & Raphael Quinet",
+ "Spencer Kimball & Peter Mattis",
+ "1995-2000",
+ "gimp-drawable-edit-fill");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to fill to",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("fill-type",
+ "fill type",
+ "The type of fill",
+ GIMP_TYPE_FILL_TYPE,
+ GIMP_FILL_FOREGROUND,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-bucket-fill
+ */
+ procedure = gimp_procedure_new (edit_bucket_fill_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-bucket-fill");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-bucket-fill",
+ "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.\n"
+ "\n"
+ "Deprecated: Use 'gimp-drawable-edit-bucket-fill' instead.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ "gimp-drawable-edit-bucket-fill");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("fill-mode",
+ "fill mode",
+ "The type of fill",
+ GIMP_TYPE_BUCKET_FILL_MODE,
+ GIMP_BUCKET_FILL_FG,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("paint-mode",
+ "paint mode",
+ "The paint application mode",
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The opacity of the final bucket fill",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("threshold",
+ "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.",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("sample-merged",
+ "sample merged",
+ "Use the composite image, not the drawable",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "The x coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "The y coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-bucket-fill-full
+ */
+ procedure = gimp_procedure_new (edit_bucket_fill_full_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-bucket-fill-full");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-bucket-fill-full",
+ "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.\n"
+ "\n"
+ "Deprecated: Use 'gimp-drawable-edit-bucket-fill' instead.",
+ "David Gowers",
+ "David Gowers",
+ "2006",
+ "gimp-drawable-edit-bucket-fill");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("fill-mode",
+ "fill mode",
+ "The type of fill",
+ GIMP_TYPE_BUCKET_FILL_MODE,
+ GIMP_BUCKET_FILL_FG,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("paint-mode",
+ "paint mode",
+ "The paint application mode",
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The opacity of the final bucket fill",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("threshold",
+ "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.",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("sample-merged",
+ "sample merged",
+ "Use the composite image, not the drawable",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("fill-transparent",
+ "fill transparent",
+ "Whether to consider transparent pixels for filling. If TRUE, transparency is considered as a unique fillable color.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("select-criterion",
+ "select criterion",
+ "The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.",
+ GIMP_TYPE_SELECT_CRITERION,
+ GIMP_SELECT_CRITERION_COMPOSITE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "The x coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "The y coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-blend
+ */
+ procedure = gimp_procedure_new (edit_blend_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-blend");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-blend",
+ "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'.\n"
+ "\n"
+ "Deprecated: Use 'gimp-drawable-edit-gradient-fill' instead.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ "gimp-drawable-edit-gradient-fill");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("blend-mode",
+ "blend mode",
+ "The type of blend",
+ GIMP_TYPE_BLEND_MODE,
+ GIMP_BLEND_FG_BG_RGB,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("paint-mode",
+ "paint mode",
+ "The paint application mode",
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("gradient-type",
+ "gradient type",
+ "The type of gradient",
+ GIMP_TYPE_GRADIENT_TYPE,
+ GIMP_GRADIENT_LINEAR,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The opacity of the final blend",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("offset",
+ "offset",
+ "Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode dependent.",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("repeat",
+ "repeat",
+ "Repeat mode",
+ GIMP_TYPE_REPEAT_MODE,
+ GIMP_REPEAT_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("reverse",
+ "reverse",
+ "Use the reverse gradient",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("supersample",
+ "supersample",
+ "Do adaptive supersampling",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("max-depth",
+ "max depth",
+ "Maximum recursion levels for supersampling",
+ 1, 9, 1,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("threshold",
+ "threshold",
+ "Supersampling threshold",
+ 0, 4, 0,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("dither",
+ "dither",
+ "Use dithering to reduce banding",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "The x coordinate of this blend's starting point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "The y coordinate of this blend's starting point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x2",
+ "x2",
+ "The x coordinate of this blend's ending point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y2",
+ "y2",
+ "The y coordinate of this blend's ending point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-stroke
+ */
+ procedure = gimp_procedure_new (edit_stroke_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-stroke");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-stroke",
+ "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.\n"
+ "\n"
+ "Deprecated: Use 'gimp-drawable-edit-stroke-selection' instead.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ "gimp-drawable-edit-stroke-selection");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to stroke to",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-edit-stroke-vectors
+ */
+ procedure = gimp_procedure_new (edit_stroke_vectors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-edit-stroke-vectors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-edit-stroke-vectors",
+ "Stroke the specified vectors object",
+ "This procedure strokes the specified vectors object, painting along the path with the active brush and foreground color.\n"
+ "\n"
+ "Deprecated: Use 'gimp-drawable-edit-stroke-item' instead.",
+ "Simon Budig",
+ "Simon Budig",
+ "2006",
+ "gimp-drawable-edit-stroke-item");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to stroke to",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/fileops-cmds.c b/app/pdb/fileops-cmds.c
new file mode 100644
index 0000000..f50d345
--- /dev/null
+++ b/app/pdb/fileops-cmds.c
@@ -0,0 +1,1184 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpconfig/gimpconfig.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp-utils.h"
+#include "core/gimp.h"
+#include "core/gimpimage.h"
+#include "core/gimplayer.h"
+#include "core/gimpparamspecs.h"
+#include "file/file-open.h"
+#include "file/file-save.h"
+#include "file/file-utils.h"
+#include "plug-in/gimppluginmanager-file.h"
+#include "plug-in/gimppluginprocedure.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+file_load_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *new_args;
+ GimpValueArray *return_vals;
+ GimpPlugInProcedure *file_proc;
+ GimpProcedure *proc;
+ GFile *file;
+ gint i;
+
+ file = file_utils_filename_to_file (gimp,
+ g_value_get_string (gimp_value_array_index (args, 1)),
+ error);
+
+ if (! file)
+ return gimp_procedure_get_return_values (procedure, FALSE,
+ error ? *error : NULL);
+
+ file_proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+ GIMP_FILE_PROCEDURE_GROUP_OPEN,
+ file, error);
+
+ if (! file_proc)
+ {
+ g_object_unref (file);
+
+ return gimp_procedure_get_return_values (procedure, FALSE,
+ error ? *error : NULL);
+ }
+
+ proc = GIMP_PROCEDURE (file_proc);
+
+ new_args = gimp_procedure_get_arguments (proc);
+
+ g_value_transform (gimp_value_array_index (args, 0),
+ gimp_value_array_index (new_args, 0));
+
+ if (file_proc->handles_uri)
+ g_value_take_string (gimp_value_array_index (new_args, 1),
+ g_file_get_uri (file));
+ else
+ g_value_transform (gimp_value_array_index (args, 1),
+ gimp_value_array_index (new_args, 1));
+
+ g_value_transform (gimp_value_array_index (args, 2),
+ gimp_value_array_index (new_args, 2));
+
+ for (i = 3; i < proc->num_args; i++)
+ if (G_IS_PARAM_SPEC_STRING (proc->args[i]))
+ g_value_set_static_string (gimp_value_array_index (new_args, i), "");
+
+ return_vals =
+ gimp_pdb_execute_procedure_by_name_args (gimp->pdb,
+ context, progress, error,
+ gimp_object_get_name (proc),
+ new_args);
+
+ gimp_value_array_unref (new_args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) ==
+ GIMP_PDB_SUCCESS)
+ {
+ if (gimp_value_array_length (return_vals) > 1 &&
+ GIMP_VALUE_HOLDS_IMAGE_ID (gimp_value_array_index (return_vals, 1)))
+ {
+ GimpImage *image =
+ gimp_value_get_image (gimp_value_array_index (return_vals, 1),
+ gimp);
+ gimp_image_set_load_proc (image, file_proc);
+ }
+ }
+
+ g_object_unref (file);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+file_load_layer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gint32 run_mode;
+ GimpImage *image;
+ const gchar *filename;
+ GimpLayer *layer = NULL;
+
+ run_mode = g_value_get_enum (gimp_value_array_index (args, 0));
+ image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+ filename = g_value_get_string (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GFile *file = file_utils_filename_to_file (gimp, filename, error);
+
+ if (file)
+ {
+ GList *layers;
+ GimpPDBStatusType status;
+
+ layers = file_open_layers (gimp, context, progress,
+ image, FALSE,
+ file, run_mode, NULL, &status, error);
+
+ g_object_unref (file);
+
+ if (layers)
+ {
+ layer = layers->data;
+ g_list_free (layers);
+ }
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+file_load_layers_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gint32 run_mode;
+ GimpImage *image;
+ const gchar *filename;
+ gint32 num_layers = 0;
+ gint32 *layer_ids = NULL;
+
+ run_mode = g_value_get_enum (gimp_value_array_index (args, 0));
+ image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+ filename = g_value_get_string (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GFile *file = file_utils_filename_to_file (gimp, filename, error);
+
+ if (file)
+ {
+ GList *layers;
+ GimpPDBStatusType status;
+
+ layers = file_open_layers (gimp, context, progress,
+ image, FALSE,
+ file, run_mode, NULL, &status, error);
+
+ g_object_unref (file);
+
+ if (layers)
+ {
+ GList *list;
+ gint i;
+
+ num_layers = g_list_length (layers);
+
+ layer_ids = g_new (gint32, num_layers);
+
+ for (i = 0, list = layers;
+ i < num_layers;
+ i++, list = g_list_next (list))
+ layer_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
+
+ g_list_free (layers);
+ }
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_layers);
+ gimp_value_take_int32array (gimp_value_array_index (return_vals, 2), layer_ids, num_layers);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+file_save_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *new_args;
+ GimpValueArray *return_vals;
+ GimpPlugInProcedure *file_proc;
+ GimpProcedure *proc;
+ GFile *file;
+ gint i;
+
+ file = file_utils_filename_to_file (gimp,
+ g_value_get_string (gimp_value_array_index (args, 3)),
+ error);
+
+ if (! file)
+ return gimp_procedure_get_return_values (procedure, FALSE,
+ error ? *error : NULL);
+
+ file_proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+ GIMP_FILE_PROCEDURE_GROUP_SAVE,
+ file, NULL);
+
+ if (! file_proc)
+ file_proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+ GIMP_FILE_PROCEDURE_GROUP_EXPORT,
+ file, error);
+
+ if (! file_proc)
+ {
+ g_object_unref (file);
+
+ return gimp_procedure_get_return_values (procedure, FALSE,
+ error ? *error : NULL);
+ }
+
+ proc = GIMP_PROCEDURE (file_proc);
+
+ new_args = gimp_procedure_get_arguments (proc);
+
+ g_value_transform (gimp_value_array_index (args, 0),
+ gimp_value_array_index (new_args, 0));
+ g_value_transform (gimp_value_array_index (args, 1),
+ gimp_value_array_index (new_args, 1));
+ g_value_transform (gimp_value_array_index (args, 2),
+ gimp_value_array_index (new_args, 2));
+
+ if (file_proc->handles_uri)
+ g_value_take_string (gimp_value_array_index (new_args, 3),
+ g_file_get_uri (file));
+ else
+ g_value_transform (gimp_value_array_index (args, 3),
+ gimp_value_array_index (new_args, 3));
+
+ g_value_transform (gimp_value_array_index (args, 4),
+ gimp_value_array_index (new_args, 4));
+
+ for (i = 5; i < proc->num_args; i++)
+ if (G_IS_PARAM_SPEC_STRING (proc->args[i]))
+ g_value_set_static_string (gimp_value_array_index (new_args, i), "");
+
+ return_vals =
+ gimp_pdb_execute_procedure_by_name_args (gimp->pdb,
+ context, progress, error,
+ gimp_object_get_name (proc),
+ new_args);
+
+ gimp_value_array_unref (new_args);
+
+ g_object_unref (file);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+file_load_thumbnail_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *filename;
+ gint32 width = 0;
+ gint32 height = 0;
+ gint32 thumb_data_count = 0;
+ guint8 *thumb_data = NULL;
+
+ filename = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GdkPixbuf *pixbuf = file_utils_load_thumbnail (filename);
+
+ if (pixbuf)
+ {
+ width = gdk_pixbuf_get_width (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+ thumb_data_count = 3 * width * height;
+ thumb_data = g_memdup (gdk_pixbuf_get_pixels (pixbuf),
+ thumb_data_count);
+
+ g_object_unref (pixbuf);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), width);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), height);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), thumb_data_count);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 4), thumb_data, thumb_data_count);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+file_save_thumbnail_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *filename;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ filename = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ success = file_utils_save_thumbnail (image, filename);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+register_magic_load_handler_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *procedure_name;
+ const gchar *extensions;
+ const gchar *prefixes;
+ const gchar *magics;
+
+ procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+ extensions = g_value_get_string (gimp_value_array_index (args, 1));
+ prefixes = g_value_get_string (gimp_value_array_index (args, 2));
+ magics = g_value_get_string (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ gchar *canonical = gimp_canonicalize_identifier (procedure_name);
+
+ success = gimp_plug_in_manager_register_load_handler (gimp->plug_in_manager,
+ canonical,
+ extensions, prefixes, magics);
+
+ g_free (canonical);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+register_load_handler_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *procedure_name;
+ const gchar *extensions;
+ const gchar *prefixes;
+
+ procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+ extensions = g_value_get_string (gimp_value_array_index (args, 1));
+ prefixes = g_value_get_string (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ gchar *canonical = gimp_canonicalize_identifier (procedure_name);
+
+ success = gimp_plug_in_manager_register_load_handler (gimp->plug_in_manager,
+ canonical,
+ extensions, prefixes, NULL);
+
+ g_free (canonical);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+register_save_handler_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *procedure_name;
+ const gchar *extensions;
+ const gchar *prefixes;
+
+ procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+ extensions = g_value_get_string (gimp_value_array_index (args, 1));
+ prefixes = g_value_get_string (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ gchar *canonical = gimp_canonicalize_identifier (procedure_name);
+
+ success = gimp_plug_in_manager_register_save_handler (gimp->plug_in_manager,
+ canonical,
+ extensions, prefixes);
+
+ g_free (canonical);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+register_file_handler_priority_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *procedure_name;
+ gint32 priority;
+
+ procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+ priority = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gchar *canonical = gimp_canonicalize_identifier (procedure_name);
+
+ success = gimp_plug_in_manager_register_priority (gimp->plug_in_manager,
+ canonical, priority);
+
+ g_free (canonical);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+register_file_handler_mime_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *procedure_name;
+ const gchar *mime_types;
+
+ procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+ mime_types = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gchar *canonical = gimp_canonicalize_identifier (procedure_name);
+
+ success = gimp_plug_in_manager_register_mime_types (gimp->plug_in_manager,
+ canonical, mime_types);
+
+ g_free (canonical);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+register_file_handler_uri_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *procedure_name;
+
+ procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ gchar *canonical = gimp_canonicalize_identifier (procedure_name);
+
+ success = gimp_plug_in_manager_register_handles_uri (gimp->plug_in_manager,
+ canonical);
+
+ g_free (canonical);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+register_file_handler_raw_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *procedure_name;
+
+ procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ gchar *canonical = gimp_canonicalize_identifier (procedure_name);
+
+ success = gimp_plug_in_manager_register_handles_raw (gimp->plug_in_manager,
+ canonical);
+
+ g_free (canonical);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+register_thumbnail_loader_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *load_proc;
+ const gchar *thumb_proc;
+
+ load_proc = g_value_get_string (gimp_value_array_index (args, 0));
+ thumb_proc = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gchar *canonical = gimp_canonicalize_identifier (load_proc);
+ gchar *canon_thumb = gimp_canonicalize_identifier (thumb_proc);
+
+ success = gimp_plug_in_manager_register_thumb_loader (gimp->plug_in_manager,
+ canonical, canon_thumb);
+
+ g_free (canonical);
+ g_free (canon_thumb);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_fileops_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-file-load
+ */
+ procedure = gimp_procedure_new (file_load_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-file-load");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-file-load",
+ "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.",
+ "Josh MacDonald",
+ "Josh MacDonald",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[0]),
+ GIMP_RUN_WITH_LAST_VALS);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filename",
+ "filename",
+ "The name of the file to load",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("raw-filename",
+ "raw filename",
+ "The name as entered by the user",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The output image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-file-load-layer
+ */
+ procedure = gimp_procedure_new (file_load_layer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-file-load-layer");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-file-load-layer",
+ "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'.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[0]),
+ GIMP_RUN_WITH_LAST_VALS);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Destination image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filename",
+ "filename",
+ "The name of the file to load",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer created when loading the image file",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-file-load-layers
+ */
+ procedure = gimp_procedure_new (file_load_layers_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-file-load-layers");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-file-load-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'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2006",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[0]),
+ GIMP_RUN_WITH_LAST_VALS);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Destination image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filename",
+ "filename",
+ "The name of the file to load",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-layers",
+ "num layers",
+ "The number of loaded layers",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32_array ("layer-ids",
+ "layer ids",
+ "The list of loaded layers",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-file-save
+ */
+ procedure = gimp_procedure_new (file_save_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-file-save");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-file-save",
+ "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.",
+ "Josh MacDonald",
+ "Josh MacDonald",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Drawable to save",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filename",
+ "filename",
+ "The name of the file to save the image in",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("raw-filename",
+ "raw filename",
+ "The name as entered by the user",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-file-load-thumbnail
+ */
+ procedure = gimp_procedure_new (file_load_thumbnail_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-file-load-thumbnail");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-file-load-thumbnail",
+ "Loads the thumbnail for a file.",
+ "This procedure tries to load a thumbnail that belongs to the file with the given filename. This name is a full pathname. The returned data is an array of colordepth 3 (RGB), regardless of the image type. Width and height of the thumbnail are also returned. Don't use this function if you need a thumbnail of an already opened image, use 'gimp-image-thumbnail' instead.",
+ "Adam D. Moss, Sven Neumann",
+ "Adam D. Moss, Sven Neumann",
+ "1999-2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filename",
+ "filename",
+ "The name of the file that owns the thumbnail to load",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The width of the thumbnail",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The height of the thumbnail",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("thumb-data-count",
+ "thumb data count",
+ "The number of bytes in thumbnail data",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("thumb-data",
+ "thumb data",
+ "The thumbnail data",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-file-save-thumbnail
+ */
+ procedure = gimp_procedure_new (file_save_thumbnail_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-file-save-thumbnail");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-file-save-thumbnail",
+ "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.",
+ "Josh MacDonald",
+ "Josh MacDonald",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filename",
+ "filename",
+ "The name of the file the thumbnail belongs to",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-register-magic-load-handler
+ */
+ procedure = gimp_procedure_new (register_magic_load_handler_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-register-magic-load-handler");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-register-magic-load-handler",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("procedure-name",
+ "procedure name",
+ "The name of the procedure to be used for loading",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("extensions",
+ "extensions",
+ "comma separated list of extensions this handler can load (i.e. \"jpg,jpeg\")",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("prefixes",
+ "prefixes",
+ "comma separated list of prefixes this handler can load (i.e. \"http:,ftp:\")",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("magics",
+ "magics",
+ "comma separated list of magic file information this handler can load (i.e. \"0,string,GIF\")",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-register-load-handler
+ */
+ procedure = gimp_procedure_new (register_load_handler_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-register-load-handler");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-register-load-handler",
+ "Registers a file load handler procedure.",
+ "Registers a procedural database procedure to be called to load files of a particular file format.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("procedure-name",
+ "procedure name",
+ "The name of the procedure to be used for loading",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("extensions",
+ "extensions",
+ "comma separated list of extensions this handler can load (i.e. \"jpg,jpeg\")",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("prefixes",
+ "prefixes",
+ "comma separated list of prefixes this handler can load (i.e. \"http:,ftp:\")",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-register-save-handler
+ */
+ procedure = gimp_procedure_new (register_save_handler_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-register-save-handler");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-register-save-handler",
+ "Registers a file save handler procedure.",
+ "Registers a procedural database procedure to be called to save files in a particular file format.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("procedure-name",
+ "procedure name",
+ "The name of the procedure to be used for saving",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("extensions",
+ "extensions",
+ "comma separated list of extensions this handler can save (i.e. \"jpg,jpeg\")",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("prefixes",
+ "prefixes",
+ "comma separated list of prefixes this handler can save (i.e. \"http:,ftp:\")",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-register-file-handler-priority
+ */
+ procedure = gimp_procedure_new (register_file_handler_priority_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-register-file-handler-priority");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-register-file-handler-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.",
+ "Ell",
+ "Ell",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("procedure-name",
+ "procedure name",
+ "The name of the procedure to set the priority of.",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("priority",
+ "priority",
+ "The procedure priority.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-register-file-handler-mime
+ */
+ procedure = gimp_procedure_new (register_file_handler_mime_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-register-file-handler-mime");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-register-file-handler-mime",
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("procedure-name",
+ "procedure name",
+ "The name of the procedure to associate a MIME type with.",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("mime-types",
+ "mime types",
+ "A comma-separated list of MIME types, such as \"image/jpeg\".",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-register-file-handler-uri
+ */
+ procedure = gimp_procedure_new (register_file_handler_uri_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-register-file-handler-uri");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-register-file-handler-uri",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("procedure-name",
+ "procedure name",
+ "The name of the procedure to enable URIs for.",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-register-file-handler-raw
+ */
+ procedure = gimp_procedure_new (register_file_handler_raw_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-register-file-handler-raw");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-register-file-handler-raw",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2017",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("procedure-name",
+ "procedure name",
+ "The name of the procedure to enable raw handling for.",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-register-thumbnail-loader
+ */
+ procedure = gimp_procedure_new (register_thumbnail_loader_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-register-thumbnail-loader");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-register-thumbnail-loader",
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("load-proc",
+ "load proc",
+ "The name of the procedure the thumbnail loader with.",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("thumb-proc",
+ "thumb proc",
+ "The name of the thumbnail load procedure.",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/floating-sel-cmds.c b/app/pdb/floating-sel-cmds.c
new file mode 100644
index 0000000..6d282e9
--- /dev/null
+++ b/app/pdb/floating-sel-cmds.c
@@ -0,0 +1,366 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
+#include "core/gimplayer-floating-selection.h"
+#include "core/gimplayer.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimppdberror.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+floating_sel_remove_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *floating_sel;
+
+ floating_sel = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_layer_is_floating_sel (floating_sel))
+ {
+ gimp_image_remove_layer (gimp_item_get_image (GIMP_ITEM (floating_sel)),
+ floating_sel, TRUE, NULL);
+ }
+ else
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Cannot remove this layer because "
+ "it is not a floating selection."));
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+floating_sel_anchor_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *floating_sel;
+
+ floating_sel = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_layer_is_floating_sel (floating_sel))
+ {
+ floating_sel_anchor (floating_sel);
+ }
+ else
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Cannot anchor this layer because "
+ "it is not a floating selection."));
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+floating_sel_to_layer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *floating_sel;
+
+ floating_sel = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_layer_is_floating_sel (floating_sel))
+ {
+ success = floating_sel_to_layer (floating_sel, error);
+ }
+ else
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Cannot convert this layer to a normal layer "
+ "because it is not a floating selection."));
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+floating_sel_attach_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ GimpDrawable *drawable;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ floating_sel_attach (layer, drawable);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+floating_sel_rigor_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ if (success)
+ {
+ }
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+floating_sel_relax_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ if (success)
+ {
+ }
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_floating_sel_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-floating-sel-remove
+ */
+ procedure = gimp_procedure_new (floating_sel_remove_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-floating-sel-remove");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-floating-sel-remove",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("floating-sel",
+ "floating sel",
+ "The floating selection",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-floating-sel-anchor
+ */
+ procedure = gimp_procedure_new (floating_sel_anchor_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-floating-sel-anchor");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-floating-sel-anchor",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("floating-sel",
+ "floating sel",
+ "The floating selection",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-floating-sel-to-layer
+ */
+ procedure = gimp_procedure_new (floating_sel_to_layer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-floating-sel-to-layer");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-floating-sel-to-layer",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("floating-sel",
+ "floating sel",
+ "The floating selection",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-floating-sel-attach
+ */
+ procedure = gimp_procedure_new (floating_sel_attach_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-floating-sel-attach");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-floating-sel-attach",
+ "Attach the specified layer as floating to the specified drawable.",
+ "This procedure attaches the layer as floating selection to the drawable.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer (is attached as floating selection)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable (where to attach the floating selection)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-floating-sel-rigor
+ */
+ procedure = gimp_procedure_new (floating_sel_rigor_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-floating-sel-rigor");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-floating-sel-rigor",
+ "Deprecated: There is no replacement for this procedure.",
+ "Deprecated: There is no replacement for this procedure.",
+ "",
+ "",
+ "",
+ "NONE");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("floating-sel",
+ "floating sel",
+ "The floating selection",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("undo",
+ "undo",
+ "",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-floating-sel-relax
+ */
+ procedure = gimp_procedure_new (floating_sel_relax_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-floating-sel-relax");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-floating-sel-relax",
+ "Deprecated: There is no replacement for this procedure.",
+ "Deprecated: There is no replacement for this procedure.",
+ "",
+ "",
+ "",
+ "NONE");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("floating-sel",
+ "floating sel",
+ "The floating selection",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("undo",
+ "undo",
+ "",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/font-select-cmds.c b/app/pdb/font-select-cmds.c
new file mode 100644
index 0000000..dc04469
--- /dev/null
+++ b/app/pdb/font-select-cmds.c
@@ -0,0 +1,227 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+fonts_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *font_callback;
+ const gchar *popup_title;
+ const gchar *initial_font;
+
+ font_callback = g_value_get_string (gimp_value_array_index (args, 0));
+ popup_title = g_value_get_string (gimp_value_array_index (args, 1));
+ initial_font = g_value_get_string (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, font_callback) ||
+ ! gimp_data_factory_data_wait (gimp->font_factory) ||
+ ! gimp_pdb_dialog_new (gimp, context, progress,
+ gimp_data_factory_get_container (gimp->font_factory),
+ popup_title, font_callback, initial_font,
+ NULL))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+fonts_close_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *font_callback;
+
+ font_callback = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, font_callback) ||
+ ! gimp_pdb_dialog_close (gimp,
+ gimp_data_factory_get_container (gimp->font_factory),
+ font_callback))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+fonts_set_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *font_callback;
+ const gchar *font_name;
+
+ font_callback = g_value_get_string (gimp_value_array_index (args, 0));
+ font_name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, font_callback) ||
+ ! gimp_data_factory_data_wait (gimp->font_factory) ||
+ ! gimp_pdb_dialog_set (gimp,
+ gimp_data_factory_get_container (gimp->font_factory),
+ font_callback, font_name,
+ NULL))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_font_select_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-fonts-popup
+ */
+ procedure = gimp_procedure_new (fonts_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-fonts-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-fonts-popup",
+ "Invokes the Gimp font selection.",
+ "This procedure opens the font selection dialog.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("font-callback",
+ "font callback",
+ "The callback PDB proc to call when font selection is made",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("popup-title",
+ "popup title",
+ "Title of the font selection dialog",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("initial-font",
+ "initial font",
+ "The name of the font to set as the first selected",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-fonts-close-popup
+ */
+ procedure = gimp_procedure_new (fonts_close_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-fonts-close-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-fonts-close-popup",
+ "Close the font selection dialog.",
+ "This procedure closes an opened font selection dialog.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("font-callback",
+ "font callback",
+ "The name of the callback registered for this pop-up",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-fonts-set-popup
+ */
+ procedure = gimp_procedure_new (fonts_set_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-fonts-set-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-fonts-set-popup",
+ "Sets the current font in a font selection dialog.",
+ "Sets the current font in a font selection dialog.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("font-callback",
+ "font callback",
+ "The name of the callback registered for this pop-up",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("font-name",
+ "font name",
+ "The name of the font to set as selected",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/fonts-cmds.c b/app/pdb/fonts-cmds.c
new file mode 100644
index 0000000..09d25d0
--- /dev/null
+++ b/app/pdb/fonts-cmds.c
@@ -0,0 +1,151 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontainer-filter.h"
+#include "core/gimpcontainer.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+fonts_refresh_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_data_factory_data_refresh (gimp->font_factory, context);
+ gimp_data_factory_data_wait (gimp->font_factory);
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+fonts_get_list_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *filter;
+ gint32 num_fonts = 0;
+ gchar **font_list = NULL;
+
+ filter = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ if (! gimp_data_factory_data_wait (gimp->font_factory))
+ success = FALSE;
+
+ if (success)
+ {
+ font_list = gimp_container_get_filtered_name_array (gimp_data_factory_get_container (gimp->font_factory),
+ filter, &num_fonts);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_fonts);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), font_list, num_fonts);
+ }
+
+ return return_vals;
+}
+
+void
+register_fonts_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-fonts-refresh
+ */
+ procedure = gimp_procedure_new (fonts_refresh_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-fonts-refresh");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2003",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-fonts-get-list
+ */
+ procedure = gimp_procedure_new (fonts_get_list_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-fonts-get-list");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-fonts-get-list",
+ "Retrieve the list of loaded fonts.",
+ "This procedure returns a list of the fonts that are currently available.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filter",
+ "filter",
+ "An optional regular expression used to filter the list",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-fonts",
+ "num fonts",
+ "The number of available fonts",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("font-list",
+ "font list",
+ "The list of font names",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/gimp-cmds.c b/app/pdb/gimp-cmds.c
new file mode 100644
index 0000000..a05be45
--- /dev/null
+++ b/app/pdb/gimp-cmds.c
@@ -0,0 +1,444 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp-parasites.h"
+#include "core/gimp-utils.h"
+#include "core/gimp.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+version_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gchar *version = NULL;
+
+ version = g_strdup (GIMP_VERSION);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_take_string (gimp_value_array_index (return_vals, 1), version);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+getpid_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 pid = 0;
+
+ pid = gimp_get_pid ();
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_int (gimp_value_array_index (return_vals, 1), pid);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+quit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gboolean force;
+
+ force = g_value_get_boolean (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ gimp_exit (gimp, force);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+attach_parasite_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const GimpParasite *parasite;
+
+ parasite = g_value_get_boxed (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ if (gimp_parasite_validate (gimp, parasite, error))
+ gimp_parasite_attach (gimp, parasite);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+detach_parasite_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ gimp_parasite_detach (gimp, name);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+get_parasite_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ GimpParasite *parasite = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ parasite = gimp_parasite_copy (gimp_parasite_find (gimp, name));
+
+ if (! parasite)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_boxed (gimp_value_array_index (return_vals, 1), parasite);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+get_parasite_list_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 num_parasites = 0;
+ gchar **parasites = NULL;
+
+ parasites = gimp_parasite_list (gimp, &num_parasites);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_parasites);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), parasites, num_parasites);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+temp_name_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *extension;
+ gchar *name = NULL;
+
+ extension = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GFile *file = gimp_get_temp_file (gimp, extension);
+
+ name = g_file_get_path (file);
+
+ g_object_unref (file);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
+void
+register_gimp_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-version
+ */
+ procedure = gimp_procedure_new (version_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-version");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-version",
+ "Returns the host GIMP version.",
+ "This procedure returns the version number of the currently running GIMP.",
+ "Manish Singh",
+ "Manish Singh",
+ "1999",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("version",
+ "version",
+ "GIMP version number",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-getpid
+ */
+ procedure = gimp_procedure_new (getpid_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-getpid");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-getpid",
+ "Returns the PID of the host GIMP process.",
+ "This procedure returns the process ID of the currently running GIMP.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("pid",
+ "pid",
+ "The PID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-quit
+ */
+ procedure = gimp_procedure_new (quit_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-quit");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-quit",
+ "Causes GIMP to exit gracefully.",
+ "If there are unsaved images in an interactive GIMP session, the user will be asked for confirmation. If force is TRUE, the application is quit without querying the user to save any dirty images.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("force",
+ "force",
+ "Force GIMP to quit without asking",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-attach-parasite
+ */
+ procedure = gimp_procedure_new (attach_parasite_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-attach-parasite");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-attach-parasite",
+ "Add a global parasite.",
+ "This procedure attaches a global parasite. It has no return values.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_parasite ("parasite",
+ "parasite",
+ "The parasite to attach",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-detach-parasite
+ */
+ procedure = gimp_procedure_new (detach_parasite_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-detach-parasite");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-detach-parasite",
+ "Removes a global parasite.",
+ "This procedure detaches a global parasite from. It has no return values.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the parasite to detach.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-get-parasite
+ */
+ procedure = gimp_procedure_new (get_parasite_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-get-parasite");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-get-parasite",
+ "Look up a global parasite.",
+ "Finds and returns the global parasite that was previously attached.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the parasite to find",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_parasite ("parasite",
+ "parasite",
+ "The found parasite",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-get-parasite-list
+ */
+ procedure = gimp_procedure_new (get_parasite_list_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-get-parasite-list");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-get-parasite-list",
+ "List all parasites.",
+ "Returns a list of all currently attached global parasites.",
+ "Marc Lehmann",
+ "Marc Lehmann",
+ "1999",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-parasites",
+ "num parasites",
+ "The number of attached parasites",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("parasites",
+ "parasites",
+ "The names of currently attached parasites",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-temp-name
+ */
+ procedure = gimp_procedure_new (temp_name_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-temp-name");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-temp-name",
+ "Generates a unique filename.",
+ "Generates a unique filename using the temp path supplied in the user's gimprc.",
+ "Josh MacDonald",
+ "Josh MacDonald",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("extension",
+ "extension",
+ "The extension the file will have",
+ TRUE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The new temp filename",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/gimp-pdb-compat.c b/app/pdb/gimp-pdb-compat.c
new file mode 100644
index 0000000..b669dfe
--- /dev/null
+++ b/app/pdb/gimp-pdb-compat.c
@@ -0,0 +1,562 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <cairo.h>
+#include <gegl.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpcolor/gimpcolor.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimp-pdb-compat.h"
+
+
+/* local function prototypes */
+
+static gchar * gimp_pdb_compat_fix_param_name (const gchar *name);
+
+
+/* public functions */
+
+GParamSpec *
+gimp_pdb_compat_param_spec (Gimp *gimp,
+ GimpPDBArgType arg_type,
+ const gchar *name,
+ const gchar *desc,
+ gboolean *name_valid)
+{
+ GParamSpec *pspec = NULL;
+ gchar *real_name;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+
+ real_name = gimp_pdb_compat_fix_param_name (name);
+
+ if (name_valid) *name_valid = ! strcmp (name, real_name);
+
+ switch (arg_type)
+ {
+ case GIMP_PDB_INT32:
+ pspec = gimp_param_spec_int32 (real_name, real_name, desc,
+ G_MININT32, G_MAXINT32, 0,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_INT16:
+ pspec = gimp_param_spec_int16 (real_name, real_name, desc,
+ G_MININT16, G_MAXINT16, 0,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_INT8:
+ pspec = gimp_param_spec_int8 (real_name, real_name, desc,
+ 0, G_MAXUINT8, 0,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_FLOAT:
+ pspec = g_param_spec_double (real_name, real_name, desc,
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_STRING:
+ pspec = gimp_param_spec_string (real_name, real_name, desc,
+ TRUE, TRUE, FALSE,
+ NULL,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_INT32ARRAY:
+ pspec = gimp_param_spec_int32_array (real_name, real_name, desc,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_INT16ARRAY:
+ pspec = gimp_param_spec_int16_array (real_name, real_name, desc,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_INT8ARRAY:
+ pspec = gimp_param_spec_int8_array (real_name, real_name, desc,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_FLOATARRAY:
+ pspec = gimp_param_spec_float_array (real_name, real_name, desc,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_STRINGARRAY:
+ pspec = gimp_param_spec_string_array (real_name, real_name, desc,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_COLOR:
+ pspec = gimp_param_spec_rgb (real_name, real_name, desc,
+ TRUE, NULL,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_ITEM:
+ pspec = gimp_param_spec_item_id (real_name, real_name, desc,
+ gimp, TRUE,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_DISPLAY:
+ pspec = gimp_param_spec_display_id (real_name, real_name, desc,
+ gimp, TRUE,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_IMAGE:
+ pspec = gimp_param_spec_image_id (real_name, real_name, desc,
+ gimp, TRUE,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_LAYER:
+ pspec = gimp_param_spec_layer_id (real_name, real_name, desc,
+ gimp, TRUE,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_CHANNEL:
+ pspec = gimp_param_spec_channel_id (real_name, real_name, desc,
+ gimp, TRUE,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_DRAWABLE:
+ pspec = gimp_param_spec_drawable_id (real_name, real_name, desc,
+ gimp, TRUE,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_SELECTION:
+ pspec = gimp_param_spec_selection_id (real_name, real_name, desc,
+ gimp, TRUE,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_COLORARRAY:
+ pspec = gimp_param_spec_color_array (real_name, real_name, desc,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_VECTORS:
+ pspec = gimp_param_spec_vectors_id (real_name, real_name, desc,
+ gimp, TRUE,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_PARASITE:
+ pspec = gimp_param_spec_parasite (real_name, real_name, desc,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_STATUS:
+ pspec = g_param_spec_enum (real_name, real_name, desc,
+ GIMP_TYPE_PDB_STATUS_TYPE,
+ GIMP_PDB_EXECUTION_ERROR,
+ G_PARAM_READWRITE);
+ break;
+
+ case GIMP_PDB_END:
+ break;
+ }
+
+ if (! pspec)
+ {
+ g_warning ("%s: returning NULL for %s (%s)",
+ G_STRFUNC,
+ real_name,
+ gimp_pdb_compat_arg_type_to_string (arg_type));
+ }
+
+ g_free (real_name);
+
+ return pspec;
+}
+
+GType
+gimp_pdb_compat_arg_type_to_gtype (GimpPDBArgType type)
+{
+
+ switch (type)
+ {
+ case GIMP_PDB_INT32:
+ return GIMP_TYPE_INT32;
+
+ case GIMP_PDB_INT16:
+ return GIMP_TYPE_INT16;
+
+ case GIMP_PDB_INT8:
+ return GIMP_TYPE_INT8;
+
+ case GIMP_PDB_FLOAT:
+ return G_TYPE_DOUBLE;
+
+ case GIMP_PDB_STRING:
+ return G_TYPE_STRING;
+
+ case GIMP_PDB_INT32ARRAY:
+ return GIMP_TYPE_INT32_ARRAY;
+
+ case GIMP_PDB_INT16ARRAY:
+ return GIMP_TYPE_INT16_ARRAY;
+
+ case GIMP_PDB_INT8ARRAY:
+ return GIMP_TYPE_INT8_ARRAY;
+
+ case GIMP_PDB_FLOATARRAY:
+ return GIMP_TYPE_FLOAT_ARRAY;
+
+ case GIMP_PDB_STRINGARRAY:
+ return GIMP_TYPE_STRING_ARRAY;
+
+ case GIMP_PDB_COLOR:
+ return GIMP_TYPE_RGB;
+
+ case GIMP_PDB_ITEM:
+ return GIMP_TYPE_ITEM_ID;
+
+ case GIMP_PDB_DISPLAY:
+ return GIMP_TYPE_DISPLAY_ID;
+
+ case GIMP_PDB_IMAGE:
+ return GIMP_TYPE_IMAGE_ID;
+
+ case GIMP_PDB_LAYER:
+ return GIMP_TYPE_LAYER_ID;
+
+ case GIMP_PDB_CHANNEL:
+ return GIMP_TYPE_CHANNEL_ID;
+
+ case GIMP_PDB_DRAWABLE:
+ return GIMP_TYPE_DRAWABLE_ID;
+
+ case GIMP_PDB_SELECTION:
+ return GIMP_TYPE_SELECTION_ID;
+
+ case GIMP_PDB_COLORARRAY:
+ return GIMP_TYPE_COLOR_ARRAY;
+
+ case GIMP_PDB_VECTORS:
+ return GIMP_TYPE_VECTORS_ID;
+
+ case GIMP_PDB_PARASITE:
+ return GIMP_TYPE_PARASITE;
+
+ case GIMP_PDB_STATUS:
+ return GIMP_TYPE_PDB_STATUS_TYPE;
+
+ case GIMP_PDB_END:
+ break;
+ }
+
+ g_warning ("%s: returning G_TYPE_NONE for %d (%s)",
+ G_STRFUNC, type, gimp_pdb_compat_arg_type_to_string (type));
+
+ return G_TYPE_NONE;
+}
+
+GimpPDBArgType
+gimp_pdb_compat_arg_type_from_gtype (GType type)
+{
+ static GQuark pdb_type_quark = 0;
+ GimpPDBArgType pdb_type;
+
+ if (! pdb_type_quark)
+ {
+ struct
+ {
+ GType g_type;
+ GimpPDBArgType pdb_type;
+ }
+ type_mapping[] =
+ {
+ { GIMP_TYPE_INT32, GIMP_PDB_INT32 },
+ { G_TYPE_INT, GIMP_PDB_INT32 },
+ { G_TYPE_UINT, GIMP_PDB_INT32 },
+ { G_TYPE_ENUM, GIMP_PDB_INT32 },
+ { G_TYPE_BOOLEAN, GIMP_PDB_INT32 },
+
+ { GIMP_TYPE_INT16, GIMP_PDB_INT16 },
+ { GIMP_TYPE_INT8, GIMP_PDB_INT8 },
+ { G_TYPE_DOUBLE, GIMP_PDB_FLOAT },
+
+ { G_TYPE_STRING, GIMP_PDB_STRING },
+
+ { GIMP_TYPE_RGB, GIMP_PDB_COLOR },
+
+ { GIMP_TYPE_INT32_ARRAY, GIMP_PDB_INT32ARRAY },
+ { GIMP_TYPE_INT16_ARRAY, GIMP_PDB_INT16ARRAY },
+ { GIMP_TYPE_INT8_ARRAY, GIMP_PDB_INT8ARRAY },
+ { GIMP_TYPE_FLOAT_ARRAY, GIMP_PDB_FLOATARRAY },
+ { GIMP_TYPE_STRING_ARRAY, GIMP_PDB_STRINGARRAY },
+ { GIMP_TYPE_COLOR_ARRAY, GIMP_PDB_COLORARRAY },
+
+ { GIMP_TYPE_ITEM_ID, GIMP_PDB_ITEM },
+ { GIMP_TYPE_DISPLAY_ID, GIMP_PDB_DISPLAY },
+ { GIMP_TYPE_IMAGE_ID, GIMP_PDB_IMAGE },
+ { GIMP_TYPE_LAYER_ID, GIMP_PDB_LAYER },
+ { GIMP_TYPE_CHANNEL_ID, GIMP_PDB_CHANNEL },
+ { GIMP_TYPE_DRAWABLE_ID, GIMP_PDB_DRAWABLE },
+ { GIMP_TYPE_SELECTION_ID, GIMP_PDB_SELECTION },
+ { GIMP_TYPE_LAYER_MASK_ID, GIMP_PDB_CHANNEL },
+ { GIMP_TYPE_VECTORS_ID, GIMP_PDB_VECTORS },
+
+ { GIMP_TYPE_PARASITE, GIMP_PDB_PARASITE },
+
+ { GIMP_TYPE_PDB_STATUS_TYPE, GIMP_PDB_STATUS }
+ };
+
+ gint i;
+
+ pdb_type_quark = g_quark_from_static_string ("gimp-pdb-type");
+
+ for (i = 0; i < G_N_ELEMENTS (type_mapping); i++)
+ g_type_set_qdata (type_mapping[i].g_type, pdb_type_quark,
+ GINT_TO_POINTER (type_mapping[i].pdb_type));
+ }
+
+ pdb_type = GPOINTER_TO_INT (g_type_get_qdata (type, pdb_type_quark));
+
+#if 0
+ g_printerr ("%s: arg_type = %p (%s) -> %d (%s)\n",
+ G_STRFUNC,
+ (gpointer) type, g_type_name (type),
+ pdb_type, gimp_pdb_arg_type_to_string (pdb_type));
+#endif
+
+ return pdb_type;
+}
+
+gchar *
+gimp_pdb_compat_arg_type_to_string (GimpPDBArgType type)
+{
+ const gchar *name;
+
+ if (! gimp_enum_get_value (GIMP_TYPE_PDB_ARG_TYPE, type,
+ &name, NULL, NULL, NULL))
+ {
+ return g_strdup_printf ("(PDB type %d unknown)", type);
+ }
+
+ return g_strdup (name);
+}
+
+void
+gimp_pdb_compat_procs_register (GimpPDB *pdb,
+ GimpPDBCompatMode compat_mode)
+{
+ static const struct
+ {
+ const gchar *old_name;
+ const gchar *new_name;
+ }
+ compat_procs[] =
+ {
+ { "gimp-blend", "gimp-edit-blend" },
+ { "gimp-brushes-list", "gimp-brushes-get-list" },
+ { "gimp-bucket-fill", "gimp-edit-bucket-fill" },
+ { "gimp-channel-delete", "gimp-item-delete" },
+ { "gimp-channel-get-name", "gimp-item-get-name" },
+ { "gimp-channel-get-tattoo", "gimp-item-get-tattoo" },
+ { "gimp-channel-get-visible", "gimp-item-get-visible" },
+ { "gimp-channel-set-name", "gimp-item-set-name" },
+ { "gimp-channel-set-tattoo", "gimp-item-set-tattoo" },
+ { "gimp-channel-set-visible", "gimp-item-set-visible" },
+ { "gimp-color-picker", "gimp-image-pick-color" },
+ { "gimp-convert-grayscale", "gimp-image-convert-grayscale" },
+ { "gimp-convert-indexed", "gimp-image-convert-indexed" },
+ { "gimp-convert-rgb", "gimp-image-convert-rgb" },
+ { "gimp-crop", "gimp-image-crop" },
+ { "gimp-drawable-bytes", "gimp-drawable-bpp" },
+ { "gimp-drawable-image", "gimp-drawable-get-image" },
+ { "gimp-image-active-drawable", "gimp-image-get-active-drawable" },
+ { "gimp-image-floating-selection", "gimp-image-get-floating-sel" },
+ { "gimp-layer-delete", "gimp-item-delete" },
+ { "gimp-layer-get-linked", "gimp-item-get-linked" },
+ { "gimp-layer-get-name", "gimp-item-get-name" },
+ { "gimp-layer-get-tattoo", "gimp-item-get-tattoo" },
+ { "gimp-layer-get-visible", "gimp-item-get-visible" },
+ { "gimp-layer-mask", "gimp-layer-get-mask" },
+ { "gimp-layer-set-linked", "gimp-item-set-linked" },
+ { "gimp-layer-set-name", "gimp-item-set-name" },
+ { "gimp-layer-set-tattoo", "gimp-item-set-tattoo" },
+ { "gimp-layer-set-visible", "gimp-item-set-visible" },
+ { "gimp-palette-refresh", "gimp-palettes-refresh" },
+ { "gimp-patterns-list", "gimp-patterns-get-list" },
+ { "gimp-temp-PDB-name", "gimp-procedural-db-temp-name" },
+ { "gimp-undo-push-group-end", "gimp-image-undo-group-end" },
+ { "gimp-undo-push-group-start", "gimp-image-undo-group-start" },
+
+ /* deprecations since 2.0 */
+ { "gimp-brushes-get-opacity", "gimp-context-get-opacity" },
+ { "gimp-brushes-get-paint-mode", "gimp-context-get-paint-mode" },
+ { "gimp-brushes-set-brush", "gimp-context-set-brush" },
+ { "gimp-brushes-set-opacity", "gimp-context-set-opacity" },
+ { "gimp-brushes-set-paint-mode", "gimp-context-set-paint-mode" },
+ { "gimp-channel-ops-duplicate", "gimp-image-duplicate" },
+ { "gimp-channel-ops-offset", "gimp-drawable-offset" },
+ { "gimp-gradients-get-active", "gimp-context-get-gradient" },
+ { "gimp-gradients-get-gradient", "gimp-context-get-gradient" },
+ { "gimp-gradients-set-active", "gimp-context-set-gradient" },
+ { "gimp-gradients-set-gradient", "gimp-context-set-gradient" },
+ { "gimp-image-get-cmap", "gimp-image-get-colormap" },
+ { "gimp-image-set-cmap", "gimp-image-set-colormap" },
+ { "gimp-palette-get-background", "gimp-context-get-background" },
+ { "gimp-palette-get-foreground", "gimp-context-get-foreground" },
+ { "gimp-palette-set-background", "gimp-context-set-background" },
+ { "gimp-palette-set-default-colors", "gimp-context-set-default-colors" },
+ { "gimp-palette-set-foreground", "gimp-context-set-foreground" },
+ { "gimp-palette-swap-colors", "gimp-context-swap-colors" },
+ { "gimp-palettes-set-palette", "gimp-context-set-palette" },
+ { "gimp-patterns-set-pattern", "gimp-context-set-pattern" },
+ { "gimp-selection-clear", "gimp-selection-none" },
+
+ /* deprecations since 2.2 */
+ { "gimp-layer-get-preserve-trans", "gimp-layer-get-lock-alpha" },
+ { "gimp-layer-set-preserve-trans", "gimp-layer-set-lock-alpha" },
+
+ /* deprecations since 2.6 */
+ { "gimp-drawable-is-valid", "gimp-item-is-valid" },
+ { "gimp-drawable-is-layer", "gimp-item-is-layer" },
+ { "gimp-drawable-is-text-layer", "gimp-item-is-text-layer" },
+ { "gimp-drawable-is-layer-mask", "gimp-item-is-layer-mask" },
+ { "gimp-drawable-is-channel", "gimp-item-is-channel" },
+ { "gimp-drawable-delete", "gimp-item-delete" },
+ { "gimp-drawable-get-image", "gimp-item-get-image" },
+ { "gimp-drawable-get-name", "gimp-item-get-name" },
+ { "gimp-drawable-set-name", "gimp-item-set-name" },
+ { "gimp-drawable-get-visible", "gimp-item-get-visible" },
+ { "gimp-drawable-set-visible", "gimp-item-set-visible" },
+ { "gimp-drawable-get-linked", "gimp-item-get-linked" },
+ { "gimp-drawable-set-linked", "gimp-item-set-linked" },
+ { "gimp-drawable-get-tattoo", "gimp-item-get-tattoo" },
+ { "gimp-drawable-set-tattoo", "gimp-item-set-tattoo" },
+ { "gimp-drawable-parasite-find", "gimp-item-get-parasite" },
+ { "gimp-drawable-parasite-attach", "gimp-item-attach-parasite" },
+ { "gimp-drawable-parasite-detach", "gimp-item-detach-parasite" },
+ { "gimp-drawable-parasite-list", "gimp-item-get-parasite-list" },
+ { "gimp-image-get-layer-position", "gimp-image-get-item-position" },
+ { "gimp-image-raise-layer", "gimp-image-raise-item" },
+ { "gimp-image-lower-layer", "gimp-image-lower-item" },
+ { "gimp-image-raise-layer-to-top", "gimp-image-raise-item-to-top" },
+ { "gimp-image-lower-layer-to-bottom", "gimp-image-lower-item-to-bottom" },
+ { "gimp-image-get-channel-position", "gimp-image-get-item-position" },
+ { "gimp-image-raise-channel", "gimp-image-raise-item" },
+ { "gimp-image-lower-channel", "gimp-image-lower-item" },
+ { "gimp-image-get-vectors-position", "gimp-image-get-item-position" },
+ { "gimp-image-raise-vectors", "gimp-image-raise-item" },
+ { "gimp-image-lower-vectors", "gimp-image-lower-item" },
+ { "gimp-image-raise-vectors-to-top", "gimp-image-raise-item-to-top" },
+ { "gimp-image-lower-vectors-to-bottom", "gimp-image-lower-item-to-bottom" },
+ { "gimp-vectors-is-valid", "gimp-item-is-valid" },
+ { "gimp-vectors-get-image", "gimp-item-get-image" },
+ { "gimp-vectors-get-name", "gimp-item-get-name" },
+ { "gimp-vectors-set-name", "gimp-item-set-name" },
+ { "gimp-vectors-get-visible", "gimp-item-get-visible" },
+ { "gimp-vectors-set-visible", "gimp-item-set-visible" },
+ { "gimp-vectors-get-linked", "gimp-item-get-linked" },
+ { "gimp-vectors-set-linked", "gimp-item-set-linked" },
+ { "gimp-vectors-get-tattoo", "gimp-item-get-tattoo" },
+ { "gimp-vectors-set-tattoo", "gimp-item-set-tattoo" },
+ { "gimp-vectors-parasite-find", "gimp-item-get-parasite" },
+ { "gimp-vectors-parasite-attach", "gimp-item-attach-parasite" },
+ { "gimp-vectors-parasite-detach", "gimp-item-detach-parasite" },
+ { "gimp-vectors-parasite-list", "gimp-item-get-parasite-list" },
+ { "gimp-image-parasite-find", "gimp-image-get-parasite" },
+ { "gimp-image-parasite-attach", "gimp-image-attach-parasite" },
+ { "gimp-image-parasite-detach", "gimp-image-detach-parasite" },
+ { "gimp-image-parasite-list", "gimp-image-get-parasite-list" },
+ { "gimp-parasite-find", "gimp-get-parasite" },
+ { "gimp-parasite-attach", "gimp-attach-parasite" },
+ { "gimp-parasite-detach", "gimp-detach-parasite" },
+ { "gimp-parasite-list", "gimp-get-parasite-list" },
+
+ /* deprecations since 2.8 */
+ { "gimp-edit-paste-as-new", "gimp-edit-paste-as-new-image" },
+ { "gimp-edit-named-paste-as-new", "gimp-edit-named-paste-as-new-image" }
+ };
+
+ g_return_if_fail (GIMP_IS_PDB (pdb));
+
+ if (compat_mode != GIMP_PDB_COMPAT_OFF)
+ {
+ gint i;
+
+ for (i = 0; i < G_N_ELEMENTS (compat_procs); i++)
+ gimp_pdb_register_compat_proc_name (pdb,
+ compat_procs[i].old_name,
+ compat_procs[i].new_name);
+ }
+}
+
+
+/* private functions */
+
+/* Since GLib 2.63.3, invalid param-spec names are rejected upon creation.
+ * This impacts procedure parameters and return-values, which are stored as
+ * param-specs internally. Since this requirement wasn't previously enforced,
+ * keep supporting arbitrary parameter names in gimp-2.
+ *
+ * See issues #4392 and #4641.
+ */
+static gchar *
+gimp_pdb_compat_fix_param_name (const gchar *name)
+{
+ GString *new_name;
+
+ new_name = g_string_new (NULL);
+
+ /* First character must be a letter. */
+ if ((name[0] < 'A' || name[0] > 'Z') &&
+ (name[0] < 'a' || name[0] > 'z'))
+ {
+ g_string_append (new_name, "param-");
+ }
+
+ for (; *name; name++)
+ {
+ gchar c = *name;
+
+ if ((c < 'A' || c > 'Z') &&
+ (c < 'a' || c > 'z') &&
+ (c < '0' || c > '9') &&
+ c != '-' && c != '_')
+ {
+ c = '-';
+ }
+
+ g_string_append_c (new_name, c);
+ }
+
+ return g_string_free (new_name, FALSE);
+}
diff --git a/app/pdb/gimp-pdb-compat.h b/app/pdb/gimp-pdb-compat.h
new file mode 100644
index 0000000..7f12fdf
--- /dev/null
+++ b/app/pdb/gimp-pdb-compat.h
@@ -0,0 +1,36 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_PDB_COMPAT_H__
+#define __GIMP_PDB_COMPAT_H__
+
+
+GParamSpec * gimp_pdb_compat_param_spec (Gimp *gimp,
+ GimpPDBArgType arg_type,
+ const gchar *name,
+ const gchar *desc,
+ gboolean *name_valid);
+
+GType gimp_pdb_compat_arg_type_to_gtype (GimpPDBArgType type);
+GimpPDBArgType gimp_pdb_compat_arg_type_from_gtype (GType type);
+gchar * gimp_pdb_compat_arg_type_to_string (GimpPDBArgType type);
+
+void gimp_pdb_compat_procs_register (GimpPDB *pdb,
+ GimpPDBCompatMode compat_mode);
+
+
+#endif /* __GIMP_PDB_COMPAT_H__ */
diff --git a/app/pdb/gimppdb-query.c b/app/pdb/gimppdb-query.c
new file mode 100644
index 0000000..00689fa
--- /dev/null
+++ b/app/pdb/gimppdb-query.c
@@ -0,0 +1,649 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gegl.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpparamspecs-desc.h"
+
+#include "gimppdb.h"
+#include "gimppdb-query.h"
+#include "gimppdberror.h"
+#include "gimp-pdb-compat.h"
+#include "gimpprocedure.h"
+
+#include "gimp-intl.h"
+
+
+#define PDB_REGEX_FLAGS (G_REGEX_CASELESS | G_REGEX_OPTIMIZE)
+
+#define COMPAT_BLURB "This procedure is deprecated! Use '%s' instead."
+
+
+typedef struct _PDBDump PDBDump;
+
+struct _PDBDump
+{
+ GimpPDB *pdb;
+ GOutputStream *output;
+ GError *error;
+
+ gboolean dumping_compat;
+};
+
+typedef struct _PDBQuery PDBQuery;
+
+struct _PDBQuery
+{
+ GimpPDB *pdb;
+
+ GRegex *name_regex;
+ GRegex *blurb_regex;
+ GRegex *help_regex;
+ GRegex *author_regex;
+ GRegex *copyright_regex;
+ GRegex *date_regex;
+ GRegex *proc_type_regex;
+
+ gchar **list_of_procs;
+ gint num_procs;
+ gboolean querying_compat;
+};
+
+typedef struct _PDBStrings PDBStrings;
+
+struct _PDBStrings
+{
+ gboolean compat;
+
+ gchar *blurb;
+ gchar *help;
+ gchar *author;
+ gchar *copyright;
+ gchar *date;
+};
+
+
+/* local function prototypes */
+
+static void gimp_pdb_query_entry (gpointer key,
+ gpointer value,
+ gpointer user_data);
+static void gimp_pdb_print_entry (gpointer key,
+ gpointer value,
+ gpointer user_data);
+static void gimp_pdb_get_strings (PDBStrings *strings,
+ GimpProcedure *procedure,
+ gboolean compat);
+static void gimp_pdb_free_strings (PDBStrings *strings);
+
+
+/* public functions */
+
+gboolean
+gimp_pdb_dump (GimpPDB *pdb,
+ GFile *file,
+ GError **error)
+{
+ PDBDump pdb_dump = { 0, };
+
+ g_return_val_if_fail (GIMP_IS_PDB (pdb), FALSE);
+ g_return_val_if_fail (G_IS_FILE (file), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ pdb_dump.pdb = pdb;
+ pdb_dump.output = G_OUTPUT_STREAM (g_file_replace (file,
+ NULL, FALSE,
+ G_FILE_CREATE_NONE,
+ NULL, error));
+ if (! pdb_dump.output)
+ return FALSE;
+
+ pdb_dump.dumping_compat = FALSE;
+
+ g_hash_table_foreach (pdb->procedures,
+ gimp_pdb_print_entry,
+ &pdb_dump);
+
+ pdb_dump.dumping_compat = TRUE;
+
+ g_hash_table_foreach (pdb->compat_proc_names,
+ gimp_pdb_print_entry,
+ &pdb_dump);
+
+ if (pdb_dump.error)
+ {
+ GCancellable *cancellable = g_cancellable_new ();
+
+ g_set_error (error, pdb_dump.error->domain, pdb_dump.error->code,
+ _("Writing PDB file '%s' failed: %s"),
+ gimp_file_get_utf8_name (file), pdb_dump.error->message);
+ g_clear_error (&pdb_dump.error);
+
+ /* Cancel the overwrite initiated by g_file_replace(). */
+ g_cancellable_cancel (cancellable);
+ g_output_stream_close (pdb_dump.output, cancellable, NULL);
+ g_object_unref (cancellable);
+ g_object_unref (pdb_dump.output);
+
+ return FALSE;
+ }
+
+ g_object_unref (pdb_dump.output);
+
+ return TRUE;
+}
+
+gboolean
+gimp_pdb_query (GimpPDB *pdb,
+ const gchar *name,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ const gchar *proc_type,
+ gint *num_procs,
+ gchar ***procs,
+ GError **error)
+{
+ PDBQuery pdb_query = { 0, };
+ gboolean success = FALSE;
+
+ g_return_val_if_fail (GIMP_IS_PDB (pdb), FALSE);
+ g_return_val_if_fail (name != NULL, FALSE);
+ g_return_val_if_fail (blurb != NULL, FALSE);
+ g_return_val_if_fail (help != NULL, FALSE);
+ g_return_val_if_fail (author != NULL, FALSE);
+ g_return_val_if_fail (copyright != NULL, FALSE);
+ g_return_val_if_fail (date != NULL, FALSE);
+ g_return_val_if_fail (proc_type != NULL, FALSE);
+ g_return_val_if_fail (num_procs != NULL, FALSE);
+ g_return_val_if_fail (procs != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ *num_procs = 0;
+ *procs = NULL;
+
+ pdb_query.name_regex = g_regex_new (name, PDB_REGEX_FLAGS, 0, error);
+ if (! pdb_query.name_regex)
+ goto cleanup;
+
+ pdb_query.blurb_regex = g_regex_new (blurb, PDB_REGEX_FLAGS, 0, error);
+ if (! pdb_query.blurb_regex)
+ goto cleanup;
+
+ pdb_query.help_regex = g_regex_new (help, PDB_REGEX_FLAGS, 0, error);
+ if (! pdb_query.help_regex)
+ goto cleanup;
+
+ pdb_query.author_regex = g_regex_new (author, PDB_REGEX_FLAGS, 0, error);
+ if (! pdb_query.author_regex)
+ goto cleanup;
+
+ pdb_query.copyright_regex = g_regex_new (copyright, PDB_REGEX_FLAGS, 0, error);
+ if (! pdb_query.copyright_regex)
+ goto cleanup;
+
+ pdb_query.date_regex = g_regex_new (date, PDB_REGEX_FLAGS, 0, error);
+ if (! pdb_query.date_regex)
+ goto cleanup;
+
+ pdb_query.proc_type_regex = g_regex_new (proc_type, PDB_REGEX_FLAGS, 0, error);
+ if (! pdb_query.proc_type_regex)
+ goto cleanup;
+
+ success = TRUE;
+
+ pdb_query.pdb = pdb;
+ pdb_query.list_of_procs = NULL;
+ pdb_query.num_procs = 0;
+ pdb_query.querying_compat = FALSE;
+
+ g_hash_table_foreach (pdb->procedures,
+ gimp_pdb_query_entry, &pdb_query);
+
+ pdb_query.querying_compat = TRUE;
+
+ g_hash_table_foreach (pdb->compat_proc_names,
+ gimp_pdb_query_entry, &pdb_query);
+
+ cleanup:
+
+ if (pdb_query.proc_type_regex)
+ g_regex_unref (pdb_query.proc_type_regex);
+
+ if (pdb_query.date_regex)
+ g_regex_unref (pdb_query.date_regex);
+
+ if (pdb_query.copyright_regex)
+ g_regex_unref (pdb_query.copyright_regex);
+
+ if (pdb_query.author_regex)
+ g_regex_unref (pdb_query.author_regex);
+
+ if (pdb_query.help_regex)
+ g_regex_unref (pdb_query.help_regex);
+
+ if (pdb_query.blurb_regex)
+ g_regex_unref (pdb_query.blurb_regex);
+
+ if (pdb_query.name_regex)
+ g_regex_unref (pdb_query.name_regex);
+
+ if (success)
+ {
+ *num_procs = pdb_query.num_procs;
+ *procs = pdb_query.list_of_procs;
+ }
+
+ return success;
+}
+
+gboolean
+gimp_pdb_proc_info (GimpPDB *pdb,
+ const gchar *proc_name,
+ gchar **blurb,
+ gchar **help,
+ gchar **author,
+ gchar **copyright,
+ gchar **date,
+ GimpPDBProcType *proc_type,
+ gint *num_args,
+ gint *num_values,
+ GError **error)
+{
+ GimpProcedure *procedure;
+ PDBStrings strings;
+
+ g_return_val_if_fail (GIMP_IS_PDB (pdb), FALSE);
+ g_return_val_if_fail (proc_name != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ procedure = gimp_pdb_lookup_procedure (pdb, proc_name);
+
+ if (procedure)
+ {
+ gimp_pdb_get_strings (&strings, procedure, FALSE);
+ }
+ else
+ {
+ const gchar *compat_name;
+
+ compat_name = gimp_pdb_lookup_compat_proc_name (pdb, proc_name);
+
+ if (compat_name)
+ {
+ procedure = gimp_pdb_lookup_procedure (pdb, compat_name);
+
+ if (procedure)
+ gimp_pdb_get_strings (&strings, procedure, TRUE);
+ }
+ }
+
+ if (procedure)
+ {
+ *blurb = strings.compat ? strings.blurb : g_strdup (strings.blurb);
+ *help = strings.compat ? strings.help : g_strdup (strings.help);
+ *author = strings.compat ? strings.author : g_strdup (strings.author);
+ *copyright = strings.compat ? strings.copyright : g_strdup (strings.copyright);
+ *date = strings.compat ? strings.date : g_strdup (strings.date);
+ *proc_type = procedure->proc_type;
+ *num_args = procedure->num_args;
+ *num_values = procedure->num_values;
+
+ return TRUE;
+ }
+
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_PROCEDURE_NOT_FOUND,
+ _("Procedure '%s' not found"), proc_name);
+
+ return FALSE;
+}
+
+
+/* private functions */
+
+static gboolean
+match_string (GRegex *regex,
+ const gchar *string)
+{
+ if (! string)
+ string = "";
+
+ return g_regex_match (regex, string, 0, NULL);
+}
+
+static void
+gimp_pdb_query_entry (gpointer key,
+ gpointer value,
+ gpointer user_data)
+{
+ PDBQuery *pdb_query = user_data;
+ GList *list;
+ GimpProcedure *procedure;
+ const gchar *proc_name;
+ PDBStrings strings;
+ GEnumClass *enum_class;
+ GimpEnumDesc *type_desc;
+
+ proc_name = key;
+
+ if (pdb_query->querying_compat)
+ list = g_hash_table_lookup (pdb_query->pdb->procedures, value);
+ else
+ list = value;
+
+ if (! list)
+ return;
+
+ procedure = list->data;
+
+ gimp_pdb_get_strings (&strings, procedure, pdb_query->querying_compat);
+
+ enum_class = g_type_class_ref (GIMP_TYPE_PDB_PROC_TYPE);
+ type_desc = gimp_enum_get_desc (enum_class, procedure->proc_type);
+ g_type_class_unref (enum_class);
+
+ if (match_string (pdb_query->name_regex, proc_name) &&
+ match_string (pdb_query->blurb_regex, strings.blurb) &&
+ match_string (pdb_query->help_regex, strings.help) &&
+ match_string (pdb_query->author_regex, strings.author) &&
+ match_string (pdb_query->copyright_regex, strings.copyright) &&
+ match_string (pdb_query->date_regex, strings.date) &&
+ match_string (pdb_query->proc_type_regex, type_desc->value_desc))
+ {
+ pdb_query->num_procs++;
+ pdb_query->list_of_procs = g_renew (gchar *, pdb_query->list_of_procs,
+ pdb_query->num_procs);
+ pdb_query->list_of_procs[pdb_query->num_procs - 1] = g_strdup (proc_name);
+ }
+
+ gimp_pdb_free_strings (&strings);
+}
+
+/* #define DEBUG_OUTPUT 1 */
+
+static void
+output_string (GString *dest,
+ const gchar *string)
+{
+#ifndef DEBUG_OUTPUT
+ g_string_append_printf (dest, "\"");
+#endif
+
+ if (string)
+ while (*string)
+ {
+ switch (*string)
+ {
+ case '\\' : g_string_append_printf (dest, "\\\\"); break;
+ case '\"' : g_string_append_printf (dest, "\\\""); break;
+ case '{' : g_string_append_printf (dest, "@{"); break;
+ case '@' : g_string_append_printf (dest, "@@"); break;
+ case '}' : g_string_append_printf (dest, "@}"); break;
+
+ default:
+ g_string_append_printf (dest, "%c", *string);
+ }
+ string++;
+ }
+
+#ifndef DEBUG_OUTPUT
+ g_string_append_printf (dest, "\"\n");
+#endif
+}
+
+static void
+gimp_pdb_print_entry (gpointer key,
+ gpointer value,
+ gpointer user_data)
+{
+ PDBDump *pdb_dump = user_data;
+ GOutputStream *output = pdb_dump->output;
+ const gchar *proc_name;
+ GList *list;
+ GEnumClass *arg_class;
+ GEnumClass *proc_class;
+ GString *buf;
+ GString *string;
+ gint num = 0;
+
+ if (pdb_dump->error)
+ return;
+
+ proc_name = key;
+
+ if (pdb_dump->dumping_compat)
+ list = g_hash_table_lookup (pdb_dump->pdb->procedures, value);
+ else
+ list = value;
+
+ arg_class = g_type_class_ref (GIMP_TYPE_PDB_ARG_TYPE);
+ proc_class = g_type_class_ref (GIMP_TYPE_PDB_PROC_TYPE);
+
+ buf = g_string_new (NULL);
+ string = g_string_new (NULL);
+
+ for (; list; list = list->next)
+ {
+ GimpProcedure *procedure = list->data;
+ PDBStrings strings;
+ GEnumValue *arg_value;
+ GimpEnumDesc *type_desc;
+ gint i;
+
+ num++;
+
+ gimp_pdb_get_strings (&strings, procedure, pdb_dump->dumping_compat);
+
+#ifdef DEBUG_OUTPUT
+ g_string_append_printf (string, "(");
+#else
+ g_string_append_printf (string, "(register-procedure ");
+#endif
+
+ if (num != 1)
+ {
+ g_string_printf (buf, "%s <%d>", proc_name, num);
+ output_string (string, buf->str);
+ }
+ else
+ {
+ output_string (string, proc_name);
+ }
+
+ type_desc = gimp_enum_get_desc (proc_class, procedure->proc_type);
+
+#ifdef DEBUG_OUTPUT
+
+ g_string_append_printf (string, " (");
+
+ for (i = 0; i < procedure->num_args; i++)
+ {
+ GParamSpec *pspec = procedure->args[i];
+ GimpPDBArgType arg_type;
+
+ arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
+
+ arg_value = g_enum_get_value (arg_class, arg_type);
+
+ if (i > 0)
+ g_string_append_printf (string, " ");
+
+ output_string (string, arg_value->value_name);
+ }
+
+ g_string_append_printf (string, ") (");
+
+ for (i = 0; i < procedure->num_values; i++)
+ {
+ GParamSpec *pspec = procedure->values[i];
+ GimpPDBArgType arg_type;
+
+ arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
+
+ arg_value = g_enum_get_value (arg_class, arg_type);
+
+ if (i > 0)
+ g_string_append_printf (string, " ");
+
+ output_string (string, arg_value->value_name);
+ }
+
+ g_string_append_printf (string, "))\n");
+
+#else /* ! DEBUG_OUTPUT */
+
+ g_string_append_printf (string, " ");
+ output_string (string, strings.blurb);
+
+ g_string_append_printf (string, " ");
+ output_string (string, strings.help);
+
+ g_string_append_printf (string, " ");
+ output_string (string, strings.author);
+
+ g_string_append_printf (string, " ");
+ output_string (string, strings.copyright);
+
+ g_string_append_printf (string, " ");
+ output_string (string, strings.date);
+
+ g_string_append_printf (string, " ");
+ output_string (string, type_desc->value_desc);
+
+ g_string_append_printf (string, " (");
+
+ for (i = 0; i < procedure->num_args; i++)
+ {
+ GParamSpec *pspec = procedure->args[i];
+ GimpPDBArgType arg_type;
+ gchar *desc = gimp_param_spec_get_desc (pspec);
+
+ g_string_append_printf (string, "\n (\n");
+
+ arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
+
+ arg_value = g_enum_get_value (arg_class, arg_type);
+
+ g_string_append_printf (string, " ");
+ output_string (string, g_param_spec_get_name (pspec));
+
+ g_string_append_printf (string, " ");
+ output_string (string, arg_value->value_name);
+
+ g_string_append_printf (string, " ");
+ output_string (string, desc);
+
+ g_free (desc);
+
+ g_string_append_printf (string, " )");
+ }
+
+ g_string_append_printf (string, "\n )\n");
+
+ g_string_append_printf (string, " (");
+
+ for (i = 0; i < procedure->num_values; i++)
+ {
+ GParamSpec *pspec = procedure->values[i];
+ GimpPDBArgType arg_type;
+ gchar *desc = gimp_param_spec_get_desc (pspec);
+
+ g_string_append_printf (string, "\n (\n");
+
+ arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
+
+ arg_value = g_enum_get_value (arg_class, arg_type);
+
+ g_string_append_printf (string, " ");
+ output_string (string, g_param_spec_get_name (pspec));
+
+ g_string_append_printf (string, " ");
+ output_string (string, arg_value->value_name);
+
+ g_string_append_printf (string, " ");
+ output_string (string, desc);
+
+ g_free (desc);
+
+ g_string_append_printf (string, " )");
+ }
+
+ g_string_append_printf (string, "\n )");
+ g_string_append_printf (string, "\n)\n");
+
+#endif /* DEBUG_OUTPUT */
+
+ gimp_pdb_free_strings (&strings);
+ }
+
+ g_output_stream_write_all (output, string->str, string->len,
+ NULL, NULL, &pdb_dump->error);
+
+ g_string_free (string, TRUE);
+ g_string_free (buf, TRUE);
+
+ g_type_class_unref (arg_class);
+ g_type_class_unref (proc_class);
+}
+
+static void
+gimp_pdb_get_strings (PDBStrings *strings,
+ GimpProcedure *procedure,
+ gboolean compat)
+{
+ strings->compat = compat;
+
+ if (compat)
+ {
+ strings->blurb = g_strdup_printf (COMPAT_BLURB,
+ gimp_object_get_name (procedure));
+ strings->help = g_strdup (strings->blurb);
+ strings->author = NULL;
+ strings->copyright = NULL;
+ strings->date = NULL;
+ }
+ else
+ {
+ strings->blurb = procedure->blurb;
+ strings->help = procedure->help;
+ strings->author = procedure->author;
+ strings->copyright = procedure->copyright;
+ strings->date = procedure->date;
+ }
+}
+
+static void
+gimp_pdb_free_strings (PDBStrings *strings)
+{
+ if (strings->compat)
+ {
+ g_free (strings->blurb);
+ g_free (strings->help);
+ }
+}
diff --git a/app/pdb/gimppdb-query.h b/app/pdb/gimppdb-query.h
new file mode 100644
index 0000000..4b8c320
--- /dev/null
+++ b/app/pdb/gimppdb-query.h
@@ -0,0 +1,49 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_PDB_QUERY_H__
+#define __GIMP_PDB_QUERY_H__
+
+
+gboolean gimp_pdb_dump (GimpPDB *pdb,
+ GFile *file,
+ GError **error);
+gboolean gimp_pdb_query (GimpPDB *pdb,
+ const gchar *name,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ const gchar *proc_type,
+ gint *num_procs,
+ gchar ***procs,
+ GError **error);
+gboolean gimp_pdb_proc_info (GimpPDB *pdb,
+ const gchar *proc_name,
+ gchar **blurb,
+ gchar **help,
+ gchar **author,
+ gchar **copyright,
+ gchar **date,
+ GimpPDBProcType *proc_type,
+ gint *num_args,
+ gint *num_values,
+ GError **error);
+
+
+#endif /* __GIMP_PDB_QUERY_H__ */
diff --git a/app/pdb/gimppdb-utils.c b/app/pdb/gimppdb-utils.c
new file mode 100644
index 0000000..b5d2eda
--- /dev/null
+++ b/app/pdb/gimppdb-utils.c
@@ -0,0 +1,846 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gegl.h>
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpbrushgenerated.h"
+#include "core/gimpchannel.h"
+#include "core/gimpcontainer.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
+#include "core/gimpimage-guides.h"
+#include "core/gimpimage-sample-points.h"
+#include "core/gimpitem.h"
+
+#include "text/gimptextlayer.h"
+
+#include "vectors/gimpvectors.h"
+
+#include "gimppdb-utils.h"
+#include "gimppdberror.h"
+
+#include "gimp-intl.h"
+
+
+static GimpObject *
+gimp_pdb_get_data_factory_item (GimpDataFactory *factory,
+ const gchar *name)
+{
+ GimpObject *object;
+
+ object = gimp_container_get_child_by_name (gimp_data_factory_get_container (factory), name);
+
+ if (! object)
+ object = gimp_container_get_child_by_name (gimp_data_factory_get_container_obsolete (factory), name);
+
+ if (! object && ! strcmp (name, "Standard"))
+ {
+ Gimp *gimp = gimp_data_factory_get_gimp (factory);
+
+ object = (GimpObject *)
+ gimp_data_factory_data_get_standard (factory,
+ gimp_get_user_context (gimp));
+ }
+
+ return object;
+}
+
+
+GimpBrush *
+gimp_pdb_get_brush (Gimp *gimp,
+ const gchar *name,
+ GimpPDBDataAccess access,
+ GError **error)
+{
+ GimpBrush *brush;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ if (! name || ! strlen (name))
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Invalid empty brush name"));
+ return NULL;
+ }
+
+ brush = (GimpBrush *) gimp_pdb_get_data_factory_item (gimp->brush_factory, name);
+
+ if (! brush)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Brush '%s' not found"), name);
+ }
+ else if ((access & GIMP_PDB_DATA_ACCESS_WRITE) &&
+ ! gimp_data_is_writable (GIMP_DATA (brush)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Brush '%s' is not editable"), name);
+ return NULL;
+ }
+ else if ((access & GIMP_PDB_DATA_ACCESS_RENAME) &&
+ ! gimp_viewable_is_name_editable (GIMP_VIEWABLE (brush)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Brush '%s' is not renamable"), name);
+ return NULL;
+ }
+
+ return brush;
+}
+
+GimpBrush *
+gimp_pdb_get_generated_brush (Gimp *gimp,
+ const gchar *name,
+ GimpPDBDataAccess access,
+ GError **error)
+{
+ GimpBrush *brush;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ brush = gimp_pdb_get_brush (gimp, name, access, error);
+
+ if (! brush)
+ return NULL;
+
+ if (! GIMP_IS_BRUSH_GENERATED (brush))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Brush '%s' is not a generated brush"), name);
+ return NULL;
+ }
+
+ return brush;
+}
+
+GimpDynamics *
+gimp_pdb_get_dynamics (Gimp *gimp,
+ const gchar *name,
+ GimpPDBDataAccess access,
+ GError **error)
+{
+ GimpDynamics *dynamics;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ if (! name || ! strlen (name))
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Invalid empty paint dynamics name"));
+ return NULL;
+ }
+
+ dynamics = (GimpDynamics *) gimp_pdb_get_data_factory_item (gimp->dynamics_factory, name);
+
+ if (! dynamics)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Paint dynamics '%s' not found"), name);
+ }
+ else if ((access & GIMP_PDB_DATA_ACCESS_WRITE) &&
+ ! gimp_data_is_writable (GIMP_DATA (dynamics)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Paint dynamics '%s' is not editable"), name);
+ return NULL;
+ }
+ else if ((access & GIMP_PDB_DATA_ACCESS_RENAME) &&
+ ! gimp_viewable_is_name_editable (GIMP_VIEWABLE (dynamics)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Paint dynamics '%s' is not renamable"), name);
+ return NULL;
+ }
+
+ return dynamics;
+}
+
+GimpMybrush *
+gimp_pdb_get_mybrush (Gimp *gimp,
+ const gchar *name,
+ GimpPDBDataAccess access,
+ GError **error)
+{
+ GimpMybrush *brush;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ if (! name || ! strlen (name))
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Invalid empty MyPaint brush name"));
+ return NULL;
+ }
+
+ brush = (GimpMybrush *) gimp_pdb_get_data_factory_item (gimp->mybrush_factory, name);
+
+ if (! brush)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("MyPaint brush '%s' not found"), name);
+ }
+ else if ((access & GIMP_PDB_DATA_ACCESS_WRITE) &&
+ ! gimp_data_is_writable (GIMP_DATA (brush)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("MyPaint brush '%s' is not editable"), name);
+ return NULL;
+ }
+ else if ((access & GIMP_PDB_DATA_ACCESS_RENAME) &&
+ ! gimp_viewable_is_name_editable (GIMP_VIEWABLE (brush)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("MyPaint brush '%s' is not renamable"), name);
+ return NULL;
+ }
+
+ return brush;
+}
+
+GimpPattern *
+gimp_pdb_get_pattern (Gimp *gimp,
+ const gchar *name,
+ GError **error)
+{
+ GimpPattern *pattern;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ if (! name || ! strlen (name))
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Invalid empty pattern name"));
+ return NULL;
+ }
+
+ pattern = (GimpPattern *) gimp_pdb_get_data_factory_item (gimp->pattern_factory, name);
+
+ if (! pattern)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Pattern '%s' not found"), name);
+ }
+
+ return pattern;
+}
+
+GimpGradient *
+gimp_pdb_get_gradient (Gimp *gimp,
+ const gchar *name,
+ GimpPDBDataAccess access,
+ GError **error)
+{
+ GimpGradient *gradient;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ if (! name || ! strlen (name))
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Invalid empty gradient name"));
+ return NULL;
+ }
+
+ gradient = (GimpGradient *) gimp_pdb_get_data_factory_item (gimp->gradient_factory, name);
+
+ if (! gradient)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Gradient '%s' not found"), name);
+ }
+ else if ((access & GIMP_PDB_DATA_ACCESS_WRITE) &&
+ ! gimp_data_is_writable (GIMP_DATA (gradient)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Gradient '%s' is not editable"), name);
+ return NULL;
+ }
+ else if ((access & GIMP_PDB_DATA_ACCESS_RENAME) &&
+ ! gimp_viewable_is_name_editable (GIMP_VIEWABLE (gradient)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Gradient '%s' is not renamable"), name);
+ return NULL;
+ }
+
+ return gradient;
+}
+
+GimpPalette *
+gimp_pdb_get_palette (Gimp *gimp,
+ const gchar *name,
+ GimpPDBDataAccess access,
+ GError **error)
+{
+ GimpPalette *palette;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ if (! name || ! strlen (name))
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Invalid empty palette name"));
+ return NULL;
+ }
+
+ palette = (GimpPalette *) gimp_pdb_get_data_factory_item (gimp->palette_factory, name);
+
+ if (! palette)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Palette '%s' not found"), name);
+ }
+ else if ((access & GIMP_PDB_DATA_ACCESS_WRITE) &&
+ ! gimp_data_is_writable (GIMP_DATA (palette)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Palette '%s' is not editable"), name);
+ return NULL;
+ }
+ else if ((access & GIMP_PDB_DATA_ACCESS_RENAME) &&
+ ! gimp_viewable_is_name_editable (GIMP_VIEWABLE (palette)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Palette '%s' is not renamable"), name);
+ return NULL;
+ }
+
+ return palette;
+}
+
+GimpFont *
+gimp_pdb_get_font (Gimp *gimp,
+ const gchar *name,
+ GError **error)
+{
+ GimpFont *font;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ if (! name || ! strlen (name))
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Invalid empty font name"));
+ return NULL;
+ }
+
+ font = (GimpFont *) gimp_pdb_get_data_factory_item (gimp->font_factory, name);
+
+ if (! font)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Font '%s' not found"), name);
+ }
+
+ return font;
+}
+
+GimpBuffer *
+gimp_pdb_get_buffer (Gimp *gimp,
+ const gchar *name,
+ GError **error)
+{
+ GimpBuffer *buffer;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ if (! name || ! strlen (name))
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Invalid empty buffer name"));
+ return NULL;
+ }
+
+ buffer = (GimpBuffer *)
+ gimp_container_get_child_by_name (gimp->named_buffers, name);
+
+ if (! buffer)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Named buffer '%s' not found"), name);
+ }
+
+ return buffer;
+}
+
+GimpPaintInfo *
+gimp_pdb_get_paint_info (Gimp *gimp,
+ const gchar *name,
+ GError **error)
+{
+ GimpPaintInfo *paint_info;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ if (! name || ! strlen (name))
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Invalid empty paint method name"));
+ return NULL;
+ }
+
+ paint_info = (GimpPaintInfo *)
+ gimp_container_get_child_by_name (gimp->paint_info_list, name);
+
+ if (! paint_info)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Paint method '%s' does not exist"), name);
+ }
+
+ return paint_info;
+}
+
+gboolean
+gimp_pdb_item_is_attached (GimpItem *item,
+ GimpImage *image,
+ GimpPDBItemModify modify,
+ GError **error)
+{
+ g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
+ g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (! gimp_item_is_attached (item))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Item '%s' (%d) cannot be used because it has not "
+ "been added to an image"),
+ gimp_object_get_name (item),
+ gimp_item_get_ID (item));
+ return FALSE;
+ }
+
+ if (image && image != gimp_item_get_image (item))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Item '%s' (%d) cannot be used because it is "
+ "attached to another image"),
+ gimp_object_get_name (item),
+ gimp_item_get_ID (item));
+ return FALSE;
+ }
+
+ return gimp_pdb_item_is_modifiable (item, modify, error);
+}
+
+gboolean
+gimp_pdb_item_is_in_tree (GimpItem *item,
+ GimpImage *image,
+ GimpPDBItemModify modify,
+ GError **error)
+{
+ g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
+ g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (! gimp_pdb_item_is_attached (item, image, modify, error))
+ return FALSE;
+
+ if (! gimp_item_get_tree (item))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Item '%s' (%d) cannot be used because it is not "
+ "a direct child of an item tree"),
+ gimp_object_get_name (item),
+ gimp_item_get_ID (item));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+gimp_pdb_item_is_in_same_tree (GimpItem *item,
+ GimpItem *item2,
+ GimpImage *image,
+ GError **error)
+{
+ g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
+ g_return_val_if_fail (GIMP_IS_ITEM (item2), FALSE);
+ g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (! gimp_pdb_item_is_in_tree (item, image, FALSE, error) ||
+ ! gimp_pdb_item_is_in_tree (item2, image, FALSE, error))
+ return FALSE;
+
+ if (gimp_item_get_tree (item) != gimp_item_get_tree (item2))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Items '%s' (%d) and '%s' (%d) cannot be used "
+ "because they are not part of the same item tree"),
+ gimp_object_get_name (item),
+ gimp_item_get_ID (item),
+ gimp_object_get_name (item2),
+ gimp_item_get_ID (item2));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+gimp_pdb_item_is_not_ancestor (GimpItem *item,
+ GimpItem *not_descendant,
+ GError **error)
+{
+ g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
+ g_return_val_if_fail (GIMP_IS_ITEM (not_descendant), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (gimp_viewable_is_ancestor (GIMP_VIEWABLE (item),
+ GIMP_VIEWABLE (not_descendant)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Item '%s' (%d) must not be an ancestor of "
+ "'%s' (%d)"),
+ gimp_object_get_name (item),
+ gimp_item_get_ID (item),
+ gimp_object_get_name (not_descendant),
+ gimp_item_get_ID (not_descendant));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+gimp_pdb_item_is_floating (GimpItem *item,
+ GimpImage *dest_image,
+ GError **error)
+{
+ g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
+ g_return_val_if_fail (GIMP_IS_IMAGE (dest_image), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (! g_object_is_floating (item))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Item '%s' (%d) has already been added to an image"),
+ gimp_object_get_name (item),
+ gimp_item_get_ID (item));
+ return FALSE;
+ }
+ else if (gimp_item_get_image (item) != dest_image)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Trying to add item '%s' (%d) to wrong image"),
+ gimp_object_get_name (item),
+ gimp_item_get_ID (item));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+gimp_pdb_item_is_modifiable (GimpItem *item,
+ GimpPDBItemModify modify,
+ GError **error)
+{
+ g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ /* When a channel is position-locked, it is also implicitly
+ * content-locked because we translate channels by modifying their
+ * pixels.
+ */
+ if ((modify & GIMP_PDB_ITEM_POSITION) && GIMP_IS_CHANNEL (item))
+ modify |= GIMP_PDB_ITEM_CONTENT;
+
+ if ((modify & GIMP_PDB_ITEM_CONTENT) && gimp_item_is_content_locked (item))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Item '%s' (%d) cannot be modified because its "
+ "contents are locked"),
+ gimp_object_get_name (item),
+ gimp_item_get_ID (item));
+ return FALSE;
+ }
+
+ if ((modify & GIMP_PDB_ITEM_POSITION) && gimp_item_is_position_locked (item))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Item '%s' (%d) cannot be modified because its "
+ "position and size are locked"),
+ gimp_object_get_name (item),
+ gimp_item_get_ID (item));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+gimp_pdb_item_is_group (GimpItem *item,
+ GError **error)
+{
+ g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (! gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Item '%s' (%d) cannot be used because it is "
+ "not a group item"),
+ gimp_object_get_name (item),
+ gimp_item_get_ID (item));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+gimp_pdb_item_is_not_group (GimpItem *item,
+ GError **error)
+{
+ g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Item '%s' (%d) cannot be modified because it "
+ "is a group item"),
+ gimp_object_get_name (item),
+ gimp_item_get_ID (item));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+gimp_pdb_layer_is_text_layer (GimpLayer *layer,
+ GimpPDBItemModify modify,
+ GError **error)
+{
+ g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (! gimp_item_is_text_layer (GIMP_ITEM (layer)))
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Layer '%s' (%d) cannot be used because it is not "
+ "a text layer"),
+ gimp_object_get_name (layer),
+ gimp_item_get_ID (GIMP_ITEM (layer)));
+
+ return FALSE;
+ }
+
+ return gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, modify, error);
+}
+
+static const gchar *
+gimp_pdb_enum_value_get_nick (GType enum_type,
+ gint value)
+{
+ GEnumClass *enum_class;
+ GEnumValue *enum_value;
+ const gchar *nick;
+
+ enum_class = g_type_class_ref (enum_type);
+ enum_value = g_enum_get_value (enum_class, value);
+
+ nick = enum_value->value_nick;
+
+ g_type_class_unref (enum_class);
+
+ return nick;
+}
+
+gboolean
+gimp_pdb_image_is_base_type (GimpImage *image,
+ GimpImageBaseType type,
+ GError **error)
+{
+ g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (gimp_image_get_base_type (image) == type)
+ return TRUE;
+
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Image '%s' (%d) is of type '%s', "
+ "but an image of type '%s' is expected"),
+ gimp_image_get_display_name (image),
+ gimp_image_get_ID (image),
+ gimp_pdb_enum_value_get_nick (GIMP_TYPE_IMAGE_BASE_TYPE,
+ gimp_image_get_base_type (image)),
+ gimp_pdb_enum_value_get_nick (GIMP_TYPE_IMAGE_BASE_TYPE, type));
+
+ return FALSE;
+}
+
+gboolean
+gimp_pdb_image_is_not_base_type (GimpImage *image,
+ GimpImageBaseType type,
+ GError **error)
+{
+ g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (gimp_image_get_base_type (image) != type)
+ return TRUE;
+
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Image '%s' (%d) must not be of type '%s'"),
+ gimp_image_get_display_name (image),
+ gimp_image_get_ID (image),
+ gimp_pdb_enum_value_get_nick (GIMP_TYPE_IMAGE_BASE_TYPE, type));
+
+ return FALSE;
+}
+
+gboolean
+gimp_pdb_image_is_precision (GimpImage *image,
+ GimpPrecision precision,
+ GError **error)
+{
+ g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (gimp_image_get_precision (image) == precision)
+ return TRUE;
+
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Image '%s' (%d) has precision '%s', "
+ "but an image of precision '%s' is expected"),
+ gimp_image_get_display_name (image),
+ gimp_image_get_ID (image),
+ gimp_pdb_enum_value_get_nick (GIMP_TYPE_PRECISION,
+ gimp_image_get_precision (image)),
+ gimp_pdb_enum_value_get_nick (GIMP_TYPE_PRECISION, precision));
+
+ return FALSE;
+}
+
+gboolean
+gimp_pdb_image_is_not_precision (GimpImage *image,
+ GimpPrecision precision,
+ GError **error)
+{
+ g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (gimp_image_get_precision (image) != precision)
+ return TRUE;
+
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Image '%s' (%d) must not be of precision '%s'"),
+ gimp_image_get_display_name (image),
+ gimp_image_get_ID (image),
+ gimp_pdb_enum_value_get_nick (GIMP_TYPE_PRECISION, precision));
+
+ return FALSE;
+}
+
+GimpGuide *
+gimp_pdb_image_get_guide (GimpImage *image,
+ gint guide_ID,
+ GError **error)
+{
+ GimpGuide *guide;
+
+ g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ guide = gimp_image_get_guide (image, guide_ID);
+
+ if (guide)
+ return guide;
+
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Image '%s' (%d) does not contain guide with ID %d"),
+ gimp_image_get_display_name (image),
+ gimp_image_get_ID (image),
+ guide_ID);
+ return NULL;
+}
+
+GimpSamplePoint *
+gimp_pdb_image_get_sample_point (GimpImage *image,
+ gint sample_point_ID,
+ GError **error)
+{
+ GimpSamplePoint *sample_point;
+
+ g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ sample_point = gimp_image_get_sample_point (image, sample_point_ID);
+
+ if (sample_point)
+ return sample_point;
+
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Image '%s' (%d) does not contain sample point with ID %d"),
+ gimp_image_get_display_name (image),
+ gimp_image_get_ID (image),
+ sample_point_ID);
+ return NULL;
+}
+
+GimpStroke *
+gimp_pdb_get_vectors_stroke (GimpVectors *vectors,
+ gint stroke_ID,
+ GimpPDBItemModify modify,
+ GError **error)
+{
+ GimpStroke *stroke = NULL;
+
+ g_return_val_if_fail (GIMP_IS_VECTORS (vectors), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ if (! gimp_pdb_item_is_not_group (GIMP_ITEM (vectors), error))
+ return NULL;
+
+ if (! modify || gimp_pdb_item_is_modifiable (GIMP_ITEM (vectors),
+ modify, error))
+ {
+ stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_ID);
+
+ if (! stroke)
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Vectors object %d does not contain stroke with ID %d"),
+ gimp_item_get_ID (GIMP_ITEM (vectors)), stroke_ID);
+ }
+
+ return stroke;
+}
diff --git a/app/pdb/gimppdb-utils.h b/app/pdb/gimppdb-utils.h
new file mode 100644
index 0000000..83b51c0
--- /dev/null
+++ b/app/pdb/gimppdb-utils.h
@@ -0,0 +1,117 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_PDB_UTILS_H__
+#define __GIMP_PDB_UTILS_H__
+
+
+GimpBrush * gimp_pdb_get_brush (Gimp *gimp,
+ const gchar *name,
+ GimpPDBDataAccess access,
+ GError **error);
+GimpBrush * gimp_pdb_get_generated_brush (Gimp *gimp,
+ const gchar *name,
+ GimpPDBDataAccess access,
+ GError **error);
+GimpDynamics * gimp_pdb_get_dynamics (Gimp *gimp,
+ const gchar *name,
+ GimpPDBDataAccess access,
+ GError **error);
+GimpMybrush * gimp_pdb_get_mybrush (Gimp *gimp,
+ const gchar *name,
+ GimpPDBDataAccess access,
+ GError **error);
+GimpPattern * gimp_pdb_get_pattern (Gimp *gimp,
+ const gchar *name,
+ GError **error);
+GimpGradient * gimp_pdb_get_gradient (Gimp *gimp,
+ const gchar *name,
+ GimpPDBDataAccess access,
+ GError **error);
+GimpPalette * gimp_pdb_get_palette (Gimp *gimp,
+ const gchar *name,
+ GimpPDBDataAccess access,
+ GError **error);
+GimpFont * gimp_pdb_get_font (Gimp *gimp,
+ const gchar *name,
+ GError **error);
+GimpBuffer * gimp_pdb_get_buffer (Gimp *gimp,
+ const gchar *name,
+ GError **error);
+GimpPaintInfo * gimp_pdb_get_paint_info (Gimp *gimp,
+ const gchar *name,
+ GError **error);
+
+gboolean gimp_pdb_item_is_attached (GimpItem *item,
+ GimpImage *image,
+ GimpPDBItemModify modify,
+ GError **error);
+gboolean gimp_pdb_item_is_in_tree (GimpItem *item,
+ GimpImage *image,
+ GimpPDBItemModify modify,
+ GError **error);
+gboolean gimp_pdb_item_is_in_same_tree (GimpItem *item,
+ GimpItem *item2,
+ GimpImage *image,
+ GError **error);
+gboolean gimp_pdb_item_is_not_ancestor (GimpItem *item,
+ GimpItem *not_descendant,
+ GError **error);
+gboolean gimp_pdb_item_is_floating (GimpItem *item,
+ GimpImage *dest_image,
+ GError **error);
+gboolean gimp_pdb_item_is_modifiable (GimpItem *item,
+ GimpPDBItemModify modify,
+ GError **error);
+gboolean gimp_pdb_item_is_group (GimpItem *item,
+ GError **error);
+gboolean gimp_pdb_item_is_not_group (GimpItem *item,
+ GError **error);
+
+gboolean gimp_pdb_layer_is_text_layer (GimpLayer *layer,
+ GimpPDBItemModify modify,
+ GError **error);
+
+gboolean gimp_pdb_image_is_base_type (GimpImage *image,
+ GimpImageBaseType type,
+ GError **error);
+gboolean gimp_pdb_image_is_not_base_type (GimpImage *image,
+ GimpImageBaseType type,
+ GError **error);
+
+gboolean gimp_pdb_image_is_precision (GimpImage *image,
+ GimpPrecision precision,
+ GError **error);
+gboolean gimp_pdb_image_is_not_precision (GimpImage *image,
+ GimpPrecision precision,
+ GError **error);
+
+GimpGuide * gimp_pdb_image_get_guide (GimpImage *image,
+ gint guide_ID,
+ GError **error);
+GimpSamplePoint *
+ gimp_pdb_image_get_sample_point (GimpImage *image,
+ gint sample_point_ID,
+ GError **error);
+
+GimpStroke * gimp_pdb_get_vectors_stroke (GimpVectors *vectors,
+ gint stroke_ID,
+ GimpPDBItemModify modify,
+ GError **error);
+
+
+#endif /* __GIMP_PDB_UTILS_H__ */
diff --git a/app/pdb/gimppdb.c b/app/pdb/gimppdb.c
new file mode 100644
index 0000000..cff9051
--- /dev/null
+++ b/app/pdb/gimppdb.c
@@ -0,0 +1,518 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <stdarg.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include <gobject/gvaluecollector.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gegl.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimp-memsize.h"
+#include "core/gimpcontext.h"
+#include "core/gimpmarshal.h"
+#include "core/gimpprogress.h"
+
+#include "gimppdb.h"
+#include "gimppdberror.h"
+#include "gimpprocedure.h"
+
+#include "gimp-intl.h"
+
+
+enum
+{
+ REGISTER_PROCEDURE,
+ UNREGISTER_PROCEDURE,
+ LAST_SIGNAL
+};
+
+
+static void gimp_pdb_finalize (GObject *object);
+static gint64 gimp_pdb_get_memsize (GimpObject *object,
+ gint64 *gui_size);
+static void gimp_pdb_real_register_procedure (GimpPDB *pdb,
+ GimpProcedure *procedure);
+static void gimp_pdb_real_unregister_procedure (GimpPDB *pdb,
+ GimpProcedure *procedure);
+static void gimp_pdb_entry_free (gpointer key,
+ gpointer value,
+ gpointer user_data);
+static gint64 gimp_pdb_entry_get_memsize (GList *procedures,
+ gint64 *gui_size);
+
+
+G_DEFINE_TYPE (GimpPDB, gimp_pdb, GIMP_TYPE_OBJECT)
+
+#define parent_class gimp_pdb_parent_class
+
+static guint gimp_pdb_signals[LAST_SIGNAL] = { 0 };
+
+
+static void
+gimp_pdb_class_init (GimpPDBClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
+
+ gimp_pdb_signals[REGISTER_PROCEDURE] =
+ g_signal_new ("register-procedure",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpPDBClass, register_procedure),
+ NULL, NULL,
+ gimp_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GIMP_TYPE_PROCEDURE);
+
+ gimp_pdb_signals[UNREGISTER_PROCEDURE] =
+ g_signal_new ("unregister-procedure",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpPDBClass, unregister_procedure),
+ NULL, NULL,
+ gimp_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GIMP_TYPE_PROCEDURE);
+
+ object_class->finalize = gimp_pdb_finalize;
+
+ gimp_object_class->get_memsize = gimp_pdb_get_memsize;
+
+ klass->register_procedure = gimp_pdb_real_register_procedure;
+ klass->unregister_procedure = gimp_pdb_real_unregister_procedure;
+}
+
+static void
+gimp_pdb_init (GimpPDB *pdb)
+{
+ pdb->procedures = g_hash_table_new (g_str_hash, g_str_equal);
+ pdb->compat_proc_names = g_hash_table_new (g_str_hash, g_str_equal);
+}
+
+static void
+gimp_pdb_finalize (GObject *object)
+{
+ GimpPDB *pdb = GIMP_PDB (object);
+
+ if (pdb->procedures)
+ {
+ g_hash_table_foreach (pdb->procedures, gimp_pdb_entry_free, NULL);
+ g_hash_table_destroy (pdb->procedures);
+ pdb->procedures = NULL;
+ }
+
+ if (pdb->compat_proc_names)
+ {
+ g_hash_table_destroy (pdb->compat_proc_names);
+ pdb->compat_proc_names = NULL;
+ }
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gint64
+gimp_pdb_get_memsize (GimpObject *object,
+ gint64 *gui_size)
+{
+ GimpPDB *pdb = GIMP_PDB (object);
+ gint64 memsize = 0;
+
+ memsize += gimp_g_hash_table_get_memsize_foreach (pdb->procedures,
+ (GimpMemsizeFunc)
+ gimp_pdb_entry_get_memsize,
+ gui_size);
+ memsize += gimp_g_hash_table_get_memsize (pdb->compat_proc_names, 0);
+
+ return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
+ gui_size);
+}
+
+static void
+gimp_pdb_real_register_procedure (GimpPDB *pdb,
+ GimpProcedure *procedure)
+{
+ const gchar *name;
+ GList *list;
+
+ name = gimp_object_get_name (procedure);
+
+ list = g_hash_table_lookup (pdb->procedures, name);
+
+ g_hash_table_replace (pdb->procedures, (gpointer) name,
+ g_list_prepend (list, g_object_ref (procedure)));
+}
+
+static void
+gimp_pdb_real_unregister_procedure (GimpPDB *pdb,
+ GimpProcedure *procedure)
+{
+ const gchar *name;
+ GList *list;
+
+ name = gimp_object_get_name (procedure);
+
+ list = g_hash_table_lookup (pdb->procedures, name);
+
+ if (list)
+ {
+ list = g_list_remove (list, procedure);
+
+ if (list)
+ {
+ name = gimp_object_get_name (list->data);
+ g_hash_table_replace (pdb->procedures, (gpointer) name, list);
+ }
+ else
+ {
+ g_hash_table_remove (pdb->procedures, name);
+ }
+
+ g_object_unref (procedure);
+ }
+}
+
+
+/* public functions */
+
+GimpPDB *
+gimp_pdb_new (Gimp *gimp)
+{
+ GimpPDB *pdb;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+
+ pdb = g_object_new (GIMP_TYPE_PDB,
+ "name", "pdb",
+ NULL);
+
+ pdb->gimp = gimp;
+
+ return pdb;
+}
+
+void
+gimp_pdb_register_procedure (GimpPDB *pdb,
+ GimpProcedure *procedure)
+{
+ g_return_if_fail (GIMP_IS_PDB (pdb));
+ g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
+
+ if (! procedure->deprecated ||
+ pdb->gimp->pdb_compat_mode != GIMP_PDB_COMPAT_OFF)
+ {
+ g_signal_emit (pdb, gimp_pdb_signals[REGISTER_PROCEDURE], 0,
+ procedure);
+ }
+}
+
+void
+gimp_pdb_unregister_procedure (GimpPDB *pdb,
+ GimpProcedure *procedure)
+{
+ g_return_if_fail (GIMP_IS_PDB (pdb));
+ g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
+
+ g_signal_emit (pdb, gimp_pdb_signals[UNREGISTER_PROCEDURE], 0,
+ procedure);
+}
+
+GimpProcedure *
+gimp_pdb_lookup_procedure (GimpPDB *pdb,
+ const gchar *name)
+{
+ GList *list;
+
+ g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+
+ list = g_hash_table_lookup (pdb->procedures, name);
+
+ if (list)
+ return list->data;
+
+ return NULL;
+}
+
+void
+gimp_pdb_register_compat_proc_name (GimpPDB *pdb,
+ const gchar *old_name,
+ const gchar *new_name)
+{
+ g_return_if_fail (GIMP_IS_PDB (pdb));
+ g_return_if_fail (old_name != NULL);
+ g_return_if_fail (new_name != NULL);
+
+ g_hash_table_insert (pdb->compat_proc_names,
+ (gpointer) old_name,
+ (gpointer) new_name);
+}
+
+const gchar *
+gimp_pdb_lookup_compat_proc_name (GimpPDB *pdb,
+ const gchar *old_name)
+{
+ g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL);
+ g_return_val_if_fail (old_name != NULL, NULL);
+
+ return g_hash_table_lookup (pdb->compat_proc_names, old_name);
+}
+
+GimpValueArray *
+gimp_pdb_execute_procedure_by_name_args (GimpPDB *pdb,
+ GimpContext *context,
+ GimpProgress *progress,
+ GError **error,
+ const gchar *name,
+ GimpValueArray *args)
+{
+ GimpValueArray *return_vals = NULL;
+ GList *list;
+
+ g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL);
+ g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+
+ list = g_hash_table_lookup (pdb->procedures, name);
+
+ if (list == NULL)
+ {
+ GError *pdb_error = g_error_new (GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_PROCEDURE_NOT_FOUND,
+ _("Procedure '%s' not found"), name);
+
+ return_vals = gimp_procedure_get_return_values (NULL, FALSE, pdb_error);
+ g_propagate_error (error, pdb_error);
+
+ return return_vals;
+ }
+
+ g_return_val_if_fail (args != NULL, NULL);
+
+ for (; list; list = g_list_next (list))
+ {
+ GimpProcedure *procedure = list->data;
+
+ g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
+
+ return_vals = gimp_procedure_execute (procedure,
+ pdb->gimp, context, progress,
+ args, error);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) ==
+ GIMP_PDB_PASS_THROUGH)
+ {
+ /* If the return value is GIMP_PDB_PASS_THROUGH and there is
+ * a next procedure in the list, destroy the return values
+ * and run the next procedure.
+ */
+ if (g_list_next (list))
+ {
+ gimp_value_array_unref (return_vals);
+ g_clear_error (error);
+ }
+ }
+ else
+ {
+ /* No GIMP_PDB_PASS_THROUGH, break out of the list of
+ * procedures and return the current return values.
+ */
+ break;
+ }
+ }
+
+ return return_vals;
+}
+
+GimpValueArray *
+gimp_pdb_execute_procedure_by_name (GimpPDB *pdb,
+ GimpContext *context,
+ GimpProgress *progress,
+ GError **error,
+ const gchar *name,
+ ...)
+{
+ GimpProcedure *procedure;
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ va_list va_args;
+ gint i;
+
+ g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL);
+ g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+
+ procedure = gimp_pdb_lookup_procedure (pdb, name);
+
+ if (! procedure)
+ {
+ GError *pdb_error = g_error_new (GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_PROCEDURE_NOT_FOUND,
+ _("Procedure '%s' not found"), name);
+
+ return_vals = gimp_procedure_get_return_values (NULL, FALSE, pdb_error);
+ g_propagate_error (error, pdb_error);
+
+ return return_vals;
+ }
+
+ args = gimp_procedure_get_arguments (procedure);
+
+ va_start (va_args, name);
+
+ for (i = 0; i < procedure->num_args; i++)
+ {
+ GValue *value;
+ GType arg_type;
+ gchar *error_msg = NULL;
+
+ arg_type = va_arg (va_args, GType);
+
+ if (arg_type == G_TYPE_NONE)
+ break;
+
+ value = gimp_value_array_index (args, i);
+
+ if (arg_type != G_VALUE_TYPE (value))
+ {
+ GError *pdb_error;
+ const gchar *expected = g_type_name (G_VALUE_TYPE (value));
+ const gchar *got = g_type_name (arg_type);
+
+ gimp_value_array_unref (args);
+
+ pdb_error = g_error_new (GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Procedure '%s' has been called with a "
+ "wrong type for argument #%d. "
+ "Expected %s, got %s."),
+ gimp_object_get_name (procedure),
+ i + 1, expected, got);
+
+ return_vals = gimp_procedure_get_return_values (procedure,
+ FALSE, pdb_error);
+ g_propagate_error (error, pdb_error);
+
+ va_end (va_args);
+
+ return return_vals;
+ }
+
+ G_VALUE_COLLECT (value, va_args, G_VALUE_NOCOPY_CONTENTS, &error_msg);
+
+ if (error_msg)
+ {
+ GError *pdb_error = g_error_new_literal (GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INTERNAL_ERROR,
+ error_msg);
+ g_warning ("%s: %s", G_STRFUNC, error_msg);
+ g_free (error_msg);
+
+ gimp_value_array_unref (args);
+
+ return_vals = gimp_procedure_get_return_values (procedure,
+ FALSE, pdb_error);
+ g_propagate_error (error, pdb_error);
+
+ va_end (va_args);
+
+ return return_vals;
+ }
+ }
+
+ va_end (va_args);
+
+ return_vals = gimp_pdb_execute_procedure_by_name_args (pdb, context,
+ progress, error,
+ name, args);
+
+ gimp_value_array_unref (args);
+
+ return return_vals;
+}
+
+/**
+ * gimp_pdb_get_deprecated_procedures:
+ * @pdb:
+ *
+ * Returns: A new #GList with the deprecated procedures. Free with
+ * g_list_free().
+ **/
+GList *
+gimp_pdb_get_deprecated_procedures (GimpPDB *pdb)
+{
+ GList *result = NULL;
+ GList *procs;
+ GList *iter;
+
+ g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL);
+
+ procs = g_hash_table_get_values (pdb->procedures);
+
+ for (iter = procs;
+ iter;
+ iter = g_list_next (iter))
+ {
+ GList *proc_list = iter->data;
+
+ /* Only care about the first procedure in the list */
+ GimpProcedure *procedure = GIMP_PROCEDURE (proc_list->data);
+
+ if (procedure->deprecated)
+ result = g_list_prepend (result, procedure);
+ }
+
+ result = g_list_sort (result, (GCompareFunc) gimp_procedure_name_compare);
+
+ g_list_free (procs);
+
+ return result;
+}
+
+
+/* private functions */
+
+static void
+gimp_pdb_entry_free (gpointer key,
+ gpointer value,
+ gpointer user_data)
+{
+ if (value)
+ g_list_free_full (value, (GDestroyNotify) g_object_unref);
+}
+
+static gint64
+gimp_pdb_entry_get_memsize (GList *procedures,
+ gint64 *gui_size)
+{
+ return gimp_g_list_get_memsize_foreach (procedures,
+ (GimpMemsizeFunc)
+ gimp_object_get_memsize,
+ gui_size);
+}
diff --git a/app/pdb/gimppdb.h b/app/pdb/gimppdb.h
new file mode 100644
index 0000000..26fc416
--- /dev/null
+++ b/app/pdb/gimppdb.h
@@ -0,0 +1,90 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_PDB_H__
+#define __GIMP_PDB_H__
+
+
+#include "core/gimpobject.h"
+
+
+#define GIMP_TYPE_PDB (gimp_pdb_get_type ())
+#define GIMP_PDB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PDB, GimpPDB))
+#define GIMP_PDB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PDB, GimpPDBClass))
+#define GIMP_IS_PDB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PDB))
+#define GIMP_IS_PDB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PDB))
+#define GIMP_PDB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PDB, GimpPDBClass))
+
+
+typedef struct _GimpPDBClass GimpPDBClass;
+
+struct _GimpPDB
+{
+ GimpObject parent_instance;
+
+ Gimp *gimp;
+
+ GHashTable *procedures;
+ GHashTable *compat_proc_names;
+};
+
+struct _GimpPDBClass
+{
+ GimpObjectClass parent_class;
+
+ void (* register_procedure) (GimpPDB *pdb,
+ GimpProcedure *procedure);
+ void (* unregister_procedure) (GimpPDB *pdb,
+ GimpProcedure *procedure);
+};
+
+
+GType gimp_pdb_get_type (void) G_GNUC_CONST;
+
+GimpPDB * gimp_pdb_new (Gimp *gimp);
+
+void gimp_pdb_register_procedure (GimpPDB *pdb,
+ GimpProcedure *procedure);
+void gimp_pdb_unregister_procedure (GimpPDB *pdb,
+ GimpProcedure *procedure);
+
+GimpProcedure * gimp_pdb_lookup_procedure (GimpPDB *pdb,
+ const gchar *name);
+
+void gimp_pdb_register_compat_proc_name (GimpPDB *pdb,
+ const gchar *old_name,
+ const gchar *new_name);
+const gchar * gimp_pdb_lookup_compat_proc_name (GimpPDB *pdb,
+ const gchar *old_name);
+
+GimpValueArray * gimp_pdb_execute_procedure_by_name_args (GimpPDB *pdb,
+ GimpContext *context,
+ GimpProgress *progress,
+ GError **error,
+ const gchar *name,
+ GimpValueArray *args);
+GimpValueArray * gimp_pdb_execute_procedure_by_name (GimpPDB *pdb,
+ GimpContext *context,
+ GimpProgress *progress,
+ GError **error,
+ const gchar *name,
+ ...);
+
+GList * gimp_pdb_get_deprecated_procedures (GimpPDB *pdb);
+
+
+#endif /* __GIMP_PDB_H__ */
diff --git a/app/pdb/gimppdbcontext.c b/app/pdb/gimppdbcontext.c
new file mode 100644
index 0000000..ca49599
--- /dev/null
+++ b/app/pdb/gimppdbcontext.c
@@ -0,0 +1,554 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
+ *
+ * gimppdbcontext.c
+ *
+ * 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 <gdk-pixbuf/gdk-pixbuf.h>
+#include <gegl.h>
+
+#include "libgimpconfig/gimpconfig.h"
+
+#include "pdb-types.h"
+
+#include "config/gimpcoreconfig.h"
+
+#include "core/gimp.h"
+#include "core/gimplist.h"
+#include "core/gimppaintinfo.h"
+#include "core/gimpstrokeoptions.h"
+
+#include "paint/gimpbrushcore.h"
+#include "paint/gimppaintoptions.h"
+
+#include "gimppdbcontext.h"
+
+#include "gimp-intl.h"
+
+
+enum
+{
+ PROP_0,
+ PROP_ANTIALIAS,
+ PROP_FEATHER,
+ PROP_FEATHER_RADIUS_X,
+ PROP_FEATHER_RADIUS_Y,
+ PROP_SAMPLE_MERGED,
+ PROP_SAMPLE_CRITERION,
+ PROP_SAMPLE_THRESHOLD,
+ PROP_SAMPLE_TRANSPARENT,
+ PROP_DIAGONAL_NEIGHBORS,
+ PROP_INTERPOLATION,
+ PROP_TRANSFORM_DIRECTION,
+ PROP_TRANSFORM_RESIZE,
+ PROP_DISTANCE_METRIC
+};
+
+
+static void gimp_pdb_context_iface_init (GimpConfigInterface *iface);
+
+static void gimp_pdb_context_constructed (GObject *object);
+static void gimp_pdb_context_finalize (GObject *object);
+static void gimp_pdb_context_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_pdb_context_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_pdb_context_reset (GimpConfig *config);
+
+
+G_DEFINE_TYPE_WITH_CODE (GimpPDBContext, gimp_pdb_context, GIMP_TYPE_CONTEXT,
+ G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
+ gimp_pdb_context_iface_init))
+
+#define parent_class gimp_pdb_context_parent_class
+
+static GimpConfigInterface *parent_config_iface = NULL;
+
+
+static void
+gimp_pdb_context_class_init (GimpPDBContextClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->constructed = gimp_pdb_context_constructed;
+ object_class->finalize = gimp_pdb_context_finalize;
+ object_class->set_property = gimp_pdb_context_set_property;
+ object_class->get_property = gimp_pdb_context_get_property;
+
+ GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_ANTIALIAS,
+ "antialias",
+ _("Antialiasing"),
+ _("Smooth edges"),
+ TRUE,
+ GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_FEATHER,
+ "feather",
+ _("Feather"),
+ NULL,
+ FALSE,
+ GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_FEATHER_RADIUS_X,
+ "feather-radius-x",
+ _("Feather radius X"),
+ NULL,
+ 0.0, 1000.0, 10.0,
+ GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_FEATHER_RADIUS_Y,
+ "feather-radius-y",
+ _("Feather radius Y"),
+ NULL,
+ 0.0, 1000.0, 10.0,
+ GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SAMPLE_MERGED,
+ "sample-merged",
+ _("Sample merged"),
+ NULL,
+ FALSE,
+ GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_ENUM (object_class, PROP_SAMPLE_CRITERION,
+ "sample-criterion",
+ _("Sample criterion"),
+ NULL,
+ GIMP_TYPE_SELECT_CRITERION,
+ GIMP_SELECT_CRITERION_COMPOSITE,
+ GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_SAMPLE_THRESHOLD,
+ "sample-threshold",
+ _("Sample threshold"),
+ NULL,
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SAMPLE_TRANSPARENT,
+ "sample-transparent",
+ _("Sample transparent"),
+ NULL,
+ FALSE,
+ GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_DIAGONAL_NEIGHBORS,
+ "diagonal-neighbors",
+ _("Diagonal neighbors"),
+ NULL,
+ FALSE,
+ GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_ENUM (object_class, PROP_INTERPOLATION,
+ "interpolation",
+ _("Interpolation"),
+ NULL,
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_CUBIC,
+ GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_ENUM (object_class, PROP_TRANSFORM_DIRECTION,
+ "transform-direction",
+ _("Transform direction"),
+ NULL,
+ GIMP_TYPE_TRANSFORM_DIRECTION,
+ GIMP_TRANSFORM_FORWARD,
+ GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_ENUM (object_class, PROP_TRANSFORM_RESIZE,
+ "transform-resize",
+ _("Transform resize"),
+ NULL,
+ GIMP_TYPE_TRANSFORM_RESIZE,
+ GIMP_TRANSFORM_RESIZE_ADJUST,
+ GIMP_PARAM_STATIC_STRINGS);
+
+ /* Legacy blend used "manhattan" metric to compute distance.
+ * API needs to stay compatible, hence the default value for this
+ * property.
+ * Nevertheless Euclidean distance since to render better; for GIMP 3
+ * API, we might therefore want to change the defaults to
+ * GEGL_DISTANCE_METRIC_EUCLIDEAN. FIXME.
+ */
+ GIMP_CONFIG_PROP_ENUM (object_class, PROP_DISTANCE_METRIC,
+ "distance-metric",
+ _("Distance metric"),
+ NULL,
+ GEGL_TYPE_DISTANCE_METRIC,
+ GEGL_DISTANCE_METRIC_MANHATTAN,
+ GIMP_PARAM_STATIC_STRINGS);
+
+}
+
+static void
+gimp_pdb_context_iface_init (GimpConfigInterface *iface)
+{
+ parent_config_iface = g_type_interface_peek_parent (iface);
+
+ if (! parent_config_iface)
+ parent_config_iface = g_type_default_interface_peek (GIMP_TYPE_CONFIG);
+
+ iface->reset = gimp_pdb_context_reset;
+}
+
+static void
+gimp_pdb_context_init (GimpPDBContext *context)
+{
+ context->paint_options_list = gimp_list_new (GIMP_TYPE_PAINT_OPTIONS,
+ FALSE);
+}
+
+static void
+gimp_pdb_context_constructed (GObject *object)
+{
+ GimpPDBContext *context = GIMP_PDB_CONTEXT (object);
+ GimpInterpolationType interpolation;
+ gint threshold;
+ GParamSpec *pspec;
+
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ context->stroke_options = gimp_stroke_options_new (GIMP_CONTEXT (context)->gimp,
+ GIMP_CONTEXT (context),
+ TRUE);
+
+ /* keep the stroke options in sync with the context */
+ gimp_context_define_properties (GIMP_CONTEXT (context->stroke_options),
+ GIMP_CONTEXT_PROP_MASK_ALL, FALSE);
+ gimp_context_set_parent (GIMP_CONTEXT (context->stroke_options),
+ GIMP_CONTEXT (context));
+
+ /* preserve the traditional PDB default */
+ g_object_set (context->stroke_options,
+ "method", GIMP_STROKE_PAINT_METHOD,
+ NULL);
+
+ g_object_bind_property (G_OBJECT (context), "antialias",
+ G_OBJECT (context->stroke_options), "antialias",
+ G_BINDING_SYNC_CREATE);
+
+ /* get default interpolation from gimprc */
+
+ interpolation = GIMP_CONTEXT (object)->gimp->config->interpolation_type;
+
+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object),
+ "interpolation");
+
+ if (pspec)
+ G_PARAM_SPEC_ENUM (pspec)->default_value = interpolation;
+
+ g_object_set (object, "interpolation", interpolation, NULL);
+
+ /* get default threshold from gimprc */
+
+ threshold = GIMP_CONTEXT (object)->gimp->config->default_threshold;
+
+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object),
+ "sample-threshold");
+
+ if (pspec)
+ G_PARAM_SPEC_DOUBLE (pspec)->default_value = threshold / 255.0;
+
+ g_object_set (object, "sample-threshold", threshold / 255.0, NULL);
+}
+
+static void
+gimp_pdb_context_finalize (GObject *object)
+{
+ GimpPDBContext *context = GIMP_PDB_CONTEXT (object);
+
+ g_clear_object (&context->paint_options_list);
+ g_clear_object (&context->stroke_options);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gimp_pdb_context_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpPDBContext *options = GIMP_PDB_CONTEXT (object);
+
+ switch (property_id)
+ {
+ case PROP_ANTIALIAS:
+ options->antialias = g_value_get_boolean (value);
+ break;
+
+ case PROP_FEATHER:
+ options->feather = g_value_get_boolean (value);
+ break;
+
+ case PROP_FEATHER_RADIUS_X:
+ options->feather_radius_x = g_value_get_double (value);
+ break;
+
+ case PROP_FEATHER_RADIUS_Y:
+ options->feather_radius_y = g_value_get_double (value);
+ break;
+
+ case PROP_SAMPLE_MERGED:
+ options->sample_merged = g_value_get_boolean (value);
+ break;
+
+ case PROP_SAMPLE_CRITERION:
+ options->sample_criterion = g_value_get_enum (value);
+ break;
+
+ case PROP_SAMPLE_THRESHOLD:
+ options->sample_threshold = g_value_get_double (value);
+ break;
+
+ case PROP_SAMPLE_TRANSPARENT:
+ options->sample_transparent = g_value_get_boolean (value);
+ break;
+
+ case PROP_DIAGONAL_NEIGHBORS:
+ options->diagonal_neighbors = g_value_get_boolean (value);
+ break;
+
+ case PROP_INTERPOLATION:
+ options->interpolation = g_value_get_enum (value);
+ break;
+
+ case PROP_TRANSFORM_DIRECTION:
+ options->transform_direction = g_value_get_enum (value);
+ break;
+
+ case PROP_TRANSFORM_RESIZE:
+ options->transform_resize = g_value_get_enum (value);
+ break;
+
+ case PROP_DISTANCE_METRIC:
+ options->distance_metric = g_value_get_enum (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_pdb_context_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpPDBContext *options = GIMP_PDB_CONTEXT (object);
+
+ switch (property_id)
+ {
+ case PROP_ANTIALIAS:
+ g_value_set_boolean (value, options->antialias);
+ break;
+
+ case PROP_FEATHER:
+ g_value_set_boolean (value, options->feather);
+ break;
+
+ case PROP_FEATHER_RADIUS_X:
+ g_value_set_double (value, options->feather_radius_x);
+ break;
+
+ case PROP_FEATHER_RADIUS_Y:
+ g_value_set_double (value, options->feather_radius_y);
+ break;
+
+ case PROP_SAMPLE_MERGED:
+ g_value_set_boolean (value, options->sample_merged);
+ break;
+
+ case PROP_SAMPLE_CRITERION:
+ g_value_set_enum (value, options->sample_criterion);
+ break;
+
+ case PROP_SAMPLE_THRESHOLD:
+ g_value_set_double (value, options->sample_threshold);
+ break;
+
+ case PROP_SAMPLE_TRANSPARENT:
+ g_value_set_boolean (value, options->sample_transparent);
+ break;
+
+ case PROP_DIAGONAL_NEIGHBORS:
+ g_value_set_boolean (value, options->diagonal_neighbors);
+ break;
+
+ case PROP_INTERPOLATION:
+ g_value_set_enum (value, options->interpolation);
+ break;
+
+ case PROP_TRANSFORM_DIRECTION:
+ g_value_set_enum (value, options->transform_direction);
+ break;
+
+ case PROP_TRANSFORM_RESIZE:
+ g_value_set_enum (value, options->transform_resize);
+ break;
+
+ case PROP_DISTANCE_METRIC:
+ g_value_set_enum (value, options->distance_metric);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_pdb_context_reset (GimpConfig *config)
+{
+ GimpPDBContext *context = GIMP_PDB_CONTEXT (config);
+ GList *list;
+
+ for (list = GIMP_LIST (context->paint_options_list)->queue->head;
+ list;
+ list = g_list_next (list))
+ {
+ gimp_config_reset (list->data);
+ }
+
+ gimp_config_reset (GIMP_CONFIG (context->stroke_options));
+
+ /* preserve the traditional PDB default */
+ g_object_set (context->stroke_options,
+ "method", GIMP_STROKE_PAINT_METHOD,
+ NULL);
+
+ parent_config_iface->reset (config);
+
+ g_object_notify (G_OBJECT (context), "antialias");
+}
+
+GimpContext *
+gimp_pdb_context_new (Gimp *gimp,
+ GimpContext *parent,
+ gboolean set_parent)
+{
+ GimpPDBContext *context;
+ GList *list;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (GIMP_IS_CONTEXT (parent), NULL);
+
+ context = g_object_new (GIMP_TYPE_PDB_CONTEXT,
+ "gimp", gimp,
+ "name", "PDB Context",
+ NULL);
+
+ if (set_parent)
+ {
+ gimp_context_define_properties (GIMP_CONTEXT (context),
+ GIMP_CONTEXT_PROP_MASK_ALL, FALSE);
+ gimp_context_set_parent (GIMP_CONTEXT (context), parent);
+
+ for (list = gimp_get_paint_info_iter (gimp);
+ list;
+ list = g_list_next (list))
+ {
+ GimpPaintInfo *info = list->data;
+
+ gimp_container_add (context->paint_options_list,
+ GIMP_OBJECT (info->paint_options));
+ }
+ }
+ else
+ {
+ for (list = GIMP_LIST (GIMP_PDB_CONTEXT (parent)->paint_options_list)->queue->head;
+ list;
+ list = g_list_next (list))
+ {
+ GimpPaintOptions *options = gimp_config_duplicate (list->data);
+
+ gimp_container_add (context->paint_options_list,
+ GIMP_OBJECT (options));
+ g_object_unref (options);
+ }
+
+ gimp_config_copy (GIMP_CONFIG (GIMP_PDB_CONTEXT (parent)->stroke_options),
+ GIMP_CONFIG (context->stroke_options),
+ 0);
+ }
+
+ /* copy the context properties last, they might have been
+ * overwritten by the above copying of stroke options, which have
+ * the pdb context as parent
+ */
+ gimp_config_sync (G_OBJECT (parent), G_OBJECT (context), 0);
+
+ return GIMP_CONTEXT (context);
+}
+
+GimpContainer *
+gimp_pdb_context_get_paint_options_list (GimpPDBContext *context)
+{
+ g_return_val_if_fail (GIMP_IS_PDB_CONTEXT (context), NULL);
+
+ return context->paint_options_list;
+}
+
+GimpPaintOptions *
+gimp_pdb_context_get_paint_options (GimpPDBContext *context,
+ const gchar *name)
+{
+ g_return_val_if_fail (GIMP_IS_PDB_CONTEXT (context), NULL);
+
+ if (! name)
+ name = gimp_object_get_name (gimp_context_get_paint_info (GIMP_CONTEXT (context)));
+
+ return (GimpPaintOptions *)
+ gimp_container_get_child_by_name (context->paint_options_list, name);
+}
+
+GList *
+gimp_pdb_context_get_brush_options (GimpPDBContext *context)
+{
+ GList *brush_options = NULL;
+ GList *list;
+
+ g_return_val_if_fail (GIMP_IS_PDB_CONTEXT (context), NULL);
+
+ for (list = GIMP_LIST (context->paint_options_list)->queue->head;
+ list;
+ list = g_list_next (list))
+ {
+ GimpPaintOptions *options = list->data;
+
+ if (g_type_is_a (options->paint_info->paint_type, GIMP_TYPE_BRUSH_CORE))
+ brush_options = g_list_prepend (brush_options, options);
+ }
+
+ return g_list_reverse (brush_options);
+}
+
+GimpStrokeOptions *
+gimp_pdb_context_get_stroke_options (GimpPDBContext *context)
+{
+ g_return_val_if_fail (GIMP_IS_PDB_CONTEXT (context), NULL);
+
+ return context->stroke_options;
+}
diff --git a/app/pdb/gimppdbcontext.h b/app/pdb/gimppdbcontext.h
new file mode 100644
index 0000000..ce2cdb3
--- /dev/null
+++ b/app/pdb/gimppdbcontext.h
@@ -0,0 +1,83 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
+ *
+ * gimppdbcontext.h
+ *
+ * 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_PDB_CONTEXT_H__
+#define __GIMP_PDB_CONTEXT_H__
+
+
+#include "core/gimpcontext.h"
+
+
+#define GIMP_TYPE_PDB_CONTEXT (gimp_pdb_context_get_type ())
+#define GIMP_PDB_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PDB_CONTEXT, GimpPDBContext))
+#define GIMP_PDB_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PDB_CONTEXT, GimpPDBContextClass))
+#define GIMP_IS_PDB_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PDB_CONTEXT))
+#define GIMP_IS_PDB_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PDB_CONTEXT))
+#define GIMP_PDB_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PDB_CONTEXT, GimpPDBContextClass))
+
+
+typedef struct _GimpPDBContext GimpPDBContext;
+typedef struct _GimpPDBContextClass GimpPDBContextClass;
+
+struct _GimpPDBContext
+{
+ GimpContext parent_instance;
+
+ gboolean antialias;
+ gboolean feather;
+ gdouble feather_radius_x;
+ gdouble feather_radius_y;
+ gboolean sample_merged;
+ GimpSelectCriterion sample_criterion;
+ gdouble sample_threshold;
+ gboolean sample_transparent;
+ gboolean diagonal_neighbors;
+
+ GimpInterpolationType interpolation;
+ GimpTransformDirection transform_direction;
+ GimpTransformResize transform_resize;
+
+ GimpContainer *paint_options_list;
+ GimpStrokeOptions *stroke_options;
+
+ GeglDistanceMetric distance_metric;
+};
+
+struct _GimpPDBContextClass
+{
+ GimpContextClass parent_class;
+};
+
+
+GType gimp_pdb_context_get_type (void) G_GNUC_CONST;
+
+GimpContext * gimp_pdb_context_new (Gimp *gimp,
+ GimpContext *parent,
+ gboolean set_parent);
+
+GimpContainer * gimp_pdb_context_get_paint_options_list
+ (GimpPDBContext *context);
+GimpPaintOptions * gimp_pdb_context_get_paint_options (GimpPDBContext *context,
+ const gchar *name);
+GList * gimp_pdb_context_get_brush_options (GimpPDBContext *context);
+
+GimpStrokeOptions * gimp_pdb_context_get_stroke_options (GimpPDBContext *context);
+
+
+#endif /* __GIMP_PDB_CONTEXT_H__ */
diff --git a/app/pdb/gimppdberror.c b/app/pdb/gimppdberror.c
new file mode 100644
index 0000000..a554ca0
--- /dev/null
+++ b/app/pdb/gimppdberror.c
@@ -0,0 +1,36 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+
+#include "gimppdberror.h"
+
+
+/**
+ * gimp_pdb_error_quark:
+ *
+ * This function is never called directly. Use GIMP_PDB_ERROR() instead.
+ *
+ * Return value: the #GQuark that defines the GimpPlugIn error domain.
+ **/
+GQuark
+gimp_pdb_error_quark (void)
+{
+ return g_quark_from_static_string ("gimp-pdb-error-quark");
+}
diff --git a/app/pdb/gimppdberror.h b/app/pdb/gimppdberror.h
new file mode 100644
index 0000000..11caa48
--- /dev/null
+++ b/app/pdb/gimppdberror.h
@@ -0,0 +1,38 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_PDB_ERROR_H__
+#define __GIMP_PDB_ERROR_H__
+
+
+typedef enum
+{
+ GIMP_PDB_ERROR_FAILED, /* generic error condition */
+ GIMP_PDB_ERROR_CANCELLED,
+ GIMP_PDB_ERROR_PROCEDURE_NOT_FOUND,
+ GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ GIMP_PDB_ERROR_INVALID_RETURN_VALUE,
+ GIMP_PDB_ERROR_INTERNAL_ERROR
+} GimpPdbErrorCode;
+
+
+#define GIMP_PDB_ERROR (gimp_pdb_error_quark ())
+
+GQuark gimp_pdb_error_quark (void) G_GNUC_CONST;
+
+
+#endif /* __GIMP_PDB_ERROR_H__ */
diff --git a/app/pdb/gimpprocedure.c b/app/pdb/gimpprocedure.c
new file mode 100644
index 0000000..a12dab9
--- /dev/null
+++ b/app/pdb/gimpprocedure.c
@@ -0,0 +1,897 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <stdarg.h>
+#include <sys/types.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gegl.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimp-memsize.h"
+#include "core/gimpchannel.h"
+#include "core/gimplayer.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimpprogress.h"
+
+#include "vectors/gimpvectors.h"
+
+#include "gimppdbcontext.h"
+#include "gimppdberror.h"
+#include "gimpprocedure.h"
+
+#include "gimp-intl.h"
+
+
+static void gimp_procedure_finalize (GObject *object);
+
+static gint64 gimp_procedure_get_memsize (GimpObject *object,
+ gint64 *gui_size);
+
+static const gchar * gimp_procedure_real_get_label (GimpProcedure *procedure);
+static const gchar * gimp_procedure_real_get_menu_label (GimpProcedure *procedure);
+static const gchar * gimp_procedure_real_get_blurb (GimpProcedure *procedure);
+static const gchar * gimp_procedure_real_get_help_id (GimpProcedure *procedure);
+static gboolean gimp_procedure_real_get_sensitive (GimpProcedure *procedure,
+ GimpObject *object,
+ const gchar **tooltip);
+static GimpValueArray * gimp_procedure_real_execute (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ GimpValueArray *args,
+ GError **error);
+static void gimp_procedure_real_execute_async (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ GimpValueArray *args,
+ GimpObject *display);
+
+static void gimp_procedure_free_strings (GimpProcedure *procedure);
+static gboolean gimp_procedure_validate_args (GimpProcedure *procedure,
+ GParamSpec **param_specs,
+ gint n_param_specs,
+ GimpValueArray *args,
+ gboolean return_vals,
+ GError **error);
+
+
+G_DEFINE_TYPE (GimpProcedure, gimp_procedure, GIMP_TYPE_VIEWABLE)
+
+#define parent_class gimp_procedure_parent_class
+
+
+static void
+gimp_procedure_class_init (GimpProcedureClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
+
+ object_class->finalize = gimp_procedure_finalize;
+
+ gimp_object_class->get_memsize = gimp_procedure_get_memsize;
+
+ klass->get_label = gimp_procedure_real_get_label;
+ klass->get_menu_label = gimp_procedure_real_get_menu_label;
+ klass->get_blurb = gimp_procedure_real_get_blurb;
+ klass->get_help_id = gimp_procedure_real_get_help_id;
+ klass->get_sensitive = gimp_procedure_real_get_sensitive;
+ klass->execute = gimp_procedure_real_execute;
+ klass->execute_async = gimp_procedure_real_execute_async;
+}
+
+static void
+gimp_procedure_init (GimpProcedure *procedure)
+{
+ procedure->proc_type = GIMP_INTERNAL;
+}
+
+static void
+gimp_procedure_finalize (GObject *object)
+{
+ GimpProcedure *procedure = GIMP_PROCEDURE (object);
+ gint i;
+
+ gimp_procedure_free_strings (procedure);
+
+ if (procedure->args)
+ {
+ for (i = 0; i < procedure->num_args; i++)
+ g_param_spec_unref (procedure->args[i]);
+
+ g_clear_pointer (&procedure->args, g_free);
+ }
+
+ if (procedure->values)
+ {
+ for (i = 0; i < procedure->num_values; i++)
+ g_param_spec_unref (procedure->values[i]);
+
+ g_clear_pointer (&procedure->values, g_free);
+ }
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gint64
+gimp_procedure_get_memsize (GimpObject *object,
+ gint64 *gui_size)
+{
+ GimpProcedure *procedure = GIMP_PROCEDURE (object);
+ gint64 memsize = 0;
+ gint i;
+
+ if (! procedure->static_strings)
+ {
+ memsize += gimp_string_get_memsize (procedure->original_name);
+ memsize += gimp_string_get_memsize (procedure->blurb);
+ memsize += gimp_string_get_memsize (procedure->help);
+ memsize += gimp_string_get_memsize (procedure->author);
+ memsize += gimp_string_get_memsize (procedure->copyright);
+ memsize += gimp_string_get_memsize (procedure->date);
+ memsize += gimp_string_get_memsize (procedure->deprecated);
+ }
+
+ memsize += procedure->num_args * sizeof (GParamSpec *);
+
+ for (i = 0; i < procedure->num_args; i++)
+ memsize += gimp_g_param_spec_get_memsize (procedure->args[i]);
+
+ memsize += procedure->num_values * sizeof (GParamSpec *);
+
+ for (i = 0; i < procedure->num_values; i++)
+ memsize += gimp_g_param_spec_get_memsize (procedure->values[i]);
+
+ return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
+ gui_size);
+}
+
+static const gchar *
+gimp_procedure_real_get_label (GimpProcedure *procedure)
+{
+ return gimp_object_get_name (procedure); /* lame fallback */
+}
+
+static const gchar *
+gimp_procedure_real_get_menu_label (GimpProcedure *procedure)
+{
+ return gimp_procedure_get_label (procedure);
+}
+
+static const gchar *
+gimp_procedure_real_get_blurb (GimpProcedure *procedure)
+{
+ return procedure->blurb;
+}
+
+static const gchar *
+gimp_procedure_real_get_help_id (GimpProcedure *procedure)
+{
+ return NULL;
+}
+
+static gboolean
+gimp_procedure_real_get_sensitive (GimpProcedure *procedure,
+ GimpObject *object,
+ const gchar **tooltip)
+{
+ return TRUE /* random fallback */;
+}
+
+static GimpValueArray *
+gimp_procedure_real_execute (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ GimpValueArray *args,
+ GError **error)
+{
+ g_return_val_if_fail (gimp_value_array_length (args) >=
+ procedure->num_args, NULL);
+
+ return procedure->marshal_func (procedure, gimp,
+ context, progress,
+ args, error);
+}
+
+static void
+gimp_procedure_real_execute_async (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ GimpValueArray *args,
+ GimpObject *display)
+{
+ GimpValueArray *return_vals;
+ GError *error = NULL;
+
+ g_return_if_fail (gimp_value_array_length (args) >= procedure->num_args);
+
+ return_vals = GIMP_PROCEDURE_GET_CLASS (procedure)->execute (procedure,
+ gimp,
+ context,
+ progress,
+ args,
+ &error);
+
+ gimp_value_array_unref (return_vals);
+
+ if (error)
+ {
+ gimp_message_literal (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
+ error->message);
+ g_error_free (error);
+ }
+}
+
+
+/* public functions */
+
+GimpProcedure *
+gimp_procedure_new (GimpMarshalFunc marshal_func)
+{
+ GimpProcedure *procedure;
+
+ g_return_val_if_fail (marshal_func != NULL, NULL);
+
+ procedure = g_object_new (GIMP_TYPE_PROCEDURE, NULL);
+
+ procedure->marshal_func = marshal_func;
+
+ return procedure;
+}
+
+void
+gimp_procedure_set_strings (GimpProcedure *procedure,
+ const gchar *original_name,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ const gchar *deprecated)
+{
+ g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
+
+ gimp_procedure_free_strings (procedure);
+
+ procedure->original_name = g_strdup (original_name);
+ procedure->blurb = g_strdup (blurb);
+ procedure->help = g_strdup (help);
+ procedure->author = g_strdup (author);
+ procedure->copyright = g_strdup (copyright);
+ procedure->date = g_strdup (date);
+ procedure->deprecated = g_strdup (deprecated);
+
+ procedure->static_strings = FALSE;
+}
+
+void
+gimp_procedure_set_static_strings (GimpProcedure *procedure,
+ const gchar *original_name,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ const gchar *deprecated)
+{
+ g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
+
+ gimp_procedure_free_strings (procedure);
+
+ procedure->original_name = (gchar *) original_name;
+ procedure->blurb = (gchar *) blurb;
+ procedure->help = (gchar *) help;
+ procedure->author = (gchar *) author;
+ procedure->copyright = (gchar *) copyright;
+ procedure->date = (gchar *) date;
+ procedure->deprecated = (gchar *) deprecated;
+
+ procedure->static_strings = TRUE;
+}
+
+void
+gimp_procedure_take_strings (GimpProcedure *procedure,
+ gchar *original_name,
+ gchar *blurb,
+ gchar *help,
+ gchar *author,
+ gchar *copyright,
+ gchar *date,
+ gchar *deprecated)
+{
+ g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
+
+ gimp_procedure_free_strings (procedure);
+
+ procedure->original_name = original_name;
+ procedure->blurb = blurb;
+ procedure->help = help;
+ procedure->author = author;
+ procedure->copyright = copyright;
+ procedure->date = date;
+ procedure->deprecated = deprecated;
+
+ procedure->static_strings = FALSE;
+}
+
+const gchar *
+gimp_procedure_get_label (GimpProcedure *procedure)
+{
+ g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
+
+ return GIMP_PROCEDURE_GET_CLASS (procedure)->get_label (procedure);
+}
+
+const gchar *
+gimp_procedure_get_menu_label (GimpProcedure *procedure)
+{
+ g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
+
+ return GIMP_PROCEDURE_GET_CLASS (procedure)->get_menu_label (procedure);
+}
+
+const gchar *
+gimp_procedure_get_blurb (GimpProcedure *procedure)
+{
+ g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
+
+ return GIMP_PROCEDURE_GET_CLASS (procedure)->get_blurb (procedure);
+}
+
+const gchar *
+gimp_procedure_get_help_id (GimpProcedure *procedure)
+{
+ g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
+
+ return GIMP_PROCEDURE_GET_CLASS (procedure)->get_help_id (procedure);
+}
+
+gboolean
+gimp_procedure_get_sensitive (GimpProcedure *procedure,
+ GimpObject *object,
+ const gchar **tooltip)
+{
+ const gchar *my_tooltip = NULL;
+ gboolean sensitive;
+
+ g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), FALSE);
+ g_return_val_if_fail (object == NULL || GIMP_IS_OBJECT (object), FALSE);
+
+ sensitive = GIMP_PROCEDURE_GET_CLASS (procedure)->get_sensitive (procedure,
+ object,
+ &my_tooltip);
+
+ if (tooltip)
+ *tooltip = my_tooltip;
+
+ return sensitive;
+}
+
+GimpValueArray *
+gimp_procedure_execute (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ GError *pdb_error = NULL;
+
+ g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
+ g_return_val_if_fail (args != NULL, NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ if (! gimp_procedure_validate_args (procedure,
+ procedure->args, procedure->num_args,
+ args, FALSE, &pdb_error))
+ {
+ return_vals = gimp_procedure_get_return_values (procedure, FALSE,
+ pdb_error);
+ g_propagate_error (error, pdb_error);
+
+ return return_vals;
+ }
+
+ if (GIMP_IS_PDB_CONTEXT (context))
+ context = g_object_ref (context);
+ else
+ context = gimp_pdb_context_new (gimp, context, TRUE);
+
+ if (progress)
+ g_object_ref (progress);
+
+ /* call the procedure */
+ return_vals = GIMP_PROCEDURE_GET_CLASS (procedure)->execute (procedure,
+ gimp,
+ context,
+ progress,
+ args,
+ error);
+
+ if (progress)
+ g_object_unref (progress);
+
+ g_object_unref (context);
+
+ if (return_vals)
+ {
+ switch (g_value_get_enum (gimp_value_array_index (return_vals, 0)))
+ {
+ case GIMP_PDB_CALLING_ERROR:
+ case GIMP_PDB_EXECUTION_ERROR:
+ /* If the error has not already been set, construct one
+ * from the error message that is optionally passed with
+ * the return values.
+ */
+ if (error && *error == NULL &&
+ gimp_value_array_length (return_vals) > 1 &&
+ G_VALUE_HOLDS_STRING (gimp_value_array_index (return_vals, 1)))
+ {
+ GValue *value = gimp_value_array_index (return_vals, 1);
+ const gchar *message = g_value_get_string (value);
+
+ if (message)
+ g_set_error_literal (error, GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_FAILED,
+ message);
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ else
+ {
+ g_warning ("%s: no return values, shouldn't happen", G_STRFUNC);
+
+ pdb_error = g_error_new (GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_RETURN_VALUE,
+ _("Procedure '%s' returned no return values"),
+ gimp_object_get_name (procedure));
+
+ return_vals = gimp_procedure_get_return_values (procedure, FALSE,
+ pdb_error);
+ if (error && *error == NULL)
+ g_propagate_error (error, pdb_error);
+ else
+ g_error_free (pdb_error);
+
+ }
+
+ return return_vals;
+}
+
+void
+gimp_procedure_execute_async (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ GimpValueArray *args,
+ GimpObject *display,
+ GError **error)
+{
+ g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
+ g_return_if_fail (GIMP_IS_GIMP (gimp));
+ g_return_if_fail (GIMP_IS_CONTEXT (context));
+ g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
+ g_return_if_fail (args != NULL);
+ g_return_if_fail (display == NULL || GIMP_IS_OBJECT (display));
+ g_return_if_fail (error == NULL || *error == NULL);
+
+ if (gimp_procedure_validate_args (procedure,
+ procedure->args, procedure->num_args,
+ args, FALSE, error))
+ {
+ if (GIMP_IS_PDB_CONTEXT (context))
+ context = g_object_ref (context);
+ else
+ context = gimp_pdb_context_new (gimp, context, TRUE);
+
+ if (progress)
+ g_object_ref (progress);
+
+ GIMP_PROCEDURE_GET_CLASS (procedure)->execute_async (procedure, gimp,
+ context, progress,
+ args, display);
+
+ if (progress)
+ g_object_unref (progress);
+
+ g_object_unref (context);
+ }
+}
+
+GimpValueArray *
+gimp_procedure_get_arguments (GimpProcedure *procedure)
+{
+ GimpValueArray *args;
+ GValue value = G_VALUE_INIT;
+ gint i;
+
+ g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
+
+ args = gimp_value_array_new (procedure->num_args);
+
+ for (i = 0; i < procedure->num_args; i++)
+ {
+ g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (procedure->args[i]));
+ gimp_value_array_append (args, &value);
+ g_value_unset (&value);
+ }
+
+ return args;
+}
+
+GimpValueArray *
+gimp_procedure_get_return_values (GimpProcedure *procedure,
+ gboolean success,
+ const GError *error)
+{
+ GimpValueArray *args;
+ GValue value = G_VALUE_INIT;
+ gint i;
+
+ g_return_val_if_fail (success == FALSE || GIMP_IS_PROCEDURE (procedure),
+ NULL);
+
+ if (success)
+ {
+ args = gimp_value_array_new (procedure->num_values + 1);
+
+ g_value_init (&value, GIMP_TYPE_PDB_STATUS_TYPE);
+ g_value_set_enum (&value, GIMP_PDB_SUCCESS);
+ gimp_value_array_append (args, &value);
+ g_value_unset (&value);
+
+ for (i = 0; i < procedure->num_values; i++)
+ {
+ g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (procedure->values[i]));
+ gimp_value_array_append (args, &value);
+ g_value_unset (&value);
+ }
+ }
+ else
+ {
+ args = gimp_value_array_new ((error && error->message) ? 2 : 1);
+
+ g_value_init (&value, GIMP_TYPE_PDB_STATUS_TYPE);
+
+ /* errors in the GIMP_PDB_ERROR domain are calling errors */
+ if (error && error->domain == GIMP_PDB_ERROR)
+ {
+ switch ((GimpPdbErrorCode) error->code)
+ {
+ case GIMP_PDB_ERROR_FAILED:
+ case GIMP_PDB_ERROR_PROCEDURE_NOT_FOUND:
+ case GIMP_PDB_ERROR_INVALID_ARGUMENT:
+ case GIMP_PDB_ERROR_INVALID_RETURN_VALUE:
+ case GIMP_PDB_ERROR_INTERNAL_ERROR:
+ g_value_set_enum (&value, GIMP_PDB_CALLING_ERROR);
+ break;
+
+ case GIMP_PDB_ERROR_CANCELLED:
+ g_value_set_enum (&value, GIMP_PDB_CANCEL);
+ break;
+
+ default:
+ gimp_assert_not_reached ();
+ }
+ }
+ else
+ {
+ g_value_set_enum (&value, GIMP_PDB_EXECUTION_ERROR);
+ }
+
+ gimp_value_array_append (args, &value);
+ g_value_unset (&value);
+
+ if (error && error->message)
+ {
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, error->message);
+ gimp_value_array_append (args, &value);
+ g_value_unset (&value);
+ }
+ }
+
+ return args;
+}
+
+void
+gimp_procedure_add_argument (GimpProcedure *procedure,
+ GParamSpec *pspec)
+{
+ g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
+ g_return_if_fail (G_IS_PARAM_SPEC (pspec));
+
+ procedure->args = g_renew (GParamSpec *, procedure->args,
+ procedure->num_args + 1);
+
+ procedure->args[procedure->num_args] = pspec;
+
+ g_param_spec_ref_sink (pspec);
+
+ procedure->num_args++;
+}
+
+void
+gimp_procedure_add_return_value (GimpProcedure *procedure,
+ GParamSpec *pspec)
+{
+ g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
+ g_return_if_fail (G_IS_PARAM_SPEC (pspec));
+
+ procedure->values = g_renew (GParamSpec *, procedure->values,
+ procedure->num_values + 1);
+
+ procedure->values[procedure->num_values] = pspec;
+
+ g_param_spec_ref_sink (pspec);
+
+ procedure->num_values++;
+}
+
+/**
+ * gimp_procedure_create_override:
+ * @procedure:
+ * @new_marshal_func:
+ *
+ * Creates a new GimpProcedure that can be used to override the
+ * existing @procedure.
+ *
+ * Returns: The new #GimpProcedure.
+ **/
+GimpProcedure *
+gimp_procedure_create_override (GimpProcedure *procedure,
+ GimpMarshalFunc new_marshal_func)
+{
+ GimpProcedure *new_procedure = NULL;
+ const gchar *name = NULL;
+ int i = 0;
+
+ new_procedure = gimp_procedure_new (new_marshal_func);
+ name = gimp_object_get_name (procedure);
+
+ gimp_object_set_static_name (GIMP_OBJECT (new_procedure), name);
+
+ for (i = 0; i < procedure->num_args; i++)
+ gimp_procedure_add_argument (new_procedure, procedure->args[i]);
+
+ for (i = 0; i < procedure->num_values; i++)
+ gimp_procedure_add_return_value (new_procedure, procedure->values[i]);
+
+ return new_procedure;
+}
+
+gint
+gimp_procedure_name_compare (GimpProcedure *proc1,
+ GimpProcedure *proc2)
+{
+ /* Assume there always is a name, don't bother with NULL checks */
+ return strcmp (proc1->original_name,
+ proc2->original_name);
+}
+
+/* private functions */
+
+static void
+gimp_procedure_free_strings (GimpProcedure *procedure)
+{
+ if (! procedure->static_strings)
+ {
+ g_free (procedure->original_name);
+ g_free (procedure->blurb);
+ g_free (procedure->help);
+ g_free (procedure->author);
+ g_free (procedure->copyright);
+ g_free (procedure->date);
+ g_free (procedure->deprecated);
+ }
+
+ procedure->original_name = NULL;
+ procedure->blurb = NULL;
+ procedure->help = NULL;
+ procedure->author = NULL;
+ procedure->copyright = NULL;
+ procedure->date = NULL;
+ procedure->deprecated = NULL;
+
+ procedure->static_strings = FALSE;
+}
+
+static gboolean
+gimp_procedure_validate_args (GimpProcedure *procedure,
+ GParamSpec **param_specs,
+ gint n_param_specs,
+ GimpValueArray *args,
+ gboolean return_vals,
+ GError **error)
+{
+ gint i;
+
+ for (i = 0; i < MIN (gimp_value_array_length (args), n_param_specs); i++)
+ {
+ GValue *arg = gimp_value_array_index (args, i);
+ GParamSpec *pspec = param_specs[i];
+ GType arg_type = G_VALUE_TYPE (arg);
+ GType spec_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
+
+ if (arg_type != spec_type)
+ {
+ if (return_vals)
+ {
+ g_set_error (error,
+ GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_RETURN_VALUE,
+ _("Procedure '%s' returned a wrong value type "
+ "for return value '%s' (#%d). "
+ "Expected %s, got %s."),
+ gimp_object_get_name (procedure),
+ g_param_spec_get_name (pspec),
+ i + 1, g_type_name (spec_type),
+ g_type_name (arg_type));
+ }
+ else
+ {
+ g_set_error (error,
+ GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Procedure '%s' has been called with a "
+ "wrong value type for argument '%s' (#%d). "
+ "Expected %s, got %s."),
+ gimp_object_get_name (procedure),
+ g_param_spec_get_name (pspec),
+ i + 1, g_type_name (spec_type),
+ g_type_name (arg_type));
+ }
+
+ return FALSE;
+ }
+ else if (! (pspec->flags & GIMP_PARAM_NO_VALIDATE))
+ {
+ GValue string_value = G_VALUE_INIT;
+
+ g_value_init (&string_value, G_TYPE_STRING);
+
+ if (g_value_type_transformable (arg_type, G_TYPE_STRING))
+ g_value_transform (arg, &string_value);
+ else
+ g_value_set_static_string (&string_value,
+ "<not transformable to string>");
+
+ if (g_param_value_validate (pspec, arg))
+ {
+ if (GIMP_IS_PARAM_SPEC_DRAWABLE_ID (pspec) &&
+ g_value_get_int (arg) == -1)
+ {
+ if (return_vals)
+ {
+ g_set_error (error,
+ GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_RETURN_VALUE,
+ _("Procedure '%s' returned an "
+ "invalid ID for argument '%s'. "
+ "Most likely a plug-in is trying "
+ "to work on a layer that doesn't "
+ "exist any longer."),
+ gimp_object_get_name (procedure),
+ g_param_spec_get_name (pspec));
+ }
+ else
+ {
+ g_set_error (error,
+ GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Procedure '%s' has been called with an "
+ "invalid ID for argument '%s'. "
+ "Most likely a plug-in is trying "
+ "to work on a layer that doesn't "
+ "exist any longer."),
+ gimp_object_get_name (procedure),
+ g_param_spec_get_name (pspec));
+ }
+ }
+ else if (GIMP_IS_PARAM_SPEC_IMAGE_ID (pspec) &&
+ g_value_get_int (arg) == -1)
+ {
+ if (return_vals)
+ {
+ g_set_error (error,
+ GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_RETURN_VALUE,
+ _("Procedure '%s' returned an "
+ "invalid ID for argument '%s'. "
+ "Most likely a plug-in is trying "
+ "to work on an image that doesn't "
+ "exist any longer."),
+ gimp_object_get_name (procedure),
+ g_param_spec_get_name (pspec));
+ }
+ else
+ {
+ g_set_error (error,
+ GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Procedure '%s' has been called with an "
+ "invalid ID for argument '%s'. "
+ "Most likely a plug-in is trying "
+ "to work on an image that doesn't "
+ "exist any longer."),
+ gimp_object_get_name (procedure),
+ g_param_spec_get_name (pspec));
+ }
+ }
+ else
+ {
+ const gchar *value = g_value_get_string (&string_value);
+
+ if (value == NULL)
+ value = "(null)";
+
+ if (return_vals)
+ {
+ g_set_error (error,
+ GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_RETURN_VALUE,
+ _("Procedure '%s' returned "
+ "'%s' as return value '%s' "
+ "(#%d, type %s). "
+ "This value is out of range."),
+ gimp_object_get_name (procedure),
+ value,
+ g_param_spec_get_name (pspec),
+ i + 1, g_type_name (spec_type));
+ }
+ else
+ {
+ g_set_error (error,
+ GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Procedure '%s' has been called with "
+ "value '%s' for argument '%s' "
+ "(#%d, type %s). "
+ "This value is out of range."),
+ gimp_object_get_name (procedure),
+ value,
+ g_param_spec_get_name (pspec),
+ i + 1, g_type_name (spec_type));
+ }
+ }
+
+ g_value_unset (&string_value);
+
+ return FALSE;
+ }
+
+ g_value_unset (&string_value);
+ }
+ }
+
+ return TRUE;
+}
diff --git a/app/pdb/gimpprocedure.h b/app/pdb/gimpprocedure.h
new file mode 100644
index 0000000..7e9f2dc
--- /dev/null
+++ b/app/pdb/gimpprocedure.h
@@ -0,0 +1,164 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_PROCEDURE_H__
+#define __GIMP_PROCEDURE_H__
+
+
+#include "core/gimpviewable.h"
+
+
+typedef GimpValueArray * (* GimpMarshalFunc) (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error);
+
+
+#define GIMP_TYPE_PROCEDURE (gimp_procedure_get_type ())
+#define GIMP_PROCEDURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PROCEDURE, GimpProcedure))
+#define GIMP_PROCEDURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PROCEDURE, GimpProcedureClass))
+#define GIMP_IS_PROCEDURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PROCEDURE))
+#define GIMP_IS_PROCEDURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PROCEDURE))
+#define GIMP_PROCEDURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PROCEDURE, GimpProcedureClass))
+
+
+typedef struct _GimpProcedureClass GimpProcedureClass;
+
+struct _GimpProcedure
+{
+ GimpViewable parent_instance;
+
+ GimpPDBProcType proc_type; /* Type of procedure */
+
+ gboolean static_strings; /* Are the strings allocated? */
+
+ gchar *original_name; /* Uncanonicalized procedure name */
+ gchar *blurb; /* Short procedure description */
+ gchar *help; /* Detailed help instructions */
+ gchar *author; /* Author field */
+ gchar *copyright; /* Copyright field */
+ gchar *date; /* Date field */
+ gchar *deprecated; /* Replacement if deprecated */
+
+ gint32 num_args; /* Number of procedure arguments */
+ GParamSpec **args; /* Array of procedure arguments */
+
+ gint32 num_values; /* Number of return values */
+ GParamSpec **values; /* Array of return values */
+
+ GimpMarshalFunc marshal_func; /* Marshaller for internal procs */
+};
+
+struct _GimpProcedureClass
+{
+ GimpViewableClass parent_class;
+
+ const gchar * (* get_label) (GimpProcedure *procedure);
+ const gchar * (* get_menu_label) (GimpProcedure *procedure);
+ const gchar * (* get_blurb) (GimpProcedure *procedure);
+ const gchar * (* get_help_id) (GimpProcedure *procedure);
+ gboolean (* get_sensitive) (GimpProcedure *procedure,
+ GimpObject *object,
+ const gchar **tooltip);
+
+ GimpValueArray * (* execute) (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ GimpValueArray *args,
+ GError **error);
+ void (* execute_async) (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ GimpValueArray *args,
+ GimpObject *display);
+};
+
+
+GType gimp_procedure_get_type (void) G_GNUC_CONST;
+
+GimpProcedure * gimp_procedure_new (GimpMarshalFunc marshal_func);
+
+void gimp_procedure_set_strings (GimpProcedure *procedure,
+ const gchar *original_name,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ const gchar *deprecated);
+void gimp_procedure_set_static_strings (GimpProcedure *procedure,
+ const gchar *original_name,
+ const gchar *blurb,
+ const gchar *help,
+ const gchar *author,
+ const gchar *copyright,
+ const gchar *date,
+ const gchar *deprecated);
+void gimp_procedure_take_strings (GimpProcedure *procedure,
+ gchar *original_name,
+ gchar *blurb,
+ gchar *help,
+ gchar *author,
+ gchar *copyright,
+ gchar *date,
+ gchar *deprecated);
+
+const gchar * gimp_procedure_get_label (GimpProcedure *procedure);
+const gchar * gimp_procedure_get_menu_label (GimpProcedure *procedure);
+const gchar * gimp_procedure_get_blurb (GimpProcedure *procedure);
+const gchar * gimp_procedure_get_help_id (GimpProcedure *procedure);
+gboolean gimp_procedure_get_sensitive (GimpProcedure *procedure,
+ GimpObject *object,
+ const gchar **tooltip);
+
+void gimp_procedure_add_argument (GimpProcedure *procedure,
+ GParamSpec *pspec);
+void gimp_procedure_add_return_value (GimpProcedure *procedure,
+ GParamSpec *pspec);
+
+GimpValueArray * gimp_procedure_get_arguments (GimpProcedure *procedure);
+GimpValueArray * gimp_procedure_get_return_values (GimpProcedure *procedure,
+ gboolean success,
+ const GError *error);
+
+GimpProcedure * gimp_procedure_create_override (GimpProcedure *procedure,
+ GimpMarshalFunc new_marshal_func);
+
+GimpValueArray * gimp_procedure_execute (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ GimpValueArray *args,
+ GError **error);
+void gimp_procedure_execute_async (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ GimpValueArray *args,
+ GimpObject *display,
+ GError **error);
+
+gint gimp_procedure_name_compare (GimpProcedure *proc1,
+ GimpProcedure *proc2);
+
+
+
+#endif /* __GIMP_PROCEDURE_H__ */
diff --git a/app/pdb/gimprc-cmds.c b/app/pdb/gimprc-cmds.c
new file mode 100644
index 0000000..9f81868
--- /dev/null
+++ b/app/pdb/gimprc-cmds.c
@@ -0,0 +1,502 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpconfig/gimpconfig.h"
+#include "libgimpmodule/gimpmodule.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "config/gimprc.h"
+#include "core/gimp-utils.h"
+#include "core/gimp.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimptemplate.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+gimprc_query_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *token;
+ gchar *value = NULL;
+
+ token = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ if (strlen (token))
+ {
+ /* use edit_config because unknown tokens are set there */
+ value = gimp_rc_query (GIMP_RC (gimp->edit_config), token);
+
+ if (! value)
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), value);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gimprc_set_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *token;
+ const gchar *value;
+
+ token = g_value_get_string (gimp_value_array_index (args, 0));
+ value = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (strlen (token))
+ {
+ /* use edit_config because that's the one that gets saved */
+ gimp_rc_set_unknown_token (GIMP_RC (gimp->edit_config), token, value);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+get_default_comment_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gchar *comment = NULL;
+
+ comment = g_strdup (gimp_template_get_comment (gimp->config->default_image));
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_take_string (gimp_value_array_index (return_vals, 1), comment);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+get_default_unit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ GimpUnit unit_id = 0;
+
+ unit_id = gimp_get_default_unit ();
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_int (gimp_value_array_index (return_vals, 1), unit_id);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+get_monitor_resolution_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gdouble xres = 0.0;
+ gdouble yres = 0.0;
+
+ xres = GIMP_DISPLAY_CONFIG (gimp->config)->monitor_xres;
+ yres = GIMP_DISPLAY_CONFIG (gimp->config)->monitor_yres;
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+
+ g_value_set_double (gimp_value_array_index (return_vals, 1), xres);
+ g_value_set_double (gimp_value_array_index (return_vals, 2), yres);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+get_theme_dir_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gchar *theme_dir = NULL;
+
+ GFile *file = gimp_get_theme_dir (gimp);
+
+ if (file)
+ theme_dir = g_file_get_path (file);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_take_string (gimp_value_array_index (return_vals, 1), theme_dir);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+get_icon_theme_dir_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gchar *icon_theme_dir = NULL;
+
+ GFile *file = gimp_get_icon_theme_dir (gimp);
+
+ if (file)
+ icon_theme_dir = g_file_get_path (file);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_take_string (gimp_value_array_index (return_vals, 1), icon_theme_dir);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+get_color_configuration_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gchar *config = NULL;
+
+ config = gimp_config_serialize_to_string (GIMP_CONFIG (gimp->config->color_management), NULL);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_take_string (gimp_value_array_index (return_vals, 1), config);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+get_module_load_inhibit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gchar *load_inhibit = NULL;
+
+ load_inhibit = g_strdup (gimp_module_db_get_load_inhibit (gimp->module_db));
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_take_string (gimp_value_array_index (return_vals, 1), load_inhibit);
+
+ return return_vals;
+}
+
+void
+register_gimprc_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-gimprc-query
+ */
+ procedure = gimp_procedure_new (gimprc_query_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gimprc-query");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gimprc-query",
+ "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: (<token> <value>). 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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("token",
+ "token",
+ "The token to query for",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("value",
+ "value",
+ "The value associated with the queried token",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gimprc-set
+ */
+ procedure = gimp_procedure_new (gimprc_set_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gimprc-set");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gimprc-set",
+ "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.",
+ "Seth Burgess",
+ "Seth Burgess",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("token",
+ "token",
+ "The token to add or modify",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("value",
+ "value",
+ "The value to set the token to",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-get-default-comment
+ */
+ procedure = gimp_procedure_new (get_default_comment_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-get-default-comment");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-get-default-comment",
+ "Get the default image comment as specified in the Preferences.",
+ "Returns a copy of the default image comment.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("comment",
+ "comment",
+ "Default image comment",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-get-default-unit
+ */
+ procedure = gimp_procedure_new (get_default_unit_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-get-default-unit");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-get-default-unit",
+ "Get the default unit (taken from the user's locale).",
+ "Returns the default unit's integer ID.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_unit ("unit-id",
+ "unit id",
+ "Default unit",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-get-monitor-resolution
+ */
+ procedure = gimp_procedure_new (get_monitor_resolution_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-get-monitor-resolution");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-get-monitor-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("xres",
+ "xres",
+ "X resolution",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("yres",
+ "yres",
+ "Y resolution",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-get-theme-dir
+ */
+ procedure = gimp_procedure_new (get_theme_dir_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-get-theme-dir");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-get-theme-dir",
+ "Get the directory of the current GUI theme.",
+ "Returns a copy of the current GUI theme dir.\n"
+ "\n"
+ "Deprecated: There is no replacement for this procedure.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ "NONE");
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("theme-dir",
+ "theme dir",
+ "The GUI theme dir",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-get-icon-theme-dir
+ */
+ procedure = gimp_procedure_new (get_icon_theme_dir_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-get-icon-theme-dir");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-get-icon-theme-dir",
+ "Get the directory of the current icon theme.",
+ "Returns a copy of the current icon theme dir.\n"
+ "\n"
+ "Deprecated: There is no replacement for this procedure.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ "NONE");
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("icon-theme-dir",
+ "icon theme dir",
+ "The icon theme dir",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-get-color-configuration
+ */
+ procedure = gimp_procedure_new (get_color_configuration_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-get-color-configuration");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2005",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("config",
+ "config",
+ "Serialized color management configuration",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-get-module-load-inhibit
+ */
+ procedure = gimp_procedure_new (get_module_load_inhibit_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-get-module-load-inhibit");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("load-inhibit",
+ "load inhibit",
+ "The list of modules",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/gradient-cmds.c b/app/pdb/gradient-cmds.c
new file mode 100644
index 0000000..27434b3
--- /dev/null
+++ b/app/pdb/gradient-cmds.c
@@ -0,0 +1,2658 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <cairo.h>
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpcolor/gimpcolor.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontext.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpgradient.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpGradient *
+gradient_get (Gimp *gimp,
+ const gchar *name,
+ GimpPDBDataAccess access,
+ gint segment,
+ GimpGradientSegment **seg,
+ GError **error)
+{
+ GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, access, error);
+
+ *seg = NULL;
+
+ if (gradient)
+ *seg = gimp_gradient_segment_get_nth (gradient->segments, segment);
+
+ return gradient;
+}
+
+static GimpGradient *
+gradient_get_range (Gimp *gimp,
+ const gchar *name,
+ gint start_segment,
+ gint end_segment,
+ GimpGradientSegment **start_seg,
+ GimpGradientSegment **end_seg,
+ GError **error)
+{
+ GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
+
+ *start_seg = NULL;
+ *end_seg = NULL;
+
+ if (end_segment >= 0 && end_segment < start_segment)
+ return NULL;
+
+ if (gradient)
+ {
+ *start_seg = gimp_gradient_segment_get_nth (gradient->segments,
+ start_segment);
+
+ if (*start_seg && end_segment >= 0)
+ *end_seg = gimp_gradient_segment_get_nth (*start_seg,
+ end_segment -
+ start_segment);
+ }
+
+ return gradient;
+}
+
+static GimpValueArray *
+gradient_new_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gchar *actual_name = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpData *data = gimp_data_factory_data_new (gimp->gradient_factory,
+ context, name);
+
+ if (data)
+ actual_name = g_strdup (gimp_object_get_name (data));
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), actual_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_duplicate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gchar *copy_name = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (gradient)
+ {
+ GimpGradient *gradient_copy = (GimpGradient *)
+ gimp_data_factory_data_duplicate (gimp->gradient_factory,
+ GIMP_DATA (gradient));
+
+ if (gradient_copy)
+ copy_name = g_strdup (gimp_object_get_name (gradient_copy));
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), copy_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_is_editable_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gboolean editable = FALSE;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (gradient)
+ editable = gimp_data_is_writable (GIMP_DATA (gradient));
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), editable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_rename_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ const gchar *new_name;
+ gchar *actual_name = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ new_name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_RENAME, error);
+
+ if (gradient)
+ {
+ gimp_object_set_name (GIMP_OBJECT (gradient), new_name);
+ actual_name = g_strdup (gimp_object_get_name (gradient));
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), actual_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_delete_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (gradient && gimp_data_is_deletable (GIMP_DATA (gradient)))
+ success = gimp_data_factory_data_delete (gimp->gradient_factory,
+ GIMP_DATA (gradient),
+ TRUE, error);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradient_get_number_of_segments_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 num_segments = 0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg;
+
+ gradient = gimp_pdb_get_gradient (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (gradient)
+ {
+ for (seg = gradient->segments; seg; seg = seg->next)
+ num_segments++;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_segments);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_get_uniform_samples_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 num_samples;
+ gboolean reverse;
+ gint32 num_color_samples = 0;
+ gdouble *color_samples = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ num_samples = g_value_get_int (gimp_value_array_index (args, 1));
+ reverse = g_value_get_boolean (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name,
+ GIMP_PDB_DATA_ACCESS_READ,
+ error);
+
+ if (gradient)
+ {
+ GimpGradientSegment *seg = NULL;
+ gdouble pos = 0.0;
+ gdouble delta = 1.0 / (num_samples - 1);
+ gdouble *sample;
+
+ num_color_samples = num_samples * 4;
+
+ sample = color_samples = g_new (gdouble, num_color_samples);
+
+ while (num_samples--)
+ {
+ GimpRGB color;
+
+ seg = gimp_gradient_get_color_at (gradient, context, seg,
+ pos, reverse,
+ GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
+ &color);
+
+ *sample++ = color.r;
+ *sample++ = color.g;
+ *sample++ = color.b;
+ *sample++ = color.a;
+
+ pos += delta;
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_color_samples);
+ gimp_value_take_floatarray (gimp_value_array_index (return_vals, 2), color_samples, num_color_samples);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_get_custom_samples_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 num_samples;
+ const gdouble *positions;
+ gboolean reverse;
+ gint32 num_color_samples = 0;
+ gdouble *color_samples = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ num_samples = g_value_get_int (gimp_value_array_index (args, 1));
+ positions = gimp_value_get_floatarray (gimp_value_array_index (args, 2));
+ reverse = g_value_get_boolean (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpGradient *gradient = gimp_pdb_get_gradient (gimp, name,
+ GIMP_PDB_DATA_ACCESS_READ,
+ error);
+
+ if (gradient)
+ {
+ GimpGradientSegment *seg = NULL;
+ gdouble *sample;
+
+ num_color_samples = num_samples * 4;
+
+ sample = color_samples = g_new (gdouble, num_color_samples);
+
+ while (num_samples--)
+ {
+ GimpRGB color;
+
+ seg = gimp_gradient_get_color_at (gradient, context,
+ seg, *positions,
+ reverse,
+ GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
+ &color);
+
+ *sample++ = color.r;
+ *sample++ = color.g;
+ *sample++ = color.b;
+ *sample++ = color.a;
+
+ positions++;
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_color_samples);
+ gimp_value_take_floatarray (gimp_value_array_index (return_vals, 2), color_samples, num_color_samples);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_segment_get_left_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 segment;
+ GimpRGB color = { 0.0, 0.0, 0.0, 1.0 };
+ gdouble opacity = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ segment = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg;
+
+ gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
+ &seg, error);
+
+ if (seg)
+ {
+ gimp_gradient_segment_get_left_color (gradient, seg, &color);
+ opacity = color.a * 100.0;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &color);
+ g_value_set_double (gimp_value_array_index (return_vals, 2), opacity);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_segment_set_left_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 segment;
+ GimpRGB color;
+ gdouble opacity;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ segment = g_value_get_int (gimp_value_array_index (args, 1));
+ gimp_value_get_rgb (gimp_value_array_index (args, 2), &color);
+ opacity = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg;
+
+ gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment,
+ &seg, error);
+
+ if (seg)
+ {
+ color.a = opacity / 100.0;
+ gimp_gradient_segment_set_left_color (gradient, seg, &color);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradient_segment_get_right_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 segment;
+ GimpRGB color = { 0.0, 0.0, 0.0, 1.0 };
+ gdouble opacity = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ segment = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg;
+
+ gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
+ &seg, error);
+
+ if (seg)
+ {
+ gimp_gradient_segment_get_right_color (gradient, seg, &color);
+ opacity = color.a * 100.0;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &color);
+ g_value_set_double (gimp_value_array_index (return_vals, 2), opacity);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_segment_set_right_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 segment;
+ GimpRGB color;
+ gdouble opacity;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ segment = g_value_get_int (gimp_value_array_index (args, 1));
+ gimp_value_get_rgb (gimp_value_array_index (args, 2), &color);
+ opacity = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg;
+
+ gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment,
+ &seg, error);
+
+ if (seg)
+ {
+ color.a = opacity / 100.0;
+ gimp_gradient_segment_set_right_color (gradient, seg, &color);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradient_segment_get_left_pos_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 segment;
+ gdouble pos = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ segment = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg;
+
+ gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
+ &seg, error);
+
+ if (seg)
+ {
+ pos = gimp_gradient_segment_get_left_pos (gradient, seg);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), pos);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_segment_set_left_pos_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 segment;
+ gdouble pos;
+ gdouble final_pos = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ segment = g_value_get_int (gimp_value_array_index (args, 1));
+ pos = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg;
+
+ gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment,
+ &seg, error);
+
+ if (seg)
+ {
+ final_pos = gimp_gradient_segment_set_left_pos (gradient, seg, pos);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), final_pos);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_segment_get_middle_pos_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 segment;
+ gdouble pos = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ segment = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg;
+
+ gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
+ &seg, error);
+
+ if (seg)
+ {
+ pos = gimp_gradient_segment_get_middle_pos (gradient, seg);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), pos);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_segment_set_middle_pos_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 segment;
+ gdouble pos;
+ gdouble final_pos = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ segment = g_value_get_int (gimp_value_array_index (args, 1));
+ pos = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg;
+
+ gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment,
+ &seg, error);
+
+ if (seg)
+ {
+ final_pos =
+ gimp_gradient_segment_set_middle_pos (gradient, seg, pos);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), final_pos);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_segment_get_right_pos_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 segment;
+ gdouble pos = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ segment = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg;
+
+ gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
+ &seg, error);
+
+ if (seg)
+ {
+ pos = gimp_gradient_segment_get_right_pos (gradient, seg);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), pos);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_segment_set_right_pos_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 segment;
+ gdouble pos;
+ gdouble final_pos = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ segment = g_value_get_int (gimp_value_array_index (args, 1));
+ pos = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg;
+
+ gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, segment,
+ &seg, error);
+
+ if (seg)
+ {
+ final_pos =
+ gimp_gradient_segment_set_right_pos (gradient, seg, pos);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), final_pos);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_segment_get_blending_function_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 segment;
+ gint32 blend_func = 0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ segment = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg;
+
+ gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
+ &seg, error);
+
+ if (seg)
+ {
+ blend_func = gimp_gradient_segment_get_blending_function (gradient, seg);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), blend_func);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_segment_get_coloring_type_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 segment;
+ gint32 coloring_type = 0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ segment = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg;
+
+ gradient = gradient_get (gimp, name, GIMP_PDB_DATA_ACCESS_READ, segment,
+ &seg, error);
+
+ if (seg)
+ {
+ coloring_type = gimp_gradient_segment_get_coloring_type (gradient, seg);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), coloring_type);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradient_segment_range_set_blending_function_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 start_segment;
+ gint32 end_segment;
+ gint32 blending_function;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ start_segment = g_value_get_int (gimp_value_array_index (args, 1));
+ end_segment = g_value_get_int (gimp_value_array_index (args, 2));
+ blending_function = g_value_get_enum (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *start_seg;
+ GimpGradientSegment *end_seg;
+
+ gradient = gradient_get_range (gimp, name, start_segment, end_segment,
+ &start_seg, &end_seg, error);
+
+ if (start_seg)
+ {
+ gimp_gradient_segment_range_set_blending_function (gradient,
+ start_seg, end_seg,
+ blending_function);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradient_segment_range_set_coloring_type_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 start_segment;
+ gint32 end_segment;
+ gint32 coloring_type;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ start_segment = g_value_get_int (gimp_value_array_index (args, 1));
+ end_segment = g_value_get_int (gimp_value_array_index (args, 2));
+ coloring_type = g_value_get_enum (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *start_seg;
+ GimpGradientSegment *end_seg;
+
+ gradient = gradient_get_range (gimp, name, start_segment, end_segment,
+ &start_seg, &end_seg, error);
+
+ if (start_seg)
+ {
+ gimp_gradient_segment_range_set_coloring_type (gradient,
+ start_seg, end_seg,
+ coloring_type);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradient_segment_range_flip_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 start_segment;
+ gint32 end_segment;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ start_segment = g_value_get_int (gimp_value_array_index (args, 1));
+ end_segment = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *start_seg;
+ GimpGradientSegment *end_seg;
+
+ gradient = gradient_get_range (gimp, name, start_segment, end_segment,
+ &start_seg, &end_seg, error);
+
+ if (start_seg)
+ {
+ gimp_gradient_segment_range_flip (gradient,
+ start_seg, end_seg,
+ NULL, NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradient_segment_range_replicate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 start_segment;
+ gint32 end_segment;
+ gint32 replicate_times;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ start_segment = g_value_get_int (gimp_value_array_index (args, 1));
+ end_segment = g_value_get_int (gimp_value_array_index (args, 2));
+ replicate_times = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *start_seg;
+ GimpGradientSegment *end_seg;
+
+ gradient = gradient_get_range (gimp, name, start_segment, end_segment,
+ &start_seg, &end_seg, error);
+
+ if (start_seg && gimp_data_is_writable (GIMP_DATA (gradient)))
+ {
+ gimp_gradient_segment_range_replicate (gradient,
+ start_seg, end_seg,
+ replicate_times,
+ NULL, NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradient_segment_range_split_midpoint_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 start_segment;
+ gint32 end_segment;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ start_segment = g_value_get_int (gimp_value_array_index (args, 1));
+ end_segment = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *start_seg;
+ GimpGradientSegment *end_seg;
+
+ gradient = gradient_get_range (gimp, name, start_segment, end_segment,
+ &start_seg, &end_seg, error);
+
+ if (start_seg)
+ {
+ gimp_gradient_segment_range_split_midpoint (gradient, context,
+ start_seg, end_seg,
+ GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
+ NULL, NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradient_segment_range_split_uniform_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 start_segment;
+ gint32 end_segment;
+ gint32 split_parts;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ start_segment = g_value_get_int (gimp_value_array_index (args, 1));
+ end_segment = g_value_get_int (gimp_value_array_index (args, 2));
+ split_parts = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *start_seg;
+ GimpGradientSegment *end_seg;
+
+ gradient = gradient_get_range (gimp, name, start_segment, end_segment,
+ &start_seg, &end_seg, error);
+
+ if (start_seg)
+ {
+ gimp_gradient_segment_range_split_uniform (gradient, context,
+ start_seg, end_seg,
+ split_parts,
+ GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
+ NULL, NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradient_segment_range_delete_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 start_segment;
+ gint32 end_segment;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ start_segment = g_value_get_int (gimp_value_array_index (args, 1));
+ end_segment = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *start_seg;
+ GimpGradientSegment *end_seg;
+
+ gradient = gradient_get_range (gimp, name, start_segment, end_segment,
+ &start_seg, &end_seg, error);
+
+ if (start_seg)
+ {
+ gimp_gradient_segment_range_delete (gradient,
+ start_seg, end_seg,
+ NULL, NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradient_segment_range_redistribute_handles_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 start_segment;
+ gint32 end_segment;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ start_segment = g_value_get_int (gimp_value_array_index (args, 1));
+ end_segment = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *start_seg;
+ GimpGradientSegment *end_seg;
+
+ gradient = gradient_get_range (gimp, name, start_segment, end_segment,
+ &start_seg, &end_seg, error);
+
+ if (start_seg)
+ {
+ gimp_gradient_segment_range_redistribute_handles (gradient,
+ start_seg, end_seg);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradient_segment_range_blend_colors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 start_segment;
+ gint32 end_segment;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ start_segment = g_value_get_int (gimp_value_array_index (args, 1));
+ end_segment = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *start_seg;
+ GimpGradientSegment *end_seg;
+
+ gradient = gradient_get_range (gimp, name, start_segment, end_segment,
+ &start_seg, &end_seg, error);
+
+ if (start_seg)
+ {
+ if (!end_seg)
+ end_seg = gimp_gradient_segment_get_last (start_seg);
+
+ gimp_gradient_segment_range_blend (gradient,
+ start_seg, end_seg,
+ &start_seg->left_color,
+ &end_seg->right_color,
+ TRUE, FALSE);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradient_segment_range_blend_opacity_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 start_segment;
+ gint32 end_segment;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ start_segment = g_value_get_int (gimp_value_array_index (args, 1));
+ end_segment = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *start_seg;
+ GimpGradientSegment *end_seg;
+
+ gradient = gradient_get_range (gimp, name, start_segment, end_segment,
+ &start_seg, &end_seg, error);
+
+ if (start_seg)
+ {
+ if (!end_seg)
+ end_seg = gimp_gradient_segment_get_last (start_seg);
+
+ gimp_gradient_segment_range_blend (gradient,
+ start_seg, end_seg,
+ &start_seg->left_color,
+ &end_seg->right_color,
+ FALSE, TRUE);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradient_segment_range_move_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 start_segment;
+ gint32 end_segment;
+ gdouble delta;
+ gboolean control_compress;
+ gdouble final_delta = 0.0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ start_segment = g_value_get_int (gimp_value_array_index (args, 1));
+ end_segment = g_value_get_int (gimp_value_array_index (args, 2));
+ delta = g_value_get_double (gimp_value_array_index (args, 3));
+ control_compress = g_value_get_boolean (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *start_seg;
+ GimpGradientSegment *end_seg;
+
+ gradient = gradient_get_range (gimp, name, start_segment, end_segment,
+ &start_seg, &end_seg, error);
+
+ if (start_seg)
+ {
+ final_delta = gimp_gradient_segment_range_move (gradient,
+ start_seg, end_seg,
+ delta,
+ control_compress);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), final_delta);
+
+ return return_vals;
+}
+
+void
+register_gradient_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-gradient-new
+ */
+ procedure = gimp_procedure_new (gradient_new_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-new");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-new",
+ "Creates a new gradient",
+ "This procedure creates a new, uninitialized gradient",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The requested name of the new gradient",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("actual-name",
+ "actual name",
+ "The actual new gradient name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-duplicate
+ */
+ procedure = gimp_procedure_new (gradient_duplicate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-duplicate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-duplicate",
+ "Duplicates a gradient",
+ "This procedure creates an identical gradient by a different name",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("copy-name",
+ "copy name",
+ "The name of the gradient's copy",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-is-editable
+ */
+ procedure = gimp_procedure_new (gradient_is_editable_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-is-editable");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-is-editable",
+ "Tests if gradient can be edited",
+ "Returns TRUE if you have permission to change the gradient",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("editable",
+ "editable",
+ "TRUE if the gradient can be edited",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-rename
+ */
+ procedure = gimp_procedure_new (gradient_rename_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-rename");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-rename",
+ "Rename a gradient",
+ "This procedure renames a gradient",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("new-name",
+ "new name",
+ "The new name of the gradient",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("actual-name",
+ "actual name",
+ "The actual new name of the gradient",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-delete
+ */
+ procedure = gimp_procedure_new (gradient_delete_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-delete");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-delete",
+ "Deletes a gradient",
+ "This procedure deletes a gradient",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-get-number-of-segments
+ */
+ procedure = gimp_procedure_new (gradient_get_number_of_segments_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-get-number-of-segments");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-get-number-of-segments",
+ "Returns the number of segments of the specified gradient",
+ "This procedure returns the number of segments of the specified gradient.",
+ "Lars-Peter Clausen <lars@metafoo.de>",
+ "Lars-Peter Clausen",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-segments",
+ "num segments",
+ "Number of segments",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-get-uniform-samples
+ */
+ procedure = gimp_procedure_new (gradient_get_uniform_samples_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-get-uniform-samples");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-get-uniform-samples",
+ "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 }.",
+ "Federico Mena Quintero",
+ "Federico Mena Quintero",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-samples",
+ "num samples",
+ "The number of samples to take",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("reverse",
+ "reverse",
+ "Use the reverse gradient",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-color-samples",
+ "num color samples",
+ "Length of the color_samples array (4 * num_samples)",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_float_array ("color-samples",
+ "color samples",
+ "Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-get-custom-samples
+ */
+ procedure = gimp_procedure_new (gradient_get_custom_samples_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-get-custom-samples");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-get-custom-samples",
+ "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.",
+ "Federico Mena Quintero",
+ "Federico Mena Quintero",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-samples",
+ "num samples",
+ "The number of samples to take",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("positions",
+ "positions",
+ "The list of positions to sample along the gradient",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("reverse",
+ "reverse",
+ "Use the reverse gradient",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-color-samples",
+ "num color samples",
+ "Length of the color_samples array (4 * num_samples)",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_float_array ("color-samples",
+ "color samples",
+ "Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-get-left-color
+ */
+ procedure = gimp_procedure_new (gradient_segment_get_left_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-get-left-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-get-left-color",
+ "Retrieves the left endpoint color of the specified segment",
+ "This procedure retrieves the left endpoint color of the specified segment of the specified gradient.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("segment",
+ "segment",
+ "The index of the segment within the gradient",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The return color",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The opacity of the endpoint",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-set-left-color
+ */
+ procedure = gimp_procedure_new (gradient_segment_set_left_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-set-left-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-set-left-color",
+ "Sets the left endpoint color of the specified segment",
+ "This procedure sets the left endpoint color of the specified segment of the specified gradient.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("segment",
+ "segment",
+ "The index of the segment within the gradient",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The color to set",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The opacity to set for the endpoint",
+ 0, 100.0, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-get-right-color
+ */
+ procedure = gimp_procedure_new (gradient_segment_get_right_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-get-right-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-get-right-color",
+ "Retrieves the right endpoint color of the specified segment",
+ "This procedure retrieves the right endpoint color of the specified segment of the specified gradient.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("segment",
+ "segment",
+ "The index of the segment within the gradient",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The return color",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The opacity of the endpoint",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-set-right-color
+ */
+ procedure = gimp_procedure_new (gradient_segment_set_right_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-set-right-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-set-right-color",
+ "Sets the right endpoint color of the specified segment",
+ "This procedure sets the right endpoint color of the specified segment of the specified gradient.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("segment",
+ "segment",
+ "The index of the segment within the gradient",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The color to set",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The opacity to set for the endpoint",
+ 0, 100.0, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-get-left-pos
+ */
+ procedure = gimp_procedure_new (gradient_segment_get_left_pos_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-get-left-pos");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-get-left-pos",
+ "Retrieves the left endpoint position of the specified segment",
+ "This procedure retrieves the left endpoint position of the specified segment of the specified gradient.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("segment",
+ "segment",
+ "The index of the segment within the gradient",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("pos",
+ "pos",
+ "The return position",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-set-left-pos
+ */
+ procedure = gimp_procedure_new (gradient_segment_set_left_pos_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-set-left-pos");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-set-left-pos",
+ "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.\n"
+ "This procedure returns the final position.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("segment",
+ "segment",
+ "The index of the segment within the gradient",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("pos",
+ "pos",
+ "The position to set the guidepoint to",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("final-pos",
+ "final pos",
+ "The return position",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-get-middle-pos
+ */
+ procedure = gimp_procedure_new (gradient_segment_get_middle_pos_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-get-middle-pos");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-get-middle-pos",
+ "Retrieves the middle point position of the specified segment",
+ "This procedure retrieves the middle point position of the specified segment of the specified gradient.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("segment",
+ "segment",
+ "The index of the segment within the gradient",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("pos",
+ "pos",
+ "The return position",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-set-middle-pos
+ */
+ procedure = gimp_procedure_new (gradient_segment_set_middle_pos_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-set-middle-pos");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-set-middle-pos",
+ "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.\n"
+ "This procedure returns the final position.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("segment",
+ "segment",
+ "The index of the segment within the gradient",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("pos",
+ "pos",
+ "The position to set the guidepoint to",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("final-pos",
+ "final pos",
+ "The return position",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-get-right-pos
+ */
+ procedure = gimp_procedure_new (gradient_segment_get_right_pos_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-get-right-pos");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-get-right-pos",
+ "Retrieves the right endpoint position of the specified segment",
+ "This procedure retrieves the right endpoint position of the specified segment of the specified gradient.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("segment",
+ "segment",
+ "The index of the segment within the gradient",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("pos",
+ "pos",
+ "The return position",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-set-right-pos
+ */
+ procedure = gimp_procedure_new (gradient_segment_set_right_pos_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-set-right-pos");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-set-right-pos",
+ "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.\n"
+ "This procedure returns the final position.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("segment",
+ "segment",
+ "The index of the segment within the gradient",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("pos",
+ "pos",
+ "The position to set the guidepoint to",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("final-pos",
+ "final pos",
+ "The return position",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-get-blending-function
+ */
+ procedure = gimp_procedure_new (gradient_segment_get_blending_function_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-get-blending-function");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-get-blending-function",
+ "Retrieves the gradient segment's blending function",
+ "This procedure retrieves the blending function of the segment at the specified gradient name and segment index.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("segment",
+ "segment",
+ "The index of the segment within the gradient",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("blend-func",
+ "blend func",
+ "The blending function of the segment",
+ GIMP_TYPE_GRADIENT_SEGMENT_TYPE,
+ GIMP_GRADIENT_SEGMENT_LINEAR,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-get-coloring-type
+ */
+ procedure = gimp_procedure_new (gradient_segment_get_coloring_type_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-get-coloring-type");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-get-coloring-type",
+ "Retrieves the gradient segment's coloring type",
+ "This procedure retrieves the coloring type of the segment at the specified gradient name and segment index.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("segment",
+ "segment",
+ "The index of the segment within the gradient",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("coloring-type",
+ "coloring type",
+ "The coloring type of the segment",
+ GIMP_TYPE_GRADIENT_SEGMENT_COLOR,
+ GIMP_GRADIENT_SEGMENT_RGB,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-range-set-blending-function
+ */
+ procedure = gimp_procedure_new (gradient_segment_range_set_blending_function_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-range-set-blending-function");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-range-set-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.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("start-segment",
+ "start segment",
+ "The index of the first segment to operate on",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("end-segment",
+ "end segment",
+ "The index of the last segment to operate on. If negative, the selection will extend to the end of the string.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("blending-function",
+ "blending function",
+ "The blending function",
+ GIMP_TYPE_GRADIENT_SEGMENT_TYPE,
+ GIMP_GRADIENT_SEGMENT_LINEAR,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-range-set-coloring-type
+ */
+ procedure = gimp_procedure_new (gradient_segment_range_set_coloring_type_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-range-set-coloring-type");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-range-set-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.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("start-segment",
+ "start segment",
+ "The index of the first segment to operate on",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("end-segment",
+ "end segment",
+ "The index of the last segment to operate on. If negative, the selection will extend to the end of the string.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("coloring-type",
+ "coloring type",
+ "The coloring type",
+ GIMP_TYPE_GRADIENT_SEGMENT_COLOR,
+ GIMP_GRADIENT_SEGMENT_RGB,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-range-flip
+ */
+ procedure = gimp_procedure_new (gradient_segment_range_flip_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-range-flip");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-range-flip",
+ "Flip the segment range",
+ "This function flips a segment range.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("start-segment",
+ "start segment",
+ "The index of the first segment to operate on",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("end-segment",
+ "end segment",
+ "The index of the last segment to operate on. If negative, the selection will extend to the end of the string.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-range-replicate
+ */
+ procedure = gimp_procedure_new (gradient_segment_range_replicate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-range-replicate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-range-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.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("start-segment",
+ "start segment",
+ "The index of the first segment to operate on",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("end-segment",
+ "end segment",
+ "The index of the last segment to operate on. If negative, the selection will extend to the end of the string.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("replicate-times",
+ "replicate times",
+ "The number of times to replicate",
+ 2, 20, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-range-split-midpoint
+ */
+ procedure = gimp_procedure_new (gradient_segment_range_split_midpoint_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-range-split-midpoint");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-range-split-midpoint",
+ "Splits each segment in the segment range at midpoint",
+ "This function splits each segment in the segment range at its midpoint.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("start-segment",
+ "start segment",
+ "The index of the first segment to operate on",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("end-segment",
+ "end segment",
+ "The index of the last segment to operate on. If negative, the selection will extend to the end of the string.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-range-split-uniform
+ */
+ procedure = gimp_procedure_new (gradient_segment_range_split_uniform_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-range-split-uniform");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-range-split-uniform",
+ "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.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("start-segment",
+ "start segment",
+ "The index of the first segment to operate on",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("end-segment",
+ "end segment",
+ "The index of the last segment to operate on. If negative, the selection will extend to the end of the string.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("split-parts",
+ "split parts",
+ "The number of uniform divisions to split each segment to",
+ 2, 1024, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-range-delete
+ */
+ procedure = gimp_procedure_new (gradient_segment_range_delete_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-range-delete");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-range-delete",
+ "Delete the segment range",
+ "This function deletes a segment range.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("start-segment",
+ "start segment",
+ "The index of the first segment to operate on",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("end-segment",
+ "end segment",
+ "The index of the last segment to operate on. If negative, the selection will extend to the end of the string.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-range-redistribute-handles
+ */
+ procedure = gimp_procedure_new (gradient_segment_range_redistribute_handles_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-range-redistribute-handles");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-range-redistribute-handles",
+ "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.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("start-segment",
+ "start segment",
+ "The index of the first segment to operate on",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("end-segment",
+ "end segment",
+ "The index of the last segment to operate on. If negative, the selection will extend to the end of the string.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-range-blend-colors
+ */
+ procedure = gimp_procedure_new (gradient_segment_range_blend_colors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-range-blend-colors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-range-blend-colors",
+ "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.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("start-segment",
+ "start segment",
+ "The index of the first segment to operate on",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("end-segment",
+ "end segment",
+ "The index of the last segment to operate on. If negative, the selection will extend to the end of the string.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-range-blend-opacity
+ */
+ procedure = gimp_procedure_new (gradient_segment_range_blend_opacity_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-range-blend-opacity");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-range-blend-opacity",
+ "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.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("start-segment",
+ "start segment",
+ "The index of the first segment to operate on",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("end-segment",
+ "end segment",
+ "The index of the last segment to operate on. If negative, the selection will extend to the end of the string.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradient-segment-range-move
+ */
+ procedure = gimp_procedure_new (gradient_segment_range_move_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradient-segment-range-move");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradient-segment-range-move",
+ "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.",
+ "Shlomi Fish <shlomif@iglu.org.il>",
+ "Shlomi Fish",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("start-segment",
+ "start segment",
+ "The index of the first segment to operate on",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("end-segment",
+ "end segment",
+ "The index of the last segment to operate on. If negative, the selection will extend to the end of the string.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("delta",
+ "delta",
+ "The delta to move the segment range",
+ -1.0, 1.0, -1.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("control-compress",
+ "control compress",
+ "Whether or not to compress the neighboring segments",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("final-delta",
+ "final delta",
+ "The final delta by which the range moved",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/gradient-select-cmds.c b/app/pdb/gradient-select-cmds.c
new file mode 100644
index 0000000..2539447
--- /dev/null
+++ b/app/pdb/gradient-select-cmds.c
@@ -0,0 +1,236 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpgradient.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+gradients_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *gradient_callback;
+ const gchar *popup_title;
+ const gchar *initial_gradient;
+ gint32 sample_size;
+
+ gradient_callback = g_value_get_string (gimp_value_array_index (args, 0));
+ popup_title = g_value_get_string (gimp_value_array_index (args, 1));
+ initial_gradient = g_value_get_string (gimp_value_array_index (args, 2));
+ sample_size = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (sample_size < 1 || sample_size > 10000)
+ sample_size = GIMP_GRADIENT_DEFAULT_SAMPLE_SIZE;
+
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
+ ! gimp_pdb_dialog_new (gimp, context, progress,
+ gimp_data_factory_get_container (gimp->gradient_factory),
+ popup_title, gradient_callback, initial_gradient,
+ "sample-size", sample_size,
+ NULL))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradients_close_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *gradient_callback;
+
+ gradient_callback = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
+ ! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->gradient_factory),
+ gradient_callback))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+gradients_set_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *gradient_callback;
+ const gchar *gradient_name;
+
+ gradient_callback = g_value_get_string (gimp_value_array_index (args, 0));
+ gradient_name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, gradient_callback) ||
+ ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->gradient_factory),
+ gradient_callback, gradient_name,
+ NULL))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_gradient_select_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-gradients-popup
+ */
+ procedure = gimp_procedure_new (gradients_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradients-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradients-popup",
+ "Invokes the Gimp gradients selection.",
+ "This procedure opens the gradient selection dialog.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("gradient-callback",
+ "gradient callback",
+ "The callback PDB proc to call when gradient selection is made",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("popup-title",
+ "popup title",
+ "Title of the gradient selection dialog",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("initial-gradient",
+ "initial gradient",
+ "The name of the gradient to set as the first selected",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("sample-size",
+ "sample size",
+ "Size of the sample to return when the gradient is changed",
+ 1, 10000, 1,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradients-close-popup
+ */
+ procedure = gimp_procedure_new (gradients_close_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradients-close-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradients-close-popup",
+ "Close the gradient selection dialog.",
+ "This procedure closes an opened gradient selection dialog.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("gradient-callback",
+ "gradient callback",
+ "The name of the callback registered for this pop-up",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradients-set-popup
+ */
+ procedure = gimp_procedure_new (gradients_set_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradients-set-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradients-set-popup",
+ "Sets the current gradient in a gradient selection dialog.",
+ "Sets the current gradient in a gradient selection dialog.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("gradient-callback",
+ "gradient callback",
+ "The name of the callback registered for this pop-up",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("gradient-name",
+ "gradient name",
+ "The name of the gradient to set as selected",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/gradients-cmds.c b/app/pdb/gradients-cmds.c
new file mode 100644
index 0000000..954c473
--- /dev/null
+++ b/app/pdb/gradients-cmds.c
@@ -0,0 +1,492 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontainer-filter.h"
+#include "core/gimpcontext.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpgradient.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+gradients_refresh_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_data_factory_data_refresh (gimp->gradient_factory, context);
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+gradients_get_list_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *filter;
+ gint32 num_gradients = 0;
+ gchar **gradient_list = NULL;
+
+ filter = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ gradient_list = gimp_container_get_filtered_name_array (gimp_data_factory_get_container (gimp->gradient_factory),
+ filter, &num_gradients);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_gradients);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), gradient_list, num_gradients);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradients_sample_uniform_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gint32 num_samples;
+ gboolean reverse;
+ gint32 array_length = 0;
+ gdouble *color_samples = NULL;
+
+ num_samples = g_value_get_int (gimp_value_array_index (args, 0));
+ reverse = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg = NULL;
+ gdouble pos, delta;
+ GimpRGB color;
+ gdouble *pv;
+
+ pos = 0.0;
+ delta = 1.0 / (num_samples - 1);
+
+ array_length = num_samples * 4;
+
+ pv = color_samples = g_new (gdouble, array_length);
+
+ gradient = gimp_context_get_gradient (context);
+
+ while (num_samples--)
+ {
+ seg = gimp_gradient_get_color_at (gradient, context, seg,
+ pos, reverse,
+ GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
+ &color);
+
+ *pv++ = color.r;
+ *pv++ = color.g;
+ *pv++ = color.b;
+ *pv++ = color.a;
+
+ pos += delta;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), array_length);
+ gimp_value_take_floatarray (gimp_value_array_index (return_vals, 2), color_samples, array_length);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradients_sample_custom_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gint32 num_samples;
+ const gdouble *positions;
+ gboolean reverse;
+ gint32 array_length = 0;
+ gdouble *color_samples = NULL;
+
+ num_samples = g_value_get_int (gimp_value_array_index (args, 0));
+ positions = gimp_value_get_floatarray (gimp_value_array_index (args, 1));
+ reverse = g_value_get_boolean (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+ GimpGradientSegment *seg = NULL;
+ GimpRGB color;
+ gdouble *pv;
+
+ array_length = num_samples * 4;
+
+ pv = color_samples = g_new (gdouble, array_length);
+
+ gradient = gimp_context_get_gradient (context);
+
+ while (num_samples--)
+ {
+ seg = gimp_gradient_get_color_at (gradient, context, seg,
+ *positions, reverse,
+ GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
+ &color);
+
+ *pv++ = color.r;
+ *pv++ = color.g;
+ *pv++ = color.b;
+ *pv++ = color.a;
+
+ positions++;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), array_length);
+ gimp_value_take_floatarray (gimp_value_array_index (return_vals, 2), color_samples, array_length);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+gradients_get_gradient_data_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 sample_size;
+ gboolean reverse;
+ gchar *actual_name = NULL;
+ gint32 width = 0;
+ gdouble *grad_data = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ sample_size = g_value_get_int (gimp_value_array_index (args, 1));
+ reverse = g_value_get_boolean (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGradient *gradient;
+
+ if (sample_size < 1 || sample_size > 10000)
+ sample_size = GIMP_GRADIENT_DEFAULT_SAMPLE_SIZE;
+
+ if (name && strlen (name))
+ gradient = gimp_pdb_get_gradient (gimp, name, FALSE, error);
+ else
+ gradient = gimp_context_get_gradient (context);
+
+ if (gradient)
+ {
+ GimpGradientSegment *seg = NULL;
+ gdouble *pv;
+ gdouble pos, delta;
+ GimpRGB color;
+
+ pos = 0.0;
+ delta = 1.0 / (sample_size - 1);
+
+ actual_name = g_strdup (gimp_object_get_name (gradient));
+ grad_data = g_new (gdouble, sample_size * 4);
+ width = sample_size * 4;
+
+ pv = grad_data;
+
+ while (sample_size--)
+ {
+ seg = gimp_gradient_get_color_at (gradient, context, seg,
+ pos, reverse,
+ GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
+ &color);
+
+ *pv++ = color.r;
+ *pv++ = color.g;
+ *pv++ = color.b;
+ *pv++ = color.a;
+
+ pos += delta;
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_take_string (gimp_value_array_index (return_vals, 1), actual_name);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), width);
+ gimp_value_take_floatarray (gimp_value_array_index (return_vals, 3), grad_data, width);
+ }
+
+ return return_vals;
+}
+
+void
+register_gradients_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-gradients-refresh
+ */
+ procedure = gimp_procedure_new (gradients_refresh_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradients-refresh");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2002",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradients-get-list
+ */
+ procedure = gimp_procedure_new (gradients_get_list_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradients-get-list");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradients-get-list",
+ "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.",
+ "Federico Mena Quintero",
+ "Federico Mena Quintero",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filter",
+ "filter",
+ "An optional regular expression used to filter the list",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-gradients",
+ "num gradients",
+ "The number of loaded gradients",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("gradient-list",
+ "gradient list",
+ "The list of gradient names",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradients-sample-uniform
+ */
+ procedure = gimp_procedure_new (gradients_sample_uniform_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradients-sample-uniform");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradients-sample-uniform",
+ "Deprecated: Use 'gimp-gradient-get-uniform-samples' instead.",
+ "Deprecated: Use 'gimp-gradient-get-uniform-samples' instead.",
+ "",
+ "",
+ "",
+ "gimp-gradient-get-uniform-samples");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-samples",
+ "num samples",
+ "The number of samples to take",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("reverse",
+ "reverse",
+ "Use the reverse gradient",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("array-length",
+ "array length",
+ "Length of the color_samples array (4 * num_samples)",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_float_array ("color-samples",
+ "color samples",
+ "Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradients-sample-custom
+ */
+ procedure = gimp_procedure_new (gradients_sample_custom_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradients-sample-custom");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradients-sample-custom",
+ "Deprecated: Use 'gimp-gradient-get-custom-samples' instead.",
+ "Deprecated: Use 'gimp-gradient-get-custom-samples' instead.",
+ "",
+ "",
+ "",
+ "gimp-gradient-get-custom-samples");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-samples",
+ "num samples",
+ "The number of samples to take",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("positions",
+ "positions",
+ "The list of positions to sample along the gradient",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("reverse",
+ "reverse",
+ "Use the reverse gradient",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("array-length",
+ "array length",
+ "Length of the color_samples array (4 * num_samples)",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_float_array ("color-samples",
+ "color samples",
+ "Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-gradients-get-gradient-data
+ */
+ procedure = gimp_procedure_new (gradients_get_gradient_data_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-gradients-get-gradient-data");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-gradients-get-gradient-data",
+ "Deprecated: Use 'gimp-gradient-get-uniform-samples' instead.",
+ "Deprecated: Use 'gimp-gradient-get-uniform-samples' instead.",
+ "",
+ "",
+ "",
+ "gimp-gradient-get-uniform-samples");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The gradient name (\"\" means current active gradient)",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("sample-size",
+ "sample size",
+ "Size of the sample to return when the gradient is changed",
+ 1, 10000, 1,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("reverse",
+ "reverse",
+ "Use the reverse gradient",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("actual-name",
+ "actual name",
+ "The gradient name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The gradient sample width (r,g,b,a)",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_float_array ("grad-data",
+ "grad data",
+ "The gradient sample data",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/help-cmds.c b/app/pdb/help-cmds.c
new file mode 100644
index 0000000..66aa825
--- /dev/null
+++ b/app/pdb/help-cmds.c
@@ -0,0 +1,108 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpparamspecs.h"
+#include "plug-in/gimpplugin.h"
+#include "plug-in/gimppluginmanager-help-domain.h"
+#include "plug-in/gimppluginmanager.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+help_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *help_domain;
+ const gchar *help_id;
+
+ help_domain = g_value_get_string (gimp_value_array_index (args, 0));
+ help_id = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpPlugInManager *manager = gimp->plug_in_manager;
+
+ if (! help_domain && manager->current_plug_in)
+ help_domain = (gchar *)
+ gimp_plug_in_manager_get_help_domain (manager,
+ manager->current_plug_in->file,
+ NULL);
+
+ gimp_help (gimp, progress, help_domain, help_id);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_help_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-help
+ */
+ procedure = gimp_procedure_new (help_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-help");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-help",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2000",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("help-domain",
+ "help domain",
+ "The help domain in which help_id is registered",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("help-id",
+ "help id",
+ "The help page's ID",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c
new file mode 100644
index 0000000..56806dd
--- /dev/null
+++ b/app/pdb/image-cmds.c
@@ -0,0 +1,5894 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <cairo.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpcolor/gimpcolor.h"
+#include "libgimpmath/gimpmath.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpchannel.h"
+#include "core/gimpcontainer.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpgrouplayer.h"
+#include "core/gimpimage-colormap.h"
+#include "core/gimpimage-duplicate.h"
+#include "core/gimpimage-merge.h"
+#include "core/gimpimage-metadata.h"
+#include "core/gimpimage-pick-color.h"
+#include "core/gimpimage-pick-item.h"
+#include "core/gimpimage.h"
+#include "core/gimpitem.h"
+#include "core/gimplayer.h"
+#include "core/gimplayermask.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimppickable.h"
+#include "core/gimpprogress.h"
+#include "core/gimpselection.h"
+#include "core/gimptempbuf.h"
+#include "file/file-utils.h"
+#include "gegl/gimp-babl.h"
+#include "plug-in/gimpplugin-cleanup.h"
+#include "plug-in/gimpplugin.h"
+#include "plug-in/gimppluginmanager.h"
+#include "vectors/gimpvectors.h"
+
+#include "gimppdb.h"
+#include "gimppdberror.h"
+#include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+#if defined (HAVE_ISFINITE)
+#define FINITE(x) isfinite(x)
+#elif defined (HAVE_FINITE)
+#define FINITE(x) finite(x)
+#elif defined (G_OS_WIN32)
+#define FINITE(x) _finite(x)
+#else
+#error "no FINITE() implementation available?!"
+#endif
+
+static GimpValueArray *
+image_is_valid_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gboolean valid = FALSE;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ valid = GIMP_IS_IMAGE (image);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), valid);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_list_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 num_images = 0;
+ gint32 *image_ids = NULL;
+
+ GList *list = gimp_get_image_iter (gimp);
+
+ num_images = g_list_length (list);
+
+ if (num_images)
+ {
+ gint i;
+
+ image_ids = g_new (gint32, num_images);
+
+ for (i = 0; i < num_images; i++, list = g_list_next (list))
+ image_ids[i] = gimp_image_get_ID (GIMP_IMAGE (list->data));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_images);
+ gimp_value_take_int32array (gimp_value_array_index (return_vals, 2), image_ids, num_images);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_new_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gint32 width;
+ gint32 height;
+ gint32 type;
+ GimpImage *image = NULL;
+
+ width = g_value_get_int (gimp_value_array_index (args, 0));
+ height = g_value_get_int (gimp_value_array_index (args, 1));
+ type = g_value_get_enum (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ image = gimp_create_image (gimp, width, height, type,
+ GIMP_PRECISION_U8_GAMMA, FALSE);
+
+ if (! image)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_image (gimp_value_array_index (return_vals, 1), image);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_new_with_precision_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gint32 width;
+ gint32 height;
+ gint32 type;
+ gint32 precision;
+ GimpImage *image = NULL;
+
+ width = g_value_get_int (gimp_value_array_index (args, 0));
+ height = g_value_get_int (gimp_value_array_index (args, 1));
+ type = g_value_get_enum (gimp_value_array_index (args, 2));
+ precision = g_value_get_enum (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp->plug_in_manager->current_plug_in)
+ gimp_plug_in_enable_precision (gimp->plug_in_manager->current_plug_in);
+
+ if (gimp_babl_is_valid (type, precision))
+ {
+ image = gimp_create_image (gimp, width, height, type,
+ precision, FALSE);
+ if (! image)
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_image (gimp_value_array_index (return_vals, 1), image);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_duplicate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpImage *new_image = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ new_image = gimp_image_duplicate (image);
+
+ if (! new_image)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_image (gimp_value_array_index (return_vals, 1), new_image);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_delete_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_image_get_display_count (image) == 0)
+ g_object_unref (image);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_base_type_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 base_type = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ base_type = gimp_image_get_base_type (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), base_type);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_precision_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 precision = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp->plug_in_manager->current_plug_in)
+ gimp_plug_in_enable_precision (gimp->plug_in_manager->current_plug_in);
+
+ precision = gimp_image_get_precision (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), precision);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_default_new_layer_mode_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 mode = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ mode = gimp_image_get_default_new_layer_mode (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), mode);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_width_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 width = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ width = gimp_image_get_width (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), width);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_height_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 height = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ height = gimp_image_get_height (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), height);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_free_shadow_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ if (success)
+ {
+ }
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_layers_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 num_layers = 0;
+ gint32 *layer_ids = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GList *list = gimp_image_get_layer_iter (image);
+
+ num_layers = g_list_length (list);
+
+ if (num_layers)
+ {
+ gint i;
+
+ layer_ids = g_new (gint32, num_layers);
+
+ for (i = 0; i < num_layers; i++, list = g_list_next (list))
+ layer_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_layers);
+ gimp_value_take_int32array (gimp_value_array_index (return_vals, 2), layer_ids, num_layers);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_channels_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 num_channels = 0;
+ gint32 *channel_ids = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GList *list = gimp_image_get_channel_iter (image);
+
+ num_channels = g_list_length (list);
+
+ if (num_channels)
+ {
+ gint i;
+
+ channel_ids = g_new (gint32, num_channels);
+
+ for (i = 0; i < num_channels; i++, list = g_list_next (list))
+ channel_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_channels);
+ gimp_value_take_int32array (gimp_value_array_index (return_vals, 2), channel_ids, num_channels);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_vectors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 num_vectors = 0;
+ gint32 *vector_ids = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GList *list = gimp_image_get_vectors_iter (image);
+
+ num_vectors = g_list_length (list);
+
+ if (num_vectors)
+ {
+ gint i;
+
+ vector_ids = g_new (gint32, num_vectors);
+
+ for (i = 0; i < num_vectors; i++, list = g_list_next (list))
+ vector_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_vectors);
+ gimp_value_take_int32array (gimp_value_array_index (return_vals, 2), vector_ids, num_vectors);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_active_drawable_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpDrawable *drawable = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ drawable = gimp_image_get_active_drawable (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_unset_active_channel_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_image_unset_active_channel (image);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_floating_sel_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpLayer *floating_sel = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ floating_sel = gimp_image_get_floating_selection (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), floating_sel);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_floating_sel_attached_to_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpDrawable *drawable = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpLayer *floating_sel = gimp_image_get_floating_selection (image);
+
+ if (floating_sel)
+ drawable = gimp_layer_get_floating_sel_drawable (floating_sel);
+ else
+ drawable = NULL;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_pick_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpDrawable *drawable;
+ gdouble x;
+ gdouble y;
+ gboolean sample_merged;
+ gboolean sample_average;
+ gdouble average_radius;
+ GimpRGB color = { 0.0, 0.0, 0.0, 1.0 };
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 1), gimp);
+ x = g_value_get_double (gimp_value_array_index (args, 2));
+ y = g_value_get_double (gimp_value_array_index (args, 3));
+ sample_merged = g_value_get_boolean (gimp_value_array_index (args, 4));
+ sample_average = g_value_get_boolean (gimp_value_array_index (args, 5));
+ average_radius = g_value_get_double (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ if (!sample_merged)
+ if (!drawable || (gimp_item_get_image (GIMP_ITEM (drawable)) != image))
+ success = FALSE;
+
+ if (success && sample_average)
+ {
+ if (average_radius <= 0.0)
+ success = FALSE;
+ }
+
+ if (success)
+ {
+ if (sample_merged)
+ gimp_pickable_flush (GIMP_PICKABLE (image));
+ else
+ gimp_pickable_flush (GIMP_PICKABLE (drawable));
+
+ success = gimp_image_pick_color (image,
+ drawable,
+ (gint) x, (gint) y,
+ FALSE,
+ sample_merged,
+ sample_average,
+ average_radius,
+ NULL,
+ NULL,
+ &color);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &color);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_pick_correlate_layer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 x;
+ gint32 y;
+ GimpLayer *layer = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ x = g_value_get_int (gimp_value_array_index (args, 1));
+ y = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ layer = gimp_image_pick_layer (image, x, y, NULL);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_add_layer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpLayer *layer;
+ gint32 position;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 1), gimp);
+ position = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_floating (GIMP_ITEM (layer), image, error) &&
+ gimp_pdb_image_is_base_type (image,
+ gimp_drawable_get_base_type (GIMP_DRAWABLE (layer)),
+ error))
+ {
+ success = gimp_image_add_layer (image, layer,
+ NULL, MAX (position, -1), TRUE);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_insert_layer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpLayer *layer;
+ GimpLayer *parent;
+ gint32 position;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 1), gimp);
+ parent = gimp_value_get_layer (gimp_value_array_index (args, 2), gimp);
+ position = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_floating (GIMP_ITEM (layer), image, error) &&
+ gimp_pdb_image_is_base_type (image,
+ gimp_drawable_get_base_type (GIMP_DRAWABLE (layer)),
+ error) &&
+ (parent == NULL ||
+ (gimp_pdb_item_is_in_tree (GIMP_ITEM (parent), image, 0, error) &&
+ gimp_pdb_item_is_group (GIMP_ITEM (parent), error))))
+ {
+ if (position == -1 && parent == NULL)
+ parent = GIMP_IMAGE_ACTIVE_PARENT;
+
+ success = gimp_image_add_layer (image, layer,
+ parent, MAX (position, -1), TRUE);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_remove_layer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpLayer *layer;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, 0, error))
+ gimp_image_remove_layer (image, layer, TRUE, NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_freeze_layers_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+ GimpContainer *container = gimp_image_get_layers (image);
+
+ if (plug_in)
+ success = gimp_plug_in_cleanup_layers_freeze (plug_in, image);
+
+ if (success)
+ gimp_container_freeze (container);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_thaw_layers_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+ GimpContainer *container = gimp_image_get_layers (image);
+
+ if (plug_in)
+ success = gimp_plug_in_cleanup_layers_thaw (plug_in, image);
+
+ if (success)
+ success = gimp_container_frozen (container);
+
+ if (success)
+ gimp_container_thaw (container);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_add_channel_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpChannel *channel;
+ gint32 position;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ channel = gimp_value_get_channel (gimp_value_array_index (args, 1), gimp);
+ position = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_floating (GIMP_ITEM (channel), image, error))
+ {
+ success = gimp_image_add_channel (image, channel,
+ NULL, MAX (position, -1), TRUE);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_insert_channel_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpChannel *channel;
+ GimpChannel *parent;
+ gint32 position;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ channel = gimp_value_get_channel (gimp_value_array_index (args, 1), gimp);
+ parent = gimp_value_get_channel (gimp_value_array_index (args, 2), gimp);
+ position = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_floating (GIMP_ITEM (channel), image, error) &&
+ (parent == NULL ||
+ (gimp_pdb_item_is_in_tree (GIMP_ITEM (parent), image, 0, error) &&
+ gimp_pdb_item_is_group (GIMP_ITEM (parent), error))))
+ {
+ if (position == -1 && parent == NULL)
+ parent = GIMP_IMAGE_ACTIVE_PARENT;
+
+ success = gimp_image_add_channel (image, channel,
+ parent, MAX (position, -1), TRUE);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_remove_channel_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpChannel *channel;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ channel = gimp_value_get_channel (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), image, 0, error))
+ gimp_image_remove_channel (image, channel, TRUE, NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_freeze_channels_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+ GimpContainer *container = gimp_image_get_channels (image);
+
+ if (plug_in)
+ success = gimp_plug_in_cleanup_channels_freeze (plug_in, image);
+
+ if (success)
+ gimp_container_freeze (container);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_thaw_channels_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+ GimpContainer *container = gimp_image_get_channels (image);
+
+ if (plug_in)
+ success = gimp_plug_in_cleanup_channels_thaw (plug_in, image);
+
+ if (success)
+ success = gimp_container_frozen (container);
+
+ if (success)
+ gimp_container_thaw (container);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_add_vectors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpVectors *vectors;
+ gint32 position;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 1), gimp);
+ position = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_floating (GIMP_ITEM (vectors), image, error))
+ {
+ success = gimp_image_add_vectors (image, vectors,
+ NULL, MAX (position, -1), TRUE);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_insert_vectors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpVectors *vectors;
+ GimpVectors *parent;
+ gint32 position;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 1), gimp);
+ parent = gimp_value_get_vectors (gimp_value_array_index (args, 2), gimp);
+ position = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_floating (GIMP_ITEM (vectors), image, error) &&
+ (parent == NULL ||
+ (gimp_pdb_item_is_in_tree (GIMP_ITEM (parent), image, 0, error) &&
+ gimp_pdb_item_is_group (GIMP_ITEM (parent), error))))
+ {
+ if (position == -1 && parent == NULL)
+ parent = GIMP_IMAGE_ACTIVE_PARENT;
+
+ success = gimp_image_add_vectors (image, vectors,
+ parent, MAX (position, -1), TRUE);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_remove_vectors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpVectors *vectors;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, 0, error))
+ gimp_image_remove_vectors (image, vectors, TRUE, NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_freeze_vectors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+ GimpContainer *container = gimp_image_get_vectors (image);
+
+ if (plug_in)
+ success = gimp_plug_in_cleanup_vectors_freeze (plug_in, image);
+
+ if (success)
+ gimp_container_freeze (container);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_thaw_vectors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+ GimpContainer *container = gimp_image_get_vectors (image);
+
+ if (plug_in)
+ success = gimp_plug_in_cleanup_vectors_thaw (plug_in, image);
+
+ if (success)
+ success = gimp_container_frozen (container);
+
+ if (success)
+ gimp_container_thaw (container);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_item_position_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpItem *item;
+ gint32 position = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ item = gimp_value_get_item (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_in_tree (item, image, 0, error))
+ position = gimp_item_get_index (item);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), position);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_raise_item_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpItem *item;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ item = gimp_value_get_item (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_in_tree (item, image, 0, error))
+ success = gimp_image_raise_item (image, item, error);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_lower_item_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpItem *item;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ item = gimp_value_get_item (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_in_tree (item, image, 0, error))
+ success = gimp_image_lower_item (image, item, error);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_raise_item_to_top_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpItem *item;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ item = gimp_value_get_item (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_in_tree (item, image, 0, error))
+ success = gimp_image_raise_item_to_top (image, item);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_lower_item_to_bottom_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpItem *item;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ item = gimp_value_get_item (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_in_tree (item, image, 0, error))
+ success = gimp_image_lower_item_to_bottom (image, item);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_reorder_item_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpItem *item;
+ GimpItem *parent;
+ gint32 position;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ item = gimp_value_get_item (gimp_value_array_index (args, 1), gimp);
+ parent = gimp_value_get_item (gimp_value_array_index (args, 2), gimp);
+ position = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_in_tree (item, image, 0, error) &&
+ (parent == NULL ||
+ (gimp_pdb_item_is_in_same_tree (item, parent, image, error) &&
+ gimp_pdb_item_is_group (parent, error) &&
+ gimp_pdb_item_is_not_ancestor (item, parent, error))))
+ {
+ success = gimp_image_reorder_item (image, item, parent, position,
+ TRUE, NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_flatten_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpLayer *layer = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ layer = gimp_image_flatten (image, context,
+ progress, error);
+
+ if (! layer)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_merge_visible_layers_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 merge_type;
+ GimpLayer *layer = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ merge_type = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ layer = gimp_image_merge_visible_layers (image, context, merge_type,
+ FALSE, FALSE,
+ progress);
+
+ if (! layer)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_merge_down_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpLayer *merge_layer;
+ gint32 merge_type;
+ GimpLayer *layer = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ merge_layer = gimp_value_get_layer (gimp_value_array_index (args, 1), gimp);
+ merge_type = g_value_get_enum (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (merge_layer), image, 0, error))
+ {
+ layer = gimp_image_merge_down (image, merge_layer, context, merge_type,
+ progress, error);
+
+ if (! layer)
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_merge_layer_group_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpLayer *layer_group;
+ GimpLayer *layer = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ layer_group = gimp_value_get_layer (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (layer_group), image, 0, error) &&
+ gimp_pdb_item_is_group (GIMP_ITEM (layer_group), error))
+ {
+ layer = gimp_image_merge_group_layer (image,
+ GIMP_GROUP_LAYER (layer_group));
+
+ if (! layer)
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_add_layer_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpLayer *layer;
+ GimpLayerMask *mask;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 1), gimp);
+ mask = gimp_value_get_layer_mask (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), image, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (layer), error))
+ success = (gimp_layer_add_mask (layer, mask, TRUE, error) == mask);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_remove_layer_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpLayer *layer;
+ gint32 mode;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 1), gimp);
+ mode = g_value_get_enum (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPDBItemModify modify = 0;
+
+ if (mode == GIMP_MASK_APPLY)
+ modify |= GIMP_PDB_ITEM_CONTENT;
+
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, modify, error) &&
+ gimp_layer_get_mask (layer))
+ gimp_layer_apply_mask (layer, mode, TRUE);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_colormap_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 num_bytes = 0;
+ guint8 *colormap = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ num_bytes = 3 * gimp_image_get_colormap_size (image);
+ colormap = g_memdup (gimp_image_get_colormap (image), num_bytes);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_bytes);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 2), colormap, num_bytes);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_set_colormap_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 num_bytes;
+ const guint8 *colormap;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ num_bytes = g_value_get_int (gimp_value_array_index (args, 1));
+ colormap = gimp_value_get_int8array (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ gimp_image_set_colormap (image, colormap, num_bytes / 3, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_metadata_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gchar *metadata_string = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpMetadata *metadata = gimp_image_get_metadata (image);
+
+ if (metadata)
+ metadata_string = gimp_metadata_serialize (metadata);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), metadata_string);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_set_metadata_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *metadata_string;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ metadata_string = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpMetadata *metadata = gimp_metadata_deserialize (metadata_string);
+
+ gimp_image_set_metadata (image, metadata, TRUE);
+
+ if (metadata)
+ g_object_unref (metadata);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_clean_all_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_image_clean_all (image);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_is_dirty_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gboolean dirty = FALSE;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ dirty = gimp_image_is_dirty (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), dirty);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_thumbnail_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 width;
+ gint32 height;
+ gint32 actual_width = 0;
+ gint32 actual_height = 0;
+ gint32 bpp = 0;
+ gint32 thumbnail_data_count = 0;
+ guint8 *thumbnail_data = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ width = g_value_get_int (gimp_value_array_index (args, 1));
+ height = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpTempBuf *buf;
+ gint dwidth, dheight;
+
+ gimp_assert (GIMP_VIEWABLE_MAX_PREVIEW_SIZE >= 1024);
+
+ /* Adjust the width/height ratio */
+ dwidth = gimp_image_get_width (image);
+ dheight = gimp_image_get_height (image);
+
+ if (dwidth > dheight)
+ height = MAX (1, (width * dheight) / dwidth);
+ else
+ width = MAX (1, (height * dwidth) / dheight);
+
+ gimp_pickable_flush (GIMP_PICKABLE (image));
+
+ buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (image), context,
+ width, height);
+
+ if (buf)
+ {
+ actual_width = gimp_temp_buf_get_width (buf);
+ actual_height = gimp_temp_buf_get_height (buf);
+ bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (buf));
+ thumbnail_data_count = gimp_temp_buf_get_data_size (buf);
+ thumbnail_data = g_memdup (gimp_temp_buf_get_data (buf),
+ thumbnail_data_count);
+
+ gimp_temp_buf_unref (buf);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), actual_width);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), actual_height);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), bpp);
+ g_value_set_int (gimp_value_array_index (return_vals, 4), thumbnail_data_count);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 5), thumbnail_data, thumbnail_data_count);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_active_layer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpLayer *active_layer = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ active_layer = gimp_image_get_active_layer (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), active_layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_set_active_layer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpLayer *active_layer;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ active_layer = gimp_value_get_layer (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_image_set_active_layer (image, active_layer) != active_layer)
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_active_channel_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpChannel *active_channel = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ active_channel = gimp_image_get_active_channel (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_channel (gimp_value_array_index (return_vals, 1), active_channel);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_set_active_channel_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpChannel *active_channel;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ active_channel = gimp_value_get_channel (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_image_set_active_channel (image, active_channel) != active_channel)
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_active_vectors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpVectors *active_vectors = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ active_vectors = gimp_image_get_active_vectors (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_vectors (gimp_value_array_index (return_vals, 1), active_vectors);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_set_active_vectors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpVectors *active_vectors;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ active_vectors = gimp_value_get_vectors (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_image_set_active_vectors (image, active_vectors) != active_vectors)
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_selection_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpSelection *selection = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ selection = GIMP_SELECTION (gimp_image_get_mask (image));
+
+ if (! selection)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_selection (gimp_value_array_index (return_vals, 1), selection);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_component_active_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 component;
+ gboolean active = FALSE;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ component = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (component == GIMP_CHANNEL_GRAY)
+ success = gimp_pdb_image_is_base_type (image, GIMP_GRAY, error);
+ else if (component == GIMP_CHANNEL_INDEXED)
+ success = gimp_pdb_image_is_base_type (image, GIMP_INDEXED, error);
+ else
+ success = gimp_pdb_image_is_base_type (image, GIMP_RGB, error);
+
+ if (success)
+ active = gimp_image_get_component_active (image, component);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), active);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_set_component_active_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 component;
+ gboolean active;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ component = g_value_get_enum (gimp_value_array_index (args, 1));
+ active = g_value_get_boolean (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (component == GIMP_CHANNEL_GRAY)
+ success = gimp_pdb_image_is_base_type (image, GIMP_GRAY, error);
+ else if (component == GIMP_CHANNEL_INDEXED)
+ success = gimp_pdb_image_is_base_type (image, GIMP_INDEXED, error);
+ else
+ success = gimp_pdb_image_is_base_type (image, GIMP_RGB, error);
+
+ if (success)
+ gimp_image_set_component_active (image, component, active);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_component_visible_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 component;
+ gboolean visible = FALSE;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ component = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (component == GIMP_CHANNEL_GRAY)
+ success = gimp_pdb_image_is_base_type (image, GIMP_GRAY, error);
+ else if (component == GIMP_CHANNEL_INDEXED)
+ success = gimp_pdb_image_is_base_type (image, GIMP_INDEXED, error);
+ else
+ success = gimp_pdb_image_is_base_type (image, GIMP_RGB, error);
+
+ if (success)
+ visible = gimp_image_get_component_visible (image, component);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), visible);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_set_component_visible_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 component;
+ gboolean visible;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ component = g_value_get_enum (gimp_value_array_index (args, 1));
+ visible = g_value_get_boolean (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (component == GIMP_CHANNEL_GRAY)
+ success = gimp_pdb_image_is_base_type (image, GIMP_GRAY, error);
+ else if (component == GIMP_CHANNEL_INDEXED)
+ success = gimp_pdb_image_is_base_type (image, GIMP_INDEXED, error);
+ else
+ success = gimp_pdb_image_is_base_type (image, GIMP_RGB, error);
+
+ if (success)
+ gimp_image_set_component_visible (image, component, visible);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_filename_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gchar *filename = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GFile *file = gimp_image_get_any_file (image);
+ if (file)
+ filename = g_file_get_path (file);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), filename);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_set_filename_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *filename;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ filename = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ /* verify that the filename can be converted to UTF-8 and back */
+ gchar *utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, error);
+
+ if (utf8)
+ {
+ gchar *tmp = g_filename_from_utf8 (utf8, -1, NULL, NULL, error);
+
+ if (tmp)
+ g_free (tmp);
+ else
+ success = FALSE;
+
+ g_free (utf8);
+ }
+ else
+ success = FALSE;
+
+ if (success)
+ {
+ GFile *file = NULL;
+
+ if (filename && strlen (filename))
+ file = file_utils_filename_to_file (image->gimp, filename, NULL);
+
+ gimp_image_set_file (image, file);
+
+ if (file)
+ g_object_unref (file);
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_uri_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gchar *uri = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GFile *file = gimp_image_get_any_file (image);
+ if (file)
+ uri = g_file_get_uri (file);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), uri);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_xcf_uri_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gchar *uri = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GFile *file = gimp_image_get_file (image);
+ if (file)
+ uri = g_file_get_uri (file);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), uri);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_imported_uri_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gchar *uri = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GFile *file = gimp_image_get_imported_file (image);
+ if (file)
+ uri = g_file_get_uri (file);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), uri);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_exported_uri_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gchar *uri = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GFile *file = gimp_image_get_exported_file (image);
+ if (file)
+ uri = g_file_get_uri (file);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), uri);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_name_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gchar *name = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ name = g_strdup (gimp_image_get_display_name (image));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_resolution_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gdouble xresolution = 0.0;
+ gdouble yresolution = 0.0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_image_get_resolution (image, &xresolution, &yresolution);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_double (gimp_value_array_index (return_vals, 1), xresolution);
+ g_value_set_double (gimp_value_array_index (return_vals, 2), yresolution);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_set_resolution_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gdouble xresolution;
+ gdouble yresolution;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ xresolution = g_value_get_double (gimp_value_array_index (args, 1));
+ yresolution = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (! FINITE (xresolution) ||
+ xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
+ ! FINITE (yresolution) ||
+ yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Image resolution is out of bounds, "
+ "using the default resolution instead."));
+ success = FALSE;
+ }
+ else
+ {
+ gimp_image_set_resolution (image, xresolution, yresolution);
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_unit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpUnit unit = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ unit = gimp_image_get_unit (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), unit);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_set_unit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpUnit unit;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ unit = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_image_set_unit (image, unit);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_tattoo_state_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 tattoo_state = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ tattoo_state = gimp_image_get_tattoo_state (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_uint (gimp_value_array_index (return_vals, 1), tattoo_state);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_set_tattoo_state_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 tattoo_state;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ tattoo_state = g_value_get_uint (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_image_set_tattoo_state (image, tattoo_state);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_layer_by_tattoo_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 tattoo;
+ GimpLayer *layer = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ tattoo = g_value_get_uint (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ layer = gimp_image_get_layer_by_tattoo (image, tattoo);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_channel_by_tattoo_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 tattoo;
+ GimpChannel *channel = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ tattoo = g_value_get_uint (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ channel = gimp_image_get_channel_by_tattoo (image, tattoo);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_channel (gimp_value_array_index (return_vals, 1), channel);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_vectors_by_tattoo_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 tattoo;
+ GimpVectors *vectors = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ tattoo = g_value_get_uint (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ vectors = gimp_image_get_vectors_by_tattoo (image, tattoo);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_vectors (gimp_value_array_index (return_vals, 1), vectors);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_layer_by_name_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ const gchar *name;
+ GimpLayer *layer = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ layer = gimp_image_get_layer_by_name (image, name);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_channel_by_name_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ const gchar *name;
+ GimpChannel *channel = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ channel = gimp_image_get_channel_by_name (image, name);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_channel (gimp_value_array_index (return_vals, 1), channel);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_vectors_by_name_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ const gchar *name;
+ GimpVectors *vectors = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ vectors = gimp_image_get_vectors_by_name (image, name);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_vectors (gimp_value_array_index (return_vals, 1), vectors);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_attach_parasite_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const GimpParasite *parasite;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ parasite = g_value_get_boxed (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_image_parasite_validate (image, parasite, error))
+ gimp_image_parasite_attach (image, parasite, TRUE);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_detach_parasite_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *name;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_image_parasite_detach (image, name, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_get_parasite_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ const gchar *name;
+ GimpParasite *parasite = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ parasite = gimp_parasite_copy (gimp_image_parasite_find (image, name));
+
+ if (! parasite)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_boxed (gimp_value_array_index (return_vals, 1), parasite);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_parasite_list_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 num_parasites = 0;
+ gchar **parasites = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ parasites = gimp_image_parasite_list (image, &num_parasites);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_parasites);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), parasites, num_parasites);
+ }
+
+ return return_vals;
+}
+
+void
+register_image_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-image-is-valid
+ */
+ procedure = gimp_procedure_new (image_is_valid_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-is-valid");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-is-valid",
+ "Returns TRUE if the image is valid.",
+ "This procedure checks if the given image ID is valid and refers to an existing image.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2007",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image to check",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("valid",
+ "valid",
+ "Whether the image ID is valid",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-list
+ */
+ procedure = gimp_procedure_new (image_list_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-list");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-list",
+ "Returns the list of images currently open.",
+ "This procedure returns the list of images currently open in GIMP.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-images",
+ "num images",
+ "The number of images currently open",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32_array ("image-ids",
+ "image ids",
+ "The list of images currently open. The returned value must be freed with g_free()",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-new
+ */
+ procedure = gimp_procedure_new (image_new_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-new");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-new",
+ "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.\n"
+ "\n"
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The width of the image",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The height of the image",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("type",
+ "type",
+ "The type of image",
+ GIMP_TYPE_IMAGE_BASE_TYPE,
+ GIMP_RGB,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The ID of the newly created image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-new-with-precision
+ */
+ procedure = gimp_procedure_new (image_new_with_precision_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-new-with-precision");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-new-with-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The width of the image",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The height of the image",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("type",
+ "type",
+ "The type of image",
+ GIMP_TYPE_IMAGE_BASE_TYPE,
+ GIMP_RGB,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("precision",
+ "precision",
+ "The precision",
+ GIMP_TYPE_PRECISION,
+ GIMP_PRECISION_U8_LINEAR,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The ID of the newly created image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-duplicate
+ */
+ procedure = gimp_procedure_new (image_duplicate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-duplicate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-duplicate",
+ "Duplicate the specified image",
+ "This procedure duplicates the specified image, copying all layers, channels, and image information.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_image_id ("new-image",
+ "new image",
+ "The new, duplicated image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-delete
+ */
+ procedure = gimp_procedure_new (image_delete_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-delete");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-delete",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-base-type
+ */
+ procedure = gimp_procedure_new (image_base_type_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-base-type");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-base-type",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("base-type",
+ "base type",
+ "The image's base type",
+ GIMP_TYPE_IMAGE_BASE_TYPE,
+ GIMP_RGB,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-precision
+ */
+ procedure = gimp_procedure_new (image_get_precision_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-precision");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-precision",
+ "Get the precision of the image.",
+ "This procedure returns the image's precision.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("precision",
+ "precision",
+ "The image's precision",
+ GIMP_TYPE_PRECISION,
+ GIMP_PRECISION_U8_LINEAR,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-default-new-layer-mode
+ */
+ procedure = gimp_procedure_new (image_get_default_new_layer_mode_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-default-new-layer-mode");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-default-new-layer-mode",
+ "Get the default mode for newly created layers of this image.",
+ "Returns the default mode for newly created layers of this image.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2017",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("mode",
+ "mode",
+ "The layer mode",
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-width
+ */
+ procedure = gimp_procedure_new (image_width_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-width");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-width",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The image's width",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-height
+ */
+ procedure = gimp_procedure_new (image_height_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-height");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-height",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The image's height",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-free-shadow
+ */
+ procedure = gimp_procedure_new (image_free_shadow_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-free-shadow");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-free-shadow",
+ "Deprecated: Use 'gimp-drawable-free-shadow' instead.",
+ "Deprecated: Use 'gimp-drawable-free-shadow' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-free-shadow");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-layers
+ */
+ procedure = gimp_procedure_new (image_get_layers_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-layers");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-layers",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-layers",
+ "num layers",
+ "The number of layers contained in the image",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32_array ("layer-ids",
+ "layer ids",
+ "The list of layers contained in the image. The returned value must be freed with g_free()",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-channels
+ */
+ procedure = gimp_procedure_new (image_get_channels_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-channels");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-channels",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-channels",
+ "num channels",
+ "The number of channels contained in the image",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32_array ("channel-ids",
+ "channel ids",
+ "The list of channels contained in the image. The returned value must be freed with g_free()",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-vectors
+ */
+ procedure = gimp_procedure_new (image_get_vectors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-vectors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-vectors",
+ "Returns the list of vectors contained in the specified image.",
+ "This procedure returns the list of vectors contained in the specified image.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-vectors",
+ "num vectors",
+ "The number of vectors contained in the image",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32_array ("vector-ids",
+ "vector ids",
+ "The list of vectors contained in the image. The returned value must be freed with g_free()",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-active-drawable
+ */
+ procedure = gimp_procedure_new (image_get_active_drawable_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-active-drawable");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-active-drawable",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The active drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-unset-active-channel
+ */
+ procedure = gimp_procedure_new (image_unset_active_channel_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-unset-active-channel");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-unset-active-channel",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-floating-sel
+ */
+ procedure = gimp_procedure_new (image_get_floating_sel_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-floating-sel");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-floating-sel",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("floating-sel",
+ "floating sel",
+ "The image's floating selection",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-floating-sel-attached-to
+ */
+ procedure = gimp_procedure_new (image_floating_sel_attached_to_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-floating-sel-attached-to");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-floating-sel-attached-to",
+ "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.",
+ "Wolfgang Hofer",
+ "Wolfgang Hofer",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable the floating selection is attached to",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-pick-color
+ */
+ procedure = gimp_procedure_new (image_pick_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-pick-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-pick-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable to pick from",
+ pdb->gimp, TRUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "x coordinate of upper-left corner of rectangle",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "y coordinate of upper-left corner of rectangle",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("sample-merged",
+ "sample merged",
+ "Use the composite image, not the drawable",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("sample-average",
+ "sample average",
+ "Average the color of all the pixels in a specified radius",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("average-radius",
+ "average radius",
+ "The radius of pixels to average",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The return color",
+ TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-pick-correlate-layer
+ */
+ procedure = gimp_procedure_new (image_pick_correlate_layer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-pick-correlate-layer");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-pick-correlate-layer",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("x",
+ "x",
+ "The x coordinate for the pick",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("y",
+ "y",
+ "The y coordinate for the pick",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer found at the specified coordinates",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-add-layer
+ */
+ procedure = gimp_procedure_new (image_add_layer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-add-layer");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-add-layer",
+ "Deprecated: Use 'gimp-image-insert-layer' instead.",
+ "Deprecated: Use 'gimp-image-insert-layer' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-insert-layer");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("position",
+ "position",
+ "The layer position",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-insert-layer
+ */
+ procedure = gimp_procedure_new (image_insert_layer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-insert-layer");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-insert-layer",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("parent",
+ "parent",
+ "The parent layer",
+ pdb->gimp, TRUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("position",
+ "position",
+ "The layer position",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-remove-layer
+ */
+ procedure = gimp_procedure_new (image_remove_layer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-remove-layer");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-remove-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-freeze-layers
+ */
+ procedure = gimp_procedure_new (image_freeze_layers_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-freeze-layers");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-freeze-layers",
+ "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.\n"
+ "\n"
+ "Each call to 'gimp-image-freeze-layers' should be matched by a corresponding call to 'gimp-image-thaw-layers', undoing its effects.",
+ "Ell",
+ "Ell",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-thaw-layers
+ */
+ procedure = gimp_procedure_new (image_thaw_layers_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-thaw-layers");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-thaw-layers",
+ "Thaw the image's layer list.",
+ "This procedure thaws the layer list of the image, re-enabling updates to the Layers dialog.\n"
+ "\n"
+ "This procedure should match a corresponding call to 'gimp-image-freeze-layers'.",
+ "Ell",
+ "Ell",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-add-channel
+ */
+ procedure = gimp_procedure_new (image_add_channel_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-add-channel");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-add-channel",
+ "Deprecated: Use 'gimp-image-insert-channel' instead.",
+ "Deprecated: Use 'gimp-image-insert-channel' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-insert-channel");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("position",
+ "position",
+ "The channel position",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-insert-channel
+ */
+ procedure = gimp_procedure_new (image_insert_channel_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-insert-channel");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-insert-channel",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("parent",
+ "parent",
+ "The parent channel",
+ pdb->gimp, TRUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("position",
+ "position",
+ "The channel position",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-remove-channel
+ */
+ procedure = gimp_procedure_new (image_remove_channel_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-remove-channel");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-remove-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-freeze-channels
+ */
+ procedure = gimp_procedure_new (image_freeze_channels_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-freeze-channels");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-freeze-channels",
+ "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.\n"
+ "\n"
+ "Each call to 'gimp-image-freeze-channels' should be matched by a corresponding call to 'gimp-image-thaw-channels', undoing its effects.",
+ "Ell",
+ "Ell",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-thaw-channels
+ */
+ procedure = gimp_procedure_new (image_thaw_channels_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-thaw-channels");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-thaw-channels",
+ "Thaw the image's channel list.",
+ "This procedure thaws the channel list of the image, re-enabling updates to the Channels dialog.\n"
+ "\n"
+ "This procedure should match a corresponding call to 'gimp-image-freeze-channels'.",
+ "Ell",
+ "Ell",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-add-vectors
+ */
+ procedure = gimp_procedure_new (image_add_vectors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-add-vectors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-add-vectors",
+ "Deprecated: Use 'gimp-image-insert-vectors' instead.",
+ "Deprecated: Use 'gimp-image-insert-vectors' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-insert-vectors");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("position",
+ "position",
+ "The vectors objects position",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-insert-vectors
+ */
+ procedure = gimp_procedure_new (image_insert_vectors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-insert-vectors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-insert-vectors",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("parent",
+ "parent",
+ "The parent vectors",
+ pdb->gimp, TRUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("position",
+ "position",
+ "The vectors position",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-remove-vectors
+ */
+ procedure = gimp_procedure_new (image_remove_vectors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-remove-vectors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-remove-vectors",
+ "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.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-freeze-vectors
+ */
+ procedure = gimp_procedure_new (image_freeze_vectors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-freeze-vectors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-freeze-vectors",
+ "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.\n"
+ "\n"
+ "Each call to 'gimp-image-freeze-vectors' should be matched by a corresponding call to 'gimp-image-thaw-vectors', undoing its effects.",
+ "Ell",
+ "Ell",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-thaw-vectors
+ */
+ procedure = gimp_procedure_new (image_thaw_vectors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-thaw-vectors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-thaw-vectors",
+ "Thaw the image's vectors list.",
+ "This procedure thaws the vectors list of the image, re-enabling updates to the Paths dialog.\n"
+ "\n"
+ "This procedure should match a corresponding call to 'gimp-image-freeze-vectors'.",
+ "Ell",
+ "Ell",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-item-position
+ */
+ procedure = gimp_procedure_new (image_get_item_position_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-item-position");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-item-position",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("position",
+ "position",
+ "The position of the item in its level in the item tree",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-raise-item
+ */
+ procedure = gimp_procedure_new (image_raise_item_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-raise-item");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-raise-item",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item to raise",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-lower-item
+ */
+ procedure = gimp_procedure_new (image_lower_item_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-lower-item");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-lower-item",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item to lower",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-raise-item-to-top
+ */
+ procedure = gimp_procedure_new (image_raise_item_to_top_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-raise-item-to-top");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-raise-item-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item to raise to top",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-lower-item-to-bottom
+ */
+ procedure = gimp_procedure_new (image_lower_item_to_bottom_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-lower-item-to-bottom");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-lower-item-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item to lower to bottom",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-reorder-item
+ */
+ procedure = gimp_procedure_new (image_reorder_item_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-reorder-item");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-reorder-item",
+ "Reorder the specified item within its item tree",
+ "This procedure reorders the specified item within its item tree.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item to reorder",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("parent",
+ "parent",
+ "The new parent item",
+ pdb->gimp, TRUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("position",
+ "position",
+ "The new position of the item",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-flatten
+ */
+ procedure = gimp_procedure_new (image_flatten_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-flatten");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-flatten",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The resulting layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-merge-visible-layers
+ */
+ procedure = gimp_procedure_new (image_merge_visible_layers_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-merge-visible-layers");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-merge-visible-layers",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("merge-type",
+ "merge type",
+ "The type of merge",
+ GIMP_TYPE_MERGE_TYPE,
+ GIMP_EXPAND_AS_NECESSARY,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
+ GIMP_FLATTEN_IMAGE);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The resulting layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-merge-down
+ */
+ procedure = gimp_procedure_new (image_merge_down_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-merge-down");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-merge-down",
+ "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.",
+ "Larry Ewing",
+ "Larry Ewing",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("merge-layer",
+ "merge layer",
+ "The layer to merge down from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("merge-type",
+ "merge type",
+ "The type of merge",
+ GIMP_TYPE_MERGE_TYPE,
+ GIMP_EXPAND_AS_NECESSARY,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[2]),
+ GIMP_FLATTEN_IMAGE);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The resulting layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-merge-layer-group
+ */
+ procedure = gimp_procedure_new (image_merge_layer_group_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-merge-layer-group");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-merge-layer-group",
+ "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.",
+ "Ell",
+ "Ell",
+ "2019",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer-group",
+ "layer group",
+ "The layer group to merge",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The resulting layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-add-layer-mask
+ */
+ procedure = gimp_procedure_new (image_add_layer_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-add-layer-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-add-layer-mask",
+ "Deprecated: Use 'gimp-layer-add-mask' instead.",
+ "Deprecated: Use 'gimp-layer-add-mask' instead.",
+ "",
+ "",
+ "",
+ "gimp-layer-add-mask");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer to receive the mask",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_mask_id ("mask",
+ "mask",
+ "The mask to add to the layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-remove-layer-mask
+ */
+ procedure = gimp_procedure_new (image_remove_layer_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-remove-layer-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-remove-layer-mask",
+ "Deprecated: Use 'gimp-layer-remove-mask' instead.",
+ "Deprecated: Use 'gimp-layer-remove-mask' instead.",
+ "",
+ "",
+ "",
+ "gimp-layer-remove-mask");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer from which to remove mask",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("mode",
+ "mode",
+ "Removal mode",
+ GIMP_TYPE_MASK_APPLY_MODE,
+ GIMP_MASK_APPLY,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-colormap
+ */
+ procedure = gimp_procedure_new (image_get_colormap_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-colormap");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-colormap",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-bytes",
+ "num bytes",
+ "Number of bytes in the colormap array",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("colormap",
+ "colormap",
+ "The image's colormap. The returned value must be freed with g_free()",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-colormap
+ */
+ procedure = gimp_procedure_new (image_set_colormap_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-colormap");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-colormap",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-bytes",
+ "num bytes",
+ "Number of bytes in the colormap array",
+ 0, 768, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8_array ("colormap",
+ "colormap",
+ "The new colormap values",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-metadata
+ */
+ procedure = gimp_procedure_new (image_get_metadata_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-metadata");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-metadata",
+ "Returns the image's metadata.",
+ "Returns exif/iptc/xmp metadata from the image.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("metadata-string",
+ "metadata string",
+ "The exif/ptc/xmp metadata as a string",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-metadata
+ */
+ procedure = gimp_procedure_new (image_set_metadata_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-metadata");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-metadata",
+ "Set the image's metadata.",
+ "Sets exif/iptc/xmp metadata on the image.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("metadata-string",
+ "metadata string",
+ "The exif/ptc/xmp metadata as a string",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-clean-all
+ */
+ procedure = gimp_procedure_new (image_clean_all_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-clean-all");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-clean-all",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-is-dirty
+ */
+ procedure = gimp_procedure_new (image_is_dirty_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-is-dirty");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-is-dirty",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("dirty",
+ "dirty",
+ "TRUE if the image has unsaved changes.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-thumbnail
+ */
+ procedure = gimp_procedure_new (image_thumbnail_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-thumbnail");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-thumbnail",
+ "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.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The requested thumbnail width",
+ 1, 1024, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The requested thumbnail height",
+ 1, 1024, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("actual-width",
+ "actual width",
+ "The previews width",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("actual-height",
+ "actual height",
+ "The previews height",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("bpp",
+ "bpp",
+ "The previews bpp",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("thumbnail-data-count",
+ "thumbnail data count",
+ "The number of bytes in thumbnail data",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("thumbnail-data",
+ "thumbnail data",
+ "The thumbnail data",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-active-layer
+ */
+ procedure = gimp_procedure_new (image_get_active_layer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-active-layer");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-active-layer",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("active-layer",
+ "active layer",
+ "The active layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-active-layer
+ */
+ procedure = gimp_procedure_new (image_set_active_layer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-active-layer");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("active-layer",
+ "active layer",
+ "The new image active layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-active-channel
+ */
+ procedure = gimp_procedure_new (image_get_active_channel_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-active-channel");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-active-channel",
+ "Returns the specified image's active channel.",
+ "If there is an active channel, this will return the channel ID, otherwise, -1.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_channel_id ("active-channel",
+ "active channel",
+ "The active channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-active-channel
+ */
+ procedure = gimp_procedure_new (image_set_active_channel_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-active-channel");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("active-channel",
+ "active channel",
+ "The new image active channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-active-vectors
+ */
+ procedure = gimp_procedure_new (image_get_active_vectors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-active-vectors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-active-vectors",
+ "Returns the specified image's active vectors.",
+ "If there is an active path, its ID will be returned, otherwise, -1.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_vectors_id ("active-vectors",
+ "active vectors",
+ "The active vectors",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-active-vectors
+ */
+ procedure = gimp_procedure_new (image_set_active_vectors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-active-vectors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-active-vectors",
+ "Sets the specified image's active vectors.",
+ "If the path exists, it is set as the active path in the image.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("active-vectors",
+ "active vectors",
+ "The new image active vectors",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-selection
+ */
+ procedure = gimp_procedure_new (image_get_selection_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-selection");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-selection",
+ "Returns the specified image's selection.",
+ "This will always return a valid ID for a selection -- which is represented as a channel internally.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_selection_id ("selection",
+ "selection",
+ "The selection channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-component-active
+ */
+ procedure = gimp_procedure_new (image_get_component_active_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-component-active");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-component-active",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("component",
+ "component",
+ "The image component",
+ GIMP_TYPE_CHANNEL_TYPE,
+ GIMP_CHANNEL_RED,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("active",
+ "active",
+ "Component is active",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-component-active
+ */
+ procedure = gimp_procedure_new (image_set_component_active_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-component-active");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-component-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("component",
+ "component",
+ "The image component",
+ GIMP_TYPE_CHANNEL_TYPE,
+ GIMP_CHANNEL_RED,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("active",
+ "active",
+ "Component is active",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-component-visible
+ */
+ procedure = gimp_procedure_new (image_get_component_visible_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-component-visible");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-component-visible",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("component",
+ "component",
+ "The image component",
+ GIMP_TYPE_CHANNEL_TYPE,
+ GIMP_CHANNEL_RED,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("visible",
+ "visible",
+ "Component is visible",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-component-visible
+ */
+ procedure = gimp_procedure_new (image_set_component_visible_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-component-visible");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-component-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("component",
+ "component",
+ "The image component",
+ GIMP_TYPE_CHANNEL_TYPE,
+ GIMP_CHANNEL_RED,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("visible",
+ "visible",
+ "Component is visible",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-filename
+ */
+ procedure = gimp_procedure_new (image_get_filename_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-filename");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-filename",
+ "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'.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("filename",
+ "filename",
+ "The filename. The returned value must be freed with g_free()",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-filename
+ */
+ procedure = gimp_procedure_new (image_set_filename_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-filename");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-filename",
+ "Sets the specified image's filename.",
+ "This procedure sets the specified image's filename. The filename should be in the filesystem encoding.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filename",
+ "filename",
+ "The new image filename",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-uri
+ */
+ procedure = gimp_procedure_new (image_get_uri_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-uri");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-uri",
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2009",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("uri",
+ "uri",
+ "The URI. The returned value must be freed with g_free()",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-xcf-uri
+ */
+ procedure = gimp_procedure_new (image_get_xcf_uri_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-xcf-uri");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-xcf-uri",
+ "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.",
+ "Eric Grivel <gimp@lumenssolutions.com>",
+ "Eric Grivel",
+ "2011",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("uri",
+ "uri",
+ "The imported URI. The returned value must be freed with g_free()",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-imported-uri
+ */
+ procedure = gimp_procedure_new (image_get_imported_uri_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-imported-uri");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-imported-uri",
+ "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.",
+ "Eric Grivel <gimp@lumenssolutions.com>",
+ "Eric Grivel",
+ "2011",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("uri",
+ "uri",
+ "The imported URI. The returned value must be freed with g_free()",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-exported-uri
+ */
+ procedure = gimp_procedure_new (image_get_exported_uri_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-exported-uri");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-exported-uri",
+ "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.",
+ "Eric Grivel <gimp@lumenssolutions.com>",
+ "Eric Grivel",
+ "2011",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("uri",
+ "uri",
+ "The exported URI. The returned value must be freed with g_free()",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-name
+ */
+ procedure = gimp_procedure_new (image_get_name_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-name");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-name",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name. The returned value must be freed with g_free()",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-resolution
+ */
+ procedure = gimp_procedure_new (image_get_resolution_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-resolution");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-resolution",
+ "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.",
+ "Austin Donnelly",
+ "Austin Donnelly",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("xresolution",
+ "xresolution",
+ "The resolution in the x-axis, in dots per inch",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("yresolution",
+ "yresolution",
+ "The resolution in the y-axis, in dots per inch",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-resolution
+ */
+ procedure = gimp_procedure_new (image_set_resolution_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-resolution");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-resolution",
+ "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.",
+ "Austin Donnelly",
+ "Austin Donnelly",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("xresolution",
+ "xresolution",
+ "The new image resolution in the x-axis, in dots per inch",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("yresolution",
+ "yresolution",
+ "The new image resolution in the y-axis, in dots per inch",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-unit
+ */
+ procedure = gimp_procedure_new (image_get_unit_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-unit");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-unit",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_unit ("unit",
+ "unit",
+ "The unit",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-unit
+ */
+ procedure = gimp_procedure_new (image_set_unit_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-unit");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("unit",
+ "unit",
+ "The new image unit",
+ FALSE,
+ FALSE,
+ GIMP_UNIT_INCH,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-tattoo-state
+ */
+ procedure = gimp_procedure_new (image_get_tattoo_state_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-tattoo-state");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-tattoo-state",
+ "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.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "2000",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_uint ("tattoo-state",
+ "tattoo state",
+ "The tattoo state",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-tattoo-state
+ */
+ procedure = gimp_procedure_new (image_set_tattoo_state_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-tattoo-state");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-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.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "2000",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_uint ("tattoo-state",
+ "tattoo state",
+ "The new image tattoo state",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-layer-by-tattoo
+ */
+ procedure = gimp_procedure_new (image_get_layer_by_tattoo_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-layer-by-tattoo");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-layer-by-tattoo",
+ "Find a layer with a given tattoo in an image.",
+ "This procedure returns the layer with the given tattoo in the specified image.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_uint ("tattoo",
+ "tattoo",
+ "The tattoo of the layer to find",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer with the specified tattoo",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-channel-by-tattoo
+ */
+ procedure = gimp_procedure_new (image_get_channel_by_tattoo_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-channel-by-tattoo");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-channel-by-tattoo",
+ "Find a channel with a given tattoo in an image.",
+ "This procedure returns the channel with the given tattoo in the specified image.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_uint ("tattoo",
+ "tattoo",
+ "The tattoo of the channel to find",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel with the specified tattoo",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-vectors-by-tattoo
+ */
+ procedure = gimp_procedure_new (image_get_vectors_by_tattoo_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-vectors-by-tattoo");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-vectors-by-tattoo",
+ "Find a vectors with a given tattoo in an image.",
+ "This procedure returns the vectors with the given tattoo in the specified image.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_uint ("tattoo",
+ "tattoo",
+ "The tattoo of the vectors to find",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors with the specified tattoo",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-layer-by-name
+ */
+ procedure = gimp_procedure_new (image_get_layer_by_name_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-layer-by-name");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-layer-by-name",
+ "Find a layer with a given name in an image.",
+ "This procedure returns the layer with the given name in the specified image.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the layer to find",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer with the specified name",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-channel-by-name
+ */
+ procedure = gimp_procedure_new (image_get_channel_by_name_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-channel-by-name");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-channel-by-name",
+ "Find a channel with a given name in an image.",
+ "This procedure returns the channel with the given name in the specified image.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the channel to find",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel with the specified name",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-vectors-by-name
+ */
+ procedure = gimp_procedure_new (image_get_vectors_by_name_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-vectors-by-name");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-vectors-by-name",
+ "Find a vectors with a given name in an image.",
+ "This procedure returns the vectors with the given name in the specified image.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2011",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the vectors to find",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors with the specified name",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-attach-parasite
+ */
+ procedure = gimp_procedure_new (image_attach_parasite_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-attach-parasite");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-attach-parasite",
+ "Add a parasite to an image.",
+ "This procedure attaches a parasite to an image. It has no return values.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_parasite ("parasite",
+ "parasite",
+ "The parasite to attach to an image",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-detach-parasite
+ */
+ procedure = gimp_procedure_new (image_detach_parasite_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-detach-parasite");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-detach-parasite",
+ "Removes a parasite from an image.",
+ "This procedure detaches a parasite from an image. It has no return values.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the parasite to detach from an image.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-parasite
+ */
+ procedure = gimp_procedure_new (image_get_parasite_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-parasite");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-parasite",
+ "Look up a parasite in an image",
+ "Finds and returns the parasite that was previously attached to an image.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the parasite to find",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_parasite ("parasite",
+ "parasite",
+ "The found parasite",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-parasite-list
+ */
+ procedure = gimp_procedure_new (image_get_parasite_list_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-parasite-list");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-parasite-list",
+ "List all parasites.",
+ "Returns a list of all currently attached parasites.",
+ "Marc Lehmann",
+ "Marc Lehmann",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-parasites",
+ "num parasites",
+ "The number of attached parasites",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("parasites",
+ "parasites",
+ "The names of currently attached parasites",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/image-color-profile-cmds.c b/app/pdb/image-color-profile-cmds.c
new file mode 100644
index 0000000..30e515c
--- /dev/null
+++ b/app/pdb/image-color-profile-cmds.c
@@ -0,0 +1,549 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <cairo.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpcolor/gimpcolor.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpimage-color-profile.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+image_get_color_profile_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 num_bytes = 0;
+ guint8 *profile_data = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpColorProfile *profile;
+
+ profile = gimp_image_get_color_profile (image);
+
+ if (profile)
+ {
+ const guint8 *data;
+ gsize length;
+
+ data = gimp_color_profile_get_icc_profile (profile, &length);
+
+ profile_data = g_memdup (data, length);
+ num_bytes = length;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_bytes);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 2), profile_data, num_bytes);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_effective_color_profile_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 num_bytes = 0;
+ guint8 *profile_data = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpColorProfile *profile;
+
+ profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
+
+ if (profile)
+ {
+ const guint8 *data;
+ gsize length;
+
+ data = gimp_color_profile_get_icc_profile (profile, &length);
+
+ profile_data = g_memdup (data, length);
+ num_bytes = length;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_bytes);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 2), profile_data, num_bytes);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_set_color_profile_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 num_bytes;
+ const guint8 *color_profile;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ num_bytes = g_value_get_int (gimp_value_array_index (args, 1));
+ color_profile = gimp_value_get_int8array (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (color_profile)
+ {
+ GimpColorProfile *profile;
+
+ profile = gimp_color_profile_new_from_icc_profile (color_profile,
+ num_bytes,
+ error);
+
+ if (profile)
+ {
+ success = gimp_image_set_color_profile (image, profile, error);
+ g_object_unref (profile);
+ }
+ else
+ success = FALSE;
+ }
+ else
+ {
+ success = gimp_image_set_color_profile (image, NULL, error);
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_set_color_profile_from_file_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *uri;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ uri = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (uri)
+ {
+ GFile *file = g_file_new_for_uri (uri);
+ GimpColorProfile *profile;
+
+ profile = gimp_color_profile_new_from_file (file, error);
+
+ if (profile)
+ {
+ success = gimp_image_set_color_profile (image, profile, error);
+ g_object_unref (profile);
+ }
+ else
+ success = FALSE;
+
+ g_object_unref (file);
+ }
+ else
+ {
+ success = gimp_image_set_color_profile (image, NULL, error);
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_convert_color_profile_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 num_bytes;
+ const guint8 *color_profile;
+ gint32 intent;
+ gboolean bpc;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ num_bytes = g_value_get_int (gimp_value_array_index (args, 1));
+ color_profile = gimp_value_get_int8array (gimp_value_array_index (args, 2));
+ intent = g_value_get_enum (gimp_value_array_index (args, 3));
+ bpc = g_value_get_boolean (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (color_profile)
+ {
+ GimpColorProfile *profile;
+
+ profile = gimp_color_profile_new_from_icc_profile (color_profile,
+ num_bytes,
+ error);
+
+ if (profile)
+ {
+ success = gimp_image_convert_color_profile (image, profile,
+ intent, bpc,
+ progress, error);
+ g_object_unref (profile);
+ }
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_convert_color_profile_from_file_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *uri;
+ gint32 intent;
+ gboolean bpc;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ uri = g_value_get_string (gimp_value_array_index (args, 1));
+ intent = g_value_get_enum (gimp_value_array_index (args, 2));
+ bpc = g_value_get_boolean (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (uri)
+ {
+ GFile *file = g_file_new_for_uri (uri);
+ GimpColorProfile *profile;
+
+ profile = gimp_color_profile_new_from_file (file, error);
+
+ if (profile)
+ {
+ success = gimp_image_convert_color_profile (image, profile,
+ intent, bpc,
+ progress, error);
+ g_object_unref (profile);
+ }
+ else
+ success = FALSE;
+
+ g_object_unref (file);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_image_color_profile_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-image-get-color-profile
+ */
+ procedure = gimp_procedure_new (image_get_color_profile_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-color-profile");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-color-profile",
+ "Returns the image's color profile",
+ "This procedure returns the image's color profile, or NULL if the image has no color profile assigned.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-bytes",
+ "num bytes",
+ "Number of bytes in the color_profile array",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("profile-data",
+ "profile data",
+ "The image's serialized color profile. The returned value must be freed with g_free()",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-effective-color-profile
+ */
+ procedure = gimp_procedure_new (image_get_effective_color_profile_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-effective-color-profile");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-effective-color-profile",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-bytes",
+ "num bytes",
+ "Number of bytes in the color_profile array",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("profile-data",
+ "profile data",
+ "The image's serialized color profile. The returned value must be freed with g_free()",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-color-profile
+ */
+ procedure = gimp_procedure_new (image_set_color_profile_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-color-profile");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-bytes",
+ "num bytes",
+ "Number of bytes in the color_profile array",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8_array ("color-profile",
+ "color profile",
+ "The new serialized color profile",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-color-profile-from-file
+ */
+ procedure = gimp_procedure_new (image_set_color_profile_from_file_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-color-profile-from-file");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-color-profile-from-file",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("uri",
+ "uri",
+ "The URI of the file containing the new color profile",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-convert-color-profile
+ */
+ procedure = gimp_procedure_new (image_convert_color_profile_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-convert-color-profile");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-convert-color-profile",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-bytes",
+ "num bytes",
+ "Number of bytes in the color_profile array",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8_array ("color-profile",
+ "color profile",
+ "The serialized color profile",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("intent",
+ "intent",
+ "Rendering intent",
+ GIMP_TYPE_COLOR_RENDERING_INTENT,
+ GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("bpc",
+ "bpc",
+ "Black point compensation",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-convert-color-profile-from-file
+ */
+ procedure = gimp_procedure_new (image_convert_color_profile_from_file_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-convert-color-profile-from-file");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-convert-color-profile-from-file",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("uri",
+ "uri",
+ "The URI of the file containing the new color profile",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("intent",
+ "intent",
+ "Rendering intent",
+ GIMP_TYPE_COLOR_RENDERING_INTENT,
+ GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("bpc",
+ "bpc",
+ "Black point compensation",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/image-convert-cmds.c b/app/pdb/image-convert-cmds.c
new file mode 100644
index 0000000..a17cb36
--- /dev/null
+++ b/app/pdb/image-convert-cmds.c
@@ -0,0 +1,450 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpimage-convert-indexed.h"
+#include "core/gimpimage-convert-precision.h"
+#include "core/gimpimage-convert-type.h"
+#include "core/gimpimage.h"
+#include "core/gimpitemstack.h"
+#include "core/gimppalette.h"
+#include "core/gimpparamspecs.h"
+#include "gegl/gimp-babl.h"
+#include "plug-in/gimpplugin.h"
+#include "plug-in/gimppluginmanager.h"
+
+#include "gimppdb.h"
+#include "gimppdberror.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+image_convert_rgb_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_image_is_not_base_type (image, GIMP_RGB, error) &&
+ gimp_babl_is_valid (GIMP_RGB, gimp_image_get_precision (image)))
+ {
+ success = gimp_image_convert_type (image, GIMP_RGB, NULL, NULL, error);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_convert_grayscale_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error) &&
+ gimp_babl_is_valid (GIMP_GRAY, gimp_image_get_precision (image)))
+ {
+ success = gimp_image_convert_type (image, GIMP_GRAY, NULL, NULL, error);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_convert_indexed_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 dither_type;
+ gint32 palette_type;
+ gint32 num_cols;
+ gboolean alpha_dither;
+ gboolean remove_unused;
+ const gchar *palette;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ dither_type = g_value_get_enum (gimp_value_array_index (args, 1));
+ palette_type = g_value_get_enum (gimp_value_array_index (args, 2));
+ num_cols = g_value_get_int (gimp_value_array_index (args, 3));
+ alpha_dither = g_value_get_boolean (gimp_value_array_index (args, 4));
+ remove_unused = g_value_get_boolean (gimp_value_array_index (args, 5));
+ palette = g_value_get_string (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ GimpPalette *pal = NULL;
+
+ if (gimp_pdb_image_is_not_base_type (image, GIMP_INDEXED, error) &&
+ gimp_pdb_image_is_precision (image, GIMP_PRECISION_U8_GAMMA, error) &&
+ gimp_babl_is_valid (GIMP_INDEXED, gimp_image_get_precision (image)) &&
+ gimp_item_stack_is_flat (GIMP_ITEM_STACK (gimp_image_get_layers (image))))
+ {
+ switch (palette_type)
+ {
+ case GIMP_CONVERT_PALETTE_GENERATE:
+ if (num_cols < 1 || num_cols > MAXNUMCOLORS)
+ success = FALSE;
+ break;
+
+ case GIMP_CONVERT_PALETTE_CUSTOM:
+ pal = gimp_pdb_get_palette (gimp, palette, FALSE, error);
+ if (! pal)
+ {
+ success = FALSE;
+ }
+ else if (pal->n_colors > MAXNUMCOLORS)
+ {
+ g_set_error_literal (error,
+ GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Cannot convert to a palette "
+ "with more than 256 colors."));
+ success = FALSE;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ else
+ {
+ success = FALSE;
+ }
+
+ if (success)
+ success = gimp_image_convert_indexed (image,
+ palette_type, num_cols, remove_unused,
+ dither_type, alpha_dither, FALSE,
+ pal,
+ NULL, error);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_convert_set_dither_matrix_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 width;
+ gint32 height;
+ gint32 matrix_length;
+ const guint8 *matrix;
+
+ width = g_value_get_int (gimp_value_array_index (args, 0));
+ height = g_value_get_int (gimp_value_array_index (args, 1));
+ matrix_length = g_value_get_int (gimp_value_array_index (args, 2));
+ matrix = gimp_value_get_int8array (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (width == 0 || height == 0 || matrix_length == width * height)
+ {
+ gimp_image_convert_indexed_set_dither_matrix (matrix, width, height);
+ }
+ else
+ {
+ g_set_error_literal (error, GIMP_PDB_ERROR,
+ GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ "Dither matrix length must be width * height");
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_convert_precision_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 precision;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ precision = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp->plug_in_manager->current_plug_in)
+ gimp_plug_in_enable_precision (gimp->plug_in_manager->current_plug_in);
+
+ if (gimp_pdb_image_is_not_base_type (image, GIMP_INDEXED, error) &&
+ gimp_pdb_image_is_not_precision (image, precision, error) &&
+ gimp_babl_is_valid (gimp_image_get_base_type (image), precision))
+ {
+ gimp_image_convert_precision (image, precision,
+ GEGL_DITHER_NONE,
+ GEGL_DITHER_NONE,
+ GEGL_DITHER_NONE,
+ progress);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_image_convert_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-image-convert-rgb
+ */
+ procedure = gimp_procedure_new (image_convert_rgb_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-convert-rgb");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-convert-rgb",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-convert-grayscale
+ */
+ procedure = gimp_procedure_new (image_convert_grayscale_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-convert-grayscale");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-convert-grayscale",
+ "Convert specified image to grayscale",
+ "This procedure converts the specified image to grayscale. This process requires an image in RGB or Indexed color mode.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-convert-indexed
+ */
+ procedure = gimp_procedure_new (image_convert_indexed_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-convert-indexed");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-convert-indexed",
+ "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).",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("dither-type",
+ "dither type",
+ "The dither type to use",
+ GIMP_TYPE_CONVERT_DITHER_TYPE,
+ GIMP_CONVERT_DITHER_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("palette-type",
+ "palette type",
+ "The type of palette to use",
+ GIMP_TYPE_CONVERT_PALETTE_TYPE,
+ GIMP_CONVERT_PALETTE_GENERATE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-cols",
+ "num cols",
+ "The number of colors to quantize to, ignored unless (palette_type == GIMP_CONVERT_PALETTE_GENERATE)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("alpha-dither",
+ "alpha dither",
+ "Dither transparency to fake partial opacity",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("remove-unused",
+ "remove unused",
+ "Remove unused or duplicate color entries from final palette, ignored if (palette_type == GIMP_CONVERT_PALETTE_GENERATE)",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("palette",
+ "palette",
+ "The name of the custom palette to use, ignored unless (palette_type == GIMP_CONVERT_PALETTE_CUSTOM)",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-convert-set-dither-matrix
+ */
+ procedure = gimp_procedure_new (image_convert_set_dither_matrix_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-convert-set-dither-matrix");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-convert-set-dither-matrix",
+ "Set dither matrix for conversion to indexed",
+ "This procedure sets the dither matrix used when converting images to INDEXED mode with positional dithering.",
+ "David Gowers",
+ "David Gowers",
+ "2006",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "Width of the matrix (0 to reset to default matrix)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "Height of the matrix (0 to reset to default matrix)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("matrix-length",
+ "matrix length",
+ "The length of 'matrix'",
+ 1, 1024, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8_array ("matrix",
+ "matrix",
+ "The matrix -- all values must be >= 1",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-convert-precision
+ */
+ procedure = gimp_procedure_new (image_convert_precision_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-convert-precision");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-convert-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("precision",
+ "precision",
+ "The new precision",
+ GIMP_TYPE_PRECISION,
+ GIMP_PRECISION_U8_LINEAR,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/image-grid-cmds.c b/app/pdb/image-grid-cmds.c
new file mode 100644
index 0000000..f74309b
--- /dev/null
+++ b/app/pdb/image-grid-cmds.c
@@ -0,0 +1,708 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <cairo.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbaseenums.h"
+#include "libgimpcolor/gimpcolor.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpgrid.h"
+#include "core/gimpimage-grid.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+image_grid_get_spacing_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gdouble xspacing = 0.0;
+ gdouble yspacing = 0.0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpGrid *grid = gimp_image_get_grid (image);
+
+ if (grid)
+ g_object_get (grid,
+ "xspacing", &xspacing,
+ "yspacing", &yspacing,
+ NULL);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_double (gimp_value_array_index (return_vals, 1), xspacing);
+ g_value_set_double (gimp_value_array_index (return_vals, 2), yspacing);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_grid_set_spacing_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gdouble xspacing;
+ gdouble yspacing;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ xspacing = g_value_get_double (gimp_value_array_index (args, 1));
+ yspacing = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGrid *grid = gimp_image_get_grid (image);
+
+ if (grid)
+ g_object_set (grid,
+ "xspacing", xspacing,
+ "yspacing", yspacing,
+ NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_grid_get_offset_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gdouble xoffset = 0.0;
+ gdouble yoffset = 0.0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpGrid *grid = gimp_image_get_grid (image);
+
+ if (grid)
+ g_object_get (grid,
+ "xoffset", &xoffset,
+ "yoffset", &yoffset,
+ NULL);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_double (gimp_value_array_index (return_vals, 1), xoffset);
+ g_value_set_double (gimp_value_array_index (return_vals, 2), yoffset);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_grid_set_offset_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gdouble xoffset;
+ gdouble yoffset;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ xoffset = g_value_get_double (gimp_value_array_index (args, 1));
+ yoffset = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpGrid *grid = gimp_image_get_grid (image);
+
+ if (grid)
+ g_object_set (grid,
+ "xoffset", xoffset,
+ "yoffset", yoffset,
+ NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_grid_get_foreground_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpRGB fgcolor = { 0.0, 0.0, 0.0, 1.0 };
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpGrid *grid = gimp_image_get_grid (image);
+
+ if (grid)
+ fgcolor = grid->fgcolor;
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &fgcolor);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_grid_set_foreground_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpRGB fgcolor;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ gimp_value_get_rgb (gimp_value_array_index (args, 1), &fgcolor);
+
+ if (success)
+ {
+ GimpGrid *grid = gimp_image_get_grid (image);
+
+ if (grid)
+ g_object_set (grid, "fgcolor", &fgcolor, NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_grid_get_background_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpRGB bgcolor = { 0.0, 0.0, 0.0, 1.0 };
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpGrid *grid = gimp_image_get_grid (image);
+
+ if (grid)
+ bgcolor = grid->bgcolor;
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &bgcolor);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_grid_set_background_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpRGB bgcolor;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ gimp_value_get_rgb (gimp_value_array_index (args, 1), &bgcolor);
+
+ if (success)
+ {
+ GimpGrid *grid = gimp_image_get_grid (image);
+
+ if (grid)
+ g_object_set (grid, "bgcolor", &bgcolor, NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_grid_get_style_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 style = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpGrid *grid = gimp_image_get_grid (image);
+
+ if (grid)
+ g_object_get (grid, "style", &style, NULL);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), style);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_grid_set_style_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 style;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ style = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGrid *grid = gimp_image_get_grid (image);
+
+ if (grid)
+ g_object_set (grid, "style", style, NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_image_grid_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-image-grid-get-spacing
+ */
+ procedure = gimp_procedure_new (image_grid_get_spacing_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-grid-get-spacing");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-grid-get-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.",
+ "Sylvain Foret",
+ "Sylvain Foret",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("xspacing",
+ "xspacing",
+ "The image's grid horizontal spacing",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("yspacing",
+ "yspacing",
+ "The image's grid vertical spacing",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-grid-set-spacing
+ */
+ procedure = gimp_procedure_new (image_grid_set_spacing_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-grid-set-spacing");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-grid-set-spacing",
+ "Sets the spacing of an image's grid.",
+ "This procedure sets the horizontal and vertical spacing of an image's grid.",
+ "Sylvain Foret",
+ "Sylvain Foret",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("xspacing",
+ "xspacing",
+ "The image's grid horizontal spacing",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("yspacing",
+ "yspacing",
+ "The image's grid vertical spacing",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-grid-get-offset
+ */
+ procedure = gimp_procedure_new (image_grid_get_offset_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-grid-get-offset");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-grid-get-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.",
+ "Sylvain Foret",
+ "Sylvain Foret",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("xoffset",
+ "xoffset",
+ "The image's grid horizontal offset",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("yoffset",
+ "yoffset",
+ "The image's grid vertical offset",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-grid-set-offset
+ */
+ procedure = gimp_procedure_new (image_grid_set_offset_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-grid-set-offset");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-grid-set-offset",
+ "Sets the offset of an image's grid.",
+ "This procedure sets the horizontal and vertical offset of an image's grid.",
+ "Sylvain Foret",
+ "Sylvain Foret",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("xoffset",
+ "xoffset",
+ "The image's grid horizontal offset",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("yoffset",
+ "yoffset",
+ "The image's grid vertical offset",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-grid-get-foreground-color
+ */
+ procedure = gimp_procedure_new (image_grid_get_foreground_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-grid-get-foreground-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-grid-get-foreground-color",
+ "Sets the foreground color of an image's grid.",
+ "This procedure gets the foreground color of an image's grid.",
+ "Sylvain Foret",
+ "Sylvain Foret",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_rgb ("fgcolor",
+ "fgcolor",
+ "The image's grid foreground color",
+ TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-grid-set-foreground-color
+ */
+ procedure = gimp_procedure_new (image_grid_set_foreground_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-grid-set-foreground-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-grid-set-foreground-color",
+ "Gets the foreground color of an image's grid.",
+ "This procedure sets the foreground color of an image's grid.",
+ "Sylvain Foret",
+ "Sylvain Foret",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("fgcolor",
+ "fgcolor",
+ "The new foreground color",
+ TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-grid-get-background-color
+ */
+ procedure = gimp_procedure_new (image_grid_get_background_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-grid-get-background-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-grid-get-background-color",
+ "Sets the background color of an image's grid.",
+ "This procedure gets the background color of an image's grid.",
+ "Sylvain Foret",
+ "Sylvain Foret",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_rgb ("bgcolor",
+ "bgcolor",
+ "The image's grid background color",
+ TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-grid-set-background-color
+ */
+ procedure = gimp_procedure_new (image_grid_set_background_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-grid-set-background-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-grid-set-background-color",
+ "Gets the background color of an image's grid.",
+ "This procedure sets the background color of an image's grid.",
+ "Sylvain Foret",
+ "Sylvain Foret",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("bgcolor",
+ "bgcolor",
+ "The new background color",
+ TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-grid-get-style
+ */
+ procedure = gimp_procedure_new (image_grid_get_style_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-grid-get-style");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-grid-get-style",
+ "Gets the style of an image's grid.",
+ "This procedure retrieves the style of an image's grid.",
+ "Sylvain Foret",
+ "Sylvain Foret",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("style",
+ "style",
+ "The image's grid style",
+ GIMP_TYPE_GRID_STYLE,
+ GIMP_GRID_DOTS,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-grid-set-style
+ */
+ procedure = gimp_procedure_new (image_grid_set_style_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-grid-set-style");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-grid-set-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.",
+ "Sylvain Foret",
+ "Sylvain Foret",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("style",
+ "style",
+ "The image's grid style",
+ GIMP_TYPE_GRID_STYLE,
+ GIMP_GRID_DOTS,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/image-guides-cmds.c b/app/pdb/image-guides-cmds.c
new file mode 100644
index 0000000..21d36ce
--- /dev/null
+++ b/app/pdb/image-guides-cmds.c
@@ -0,0 +1,477 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "cairo.h"
+#include "core/gimpguide.h"
+#include "core/gimpimage-guides.h"
+#include "core/gimpimage-undo-push.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimppdberror.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+image_add_hguide_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 yposition;
+ gint32 guide = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ yposition = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (yposition <= gimp_image_get_height (image))
+ {
+ GimpGuide *g;
+
+ g = gimp_image_add_hguide (image, yposition, TRUE);
+ guide = gimp_aux_item_get_ID (GIMP_AUX_ITEM (g));
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_uint (gimp_value_array_index (return_vals, 1), guide);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_add_vguide_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 xposition;
+ gint32 guide = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ xposition = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (xposition <= gimp_image_get_width (image))
+ {
+ GimpGuide *g;
+
+ g = gimp_image_add_vguide (image, xposition, TRUE);
+ guide = gimp_aux_item_get_ID (GIMP_AUX_ITEM (g));
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_uint (gimp_value_array_index (return_vals, 1), guide);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_delete_guide_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 guide;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ guide = g_value_get_uint (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGuide *g = gimp_pdb_image_get_guide (image, guide, error);
+
+ if (g)
+ gimp_image_remove_guide (image, g, TRUE);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_find_next_guide_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 guide;
+ gint32 next_guide = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ guide = g_value_get_uint (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGuide *g = gimp_image_get_next_guide (image, guide, &success);
+
+ if (g)
+ next_guide = gimp_aux_item_get_ID (GIMP_AUX_ITEM (g));
+
+ if (! success)
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Image '%s' (%d) does not contain guide with ID %d"),
+ gimp_image_get_display_name (image),
+ gimp_image_get_ID (image),
+ guide);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_uint (gimp_value_array_index (return_vals, 1), next_guide);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_guide_orientation_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 guide;
+ gint32 orientation = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ guide = g_value_get_uint (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGuide *g = gimp_pdb_image_get_guide (image, guide, error);
+
+ if (g)
+ orientation = gimp_guide_get_orientation (g);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), orientation);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_guide_position_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 guide;
+ gint32 position = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ guide = g_value_get_uint (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpGuide *g = gimp_pdb_image_get_guide (image, guide, error);
+
+ if (g)
+ position = gimp_guide_get_position (g);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), position);
+
+ return return_vals;
+}
+
+void
+register_image_guides_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-image-add-hguide
+ */
+ procedure = gimp_procedure_new (image_add_hguide_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-add-hguide");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-add-hguide",
+ "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.",
+ "Adam D. Moss",
+ "Adam D. Moss",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("yposition",
+ "yposition",
+ "The guide's y-offset from top of image",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_uint ("guide",
+ "guide",
+ "The new guide",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-add-vguide
+ */
+ procedure = gimp_procedure_new (image_add_vguide_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-add-vguide");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-add-vguide",
+ "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.",
+ "Adam D. Moss",
+ "Adam D. Moss",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("xposition",
+ "xposition",
+ "The guide's x-offset from left of image",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_uint ("guide",
+ "guide",
+ "The new guide",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-delete-guide
+ */
+ procedure = gimp_procedure_new (image_delete_guide_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-delete-guide");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-delete-guide",
+ "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.",
+ "Adam D. Moss",
+ "Adam D. Moss",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_uint ("guide",
+ "guide",
+ "The ID of the guide to be removed",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-find-next-guide
+ */
+ procedure = gimp_procedure_new (image_find_next_guide_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-find-next-guide");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-find-next-guide",
+ "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.",
+ "Adam D. Moss",
+ "Adam D. Moss",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_uint ("guide",
+ "guide",
+ "The ID of the current guide (0 if first invocation)",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_uint ("next-guide",
+ "next guide",
+ "The next guide's ID",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-guide-orientation
+ */
+ procedure = gimp_procedure_new (image_get_guide_orientation_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-guide-orientation");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-guide-orientation",
+ "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.",
+ "Adam D. Moss",
+ "Adam D. Moss",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_uint ("guide",
+ "guide",
+ "The guide",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_enum ("orientation",
+ "orientation",
+ "The guide's orientation",
+ GIMP_TYPE_ORIENTATION_TYPE,
+ GIMP_ORIENTATION_HORIZONTAL,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->values[0]),
+ GIMP_ORIENTATION_UNKNOWN);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-guide-position
+ */
+ procedure = gimp_procedure_new (image_get_guide_position_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-guide-position");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-guide-position",
+ "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.",
+ "Adam D. Moss",
+ "Adam D. Moss",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_uint ("guide",
+ "guide",
+ "The guide",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("position",
+ "position",
+ "The guide's position relative to top or left of image",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/image-sample-points-cmds.c b/app/pdb/image-sample-points-cmds.c
new file mode 100644
index 0000000..a8a1965
--- /dev/null
+++ b/app/pdb/image-sample-points-cmds.c
@@ -0,0 +1,350 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpimage-sample-points.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimpsamplepoint.h"
+
+#include "gimppdb.h"
+#include "gimppdberror.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+image_add_sample_point_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 position_x;
+ gint32 position_y;
+ gint32 sample_point = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ position_x = g_value_get_int (gimp_value_array_index (args, 1));
+ position_y = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (position_x <= gimp_image_get_width (image) &&
+ position_y <= gimp_image_get_height (image))
+ {
+ GimpSamplePoint *sp;
+
+ sp = gimp_image_add_sample_point_at_pos (image, position_x, position_y,
+ TRUE);
+ sample_point = gimp_aux_item_get_ID (GIMP_AUX_ITEM (sp));
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_uint (gimp_value_array_index (return_vals, 1), sample_point);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_delete_sample_point_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 sample_point;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ sample_point = g_value_get_uint (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpSamplePoint *sp = gimp_pdb_image_get_sample_point (image, sample_point,
+ error);
+
+ if (sp)
+ gimp_image_remove_sample_point (image, sp, TRUE);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_find_next_sample_point_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 sample_point;
+ gint32 next_sample_point = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ sample_point = g_value_get_uint (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpSamplePoint *sp = gimp_image_get_next_sample_point (image, sample_point,
+ &success);
+
+ if (sp)
+ next_sample_point = gimp_aux_item_get_ID (GIMP_AUX_ITEM (sp));
+
+ if (! success)
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Image '%s' (%d) does not contain sample point with ID %d"),
+ gimp_image_get_display_name (image),
+ gimp_image_get_ID (image),
+ sample_point);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_uint (gimp_value_array_index (return_vals, 1), next_sample_point);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_get_sample_point_position_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 sample_point;
+ gint32 position_x = 0;
+ gint32 position_y = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ sample_point = g_value_get_uint (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpSamplePoint *sp = gimp_pdb_image_get_sample_point (image, sample_point,
+ error);
+
+ if (sp)
+ gimp_sample_point_get_position (sp, &position_x, &position_y);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), position_x);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), position_y);
+ }
+
+ return return_vals;
+}
+
+void
+register_image_sample_points_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-image-add-sample-point
+ */
+ procedure = gimp_procedure_new (image_add_sample_point_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-add-sample-point");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-add-sample-point",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2016",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("position-x",
+ "position x",
+ "The guide'sample points x-offset from left of image",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("position-y",
+ "position y",
+ "The guide'sample points y-offset from top of image",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_uint ("sample-point",
+ "sample point",
+ "The new sample point",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-delete-sample-point
+ */
+ procedure = gimp_procedure_new (image_delete_sample_point_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-delete-sample-point");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-delete-sample-point",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2016",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_uint ("sample-point",
+ "sample point",
+ "The ID of the sample point to be removed",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-find-next-sample-point
+ */
+ procedure = gimp_procedure_new (image_find_next_sample_point_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-find-next-sample-point");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-find-next-sample-point",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2016",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_uint ("sample-point",
+ "sample point",
+ "The ID of the current sample point (0 if first invocation)",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_uint ("next-sample-point",
+ "next sample point",
+ "The next sample point's ID",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-get-sample-point-position
+ */
+ procedure = gimp_procedure_new (image_get_sample_point_position_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-sample-point-position");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-sample-point-position",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2016",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_uint ("sample-point",
+ "sample point",
+ "The guide",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("position-x",
+ "position x",
+ "The sample points's position relative to top of image",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("position-y",
+ "position y",
+ "The sample points's position relative to top of image",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/image-select-cmds.c b/app/pdb/image-select-cmds.c
new file mode 100644
index 0000000..3980aea
--- /dev/null
+++ b/app/pdb/image-select-cmds.c
@@ -0,0 +1,718 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <cairo.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpcolor/gimpcolor.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpchannel-select.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
+#include "core/gimpitem.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+image_select_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 operation;
+ GimpDrawable *drawable;
+ GimpRGB color;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ operation = g_value_get_enum (gimp_value_array_index (args, 1));
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ gimp_value_get_rgb (gimp_value_array_index (args, 3), &color);
+
+ if (success)
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
+ if (pdb_context->sample_merged ||
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), image, 0, error))
+ {
+ gimp_channel_select_by_color (gimp_image_get_mask (image), drawable,
+ pdb_context->sample_merged,
+ &color,
+ pdb_context->sample_threshold,
+ pdb_context->sample_transparent,
+ pdb_context->sample_criterion,
+ operation,
+ pdb_context->antialias,
+ pdb_context->feather,
+ pdb_context->feather_radius_x,
+ pdb_context->feather_radius_y);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_select_contiguous_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 operation;
+ GimpDrawable *drawable;
+ gdouble x;
+ gdouble y;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ operation = g_value_get_enum (gimp_value_array_index (args, 1));
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ x = g_value_get_double (gimp_value_array_index (args, 3));
+ y = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
+ if (pdb_context->sample_merged ||
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), image, 0, error))
+ {
+
+ gimp_channel_select_fuzzy (gimp_image_get_mask (image),
+ drawable,
+ pdb_context->sample_merged,
+ x, y,
+ pdb_context->sample_threshold,
+ pdb_context->sample_transparent,
+ pdb_context->sample_criterion,
+ pdb_context->diagonal_neighbors,
+ operation,
+ pdb_context->antialias,
+ pdb_context->feather,
+ pdb_context->feather_radius_x,
+ pdb_context->feather_radius_y);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_select_rectangle_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 operation;
+ gdouble x;
+ gdouble y;
+ gdouble width;
+ gdouble height;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ operation = g_value_get_enum (gimp_value_array_index (args, 1));
+ x = g_value_get_double (gimp_value_array_index (args, 2));
+ y = g_value_get_double (gimp_value_array_index (args, 3));
+ width = g_value_get_double (gimp_value_array_index (args, 4));
+ height = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
+ gimp_channel_select_rectangle (gimp_image_get_mask (image),
+ (gint) x, (gint) y,
+ (gint) width, (gint) height,
+ operation,
+ pdb_context->feather,
+ pdb_context->feather_radius_x,
+ pdb_context->feather_radius_y,
+ TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_select_round_rectangle_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 operation;
+ gdouble x;
+ gdouble y;
+ gdouble width;
+ gdouble height;
+ gdouble corner_radius_x;
+ gdouble corner_radius_y;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ operation = g_value_get_enum (gimp_value_array_index (args, 1));
+ x = g_value_get_double (gimp_value_array_index (args, 2));
+ y = g_value_get_double (gimp_value_array_index (args, 3));
+ width = g_value_get_double (gimp_value_array_index (args, 4));
+ height = g_value_get_double (gimp_value_array_index (args, 5));
+ corner_radius_x = g_value_get_double (gimp_value_array_index (args, 6));
+ corner_radius_y = g_value_get_double (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
+ gimp_channel_select_round_rect (gimp_image_get_mask (image),
+ (gint) x, (gint) y,
+ (gint) width, (gint) height,
+ corner_radius_x,
+ corner_radius_y,
+ operation,
+ pdb_context->antialias,
+ pdb_context->feather,
+ pdb_context->feather_radius_x,
+ pdb_context->feather_radius_y,
+ TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_select_ellipse_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 operation;
+ gdouble x;
+ gdouble y;
+ gdouble width;
+ gdouble height;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ operation = g_value_get_enum (gimp_value_array_index (args, 1));
+ x = g_value_get_double (gimp_value_array_index (args, 2));
+ y = g_value_get_double (gimp_value_array_index (args, 3));
+ width = g_value_get_double (gimp_value_array_index (args, 4));
+ height = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
+ gimp_channel_select_ellipse (gimp_image_get_mask (image),
+ (gint) x, (gint) y,
+ (gint) width, (gint) height,
+ operation,
+ pdb_context->antialias,
+ pdb_context->feather,
+ pdb_context->feather_radius_x,
+ pdb_context->feather_radius_y,
+ TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_select_polygon_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 operation;
+ gint32 num_segs;
+ const gdouble *segs;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ operation = g_value_get_enum (gimp_value_array_index (args, 1));
+ num_segs = g_value_get_int (gimp_value_array_index (args, 2));
+ segs = gimp_value_get_floatarray (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
+ gimp_channel_select_polygon (gimp_image_get_mask (image),
+ _("Free Select"),
+ num_segs / 2,
+ (GimpVector2 *) segs,
+ operation,
+ pdb_context->antialias,
+ pdb_context->feather,
+ pdb_context->feather_radius_x,
+ pdb_context->feather_radius_y,
+ TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_select_item_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 operation;
+ GimpItem *item;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ operation = g_value_get_enum (gimp_value_array_index (args, 1));
+ item = gimp_value_get_item (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (item, image, 0, error))
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
+ gimp_item_to_selection (item, operation,
+ pdb_context->antialias,
+ pdb_context->feather,
+ pdb_context->feather_radius_x,
+ pdb_context->feather_radius_y);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_image_select_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-image-select-color
+ */
+ procedure = gimp_procedure_new (image_select_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-select-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-select-color",
+ "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.\n"
+ "\n"
+ "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'.\n"
+ "\n"
+ "In the case of a merged sampling, the supplied drawable is ignored.",
+ "David Gowers",
+ "David Gowers",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The affected image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The color to select",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-select-contiguous-color
+ */
+ procedure = gimp_procedure_new (image_select_contiguous_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-select-contiguous-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-select-contiguous-color",
+ "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.\n"
+ "\n"
+ "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'.\n"
+ "\n"
+ "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.",
+ "David Gowers",
+ "David Gowers",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The affected image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "x coordinate of initial seed fill point: (image coordinates)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "y coordinate of initial seed fill point: (image coordinates)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-select-rectangle
+ */
+ procedure = gimp_procedure_new (image_select_rectangle_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-select-rectangle");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-select-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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-feather', 'gimp-context-set-feather-radius'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "x coordinate of upper-left corner of rectangle",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "y coordinate of upper-left corner of rectangle",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("width",
+ "width",
+ "The width of the rectangle",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("height",
+ "height",
+ "The height of the rectangle",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-select-round-rectangle
+ */
+ procedure = gimp_procedure_new (image_select_round_rectangle_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-select-round-rectangle");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-select-round-rectangle",
+ "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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius'.",
+ "Martin Nordholts",
+ "Martin Nordholts",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "x coordinate of upper-left corner of rectangle",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "y coordinate of upper-left corner of rectangle",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("width",
+ "width",
+ "The width of the rectangle",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("height",
+ "height",
+ "The height of the rectangle",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("corner-radius-x",
+ "corner radius x",
+ "The corner radius in X direction",
+ 0, GIMP_MAX_IMAGE_SIZE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("corner-radius-y",
+ "corner radius y",
+ "The corner radius in Y direction",
+ 0, GIMP_MAX_IMAGE_SIZE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-select-ellipse
+ */
+ procedure = gimp_procedure_new (image_select_ellipse_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-select-ellipse");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-select-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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "x coordinate of upper-left corner of ellipse bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "y coordinate of upper-left corner of ellipse bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("width",
+ "width",
+ "The width of the ellipse",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("height",
+ "height",
+ "The height of the ellipse",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-select-polygon
+ */
+ procedure = gimp_procedure_new (image_select_polygon_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-select-polygon");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-select-polygon",
+ "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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-segs",
+ "num segs",
+ "Number of points (count 1 coordinate as two points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("segs",
+ "segs",
+ "Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-select-item
+ */
+ procedure = gimp_procedure_new (image_select_item_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-select-item");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-select-item",
+ "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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The desired operation with current selection",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item to render to the selection",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/image-transform-cmds.c b/app/pdb/image-transform-cmds.c
new file mode 100644
index 0000000..074bd38
--- /dev/null
+++ b/app/pdb/image-transform-cmds.c
@@ -0,0 +1,522 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpimage-crop.h"
+#include "core/gimpimage-flip.h"
+#include "core/gimpimage-resize.h"
+#include "core/gimpimage-rotate.h"
+#include "core/gimpimage-scale.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimpprogress.h"
+
+#include "gimppdb.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+image_resize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 new_width;
+ gint32 new_height;
+ gint32 offx;
+ gint32 offy;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ new_width = g_value_get_int (gimp_value_array_index (args, 1));
+ new_height = g_value_get_int (gimp_value_array_index (args, 2));
+ offx = g_value_get_int (gimp_value_array_index (args, 3));
+ offy = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ gimp_image_resize (image, context,
+ new_width, new_height, offx, offy, NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_resize_to_layers_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_image_resize_to_layers (image, context, NULL, NULL, NULL, NULL, NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_scale_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 new_width;
+ gint32 new_height;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ new_width = g_value_get_int (gimp_value_array_index (args, 1));
+ new_height = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Scaling"));
+
+ gimp_image_scale (image, new_width, new_height,
+ pdb_context->interpolation,
+ progress);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_scale_full_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 new_width;
+ gint32 new_height;
+ gint32 interpolation;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ new_width = g_value_get_int (gimp_value_array_index (args, 1));
+ new_height = g_value_get_int (gimp_value_array_index (args, 2));
+ interpolation = g_value_get_enum (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Scaling"));
+
+ gimp_image_scale (image, new_width, new_height, interpolation, progress);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_crop_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 new_width;
+ gint32 new_height;
+ gint32 offx;
+ gint32 offy;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ new_width = g_value_get_int (gimp_value_array_index (args, 1));
+ new_height = g_value_get_int (gimp_value_array_index (args, 2));
+ offx = g_value_get_int (gimp_value_array_index (args, 3));
+ offy = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (new_width > gimp_image_get_width (image) ||
+ new_height > gimp_image_get_height (image) ||
+ offx > (gimp_image_get_width (image) - new_width) ||
+ offy > (gimp_image_get_height (image) - new_height))
+ success = FALSE;
+ else
+ gimp_image_crop (image, context, GIMP_FILL_TRANSPARENT,
+ offx, offy, new_width, new_height,
+ TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_flip_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 flip_type;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ flip_type = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_image_flip (image, context, flip_type, NULL);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_rotate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 rotate_type;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ rotate_type = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Rotating"));
+
+ gimp_image_rotate (image, context, rotate_type, progress);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_image_transform_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-image-resize
+ */
+ procedure = gimp_procedure_new (image_resize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-resize");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-resize",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-width",
+ "new width",
+ "New image width",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-height",
+ "new height",
+ "New image height",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offx",
+ "offx",
+ "x offset between upper left corner of old and new images: (new - old)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offy",
+ "offy",
+ "y offset between upper left corner of old and new images: (new - old)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-resize-to-layers
+ */
+ procedure = gimp_procedure_new (image_resize_to_layers_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-resize-to-layers");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-resize-to-layers",
+ "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.",
+ "Simon Budig",
+ "Simon Budig",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-scale
+ */
+ procedure = gimp_procedure_new (image_scale_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-scale");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-scale",
+ "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'.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-width",
+ "new width",
+ "New image width",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-height",
+ "new height",
+ "New image height",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-scale-full
+ */
+ procedure = gimp_procedure_new (image_scale_full_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-scale-full");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-scale-full",
+ "Deprecated: Use 'gimp-image-scale' instead.",
+ "Deprecated: Use 'gimp-image-scale' instead.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2008",
+ "gimp-image-scale");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-width",
+ "new width",
+ "New image width",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-height",
+ "new height",
+ "New image height",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "Type of interpolation",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-crop
+ */
+ procedure = gimp_procedure_new (image_crop_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-crop");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-crop",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-width",
+ "new width",
+ "New image width: (0 < new_width <= width)",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-height",
+ "new height",
+ "New image height: (0 < new_height <= height)",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offx",
+ "offx",
+ "X offset: (0 <= offx <= (width - new_width))",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offy",
+ "offy",
+ "Y offset: (0 <= offy <= (height - new_height))",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-flip
+ */
+ procedure = gimp_procedure_new (image_flip_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-flip");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-flip",
+ "Flips the image horizontally or vertically.",
+ "This procedure flips (mirrors) the image.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("flip-type",
+ "flip type",
+ "Type of flip",
+ GIMP_TYPE_ORIENTATION_TYPE,
+ GIMP_ORIENTATION_HORIZONTAL,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
+ GIMP_ORIENTATION_UNKNOWN);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-rotate
+ */
+ procedure = gimp_procedure_new (image_rotate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-rotate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-rotate",
+ "Rotates the image by the specified degrees.",
+ "This procedure rotates the image.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("rotate-type",
+ "rotate type",
+ "Angle of rotation",
+ GIMP_TYPE_ROTATION_TYPE,
+ GIMP_ROTATE_90,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/image-undo-cmds.c b/app/pdb/image-undo-cmds.c
new file mode 100644
index 0000000..1a5dfe5
--- /dev/null
+++ b/app/pdb/image-undo-cmds.c
@@ -0,0 +1,477 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpimage-undo.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+#include "plug-in/gimpplugin-cleanup.h"
+#include "plug-in/gimpplugin.h"
+#include "plug-in/gimppluginmanager.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+image_undo_group_start_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+ const gchar *undo_desc = NULL;
+
+ if (plug_in)
+ {
+ success = gimp_plug_in_cleanup_undo_group_start (plug_in, image);
+
+ if (success)
+ undo_desc = gimp_plug_in_get_undo_desc (plug_in);
+ }
+
+ if (success)
+ gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_MISC, undo_desc);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_undo_group_end_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in)
+ success = gimp_plug_in_cleanup_undo_group_end (plug_in, image);
+
+ if (success)
+ gimp_image_undo_group_end (image);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_undo_is_enabled_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gboolean enabled = FALSE;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ enabled = gimp_image_undo_is_enabled (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), enabled);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_undo_disable_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gboolean disabled = FALSE;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ #if 0
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in)
+ success = gimp_plug_in_cleanup_undo_disable (plug_in, image);
+ #endif
+
+ if (success)
+ disabled = gimp_image_undo_disable (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), disabled);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_undo_enable_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gboolean enabled = FALSE;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ #if 0
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in)
+ success = gimp_plug_in_cleanup_undo_enable (plug_in, image);
+ #endif
+
+ if (success)
+ enabled = gimp_image_undo_enable (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), enabled);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_undo_freeze_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gboolean frozen = FALSE;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ #if 0
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in)
+ success = gimp_plug_in_cleanup_undo_freeze (plug_in, image);
+ #endif
+
+ if (success)
+ frozen = gimp_image_undo_freeze (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), frozen);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_undo_thaw_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gboolean thawed = FALSE;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ #if 0
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in)
+ success = gimp_plug_in_cleanup_undo_thaw (plug_in, image);
+ #endif
+
+ if (success)
+ thawed = gimp_image_undo_thaw (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), thawed);
+
+ return return_vals;
+}
+
+void
+register_image_undo_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-image-undo-group-start
+ */
+ procedure = gimp_procedure_new (image_undo_group_start_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-undo-group-start");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-undo-group-start",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The ID of the image in which to open an undo group",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-undo-group-end
+ */
+ procedure = gimp_procedure_new (image_undo_group_end_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-undo-group-end");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-undo-group-end",
+ "Finish a group undo.",
+ "This function must be called once for each 'gimp-image-undo-group-start' call that is made.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The ID of the image in which to close an undo group",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-undo-is-enabled
+ */
+ procedure = gimp_procedure_new (image_undo_is_enabled_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-undo-is-enabled");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-undo-is-enabled",
+ "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'.",
+ "Rapha\xc3\xabl Quinet <raphael@gimp.org>",
+ "Rapha\xc3\xabl Quinet",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("enabled",
+ "enabled",
+ "TRUE if undo is enabled for this image",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-undo-disable
+ */
+ procedure = gimp_procedure_new (image_undo_disable_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-undo-disable");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-undo-disable",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("disabled",
+ "disabled",
+ "TRUE if the image undo has been disabled",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-undo-enable
+ */
+ procedure = gimp_procedure_new (image_undo_enable_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-undo-enable");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-undo-enable",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("enabled",
+ "enabled",
+ "TRUE if the image undo has been enabled",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-undo-freeze
+ */
+ procedure = gimp_procedure_new (image_undo_freeze_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-undo-freeze");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-undo-freeze",
+ "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.",
+ "Adam D. Moss",
+ "Adam D. Moss",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("frozen",
+ "frozen",
+ "TRUE if the image undo has been frozen",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-undo-thaw
+ */
+ procedure = gimp_procedure_new (image_undo_thaw_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-undo-thaw");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-undo-thaw",
+ "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.",
+ "Adam D. Moss",
+ "Adam D. Moss",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("thawed",
+ "thawed",
+ "TRUE if the image undo has been thawed",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
new file mode 100644
index 0000000..9a90f78
--- /dev/null
+++ b/app/pdb/internal-procs.c
@@ -0,0 +1,95 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <glib-object.h>
+
+#include "pdb-types.h"
+
+#include "gimppdb.h"
+
+#include "internal-procs.h"
+
+
+/* 852 procedures registered total */
+
+void
+internal_procs_init (GimpPDB *pdb)
+{
+ g_return_if_fail (GIMP_IS_PDB (pdb));
+
+ register_brush_procs (pdb);
+ register_brush_select_procs (pdb);
+ register_brushes_procs (pdb);
+ register_buffer_procs (pdb);
+ register_channel_procs (pdb);
+ register_color_procs (pdb);
+ register_context_procs (pdb);
+ register_debug_procs (pdb);
+ register_display_procs (pdb);
+ register_drawable_procs (pdb);
+ register_drawable_color_procs (pdb);
+ register_drawable_edit_procs (pdb);
+ register_drawable_transform_procs (pdb);
+ register_dynamics_procs (pdb);
+ register_edit_procs (pdb);
+ register_fileops_procs (pdb);
+ register_floating_sel_procs (pdb);
+ register_font_select_procs (pdb);
+ register_fonts_procs (pdb);
+ register_gimp_procs (pdb);
+ register_gimprc_procs (pdb);
+ register_gradient_procs (pdb);
+ register_gradient_select_procs (pdb);
+ register_gradients_procs (pdb);
+ register_help_procs (pdb);
+ register_image_procs (pdb);
+ register_image_color_profile_procs (pdb);
+ register_image_convert_procs (pdb);
+ register_image_grid_procs (pdb);
+ register_image_guides_procs (pdb);
+ register_image_sample_points_procs (pdb);
+ register_image_select_procs (pdb);
+ register_image_transform_procs (pdb);
+ register_image_undo_procs (pdb);
+ register_item_procs (pdb);
+ register_item_transform_procs (pdb);
+ register_layer_procs (pdb);
+ register_message_procs (pdb);
+ register_paint_tools_procs (pdb);
+ register_palette_procs (pdb);
+ register_palette_select_procs (pdb);
+ register_palettes_procs (pdb);
+ register_paths_procs (pdb);
+ register_pattern_procs (pdb);
+ register_pattern_select_procs (pdb);
+ register_patterns_procs (pdb);
+ register_plug_in_procs (pdb);
+ register_plug_in_compat_procs (pdb);
+ register_procedural_db_procs (pdb);
+ register_progress_procs (pdb);
+ register_selection_procs (pdb);
+ register_selection_tools_procs (pdb);
+ register_text_layer_procs (pdb);
+ register_text_tool_procs (pdb);
+ register_transform_tools_procs (pdb);
+ register_unit_procs (pdb);
+ register_vectors_procs (pdb);
+}
diff --git a/app/pdb/internal-procs.h b/app/pdb/internal-procs.h
new file mode 100644
index 0000000..def0554
--- /dev/null
+++ b/app/pdb/internal-procs.h
@@ -0,0 +1,85 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#ifndef __INTERNAL_PROCS_H__
+#define __INTERNAL_PROCS_H__
+
+void internal_procs_init (GimpPDB *pdb);
+
+/* Forward declarations for registering PDB procs */
+
+void register_brush_procs (GimpPDB *pdb);
+void register_brush_select_procs (GimpPDB *pdb);
+void register_brushes_procs (GimpPDB *pdb);
+void register_buffer_procs (GimpPDB *pdb);
+void register_channel_procs (GimpPDB *pdb);
+void register_color_procs (GimpPDB *pdb);
+void register_context_procs (GimpPDB *pdb);
+void register_debug_procs (GimpPDB *pdb);
+void register_display_procs (GimpPDB *pdb);
+void register_drawable_procs (GimpPDB *pdb);
+void register_drawable_color_procs (GimpPDB *pdb);
+void register_drawable_edit_procs (GimpPDB *pdb);
+void register_drawable_transform_procs (GimpPDB *pdb);
+void register_dynamics_procs (GimpPDB *pdb);
+void register_edit_procs (GimpPDB *pdb);
+void register_fileops_procs (GimpPDB *pdb);
+void register_floating_sel_procs (GimpPDB *pdb);
+void register_font_select_procs (GimpPDB *pdb);
+void register_fonts_procs (GimpPDB *pdb);
+void register_gimp_procs (GimpPDB *pdb);
+void register_gimprc_procs (GimpPDB *pdb);
+void register_gradient_procs (GimpPDB *pdb);
+void register_gradient_select_procs (GimpPDB *pdb);
+void register_gradients_procs (GimpPDB *pdb);
+void register_help_procs (GimpPDB *pdb);
+void register_image_procs (GimpPDB *pdb);
+void register_image_color_profile_procs (GimpPDB *pdb);
+void register_image_convert_procs (GimpPDB *pdb);
+void register_image_grid_procs (GimpPDB *pdb);
+void register_image_guides_procs (GimpPDB *pdb);
+void register_image_sample_points_procs (GimpPDB *pdb);
+void register_image_select_procs (GimpPDB *pdb);
+void register_image_transform_procs (GimpPDB *pdb);
+void register_image_undo_procs (GimpPDB *pdb);
+void register_item_procs (GimpPDB *pdb);
+void register_item_transform_procs (GimpPDB *pdb);
+void register_layer_procs (GimpPDB *pdb);
+void register_message_procs (GimpPDB *pdb);
+void register_paint_tools_procs (GimpPDB *pdb);
+void register_palette_procs (GimpPDB *pdb);
+void register_palette_select_procs (GimpPDB *pdb);
+void register_palettes_procs (GimpPDB *pdb);
+void register_paths_procs (GimpPDB *pdb);
+void register_pattern_procs (GimpPDB *pdb);
+void register_pattern_select_procs (GimpPDB *pdb);
+void register_patterns_procs (GimpPDB *pdb);
+void register_plug_in_procs (GimpPDB *pdb);
+void register_plug_in_compat_procs (GimpPDB *pdb);
+void register_procedural_db_procs (GimpPDB *pdb);
+void register_progress_procs (GimpPDB *pdb);
+void register_selection_procs (GimpPDB *pdb);
+void register_selection_tools_procs (GimpPDB *pdb);
+void register_text_layer_procs (GimpPDB *pdb);
+void register_text_tool_procs (GimpPDB *pdb);
+void register_transform_tools_procs (GimpPDB *pdb);
+void register_unit_procs (GimpPDB *pdb);
+void register_vectors_procs (GimpPDB *pdb);
+
+#endif /* __INTERNAL_PROCS_H__ */
diff --git a/app/pdb/item-cmds.c b/app/pdb/item-cmds.c
new file mode 100644
index 0000000..894e596
--- /dev/null
+++ b/app/pdb/item-cmds.c
@@ -0,0 +1,1970 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpimage.h"
+#include "core/gimpitem.h"
+#include "core/gimplayermask.h"
+#include "core/gimplist.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimpselection.h"
+#include "text/gimptextlayer.h"
+#include "vectors/gimpvectors.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+item_is_valid_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean valid = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ valid = (GIMP_IS_ITEM (item) &&
+ ! gimp_item_is_removed (GIMP_ITEM (item)));
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), valid);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_get_image_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ GimpImage *image = NULL;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ image = gimp_item_get_image (GIMP_ITEM (item));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_image (gimp_value_array_index (return_vals, 1), image);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_delete_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpItem *item;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (g_object_is_floating (item))
+ {
+ g_object_ref_sink (item);
+ g_object_unref (item);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+item_is_drawable_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean drawable = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ drawable = GIMP_IS_DRAWABLE (item);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_is_layer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean layer = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ layer = GIMP_IS_LAYER (item);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_is_text_layer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean text_layer = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ text_layer = gimp_item_is_text_layer (item);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), text_layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_is_channel_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean channel = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ channel = GIMP_IS_CHANNEL (item);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), channel);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_is_layer_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean layer_mask = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ layer_mask = GIMP_IS_LAYER_MASK (item);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), layer_mask);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_is_selection_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean selection = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ selection = GIMP_IS_SELECTION (item);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), selection);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_is_vectors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean vectors = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ vectors = GIMP_IS_VECTORS (item);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), vectors);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_is_group_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean group = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ group = (gimp_viewable_get_children (GIMP_VIEWABLE (item)) != NULL);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), group);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_get_parent_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ GimpItem *parent = NULL;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ parent = gimp_item_get_parent (item);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_item (gimp_value_array_index (return_vals, 1), parent);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_get_children_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gint32 num_children = 0;
+ gint32 *child_ids = NULL;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpContainer *children = gimp_viewable_get_children (GIMP_VIEWABLE (item));
+
+ if (children)
+ {
+ num_children = gimp_container_get_n_children (children);
+
+ if (num_children)
+ {
+ GList *list;
+ gint i;
+
+ child_ids = g_new (gint32, num_children);
+
+ for (list = GIMP_LIST (children)->queue->head, i = 0;
+ list;
+ list = g_list_next (list), i++)
+ {
+ child_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
+ }
+ }
+ }
+ else
+ success = FALSE;
+
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_children);
+ gimp_value_take_int32array (gimp_value_array_index (return_vals, 2), child_ids, num_children);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_get_expanded_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean expanded = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ expanded = gimp_viewable_get_expanded (GIMP_VIEWABLE (item));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), expanded);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_set_expanded_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpItem *item;
+ gboolean expanded;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ expanded = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_viewable_set_expanded (GIMP_VIEWABLE (item), expanded);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+item_get_name_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gchar *name = NULL;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ name = g_strdup (gimp_object_get_name (item));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_set_name_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpItem *item;
+ const gchar *name;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ success = gimp_item_rename (GIMP_ITEM (item), name, error);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+item_get_visible_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean visible = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ visible = gimp_item_get_visible (GIMP_ITEM (item));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), visible);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_set_visible_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpItem *item;
+ gboolean visible;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ visible = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_item_set_visible (GIMP_ITEM (item), visible, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+item_get_linked_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean linked = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ linked = gimp_item_get_linked (GIMP_ITEM (item));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), linked);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_set_linked_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpItem *item;
+ gboolean linked;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ linked = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_item_set_linked (GIMP_ITEM (item), linked, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+item_get_lock_content_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean lock_content = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ lock_content = gimp_item_get_lock_content (GIMP_ITEM (item));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), lock_content);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_set_lock_content_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpItem *item;
+ gboolean lock_content;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ lock_content = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_item_can_lock_content (GIMP_ITEM (item)))
+ gimp_item_set_lock_content (GIMP_ITEM (item), lock_content, TRUE);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+item_get_lock_position_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gboolean lock_position = FALSE;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ lock_position = gimp_item_get_lock_position (GIMP_ITEM (item));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), lock_position);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_set_lock_position_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpItem *item;
+ gboolean lock_position;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ lock_position = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_item_can_lock_position (GIMP_ITEM (item)))
+ gimp_item_set_lock_position (GIMP_ITEM (item), lock_position, TRUE);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+item_get_color_tag_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gint32 color_tag = 0;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ color_tag = gimp_item_get_color_tag (GIMP_ITEM (item));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), color_tag);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_set_color_tag_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpItem *item;
+ gint32 color_tag;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ color_tag = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_item_set_color_tag (GIMP_ITEM (item), color_tag, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+item_get_tattoo_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gint32 tattoo = 0;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ tattoo = gimp_item_get_tattoo (GIMP_ITEM (item));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_uint (gimp_value_array_index (return_vals, 1), tattoo);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_set_tattoo_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpItem *item;
+ gint32 tattoo;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ tattoo = g_value_get_uint (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_item_set_tattoo (GIMP_ITEM (item), tattoo);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+item_attach_parasite_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpItem *item;
+ const GimpParasite *parasite;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ parasite = g_value_get_boxed (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_item_parasite_validate (item, parasite, error))
+ gimp_item_parasite_attach (item, parasite, TRUE);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+item_detach_parasite_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpItem *item;
+ const gchar *name;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_item_parasite_detach (item, name, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+item_get_parasite_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ const gchar *name;
+ GimpParasite *parasite = NULL;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ parasite = gimp_parasite_copy (gimp_item_parasite_find (item, name));
+
+ if (! parasite)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_boxed (gimp_value_array_index (return_vals, 1), parasite);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_get_parasite_list_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gint32 num_parasites = 0;
+ gchar **parasites = NULL;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ parasites = gimp_item_parasite_list (item, &num_parasites);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_parasites);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), parasites, num_parasites);
+ }
+
+ return return_vals;
+}
+
+void
+register_item_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-item-is-valid
+ */
+ procedure = gimp_procedure_new (item_is_valid_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-is-valid");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-is-valid",
+ "Returns TRUE if the item is valid.",
+ "This procedure checks if the given item ID is valid and refers to an existing item.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2007",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item to check",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("valid",
+ "valid",
+ "Whether the item ID is valid",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-get-image
+ */
+ procedure = gimp_procedure_new (item_get_image_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-get-image");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-get-image",
+ "Returns the item's image.",
+ "This procedure returns the item's image.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The item's image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-delete
+ */
+ procedure = gimp_procedure_new (item_delete_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-delete");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item to delete",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-is-drawable
+ */
+ procedure = gimp_procedure_new (item_is_drawable_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-is-drawable");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-is-drawable",
+ "Returns whether the item is a drawable.",
+ "This procedure returns TRUE if the specified item is a drawable.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("drawable",
+ "drawable",
+ "TRUE if the item is a drawable, FALSE otherwise",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-is-layer
+ */
+ procedure = gimp_procedure_new (item_is_layer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-is-layer");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-is-layer",
+ "Returns whether the item is a layer.",
+ "This procedure returns TRUE if the specified item is a layer.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("layer",
+ "layer",
+ "TRUE if the item is a layer, FALSE otherwise",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-is-text-layer
+ */
+ procedure = gimp_procedure_new (item_is_text_layer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-is-text-layer");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-is-text-layer",
+ "Returns whether the item is a text layer.",
+ "This procedure returns TRUE if the specified item is a text layer.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("text-layer",
+ "text layer",
+ "TRUE if the item is a text layer, FALSE otherwise.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-is-channel
+ */
+ procedure = gimp_procedure_new (item_is_channel_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-is-channel");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-is-channel",
+ "Returns whether the item is a channel.",
+ "This procedure returns TRUE if the specified item is a channel.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("channel",
+ "channel",
+ "TRUE if the item is a channel, FALSE otherwise",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-is-layer-mask
+ */
+ procedure = gimp_procedure_new (item_is_layer_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-is-layer-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-is-layer-mask",
+ "Returns whether the item is a layer mask.",
+ "This procedure returns TRUE if the specified item is a layer mask.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("layer-mask",
+ "layer mask",
+ "TRUE if the item is a layer mask, FALSE otherwise",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-is-selection
+ */
+ procedure = gimp_procedure_new (item_is_selection_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-is-selection");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-is-selection",
+ "Returns whether the item is a selection.",
+ "This procedure returns TRUE if the specified item is a selection.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("selection",
+ "selection",
+ "TRUE if the item is a selection, FALSE otherwise",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-is-vectors
+ */
+ procedure = gimp_procedure_new (item_is_vectors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-is-vectors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-is-vectors",
+ "Returns whether the item is a vectors.",
+ "This procedure returns TRUE if the specified item is a vectors.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("vectors",
+ "vectors",
+ "TRUE if the item is a vectors, FALSE otherwise",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-is-group
+ */
+ procedure = gimp_procedure_new (item_is_group_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-is-group");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-is-group",
+ "Returns whether the item is a group item.",
+ "This procedure returns TRUE if the specified item is a group item which can have children.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("group",
+ "group",
+ "TRUE if the item is a group, FALSE otherwise",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-get-parent
+ */
+ procedure = gimp_procedure_new (item_get_parent_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-get-parent");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-get-parent",
+ "Returns the item's parent item.",
+ "This procedure returns the item's parent item, if any.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_item_id ("parent",
+ "parent",
+ "The item's parent item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-get-children
+ */
+ procedure = gimp_procedure_new (item_get_children_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-get-children");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-get-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-children",
+ "num children",
+ "The item's number of children",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32_array ("child-ids",
+ "child ids",
+ "The item's list of children",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-get-expanded
+ */
+ procedure = gimp_procedure_new (item_get_expanded_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-get-expanded");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-get-expanded",
+ "Returns whether the item is expanded.",
+ "This procedure returns TRUE if the specified item is expanded.",
+ "Ell",
+ "Ell",
+ "2017",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("expanded",
+ "expanded",
+ "TRUE if the item is expanded, FALSE otherwise",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-set-expanded
+ */
+ procedure = gimp_procedure_new (item_set_expanded_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-set-expanded");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-set-expanded",
+ "Sets the expanded state of the item.",
+ "This procedure expands or collapses the item.",
+ "Ell",
+ "Ell",
+ "2017",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("expanded",
+ "expanded",
+ "TRUE to expand the item, FALSE to collapse the item",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-get-name
+ */
+ procedure = gimp_procedure_new (item_get_name_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-get-name");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-get-name",
+ "Get the name of the specified item.",
+ "This procedure returns the specified item's name.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The item name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-set-name
+ */
+ procedure = gimp_procedure_new (item_set_name_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-set-name");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-set-name",
+ "Set the name of the specified item.",
+ "This procedure sets the specified item's name.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The new item name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-get-visible
+ */
+ procedure = gimp_procedure_new (item_get_visible_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-get-visible");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-get-visible",
+ "Get the visibility of the specified item.",
+ "This procedure returns the specified item's visibility.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("visible",
+ "visible",
+ "The item visibility",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-set-visible
+ */
+ procedure = gimp_procedure_new (item_set_visible_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-set-visible");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-set-visible",
+ "Set the visibility of the specified item.",
+ "This procedure sets the specified item's visibility.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("visible",
+ "visible",
+ "The new item visibility",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-get-linked
+ */
+ procedure = gimp_procedure_new (item_get_linked_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-get-linked");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-get-linked",
+ "Get the linked state of the specified item.",
+ "This procedure returns the specified item's linked state.",
+ "Wolfgang Hofer",
+ "Wolfgang Hofer",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("linked",
+ "linked",
+ "The item linked state (for moves)",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-set-linked
+ */
+ procedure = gimp_procedure_new (item_set_linked_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-set-linked");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-set-linked",
+ "Set the linked state of the specified item.",
+ "This procedure sets the specified item's linked state.",
+ "Wolfgang Hofer",
+ "Wolfgang Hofer",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("linked",
+ "linked",
+ "The new item linked state",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-get-lock-content
+ */
+ procedure = gimp_procedure_new (item_get_lock_content_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-get-lock-content");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-get-lock-content",
+ "Get the 'lock content' state of the specified item.",
+ "This procedure returns the specified item's lock content state.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2009",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("lock-content",
+ "lock content",
+ "Whether the item's contents are locked",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-set-lock-content
+ */
+ procedure = gimp_procedure_new (item_set_lock_content_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-set-lock-content");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-set-lock-content",
+ "Set the 'lock content' state of the specified item.",
+ "This procedure sets the specified item's lock content state.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2009",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("lock-content",
+ "lock content",
+ "The new item 'lock content' state",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-get-lock-position
+ */
+ procedure = gimp_procedure_new (item_get_lock_position_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-get-lock-position");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-get-lock-position",
+ "Get the 'lock position' state of the specified item.",
+ "This procedure returns the specified item's lock position state.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2012",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("lock-position",
+ "lock position",
+ "Whether the item's position is locked",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-set-lock-position
+ */
+ procedure = gimp_procedure_new (item_set_lock_position_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-set-lock-position");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-set-lock-position",
+ "Set the 'lock position' state of the specified item.",
+ "This procedure sets the specified item's lock position state.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2009",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("lock-position",
+ "lock position",
+ "The new item 'lock position' state",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-get-color-tag
+ */
+ procedure = gimp_procedure_new (item_get_color_tag_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-get-color-tag");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-get-color-tag",
+ "Get the color tag of the specified item.",
+ "This procedure returns the specified item's color tag.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2016",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("color-tag",
+ "color tag",
+ "The item's color tag",
+ GIMP_TYPE_COLOR_TAG,
+ GIMP_COLOR_TAG_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-set-color-tag
+ */
+ procedure = gimp_procedure_new (item_set_color_tag_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-set-color-tag");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-set-color-tag",
+ "Set the color tag of the specified item.",
+ "This procedure sets the specified item's color tag.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2016",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("color-tag",
+ "color tag",
+ "The new item color tag",
+ GIMP_TYPE_COLOR_TAG,
+ GIMP_COLOR_TAG_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-get-tattoo
+ */
+ procedure = gimp_procedure_new (item_get_tattoo_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-get-tattoo");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-get-tattoo",
+ "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.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_uint ("tattoo",
+ "tattoo",
+ "The item tattoo",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-set-tattoo
+ */
+ procedure = gimp_procedure_new (item_set_tattoo_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-set-tattoo");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-set-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.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_uint ("tattoo",
+ "tattoo",
+ "The new item tattoo",
+ 1, G_MAXUINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-attach-parasite
+ */
+ procedure = gimp_procedure_new (item_attach_parasite_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-attach-parasite");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-attach-parasite",
+ "Add a parasite to an item.",
+ "This procedure attaches a parasite to an item. It has no return values.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_parasite ("parasite",
+ "parasite",
+ "The parasite to attach to the item",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-detach-parasite
+ */
+ procedure = gimp_procedure_new (item_detach_parasite_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-detach-parasite");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-detach-parasite",
+ "Removes a parasite from an item.",
+ "This procedure detaches a parasite from an item. It has no return values.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the parasite to detach from the item.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-get-parasite
+ */
+ procedure = gimp_procedure_new (item_get_parasite_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-get-parasite");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-get-parasite",
+ "Look up a parasite in an item",
+ "Finds and returns the parasite that is attached to an item.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the parasite to find",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_parasite ("parasite",
+ "parasite",
+ "The found parasite",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-get-parasite-list
+ */
+ procedure = gimp_procedure_new (item_get_parasite_list_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-get-parasite-list");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-get-parasite-list",
+ "List all parasites.",
+ "Returns a list of all parasites currently attached the an item.",
+ "Marc Lehmann",
+ "Marc Lehmann",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-parasites",
+ "num parasites",
+ "The number of attached parasites",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("parasites",
+ "parasites",
+ "The names of currently attached parasites",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/item-transform-cmds.c b/app/pdb/item-transform-cmds.c
new file mode 100644
index 0000000..bcf210e
--- /dev/null
+++ b/app/pdb/item-transform-cmds.c
@@ -0,0 +1,1669 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpmath/gimpmath.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp-transform-utils.h"
+#include "core/gimpchannel.h"
+#include "core/gimpdrawable-transform.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
+#include "core/gimpitem-linked.h"
+#include "core/gimpitem.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimpprogress.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+item_transform_translate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gdouble off_x;
+ gdouble off_y;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ off_x = g_value_get_double (gimp_value_array_index (args, 1));
+ off_y = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_modifiable (item,
+ GIMP_PDB_ITEM_POSITION, error))
+ {
+ if (gimp_item_get_linked (item) && gimp_item_is_attached (item))
+ {
+ gimp_item_linked_translate (item, off_x, off_y, TRUE);
+ }
+ else
+ {
+ gimp_item_translate (item, off_x, off_y, TRUE);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_item (gimp_value_array_index (return_vals, 1), item);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_transform_flip_simple_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gint32 flip_type;
+ gboolean auto_center;
+ gdouble axis;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ flip_type = g_value_get_enum (gimp_value_array_index (args, 1));
+ auto_center = g_value_get_boolean (gimp_value_array_index (args, 2));
+ axis = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (item, NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (item, &x, &y, &width, &height))
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
+ gint off_x, off_y;
+
+ gimp_item_get_offset (item, &off_x, &off_y);
+ x += off_x;
+ y += off_y;
+
+ gimp_transform_get_flip_axis (x, y, width, height,
+ flip_type, auto_center, &axis);
+
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ GimpDrawable *drawable;
+
+ drawable = gimp_drawable_transform_flip (GIMP_DRAWABLE (item), context,
+ flip_type, axis,
+ pdb_context->transform_resize);
+
+ if (drawable)
+ item = GIMP_ITEM (drawable);
+ else
+ success = FALSE;
+ }
+ else if (gimp_item_get_linked (item))
+ {
+ gimp_item_linked_flip (item, context,
+ flip_type, axis,
+ pdb_context->transform_resize);
+ }
+ else
+ {
+ gimp_item_flip (item, context,
+ flip_type, axis,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize));
+ }
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_item (gimp_value_array_index (return_vals, 1), item);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_transform_flip_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gdouble x0;
+ gdouble y0;
+ gdouble x1;
+ gdouble y1;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ x0 = g_value_get_double (gimp_value_array_index (args, 1));
+ y0 = g_value_get_double (gimp_value_array_index (args, 2));
+ x1 = g_value_get_double (gimp_value_array_index (args, 3));
+ y1 = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (item, NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (item, &x, &y, &width, &height))
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (item, &off_x, &off_y);
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_flip_free (&matrix, x0, y0, x1, y1);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Flipping"));
+
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ GimpDrawable *drawable;
+
+ drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+ context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+
+ if (drawable)
+ item = GIMP_ITEM (drawable);
+ else
+ success = FALSE;
+ }
+ else if (gimp_item_get_linked (item))
+ {
+ gimp_item_linked_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+ }
+ else
+ {
+ gimp_item_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
+ progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_item (gimp_value_array_index (return_vals, 1), item);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_transform_perspective_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gdouble x0;
+ gdouble y0;
+ gdouble x1;
+ gdouble y1;
+ gdouble x2;
+ gdouble y2;
+ gdouble x3;
+ gdouble y3;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ x0 = g_value_get_double (gimp_value_array_index (args, 1));
+ y0 = g_value_get_double (gimp_value_array_index (args, 2));
+ x1 = g_value_get_double (gimp_value_array_index (args, 3));
+ y1 = g_value_get_double (gimp_value_array_index (args, 4));
+ x2 = g_value_get_double (gimp_value_array_index (args, 5));
+ y2 = g_value_get_double (gimp_value_array_index (args, 6));
+ x3 = g_value_get_double (gimp_value_array_index (args, 7));
+ y3 = g_value_get_double (gimp_value_array_index (args, 8));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (item, NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (item, &x, &y, &width, &height))
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (item, &off_x, &off_y);
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_perspective (&matrix,
+ x, y, width, height,
+ x0, y0, x1, y1,
+ x2, y2, x3, y3);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Perspective"));
+
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ GimpDrawable *drawable;
+
+ drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+ context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+
+ if (drawable)
+ item = GIMP_ITEM (drawable);
+ else
+ success = FALSE;
+ }
+ else if (gimp_item_get_linked (item))
+ {
+ gimp_item_linked_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+ }
+ else
+ {
+ gimp_item_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
+ progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_item (gimp_value_array_index (return_vals, 1), item);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_transform_rotate_simple_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gint32 rotate_type;
+ gboolean auto_center;
+ gdouble center_x;
+ gdouble center_y;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ rotate_type = g_value_get_enum (gimp_value_array_index (args, 1));
+ auto_center = g_value_get_boolean (gimp_value_array_index (args, 2));
+ center_x = g_value_get_double (gimp_value_array_index (args, 3));
+ center_y = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (item, NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (item, &x, &y, &width, &height))
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
+ gint off_x, off_y;
+
+ gimp_item_get_offset (item, &off_x, &off_y);
+ x += off_x;
+ y += off_y;
+
+ gimp_transform_get_rotate_center (x, y, width, height,
+ auto_center, &center_x, &center_y);
+
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ GimpDrawable *drawable;
+
+ drawable = gimp_drawable_transform_rotate (GIMP_DRAWABLE (item),
+ context,
+ rotate_type,
+ center_x, center_y,
+ pdb_context->transform_resize);
+
+ if (drawable)
+ item = GIMP_ITEM (drawable);
+ else
+ success = FALSE;
+ }
+ else if (gimp_item_get_linked (item))
+ {
+ gimp_item_linked_rotate (item, context,
+ rotate_type,
+ center_x, center_y,
+ pdb_context->transform_resize);
+ }
+ else
+ {
+ gimp_item_rotate (item, context,
+ rotate_type,
+ center_x, center_y,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize));
+ }
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_item (gimp_value_array_index (return_vals, 1), item);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_transform_rotate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gdouble angle;
+ gboolean auto_center;
+ gdouble center_x;
+ gdouble center_y;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ angle = g_value_get_double (gimp_value_array_index (args, 1));
+ auto_center = g_value_get_boolean (gimp_value_array_index (args, 2));
+ center_x = g_value_get_double (gimp_value_array_index (args, 3));
+ center_y = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (item, NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (item, &x, &y, &width, &height))
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (item, &off_x, &off_y);
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ if (auto_center)
+ gimp_transform_matrix_rotate_rect (&matrix,
+ x, y, width, height, angle);
+ else
+ gimp_transform_matrix_rotate_center (&matrix,
+ center_x, center_y, angle);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Rotating"));
+
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ GimpDrawable *drawable;
+
+ drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+ context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+
+ if (drawable)
+ item = GIMP_ITEM (drawable);
+ else
+ success = FALSE;
+ }
+ else if (gimp_item_get_linked (item))
+ {
+ gimp_item_linked_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+ }
+ else
+ {
+ gimp_item_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
+ progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_item (gimp_value_array_index (return_vals, 1), item);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_transform_scale_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gdouble x0;
+ gdouble y0;
+ gdouble x1;
+ gdouble y1;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ x0 = g_value_get_double (gimp_value_array_index (args, 1));
+ y0 = g_value_get_double (gimp_value_array_index (args, 2));
+ x1 = g_value_get_double (gimp_value_array_index (args, 3));
+ y1 = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = (gimp_pdb_item_is_attached (item, NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error) &&
+ x0 < x1 && y0 < y1);
+
+ if (success &&
+ gimp_item_mask_intersect (item, &x, &y, &width, &height))
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (item, &off_x, &off_y);
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_scale (&matrix,
+ x, y, width, height,
+ x0, y0, x1 - x0, y1 - y0);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Scaling"));
+
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ GimpDrawable *drawable;
+
+ drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+ context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+
+ if (drawable)
+ item = GIMP_ITEM (drawable);
+ else
+ success = FALSE;
+ }
+ else if (gimp_item_get_linked (item))
+ {
+ gimp_item_linked_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+ }
+ else
+ {
+ gimp_item_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
+ progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_item (gimp_value_array_index (return_vals, 1), item);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_transform_shear_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gint32 shear_type;
+ gdouble magnitude;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ shear_type = g_value_get_enum (gimp_value_array_index (args, 1));
+ magnitude = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (item, NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (item, &x, &y, &width, &height))
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (item, &off_x, &off_y);
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_shear (&matrix,
+ x, y, width, height,
+ shear_type, magnitude);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Shearing"));
+
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ GimpDrawable *drawable;
+
+ drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+ context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+
+ if (drawable)
+ item = GIMP_ITEM (drawable);
+ else
+ success = FALSE;
+ }
+ else if (gimp_item_get_linked (item))
+ {
+ gimp_item_linked_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+ }
+ else
+ {
+ gimp_item_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
+ progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_item (gimp_value_array_index (return_vals, 1), item);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_transform_2d_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ gdouble source_x;
+ gdouble source_y;
+ gdouble scale_x;
+ gdouble scale_y;
+ gdouble angle;
+ gdouble dest_x;
+ gdouble dest_y;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ source_x = g_value_get_double (gimp_value_array_index (args, 1));
+ source_y = g_value_get_double (gimp_value_array_index (args, 2));
+ scale_x = g_value_get_double (gimp_value_array_index (args, 3));
+ scale_y = g_value_get_double (gimp_value_array_index (args, 4));
+ angle = g_value_get_double (gimp_value_array_index (args, 5));
+ dest_x = g_value_get_double (gimp_value_array_index (args, 6));
+ dest_y = g_value_get_double (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (item, NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (item, &x, &y, &width, &height))
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (item, &off_x, &off_y);
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_matrix3_translate (&matrix, -source_x, -source_y);
+ gimp_matrix3_scale (&matrix, scale_x, scale_y);
+ gimp_matrix3_rotate (&matrix, angle);
+ gimp_matrix3_translate (&matrix, dest_x, dest_y);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("2D Transform"));
+
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ GimpDrawable *drawable;
+
+ drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+ context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+
+ if (drawable)
+ item = GIMP_ITEM (drawable);
+ else
+ success = FALSE;
+ }
+ else if (gimp_item_get_linked (item))
+ {
+ gimp_item_linked_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+ }
+ else
+ {
+ gimp_item_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
+ progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_item (gimp_value_array_index (return_vals, 1), item);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+item_transform_matrix_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpItem *item;
+ 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;
+
+ item = gimp_value_get_item (gimp_value_array_index (args, 0), gimp);
+ coeff_0_0 = g_value_get_double (gimp_value_array_index (args, 1));
+ coeff_0_1 = g_value_get_double (gimp_value_array_index (args, 2));
+ coeff_0_2 = g_value_get_double (gimp_value_array_index (args, 3));
+ coeff_1_0 = g_value_get_double (gimp_value_array_index (args, 4));
+ coeff_1_1 = g_value_get_double (gimp_value_array_index (args, 5));
+ coeff_1_2 = g_value_get_double (gimp_value_array_index (args, 6));
+ coeff_2_0 = g_value_get_double (gimp_value_array_index (args, 7));
+ coeff_2_1 = g_value_get_double (gimp_value_array_index (args, 8));
+ coeff_2_2 = g_value_get_double (gimp_value_array_index (args, 9));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (item, NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (item, &x, &y, &width, &height))
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (item, &off_x, &off_y);
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ matrix.coeff[0][0] = coeff_0_0;
+ matrix.coeff[0][1] = coeff_0_1;
+ matrix.coeff[0][2] = coeff_0_2;
+ matrix.coeff[1][0] = coeff_1_0;
+ matrix.coeff[1][1] = coeff_1_1;
+ matrix.coeff[1][2] = coeff_1_2;
+ matrix.coeff[2][0] = coeff_2_0;
+ matrix.coeff[2][1] = coeff_2_1;
+ matrix.coeff[2][2] = coeff_2_2;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("2D Transforming"));
+
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ GimpDrawable *drawable;
+
+ drawable = gimp_drawable_transform_affine (GIMP_DRAWABLE (item),
+ context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+
+ if (drawable)
+ item = GIMP_ITEM (drawable);
+ else
+ success = FALSE;
+ }
+ else if (gimp_item_get_linked (item))
+ {
+ gimp_item_linked_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ pdb_context->transform_resize,
+ progress);
+ }
+ else
+ {
+ gimp_item_transform (item, context, &matrix,
+ pdb_context->transform_direction,
+ pdb_context->interpolation,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
+ progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_item (gimp_value_array_index (return_vals, 1), item);
+
+ return return_vals;
+}
+
+void
+register_item_transform_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-item-transform-translate
+ */
+ procedure = gimp_procedure_new (item_transform_translate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-transform-translate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-transform-translate",
+ "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.\n"
+ "\n"
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("off-x",
+ "off x",
+ "Offset in x direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("off-y",
+ "off y",
+ "Offset in y direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The translated item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-transform-flip-simple
+ */
+ procedure = gimp_procedure_new (item_transform_flip_simple_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-transform-flip-simple");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-transform-flip-simple",
+ "Flip the specified item either vertically or horizontally.",
+ "This procedure flips the specified item.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-transform-resize'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The affected item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("flip-type",
+ "flip type",
+ "Type of flip",
+ GIMP_TYPE_ORIENTATION_TYPE,
+ GIMP_ORIENTATION_HORIZONTAL,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
+ GIMP_ORIENTATION_UNKNOWN);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("auto-center",
+ "auto center",
+ "Whether to automatically position the axis in the selection center",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("axis",
+ "axis",
+ "coord. of flip axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The flipped item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-transform-flip
+ */
+ procedure = gimp_procedure_new (item_transform_flip_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-transform-flip");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-transform-flip",
+ "Flip the specified item around a given line.",
+ "This procedure flips the specified item.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-interpolation', 'gimp-context-set-transform-direction', 'gimp-context-set-transform-resize'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The affected item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "horz. coord. of one end of axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "vert. coord. of one end of axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "horz. coord. of other end of axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "vert. coord. of other end of axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The flipped item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-transform-perspective
+ */
+ procedure = gimp_procedure_new (item_transform_perspective_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-transform-perspective");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-transform-perspective",
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-interpolation', 'gimp-context-set-transform-direction', 'gimp-context-set-transform-resize'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The affected item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "The new x coordinate of upper-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "The new y coordinate of upper-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "The new x coordinate of upper-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "The new y coordinate of upper-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x2",
+ "x2",
+ "The new x coordinate of lower-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y2",
+ "y2",
+ "The new y coordinate of lower-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x3",
+ "x3",
+ "The new x coordinate of lower-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y3",
+ "y3",
+ "The new y coordinate of lower-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The transformed item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-transform-rotate-simple
+ */
+ procedure = gimp_procedure_new (item_transform_rotate_simple_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-transform-rotate-simple");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-transform-rotate-simple",
+ "Rotate the specified item about given coordinates through the specified angle.",
+ "This function rotates the specified item.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-transform-resize'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The affected item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("rotate-type",
+ "rotate type",
+ "Type of rotation",
+ GIMP_TYPE_ROTATION_TYPE,
+ GIMP_ROTATE_90,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("auto-center",
+ "auto center",
+ "Whether to automatically rotate around the selection center",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("center-x",
+ "center x",
+ "The hor. coordinate of the center of rotation",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("center-y",
+ "center y",
+ "The vert. coordinate of the center of rotation",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The rotated item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-transform-rotate
+ */
+ procedure = gimp_procedure_new (item_transform_rotate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-transform-rotate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-transform-rotate",
+ "Rotate the specified item about given coordinates through the specified angle.",
+ "This function rotates the specified item.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-interpolation', 'gimp-context-set-transform-direction', 'gimp-context-set-transform-resize'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The affected item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "The angle of rotation (radians)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("auto-center",
+ "auto center",
+ "Whether to automatically rotate around the selection center",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("center-x",
+ "center x",
+ "The hor. coordinate of the center of rotation",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("center-y",
+ "center y",
+ "The vert. coordinate of the center of rotation",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The rotated item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-transform-scale
+ */
+ procedure = gimp_procedure_new (item_transform_scale_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-transform-scale");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-transform-scale",
+ "Scale the specified item.",
+ "This procedure scales the specified item.\n"
+ "\n"
+ "The 2 coordinates specify the new locations of the top-left and bottom-roght corners of the original bounding box.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-interpolation', 'gimp-context-set-transform-direction', 'gimp-context-set-transform-resize'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The affected item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "The new x coordinate of the upper-left corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "The new y coordinate of the upper-left corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "The new x coordinate of the lower-right corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "The new y coordinate of the lower-right corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The scaled item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-transform-shear
+ */
+ procedure = gimp_procedure_new (item_transform_shear_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-transform-shear");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-transform-shear",
+ "Shear the specified item about its center by the specified magnitude.",
+ "This procedure shears the specified item.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-interpolation', 'gimp-context-set-transform-direction', 'gimp-context-set-transform-resize'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The affected item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("shear-type",
+ "shear type",
+ "Type of shear",
+ GIMP_TYPE_ORIENTATION_TYPE,
+ GIMP_ORIENTATION_HORIZONTAL,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
+ GIMP_ORIENTATION_UNKNOWN);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("magnitude",
+ "magnitude",
+ "The magnitude of the shear",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The sheared item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-transform-2d
+ */
+ procedure = gimp_procedure_new (item_transform_2d_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-transform-2d");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-transform-2d",
+ "Transform the specified item in 2d.",
+ "This procedure transforms the specified item.\n"
+ "\n"
+ "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).\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-interpolation', 'gimp-context-set-transform-direction', 'gimp-context-set-transform-resize'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The affected item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("source-x",
+ "source x",
+ "X coordinate of the transformation center",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("source-y",
+ "source y",
+ "Y coordinate of the transformation center",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("scale-x",
+ "scale x",
+ "Amount to scale in x direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("scale-y",
+ "scale y",
+ "Amount to scale in y direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "The angle of rotation (radians)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("dest-x",
+ "dest x",
+ "X coordinate of where the center goes",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("dest-y",
+ "dest y",
+ "Y coordinate of where the center goes",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The transformed item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-item-transform-matrix
+ */
+ procedure = gimp_procedure_new (item_transform_matrix_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-item-transform-matrix");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-item-transform-matrix",
+ "Transform the specified item in 2d.",
+ "This procedure transforms the specified item.\n"
+ "\n"
+ "The transformation is done by assembling a 3x3 matrix from the coefficients passed.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "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.\n"
+ "\n"
+ "This procedure is affected by the following context setters: 'gimp-context-set-interpolation', 'gimp-context-set-transform-direction', 'gimp-context-set-transform-resize'.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The affected item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-0-0",
+ "coeff 0 0",
+ "coefficient (0,0) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-0-1",
+ "coeff 0 1",
+ "coefficient (0,1) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-0-2",
+ "coeff 0 2",
+ "coefficient (0,2) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-1-0",
+ "coeff 1 0",
+ "coefficient (1,0) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-1-1",
+ "coeff 1 1",
+ "coefficient (1,1) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-1-2",
+ "coeff 1 2",
+ "coefficient (1,2) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-2-0",
+ "coeff 2 0",
+ "coefficient (2,0) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-2-1",
+ "coeff 2 1",
+ "coefficient (2,1) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("coeff-2-2",
+ "coeff 2 2",
+ "coefficient (2,2) of the transformation matrix",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_item_id ("item",
+ "item",
+ "The transformed item",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/layer-cmds.c b/app/pdb/layer-cmds.c
new file mode 100644
index 0000000..7292bd2
--- /dev/null
+++ b/app/pdb/layer-cmds.c
@@ -0,0 +1,2540 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <cairo.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpcolor/gimpcolor.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpgrouplayer.h"
+#include "core/gimpimage-color-profile.h"
+#include "core/gimpimage-undo.h"
+#include "core/gimpimage.h"
+#include "core/gimpitem-linked.h"
+#include "core/gimplayer-new.h"
+#include "core/gimplayer.h"
+#include "core/gimplayermask.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimppickable.h"
+#include "core/gimpprogress.h"
+#include "operations/layer-modes/gimp-layer-modes.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+layer_new_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 width;
+ gint32 height;
+ gint32 type;
+ const gchar *name;
+ gdouble opacity;
+ gint32 mode;
+ GimpLayer *layer = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ width = g_value_get_int (gimp_value_array_index (args, 1));
+ height = g_value_get_int (gimp_value_array_index (args, 2));
+ type = g_value_get_enum (gimp_value_array_index (args, 3));
+ name = g_value_get_string (gimp_value_array_index (args, 4));
+ opacity = g_value_get_double (gimp_value_array_index (args, 5));
+ mode = g_value_get_enum (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ GimpImageBaseType base_type = GIMP_RGB;
+ gboolean has_alpha = FALSE;
+ const Babl *format;
+
+ if (mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
+ mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
+
+ switch (type)
+ {
+ case GIMP_RGB_IMAGE:
+ base_type = GIMP_RGB;
+ has_alpha = FALSE;
+ break;
+
+ case GIMP_RGBA_IMAGE:
+ base_type = GIMP_RGB;
+ has_alpha = TRUE;
+ break;
+
+ case GIMP_GRAY_IMAGE:
+ base_type = GIMP_GRAY;
+ has_alpha = FALSE;
+ break;
+
+ case GIMP_GRAYA_IMAGE:
+ base_type = GIMP_GRAY;
+ has_alpha = TRUE;
+ break;
+
+ case GIMP_INDEXED_IMAGE:
+ base_type = GIMP_INDEXED;
+ has_alpha = FALSE;
+ break;
+
+ case GIMP_INDEXEDA_IMAGE:
+ base_type = GIMP_INDEXED;
+ has_alpha = TRUE;
+ break;
+ }
+
+ /* do not use gimp_image_get_layer_format() because it might
+ * be the floating selection of a channel or mask
+ */
+ format = gimp_image_get_format (image, base_type,
+ gimp_image_get_precision (image),
+ has_alpha);
+
+ layer = gimp_layer_new (image, width, height,
+ format, name, opacity / 100.0, mode);
+
+ if (! layer)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_new_from_visible_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpImage *dest_image;
+ const gchar *name;
+ GimpLayer *layer = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ dest_image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPickable *pickable = GIMP_PICKABLE (image);
+ GimpColorProfile *profile;
+
+ gimp_pickable_flush (pickable);
+
+ profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
+
+ layer = gimp_layer_new_from_gegl_buffer (gimp_pickable_get_buffer (pickable),
+ dest_image,
+ gimp_image_get_layer_format (dest_image,
+ TRUE),
+ name,
+ GIMP_OPACITY_OPAQUE,
+ gimp_image_get_default_new_layer_mode (dest_image),
+ profile);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_new_from_drawable_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ GimpImage *dest_image;
+ GimpLayer *layer_copy = NULL;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ dest_image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ GType new_type;
+ GimpItem *new_item;
+
+ if (GIMP_IS_LAYER (drawable))
+ new_type = G_TYPE_FROM_INSTANCE (drawable);
+ else
+ new_type = GIMP_TYPE_LAYER;
+
+ new_item = gimp_item_convert (GIMP_ITEM (drawable), dest_image, new_type);
+
+ if (new_item)
+ layer_copy = GIMP_LAYER (new_item);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer_copy);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_group_new_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpLayer *layer_group = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ layer_group = gimp_group_layer_new (image);
+
+ if (! layer_group)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer_group);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_copy_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gboolean add_alpha;
+ GimpLayer *layer_copy = NULL;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ add_alpha = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ layer_copy = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
+ G_TYPE_FROM_INSTANCE (layer)));
+ if (layer_copy)
+ {
+ if (add_alpha)
+ gimp_layer_add_alpha (layer_copy);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer_copy);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_add_alpha_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_modifiable (GIMP_ITEM (layer),
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (layer), error))
+ {
+ gimp_layer_add_alpha (layer);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_flatten_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_modifiable (GIMP_ITEM (layer),
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (layer), error))
+ {
+ gimp_layer_remove_alpha (layer, context);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_scale_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 new_width;
+ gint32 new_height;
+ gboolean local_origin;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ new_width = g_value_get_int (gimp_value_array_index (args, 1));
+ new_height = g_value_get_int (gimp_value_array_index (args, 2));
+ local_origin = g_value_get_boolean (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL,
+ GIMP_PDB_ITEM_CONTENT | GIMP_PDB_ITEM_POSITION,
+ error))
+ {
+ GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Scaling"));
+
+ gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
+ pdb_context->interpolation, progress,
+ local_origin);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_scale_full_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 new_width;
+ gint32 new_height;
+ gboolean local_origin;
+ gint32 interpolation;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ new_width = g_value_get_int (gimp_value_array_index (args, 1));
+ new_height = g_value_get_int (gimp_value_array_index (args, 2));
+ local_origin = g_value_get_boolean (gimp_value_array_index (args, 3));
+ interpolation = g_value_get_enum (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL,
+ GIMP_PDB_ITEM_CONTENT | GIMP_PDB_ITEM_POSITION,
+ error))
+ {
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Scaling"));
+
+ gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
+ interpolation, progress,
+ local_origin);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_resize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 new_width;
+ gint32 new_height;
+ gint32 offx;
+ gint32 offy;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ new_width = g_value_get_int (gimp_value_array_index (args, 1));
+ new_height = g_value_get_int (gimp_value_array_index (args, 2));
+ offx = g_value_get_int (gimp_value_array_index (args, 3));
+ offy = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL,
+ GIMP_PDB_ITEM_CONTENT | GIMP_PDB_ITEM_POSITION,
+ error))
+ gimp_item_resize (GIMP_ITEM (layer), context, GIMP_FILL_TRANSPARENT,
+ new_width, new_height, offx, offy);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_resize_to_image_size_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL,
+ GIMP_PDB_ITEM_CONTENT | GIMP_PDB_ITEM_POSITION,
+ error))
+ gimp_layer_resize_to_image (layer, context, GIMP_FILL_TRANSPARENT);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_translate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 offx;
+ gint32 offy;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ offx = g_value_get_int (gimp_value_array_index (args, 1));
+ offy = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_modifiable (GIMP_ITEM (layer),
+ GIMP_PDB_ITEM_POSITION, error))
+ {
+ if (gimp_item_get_linked (GIMP_ITEM (layer)))
+ {
+ gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
+ }
+ else
+ {
+ gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_set_offsets_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 offx;
+ gint32 offy;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ offx = g_value_get_int (gimp_value_array_index (args, 1));
+ offy = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_modifiable (GIMP_ITEM (layer),
+ GIMP_PDB_ITEM_POSITION, error))
+ {
+ gint offset_x;
+ gint offset_y;
+
+ gimp_item_get_offset (GIMP_ITEM (layer), &offset_x, &offset_y);
+ offx -= offset_x;
+ offy -= offset_y;
+
+ if (gimp_item_get_linked (GIMP_ITEM (layer)))
+ {
+ gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
+ }
+ else
+ {
+ gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_create_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gint32 mask_type;
+ GimpLayerMask *mask = NULL;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ mask_type = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpChannel *channel = NULL;
+
+ if (mask_type == GIMP_ADD_MASK_CHANNEL)
+ {
+ channel = gimp_image_get_active_channel (gimp_item_get_image (GIMP_ITEM (layer)));
+
+ if (! channel)
+ success = FALSE;
+ }
+
+ if (success)
+ {
+ mask = gimp_layer_create_mask (layer, mask_type, channel);
+
+ if (! mask)
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer_mask (gimp_value_array_index (return_vals, 1), mask);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_get_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ GimpLayerMask *mask = NULL;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ mask = gimp_layer_get_mask (layer);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer_mask (gimp_value_array_index (return_vals, 1), mask);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_from_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayerMask *mask;
+ GimpLayer *layer = NULL;
+
+ mask = gimp_value_get_layer_mask (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ layer = gimp_layer_mask_get_layer (mask);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_add_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ GimpLayerMask *mask;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ mask = gimp_value_get_layer_mask (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_floating (GIMP_ITEM (mask),
+ gimp_item_get_image (GIMP_ITEM (layer)),
+ error))
+ success = (gimp_layer_add_mask (layer, mask, TRUE, error) == mask);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_remove_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 mode;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ mode = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpPDBItemModify modify = 0;
+
+ if (mode == GIMP_MASK_APPLY)
+ modify |= GIMP_PDB_ITEM_CONTENT;
+
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, modify, error) &&
+ gimp_layer_get_mask (layer) &&
+ (mode == GIMP_MASK_DISCARD ||
+ gimp_pdb_item_is_not_group (GIMP_ITEM (layer), error)))
+ gimp_layer_apply_mask (layer, mode, TRUE);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_is_floating_sel_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gboolean is_floating_sel = FALSE;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ is_floating_sel = gimp_layer_is_floating_sel (layer);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), is_floating_sel);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_get_lock_alpha_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gboolean lock_alpha = FALSE;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ lock_alpha = gimp_layer_get_lock_alpha (layer);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), lock_alpha);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_set_lock_alpha_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gboolean lock_alpha;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ lock_alpha = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_layer_can_lock_alpha (layer))
+ gimp_layer_set_lock_alpha (layer, lock_alpha, TRUE);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_get_apply_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gboolean apply_mask = FALSE;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (layer->mask)
+ apply_mask = gimp_layer_get_apply_mask (layer);
+ else
+ apply_mask = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), apply_mask);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_set_apply_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gboolean apply_mask;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ apply_mask = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (layer->mask)
+ gimp_layer_set_apply_mask (layer, apply_mask, TRUE);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_get_show_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gboolean show_mask = FALSE;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (layer->mask)
+ show_mask = gimp_layer_get_show_mask (layer);
+ else
+ show_mask = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), show_mask);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_set_show_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gboolean show_mask;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ show_mask = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (layer->mask)
+ gimp_layer_set_show_mask (layer, show_mask, TRUE);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_get_edit_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gboolean edit_mask = FALSE;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (layer->mask)
+ edit_mask = gimp_layer_get_edit_mask (layer);
+ else
+ edit_mask = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), edit_mask);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_set_edit_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gboolean edit_mask;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ edit_mask = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (layer->mask)
+ gimp_layer_set_edit_mask (layer, edit_mask);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_get_opacity_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gdouble opacity = 0.0;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ opacity = gimp_layer_get_opacity (layer) * 100.0;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), opacity);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_set_opacity_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gdouble opacity;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ opacity = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_layer_set_opacity (layer, opacity / 100.0, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_get_mode_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gint32 mode = 0;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ mode = gimp_layer_get_mode (layer);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), mode);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_set_mode_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 mode;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ mode = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
+ mode = GIMP_LAYER_MODE_SOFTLIGHT_LEGACY;
+
+ if (gimp_viewable_get_children (GIMP_VIEWABLE (layer)) == NULL)
+ {
+ if (! (gimp_layer_mode_get_context (mode) & GIMP_LAYER_MODE_CONTEXT_LAYER))
+ success = FALSE;
+ }
+ else
+ {
+ if (! (gimp_layer_mode_get_context (mode) & GIMP_LAYER_MODE_CONTEXT_GROUP))
+ success = FALSE;
+ }
+
+ if (success)
+ gimp_layer_set_mode (layer, mode, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_get_blend_space_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gint32 blend_space = 0;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ blend_space = gimp_layer_get_blend_space (layer);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), blend_space);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_set_blend_space_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 blend_space;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ blend_space = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_layer_set_blend_space (layer, blend_space, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_get_composite_space_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gint32 composite_space = 0;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ composite_space = gimp_layer_get_composite_space (layer);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), composite_space);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_set_composite_space_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 composite_space;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ composite_space = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_layer_set_composite_space (layer, composite_space, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+layer_get_composite_mode_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gint32 composite_mode = 0;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ composite_mode = gimp_layer_get_composite_mode (layer);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), composite_mode);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+layer_set_composite_mode_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 composite_mode;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ composite_mode = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_layer_set_composite_mode (layer, composite_mode, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_layer_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-layer-new
+ */
+ procedure = gimp_procedure_new (layer_new_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-new");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-new",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image to which to add the layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The layer width",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The layer height",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("type",
+ "type",
+ "The layer type",
+ GIMP_TYPE_IMAGE_TYPE,
+ GIMP_RGB_IMAGE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The layer name",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The layer opacity",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("mode",
+ "mode",
+ "The layer combination mode",
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The newly created layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-new-from-visible
+ */
+ procedure = gimp_procedure_new (layer_new_from_visible_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-new-from-visible");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-new-from-visible",
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The source image from where the content is copied",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("dest-image",
+ "dest image",
+ "The destination image to which to add the layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The layer name",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The newly created layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-new-from-drawable
+ */
+ procedure = gimp_procedure_new (layer_new_from_drawable_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-new-from-drawable");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-new-from-drawable",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The source drawable from where the new layer is copied",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("dest-image",
+ "dest image",
+ "The destination image to which to add the layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer-copy",
+ "layer copy",
+ "The newly copied layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-group-new
+ */
+ procedure = gimp_procedure_new (layer_group_new_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-group-new");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-group-new",
+ "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.\n"
+ "Other procedures useful with layer groups: 'gimp-image-reorder-item', 'gimp-item-get-parent', 'gimp-item-get-children', 'gimp-item-is-group'.",
+ "Barak Itkin <lightningismyname@gmail.com>",
+ "Barak Itkin",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image to which to add the layer group",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer-group",
+ "layer group",
+ "The newly created layer group",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-copy
+ */
+ procedure = gimp_procedure_new (layer_copy_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-copy");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-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. 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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer to copy",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("add-alpha",
+ "add alpha",
+ "Add an alpha channel to the copied layer",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer-copy",
+ "layer copy",
+ "The newly copied layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-add-alpha
+ */
+ procedure = gimp_procedure_new (layer_add_alpha_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-add-alpha");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-add-alpha",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-flatten
+ */
+ procedure = gimp_procedure_new (layer_flatten_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-flatten");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-flatten",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2007",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-scale
+ */
+ procedure = gimp_procedure_new (layer_scale_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-scale");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-scale",
+ "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'.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-width",
+ "new width",
+ "New layer width",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-height",
+ "new height",
+ "New layer height",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("local-origin",
+ "local origin",
+ "Use a local origin (as opposed to the image origin)",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-scale-full
+ */
+ procedure = gimp_procedure_new (layer_scale_full_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-scale-full");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-scale-full",
+ "Deprecated: Use 'gimp-layer-scale' instead.",
+ "Deprecated: Use 'gimp-layer-scale' instead.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2008",
+ "gimp-layer-scale");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-width",
+ "new width",
+ "New layer width",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-height",
+ "new height",
+ "New layer height",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("local-origin",
+ "local origin",
+ "Use a local origin (as opposed to the image origin)",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "Type of interpolation",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-resize
+ */
+ procedure = gimp_procedure_new (layer_resize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-resize");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-resize",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-width",
+ "new width",
+ "New layer width",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-height",
+ "new height",
+ "New layer height",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offx",
+ "offx",
+ "x offset between upper left corner of old and new layers: (old - new)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offy",
+ "offy",
+ "y offset between upper left corner of old and new layers: (old - new)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-resize-to-image-size
+ */
+ procedure = gimp_procedure_new (layer_resize_to_image_size_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-resize-to-image-size");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-resize-to-image-size",
+ "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.",
+ "Manish Singh",
+ "Manish Singh",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer to resize",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-translate
+ */
+ procedure = gimp_procedure_new (layer_translate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-translate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-translate",
+ "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.\n"
+ "\n"
+ "Deprecated: Use 'gimp-item-transform-translate' instead.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ "gimp-item-transform-translate");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offx",
+ "offx",
+ "Offset in x direction",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offy",
+ "offy",
+ "Offset in y direction",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-set-offsets
+ */
+ procedure = gimp_procedure_new (layer_set_offsets_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-set-offsets");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-set-offsets",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offx",
+ "offx",
+ "Offset in x direction",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offy",
+ "offy",
+ "Offset in y direction",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-create-mask
+ */
+ procedure = gimp_procedure_new (layer_create_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-create-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-create-mask",
+ "Create a layer mask for the specified layer.",
+ "This procedure creates a layer mask for the specified layer.\n"
+ "Layer masks serve as an additional alpha channel for a layer. Different types of masks are allowed for initialisation:\n"
+ "- white mask (leaves the layer fully visible);\n"
+ "- black mask (gives the layer complete transparency);\n"
+ "- 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);\n"
+ "- the current selection;\n"
+ "- a grayscale copy of the layer;\n"
+ "- or a copy of the active channel.\n"
+ "\n"
+ "The layer mask still needs to be added to the layer. This can be done with a call to 'gimp-layer-add-mask'.\n"
+ "\n"
+ "'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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer to which to add the mask",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("mask-type",
+ "mask type",
+ "The type of mask",
+ GIMP_TYPE_ADD_MASK_TYPE,
+ GIMP_ADD_MASK_WHITE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_mask_id ("mask",
+ "mask",
+ "The newly created mask",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-get-mask
+ */
+ procedure = gimp_procedure_new (layer_get_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-get-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-get-mask",
+ "Get the specified layer's mask if it exists.",
+ "This procedure returns the specified layer's mask, or -1 if none exists.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_mask_id ("mask",
+ "mask",
+ "The layer mask",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-from-mask
+ */
+ procedure = gimp_procedure_new (layer_from_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-from-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-from-mask",
+ "Get the specified mask's layer.",
+ "This procedure returns the specified mask's layer , or -1 if none exists.",
+ "Geert Jordaens",
+ "Geert Jordaens",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_mask_id ("mask",
+ "mask",
+ "Mask for which to return the layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The mask's layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-add-mask
+ */
+ procedure = gimp_procedure_new (layer_add_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-add-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-add-mask",
+ "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'.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer to receive the mask",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_mask_id ("mask",
+ "mask",
+ "The mask to add to the layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-remove-mask
+ */
+ procedure = gimp_procedure_new (layer_remove_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-remove-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-remove-mask",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer from which to remove mask",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("mode",
+ "mode",
+ "Removal mode",
+ GIMP_TYPE_MASK_APPLY_MODE,
+ GIMP_MASK_APPLY,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-is-floating-sel
+ */
+ procedure = gimp_procedure_new (layer_is_floating_sel_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-is-floating-sel");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-is-floating-sel",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("is-floating-sel",
+ "is floating sel",
+ "TRUE if the layer is a floating selection",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-get-lock-alpha
+ */
+ procedure = gimp_procedure_new (layer_get_lock_alpha_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-get-lock-alpha");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-get-lock-alpha",
+ "Get the lock alpha channel setting of the specified layer.",
+ "This procedure returns the specified layer's lock alpha channel setting.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("lock-alpha",
+ "lock alpha",
+ "The layer's lock alpha channel setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-set-lock-alpha
+ */
+ procedure = gimp_procedure_new (layer_set_lock_alpha_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-set-lock-alpha");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-set-lock-alpha",
+ "Set the lock alpha channel setting of the specified layer.",
+ "This procedure sets the specified layer's lock alpha channel setting.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("lock-alpha",
+ "lock alpha",
+ "The new layer's lock alpha channel setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-get-apply-mask
+ */
+ procedure = gimp_procedure_new (layer_get_apply_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-get-apply-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-get-apply-mask",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("apply-mask",
+ "apply mask",
+ "The layer's apply mask setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-set-apply-mask
+ */
+ procedure = gimp_procedure_new (layer_set_apply_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-set-apply-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-set-apply-mask",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("apply-mask",
+ "apply mask",
+ "The new layer's apply mask setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-get-show-mask
+ */
+ procedure = gimp_procedure_new (layer_get_show_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-get-show-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-get-show-mask",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("show-mask",
+ "show mask",
+ "The layer's show mask setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-set-show-mask
+ */
+ procedure = gimp_procedure_new (layer_set_show_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-set-show-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-set-show-mask",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("show-mask",
+ "show mask",
+ "The new layer's show mask setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-get-edit-mask
+ */
+ procedure = gimp_procedure_new (layer_get_edit_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-get-edit-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-get-edit-mask",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("edit-mask",
+ "edit mask",
+ "The layer's edit mask setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-set-edit-mask
+ */
+ procedure = gimp_procedure_new (layer_set_edit_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-set-edit-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-set-edit-mask",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("edit-mask",
+ "edit mask",
+ "The new layer's edit mask setting",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-get-opacity
+ */
+ procedure = gimp_procedure_new (layer_get_opacity_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-get-opacity");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-get-opacity",
+ "Get the opacity of the specified layer.",
+ "This procedure returns the specified layer's opacity.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The layer opacity",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-set-opacity
+ */
+ procedure = gimp_procedure_new (layer_set_opacity_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-set-opacity");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-set-opacity",
+ "Set the opacity of the specified layer.",
+ "This procedure sets the specified layer's opacity.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("opacity",
+ "opacity",
+ "The new layer opacity",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-get-mode
+ */
+ procedure = gimp_procedure_new (layer_get_mode_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-get-mode");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-get-mode",
+ "Get the combination mode of the specified layer.",
+ "This procedure returns the specified layer's combination mode.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("mode",
+ "mode",
+ "The layer combination mode",
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-set-mode
+ */
+ procedure = gimp_procedure_new (layer_set_mode_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-set-mode");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-set-mode",
+ "Set the combination mode of the specified layer.",
+ "This procedure sets the specified layer's combination mode.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("mode",
+ "mode",
+ "The new layer combination mode",
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-get-blend-space
+ */
+ procedure = gimp_procedure_new (layer_get_blend_space_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-get-blend-space");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-get-blend-space",
+ "Get the blend space of the specified layer.",
+ "This procedure returns the specified layer's blend space.",
+ "Ell",
+ "Ell",
+ "2017",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("blend-space",
+ "blend space",
+ "The layer blend space",
+ GIMP_TYPE_LAYER_COLOR_SPACE,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-set-blend-space
+ */
+ procedure = gimp_procedure_new (layer_set_blend_space_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-set-blend-space");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-set-blend-space",
+ "Set the blend space of the specified layer.",
+ "This procedure sets the specified layer's blend space.",
+ "Ell",
+ "Ell",
+ "2017",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("blend-space",
+ "blend space",
+ "The new layer blend space",
+ GIMP_TYPE_LAYER_COLOR_SPACE,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-get-composite-space
+ */
+ procedure = gimp_procedure_new (layer_get_composite_space_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-get-composite-space");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-get-composite-space",
+ "Get the composite space of the specified layer.",
+ "This procedure returns the specified layer's composite space.",
+ "Ell",
+ "Ell",
+ "2017",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("composite-space",
+ "composite space",
+ "The layer composite space",
+ GIMP_TYPE_LAYER_COLOR_SPACE,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-set-composite-space
+ */
+ procedure = gimp_procedure_new (layer_set_composite_space_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-set-composite-space");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-set-composite-space",
+ "Set the composite space of the specified layer.",
+ "This procedure sets the specified layer's composite space.",
+ "Ell",
+ "Ell",
+ "2017",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("composite-space",
+ "composite space",
+ "The new layer composite space",
+ GIMP_TYPE_LAYER_COLOR_SPACE,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-get-composite-mode
+ */
+ procedure = gimp_procedure_new (layer_get_composite_mode_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-get-composite-mode");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-get-composite-mode",
+ "Get the composite mode of the specified layer.",
+ "This procedure returns the specified layer's composite mode.",
+ "Ell",
+ "Ell",
+ "2017",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("composite-mode",
+ "composite mode",
+ "The layer composite mode",
+ GIMP_TYPE_LAYER_COMPOSITE_MODE,
+ GIMP_LAYER_COMPOSITE_AUTO,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-layer-set-composite-mode
+ */
+ procedure = gimp_procedure_new (layer_set_composite_mode_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-set-composite-mode");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-set-composite-mode",
+ "Set the composite mode of the specified layer.",
+ "This procedure sets the specified layer's composite mode.",
+ "Ell",
+ "Ell",
+ "2017",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("composite-mode",
+ "composite mode",
+ "The new layer composite mode",
+ GIMP_TYPE_LAYER_COMPOSITE_MODE,
+ GIMP_LAYER_COMPOSITE_AUTO,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/message-cmds.c b/app/pdb/message-cmds.c
new file mode 100644
index 0000000..63e07cf
--- /dev/null
+++ b/app/pdb/message-cmds.c
@@ -0,0 +1,188 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpparamspecs.h"
+#include "plug-in/gimpplugin.h"
+#include "plug-in/gimppluginmanager.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+message_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *message;
+
+ message = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ const gchar *domain = NULL;
+
+ if (gimp->plug_in_manager->current_plug_in)
+ domain = gimp_plug_in_get_undo_desc (gimp->plug_in_manager->current_plug_in);
+ gimp_show_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_WARNING,
+ domain, message);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+message_get_handler_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 handler = 0;
+
+ handler = gimp->message_handler;
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), handler);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+message_set_handler_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 handler;
+
+ handler = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ gimp->message_handler = handler;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_message_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-message
+ */
+ procedure = gimp_procedure_new (message_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-message");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-message",
+ "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.",
+ "Manish Singh",
+ "Manish Singh",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("message",
+ "message",
+ "Message to display in the dialog",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-message-get-handler
+ */
+ procedure = gimp_procedure_new (message_get_handler_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-message-get-handler");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Manish Singh",
+ "Manish Singh",
+ "1998",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("handler",
+ "handler",
+ "The current handler type",
+ GIMP_TYPE_MESSAGE_HANDLER_TYPE,
+ GIMP_MESSAGE_BOX,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-message-set-handler
+ */
+ procedure = gimp_procedure_new (message_set_handler_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-message-set-handler");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-message-set-handler",
+ "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.",
+ "Manish Singh",
+ "Manish Singh",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("handler",
+ "handler",
+ "The new handler type",
+ GIMP_TYPE_MESSAGE_HANDLER_TYPE,
+ GIMP_MESSAGE_BOX,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/paint-tools-cmds.c b/app/pdb/paint-tools-cmds.c
new file mode 100644
index 0000000..b4a0b0f
--- /dev/null
+++ b/app/pdb/paint-tools-cmds.c
@@ -0,0 +1,1645 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpconfig/gimpconfig.h"
+#include "libgimpmath/gimpmath.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpdrawable.h"
+#include "core/gimpdynamics.h"
+#include "core/gimppaintinfo.h"
+#include "core/gimpparamspecs.h"
+#include "paint/gimppaintcore-stroke.h"
+#include "paint/gimppaintcore.h"
+#include "paint/gimppaintoptions.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static const GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES;
+
+static gboolean
+paint_tools_stroke (Gimp *gimp,
+ GimpContext *context,
+ GimpPaintOptions *options,
+ GimpDrawable *drawable,
+ gint n_strokes,
+ const gdouble *strokes,
+ GError **error,
+ const gchar *first_property_name,
+ ...)
+{
+ GimpPaintCore *core;
+ GimpCoords *coords;
+ gboolean retval;
+ gint i;
+ va_list args;
+
+ n_strokes /= 2; /* #doubles -> #points */
+
+ /* undefine the paint-relevant context properties and get them
+ * from the current context
+ */
+ gimp_context_define_properties (GIMP_CONTEXT (options),
+ GIMP_CONTEXT_PROP_MASK_PAINT,
+ FALSE);
+ gimp_context_set_parent (GIMP_CONTEXT (options), context);
+
+ va_start (args, first_property_name);
+ core = GIMP_PAINT_CORE (g_object_new_valist (options->paint_info->paint_type,
+ first_property_name, args));
+ va_end (args);
+
+ coords = g_new (GimpCoords, n_strokes);
+
+ for (i = 0; i < n_strokes; i++)
+ {
+ coords[i] = default_coords;
+ coords[i].x = strokes[2 * i];
+ coords[i].y = strokes[2 * i + 1];
+ }
+
+ retval = gimp_paint_core_stroke (core, drawable, options,
+ coords, n_strokes, TRUE,
+ error);
+
+ g_free (coords);
+
+ g_object_unref (core);
+ g_object_unref (options);
+
+ return retval;
+}
+
+static GimpValueArray *
+airbrush_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble pressure;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ pressure = g_value_get_double (gimp_value_array_index (args, 1));
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 2));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-airbrush");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ g_object_set (options,
+ "pressure", pressure,
+ NULL);
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+airbrush_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 1));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-airbrush");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+clone_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ GimpDrawable *src_drawable;
+ gint32 clone_type;
+ gdouble src_x;
+ gdouble src_y;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ src_drawable = gimp_value_get_drawable (gimp_value_array_index (args, 1), gimp);
+ clone_type = g_value_get_enum (gimp_value_array_index (args, 2));
+ src_x = g_value_get_double (gimp_value_array_index (args, 3));
+ src_y = g_value_get_double (gimp_value_array_index (args, 4));
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 5));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-clone");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ g_object_set (options,
+ "clone-type", clone_type,
+ NULL);
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ "src-drawable", src_drawable,
+ "src-x", (gint) floor (src_x),
+ "src-y", (gint) floor (src_y),
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+clone_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 1));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-clone");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+convolve_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble pressure;
+ gint32 convolve_type;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ pressure = g_value_get_double (gimp_value_array_index (args, 1));
+ convolve_type = g_value_get_enum (gimp_value_array_index (args, 2));
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 3));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-convolve");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ g_object_set (options,
+ "type", convolve_type,
+ "rate", pressure,
+ NULL);
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+convolve_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 1));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-convolve");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+dodgeburn_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble exposure;
+ gint32 dodgeburn_type;
+ gint32 dodgeburn_mode;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ exposure = g_value_get_double (gimp_value_array_index (args, 1));
+ dodgeburn_type = g_value_get_enum (gimp_value_array_index (args, 2));
+ dodgeburn_mode = g_value_get_enum (gimp_value_array_index (args, 3));
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 4));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-dodge-burn");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ g_object_set (options,
+ "type", dodgeburn_type,
+ "mode", dodgeburn_mode,
+ "exposure", exposure,
+ NULL);
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+dodgeburn_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 1));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-dodge-burn");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+eraser_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 num_strokes;
+ const gdouble *strokes;
+ gint32 hardness;
+ gint32 method;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 1));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 2));
+ hardness = g_value_get_enum (gimp_value_array_index (args, 3));
+ method = g_value_get_enum (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-eraser");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ g_object_set (options,
+ "application-mode", method,
+ "hard", hardness,
+ NULL);
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+eraser_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 1));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-eraser");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+heal_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ GimpDrawable *src_drawable;
+ gdouble src_x;
+ gdouble src_y;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ src_drawable = gimp_value_get_drawable (gimp_value_array_index (args, 1), gimp);
+ src_x = g_value_get_double (gimp_value_array_index (args, 2));
+ src_y = g_value_get_double (gimp_value_array_index (args, 3));
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 4));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-heal");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ "src-drawable", src_drawable,
+ "src-x", (gint) floor (src_x),
+ "src-y", (gint) floor (src_y),
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+heal_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 1));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-heal");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+paintbrush_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble fade_out;
+ gint32 num_strokes;
+ const gdouble *strokes;
+ gint32 method;
+ gdouble gradient_length;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ fade_out = g_value_get_double (gimp_value_array_index (args, 1));
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 2));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 3));
+ method = g_value_get_enum (gimp_value_array_index (args, 4));
+ gradient_length = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-paintbrush");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpDynamics *pdb_dynamics = GIMP_DYNAMICS (gimp_dynamics_new (context, "pdb"));
+ GimpDynamics *user_dynamics = gimp_context_get_dynamics (context);
+
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ g_object_set (options,
+ "application-mode", method,
+ "fade-length", MAX (fade_out, gradient_length),
+ NULL);
+
+ if (fade_out > 0)
+ {
+ GimpDynamicsOutput *opacity_output =
+ gimp_dynamics_get_output (pdb_dynamics,
+ GIMP_DYNAMICS_OUTPUT_OPACITY);
+
+ g_object_set (opacity_output,
+ "use-fade", TRUE,
+ NULL);
+ }
+
+ if (gradient_length > 0)
+ {
+ GimpDynamicsOutput *color_output =
+ gimp_dynamics_get_output (pdb_dynamics,
+ GIMP_DYNAMICS_OUTPUT_COLOR);
+
+ g_object_set (color_output,
+ "use-fade", TRUE,
+ NULL);
+ }
+
+ gimp_context_set_dynamics (context, pdb_dynamics);
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+
+ gimp_context_set_dynamics (context, user_dynamics);
+
+ g_object_unref (pdb_dynamics);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+paintbrush_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 1));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-paintbrush");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+pencil_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 1));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-pencil");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+smudge_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble pressure;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ pressure = g_value_get_double (gimp_value_array_index (args, 1));
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 2));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-smudge");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ g_object_set (options,
+ "rate", pressure,
+ NULL);
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+smudge_default_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 num_strokes;
+ const gdouble *strokes;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ num_strokes = g_value_get_int (gimp_value_array_index (args, 1));
+ strokes = gimp_value_get_floatarray (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPaintOptions *options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+ "gimp-smudge");
+
+ if (options &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ options = gimp_config_duplicate (GIMP_CONFIG (options));
+
+ success = paint_tools_stroke (gimp, context, options, drawable,
+ num_strokes, strokes, error,
+ "undo-desc", options->paint_info->blurb,
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_paint_tools_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-airbrush
+ */
+ procedure = gimp_procedure_new (airbrush_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-airbrush");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-airbrush",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("pressure",
+ "pressure",
+ "The pressure of the airbrush strokes",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-airbrush-default
+ */
+ procedure = gimp_procedure_new (airbrush_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-airbrush-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-airbrush-default",
+ "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.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-clone
+ */
+ procedure = gimp_procedure_new (clone_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-clone");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-clone",
+ "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->Indexed--although converting from any type to indexed is significantly slower.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("src-drawable",
+ "src drawable",
+ "The source drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("clone-type",
+ "clone type",
+ "The type of clone",
+ GIMP_TYPE_CLONE_TYPE,
+ GIMP_CLONE_IMAGE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("src-x",
+ "src x",
+ "The x coordinate in the source image",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("src-y",
+ "src y",
+ "The y coordinate in the source image",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-clone-default
+ */
+ procedure = gimp_procedure_new (clone_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-clone-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-clone-default",
+ "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.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-convolve
+ */
+ procedure = gimp_procedure_new (convolve_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-convolve");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-convolve",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("pressure",
+ "pressure",
+ "The pressure",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("convolve-type",
+ "convolve type",
+ "Convolve type",
+ GIMP_TYPE_CONVOLVE_TYPE,
+ GIMP_CONVOLVE_BLUR,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-convolve-default
+ */
+ procedure = gimp_procedure_new (convolve_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-convolve-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-convolve-default",
+ "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.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-dodgeburn
+ */
+ procedure = gimp_procedure_new (dodgeburn_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-dodgeburn");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-dodgeburn",
+ "Dodgeburn image with varying exposure.",
+ "Dodgeburn. More details here later.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("exposure",
+ "exposure",
+ "The exposure of the strokes",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("dodgeburn-type",
+ "dodgeburn type",
+ "The type either dodge or burn",
+ GIMP_TYPE_DODGE_BURN_TYPE,
+ GIMP_DODGE_BURN_TYPE_DODGE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("dodgeburn-mode",
+ "dodgeburn mode",
+ "The mode",
+ GIMP_TYPE_TRANSFER_MODE,
+ GIMP_TRANSFER_SHADOWS,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-dodgeburn-default
+ */
+ procedure = gimp_procedure_new (dodgeburn_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-dodgeburn-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-dodgeburn-default",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-eraser
+ */
+ procedure = gimp_procedure_new (eraser_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-eraser");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-eraser",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("hardness",
+ "hardness",
+ "How to apply the brush",
+ GIMP_TYPE_BRUSH_APPLICATION_MODE,
+ GIMP_BRUSH_HARD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("method",
+ "method",
+ "The paint method to use",
+ GIMP_TYPE_PAINT_APPLICATION_MODE,
+ GIMP_PAINT_CONSTANT,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-eraser-default
+ */
+ procedure = gimp_procedure_new (eraser_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-eraser-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-eraser-default",
+ "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.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-heal
+ */
+ procedure = gimp_procedure_new (heal_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-heal");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-heal",
+ "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->Indexed.",
+ "Kevin Sookocheff",
+ "Kevin Sookocheff",
+ "2006",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("src-drawable",
+ "src drawable",
+ "The source drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("src-x",
+ "src x",
+ "The x coordinate in the source image",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("src-y",
+ "src y",
+ "The y coordinate in the source image",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-heal-default
+ */
+ procedure = gimp_procedure_new (heal_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-heal-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-heal-default",
+ "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.",
+ "Kevin Sookocheff",
+ "Kevin Sookocheff",
+ "2006",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-paintbrush
+ */
+ procedure = gimp_procedure_new (paintbrush_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-paintbrush");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-paintbrush",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("fade-out",
+ "fade out",
+ "Fade out parameter",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("method",
+ "method",
+ "The paint method to use",
+ GIMP_TYPE_PAINT_APPLICATION_MODE,
+ GIMP_PAINT_CONSTANT,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("gradient-length",
+ "gradient length",
+ "Length of gradient to draw",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-paintbrush-default
+ */
+ procedure = gimp_procedure_new (paintbrush_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-paintbrush-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-paintbrush-default",
+ "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.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-pencil
+ */
+ procedure = gimp_procedure_new (pencil_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-pencil");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-pencil",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-smudge
+ */
+ procedure = gimp_procedure_new (smudge_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-smudge");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-smudge",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("pressure",
+ "pressure",
+ "The pressure of the smudge strokes",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-smudge-default
+ */
+ procedure = gimp_procedure_new (smudge_default_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-smudge-default");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-smudge-default",
+ "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.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "Number of stroke control points (count each coordinate as 2 points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("strokes",
+ "strokes",
+ "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/palette-cmds.c b/app/pdb/palette-cmds.c
new file mode 100644
index 0000000..df78136
--- /dev/null
+++ b/app/pdb/palette-cmds.c
@@ -0,0 +1,1107 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <cairo.h>
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpcolor/gimpcolor.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontext.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimppalette.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+palette_new_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gchar *actual_name = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpData *data = gimp_data_factory_data_new (gimp->palette_factory,
+ context, name);
+
+ if (data)
+ actual_name = g_strdup (gimp_object_get_name (data));
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), actual_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+palette_duplicate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gchar *copy_name = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (palette)
+ {
+ GimpPalette *palette_copy = (GimpPalette *)
+ gimp_data_factory_data_duplicate (gimp->palette_factory,
+ GIMP_DATA (palette));
+
+ if (palette_copy)
+ copy_name = g_strdup (gimp_object_get_name (palette_copy));
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), copy_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+palette_rename_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ const gchar *new_name;
+ gchar *actual_name = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ new_name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_RENAME, error);
+
+ if (palette)
+ {
+ gimp_object_set_name (GIMP_OBJECT (palette), new_name);
+ actual_name = g_strdup (gimp_object_get_name (palette));
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), actual_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+palette_delete_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (palette && gimp_data_is_deletable (GIMP_DATA (palette)))
+ success = gimp_data_factory_data_delete (gimp->palette_factory,
+ GIMP_DATA (palette),
+ TRUE, error);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+palette_is_editable_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gboolean editable = FALSE;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (palette)
+ editable = gimp_data_is_writable (GIMP_DATA (palette));
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), editable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+palette_get_info_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 num_colors = 0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (palette)
+ num_colors = gimp_palette_get_n_colors (palette);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_colors);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+palette_get_colors_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 num_colors = 0;
+ GimpRGB *colors = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (palette)
+ {
+ GList *list = gimp_palette_get_colors (palette);
+ gint i;
+
+ num_colors = gimp_palette_get_n_colors (palette);
+ colors = g_new (GimpRGB, num_colors);
+
+ for (i = 0; i < num_colors; i++, list = g_list_next (list))
+ {
+ GimpPaletteEntry *entry = list->data;
+
+ colors[i] = entry->color;
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_colors);
+ gimp_value_take_colorarray (gimp_value_array_index (return_vals, 2), colors, num_colors);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+palette_get_columns_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 num_columns = 0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (palette)
+ num_columns = gimp_palette_get_columns (palette);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_columns);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+palette_set_columns_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 columns;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ columns = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
+
+ if (palette)
+ gimp_palette_set_columns (palette, columns);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+palette_add_entry_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ const gchar *entry_name;
+ GimpRGB color;
+ gint32 entry_num = 0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ entry_name = g_value_get_string (gimp_value_array_index (args, 1));
+ gimp_value_get_rgb (gimp_value_array_index (args, 2), &color);
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
+
+ if (palette)
+ {
+ GimpPaletteEntry *entry =
+ gimp_palette_add_entry (palette, -1, entry_name, &color);
+
+ entry_num = entry->position;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), entry_num);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+palette_delete_entry_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 entry_num;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ entry_num = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
+
+ if (palette)
+ {
+ GimpPaletteEntry *entry = gimp_palette_get_entry (palette, entry_num);
+
+ if (entry)
+ gimp_palette_delete_entry (palette, entry);
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+palette_entry_get_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 entry_num;
+ GimpRGB color = { 0.0, 0.0, 0.0, 1.0 };
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ entry_num = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (palette)
+ {
+ GimpPaletteEntry *entry = gimp_palette_get_entry (palette, entry_num);
+
+ if (entry)
+ color = entry->color;
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &color);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+palette_entry_set_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 entry_num;
+ GimpRGB color;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ entry_num = g_value_get_int (gimp_value_array_index (args, 1));
+ gimp_value_get_rgb (gimp_value_array_index (args, 2), &color);
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
+
+ if (palette)
+ success = gimp_palette_set_entry_color (palette, entry_num, &color);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+palette_entry_get_name_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 entry_num;
+ gchar *entry_name = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ entry_num = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
+
+ if (palette)
+ {
+ GimpPaletteEntry *entry = gimp_palette_get_entry (palette, entry_num);
+
+ if (entry)
+ entry_name = g_strdup (entry->name);
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), entry_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+palette_entry_set_name_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+ gint32 entry_num;
+ const gchar *entry_name;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ entry_num = g_value_get_int (gimp_value_array_index (args, 1));
+ entry_name = g_value_get_string (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpPalette *palette = gimp_pdb_get_palette (gimp, name, GIMP_PDB_DATA_ACCESS_WRITE, error);
+
+ if (palette)
+ success = gimp_palette_set_entry_name (palette, entry_num, entry_name);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_palette_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-palette-new
+ */
+ procedure = gimp_procedure_new (palette_new_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-new");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-new",
+ "Creates a new palette",
+ "This procedure creates a new, uninitialized palette",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The requested name of the new palette",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("actual-name",
+ "actual name",
+ "The actual new palette name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-duplicate
+ */
+ procedure = gimp_procedure_new (palette_duplicate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-duplicate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-duplicate",
+ "Duplicates a palette",
+ "This procedure creates an identical palette by a different name",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("copy-name",
+ "copy name",
+ "The name of the palette's copy",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-rename
+ */
+ procedure = gimp_procedure_new (palette_rename_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-rename");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-rename",
+ "Rename a palette",
+ "This procedure renames a palette",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("new-name",
+ "new name",
+ "The new name of the palette",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("actual-name",
+ "actual name",
+ "The actual new name of the palette",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-delete
+ */
+ procedure = gimp_procedure_new (palette_delete_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-delete");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-delete",
+ "Deletes a palette",
+ "This procedure deletes a palette",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-is-editable
+ */
+ procedure = gimp_procedure_new (palette_is_editable_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-is-editable");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-is-editable",
+ "Tests if palette can be edited",
+ "Returns TRUE if you have permission to change the palette",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("editable",
+ "editable",
+ "TRUE if the palette can be edited",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-get-info
+ */
+ procedure = gimp_procedure_new (palette_get_info_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-get-info");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-get-info",
+ "Retrieve information about the specified palette.",
+ "This procedure retrieves information about the specified palette. This includes the name, and the number of colors.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-colors",
+ "num colors",
+ "The number of colors in the palette",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-get-colors
+ */
+ procedure = gimp_procedure_new (palette_get_colors_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-get-colors");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-get-colors",
+ "Gets all colors from the specified palette.",
+ "This procedure retrieves all color entries of the specified palette.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2006",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-colors",
+ "num colors",
+ "Length of the colors array",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_color_array ("colors",
+ "colors",
+ "The colors in the palette",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-get-columns
+ */
+ procedure = gimp_procedure_new (palette_get_columns_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-get-columns");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-get-columns",
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-columns",
+ "num columns",
+ "The number of columns used to display this palette",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-set-columns
+ */
+ procedure = gimp_procedure_new (palette_set_columns_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-set-columns");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-set-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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("columns",
+ "columns",
+ "The new number of columns",
+ 0, 64, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-add-entry
+ */
+ procedure = gimp_procedure_new (palette_add_entry_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-add-entry");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-add-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("entry-name",
+ "entry name",
+ "The name of the entry",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The new entry's color color",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("entry-num",
+ "entry num",
+ "The index of the added entry",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-delete-entry
+ */
+ procedure = gimp_procedure_new (palette_delete_entry_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-delete-entry");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-delete-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("entry-num",
+ "entry num",
+ "The index of the added entry",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-entry-get-color
+ */
+ procedure = gimp_procedure_new (palette_entry_get_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-entry-get-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-entry-get-color",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("entry-num",
+ "entry num",
+ "The entry to retrieve",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The color requested",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-entry-set-color
+ */
+ procedure = gimp_procedure_new (palette_entry_set_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-entry-set-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-entry-set-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("entry-num",
+ "entry num",
+ "The entry to retrieve",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The new color",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-entry-get-name
+ */
+ procedure = gimp_procedure_new (palette_entry_get_name_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-entry-get-name");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-entry-get-name",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("entry-num",
+ "entry num",
+ "The entry to retrieve",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("entry-name",
+ "entry name",
+ "The name requested",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palette-entry-set-name
+ */
+ procedure = gimp_procedure_new (palette_entry_set_name_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palette-entry-set-name");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palette-entry-set-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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("entry-num",
+ "entry num",
+ "The entry to retrieve",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("entry-name",
+ "entry name",
+ "The new name",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/palette-select-cmds.c b/app/pdb/palette-select-cmds.c
new file mode 100644
index 0000000..e99e9df
--- /dev/null
+++ b/app/pdb/palette-select-cmds.c
@@ -0,0 +1,223 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+palettes_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *palette_callback;
+ const gchar *popup_title;
+ const gchar *initial_palette;
+
+ palette_callback = g_value_get_string (gimp_value_array_index (args, 0));
+ popup_title = g_value_get_string (gimp_value_array_index (args, 1));
+ initial_palette = g_value_get_string (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, palette_callback) ||
+ ! gimp_pdb_dialog_new (gimp, context, progress,
+ gimp_data_factory_get_container (gimp->palette_factory),
+ popup_title, palette_callback, initial_palette,
+ NULL))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+palettes_close_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *palette_callback;
+
+ palette_callback = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, palette_callback) ||
+ ! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->palette_factory),
+ palette_callback))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+palettes_set_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *palette_callback;
+ const gchar *palette_name;
+
+ palette_callback = g_value_get_string (gimp_value_array_index (args, 0));
+ palette_name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, palette_callback) ||
+ ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->palette_factory),
+ palette_callback, palette_name,
+ NULL))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_palette_select_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-palettes-popup
+ */
+ procedure = gimp_procedure_new (palettes_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palettes-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palettes-popup",
+ "Invokes the Gimp palette selection.",
+ "This procedure opens the palette selection dialog.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2002",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("palette-callback",
+ "palette callback",
+ "The callback PDB proc to call when palette selection is made",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("popup-title",
+ "popup title",
+ "Title of the palette selection dialog",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("initial-palette",
+ "initial palette",
+ "The name of the palette to set as the first selected",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palettes-close-popup
+ */
+ procedure = gimp_procedure_new (palettes_close_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palettes-close-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palettes-close-popup",
+ "Close the palette selection dialog.",
+ "This procedure closes an opened palette selection dialog.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2002",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("palette-callback",
+ "palette callback",
+ "The name of the callback registered for this pop-up",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palettes-set-popup
+ */
+ procedure = gimp_procedure_new (palettes_set_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palettes-set-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palettes-set-popup",
+ "Sets the current palette in a palette selection dialog.",
+ "Sets the current palette in a palette selection dialog.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2002",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("palette-callback",
+ "palette callback",
+ "The name of the callback registered for this pop-up",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("palette-name",
+ "palette name",
+ "The name of the palette to set as selected",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/palettes-cmds.c b/app/pdb/palettes-cmds.c
new file mode 100644
index 0000000..c3612f4
--- /dev/null
+++ b/app/pdb/palettes-cmds.c
@@ -0,0 +1,324 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <cairo.h>
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpcolor/gimpcolor.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontainer-filter.h"
+#include "core/gimpcontext.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimppalette.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+palettes_refresh_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_data_factory_data_refresh (gimp->palette_factory, context);
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+palettes_get_list_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *filter;
+ gint32 num_palettes = 0;
+ gchar **palette_list = NULL;
+
+ filter = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ palette_list = gimp_container_get_filtered_name_array (gimp_data_factory_get_container (gimp->palette_factory),
+ filter, &num_palettes);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_palettes);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), palette_list, num_palettes);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+palettes_get_palette_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+ gint32 num_colors = 0;
+
+ GimpPalette *palette = gimp_context_get_palette (context);
+
+ if (palette)
+ {
+ name = g_strdup (gimp_object_get_name (palette));
+ num_colors = gimp_palette_get_n_colors (palette);
+ }
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), num_colors);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+palettes_get_palette_entry_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 entry_num;
+ gchar *actual_name = NULL;
+ gint32 num_colors = 0;
+ GimpRGB color = { 0.0, 0.0, 0.0, 1.0 };
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ entry_num = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpPalette *palette;
+
+ if (name && strlen (name))
+ palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+ else
+ palette = gimp_context_get_palette (context);
+
+ if (palette)
+ {
+ GimpPaletteEntry *entry = gimp_palette_get_entry (palette, entry_num);
+
+ if (entry)
+ {
+ actual_name = g_strdup (gimp_object_get_name (palette));
+ num_colors = gimp_palette_get_n_colors (palette);
+ color = entry->color;
+ }
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_take_string (gimp_value_array_index (return_vals, 1), actual_name);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), num_colors);
+ gimp_value_set_rgb (gimp_value_array_index (return_vals, 3), &color);
+ }
+
+ return return_vals;
+}
+
+void
+register_palettes_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-palettes-refresh
+ */
+ procedure = gimp_procedure_new (palettes_refresh_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palettes-refresh");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Adrian Likins <adrian@gimp.org>",
+ "Adrian Likins",
+ "1998",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palettes-get-list
+ */
+ procedure = gimp_procedure_new (palettes_get_list_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palettes-get-list");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palettes-get-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'.",
+ "Nathan Summers <rock@gimp.org>",
+ "Nathan Summers",
+ "2001",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filter",
+ "filter",
+ "An optional regular expression used to filter the list",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-palettes",
+ "num palettes",
+ "The number of palettes in the list",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("palette-list",
+ "palette list",
+ "The list of palette names",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palettes-get-palette
+ */
+ procedure = gimp_procedure_new (palettes_get_palette_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palettes-get-palette");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palettes-get-palette",
+ "Deprecated: Use 'gimp-context-get-palette' instead.",
+ "Deprecated: Use 'gimp-context-get-palette' instead.",
+ "",
+ "",
+ "",
+ "gimp-context-get-palette");
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-colors",
+ "num colors",
+ "The palette num_colors",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-palettes-get-palette-entry
+ */
+ procedure = gimp_procedure_new (palettes_get_palette_entry_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-palettes-get-palette-entry");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-palettes-get-palette-entry",
+ "Deprecated: Use 'gimp-palette-entry-get-color' instead.",
+ "Deprecated: Use 'gimp-palette-entry-get-color' instead.",
+ "",
+ "",
+ "",
+ "gimp-palette-entry-get-color");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The palette name (\"\" means currently active palette)",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("entry-num",
+ "entry num",
+ "The entry to retrieve",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("actual-name",
+ "actual name",
+ "The palette name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-colors",
+ "num colors",
+ "The palette num_colors",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The color requested",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/paths-cmds.c b/app/pdb/paths-cmds.c
new file mode 100644
index 0000000..5d7248f
--- /dev/null
+++ b/app/pdb/paths-cmds.c
@@ -0,0 +1,1283 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpconfig/gimpconfig.h"
+#include "libgimpmath/gimpmath.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpimage.h"
+#include "core/gimplist.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimpstrokeoptions.h"
+#include "vectors/gimpanchor.h"
+#include "vectors/gimpbezierstroke.h"
+#include "vectors/gimpvectors-compat.h"
+#include "vectors/gimpvectors-import.h"
+#include "vectors/gimpvectors.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+path_list_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 num_paths = 0;
+ gchar **path_list = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ path_list = gimp_container_get_name_array (gimp_image_get_vectors (image),
+ &num_paths);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_paths);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), path_list, num_paths);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+path_get_current_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gchar *name = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpVectors *vectors = gimp_image_get_active_vectors (image);
+
+ if (vectors)
+ name = g_strdup (gimp_object_get_name (vectors));
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+path_set_current_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *name;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
+
+ if (vectors)
+ gimp_image_set_active_vectors (image, vectors);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+path_delete_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *name;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
+
+ if (vectors)
+ gimp_image_remove_vectors (image, vectors, TRUE, NULL);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+path_get_points_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ const gchar *name;
+ gint32 path_type = 0;
+ gint32 path_closed = 0;
+ gint32 num_path_point_details = 0;
+ gdouble *points_pairs = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
+
+ if (vectors)
+ {
+ GimpVectorsCompatPoint *points;
+ gint num_points;
+
+ path_type = 1; /* BEZIER (1.2 compat) */
+
+ points = gimp_vectors_compat_get_points (vectors, &num_points,
+ &path_closed);
+
+ num_path_point_details = num_points * 3;
+
+ if (points)
+ {
+ gdouble *curr_point;
+ gint i;
+
+ points_pairs = g_new0 (gdouble, num_path_point_details);
+
+ for (i = 0, curr_point = points_pairs;
+ i < num_points;
+ i++, curr_point += 3)
+ {
+ curr_point[0] = points[i].x;
+ curr_point[1] = points[i].y;
+ curr_point[2] = points[i].type;
+ }
+
+ g_free (points);
+ }
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), path_type);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), path_closed);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), num_path_point_details);
+ gimp_value_take_floatarray (gimp_value_array_index (return_vals, 4), points_pairs, num_path_point_details);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+path_set_points_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *name;
+ gint32 num_path_points;
+ const gdouble *points_pairs;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+ num_path_points = g_value_get_int (gimp_value_array_index (args, 3));
+ points_pairs = gimp_value_get_floatarray (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ gboolean closed = FALSE;
+
+ if ((num_path_points / 3) % 3 == 0)
+ closed = TRUE;
+ else if ((num_path_points / 3) % 3 != 2)
+ success = FALSE;
+
+ if (success)
+ {
+ GimpVectors *vectors;
+ const gdouble *curr_point_pair;
+ GimpVectorsCompatPoint *points;
+ gint n_points;
+ gint i;
+
+ n_points = num_path_points / 3;
+
+ points = g_new0 (GimpVectorsCompatPoint, n_points);
+
+ for (i = 0, curr_point_pair = points_pairs;
+ i < n_points;
+ i++, curr_point_pair += 3)
+ {
+ points[i].x = curr_point_pair[0];
+ points[i].y = curr_point_pair[1];
+ points[i].type = curr_point_pair[2];
+ }
+
+ vectors = gimp_vectors_compat_new (image, name, points, n_points,
+ closed);
+
+ g_free (points);
+
+ if (vectors)
+ success = gimp_image_add_vectors (image, vectors, NULL, 0, TRUE);
+ else
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+path_stroke_current_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpVectors *vectors = gimp_image_get_active_vectors (image);
+ GimpDrawable *drawable = gimp_image_get_active_drawable (image);
+
+ if (vectors && drawable &&
+ gimp_pdb_item_is_modifiable (GIMP_ITEM (drawable),
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpStrokeOptions *options;
+ GimpPaintOptions *paint_options;
+
+ options = gimp_stroke_options_new (gimp, context, TRUE);
+ g_object_set (options,
+ "method", GIMP_STROKE_PAINT_METHOD,
+ NULL);
+
+ paint_options =
+ gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context), NULL);
+ paint_options = gimp_config_duplicate (GIMP_CONFIG (paint_options));
+
+ success = gimp_item_stroke (GIMP_ITEM (vectors),
+ drawable, context, options, paint_options,
+ TRUE, progress, error);
+
+ g_object_unref (options);
+ g_object_unref (paint_options);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+path_get_point_at_dist_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gdouble distance;
+ gint32 x_point = 0;
+ gint32 y_point = 0;
+ gdouble slope = 0.0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ distance = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectors *vectors;
+ GimpStroke *stroke;
+ gdouble distance_along;
+ gdouble stroke_length;
+ gdouble stroke_distance;
+ GimpCoords position;
+
+ vectors = gimp_image_get_active_vectors (image);
+
+ if (vectors)
+ {
+ distance_along = 0.0;
+ stroke = gimp_vectors_stroke_get_next (vectors, NULL);
+
+ while (stroke != NULL )
+ {
+ stroke_length = gimp_stroke_get_length (stroke, 0.5);
+
+ if (distance_along + stroke_length < distance)
+ {
+ distance_along += stroke_length;
+ }
+ else
+ {
+ stroke_distance = distance - distance_along;
+ stroke_distance = stroke_distance < 0 ? 0: stroke_distance;
+
+ if (!gimp_stroke_get_point_at_dist (stroke, stroke_distance, 0.5,
+ &position, &slope))
+ {
+ success = FALSE;
+ break;
+ }
+ else
+ {
+ success = TRUE;
+ x_point = ROUND (position.x);
+ y_point = ROUND (position.y);
+ break;
+ }
+ }
+
+ stroke = gimp_vectors_stroke_get_next (vectors, stroke);
+ }
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), x_point);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), y_point);
+ g_value_set_double (gimp_value_array_index (return_vals, 3), slope);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+path_get_tattoo_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ const gchar *name;
+ gint32 tattoo = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
+
+ if (vectors)
+ tattoo = gimp_item_get_tattoo (GIMP_ITEM (vectors));
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), tattoo);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+path_set_tattoo_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *name;
+ gint32 tattovalue;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+ tattovalue = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
+
+ if (vectors)
+ gimp_item_set_tattoo (GIMP_ITEM (vectors), tattovalue);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+get_path_by_tattoo_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 tattoo;
+ gchar *name = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ tattoo = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectors *vectors = gimp_image_get_vectors_by_tattoo (image, tattoo);
+
+ if (vectors)
+ name = g_strdup (gimp_object_get_name (vectors));
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+path_get_locked_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ const gchar *name;
+ gboolean locked = FALSE;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
+
+ if (vectors)
+ locked = gimp_item_get_linked (GIMP_ITEM (vectors));
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), locked);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+path_set_locked_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *name;
+ gboolean locked;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+ locked = g_value_get_boolean (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
+
+ if (vectors)
+ gimp_item_set_linked (GIMP_ITEM (vectors), locked, TRUE);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+path_to_selection_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *name;
+ gint32 op;
+ gboolean antialias;
+ gboolean feather;
+ gdouble feather_radius_x;
+ gdouble feather_radius_y;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+ op = g_value_get_enum (gimp_value_array_index (args, 2));
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 3));
+ feather = g_value_get_boolean (gimp_value_array_index (args, 4));
+ feather_radius_x = g_value_get_double (gimp_value_array_index (args, 5));
+ feather_radius_y = g_value_get_double (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
+
+ if (vectors)
+ gimp_item_to_selection (GIMP_ITEM (vectors),
+ op,
+ antialias,
+ feather,
+ feather_radius_x,
+ feather_radius_y);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+path_import_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *filename;
+ gboolean merge;
+ gboolean scale;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ filename = g_value_get_string (gimp_value_array_index (args, 1));
+ merge = g_value_get_boolean (gimp_value_array_index (args, 2));
+ scale = g_value_get_boolean (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GFile *file = g_file_new_for_path (filename);
+
+ success = gimp_vectors_import_file (image, file,
+ merge, scale, NULL, -1, NULL, NULL);
+
+ g_object_unref (file);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_paths_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-path-list
+ */
+ procedure = gimp_procedure_new (path_list_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-list");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-list",
+ "Deprecated: Use 'gimp-image-get-vectors' instead.",
+ "Deprecated: Use 'gimp-image-get-vectors' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-get-vectors");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image to list the paths from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-paths",
+ "num paths",
+ "The number of paths returned.",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("path-list",
+ "path list",
+ "List of the paths belonging to this image",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-path-get-current
+ */
+ procedure = gimp_procedure_new (path_get_current_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-get-current");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-get-current",
+ "Deprecated: Use 'gimp-image-get-active-vectors' instead.",
+ "Deprecated: Use 'gimp-image-get-active-vectors' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-get-active-vectors");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image to get the current path from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the current path.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-path-set-current
+ */
+ procedure = gimp_procedure_new (path_set_current_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-set-current");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-set-current",
+ "Deprecated: Use 'gimp-image-set-active-vectors' instead.",
+ "Deprecated: Use 'gimp-image-set-active-vectors' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-set-active-vectors");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image in which a path will become current",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the path to make current.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-path-delete
+ */
+ procedure = gimp_procedure_new (path_delete_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-delete");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-delete",
+ "Deprecated: Use 'gimp-image-remove-vectors' instead.",
+ "Deprecated: Use 'gimp-image-remove-vectors' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-remove-vectors");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image to delete the path from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the path to delete.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-path-get-points
+ */
+ procedure = gimp_procedure_new (path_get_points_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-get-points");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-get-points",
+ "Deprecated: Use 'gimp-vectors-stroke-get-points' instead.",
+ "Deprecated: Use 'gimp-vectors-stroke-get-points' instead.",
+ "",
+ "",
+ "",
+ "gimp-vectors-stroke-get-points");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image to list the paths from",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the path whose points should be listed.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("path-type",
+ "path type",
+ "The type of the path. Currently only one type (1 = Bezier) is supported",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("path-closed",
+ "path closed",
+ "Return if the path is closed. (0 = path open, 1 = path closed)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-path-point-details",
+ "num path point details",
+ "The number of points returned. Each point is made up of (x, y, pnt_type) of floats.",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_float_array ("points-pairs",
+ "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.",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-path-set-points
+ */
+ procedure = gimp_procedure_new (path_set_points_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-set-points");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-set-points",
+ "Deprecated: Use 'gimp-vectors-stroke-new-from-points' instead.",
+ "Deprecated: Use 'gimp-vectors-stroke-new-from-points' instead.",
+ "",
+ "",
+ "",
+ "gimp-vectors-stroke-new-from-points");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image to set the paths in",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "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.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("ptype",
+ "ptype",
+ "The type of the path. Currently only one type (1 = Bezier) is supported.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-path-points",
+ "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.",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("points-pairs",
+ "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.",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-path-stroke-current
+ */
+ procedure = gimp_procedure_new (path_stroke_current_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-stroke-current");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-stroke-current",
+ "Deprecated: Use 'gimp-edit-stroke-vectors' instead.",
+ "Deprecated: Use 'gimp-edit-stroke-vectors' instead.",
+ "",
+ "",
+ "",
+ "gimp-edit-stroke-vectors");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image which contains the path to stroke",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-path-get-point-at-dist
+ */
+ procedure = gimp_procedure_new (path_get_point_at_dist_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-get-point-at-dist");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-get-point-at-dist",
+ "Deprecated: Use 'gimp-vectors-stroke-get-point-at-dist' instead.",
+ "Deprecated: Use 'gimp-vectors-stroke-get-point-at-dist' instead.",
+ "",
+ "",
+ "",
+ "gimp-vectors-stroke-get-point-at-dist");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image the paths belongs to",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("distance",
+ "distance",
+ "The distance along the path.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("x-point",
+ "x point",
+ "The x position of the point.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("y-point",
+ "y point",
+ "The y position of the point.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("slope",
+ "slope",
+ "The slope (dy / dx) at the specified point.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-path-get-tattoo
+ */
+ procedure = gimp_procedure_new (path_get_tattoo_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-get-tattoo");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-get-tattoo",
+ "Deprecated: Use 'gimp-vectors-get-tattoo' instead.",
+ "Deprecated: Use 'gimp-vectors-get-tattoo' instead.",
+ "",
+ "",
+ "",
+ "gimp-vectors-get-tattoo");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the path whose tattoo should be obtained.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("tattoo",
+ "tattoo",
+ "The tattoo associated with the named path.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-path-set-tattoo
+ */
+ procedure = gimp_procedure_new (path_set_tattoo_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-set-tattoo");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-set-tattoo",
+ "Deprecated: Use 'gimp-vectors-set-tattoo' instead.",
+ "Deprecated: Use 'gimp-vectors-set-tattoo' instead.",
+ "",
+ "",
+ "",
+ "gimp-vectors-set-tattoo");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "the name of the path whose tattoo should be set",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("tattovalue",
+ "tattovalue",
+ "The tattoo associated with the name path. Only values returned from 'path_get_tattoo' should be used here",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-get-path-by-tattoo
+ */
+ procedure = gimp_procedure_new (get_path_by_tattoo_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-get-path-by-tattoo");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-get-path-by-tattoo",
+ "Deprecated: Use 'gimp-image-get-vectors-by-tattoo' instead.",
+ "Deprecated: Use 'gimp-image-get-vectors-by-tattoo' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-get-vectors-by-tattoo");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("tattoo",
+ "tattoo",
+ "The tattoo of the required path.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the path with the specified tattoo.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-path-get-locked
+ */
+ procedure = gimp_procedure_new (path_get_locked_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-get-locked");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-get-locked",
+ "Deprecated: Use 'gimp-vectors-get-linked' instead.",
+ "Deprecated: Use 'gimp-vectors-get-linked' instead.",
+ "",
+ "",
+ "",
+ "gimp-vectors-get-linked");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the path whose locked status should be obtained.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("locked",
+ "locked",
+ "TRUE if the path is locked, FALSE otherwise",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-path-set-locked
+ */
+ procedure = gimp_procedure_new (path_set_locked_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-set-locked");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-set-locked",
+ "Deprecated: Use 'gimp-vectors-set-linked' instead.",
+ "Deprecated: Use 'gimp-vectors-set-linked' instead.",
+ "",
+ "",
+ "",
+ "gimp-vectors-set-linked");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "the name of the path whose locked status should be set",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("locked",
+ "locked",
+ "Whether the path is locked",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-path-to-selection
+ */
+ procedure = gimp_procedure_new (path_to_selection_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-to-selection");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-to-selection",
+ "Deprecated: Use 'gimp-vectors-to-selection' instead.",
+ "Deprecated: Use 'gimp-vectors-to-selection' instead.",
+ "",
+ "",
+ "",
+ "gimp-vectors-to-selection");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the path which should be made into selection.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("op",
+ "op",
+ "The desired operation with current selection",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "Antialias selection.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("feather",
+ "feather",
+ "Feather selection.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius-x",
+ "feather radius x",
+ "Feather radius x.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius-y",
+ "feather radius y",
+ "Feather radius y.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-path-import
+ */
+ procedure = gimp_procedure_new (path_import_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-path-import");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-path-import",
+ "Deprecated: Use 'gimp-vectors-import-from-file' instead.",
+ "Deprecated: Use 'gimp-vectors-import-from-file' instead.",
+ "",
+ "",
+ "",
+ "gimp-vectors-import-from-file");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filename",
+ "filename",
+ "The name of the SVG file to import.",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("merge",
+ "merge",
+ "Merge paths into a single vectors object.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("scale",
+ "scale",
+ "Scale the SVG to image dimensions.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/pattern-cmds.c b/app/pdb/pattern-cmds.c
new file mode 100644
index 0000000..e9a67d9
--- /dev/null
+++ b/app/pdb/pattern-cmds.c
@@ -0,0 +1,252 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpcontext.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimppattern.h"
+#include "core/gimptempbuf.h"
+#include "gegl/gimp-babl-compat.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+pattern_get_info_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 width = 0;
+ gint32 height = 0;
+ gint32 bpp = 0;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPattern *pattern = gimp_pdb_get_pattern (gimp, name, error);
+
+ if (pattern)
+ {
+ const Babl *format;
+
+ format = gimp_babl_compat_u8_format (
+ gimp_temp_buf_get_format (pattern->mask));
+
+ width = gimp_temp_buf_get_width (pattern->mask);
+ height = gimp_temp_buf_get_height (pattern->mask);
+ bpp = babl_format_get_bytes_per_pixel (format);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), width);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), height);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), bpp);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+pattern_get_pixels_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gint32 width = 0;
+ gint32 height = 0;
+ gint32 bpp = 0;
+ gint32 num_color_bytes = 0;
+ guint8 *color_bytes = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPattern *pattern = gimp_pdb_get_pattern (gimp, name, error);
+
+ if (pattern)
+ {
+ const Babl *format;
+ gpointer data;
+
+ format = gimp_babl_compat_u8_format (
+ gimp_temp_buf_get_format (pattern->mask));
+ data = gimp_temp_buf_lock (pattern->mask, format, GEGL_ACCESS_READ);
+
+ width = gimp_temp_buf_get_width (pattern->mask);
+ height = gimp_temp_buf_get_height (pattern->mask);
+ bpp = babl_format_get_bytes_per_pixel (format);
+ num_color_bytes = gimp_temp_buf_get_data_size (pattern->mask);
+ color_bytes = g_memdup (data, num_color_bytes);
+
+ gimp_temp_buf_unlock (pattern->mask, data);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), width);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), height);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), bpp);
+ g_value_set_int (gimp_value_array_index (return_vals, 4), num_color_bytes);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 5), color_bytes, num_color_bytes);
+ }
+
+ return return_vals;
+}
+
+void
+register_pattern_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-pattern-get-info
+ */
+ procedure = gimp_procedure_new (pattern_get_info_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-pattern-get-info");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-pattern-get-info",
+ "Retrieve information about the specified pattern.",
+ "This procedure retrieves information about the specified pattern. This includes the pattern extents (width and height).",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The pattern name.",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The pattern width",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The pattern height",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("bpp",
+ "bpp",
+ "The pattern bpp",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-pattern-get-pixels
+ */
+ procedure = gimp_procedure_new (pattern_get_pixels_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-pattern-get-pixels");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-pattern-get-pixels",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The pattern name.",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The pattern width",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The pattern height",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("bpp",
+ "bpp",
+ "The pattern bpp",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-color-bytes",
+ "num color bytes",
+ "Number of pattern bytes",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("color-bytes",
+ "color bytes",
+ "The pattern data.",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/pattern-select-cmds.c b/app/pdb/pattern-select-cmds.c
new file mode 100644
index 0000000..657dea6
--- /dev/null
+++ b/app/pdb/pattern-select-cmds.c
@@ -0,0 +1,223 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+patterns_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *pattern_callback;
+ const gchar *popup_title;
+ const gchar *initial_pattern;
+
+ pattern_callback = g_value_get_string (gimp_value_array_index (args, 0));
+ popup_title = g_value_get_string (gimp_value_array_index (args, 1));
+ initial_pattern = g_value_get_string (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, pattern_callback) ||
+ ! gimp_pdb_dialog_new (gimp, context, progress,
+ gimp_data_factory_get_container (gimp->pattern_factory),
+ popup_title, pattern_callback, initial_pattern,
+ NULL))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+patterns_close_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *pattern_callback;
+
+ pattern_callback = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, pattern_callback) ||
+ ! gimp_pdb_dialog_close (gimp, gimp_data_factory_get_container (gimp->pattern_factory),
+ pattern_callback))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+patterns_set_popup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *pattern_callback;
+ const gchar *pattern_name;
+
+ pattern_callback = g_value_get_string (gimp_value_array_index (args, 0));
+ pattern_name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp->no_interface ||
+ ! gimp_pdb_lookup_procedure (gimp->pdb, pattern_callback) ||
+ ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->pattern_factory),
+ pattern_callback, pattern_name,
+ NULL))
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_pattern_select_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-patterns-popup
+ */
+ procedure = gimp_procedure_new (patterns_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-patterns-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-patterns-popup",
+ "Invokes the Gimp pattern selection.",
+ "This procedure opens the pattern selection dialog.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("pattern-callback",
+ "pattern callback",
+ "The callback PDB proc to call when pattern selection is made",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("popup-title",
+ "popup title",
+ "Title of the pattern selection dialog",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("initial-pattern",
+ "initial pattern",
+ "The name of the pattern to set as the first selected",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-patterns-close-popup
+ */
+ procedure = gimp_procedure_new (patterns_close_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-patterns-close-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-patterns-close-popup",
+ "Close the pattern selection dialog.",
+ "This procedure closes an opened pattern selection dialog.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("pattern-callback",
+ "pattern callback",
+ "The name of the callback registered for this pop-up",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-patterns-set-popup
+ */
+ procedure = gimp_procedure_new (patterns_set_popup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-patterns-set-popup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-patterns-set-popup",
+ "Sets the current pattern in a pattern selection dialog.",
+ "Sets the current pattern in a pattern selection dialog.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("pattern-callback",
+ "pattern callback",
+ "The name of the callback registered for this pop-up",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("pattern-name",
+ "pattern name",
+ "The name of the pattern to set as selected",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/patterns-cmds.c b/app/pdb/patterns-cmds.c
new file mode 100644
index 0000000..9b81b01
--- /dev/null
+++ b/app/pdb/patterns-cmds.c
@@ -0,0 +1,341 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontainer-filter.h"
+#include "core/gimpcontext.h"
+#include "core/gimpdatafactory.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimppattern.h"
+#include "core/gimptempbuf.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+patterns_refresh_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gimp_data_factory_data_refresh (gimp->pattern_factory, context);
+
+ return gimp_procedure_get_return_values (procedure, TRUE, NULL);
+}
+
+static GimpValueArray *
+patterns_get_list_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *filter;
+ gint32 num_patterns = 0;
+ gchar **pattern_list = NULL;
+
+ filter = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ pattern_list = gimp_container_get_filtered_name_array (gimp_data_factory_get_container (gimp->pattern_factory),
+ filter, &num_patterns);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_patterns);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), pattern_list, num_patterns);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+patterns_get_pattern_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+ gint32 width = 0;
+ gint32 height = 0;
+
+ GimpPattern *pattern = gimp_context_get_pattern (context);
+
+ if (pattern)
+ {
+ name = g_strdup (gimp_object_get_name (pattern));
+ width = gimp_temp_buf_get_width (pattern->mask);
+ height = gimp_temp_buf_get_height (pattern->mask);
+ }
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_take_string (gimp_value_array_index (return_vals, 1), name);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), width);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), height);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+patterns_get_pattern_data_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ gchar *actual_name = NULL;
+ gint32 width = 0;
+ gint32 height = 0;
+ gint32 mask_bpp = 0;
+ gint32 length = 0;
+ guint8 *mask_data = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPattern *pattern;
+
+ if (name && strlen (name))
+ pattern = gimp_pdb_get_pattern (gimp, name, error);
+ else
+ pattern = gimp_context_get_pattern (context);
+
+ if (pattern)
+ {
+ actual_name = g_strdup (gimp_object_get_name (pattern));
+ width = gimp_temp_buf_get_width (pattern->mask);
+ height = gimp_temp_buf_get_height (pattern->mask);
+ mask_bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (pattern->mask));
+ length = gimp_temp_buf_get_data_size (pattern->mask);
+ mask_data = g_memdup (gimp_temp_buf_get_data (pattern->mask), length);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_take_string (gimp_value_array_index (return_vals, 1), actual_name);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), width);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), height);
+ g_value_set_int (gimp_value_array_index (return_vals, 4), mask_bpp);
+ g_value_set_int (gimp_value_array_index (return_vals, 5), length);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 6), mask_data, length);
+ }
+
+ return return_vals;
+}
+
+void
+register_patterns_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-patterns-refresh
+ */
+ procedure = gimp_procedure_new (patterns_refresh_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-patterns-refresh");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2002",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-patterns-get-list
+ */
+ procedure = gimp_procedure_new (patterns_get_list_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-patterns-get-list");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-patterns-get-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'.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filter",
+ "filter",
+ "An optional regular expression used to filter the list",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-patterns",
+ "num patterns",
+ "The number of patterns in the pattern list",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("pattern-list",
+ "pattern list",
+ "The list of pattern names",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-patterns-get-pattern
+ */
+ procedure = gimp_procedure_new (patterns_get_pattern_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-patterns-get-pattern");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-patterns-get-pattern",
+ "Deprecated: Use 'gimp-context-get-pattern' instead.",
+ "Deprecated: Use 'gimp-context-get-pattern' instead.",
+ "",
+ "",
+ "",
+ "gimp-context-get-pattern");
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The pattern name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The pattern width",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The pattern height",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-patterns-get-pattern-data
+ */
+ procedure = gimp_procedure_new (patterns_get_pattern_data_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-patterns-get-pattern-data");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-patterns-get-pattern-data",
+ "Deprecated: Use 'gimp-pattern-get-pixels' instead.",
+ "Deprecated: Use 'gimp-pattern-get-pixels' instead.",
+ "",
+ "",
+ "",
+ "gimp-pattern-get-pixels");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The pattern name (\"\" means currently active pattern)",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("actual-name",
+ "actual name",
+ "The pattern name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The pattern width",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The pattern height",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("mask-bpp",
+ "mask bpp",
+ "Pattern bytes per pixel",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("length",
+ "length",
+ "Length of pattern mask data",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("mask-data",
+ "mask data",
+ "The pattern mask data",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/pdb-types.h b/app/pdb/pdb-types.h
new file mode 100644
index 0000000..301c7ee
--- /dev/null
+++ b/app/pdb/pdb-types.h
@@ -0,0 +1,54 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __PDB_TYPES_H__
+#define __PDB_TYPES_H__
+
+
+#include "core/core-types.h"
+
+
+typedef struct _GimpPDB GimpPDB;
+typedef struct _GimpProcedure GimpProcedure;
+typedef struct _GimpPlugInProcedure GimpPlugInProcedure;
+typedef struct _GimpTemporaryProcedure GimpTemporaryProcedure;
+
+
+typedef enum
+{
+ GIMP_PDB_COMPAT_OFF,
+ GIMP_PDB_COMPAT_ON,
+ GIMP_PDB_COMPAT_WARN
+} GimpPDBCompatMode;
+
+
+typedef enum
+{
+ GIMP_PDB_ITEM_CONTENT = 1 << 0,
+ GIMP_PDB_ITEM_POSITION = 1 << 1
+} GimpPDBItemModify;
+
+
+typedef enum
+{
+ GIMP_PDB_DATA_ACCESS_READ = 0,
+ GIMP_PDB_DATA_ACCESS_WRITE = 1 << 0,
+ GIMP_PDB_DATA_ACCESS_RENAME = 1 << 1
+} GimpPDBDataAccess;
+
+
+#endif /* __PDB_TYPES_H__ */
diff --git a/app/pdb/plug-in-cmds.c b/app/pdb/plug-in-cmds.c
new file mode 100644
index 0000000..5013617
--- /dev/null
+++ b/app/pdb/plug-in-cmds.c
@@ -0,0 +1,751 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpparamspecs.h"
+#include "plug-in/gimpplugin.h"
+#include "plug-in/gimpplugindef.h"
+#include "plug-in/gimppluginmanager-menu-branch.h"
+#include "plug-in/gimppluginmanager-query.h"
+#include "plug-in/gimppluginmanager.h"
+#include "plug-in/gimppluginprocedure.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+plugins_query_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ const gchar *search_string;
+ gint32 num_plugins = 0;
+ gchar **menu_path = NULL;
+ gchar **plugin_accelerator = NULL;
+ gchar **plugin_location = NULL;
+ gchar **plugin_image_type = NULL;
+ gint32 *plugin_install_time = NULL;
+ gchar **plugin_real_name = NULL;
+
+ search_string = g_value_get_string (gimp_value_array_index (args, 0));
+
+ num_plugins = gimp_plug_in_manager_query (gimp->plug_in_manager,
+ search_string,
+ &menu_path,
+ &plugin_accelerator,
+ &plugin_location,
+ &plugin_image_type,
+ &plugin_real_name,
+ &plugin_install_time);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_plugins);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), menu_path, num_plugins);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), num_plugins);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 4), plugin_accelerator, num_plugins);
+ g_value_set_int (gimp_value_array_index (return_vals, 5), num_plugins);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 6), plugin_location, num_plugins);
+ g_value_set_int (gimp_value_array_index (return_vals, 7), num_plugins);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 8), plugin_image_type, num_plugins);
+ g_value_set_int (gimp_value_array_index (return_vals, 9), num_plugins);
+ gimp_value_take_int32array (gimp_value_array_index (return_vals, 10), plugin_install_time, num_plugins);
+ g_value_set_int (gimp_value_array_index (return_vals, 11), num_plugins);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 12), plugin_real_name, num_plugins);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+plugin_domain_register_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *domain_name;
+ const gchar *domain_path;
+
+ domain_name = g_value_get_string (gimp_value_array_index (args, 0));
+ domain_path = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->call_mode == GIMP_PLUG_IN_CALL_QUERY)
+ {
+ gimp_plug_in_def_set_locale_domain (plug_in->plug_in_def,
+ domain_name, domain_path);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plugin_help_register_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *domain_name;
+ const gchar *domain_uri;
+
+ domain_name = g_value_get_string (gimp_value_array_index (args, 0));
+ domain_uri = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->call_mode == GIMP_PLUG_IN_CALL_QUERY)
+ {
+ gimp_plug_in_def_set_help_domain (plug_in->plug_in_def,
+ domain_name, domain_uri);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plugin_menu_register_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *procedure_name;
+ const gchar *menu_path;
+
+ procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+ menu_path = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in)
+ {
+ gchar *canonical = gimp_canonicalize_identifier (procedure_name);
+ success = gimp_plug_in_menu_register (plug_in, canonical, menu_path);
+ g_free (canonical);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plugin_menu_branch_register_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *menu_path;
+ const gchar *menu_name;
+
+ menu_path = g_value_get_string (gimp_value_array_index (args, 0));
+ menu_name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in)
+ {
+ gimp_plug_in_manager_add_menu_branch (gimp->plug_in_manager,
+ plug_in->file, menu_path, menu_name);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plugin_icon_register_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *procedure_name;
+ gint32 icon_type;
+ gint32 icon_data_length;
+ const guint8 *icon_data;
+
+ procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+ icon_type = g_value_get_enum (gimp_value_array_index (args, 1));
+ icon_data_length = g_value_get_int (gimp_value_array_index (args, 2));
+ icon_data = gimp_value_get_int8array (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->call_mode == GIMP_PLUG_IN_CALL_QUERY)
+ {
+ GimpPlugInProcedure *proc;
+ gchar *canonical;
+
+ canonical = gimp_canonicalize_identifier (procedure_name);
+
+ proc = gimp_plug_in_procedure_find (plug_in->plug_in_def->procedures,
+ canonical);
+
+ g_free (canonical);
+
+ if (proc)
+ gimp_plug_in_procedure_set_icon (proc, icon_type,
+ icon_data, icon_data_length);
+ else
+ success = FALSE;
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plugin_set_pdb_error_handler_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gint32 handler;
+
+ handler = g_value_get_enum (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in)
+ {
+ gimp_plug_in_set_error_handler (plug_in, handler);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plugin_get_pdb_error_handler_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gint32 handler = 0;
+
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in)
+ {
+ handler = gimp_plug_in_get_error_handler (plug_in);
+ }
+ else
+ {
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), handler);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+plugin_enable_precision_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in)
+ {
+ gimp_plug_in_enable_precision (plug_in);
+ }
+ else
+ {
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plugin_precision_enabled_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gboolean enabled = FALSE;
+
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in)
+ {
+ enabled = gimp_plug_in_precision_enabled (plug_in);
+ }
+ else
+ {
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), enabled);
+
+ return return_vals;
+}
+
+void
+register_plug_in_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-plugins-query
+ */
+ procedure = gimp_procedure_new (plugins_query_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-plugins-query");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-plugins-query",
+ "Queries the plug-in database for its contents.",
+ "This procedure queries the contents of the plug-in database.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("search-string",
+ "search string",
+ "If not an empty string then use this as a search pattern",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-plugins",
+ "num plugins",
+ "The number of plug-ins",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("menu-path",
+ "menu path",
+ "The menu path of the plug-in",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-plugins",
+ "num plugins",
+ "The number of plug-ins",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("plugin-accelerator",
+ "plugin accelerator",
+ "String representing keyboard accelerator (could be empty string)",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-plugins",
+ "num plugins",
+ "The number of plug-ins",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("plugin-location",
+ "plugin location",
+ "Location of the plug-in program",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-plugins",
+ "num plugins",
+ "The number of plug-ins",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("plugin-image-type",
+ "plugin image type",
+ "Type of image that this plug-in will work on",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-plugins",
+ "num plugins",
+ "The number of plug-ins",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32_array ("plugin-install-time",
+ "plugin install time",
+ "Time that the plug-in was installed",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-plugins",
+ "num plugins",
+ "The number of plug-ins",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("plugin-real-name",
+ "plugin real name",
+ "The internal name of the plug-in",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plugin-domain-register
+ */
+ procedure = gimp_procedure_new (plugin_domain_register_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-plugin-domain-register");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-plugin-domain-register",
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2000",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("domain-name",
+ "domain name",
+ "The name of the textdomain (must be unique)",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("domain-path",
+ "domain path",
+ "The absolute path to the compiled message catalog (may be NULL)",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plugin-help-register
+ */
+ procedure = gimp_procedure_new (plugin_help_register_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-plugin-help-register");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-plugin-help-register",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2000",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("domain-name",
+ "domain name",
+ "The XML namespace of the plug-in's help pages",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("domain-uri",
+ "domain uri",
+ "The root URI of the plug-in's help pages",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plugin-menu-register
+ */
+ procedure = gimp_procedure_new (plugin_menu_register_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-plugin-menu-register");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-plugin-menu-register",
+ "Register an additional menu path for a plug-in procedure.",
+ "This procedure installs an additional menu entry for the given procedure.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("procedure-name",
+ "procedure name",
+ "The procedure for which to install the menu path",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("menu-path",
+ "menu path",
+ "The procedure's additional menu path",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plugin-menu-branch-register
+ */
+ procedure = gimp_procedure_new (plugin_menu_branch_register_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-plugin-menu-branch-register");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-plugin-menu-branch-register",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("menu-path",
+ "menu path",
+ "The sub-menu's menu path",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("menu-name",
+ "menu name",
+ "The name of the sub-menu",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plugin-icon-register
+ */
+ procedure = gimp_procedure_new (plugin_icon_register_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-plugin-icon-register");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-plugin-icon-register",
+ "Register an icon for a plug-in procedure.",
+ "This procedure installs an icon for the given procedure.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("procedure-name",
+ "procedure name",
+ "The procedure for which to install the icon",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("icon-type",
+ "icon type",
+ "The type of the icon",
+ GIMP_TYPE_ICON_TYPE,
+ GIMP_ICON_TYPE_ICON_NAME,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("icon-data-length",
+ "icon data length",
+ "The length of 'icon-data'",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8_array ("icon-data",
+ "icon data",
+ "The procedure's icon. The format depends on the 'icon_type' parameter",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plugin-set-pdb-error-handler
+ */
+ procedure = gimp_procedure_new (plugin_set_pdb_error_handler_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-plugin-set-pdb-error-handler");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-plugin-set-pdb-error-handler",
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("handler",
+ "handler",
+ "Who is responsible for handling procedure call errors",
+ GIMP_TYPE_PDB_ERROR_HANDLER,
+ GIMP_PDB_ERROR_HANDLER_INTERNAL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plugin-get-pdb-error-handler
+ */
+ procedure = gimp_procedure_new (plugin_get_pdb_error_handler_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-plugin-get-pdb-error-handler");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2008",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("handler",
+ "handler",
+ "Who is responsible for handling procedure call errors",
+ GIMP_TYPE_PDB_ERROR_HANDLER,
+ GIMP_PDB_ERROR_HANDLER_INTERNAL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plugin-enable-precision
+ */
+ procedure = gimp_procedure_new (plugin_enable_precision_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-plugin-enable-precision");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2012",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plugin-precision-enabled
+ */
+ procedure = gimp_procedure_new (plugin_precision_enabled_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-plugin-precision-enabled");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2012",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("enabled",
+ "enabled",
+ "Whether precision is enabled",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c
new file mode 100644
index 0000000..6e02cdd
--- /dev/null
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -0,0 +1,9622 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.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"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "config/gimpcoreconfig.h"
+#include "core/gimp.h"
+#include "core/gimpchannel.h"
+#include "core/gimpcontext.h"
+#include "core/gimpdrawable-operation.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpimage-color-profile.h"
+#include "core/gimpimage-crop.h"
+#include "core/gimpimage-resize.h"
+#include "core/gimpimage-rotate.h"
+#include "core/gimpimage-undo.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimppickable-auto-shrink.h"
+#include "core/gimppickable.h"
+#include "gegl/gimp-babl.h"
+#include "gegl/gimp-gegl-utils.h"
+
+#include "gimppdb.h"
+#include "gimppdberror.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GeglNode *
+wrap_in_graph (GeglNode *node)
+{
+ GeglNode *new_node;
+ GeglNode *input;
+ GeglNode *output;
+
+ new_node = gegl_node_new ();
+
+ gegl_node_add_child (new_node, node);
+ g_object_unref (node);
+
+ gimp_gegl_node_set_underlying_operation (new_node, node);
+
+ input = gegl_node_get_input_proxy (new_node, "input");
+ output = gegl_node_get_output_proxy (new_node, "output");
+
+ gegl_node_link_many (input,
+ node,
+ output,
+ NULL);
+
+ return new_node;
+}
+
+static GeglNode *
+wrap_in_selection_bounds (GeglNode *node,
+ GimpDrawable *drawable)
+{
+ gint x, y;
+ gint width, height;
+
+ if (gimp_item_mask_intersect (GIMP_ITEM (drawable),
+ &x, &y, &width, &height))
+ {
+ GeglNode *new_node;
+ GeglNode *input;
+ GeglNode *output;
+ GeglNode *translate_before;
+ GeglNode *crop;
+ GeglNode *translate_after;
+
+ new_node = gegl_node_new ();
+
+ gegl_node_add_child (new_node, node);
+ g_object_unref (node);
+
+ gimp_gegl_node_set_underlying_operation (new_node, node);
+
+ input = gegl_node_get_input_proxy (new_node, "input");
+ output = gegl_node_get_output_proxy (new_node, "output");
+
+ translate_before = gegl_node_new_child (new_node,
+ "operation", "gegl:translate",
+ "x", (gdouble) -x,
+ "y", (gdouble) -y,
+ NULL);
+ crop = gegl_node_new_child (new_node,
+ "operation", "gegl:crop",
+ "width", (gdouble) width,
+ "height", (gdouble) height,
+ NULL);
+ translate_after = gegl_node_new_child (new_node,
+ "operation", "gegl:translate",
+ "x", (gdouble) x,
+ "y", (gdouble) y,
+ NULL);
+
+ gegl_node_link_many (input,
+ translate_before,
+ crop,
+ node,
+ translate_after,
+ output,
+ NULL);
+
+ return new_node;
+ }
+ else
+ {
+ return node;
+ }
+}
+
+static GeglNode *
+wrap_in_gamma_cast (GeglNode *node,
+ GimpDrawable *drawable)
+{
+ if (! gimp_drawable_get_linear (drawable))
+ {
+ const Babl *drawable_format;
+ const Babl *cast_format;
+ GeglNode *new_node;
+ GeglNode *input;
+ GeglNode *output;
+ GeglNode *cast_before;
+ GeglNode *cast_after;
+
+ drawable_format = gimp_drawable_get_format (drawable);
+
+ cast_format =
+ gimp_babl_format (gimp_babl_format_get_base_type (drawable_format),
+ gimp_babl_precision (gimp_babl_format_get_component_type (drawable_format),
+ TRUE),
+ babl_format_has_alpha (drawable_format));
+
+ new_node = gegl_node_new ();
+
+ gegl_node_add_child (new_node, node);
+ g_object_unref (node);
+
+ gimp_gegl_node_set_underlying_operation (new_node, node);
+
+ input = gegl_node_get_input_proxy (new_node, "input");
+ output = gegl_node_get_output_proxy (new_node, "output");
+
+ cast_before = gegl_node_new_child (new_node,
+ "operation", "gegl:cast-format",
+ "input-format", drawable_format,
+ "output-format", cast_format,
+ NULL);
+ cast_after = gegl_node_new_child (new_node,
+ "operation", "gegl:cast-format",
+ "input-format", cast_format,
+ "output-format", drawable_format,
+ NULL);
+
+ gegl_node_link_many (input,
+ cast_before,
+ node,
+ cast_after,
+ output,
+ NULL);
+
+ return new_node;
+ }
+ else
+ {
+ return node;
+ }
+}
+
+static GeglNode *
+create_buffer_source_node (GeglNode *parent,
+ GimpDrawable *drawable)
+{
+ GeglNode *new_node;
+ GeglBuffer *buffer;
+
+ buffer = gimp_drawable_get_buffer (drawable);
+ g_object_ref (buffer);
+ new_node = gegl_node_new_child (parent,
+ "operation", "gegl:buffer-source",
+ "buffer", buffer,
+ NULL);
+ g_object_unref (buffer);
+ return new_node;
+}
+
+static gboolean
+bump_map (GimpDrawable *drawable,
+ GimpDrawable *bump_map,
+ gdouble azimuth,
+ gdouble elevation,
+ gint depth,
+ gint offset_x,
+ gint offset_y,
+ gdouble waterlevel,
+ gdouble ambient,
+ gboolean compensate,
+ gboolean invert,
+ gint type,
+ gboolean tiled,
+ GimpProgress *progress,
+ GError **error)
+{
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *graph;
+ GeglNode *node;
+ GeglNode *src_node;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:bump-map",
+ "tiled", tiled,
+ "type", type,
+ "compensate", compensate,
+ "invert", invert,
+ "azimuth", azimuth,
+ "elevation", elevation,
+ "depth", depth,
+ "offset_x", offset_x,
+ "offset_y", offset_y,
+ "waterlevel", waterlevel,
+ "ambient", ambient,
+ NULL);
+
+ graph = wrap_in_graph (node);
+
+ src_node = create_buffer_source_node (graph, bump_map);
+
+ gegl_node_connect_to (src_node, "output", node, "aux");
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Bump Map"),
+ graph);
+ g_object_unref (graph);
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+static gboolean
+displace (GimpDrawable *drawable,
+ gdouble amount_x,
+ gdouble amount_y,
+ gboolean do_x,
+ gboolean do_y,
+ GimpDrawable *displace_map_x,
+ GimpDrawable *displace_map_y,
+ gint displace_type,
+ gint displace_mode,
+ GimpProgress *progress,
+ GError **error)
+{
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ if (do_x || do_y)
+ {
+ GeglNode *graph;
+ GeglNode *node;
+ GeglAbyssPolicy abyss_policy = GEGL_ABYSS_NONE;
+
+ switch (displace_type)
+ {
+ case 1:
+ abyss_policy = GEGL_ABYSS_LOOP;
+ break;
+ case 2:
+ abyss_policy = GEGL_ABYSS_CLAMP;
+ break;
+ case 3:
+ abyss_policy = GEGL_ABYSS_BLACK;
+ break;
+ }
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:displace",
+ "displace_mode", displace_mode,
+ "sampler_type", GEGL_SAMPLER_CUBIC,
+ "abyss_policy", abyss_policy,
+ "amount_x", amount_x,
+ "amount_y", amount_y,
+ NULL);
+
+ graph = wrap_in_graph (node);
+
+ if (do_x)
+ {
+ GeglNode *src_node;
+ src_node = create_buffer_source_node (graph, displace_map_x);
+ gegl_node_connect_to (src_node, "output", node, "aux");
+ }
+
+ if (do_y)
+ {
+ GeglNode *src_node;
+ src_node = create_buffer_source_node (graph, displace_map_y);
+ gegl_node_connect_to (src_node, "output", node, "aux2");
+ }
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Displace"),
+ graph);
+ g_object_unref (graph);
+ }
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+static gboolean
+gaussian_blur (GimpDrawable *drawable,
+ gdouble horizontal,
+ gdouble vertical,
+ GimpProgress *progress,
+ GError **error)
+{
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:gaussian-blur",
+ "std-dev-x", horizontal * 0.32,
+ "std-dev-y", vertical * 0.32,
+ "abyss-policy", 1,
+ NULL);
+
+ node = wrap_in_gamma_cast (node, drawable);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Gaussian Blur"),
+ node);
+ g_object_unref (node);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gint
+newsprint_color_model (gint colorspace)
+{
+ switch (colorspace)
+ {
+ case 0: return 1; /* black on white */
+ case 1: return 2; /* rgb */
+ case 2: return 3; /* cmyk */
+ case 3: return 1; /* black on white */
+ }
+
+ return 2;
+}
+
+static gint
+newsprint_pattern (gint spotfn)
+{
+ switch (spotfn)
+ {
+ case 0: return 1; /* circle */
+ case 1: return 0; /* line */
+ case 2: return 2; /* diamond */
+ case 3: return 4; /* ps circle */
+ case 4: return 2; /* FIXME postscript diamond */
+ }
+
+ return 1;
+}
+
+static gdouble
+newsprint_angle (gdouble angle)
+{
+ while (angle > 180.0)
+ angle -= 360.0;
+
+ while (angle < -180.0)
+ angle += 360.0;
+
+ return angle;
+}
+
+static GimpValueArray *
+plug_in_alienmap2_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble redfrequency;
+ gdouble redangle;
+ gdouble greenfrequency;
+ gdouble greenangle;
+ gdouble bluefrequency;
+ gdouble blueangle;
+ guint8 colormodel;
+ guint8 redmode;
+ guint8 greenmode;
+ guint8 bluemode;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ redfrequency = g_value_get_double (gimp_value_array_index (args, 3));
+ redangle = g_value_get_double (gimp_value_array_index (args, 4));
+ greenfrequency = g_value_get_double (gimp_value_array_index (args, 5));
+ greenangle = g_value_get_double (gimp_value_array_index (args, 6));
+ bluefrequency = g_value_get_double (gimp_value_array_index (args, 7));
+ blueangle = g_value_get_double (gimp_value_array_index (args, 8));
+ colormodel = g_value_get_uint (gimp_value_array_index (args, 9));
+ redmode = g_value_get_uint (gimp_value_array_index (args, 10));
+ greenmode = g_value_get_uint (gimp_value_array_index (args, 11));
+ bluemode = g_value_get_uint (gimp_value_array_index (args, 12));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:alien-map",
+ "color-model", (gint) colormodel,
+ "cpn-1-frequency", (gdouble) redfrequency,
+ "cpn-2-frequency", (gdouble) greenfrequency,
+ "cpn-3-frequency", (gdouble) bluefrequency,
+ "cpn-1-phaseshift", (gdouble) redangle,
+ "cpn-2-phaseshift", (gdouble) greenangle,
+ "cpn-3-phaseshift", (gdouble) blueangle,
+ "cpn-1-keep", (gboolean) !redmode,
+ "cpn-2-keep", (gboolean) !greenmode,
+ "cpn-3-keep", (gboolean) !bluemode,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Alien Map"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_antialias_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:antialias",
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Antialias"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_apply_canvas_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 direction;
+ gint32 depth;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ direction = g_value_get_int (gimp_value_array_index (args, 3));
+ depth = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:texturize-canvas",
+ "direction", direction,
+ "depth", depth,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Apply Canvas"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_applylens_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble refraction;
+ gboolean keep_surroundings;
+ gboolean set_background;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ refraction = g_value_get_double (gimp_value_array_index (args, 3));
+ keep_surroundings = g_value_get_boolean (gimp_value_array_index (args, 4));
+ set_background = g_value_get_boolean (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpRGB color;
+ GeglColor *gegl_color;
+ GeglNode *node;
+
+ if (set_background)
+ gimp_context_get_background (context, &color);
+ else
+ gimp_rgba_set (&color, 0.0, 0.0, 0.0, 0.0);
+
+ gegl_color = gimp_gegl_color_new (&color);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:apply-lens",
+ "refraction-index", refraction,
+ "keep-surroundings", keep_surroundings,
+ "background-color", gegl_color,
+ NULL);
+
+ g_object_unref (gegl_color);
+
+ node = wrap_in_selection_bounds (node, drawable);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Apply Lens"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_autocrop_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpDrawable *drawable;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gint x, y, width, height;
+ gint off_x, off_y;
+
+ gimp_pickable_auto_shrink (GIMP_PICKABLE (drawable),
+ 0, 0,
+ gimp_item_get_width (GIMP_ITEM (drawable)),
+ gimp_item_get_height (GIMP_ITEM (drawable)),
+ &x, &y, &width, &height);
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+ x += off_x;
+ y += off_y;
+
+ gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_RESIZE,
+ _("Autocrop image"));
+
+ if (x < 0 ||
+ y < 0 ||
+ x + width > gimp_image_get_width (image) ||
+ y + height > gimp_image_get_height (image))
+ {
+ /*
+ * partially outside the image area, we need to
+ * resize the image to be able to crop properly.
+ */
+ gimp_image_resize (image, context, width, height, -x, -y, NULL);
+
+ x = y = 0;
+ }
+
+ gimp_image_crop (image, context, GIMP_FILL_TRANSPARENT,
+ x, y, width, height, TRUE);
+
+ gimp_image_undo_group_end (image);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_autocrop_layer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpDrawable *drawable;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error))
+ {
+ GimpLayer *layer = gimp_image_get_active_layer (image);
+ gint x, y, width, height;
+
+ if (layer)
+ {
+ switch (gimp_pickable_auto_shrink (GIMP_PICKABLE (drawable),
+ 0, 0,
+ gimp_item_get_width (GIMP_ITEM (drawable)),
+ gimp_item_get_height (GIMP_ITEM (drawable)),
+ &x, &y, &width, &height))
+ {
+ case GIMP_AUTO_SHRINK_SHRINK:
+ gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_RESIZE,
+ _("Autocrop layer"));
+
+ gimp_item_resize (GIMP_ITEM (layer),
+ context, GIMP_FILL_TRANSPARENT,
+ width, height, -x, -y);
+
+ gimp_image_undo_group_end (image);
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_autostretch_hsv_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:stretch-contrast-hsv",
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Stretch Contrast HSV"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_bump_map_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ GimpDrawable *bumpmap;
+ gdouble azimuth;
+ gdouble elevation;
+ gint32 depth;
+ gint32 xofs;
+ gint32 yofs;
+ gdouble waterlevel;
+ gdouble ambient;
+ gboolean compensate;
+ gboolean invert;
+ gint32 type;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ bumpmap = gimp_value_get_drawable (gimp_value_array_index (args, 3), gimp);
+ azimuth = g_value_get_double (gimp_value_array_index (args, 4));
+ elevation = g_value_get_double (gimp_value_array_index (args, 5));
+ depth = g_value_get_int (gimp_value_array_index (args, 6));
+ xofs = g_value_get_int (gimp_value_array_index (args, 7));
+ yofs = g_value_get_int (gimp_value_array_index (args, 8));
+ waterlevel = g_value_get_double (gimp_value_array_index (args, 9));
+ ambient = g_value_get_double (gimp_value_array_index (args, 10));
+ compensate = g_value_get_boolean (gimp_value_array_index (args, 11));
+ invert = g_value_get_boolean (gimp_value_array_index (args, 12));
+ type = g_value_get_int (gimp_value_array_index (args, 13));
+
+ if (success)
+ {
+ success = bump_map (drawable,
+ bumpmap,
+ azimuth,
+ elevation,
+ depth,
+ xofs,
+ yofs,
+ waterlevel,
+ ambient,
+ compensate,
+ invert,
+ type,
+ FALSE,
+ progress,
+ error);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_bump_map_tiled_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ GimpDrawable *bumpmap;
+ gdouble azimuth;
+ gdouble elevation;
+ gint32 depth;
+ gint32 xofs;
+ gint32 yofs;
+ gdouble waterlevel;
+ gdouble ambient;
+ gboolean compensate;
+ gboolean invert;
+ gint32 type;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ bumpmap = gimp_value_get_drawable (gimp_value_array_index (args, 3), gimp);
+ azimuth = g_value_get_double (gimp_value_array_index (args, 4));
+ elevation = g_value_get_double (gimp_value_array_index (args, 5));
+ depth = g_value_get_int (gimp_value_array_index (args, 6));
+ xofs = g_value_get_int (gimp_value_array_index (args, 7));
+ yofs = g_value_get_int (gimp_value_array_index (args, 8));
+ waterlevel = g_value_get_double (gimp_value_array_index (args, 9));
+ ambient = g_value_get_double (gimp_value_array_index (args, 10));
+ compensate = g_value_get_boolean (gimp_value_array_index (args, 11));
+ invert = g_value_get_boolean (gimp_value_array_index (args, 12));
+ type = g_value_get_int (gimp_value_array_index (args, 13));
+
+ if (success)
+ {
+ success = bump_map (drawable,
+ bumpmap,
+ azimuth,
+ elevation,
+ depth,
+ xofs,
+ yofs,
+ waterlevel,
+ ambient,
+ compensate,
+ invert,
+ type,
+ TRUE,
+ progress,
+ error);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_c_astretch_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:stretch-contrast",
+ "keep-colors", (gboolean) FALSE,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Stretch Contrast"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_colors_channel_mixer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 monochrome;
+ gdouble rr_gain;
+ gdouble rg_gain;
+ gdouble rb_gain;
+ gdouble gr_gain;
+ gdouble gg_gain;
+ gdouble gb_gain;
+ gdouble br_gain;
+ gdouble bg_gain;
+ gdouble bb_gain;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ monochrome = g_value_get_int (gimp_value_array_index (args, 3));
+ rr_gain = g_value_get_double (gimp_value_array_index (args, 4));
+ rg_gain = g_value_get_double (gimp_value_array_index (args, 5));
+ rb_gain = g_value_get_double (gimp_value_array_index (args, 6));
+ gr_gain = g_value_get_double (gimp_value_array_index (args, 7));
+ gg_gain = g_value_get_double (gimp_value_array_index (args, 8));
+ gb_gain = g_value_get_double (gimp_value_array_index (args, 9));
+ br_gain = g_value_get_double (gimp_value_array_index (args, 10));
+ bg_gain = g_value_get_double (gimp_value_array_index (args, 11));
+ bb_gain = g_value_get_double (gimp_value_array_index (args, 12));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node = NULL;
+
+ if (monochrome)
+ {
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:mono-mixer",
+ "red", rr_gain,
+ "green", rg_gain,
+ "blue", rb_gain,
+ NULL);
+ }
+ else
+ {
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:channel-mixer",
+ "rr-gain", rr_gain,
+ "rg-gain", rg_gain,
+ "rb-gain", rb_gain,
+ "gr-gain", gr_gain,
+ "gg-gain", gg_gain,
+ "gb-gain", gb_gain,
+ "br-gain", br_gain,
+ "bg-gain", bg_gain,
+ "bb-gain", bb_gain,
+ NULL);
+ }
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Channel Mixer"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_colortoalpha_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ GimpRGB color;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ gimp_value_get_rgb (gimp_value_array_index (args, 3), &color);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglColor *gegl_color = gimp_gegl_color_new (&color);
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:color-to-alpha",
+ "color", gegl_color,
+ NULL);
+ g_object_unref (gegl_color);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Color to Alpha"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_convmatrix_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 argc_matrix;
+ const gdouble *matrix;
+ gboolean alpha_alg;
+ gdouble divisor;
+ gdouble offset;
+ gint32 argc_channels;
+ const gint32 *channels;
+ gint32 bmode;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ argc_matrix = g_value_get_int (gimp_value_array_index (args, 3));
+ matrix = gimp_value_get_floatarray (gimp_value_array_index (args, 4));
+ alpha_alg = g_value_get_boolean (gimp_value_array_index (args, 5));
+ divisor = g_value_get_double (gimp_value_array_index (args, 6));
+ offset = g_value_get_double (gimp_value_array_index (args, 7));
+ argc_channels = g_value_get_int (gimp_value_array_index (args, 8));
+ channels = gimp_value_get_int32array (gimp_value_array_index (args, 9));
+ bmode = g_value_get_int (gimp_value_array_index (args, 10));
+
+ if (success)
+ {
+ if (argc_matrix != 25)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Array 'matrix' has only %d members, must have 25"),
+ argc_matrix);
+ success = FALSE;
+ }
+
+ if (success && argc_channels != 5)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Array 'channels' has only %d members, must have 5"),
+ argc_channels);
+ success = FALSE;
+ }
+
+ if (success &&
+ gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ GeglAbyssPolicy border = GEGL_ABYSS_CLAMP;
+ gboolean r = channels[1];
+ gboolean g = channels[2];
+ gboolean b = channels[3];
+ gboolean a = channels[4];
+
+ if (gimp_drawable_is_gray (drawable))
+ {
+ r = channels[0];
+ g = channels[0];
+ b = channels[0];
+ }
+
+ switch (bmode)
+ {
+ case 0: border = GEGL_ABYSS_CLAMP; break;
+ case 1: border = GEGL_ABYSS_LOOP; break;
+ case 2: border = GEGL_ABYSS_NONE; break;
+ }
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:convolution-matrix",
+ "a1", matrix[0],
+ "a2", matrix[1],
+ "a3", matrix[2],
+ "a4", matrix[3],
+ "a5", matrix[4],
+ "b1", matrix[5],
+ "b2", matrix[6],
+ "b3", matrix[7],
+ "b4", matrix[8],
+ "b5", matrix[9],
+ "c1", matrix[10],
+ "c2", matrix[11],
+ "c3", matrix[12],
+ "c4", matrix[13],
+ "c5", matrix[14],
+ "d1", matrix[15],
+ "d2", matrix[16],
+ "d3", matrix[17],
+ "d4", matrix[18],
+ "d5", matrix[19],
+ "e1", matrix[20],
+ "e2", matrix[21],
+ "e3", matrix[22],
+ "e4", matrix[23],
+ "e5", matrix[24],
+ "divisor", divisor,
+ "offset", offset,
+ "red", r,
+ "green", g,
+ "blue", b,
+ "alpha", a,
+ "normalize", FALSE,
+ "alpha-weight", alpha_alg,
+ "border", border,
+ NULL);
+
+ node = wrap_in_gamma_cast (node, drawable);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Convolution Matrix"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_cubism_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble tile_size;
+ gdouble tile_saturation;
+ gint32 bg_color;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ tile_size = g_value_get_double (gimp_value_array_index (args, 3));
+ tile_saturation = g_value_get_double (gimp_value_array_index (args, 4));
+ bg_color = g_value_get_int (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpRGB color;
+ GeglColor *gegl_color;
+ GeglNode *node;
+
+ if (bg_color)
+ {
+ gimp_context_get_background (context, &color);
+ gimp_rgb_set_alpha (&color, 0.0);
+ }
+ else
+ {
+ gimp_rgba_set (&color, 0.0, 0.0, 0.0, 0.0);
+ }
+
+ gegl_color = gimp_gegl_color_new (&color);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:cubism",
+ "tile-size", tile_size,
+ "tile-saturation", tile_saturation,
+ "bg-color", gegl_color,
+ NULL);
+ g_object_unref (gegl_color);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Cubism"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_deinterlace_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 evenodd;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ evenodd = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:deinterlace",
+ "keep", evenodd ? 0 : 1,
+ "orientation", 0, /* HORIZONTAL */
+ "size", 1,
+ NULL);
+
+ node = wrap_in_gamma_cast (node, drawable);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Deinterlace"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_diffraction_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble lam_r;
+ gdouble lam_g;
+ gdouble lam_b;
+ gdouble contour_r;
+ gdouble contour_g;
+ gdouble contour_b;
+ gdouble edges_r;
+ gdouble edges_g;
+ gdouble edges_b;
+ gdouble brightness;
+ gdouble scattering;
+ gdouble polarization;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ lam_r = g_value_get_double (gimp_value_array_index (args, 3));
+ lam_g = g_value_get_double (gimp_value_array_index (args, 4));
+ lam_b = g_value_get_double (gimp_value_array_index (args, 5));
+ contour_r = g_value_get_double (gimp_value_array_index (args, 6));
+ contour_g = g_value_get_double (gimp_value_array_index (args, 7));
+ contour_b = g_value_get_double (gimp_value_array_index (args, 8));
+ edges_r = g_value_get_double (gimp_value_array_index (args, 9));
+ edges_g = g_value_get_double (gimp_value_array_index (args, 10));
+ edges_b = g_value_get_double (gimp_value_array_index (args, 11));
+ brightness = g_value_get_double (gimp_value_array_index (args, 12));
+ scattering = g_value_get_double (gimp_value_array_index (args, 13));
+ polarization = g_value_get_double (gimp_value_array_index (args, 14));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ gint x, y, width, height;
+
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:diffraction-patterns",
+ "red-frequency", lam_r,
+ "green-frequency", lam_g,
+ "blue-frequency", lam_b,
+ "red-contours", contour_r,
+ "green-contours", contour_g,
+ "blue-contours", contour_b,
+ "red-sedges", edges_r,
+ "green-sedges", edges_g,
+ "blue-sedges", edges_b,
+ "brightness", brightness,
+ "scattering", scattering,
+ "polarization", polarization,
+ "width", width,
+ "height", height,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Diffraction Patterns"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_displace_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble amount_x;
+ gdouble amount_y;
+ gboolean do_x;
+ gboolean do_y;
+ GimpDrawable *displace_map_x;
+ GimpDrawable *displace_map_y;
+ gint32 displace_type;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ amount_x = g_value_get_double (gimp_value_array_index (args, 3));
+ amount_y = g_value_get_double (gimp_value_array_index (args, 4));
+ do_x = g_value_get_boolean (gimp_value_array_index (args, 5));
+ do_y = g_value_get_boolean (gimp_value_array_index (args, 6));
+ displace_map_x = gimp_value_get_drawable (gimp_value_array_index (args, 7), gimp);
+ displace_map_y = gimp_value_get_drawable (gimp_value_array_index (args, 8), gimp);
+ displace_type = g_value_get_int (gimp_value_array_index (args, 9));
+
+ if (success)
+ {
+ success = displace (drawable,
+ amount_x,
+ amount_y,
+ do_x,
+ do_y,
+ displace_map_x,
+ displace_map_y,
+ displace_type,
+ 0,
+ progress,
+ error);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_displace_polar_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble amount_x;
+ gdouble amount_y;
+ gboolean do_x;
+ gboolean do_y;
+ GimpDrawable *displace_map_x;
+ GimpDrawable *displace_map_y;
+ gint32 displace_type;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ amount_x = g_value_get_double (gimp_value_array_index (args, 3));
+ amount_y = g_value_get_double (gimp_value_array_index (args, 4));
+ do_x = g_value_get_boolean (gimp_value_array_index (args, 5));
+ do_y = g_value_get_boolean (gimp_value_array_index (args, 6));
+ displace_map_x = gimp_value_get_drawable (gimp_value_array_index (args, 7), gimp);
+ displace_map_y = gimp_value_get_drawable (gimp_value_array_index (args, 8), gimp);
+ displace_type = g_value_get_int (gimp_value_array_index (args, 9));
+
+ if (success)
+ {
+ success = displace (drawable,
+ amount_x,
+ amount_y,
+ do_x,
+ do_y,
+ displace_map_x,
+ displace_map_y,
+ displace_type,
+ 1,
+ progress,
+ error);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_edge_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble amount;
+ gint32 warpmode;
+ gint32 edgemode;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ amount = g_value_get_double (gimp_value_array_index (args, 3));
+ warpmode = g_value_get_int (gimp_value_array_index (args, 4));
+ edgemode = g_value_get_int (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ GeglAbyssPolicy border_behavior = GEGL_ABYSS_NONE;
+
+ switch (warpmode)
+ {
+ case 0:
+ border_behavior = GEGL_ABYSS_NONE;
+ break;
+
+ case 1:
+ border_behavior = GEGL_ABYSS_LOOP;
+ break;
+
+ case 2:
+ border_behavior = GEGL_ABYSS_CLAMP;
+ break;
+
+ case 3:
+ border_behavior = GEGL_ABYSS_BLACK;
+ break;
+ }
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:edge",
+ "algorithm", edgemode,
+ "amount", amount,
+ "border-behavior", border_behavior,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Edge"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_engrave_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 height;
+ gboolean limit;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ height = g_value_get_int (gimp_value_array_index (args, 3));
+ limit = g_value_get_boolean (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:engrave",
+ "row-height", height,
+ "limit", limit,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Engrave"),
+ node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_exchange_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ guint8 from_red;
+ guint8 from_green;
+ guint8 from_blue;
+ guint8 to_red;
+ guint8 to_green;
+ guint8 to_blue;
+ guint8 red_threshold;
+ guint8 green_threshold;
+ guint8 blue_threshold;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ from_red = g_value_get_uint (gimp_value_array_index (args, 3));
+ from_green = g_value_get_uint (gimp_value_array_index (args, 4));
+ from_blue = g_value_get_uint (gimp_value_array_index (args, 5));
+ to_red = g_value_get_uint (gimp_value_array_index (args, 6));
+ to_green = g_value_get_uint (gimp_value_array_index (args, 7));
+ to_blue = g_value_get_uint (gimp_value_array_index (args, 8));
+ red_threshold = g_value_get_uint (gimp_value_array_index (args, 9));
+ green_threshold = g_value_get_uint (gimp_value_array_index (args, 10));
+ blue_threshold = g_value_get_uint (gimp_value_array_index (args, 11));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpRGB from;
+ GimpRGB to;
+ GeglColor *gegl_from;
+ GeglColor *gegl_to;
+ GeglNode *node;
+
+ gimp_rgb_set_uchar (&from, from_red, from_green, from_blue);
+ gimp_rgb_set_uchar (&to, to_red, to_green, to_blue);
+
+ gegl_from = gimp_gegl_color_new (&from);
+ gegl_to = gimp_gegl_color_new (&to);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:color-exchange",
+ "from-color", gegl_from,
+ "to-color", gegl_to,
+ "red-threshold", red_threshold / 255.0,
+ "green-threshold", green_threshold / 255.0,
+ "blue-threshold", blue_threshold / 255.0,
+ NULL);
+
+ g_object_unref (gegl_from);
+ g_object_unref (gegl_to);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Color Exchange"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_flarefx_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 pos_x;
+ gint32 pos_y;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ pos_x = g_value_get_int (gimp_value_array_index (args, 3));
+ pos_y = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ gint width = gimp_item_get_width (GIMP_ITEM (drawable));
+ gint height = gimp_item_get_height (GIMP_ITEM (drawable));
+ gdouble x = (gdouble) pos_x / (gdouble) width;
+ gdouble y = (gdouble) pos_y / (gdouble) height;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:lens-flare",
+ "pos-x", x,
+ "pos-y", y,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Lens Flare"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_gauss_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble horizontal;
+ gdouble vertical;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ horizontal = g_value_get_double (gimp_value_array_index (args, 3));
+ vertical = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ success = gaussian_blur (drawable, horizontal, vertical, progress, error);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_gauss_iir_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble radius;
+ gboolean horizontal;
+ gboolean vertical;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ radius = g_value_get_double (gimp_value_array_index (args, 3));
+ horizontal = g_value_get_boolean (gimp_value_array_index (args, 4));
+ vertical = g_value_get_boolean (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ success = gaussian_blur (drawable,
+ horizontal ? radius : 0.0,
+ vertical ? radius : 0.0,
+ progress, error);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_gauss_iir2_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble horizontal;
+ gdouble vertical;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ horizontal = g_value_get_double (gimp_value_array_index (args, 3));
+ vertical = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ success = gaussian_blur (drawable, horizontal, vertical, progress, error);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_gauss_rle_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble radius;
+ gboolean horizontal;
+ gboolean vertical;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ radius = g_value_get_double (gimp_value_array_index (args, 3));
+ horizontal = g_value_get_boolean (gimp_value_array_index (args, 4));
+ vertical = g_value_get_boolean (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ success = gaussian_blur (drawable,
+ horizontal ? radius : 0.0,
+ vertical ? radius : 0.0,
+ progress, error);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_gauss_rle2_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble horizontal;
+ gdouble vertical;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ horizontal = g_value_get_double (gimp_value_array_index (args, 3));
+ vertical = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ success = gaussian_blur (drawable, horizontal, vertical, progress, error);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_glasstile_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 tilex;
+ gint32 tiley;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ tilex = g_value_get_int (gimp_value_array_index (args, 3));
+ tiley = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:tile-glass",
+ "tile-width", tilex,
+ "tile-height", tiley,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Glass Tile"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_hsv_noise_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 holdness;
+ gint32 hue_distance;
+ gint32 saturation_distance;
+ gint32 value_distance;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ holdness = g_value_get_int (gimp_value_array_index (args, 3));
+ hue_distance = g_value_get_int (gimp_value_array_index (args, 4));
+ saturation_distance = g_value_get_int (gimp_value_array_index (args, 5));
+ value_distance = g_value_get_int (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+
+ gdouble saturation = saturation_distance / 255.0;
+ gdouble value = value_distance / 255.0;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:noise-hsv",
+ "holdness", (gint) holdness,
+ "hue-distance", (gdouble) hue_distance,
+ "saturation-distance", (gdouble) saturation,
+ "value-distance", (gdouble) value,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Noise HSV"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_icc_profile_info_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gchar *profile_name = NULL;
+ gchar *profile_desc = NULL;
+ gchar *profile_info = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpColorProfile *profile;
+
+ profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
+
+ if (profile)
+ {
+ profile_name = g_strdup (gimp_color_profile_get_model (profile));
+ profile_desc = g_strdup (gimp_color_profile_get_description (profile));
+ profile_info = g_strdup (gimp_color_profile_get_summary (profile));
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_take_string (gimp_value_array_index (return_vals, 1), profile_name);
+ g_value_take_string (gimp_value_array_index (return_vals, 2), profile_desc);
+ g_value_take_string (gimp_value_array_index (return_vals, 3), profile_info);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+plug_in_icc_profile_file_info_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *profile;
+ gchar *profile_name = NULL;
+ gchar *profile_desc = NULL;
+ gchar *profile_info = NULL;
+
+ profile = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GFile *file = g_file_new_for_path (profile);
+
+ if (file)
+ {
+ GimpColorProfile *p;
+
+ p = gimp_color_profile_new_from_file (file, error);
+ g_object_unref (file);
+
+ if (p)
+ {
+ profile_name = g_strdup (gimp_color_profile_get_model (p));
+ profile_desc = g_strdup (gimp_color_profile_get_description (p));
+ profile_info = g_strdup (gimp_color_profile_get_summary (p));
+
+ g_object_unref (p);
+ }
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_take_string (gimp_value_array_index (return_vals, 1), profile_name);
+ g_value_take_string (gimp_value_array_index (return_vals, 2), profile_desc);
+ g_value_take_string (gimp_value_array_index (return_vals, 3), profile_info);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+plug_in_icc_profile_apply_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *profile;
+ gint32 intent;
+ gboolean bpc;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+ profile = g_value_get_string (gimp_value_array_index (args, 2));
+ intent = g_value_get_enum (gimp_value_array_index (args, 3));
+ bpc = g_value_get_boolean (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
+ {
+ GimpColorProfile *p = NULL;
+
+ if (profile)
+ {
+ GFile *file = g_file_new_for_path (profile);
+
+ if (file)
+ {
+ p = gimp_color_profile_new_from_file (file, error);
+
+ if (! p)
+ success = FALSE;
+
+ g_object_unref (file);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+ else if (image->gimp->config->color_management->rgb_profile)
+ {
+ p = gimp_color_config_get_rgb_color_profile (image->gimp->config->color_management,
+ error);
+
+ if (! p)
+ success = FALSE;
+ }
+
+ if (success)
+ {
+ if (! p)
+ p = gimp_image_get_builtin_color_profile (image);
+
+ success = gimp_image_convert_color_profile (image, p, intent, bpc,
+ progress, error);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_icc_profile_apply_rgb_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 intent;
+ gboolean bpc;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+ intent = g_value_get_enum (gimp_value_array_index (args, 2));
+ bpc = g_value_get_boolean (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
+ {
+ GimpColorProfile *p = NULL;
+
+ if (image->gimp->config->color_management->rgb_profile)
+ {
+ p = gimp_color_config_get_rgb_color_profile (image->gimp->config->color_management,
+ error);
+
+ if (! p)
+ success = FALSE;
+ }
+
+ if (success)
+ {
+ if (! p)
+ p = gimp_image_get_builtin_color_profile (image);
+
+ success = gimp_image_convert_color_profile (image, p, intent, bpc,
+ progress, error);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_icc_profile_set_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *profile;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+ profile = g_value_get_string (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
+ {
+ GimpColorProfile *p = NULL;
+
+ if (profile)
+ {
+ GFile *file = g_file_new_for_path (profile);
+
+ if (file)
+ {
+ p = gimp_color_profile_new_from_file (file, error);
+
+ if (! p)
+ success = FALSE;
+
+ g_object_unref (file);
+ }
+ else
+ success = FALSE;
+ }
+ else if (image->gimp->config->color_management->rgb_profile)
+ {
+ p = gimp_color_config_get_rgb_color_profile (image->gimp->config->color_management,
+ error);
+
+ if (! p)
+ success = FALSE;
+ }
+
+ if (success)
+ {
+ gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_MISC,
+ _("Set color profile"));
+
+ if (gimp_image_set_color_profile (image, p, error))
+ gimp_image_parasite_detach (image, "icc-profile-name", TRUE);
+ else
+ success = FALSE;
+
+ gimp_image_undo_group_end (image);
+
+ if (! success)
+ gimp_image_undo (image);
+
+ if (p)
+ g_object_unref (p);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_icc_profile_set_rgb_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
+ {
+ GimpColorProfile *p = NULL;
+
+ if (image->gimp->config->color_management->rgb_profile)
+ {
+ p = gimp_color_config_get_rgb_color_profile (image->gimp->config->color_management,
+ error);
+
+ if (! p)
+ success = FALSE;
+ }
+
+ if (success)
+ {
+ gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_MISC,
+ _("Set color profile"));
+
+ if (gimp_image_set_color_profile (image, p, error))
+ gimp_image_parasite_detach (image, "icc-profile-name", TRUE);
+ else
+ success = FALSE;
+
+ gimp_image_undo_group_end (image);
+
+ if (! success)
+ gimp_image_undo (image);
+
+ if (p)
+ g_object_unref (p);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_illusion_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 division;
+ gint32 type;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ division = g_value_get_int (gimp_value_array_index (args, 3));
+ type = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:illusion",
+ "division", (gint) division,
+ "illusion-type", (gint) type,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Illusion"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_laplace_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:edge-laplace",
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Laplace"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_lens_distortion_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble offset_x;
+ gdouble offset_y;
+ gdouble main_adjust;
+ gdouble edge_adjust;
+ gdouble rescale;
+ gdouble brighten;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ offset_x = g_value_get_double (gimp_value_array_index (args, 3));
+ offset_y = g_value_get_double (gimp_value_array_index (args, 4));
+ main_adjust = g_value_get_double (gimp_value_array_index (args, 5));
+ edge_adjust = g_value_get_double (gimp_value_array_index (args, 6));
+ rescale = g_value_get_double (gimp_value_array_index (args, 7));
+ brighten = g_value_get_double (gimp_value_array_index (args, 8));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node = NULL;
+ GimpRGB color;
+ GeglColor *gegl_color;
+
+ gimp_context_get_background (context, &color);
+
+ if (gimp_drawable_has_alpha (drawable))
+ {
+ gimp_rgb_set_alpha (&color, 0.0);
+ }
+ else
+ {
+ gimp_rgb_set_alpha (&color, 1.0);
+ }
+
+ gegl_color = gimp_gegl_color_new (&color);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:lens-distortion",
+ "main", (gdouble) main_adjust,
+ "edge", (gdouble) edge_adjust,
+ "zoom", (gdouble) rescale,
+ "x-shift", (gdouble) offset_x,
+ "y-shift", (gdouble) offset_y,
+ "brighten", (gdouble) brighten,
+ "background", gegl_color,
+ NULL);
+
+ g_object_unref (gegl_color);
+
+ node = wrap_in_selection_bounds (node, drawable);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Lens Distortion"),
+ node);
+ g_object_unref (node);
+
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_make_seamless_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:tile-seamless",
+ NULL);
+
+ node = wrap_in_selection_bounds (node, drawable);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Tile Seamless"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_maze_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint16 width;
+ gint16 height;
+ guint8 tileable;
+ guint8 algorithm;
+ gint32 seed;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ width = g_value_get_int (gimp_value_array_index (args, 3));
+ height = g_value_get_int (gimp_value_array_index (args, 4));
+ tileable = g_value_get_uint (gimp_value_array_index (args, 5));
+ algorithm = g_value_get_uint (gimp_value_array_index (args, 6));
+ seed = g_value_get_int (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ GeglColor *fg_color;
+ GeglColor *bg_color;
+ GimpRGB color;
+
+ gimp_context_get_foreground (context, &color);
+ fg_color = gimp_gegl_color_new (&color);
+
+ gimp_context_get_background (context, &color);
+ bg_color = gimp_gegl_color_new (&color);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:maze",
+ "x", width,
+ "y", height,
+ "algorithm-type", algorithm,
+ "tileable", tileable,
+ "seed", seed,
+ "fg-color", fg_color,
+ "bg-color", bg_color,
+ NULL);
+
+ g_object_unref (fg_color);
+ g_object_unref (bg_color);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Maze"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_mblur_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 type;
+ gdouble length;
+ gdouble angle;
+ gdouble center_x;
+ gdouble center_y;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ type = g_value_get_int (gimp_value_array_index (args, 3));
+ length = g_value_get_double (gimp_value_array_index (args, 4));
+ angle = g_value_get_double (gimp_value_array_index (args, 5));
+ center_x = g_value_get_double (gimp_value_array_index (args, 6));
+ center_y = g_value_get_double (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node = NULL;
+ gint width = gimp_item_get_width (GIMP_ITEM (drawable));
+ gint height = gimp_item_get_height (GIMP_ITEM (drawable));
+
+ center_x /= (gdouble) width;
+ center_y /= (gdouble) height;
+
+ if (angle > 180.0)
+ angle -= 360.0;
+
+ if (type == 0)
+ {
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:motion-blur-linear",
+ "length", length,
+ "angle", angle,
+ NULL);
+ }
+ else if (type == 1)
+ {
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:motion-blur-circular",
+ "center-x", center_x,
+ "center-y", center_y,
+ "angle", angle,
+ NULL);
+ }
+ else if (type == 2)
+ {
+ gdouble factor = CLAMP (length / 256.0, 0.0, 1.0);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:motion-blur-zoom",
+ "center-x", center_x,
+ "center-y", center_y,
+ "factor", factor,
+ NULL);
+ }
+
+ if (node != NULL)
+ {
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Motion Blur"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_mblur_inward_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 type;
+ gdouble length;
+ gdouble angle;
+ gdouble center_x;
+ gdouble center_y;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ type = g_value_get_int (gimp_value_array_index (args, 3));
+ length = g_value_get_double (gimp_value_array_index (args, 4));
+ angle = g_value_get_double (gimp_value_array_index (args, 5));
+ center_x = g_value_get_double (gimp_value_array_index (args, 6));
+ center_y = g_value_get_double (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node = NULL;
+ gint width = gimp_item_get_width (GIMP_ITEM (drawable));
+ gint height = gimp_item_get_height (GIMP_ITEM (drawable));
+
+ center_x /= (gdouble) width;
+ center_y /= (gdouble) height;
+
+ if (type == 0)
+ {
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:motion-blur-linear",
+ "length", length,
+ "angle", angle,
+ NULL);
+ }
+ else if (type == 1)
+ {
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:motion-blur-circular",
+ "center-x", center_x,
+ "center-y", center_y,
+ "angle", angle,
+ NULL);
+ }
+ else if (type == 2)
+ {
+ gdouble factor = CLAMP (-length / (256.0 - length), -10.0, 0.0);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:motion-blur-zoom",
+ "center-x", center_x,
+ "center-y", center_y,
+ "factor", factor,
+ NULL);
+ }
+
+ if (node != NULL)
+ {
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Motion Blur"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_median_blur_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 radius;
+ gdouble percentile;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ radius = g_value_get_int (gimp_value_array_index (args, 3));
+ percentile = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:median-blur",
+ "radius", radius,
+ "percentile", percentile,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Median Blur"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_mosaic_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble tile_size;
+ gdouble tile_height;
+ gdouble tile_spacing;
+ gdouble tile_neatness;
+ gint32 tile_allow_split;
+ gdouble light_dir;
+ gdouble color_variation;
+ gint32 antialiasing;
+ gint32 color_averaging;
+ gint32 tile_type;
+ gint32 tile_surface;
+ gint32 grout_color;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ tile_size = g_value_get_double (gimp_value_array_index (args, 3));
+ tile_height = g_value_get_double (gimp_value_array_index (args, 4));
+ tile_spacing = g_value_get_double (gimp_value_array_index (args, 5));
+ tile_neatness = g_value_get_double (gimp_value_array_index (args, 6));
+ tile_allow_split = g_value_get_int (gimp_value_array_index (args, 7));
+ light_dir = g_value_get_double (gimp_value_array_index (args, 8));
+ color_variation = g_value_get_double (gimp_value_array_index (args, 9));
+ antialiasing = g_value_get_int (gimp_value_array_index (args, 10));
+ color_averaging = g_value_get_int (gimp_value_array_index (args, 11));
+ tile_type = g_value_get_int (gimp_value_array_index (args, 12));
+ tile_surface = g_value_get_int (gimp_value_array_index (args, 13));
+ grout_color = g_value_get_int (gimp_value_array_index (args, 14));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglColor *fg_color;
+ GeglColor *bg_color;
+ GeglNode *node;
+
+ if (grout_color)
+ {
+ GimpRGB fgcolor, bgcolor;
+
+ gimp_context_get_background (context, &bgcolor);
+ bg_color = gimp_gegl_color_new (&bgcolor);
+
+ gimp_context_get_foreground (context, &fgcolor);
+ fg_color = gimp_gegl_color_new (&fgcolor);
+ }
+ else
+ {
+ /* sic */
+ fg_color = gegl_color_new ("white");
+ bg_color = gegl_color_new ("black");
+ }
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:mosaic",
+ "tile-size", (gdouble) tile_size,
+ "tile-height", (gdouble) tile_height,
+ "tile-spacing", (gdouble) tile_spacing,
+ "tile-neatness", (gdouble) tile_neatness,
+ "tile-allow-split", (gboolean) tile_allow_split,
+ "light-dir", (gdouble) light_dir,
+ "color-variation", (gfloat) color_variation,
+ "antialiasing", (gboolean) antialiasing,
+ "color-averaging", (gboolean) color_averaging,
+ "tile-type", (gint) tile_type,
+ "tile-surface", (gboolean) tile_surface,
+ "light-color", fg_color,
+ "joints-color", bg_color,
+ NULL);
+
+ g_object_unref (fg_color);
+ g_object_unref (bg_color);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Mosaic"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_neon_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble radius;
+ gdouble amount;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ radius = g_value_get_double (gimp_value_array_index (args, 3));
+ amount = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:edge-neon",
+ "radius", radius,
+ "amount", amount,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Neon"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_newsprint_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 cell_width;
+ gint32 colorspace;
+ gint32 k_pullout;
+ gdouble gry_ang;
+ gint32 gry_spotfn;
+ gdouble red_ang;
+ gint32 red_spotfn;
+ gdouble grn_ang;
+ gint32 grn_spotfn;
+ gdouble blu_ang;
+ gint32 blu_spotfn;
+ gint32 oversample;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ cell_width = g_value_get_int (gimp_value_array_index (args, 3));
+ colorspace = g_value_get_int (gimp_value_array_index (args, 4));
+ k_pullout = g_value_get_int (gimp_value_array_index (args, 5));
+ gry_ang = g_value_get_double (gimp_value_array_index (args, 6));
+ gry_spotfn = g_value_get_int (gimp_value_array_index (args, 7));
+ red_ang = g_value_get_double (gimp_value_array_index (args, 8));
+ red_spotfn = g_value_get_int (gimp_value_array_index (args, 9));
+ grn_ang = g_value_get_double (gimp_value_array_index (args, 10));
+ grn_spotfn = g_value_get_int (gimp_value_array_index (args, 11));
+ blu_ang = g_value_get_double (gimp_value_array_index (args, 12));
+ blu_spotfn = g_value_get_int (gimp_value_array_index (args, 13));
+ oversample = g_value_get_int (gimp_value_array_index (args, 14));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ gint color_model = newsprint_color_model (colorspace);
+ gint pattern = newsprint_pattern (gry_spotfn);
+ gint pattern2 = newsprint_pattern (red_spotfn);
+ gint pattern3 = newsprint_pattern (grn_spotfn);
+ gint pattern4 = newsprint_pattern (blu_spotfn);
+ gdouble angle = newsprint_angle (gry_ang);
+ gdouble angle2 = newsprint_angle (red_ang);
+ gdouble angle3 = newsprint_angle (grn_ang);
+ gdouble angle4 = newsprint_angle (blu_ang);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:newsprint",
+ "color-model", color_model,
+ "black-pullout", (gdouble) k_pullout / 100.0,
+ "period", (gdouble) cell_width,
+ "angle", angle,
+ "pattern", pattern,
+ "period2", (gdouble) cell_width,
+ "angle2", angle2,
+ "pattern2", pattern2,
+ "period3", (gdouble) cell_width,
+ "angle3", angle3,
+ "pattern3", pattern3,
+ "period4", (gdouble) cell_width,
+ "angle4", angle4,
+ "pattern4", pattern4,
+ "aa-samples", oversample,
+ NULL);
+
+ node = wrap_in_gamma_cast (node, drawable);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Newsprint"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_normalize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:stretch-contrast",
+ "keep-colors", TRUE,
+ "perceptual", TRUE,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Normalize"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_nova_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 xcenter;
+ gint32 ycenter;
+ GimpRGB color;
+ gint32 radius;
+ gint32 nspoke;
+ gint32 randomhue;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ xcenter = g_value_get_int (gimp_value_array_index (args, 3));
+ ycenter = g_value_get_int (gimp_value_array_index (args, 4));
+ gimp_value_get_rgb (gimp_value_array_index (args, 5), &color);
+ radius = g_value_get_int (gimp_value_array_index (args, 6));
+ nspoke = g_value_get_int (gimp_value_array_index (args, 7));
+ randomhue = g_value_get_int (gimp_value_array_index (args, 8));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ GeglColor *gegl_color = gimp_gegl_color_new (&color);
+ gdouble center_x = (gdouble) xcenter / (gdouble) gimp_item_get_width (GIMP_ITEM (drawable));
+ gdouble center_y = (gdouble) ycenter / (gdouble) gimp_item_get_height (GIMP_ITEM (drawable));
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:supernova",
+ "center-x", center_x,
+ "center-y", center_y,
+ "radius", radius,
+ "spokes-count", nspoke,
+ "random-hue", randomhue,
+ "color", gegl_color,
+ "seed", g_random_int (),
+ NULL);
+
+ g_object_unref (gegl_color);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Supernova"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_oilify_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 mask_size;
+ gint32 mode;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ mask_size = g_value_get_int (gimp_value_array_index (args, 3));
+ mode = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:oilify",
+ "mask-radius", MAX (1, mask_size / 2),
+ "use-inten", mode ? TRUE : FALSE,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Oilify"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_oilify_enhanced_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 mode;
+ gint32 mask_size;
+ GimpDrawable *mask_size_map;
+ gint32 exponent;
+ GimpDrawable *exponent_map;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ mode = g_value_get_int (gimp_value_array_index (args, 3));
+ mask_size = g_value_get_int (gimp_value_array_index (args, 4));
+ mask_size_map = gimp_value_get_drawable (gimp_value_array_index (args, 5), gimp);
+ exponent = g_value_get_int (gimp_value_array_index (args, 6));
+ exponent_map = gimp_value_get_drawable (gimp_value_array_index (args, 7), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *graph;
+ GeglNode *node;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:oilify",
+ "mask-radius", MAX (1, mask_size / 2),
+ "use-inten", mode ? TRUE : FALSE,
+ "exponent", exponent,
+ NULL);
+
+ graph = wrap_in_graph (node);
+
+ if (mask_size_map)
+ {
+ GeglNode *src_node;
+ src_node = create_buffer_source_node (graph, mask_size_map);
+ gegl_node_connect_to (src_node, "output", node, "aux");
+ }
+
+ if (exponent_map)
+ {
+ GeglNode *src_node;
+ src_node = create_buffer_source_node (graph, exponent_map);
+ gegl_node_connect_to (src_node, "output", node, "aux2");
+ }
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Oilify"),
+ graph);
+ g_object_unref (graph);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_papertile_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 tile_size;
+ gdouble move_max;
+ gint32 fractional_type;
+ gboolean wrap_around;
+ gboolean centering;
+ gint32 background_type;
+ GimpRGB background_color;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ tile_size = g_value_get_int (gimp_value_array_index (args, 3));
+ move_max = g_value_get_double (gimp_value_array_index (args, 4));
+ fractional_type = g_value_get_int (gimp_value_array_index (args, 5));
+ wrap_around = g_value_get_boolean (gimp_value_array_index (args, 6));
+ centering = g_value_get_boolean (gimp_value_array_index (args, 7));
+ background_type = g_value_get_int (gimp_value_array_index (args, 8));
+ gimp_value_get_rgb (gimp_value_array_index (args, 9), &background_color);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ GimpRGB color;
+ GeglColor *gegl_color;
+ gint bg_type;
+
+ switch (background_type)
+ {
+ default:
+ bg_type = background_type;
+ gimp_rgba_set (&color, 0.0, 0.0, 1.0, 1.0);
+ break;
+
+ case 3:
+ bg_type = 3;
+ gimp_context_get_foreground (context, &color);
+ break;
+
+ case 4:
+ bg_type = 3;
+ gimp_context_get_background (context, &color);
+ break;
+
+ case 5:
+ bg_type = 3;
+ color = background_color;
+ break;
+ }
+
+ gegl_color = gimp_gegl_color_new (&color);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:tile-paper",
+ "tile-width", tile_size,
+ "tile-height", tile_size,
+ "move-rate", move_max,
+ "bg-color", gegl_color,
+ "centering", centering,
+ "wrap-around", wrap_around,
+ "background-type", bg_type,
+ "fractional-type", fractional_type,
+ NULL);
+
+ g_object_unref (gegl_color);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Paper Tile"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_pixelize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 pixel_width;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ pixel_width = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:pixelize",
+ "size-x", pixel_width,
+ "size-y", pixel_width,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Pixelize"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_pixelize2_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 pixel_width;
+ gint32 pixel_height;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ pixel_width = g_value_get_int (gimp_value_array_index (args, 3));
+ pixel_height = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:pixelize",
+ "size-x", pixel_width,
+ "size-y", pixel_height,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Pixelize"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_plasma_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 seed;
+ gdouble turbulence;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ seed = g_value_get_int (gimp_value_array_index (args, 3));
+ turbulence = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ gint x, y, width, height;
+
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:plasma",
+ "seed", seed,
+ "turbulence", turbulence,
+ "x", x,
+ "y", y,
+ "width", width,
+ "height", height,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Plasma"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_polar_coords_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble circle;
+ gdouble angle;
+ gboolean backwards;
+ gboolean inverse;
+ gboolean polrec;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ circle = g_value_get_double (gimp_value_array_index (args, 3));
+ angle = g_value_get_double (gimp_value_array_index (args, 4));
+ backwards = g_value_get_boolean (gimp_value_array_index (args, 5));
+ inverse = g_value_get_boolean (gimp_value_array_index (args, 6));
+ polrec = g_value_get_boolean (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:polar-coordinates",
+ "depth", circle,
+ "angle", angle,
+ "bw", backwards, /* XXX name */
+ "top", inverse,
+ "polar", polrec,
+ NULL);
+
+ node = wrap_in_selection_bounds (node, drawable);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Polar Coordinates"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_red_eye_removal_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 threshold;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ threshold = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:red-eye-removal",
+ "threshold", (gdouble) (threshold - 50) / 50.0 * 0.2 + 0.4,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Red Eye Removal"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_randomize_hurl_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble rndm_pct;
+ gdouble rndm_rcount;
+ gboolean randomize;
+ gint32 seed;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ rndm_pct = g_value_get_double (gimp_value_array_index (args, 3));
+ rndm_rcount = g_value_get_double (gimp_value_array_index (args, 4));
+ randomize = g_value_get_boolean (gimp_value_array_index (args, 5));
+ seed = g_value_get_int (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+
+ if (randomize)
+ seed = (gint32) g_random_int ();
+
+ node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:noise-hurl",
+ "seed", seed,
+ "pct-random", rndm_pct,
+ "repeat", (gint) rndm_rcount,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Random Hurl"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_randomize_pick_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble rndm_pct;
+ gdouble rndm_rcount;
+ gboolean randomize;
+ gint32 seed;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ rndm_pct = g_value_get_double (gimp_value_array_index (args, 3));
+ rndm_rcount = g_value_get_double (gimp_value_array_index (args, 4));
+ randomize = g_value_get_boolean (gimp_value_array_index (args, 5));
+ seed = g_value_get_int (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+
+ if (randomize)
+ seed = (gint32) g_random_int ();
+
+ node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:noise-pick",
+ "seed", seed,
+ "pct-random", rndm_pct,
+ "repeat", (gint) rndm_rcount,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Random Pick"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_randomize_slur_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble rndm_pct;
+ gdouble rndm_rcount;
+ gboolean randomize;
+ gint32 seed;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ rndm_pct = g_value_get_double (gimp_value_array_index (args, 3));
+ rndm_rcount = g_value_get_double (gimp_value_array_index (args, 4));
+ randomize = g_value_get_boolean (gimp_value_array_index (args, 5));
+ seed = g_value_get_int (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+
+ if (randomize)
+ seed = (gint32) g_random_int ();
+
+ node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:noise-slur",
+ "seed", seed,
+ "pct-random", rndm_pct,
+ "repeat", (gint) rndm_rcount,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Random Slur"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_rgb_noise_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gboolean independent;
+ gboolean correlated;
+ gdouble noise_1;
+ gdouble noise_2;
+ gdouble noise_3;
+ gdouble noise_4;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ independent = g_value_get_boolean (gimp_value_array_index (args, 3));
+ correlated = g_value_get_boolean (gimp_value_array_index (args, 4));
+ noise_1 = g_value_get_double (gimp_value_array_index (args, 5));
+ noise_2 = g_value_get_double (gimp_value_array_index (args, 6));
+ noise_3 = g_value_get_double (gimp_value_array_index (args, 7));
+ noise_4 = g_value_get_double (gimp_value_array_index (args, 8));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ gdouble r, g, b, a;
+
+ if (gimp_drawable_is_gray (drawable))
+ {
+ r = noise_1;
+ g = noise_1;
+ b = noise_1;
+ a = noise_2;
+ }
+ else
+ {
+ r = noise_1;
+ g = noise_2;
+ b = noise_3;
+ a = noise_4;
+ }
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:noise-rgb",
+ "correlated", correlated,
+ "independent", independent,
+ "red", r,
+ "green", g,
+ "blue", b,
+ "alpha", a,
+ "seed", g_random_int (),
+ NULL);
+
+ node = wrap_in_gamma_cast (node, drawable);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "RGB Noise"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_ripple_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 period;
+ gint32 amplitude;
+ gint32 orientation;
+ gint32 edges;
+ gint32 waveform;
+ gboolean antialias;
+ gboolean tile;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ period = g_value_get_int (gimp_value_array_index (args, 3));
+ amplitude = g_value_get_int (gimp_value_array_index (args, 4));
+ orientation = g_value_get_int (gimp_value_array_index (args, 5));
+ edges = g_value_get_int (gimp_value_array_index (args, 6));
+ waveform = g_value_get_int (gimp_value_array_index (args, 7));
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 8));
+ tile = g_value_get_boolean (gimp_value_array_index (args, 9));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ gdouble angle, phi;
+
+ angle = orientation ? 0.0 : 90.0;
+ phi = waveform ? 0.0 : 0.75;
+ if (orientation == 0 && waveform == 1)
+ phi = 0.5;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:ripple",
+ "amplitude", (gdouble) amplitude,
+ "period", (gdouble) period,
+ "phi", phi,
+ "angle", angle,
+ "sampler_type", antialias ? GEGL_SAMPLER_CUBIC : GEGL_SAMPLER_NEAREST,
+ "wave_type", waveform ? 0 : 1,
+ "abyss_policy", edges == 0 ? GEGL_ABYSS_CLAMP :
+ edges == 1 ? GEGL_ABYSS_LOOP :
+ GEGL_ABYSS_NONE,
+ "tileable", tile ? TRUE : FALSE,
+ NULL);
+
+ node = wrap_in_gamma_cast (node, drawable);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Ripple"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_rotate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ GimpDrawable *drawable;
+ gint32 angle;
+ gboolean everything;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ angle = g_value_get_int (gimp_value_array_index (args, 3));
+ everything = g_value_get_boolean (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ GimpRotationType rotate_type = angle - 1;
+
+ if (everything)
+ {
+ gimp_image_rotate (image, context, rotate_type, progress);
+ }
+ else if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error))
+ {
+ GimpItem *item = GIMP_ITEM (drawable);
+ gint off_x, off_y;
+ gdouble center_x, center_y;
+
+ gimp_item_get_offset (item, &off_x, &off_y);
+
+ center_x = ((gdouble) off_x + (gdouble) gimp_item_get_width (item) / 2.0);
+ center_y = ((gdouble) off_y + (gdouble) gimp_item_get_height (item) / 2.0);
+
+ gimp_item_rotate (item, context, rotate_type, center_x, center_y,
+ GIMP_IS_CHANNEL (drawable));
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_noisify_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gboolean independent;
+ gdouble noise_1;
+ gdouble noise_2;
+ gdouble noise_3;
+ gdouble noise_4;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ independent = g_value_get_boolean (gimp_value_array_index (args, 3));
+ noise_1 = g_value_get_double (gimp_value_array_index (args, 4));
+ noise_2 = g_value_get_double (gimp_value_array_index (args, 5));
+ noise_3 = g_value_get_double (gimp_value_array_index (args, 6));
+ noise_4 = g_value_get_double (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ gdouble r, g, b, a;
+
+ if (gimp_drawable_is_gray (drawable))
+ {
+ r = noise_1;
+ g = noise_1;
+ b = noise_1;
+ a = noise_2;
+ }
+ else
+ {
+ r = noise_1;
+ g = noise_2;
+ b = noise_3;
+ a = noise_4;
+ }
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:noise-rgb",
+ "correlated", FALSE,
+ "independent", independent,
+ "red", r,
+ "green", g,
+ "blue", b,
+ "alpha", a,
+ "seed", g_random_int (),
+ NULL);
+
+ node = wrap_in_gamma_cast (node, drawable);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Noisify"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_sel_gauss_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble radius;
+ gint32 max_delta;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ radius = g_value_get_double (gimp_value_array_index (args, 3));
+ max_delta = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:gaussian-blur-selective",
+ "blur-radius", radius,
+ "max-delta", (gdouble) max_delta / 255.0,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Selective Gaussian Blur"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_semiflatten_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_drawable_has_alpha (drawable))
+ {
+ GeglNode *node;
+ GimpRGB color;
+
+ gimp_context_get_background (context, &color);
+
+ node =
+ gegl_node_new_child (NULL,
+ "operation", "gimp:semi-flatten",
+ "color", &color,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Semi-Flatten"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_shift_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 shift_amount;
+ gint32 orientation;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ shift_amount = g_value_get_int (gimp_value_array_index (args, 3));
+ orientation = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:shift",
+ "shift", shift_amount / 2,
+ "direction", orientation ? 0 : 1,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Shift"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_sinus_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble xscale;
+ gdouble yscale;
+ gdouble complex;
+ gint32 seed;
+ gboolean tiling;
+ gboolean perturb;
+ gint32 colors;
+ GimpRGB col1;
+ GimpRGB col2;
+ gdouble alpha1;
+ gdouble alpha2;
+ gint32 blend;
+ gdouble blend_power;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ xscale = g_value_get_double (gimp_value_array_index (args, 3));
+ yscale = g_value_get_double (gimp_value_array_index (args, 4));
+ complex = g_value_get_double (gimp_value_array_index (args, 5));
+ seed = g_value_get_int (gimp_value_array_index (args, 6));
+ tiling = g_value_get_boolean (gimp_value_array_index (args, 7));
+ perturb = g_value_get_boolean (gimp_value_array_index (args, 8));
+ colors = g_value_get_int (gimp_value_array_index (args, 9));
+ gimp_value_get_rgb (gimp_value_array_index (args, 10), &col1);
+ gimp_value_get_rgb (gimp_value_array_index (args, 11), &col2);
+ alpha1 = g_value_get_double (gimp_value_array_index (args, 12));
+ alpha2 = g_value_get_double (gimp_value_array_index (args, 13));
+ blend = g_value_get_int (gimp_value_array_index (args, 14));
+ blend_power = g_value_get_double (gimp_value_array_index (args, 15));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ GeglColor *gegl_color1;
+ GeglColor *gegl_color2;
+ gint x, y, width, height;
+
+ switch (colors)
+ {
+ case 0:
+ gimp_rgb_set (&col1, 0.0, 0.0, 0.0);
+ gimp_rgb_set (&col2, 1.0, 1.0, 1.0);
+ break;
+
+ case 1:
+ gimp_context_get_foreground (context, &col1);
+ gimp_context_get_background (context, &col2);
+ break;
+ }
+
+ gimp_rgb_set_alpha (&col1, alpha1);
+ gimp_rgb_set_alpha (&col2, alpha2);
+
+ gegl_color1 = gimp_gegl_color_new (&col1);
+ gegl_color2 = gimp_gegl_color_new (&col2);
+
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:sinus",
+ "x_scale", xscale,
+ "y-scale", yscale,
+ "complexity", complex,
+ "seed", seed,
+ "tiling", tiling,
+ "perturbation", perturb,
+ "color1", gegl_color1,
+ "color2", gegl_color2,
+ "blend-mode", blend,
+ "blend-power", blend_power,
+ "width", width,
+ "height", height,
+ NULL);
+
+ g_object_unref (gegl_color1);
+ g_object_unref (gegl_color2);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Sinus"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_sobel_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gboolean horizontal;
+ gboolean vertical;
+ gboolean keep_sign;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ horizontal = g_value_get_boolean (gimp_value_array_index (args, 3));
+ vertical = g_value_get_boolean (gimp_value_array_index (args, 4));
+ keep_sign = g_value_get_boolean (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:edge-sobel",
+ "horizontal", horizontal,
+ "vertical", vertical,
+ "keep-sign", keep_sign,
+ NULL);
+
+ node = wrap_in_gamma_cast (node, drawable);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Sobel"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_solid_noise_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gboolean tileable;
+ gboolean turbulent;
+ gint32 seed;
+ gint32 detail;
+ gdouble xsize;
+ gdouble ysize;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ tileable = g_value_get_boolean (gimp_value_array_index (args, 3));
+ turbulent = g_value_get_boolean (gimp_value_array_index (args, 4));
+ seed = g_value_get_int (gimp_value_array_index (args, 5));
+ detail = g_value_get_int (gimp_value_array_index (args, 6));
+ xsize = g_value_get_double (gimp_value_array_index (args, 7));
+ ysize = g_value_get_double (gimp_value_array_index (args, 8));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ gint x, y, width, height;
+
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:noise-solid",
+ "x-size", xsize,
+ "y-size", ysize,
+ "detail", detail,
+ "tileable", tileable,
+ "turbulent", turbulent,
+ "seed", seed,
+ "width", width,
+ "height", height,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Solid Noise"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_spread_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble spread_amount_x;
+ gdouble spread_amount_y;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ spread_amount_x = g_value_get_double (gimp_value_array_index (args, 3));
+ spread_amount_y = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:noise-spread",
+ "amount-x", (gint) spread_amount_x,
+ "amount-y", (gint) spread_amount_y,
+ "seed", g_random_int (),
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Spread"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_threshold_alpha_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 threshold;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ threshold = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_drawable_has_alpha (drawable))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gimp:threshold-alpha",
+ "value", threshold / 255.0,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Threshold Alpha"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_unsharp_mask_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble radius;
+ gdouble amount;
+ gint32 threshold;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ radius = g_value_get_double (gimp_value_array_index (args, 3));
+ amount = g_value_get_double (gimp_value_array_index (args, 4));
+ threshold = g_value_get_int (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:unsharp-mask",
+ "std-dev", radius,
+ "scale", amount,
+ "threshold", threshold / 255.0,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Sharpen (Unsharp Mask)"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_video_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 pattern_number;
+ gboolean additive;
+ gboolean rotated;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ pattern_number = g_value_get_int (gimp_value_array_index (args, 3));
+ additive = g_value_get_boolean (gimp_value_array_index (args, 4));
+ rotated = g_value_get_boolean (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:video-degradation",
+ "pattern", pattern_number,
+ "additive", additive,
+ "rotated", rotated,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Video"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_vinvert_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:value-invert",
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Value Invert"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_vpropagate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 propagate_mode;
+ gint32 propagating_channel;
+ gdouble propagating_rate;
+ gint32 direction_mask;
+ gint32 lower_limit;
+ gint32 upper_limit;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ propagate_mode = g_value_get_int (gimp_value_array_index (args, 3));
+ propagating_channel = g_value_get_int (gimp_value_array_index (args, 4));
+ propagating_rate = g_value_get_double (gimp_value_array_index (args, 5));
+ direction_mask = g_value_get_int (gimp_value_array_index (args, 6));
+ lower_limit = g_value_get_int (gimp_value_array_index (args, 7));
+ upper_limit = g_value_get_int (gimp_value_array_index (args, 8));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ GimpRGB color;
+ GeglColor *gegl_color = NULL;
+ gint gegl_mode = 0;
+ gboolean to_left = (direction_mask & (0x1 << 0)) != 0;
+ gboolean to_top = (direction_mask & (0x1 << 1)) != 0;
+ gboolean to_right = (direction_mask & (0x1 << 2)) != 0;
+ gboolean to_bottom = (direction_mask & (0x1 << 3)) != 0;
+ gboolean value = (propagating_channel & (0x1 << 0)) != 0;
+ gboolean alpha = (propagating_channel & (0x1 << 1)) != 0;
+
+ switch (propagate_mode)
+ {
+ case 0:
+ case 1:
+ case 2:
+ gegl_mode = propagate_mode;
+ break;
+
+ case 3:
+ case 4:
+ case 5:
+ if (propagate_mode == 3 || propagate_mode == 4)
+ {
+ gegl_mode = propagate_mode;
+
+ gimp_context_get_foreground (context, &color);
+ }
+ else
+ {
+ gegl_mode = 4;
+
+ gimp_context_get_background (context, &color);
+ }
+
+ gegl_color = gimp_gegl_color_new (&color);
+ break;
+
+ case 6:
+ case 7:
+ gegl_mode = propagate_mode - 1;
+ break;
+ }
+
+ node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:value-propagate",
+ "mode", gegl_mode,
+ "lower-threshold", (gdouble) lower_limit / 255.0,
+ "upper-threshold", (gdouble) upper_limit / 255.0,
+ "rate", propagating_rate,
+ "color", gegl_color,
+ "top", to_top,
+ "left", to_left,
+ "right", to_right,
+ "bottom", to_bottom,
+ "value", value,
+ "alpha", alpha,
+ NULL);
+
+ if (gegl_color)
+ g_object_unref (gegl_color);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Value Propagate"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_dilate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:value-propagate",
+ "mode", 0, /* GEGL_VALUE_PROPAGATE_MODE_WHITE */
+ "lower-threshold", 0.0,
+ "upper-threshold", 1.0,
+ "rate", 1.0,
+ "top", TRUE,
+ "left", TRUE,
+ "right", TRUE,
+ "bottom", TRUE,
+ "value", TRUE,
+ "alpha", FALSE,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Dilate"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_erode_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:value-propagate",
+ "mode", 1, /* GEGL_VALUE_PROPAGATE_MODE_BLACK */
+ "lower-threshold", 0.0,
+ "upper-threshold", 1.0,
+ "rate", 1.0,
+ "top", TRUE,
+ "left", TRUE,
+ "right", TRUE,
+ "bottom", TRUE,
+ "value", TRUE,
+ "alpha", FALSE,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Erode"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_waves_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble amplitude;
+ gdouble phase;
+ gdouble wavelength;
+ gboolean type;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ amplitude = g_value_get_double (gimp_value_array_index (args, 3));
+ phase = g_value_get_double (gimp_value_array_index (args, 4));
+ wavelength = g_value_get_double (gimp_value_array_index (args, 5));
+ type = g_value_get_boolean (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node;
+ gdouble width = gimp_item_get_width (GIMP_ITEM (drawable));
+ gdouble height = gimp_item_get_height (GIMP_ITEM (drawable));
+ gdouble aspect;
+
+ while (phase < 0)
+ phase += 360.0;
+
+ phase = fmod (phase, 360.0);
+
+ aspect = CLAMP (width / height, 0.1, 10.0);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:waves",
+ "x", 0.5,
+ "y", 0.5,
+ "amplitude", amplitude,
+ "phi", (phase - 180.0) / 180.0,
+ "period", wavelength * 2.0,
+ "aspect", aspect,
+ "clamp", ! type,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Waves"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_whirl_pinch_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble whirl;
+ gdouble pinch;
+ gdouble radius;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ whirl = g_value_get_double (gimp_value_array_index (args, 3));
+ pinch = g_value_get_double (gimp_value_array_index (args, 4));
+ radius = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:whirl-pinch",
+ "whirl", whirl,
+ "pinch", pinch,
+ "radius", radius,
+ NULL);
+
+ node = wrap_in_selection_bounds (node, drawable);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Whirl and Pinch"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_wind_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 threshold;
+ gint32 direction;
+ gint32 strength;
+ gint32 algorithm;
+ gint32 edge;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ threshold = g_value_get_int (gimp_value_array_index (args, 3));
+ direction = g_value_get_int (gimp_value_array_index (args, 4));
+ strength = g_value_get_int (gimp_value_array_index (args, 5));
+ algorithm = g_value_get_int (gimp_value_array_index (args, 6));
+ edge = g_value_get_int (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:wind",
+ "threshold", threshold,
+ "direction", direction,
+ "strength", strength,
+ "style", algorithm,
+ "edge", edge,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Wind"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_plug_in_compat_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-plug-in-alienmap2
+ */
+ procedure = gimp_procedure_new (plug_in_alienmap2_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-alienmap2");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-alienmap2",
+ "Alter colors in various psychedelic ways",
+ "No help yet. Just try it and you'll see!",
+ "Compatibility procedure. Please see 'gegl:alien-map' for credits.",
+ "Compatibility procedure. Please see 'gegl:alien-map' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("redfrequency",
+ "redfrequency",
+ "Red/hue component frequency factor",
+ 0, 20, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("redangle",
+ "redangle",
+ "Red/hue component angle factor (0-360)",
+ 0, 360, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("greenfrequency",
+ "greenfrequency",
+ "Green/saturation component frequency factor",
+ 0, 20, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("greenangle",
+ "greenangle",
+ "Green/saturation component angle factor (0-360)",
+ 0, 360, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("bluefrequency",
+ "bluefrequency",
+ "Blue/luminance component frequency factor",
+ 0, 20, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("blueangle",
+ "blueangle",
+ "Blue/luminance component angle factor (0-360)",
+ 0, 360, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("colormodel",
+ "colormodel",
+ "Color model { RGB-MODEL (0), HSL-MODEL (1) }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("redmode",
+ "redmode",
+ "Red/hue application mode { TRUE, FALSE }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("greenmode",
+ "greenmode",
+ "Green/saturation application mode { TRUE, FALSE }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("bluemode",
+ "bluemode",
+ "Blue/luminance application mode { TRUE, FALSE }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-antialias
+ */
+ procedure = gimp_procedure_new (plug_in_antialias_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-antialias");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-antialias",
+ "Antialias using the Scale3X edge-extrapolation algorithm",
+ "No more help.",
+ "Compatibility procedure. Please see 'gegl:antialias' for credits.",
+ "Compatibility procedure. Please see 'gegl:antialias' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-apply-canvas
+ */
+ procedure = gimp_procedure_new (plug_in_apply_canvas_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-apply-canvas");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-apply-canvas",
+ "Add a canvas texture to the image",
+ "This function applies a canvas texture map to the drawable.",
+ "Compatibility procedure. Please see 'gegl:texturize-canvas' for credits.",
+ "Compatibility procedure. Please see 'gegl:texturize-canvas' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("direction",
+ "direction",
+ "Light direction (0 - 3)",
+ 0, 3, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("depth",
+ "depth",
+ "Texture depth (1 - 50)",
+ 1, 50, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-applylens
+ */
+ procedure = gimp_procedure_new (plug_in_applylens_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-applylens");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-applylens",
+ "Simulate an elliptical lens over the image",
+ "This plug-in uses Snell's law to draw an ellipsoid lens over the image.",
+ "Compatibility procedure. Please see 'gegl:apply-lens' for credits.",
+ "Compatibility procedure. Please see 'gegl:apply-lens' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("refraction",
+ "refraction",
+ "Lens refraction index",
+ 1.0, 100.0, 1.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("keep-surroundings",
+ "keep surroundings",
+ "Keep lens surroundings",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("set-background",
+ "set background",
+ "Set lens surroundings to BG value",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("set-transparent",
+ "set transparent",
+ "Set lens surroundings transparent",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-autocrop
+ */
+ procedure = gimp_procedure_new (plug_in_autocrop_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-autocrop");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-autocrop",
+ "Remove empty borders from the image",
+ "Remove empty borders from the image.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-autocrop-layer
+ */
+ procedure = gimp_procedure_new (plug_in_autocrop_layer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-autocrop-layer");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-autocrop-layer",
+ "Crop the active layer based on empty borders of the input drawable",
+ "Crop the active layer of the input \"image\" based on empty borders of the input \"drawable\". \n\nThe input drawable serves as a base for detecting cropping extents (transparency or background color), and is not necessarily the cropped layer (the current active layer).",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-autostretch-hsv
+ */
+ procedure = gimp_procedure_new (plug_in_autostretch_hsv_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-autostretch-hsv");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-autostretch-hsv",
+ "Stretch contrast to cover the maximum possible range",
+ "This simple plug-in does an automatic contrast stretch. For each channel in the image, it finds the minimum and maximum values... it uses those values to stretch the individual histograms to the full contrast range. For some images it may do just what you want; for others it may be total crap :). This version differs from Contrast Autostretch in that it works in HSV space, and preserves hue.",
+ "Compatibility procedure. Please see 'gegl:stretch-contrast-hsv' for credits.",
+ "Compatibility procedure. Please see 'gegl:stretch-contrast-hsv' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-bump-map
+ */
+ procedure = gimp_procedure_new (plug_in_bump_map_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-bump-map");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-bump-map",
+ "Create an embossing effect using a bump map",
+ "This plug-in uses the algorithm described by John Schlag, \"Fast Embossing Effects on Raster Image Data\" in Graphics GEMS IV (ISBN 0-12-336155-9). It takes a drawable to be applied as a bump map to another image and produces a nice embossing effect.",
+ "Compatibility procedure. Please see 'gegl:bump-map' for credits.",
+ "Compatibility procedure. Please see 'gegl:bump-map' for credits.",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("bumpmap",
+ "bumpmap",
+ "Bump map drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("azimuth",
+ "azimuth",
+ "Azimuth",
+ 0.0, 360.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("elevation",
+ "elevation",
+ "Elevation",
+ 0.5, 90.0, 0.5,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("depth",
+ "depth",
+ "Depth",
+ 1, 65, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("xofs",
+ "xofs",
+ "X offset",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("yofs",
+ "yofs",
+ "Y offset",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("waterlevel",
+ "waterlevel",
+ "Level that full transparency should represent",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("ambient",
+ "ambient",
+ "Ambient lighting factor",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("compensate",
+ "compensate",
+ "Compensate for darkening",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("invert",
+ "invert",
+ "Invert bumpmap",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("type",
+ "type",
+ "Type of map { LINEAR (0), SPHERICAL (1), SINUSOIDAL (2) }",
+ 0, 3, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-bump-map-tiled
+ */
+ procedure = gimp_procedure_new (plug_in_bump_map_tiled_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-bump-map-tiled");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-bump-map-tiled",
+ "Create an embossing effect using a tiled image as a bump map",
+ "This plug-in uses the algorithm described by John Schlag, \"Fast Embossing Effects on Raster Image Data\" in Graphics GEMS IV (ISBN 0-12-336155-9). It takes a drawable to be tiled and applied as a bump map to another image and produces a nice embossing effect.",
+ "Compatibility procedure. Please see 'gegl:bump-map' for credits.",
+ "Compatibility procedure. Please see 'gegl:bump-map' for credits.",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("bumpmap",
+ "bumpmap",
+ "Bump map drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("azimuth",
+ "azimuth",
+ "Azimuth",
+ 0.0, 360.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("elevation",
+ "elevation",
+ "Elevation",
+ 0.5, 90.0, 0.5,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("depth",
+ "depth",
+ "Depth",
+ 1, 65, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("xofs",
+ "xofs",
+ "X offset",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("yofs",
+ "yofs",
+ "Y offset",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("waterlevel",
+ "waterlevel",
+ "Level that full transparency should represent",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("ambient",
+ "ambient",
+ "Ambient lighting factor",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("compensate",
+ "compensate",
+ "Compensate for darkening",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("invert",
+ "invert",
+ "Invert bumpmap",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("type",
+ "type",
+ "Type of map { LINEAR (0), SPHERICAL (1), SINUSOIDAL (2) }",
+ 0, 3, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-c-astretch
+ */
+ procedure = gimp_procedure_new (plug_in_c_astretch_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-c-astretch");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-c-astretch",
+ "Stretch contrast to cover the maximum possible range",
+ "This simple plug-in does an automatic contrast stretch. For each channel in the image, it finds the minimum and maximum values... it uses those values to stretch the individual histograms to the full contrast range. For some images it may do just what you want; for others it may not work that well.",
+ "Compatibility procedure. Please see 'gegl:stretch-contrast' for credits.",
+ "Compatibility procedure. Please see 'gegl:stretch-contrast' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-colors-channel-mixer
+ */
+ procedure = gimp_procedure_new (plug_in_colors_channel_mixer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-colors-channel-mixer");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-colors-channel-mixer",
+ "Alter colors by mixing RGB Channels",
+ "This plug-in mixes the RGB channels.",
+ "Compatibility procedure. Please see 'gegl:channel-mixer' for credits.",
+ "Compatibility procedure. Please see 'gegl:channel-mixer' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("monochrome",
+ "monochrome",
+ "Monochrome { TRUE, FALSE }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("rr-gain",
+ "rr gain",
+ "Set the red gain for the red channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("rg-gain",
+ "rg gain",
+ "Set the green gain for the red channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("rb-gain",
+ "rb gain",
+ "Set the blue gain for the red channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("gr-gain",
+ "gr gain",
+ "Set the red gain for the green channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("gg-gain",
+ "gg gain",
+ "Set the green gain for the green channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("gb-gain",
+ "gb gain",
+ "Set the blue gain for the green channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("br-gain",
+ "br gain",
+ "Set the red gain for the blue channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("bg-gain",
+ "bg gain",
+ "Set the green gain for the blue channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("bb-gain",
+ "bb gain",
+ "Set the blue gain for the blue channel",
+ -2, 2, -2,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-colortoalpha
+ */
+ procedure = gimp_procedure_new (plug_in_colortoalpha_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-colortoalpha");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-colortoalpha",
+ "Convert a specified color to transparency",
+ "This replaces as much of a given color as possible in each pixel with a corresponding amount of alpha, then readjusts the color accordingly.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "Color to remove",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-convmatrix
+ */
+ procedure = gimp_procedure_new (plug_in_convmatrix_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-convmatrix");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-convmatrix",
+ "Apply a generic 5x5 convolution matrix",
+ "Apply a generic 5x5 convolution matrix.",
+ "Compatibility procedure. Please see 'gegl:convolution-matrix' for credits.",
+ "Compatibility procedure. Please see 'gegl:convolution-matrix' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("argc-matrix",
+ "argc matrix",
+ "The number of elements in the following array, must always be 25",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("matrix",
+ "matrix",
+ "The 5x5 convolution matrix",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("alpha-alg",
+ "alpha alg",
+ "Enable weighting by alpha channel",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("divisor",
+ "divisor",
+ "Divisor",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("offset",
+ "offset",
+ "Offset",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("argc-channels",
+ "argc channels",
+ "The number of elements in following array, must always be 5",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32_array ("channels",
+ "channels",
+ "Mask of the channels to be filtered",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("bmode",
+ "bmode",
+ "Mode for treating image borders { EXTEND (0), WRAP (1), CLEAR (2) }",
+ 0, 2, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-cubism
+ */
+ procedure = gimp_procedure_new (plug_in_cubism_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-cubism");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-cubism",
+ "Convert the image into randomly rotated square blobs",
+ "Convert the image into randomly rotated square blobs.",
+ "Compatibility procedure. Please see 'gegl:cubism' for credits.",
+ "Compatibility procedure. Please see 'gegl:cubism' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("tile-size",
+ "tile size",
+ "Average diameter of each tile (in pixels)",
+ 0.0, 100.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("tile-saturation",
+ "tile saturation",
+ "Expand tiles by this amount",
+ 0.0, 10.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("bg-color",
+ "bg color",
+ "Background color { BLACK (0), BG (1) }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-deinterlace
+ */
+ procedure = gimp_procedure_new (plug_in_deinterlace_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-deinterlace");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-deinterlace",
+ "Fix images where every other row is missing",
+ "Deinterlace is useful for processing images from video capture cards. When only the odd or even fields get captured, deinterlace can be used to interpolate between the existing fields to correct this.",
+ "Compatibility procedure. Please see 'gegl:deinterlace' for credits.",
+ "Compatibility procedure. Please see 'gegl:deinterlace' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("evenodd",
+ "evenodd",
+ "Which lines to keep { KEEP-ODD (0), KEEP-EVEN (1)",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-diffraction
+ */
+ procedure = gimp_procedure_new (plug_in_diffraction_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-diffraction");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-diffraction",
+ "Generate diffraction patterns",
+ "Help? What help?",
+ "Compatibility procedure. Please see 'gegl:diffraction-patterns' for credits.",
+ "Compatibility procedure. Please see 'gegl:diffraction-patterns' for credits.",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("lam-r",
+ "lam r",
+ "Light frequency (red)",
+ 0.0, 20.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("lam-g",
+ "lam g",
+ "Light frequency (green)",
+ 0.0, 20.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("lam-b",
+ "lam b",
+ "Light frequency (blue)",
+ 0.0, 20.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("contour-r",
+ "contour r",
+ "Number of contours (red)",
+ 0.0, 10.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("contour-g",
+ "contour g",
+ "Number of contours (green)",
+ 0.0, 10.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("contour-b",
+ "contour b",
+ "Number of contours (blue)",
+ 0.0, 10.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("edges-r",
+ "edges r",
+ "Number of sharp edges (red)",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("edges-g",
+ "edges g",
+ "Number of sharp edges (green)",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("edges-b",
+ "edges b",
+ "Number of sharp edges (blue)",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("brightness",
+ "brightness",
+ "Brightness and shifting/fattening of contours",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("scattering",
+ "scattering",
+ "Scattering (Speed vs. quality)",
+ 0.0, 100.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("polarization",
+ "polarization",
+ "Polarization",
+ -1.0, 1.0, -1.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-displace
+ */
+ procedure = gimp_procedure_new (plug_in_displace_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-displace");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-displace",
+ "Displace pixels as indicated by displacement maps",
+ "Displaces the contents of the specified drawable by the amounts specified by 'amount-x' and 'amount-y' multiplied by the luminance of corresponding pixels in the 'displace-map' drawables.",
+ "Compatibility procedure. Please see 'gegl:displace' for credits.",
+ "Compatibility procedure. Please see 'gegl:displace' for credits.",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("amount-x",
+ "amount x",
+ "Displace multiplier for x direction",
+ -500.0, 500.0, -500.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("amount-y",
+ "amount y",
+ "Displace multiplier for y direction",
+ -500.0, 500.0, -500.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("do-x",
+ "do x",
+ "Displace in x direction ?",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("do-y",
+ "do y",
+ "Displace in y direction ?",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("displace-map-x",
+ "displace map x",
+ "Displacement map for x direction",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("displace-map-y",
+ "displace map y",
+ "Displacement map for y direction",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("displace-type",
+ "displace type",
+ "Edge behavior { WRAP (1), SMEAR (2), BLACK (3) }",
+ 1, 3, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-displace-polar
+ */
+ procedure = gimp_procedure_new (plug_in_displace_polar_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-displace-polar");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-displace-polar",
+ "Displace pixels as indicated by displacement maps",
+ "Just like plug-in-displace but working in polar coordinates. The drawable is whirled and pinched according to the map.",
+ "Compatibility procedure. Please see 'gegl:displace' for credits.",
+ "Compatibility procedure. Please see 'gegl:displace' for credits.",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("amount-x",
+ "amount x",
+ "Displace multiplier for radial direction",
+ -500.0, 500.0, -500.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("amount-y",
+ "amount y",
+ "Displace multiplier for tangent direction",
+ -500.0, 500.0, -500.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("do-x",
+ "do x",
+ "Displace in radial direction ?",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("do-y",
+ "do y",
+ "Displace in tangent direction ?",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("displace-map-x",
+ "displace map x",
+ "Displacement map for radial direction",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("displace-map-y",
+ "displace map y",
+ "Displacement map for tangent direction",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("displace-type",
+ "displace type",
+ "Edge behavior { WRAP (1), SMEAR (2), BLACK (3) }",
+ 1, 3, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-edge
+ */
+ procedure = gimp_procedure_new (plug_in_edge_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-edge");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-edge",
+ "Several simple methods for detecting edges",
+ "Perform edge detection on the contents of the specified drawable. AMOUNT is an arbitrary constant, WRAPMODE is like displace plug-in (useful for tileable image). EDGEMODE sets the kind of matrix transform applied to the pixels, SOBEL was the method used in older versions.",
+ "Compatibility procedure. Please see 'gegl:edge' for credits.",
+ "Compatibility procedure. Please see 'gegl:edge' for credits.",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("amount",
+ "amount",
+ "Edge detection amount",
+ 1.0, 10.0, 1.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("warpmode",
+ "warpmode",
+ "Edge detection behavior { NONE (0), WRAP (1), SMEAR (2), BLACK (3) }",
+ 0, 3, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("edgemode",
+ "edgemode",
+ "Edge detection algorithm { SOBEL (0), PREWITT (1), GRADIENT (2), ROBERTS (3), DIFFERENTIAL (4), LAPLACE (5) }",
+ 0, 5, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-engrave
+ */
+ procedure = gimp_procedure_new (plug_in_engrave_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-engrave");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-engrave",
+ "Simulate an antique engraving",
+ "Creates a black-and-white 'engraved' version of an image as seen in old illustrations.",
+ "Compatibility procedure. Please see 'gegl:engrave' for credits.",
+ "Compatibility procedure. Please see 'gegl:engrave' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "Resolution in pixels",
+ 2, 16, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("limit",
+ "limit",
+ "Limit line width",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-exchange
+ */
+ procedure = gimp_procedure_new (plug_in_exchange_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-exchange");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-exchange",
+ "Swap one color with another",
+ "Exchange one color with another, optionally setting a threshold to convert from one shade to another.",
+ "Compatibility procedure. Please see 'gegl:color-exchange' for credits.",
+ "Compatibility procedure. Please see 'gegl:color-exchange' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("from-red",
+ "from red",
+ "Red value (from)",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("from-green",
+ "from green",
+ "Green value (from)",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("from-blue",
+ "from blue",
+ "Blue value (from)",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("to-red",
+ "to red",
+ "Red value (to)",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("to-green",
+ "to green",
+ "Green value (to)",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("to-blue",
+ "to blue",
+ "Blue value (to)",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("red-threshold",
+ "red threshold",
+ "Red threshold",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("green-threshold",
+ "green threshold",
+ "Green threshold",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("blue-threshold",
+ "blue threshold",
+ "Blue threshold",
+ 0, G_MAXUINT8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-flarefx
+ */
+ procedure = gimp_procedure_new (plug_in_flarefx_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-flarefx");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-flarefx",
+ "Add a lens flare effect",
+ "Adds a lens flare effects. Makes your image look like it was snapped with a cheap camera with a lot of lens :)",
+ "Compatibility procedure. Please see 'gegl:lens-flare' for credits.",
+ "Compatibility procedure. Please see 'gegl:lens-flare' for credits.",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("pos-x",
+ "pos x",
+ "X-Position",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("pos-y",
+ "pos y",
+ "Y-Position",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-gauss
+ */
+ procedure = gimp_procedure_new (plug_in_gauss_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-gauss");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-gauss",
+ "Simplest, most commonly used way of blurring",
+ "Applies a gaussian blur to the drawable, with specified radius of affect. The standard deviation of the normal distribution used to modify pixel values is calculated based on the supplied radius. Horizontal and vertical blurring can be independently invoked by specifying only one to run. The 'method' parameter is ignored.",
+ "Compatibility procedure. Please see 'gegl:gaussian-blur' for credits.",
+ "Compatibility procedure. Please see 'gegl:gaussian-blur' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("horizontal",
+ "horizontal",
+ "Horizontal radius of gaussian blur (in pixels",
+ 0.0, 500.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("vertical",
+ "vertical",
+ "Vertical radius of gaussian blur (in pixels",
+ 0.0, 500.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("method",
+ "method",
+ "Blur method { IIR (0), RLE (1) }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-gauss-iir
+ */
+ procedure = gimp_procedure_new (plug_in_gauss_iir_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-gauss-iir");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-gauss-iir",
+ "Apply a gaussian blur",
+ "Applies a gaussian blur to the drawable, with specified radius of affect. The standard deviation of the normal distribution used to modify pixel values is calculated based on the supplied radius. Horizontal and vertical blurring can be independently invoked by specifying only one to run.",
+ "Compatibility procedure. Please see 'gegl:gaussian-blur' for credits.",
+ "Compatibility procedure. Please see 'gegl:gaussian-blur' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("radius",
+ "radius",
+ "Radius of gaussian blur (in pixels",
+ 0.0, 500.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("horizontal",
+ "horizontal",
+ "Blur in horizontal direction",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("vertical",
+ "vertical",
+ "Blur in vertical direction",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-gauss-iir2
+ */
+ procedure = gimp_procedure_new (plug_in_gauss_iir2_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-gauss-iir2");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-gauss-iir2",
+ "Apply a gaussian blur",
+ "Applies a gaussian blur to the drawable, with specified radius of affect. The standard deviation of the normal distribution used to modify pixel values is calculated based on the supplied radius. Horizontal and vertical blurring can be independently invoked by specifying only one to run.",
+ "Compatibility procedure. Please see 'gegl:gaussian-blur' for credits.",
+ "Compatibility procedure. Please see 'gegl:gaussian-blur' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("horizontal",
+ "horizontal",
+ "Horizontal radius of gaussian blur (in pixels",
+ 0.0, 500.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("vertical",
+ "vertical",
+ "Vertical radius of gaussian blur (in pixels",
+ 0.0, 500.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-gauss-rle
+ */
+ procedure = gimp_procedure_new (plug_in_gauss_rle_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-gauss-rle");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-gauss-rle",
+ "Apply a gaussian blur",
+ "Applies a gaussian blur to the drawable, with specified radius of affect. The standard deviation of the normal distribution used to modify pixel values is calculated based on the supplied radius. Horizontal and vertical blurring can be independently invoked by specifying only one to run.",
+ "Compatibility procedure. Please see 'gegl:gaussian-blur' for credits.",
+ "Compatibility procedure. Please see 'gegl:gaussian-blur' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("radius",
+ "radius",
+ "Radius of gaussian blur (in pixels",
+ 0.0, 500.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("horizontal",
+ "horizontal",
+ "Blur in horizontal direction",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("vertical",
+ "vertical",
+ "Blur in vertical direction",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-gauss-rle2
+ */
+ procedure = gimp_procedure_new (plug_in_gauss_rle2_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-gauss-rle2");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-gauss-rle2",
+ "Apply a gaussian blur",
+ "Applies a gaussian blur to the drawable, with specified radius of affect. The standard deviation of the normal distribution used to modify pixel values is calculated based on the supplied radius. Horizontal and vertical blurring can be independently invoked by specifying only one to run.",
+ "Compatibility procedure. Please see 'gegl:gaussian-blur' for credits.",
+ "Compatibility procedure. Please see 'gegl:gaussian-blur' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("horizontal",
+ "horizontal",
+ "Horizontal radius of gaussian blur (in pixels",
+ 0.0, 500.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("vertical",
+ "vertical",
+ "Vertical radius of gaussian blur (in pixels",
+ 0.0, 500.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-glasstile
+ */
+ procedure = gimp_procedure_new (plug_in_glasstile_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-glasstile");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-glasstile",
+ "Simulate distortion caused by square glass tiles",
+ "Divide the image into square glassblocks in which the image is refracted.",
+ "Compatibility procedure. Please see 'gegl:tile-glass' for credits.",
+ "Compatibility procedure. Please see 'gegl:tile-glass' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("tilex",
+ "tilex",
+ "Tile width",
+ 10, 500, 10,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("tiley",
+ "tiley",
+ "Tile height",
+ 10, 500, 10,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-hsv-noise
+ */
+ procedure = gimp_procedure_new (plug_in_hsv_noise_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-hsv-noise");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-hsv-noise",
+ "Randomize hue, saturation and value independently",
+ "Scattering pixel values in HSV space",
+ "Compatibility procedure. Please see 'gegl:noise-hsv' for credits.",
+ "Compatibility procedure. Please see 'gegl:noise-hsv' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("holdness",
+ "holdness",
+ "Convolution strength",
+ 1, 8, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("hue-distance",
+ "hue distance",
+ "Scattering of hue angle",
+ 0, 180, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("saturation-distance",
+ "saturation distance",
+ "Distribution distance on saturation axis",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("value-distance",
+ "value distance",
+ "Distribution distance on value axis",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-icc-profile-info
+ */
+ procedure = gimp_procedure_new (plug_in_icc_profile_info_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-icc-profile-info");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-icc-profile-info",
+ "Retrieve information about an image's color profile",
+ "This procedure returns information about the RGB color profile attached to an image. If no RGB color profile is attached, sRGB is assumed.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("profile-name",
+ "profile name",
+ "Name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("profile-desc",
+ "profile desc",
+ "Description",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("profile-info",
+ "profile info",
+ "Info",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-icc-profile-file-info
+ */
+ procedure = gimp_procedure_new (plug_in_icc_profile_file_info_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-icc-profile-file-info");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-icc-profile-file-info",
+ "Retrieve information about a color profile",
+ "This procedure returns information about an ICC color profile on disk.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("profile",
+ "profile",
+ "Filename of an ICC color profile",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("profile-name",
+ "profile name",
+ "Name",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("profile-desc",
+ "profile desc",
+ "Description",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("profile-info",
+ "profile info",
+ "Info",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-icc-profile-apply
+ */
+ procedure = gimp_procedure_new (plug_in_icc_profile_apply_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-icc-profile-apply");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-icc-profile-apply",
+ "Apply a color profile on the image",
+ "This procedure transform from the image's color profile (or the default RGB profile if none is set) to the given ICC color profile. Only RGB color profiles are accepted. The profile is then set on the image using the 'icc-profile' \"parasite.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("profile",
+ "profile",
+ "Filename of an ICC color profile",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("intent",
+ "intent",
+ "Rendering intent",
+ GIMP_TYPE_COLOR_RENDERING_INTENT,
+ GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("bpc",
+ "bpc",
+ "Black point compensation",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-icc-profile-apply-rgb
+ */
+ procedure = gimp_procedure_new (plug_in_icc_profile_apply_rgb_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-icc-profile-apply-rgb");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-icc-profile-apply-rgb",
+ "Apply default RGB color profile on the image",
+ "This procedure transform from the image's color profile (or the default RGB profile if none is set) to the configured default RGB color profile. The profile is then set on the image using the 'icc-profile' parasite. If no RGB color profile is configured, sRGB is assumed and the parasite is unset.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("intent",
+ "intent",
+ "Rendering intent",
+ GIMP_TYPE_COLOR_RENDERING_INTENT,
+ GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("bpc",
+ "bpc",
+ "Black point compensation",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-icc-profile-set
+ */
+ procedure = gimp_procedure_new (plug_in_icc_profile_set_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-icc-profile-set");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-icc-profile-set",
+ "Set a color profile on the image",
+ "This procedure sets the user-configured RGB profile on an image using the 'icc-profile' parasite. This procedure does not do any color conversion.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("profile",
+ "profile",
+ "Filename of an ICC color profile",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-icc-profile-set-rgb
+ */
+ procedure = gimp_procedure_new (plug_in_icc_profile_set_rgb_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-icc-profile-set-rgb");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-icc-profile-set-rgb",
+ "Set the default RGB color profile on the image",
+ "This procedure sets the user-configured RGB profile on an image using the 'icc-profile' parasite. If no RGB profile is configured, sRGB is assumed and the parasite is unset. This procedure does not do any color conversion.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-illusion
+ */
+ procedure = gimp_procedure_new (plug_in_illusion_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-illusion");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-illusion",
+ "Superimpose many altered copies of the image",
+ "Produce illusion.",
+ "Compatibility procedure. Please see 'gegl:illusion' for credits.",
+ "Compatibility procedure. Please see 'gegl:illusion' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("division",
+ "division",
+ "The number of divisions",
+ 0, 64, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("type",
+ "type",
+ "Illusion type { TYPE1 (0), TYPE2 (1) }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-laplace
+ */
+ procedure = gimp_procedure_new (plug_in_laplace_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-laplace");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-laplace",
+ "High-resolution edge detection",
+ "This plug-in creates one-pixel wide edges from the image, with the value proportional to the gradient. It uses the Laplace operator (a 3x3 kernel with -8 in the middle). The image has to be laplacered to get useful results, a gauss_iir with 1.5 - 5.0 depending on the noise in the image is best.",
+ "Compatibility procedure. Please see 'gegl:edge-laplace' for credits.",
+ "Compatibility procedure. Please see 'gegl:edge-laplace' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-lens-distortion
+ */
+ procedure = gimp_procedure_new (plug_in_lens_distortion_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-lens-distortion");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-lens-distortion",
+ "Corrects lens distortion",
+ "Corrects barrel or pincushion lens distortion.",
+ "Compatibility procedure. Please see 'gegl:lens-distortion' for credits.",
+ "Compatibility procedure. Please see 'gegl:lens-distortion' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("offset-x",
+ "offset x",
+ "Effect centre offset in X",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("offset-y",
+ "offset y",
+ "Effect centre offset in Y",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("main-adjust",
+ "main adjust",
+ "Amount of second-order distortion",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("edge-adjust",
+ "edge adjust",
+ "Amount of fourth-order distortion",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("rescale",
+ "rescale",
+ "Rescale overall image size",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("brighten",
+ "brighten",
+ "Adjust brightness in corners",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-make-seamless
+ */
+ procedure = gimp_procedure_new (plug_in_make_seamless_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-make-seamless");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-make-seamless",
+ "Alters edges to make the image seamlessly tileable",
+ "This plug-in creates a seamless tileable from the input drawable.",
+ "Compatibility procedure. Please see 'gegl:tile-seamless' for credits.",
+ "Compatibility procedure. Please see 'gegl:tile-seamless' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-maze
+ */
+ procedure = gimp_procedure_new (plug_in_maze_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-maze");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-maze",
+ "Draw a labyrinth",
+ "Generates a maze using either the depth-first search method or Prim's algorithm. Can make tileable mazes too.",
+ "Compatibility procedure. Please see 'gegl:maze' for credits.",
+ "Compatibility procedure. Please see 'gegl:maze' for credits.",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int16 ("width",
+ "width",
+ "Width of the passages",
+ 1, 1024, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int16 ("height",
+ "height",
+ "Height of the passages",
+ 1, 1024, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("tileable",
+ "tileable",
+ "Tileable maze? (TRUE or FALSE)",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8 ("algorithm",
+ "algorithm",
+ "Generation algorithm (0 = DEPTH FIRST, 1 = PRIM'S ALGORITHM)",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("seed",
+ "seed",
+ "Random Seed",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int16 ("multiple",
+ "multiple",
+ "Multiple (use 57)",
+ G_MININT16, G_MAXINT16, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int16 ("offset",
+ "offset",
+ "Offset (use 1)",
+ G_MININT16, G_MAXINT16, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-mblur
+ */
+ procedure = gimp_procedure_new (plug_in_mblur_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-mblur");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-mblur",
+ "Simulate movement using directional blur",
+ "This plug-in simulates the effect seen when photographing a moving object at a slow shutter speed. Done by adding multiple displaced copies.",
+ "Compatibility procedure. Please see 'gegl:motion-blur-linear, -zoom, -cirular' for credits.",
+ "Compatibility procedure. Please see 'gegl:motion-blur-linear, -zoom, -cirular' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("type",
+ "type",
+ "Type of motion blur { LINEAR (0), RADIAL (1), ZOOM (2) }",
+ 0, 2, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("length",
+ "length",
+ "Length",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "Angle",
+ 0, 360, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("center-x",
+ "center x",
+ "Center X",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("center-y",
+ "center y",
+ "Center Y",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-mblur-inward
+ */
+ procedure = gimp_procedure_new (plug_in_mblur_inward_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-mblur-inward");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-mblur-inward",
+ "Simulate movement using directional blur",
+ "This procedure is equivalent to plug-in-mblur but performs the zoom blur inward instead of outward.",
+ "Compatibility procedure. Please see 'gegl:motion-blur-linear, -zoom, -cirular' for credits.",
+ "Compatibility procedure. Please see 'gegl:motion-blur-linear, -zoom, -cirular' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("type",
+ "type",
+ "Type of motion blur { LINEAR (0), RADIAL (1), ZOOM (2) }",
+ 0, 2, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("length",
+ "length",
+ "Length",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "Angle",
+ 0, 360, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("center-x",
+ "center x",
+ "Center X",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("center-y",
+ "center y",
+ "Center Y",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-median-blur
+ */
+ procedure = gimp_procedure_new (plug_in_median_blur_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-median-blur");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-median-blur",
+ "Blur using the median color near each pixel",
+ "Blur resulting from computing the median color in the neighborhood of each pixel",
+ "Compatibility procedure. Please see 'gegl:median-blur' for credits.",
+ "Compatibility procedure. Please see 'gegl:median-blur' for credits.",
+ "2021",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("radius",
+ "radius",
+ "Neighborhood radius, a negative value will calculate with inverted percentiles",
+ -400, 400, -400,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("percentile",
+ "percentile",
+ "Neighborhood color percentile",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-mosaic
+ */
+ procedure = gimp_procedure_new (plug_in_mosaic_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-mosaic");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-mosaic",
+ "Convert the image into irregular tiles",
+ "Mosaic is a filter which transforms an image into what appears to be a mosaic, composed of small primitives, each of constant color and of an approximate size.",
+ "Compatibility procedure. Please see 'gegl:mosaic' for credits.",
+ "Compatibility procedure. Please see 'gegl:mosaic' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("tile-size",
+ "tile size",
+ "Average diameter of each tile (in pixels)",
+ 1, 1000, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("tile-height",
+ "tile height",
+ "Apparent height of each tile (in pixels)",
+ 1, 1000, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("tile-spacing",
+ "tile spacing",
+ "Inter_tile spacing (in pixels)",
+ 0.1, 1000, 0.1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("tile-neatness",
+ "tile neatness",
+ "Deviation from perfectly formed tiles",
+ 0, 1.0, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("tile-allow-split",
+ "tile allow split",
+ "Allows splitting tiles at hard edges",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("light-dir",
+ "light dir",
+ "Direction of light_source (in degrees)",
+ 0, 360, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("color-variation",
+ "color variation",
+ "Magnitude of random color variations",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("antialiasing",
+ "antialiasing",
+ "Enables smoother tile output at the cost of speed",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("color-averaging",
+ "color averaging",
+ "Tile color based on average of subsumed pixels",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("tile-type",
+ "tile type",
+ "Tile geometry { SQUARES (0), HEXAGONS (1), OCTAGONS (2), TRIANGLES (3) }",
+ 0, 3, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("tile-surface",
+ "tile surface",
+ "Surface characteristics { SMOOTH (0), ROUGH (1) }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("grout-color",
+ "grout color",
+ "Grout color (black/white or fore/background) { BW (0), FG-BG (1) }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-neon
+ */
+ procedure = gimp_procedure_new (plug_in_neon_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-neon");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-neon",
+ "Simulate the glowing boundary of a neon light",
+ "This filter works in a manner similar to the edge plug-in, but uses the first derivative of the gaussian operator to achieve resolution independence. The IIR method of calculating the effect is utilized to keep the processing time constant between large and small standard deviations.",
+ "Compatibility procedure. Please see 'gegl:edge-neon' for credits.",
+ "Compatibility procedure. Please see 'gegl:edge-neon' for credits.",
+ "2019",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("radius",
+ "radius",
+ "Radius of neon effect (in pixels)",
+ 0.0, 1500.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("amount",
+ "amount",
+ "Effect enhancement variable",
+ 0.0, 100.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-newsprint
+ */
+ procedure = gimp_procedure_new (plug_in_newsprint_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-newsprint");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-newsprint",
+ "Halftone the image to give newspaper-like effect",
+ "Halftone the image to give newspaper-like effect",
+ "Compatibility procedure. Please see 'gegl:newsprint' for credits.",
+ "Compatibility procedure. Please see 'gegl:newsprint' for credits.",
+ "2019",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("cell-width",
+ "cell width",
+ "Screen cell width in pixels",
+ 0, 1500, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("colorspace",
+ "colorspace",
+ "Separate to { GRAYSCALE (0), RGB (1), CMYK (2), LUMINANCE (3) }",
+ 0, 3, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("k-pullout",
+ "k pullout",
+ "Percentage of black to pullout (CMYK only)",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("gry-ang",
+ "gry ang",
+ "Grey/black screen angle (degrees)",
+ 0.0, 360.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("gry-spotfn",
+ "gry spotfn",
+ "Grey/black spot function { DOTS (0), LINES (1), DIAMONDS (2), EUCLIDIAN-DOT (3), PS-DIAMONDS (4) }",
+ 0, 4, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("red-ang",
+ "red ang",
+ "Red/cyan screen angle (degrees)",
+ 0.0, 360.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("red-spotfn",
+ "red spotfn",
+ "Red/cyan spot function { DOTS (0), LINES (1), DIAMONDS (2), EUCLIDIAN-DOT (3), PS-DIAMONDS (4) }",
+ 0, 4, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("grn-ang",
+ "grn ang",
+ "Green/magenta screen angle (degrees)",
+ 0.0, 360.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("grn-spotfn",
+ "grn spotfn",
+ "Green/magenta spot function { DOTS (0), LINES (1), DIAMONDS (2), EUCLIDIAN-DOT (3), PS-DIAMONDS (4) }",
+ 0, 4, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("blu-ang",
+ "blu ang",
+ "Blue/yellow screen angle (degrees)",
+ 0.0, 360.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("blu-spotfn",
+ "blu spotfn",
+ "Blue/yellow spot function { DOTS (0), LINES (1), DIAMONDS (2), EUCLIDIAN-DOT (3), PS-DIAMONDS (4) }",
+ 0, 4, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("oversample",
+ "oversample",
+ "how many times to oversample spot fn",
+ 0, 128, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-normalize
+ */
+ procedure = gimp_procedure_new (plug_in_normalize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-normalize");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-normalize",
+ "Stretch brightness values to cover the full range",
+ "This plug-in performs almost the same operation as the 'contrast autostretch' plug-in, except that it won't allow the color channels to normalize independently. This is actually what most people probably want instead of contrast-autostretch; use c-a only if you wish to remove an undesirable color-tint from a source image which is supposed to contain pure-white and pure-black.",
+ "Compatibility procedure. Please see 'gegl:stretch-contrast' for credits.",
+ "Compatibility procedure. Please see 'gegl:stretch-contrast' for credits.",
+ "2019",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-nova
+ */
+ procedure = gimp_procedure_new (plug_in_nova_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-nova");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-nova",
+ "Add a starburst to the image",
+ "This plug-in produces an effect like a supernova burst. The amount of the light effect is approximately in proportion to 1/r, where r is the distance from the center of the star.",
+ "Compatibility procedure. Please see 'gegl:supernova' for credits.",
+ "Compatibility procedure. Please see 'gegl:supernova' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("xcenter",
+ "xcenter",
+ "X coordinates of the center of supernova",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("ycenter",
+ "ycenter",
+ "Y coordinates of the center of supernova",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "Color of supernova",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("radius",
+ "radius",
+ "Radius of supernova",
+ 1, 3000, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("nspoke",
+ "nspoke",
+ "Number of spokes",
+ 1, 1024, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("randomhue",
+ "randomhue",
+ "Random hue",
+ 0, 360, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-oilify
+ */
+ procedure = gimp_procedure_new (plug_in_oilify_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-oilify");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-oilify",
+ "Smear colors to simulate an oil painting",
+ "This function performs the well-known oil-paint effect on the specified drawable.",
+ "Compatibility procedure. Please see 'gegl:oilify' for credits.",
+ "Compatibility procedure. Please see 'gegl:oilify' for credits.",
+ "2019",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("mask-size",
+ "mask size",
+ "Oil paint mask size",
+ 1, 200, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("mode",
+ "mode",
+ "Algorithm { RGB (0), INTENSITY (1) }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-oilify-enhanced
+ */
+ procedure = gimp_procedure_new (plug_in_oilify_enhanced_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-oilify-enhanced");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-oilify-enhanced",
+ "Smear colors to simulate an oil painting",
+ "This function performs the well-known oil-paint effect on the specified drawable.",
+ "Compatibility procedure. Please see 'gegl:oilify' for credits.",
+ "Compatibility procedure. Please see 'gegl:oilify' for credits.",
+ "2019",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("mode",
+ "mode",
+ "Algorithm { RGB (0), INTENSITY (1) }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("mask-size",
+ "mask size",
+ "Oil paint mask size",
+ 1, 200, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("mask-size-map",
+ "mask size map",
+ "Mask size control map",
+ pdb->gimp, TRUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("exponent",
+ "exponent",
+ "Oil paint exponent",
+ 1, 20, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("exponent-map",
+ "exponent map",
+ "Exponent control map",
+ pdb->gimp, TRUE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-papertile
+ */
+ procedure = gimp_procedure_new (plug_in_papertile_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-papertile");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-papertile",
+ "Cut image into paper tiles, and slide them",
+ "This plug-in cuts an image into paper tiles and slides each paper tile.",
+ "Compatibility procedure. Please see 'gegl:tile-paper' for credits.",
+ "Compatibility procedure. Please see 'gegl:tile-paper' for credits.",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("tile-size",
+ "tile size",
+ "Tile size (pixels)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("move-max",
+ "move max",
+ "Max move rate (%)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("fractional-type",
+ "fractional type",
+ "Fractional type { BACKGROUND (0), IGNORE (1), FORCE (2) }",
+ 0, 2, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("wrap-around",
+ "wrap around",
+ "Wrap around",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("centering",
+ "centering",
+ "Centering",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("background-type",
+ "background type",
+ "Background type { TRANSPARENT (0), INVERTED (1), IMAGE (2), FG (3), BG (4), COLOR (5) }",
+ 0, 5, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("background-color",
+ "background color",
+ "Background color (for background-type == 5)",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("background-alpha",
+ "background alpha",
+ "Background alpha (unused)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-pixelize
+ */
+ procedure = gimp_procedure_new (plug_in_pixelize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-pixelize");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-pixelize",
+ "Simplify image into an array of solid-colored squares",
+ "Pixelize the contents of the specified drawable with specified pixelizing width.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("pixel-width",
+ "pixel width",
+ "Pixel width (the decrease in resolution)",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-pixelize2
+ */
+ procedure = gimp_procedure_new (plug_in_pixelize2_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-pixelize2");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-pixelize2",
+ "Simplify image into an array of solid-colored rectangles",
+ "Pixelize the contents of the specified drawable with specified pixelizing width and height.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("pixel-width",
+ "pixel width",
+ "Pixel width (the decrease in horizontal resolution)",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("pixel-height",
+ "pixel height",
+ "Pixel height (the decrease in vertical resolution)",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-plasma
+ */
+ procedure = gimp_procedure_new (plug_in_plasma_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-plasma");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-plasma",
+ "Create a random plasma texture",
+ "This plug-in produces plasma fractal images.",
+ "Compatibility procedure. Please see 'gegl:plasma' for credits.",
+ "Compatibility procedure. Please see 'gegl:plasma' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("seed",
+ "seed",
+ "Random seed",
+ -1, G_MAXINT, -1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("turbulence",
+ "turbulence",
+ "The value of the turbulence",
+ 0.0, 7.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-polar-coords
+ */
+ procedure = gimp_procedure_new (plug_in_polar_coords_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-polar-coords");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-polar-coords",
+ "Convert image to or from polar coordinates",
+ "Remaps and image from rectangular coordinates to polar coordinates or vice versa.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("circle",
+ "circle",
+ "Circle depth in %",
+ 0.0, 100.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "Offset angle",
+ 0.0, 360.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("backwards",
+ "backwards",
+ "Map backwards",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("inverse",
+ "inverse",
+ "Map from top",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("polrec",
+ "polrec",
+ "Polar to rectangular",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-red-eye-removal
+ */
+ procedure = gimp_procedure_new (plug_in_red_eye_removal_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-red-eye-removal");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-red-eye-removal",
+ "Remove the red eye effect caused by camera flashes",
+ "This procedure removes the red eye effect caused by camera flashes by using a percentage based red color threshold. Make a selection containing the eyes, and apply the filter while adjusting the threshold to accurately remove the red eyes.",
+ "Compatibility procedure. Please see 'gegl:red-eye-removal' for credits.",
+ "Compatibility procedure. Please see 'gegl:red-eye-removal' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("threshold",
+ "threshold",
+ "Red eye threshold in percent",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-randomize-hurl
+ */
+ procedure = gimp_procedure_new (plug_in_randomize_hurl_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-randomize-hurl");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-randomize-hurl",
+ "Completely randomize a fraction of pixels",
+ "This plug-in \"hurls\" randomly-valued pixels onto the selection or image. You may select the percentage of pixels to modify and the number of times to repeat the process.",
+ "Compatibility procedure. Please see 'gegl:noise-hurl' for credits.",
+ "Compatibility procedure. Please see 'gegl:noise-hurl' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("rndm-pct",
+ "rndm pct",
+ "Randomization percentage",
+ 0.0, 100.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("rndm-rcount",
+ "rndm rcount",
+ "Repeat count",
+ 1.0, 100.0, 1.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("randomize",
+ "randomize",
+ "Use random seed",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("seed",
+ "seed",
+ "Seed value (used only if randomize is FALSE)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-randomize-pick
+ */
+ procedure = gimp_procedure_new (plug_in_randomize_pick_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-randomize-pick");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-randomize-pick",
+ "Randomly interchange some pixels with neighbors",
+ "This plug-in replaces a pixel with a random adjacent pixel. You may select the percentage of pixels to modify and the number of times to repeat the process.",
+ "Compatibility procedure. Please see 'gegl:noise-pick' for credits.",
+ "Compatibility procedure. Please see 'gegl:noise-pick' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("rndm-pct",
+ "rndm pct",
+ "Randomization percentage",
+ 1.0, 100.0, 1.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("rndm-rcount",
+ "rndm rcount",
+ "Repeat count",
+ 1.0, 100.0, 1.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("randomize",
+ "randomize",
+ "Use random seed",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("seed",
+ "seed",
+ "Seed value (used only if randomize is FALSE)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-randomize-slur
+ */
+ procedure = gimp_procedure_new (plug_in_randomize_slur_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-randomize-slur");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-randomize-slur",
+ "Randomly slide some pixels downward (similar to melting",
+ "This plug-in \"slurs\" (melts like a bunch of icicles) an image. You may select the percentage of pixels to modify and the number of times to repeat the process.",
+ "Compatibility procedure. Please see 'gegl:noise-slur' for credits.",
+ "Compatibility procedure. Please see 'gegl:noise-slur' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("rndm-pct",
+ "rndm pct",
+ "Randomization percentage",
+ 1.0, 100.0, 1.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("rndm-rcount",
+ "rndm rcount",
+ "Repeat count",
+ 1.0, 100.0, 1.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("randomize",
+ "randomize",
+ "Use random seed",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("seed",
+ "seed",
+ "Seed value (used only if randomize is FALSE)",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-rgb-noise
+ */
+ procedure = gimp_procedure_new (plug_in_rgb_noise_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-rgb-noise");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-rgb-noise",
+ "Distort colors by random amounts",
+ "Add normally distributed (zero mean) random values to image channels. Noise may be additive (uncorrelated) or multiplicative (correlated - also known as speckle noise). For color images color channels may be treated together or independently.",
+ "Compatibility procedure. Please see 'gegl:noise-rgb' for credits.",
+ "Compatibility procedure. Please see 'gegl:noise-rgb' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("independent",
+ "independent",
+ "Noise in channels independent",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("correlated",
+ "correlated",
+ "Noise correlated (i.e. multiplicative not additive)",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("noise-1",
+ "noise 1",
+ "Noise in the first channel (red, gray)",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("noise-2",
+ "noise 2",
+ "Noise in the second channel (green, gray_alpha)",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("noise-3",
+ "noise 3",
+ "Noise in the third channel (blue)",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("noise-4",
+ "noise 4",
+ "Noise in the fourth channel (alpha)",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-ripple
+ */
+ procedure = gimp_procedure_new (plug_in_ripple_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-ripple");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-ripple",
+ "Displace pixels in a ripple pattern",
+ "Ripples the pixels of the specified drawable. Each row or column will be displaced a certain number of pixels coinciding with the given wave form.",
+ "Compatibility procedure. Please see 'gegl:ripple' for credits.",
+ "Compatibility procedure. Please see 'gegl:ripple' for credits.",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("period",
+ "period",
+ "Period: number of pixels for one wave to complete",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("amplitude",
+ "amplitude",
+ "Amplitude: maximum displacement of wave",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("orientation",
+ "orientation",
+ "Orientation { ORIENTATION-HORIZONTAL (0), ORIENTATION-VERTICAL (1) }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("edges",
+ "edges",
+ "Edges { SMEAR (0), WRAP (1), BLANK (2) }",
+ 0, 2, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("waveform",
+ "waveform",
+ "Waveform { SAWTOOTH (0), SINE (1) }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "Antialias { TRUE, FALSE }",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("tile",
+ "tile",
+ "Tileable { TRUE, FALSE }",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-rotate
+ */
+ procedure = gimp_procedure_new (plug_in_rotate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-rotate");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-rotate",
+ "Rotates a layer or the whole image by 90, 180 or 270 degrees",
+ "This plug-in does rotate the active layer or the whole image clockwise by multiples of 90 degrees. When the whole image is chosen, the image is resized if necessary.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("angle",
+ "angle",
+ "Angle { 90 (1), 180 (2), 270 (3) } degrees",
+ 1, 3, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("everything",
+ "everything",
+ "Rotate the whole image",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-noisify
+ */
+ procedure = gimp_procedure_new (plug_in_noisify_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-noisify");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-noisify",
+ "Adds random noise to image channels",
+ "Add normally distributed random values to image channels. For color images each color channel may be treated together or independently.",
+ "Compatibility procedure. Please see 'gegl:noise-rgb' for credits.",
+ "Compatibility procedure. Please see 'gegl:noise-rgb' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("independent",
+ "independent",
+ "Noise in channels independent",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("noise-1",
+ "noise 1",
+ "Noise in the first channel (red, gray)",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("noise-2",
+ "noise 2",
+ "Noise in the second channel (green, gray_alpha)",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("noise-3",
+ "noise 3",
+ "Noise in the third channel (blue)",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("noise-4",
+ "noise 4",
+ "Noise in the fourth channel (alpha)",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-sel-gauss
+ */
+ procedure = gimp_procedure_new (plug_in_sel_gauss_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-sel-gauss");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-sel-gauss",
+ "Blur neighboring pixels, but only in low-contrast areas",
+ "This filter functions similar to the regular gaussian blur filter except that neighbouring pixels that differ more than the given maxdelta parameter will not be blended with. This way with the correct parameters, an image can be smoothed out without losing details. However, this filter can be rather slow.",
+ "Compatibility procedure. Please see 'gegl:gaussian-blur-selective' for credits.",
+ "Compatibility procedure. Please see 'gegl:gaussian-blur-selective' for credits.",
+ "2099",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("radius",
+ "radius",
+ "Radius of gaussian blur (in pixels)",
+ 0.0, G_MAXDOUBLE, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("max-delta",
+ "max delta",
+ "Maximum delta",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-semiflatten
+ */
+ procedure = gimp_procedure_new (plug_in_semiflatten_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-semiflatten");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-semiflatten",
+ "Replace partial transparency with the current background color",
+ "This plug-in flattens pixels in an RGBA image that aren't completely transparent against the current GIMP background color.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-shift
+ */
+ procedure = gimp_procedure_new (plug_in_shift_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-shift");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-shift",
+ "Shift each row or column of pixels by a random amount",
+ "Shifts the pixels of the specified drawable. Each row or column will be displaced a random value of pixels.",
+ "Compatibility procedure. Please see 'gegl:shift' for credits.",
+ "Compatibility procedure. Please see 'gegl:shift' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("shift-amount",
+ "shift amount",
+ "Shift amount",
+ 0, 200, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("orientation",
+ "orientation",
+ "Orientation { ORIENTATION-VERTICAL (0), ORIENTATION-HORIZONTAL (1) }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-sinus
+ */
+ procedure = gimp_procedure_new (plug_in_sinus_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-sinus");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-sinus",
+ "Generate complex sinusoidal textures",
+ "FIXME: sinus help",
+ "Compatibility procedure. Please see 'gegl:sinus' for credits.",
+ "Compatibility procedure. Please see 'gegl:sinus' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("xscale",
+ "xscale",
+ "Scale value for x axis",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("yscale",
+ "yscale",
+ "Scale value for y axis",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("complex",
+ "complex",
+ "Complexity factor",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("seed",
+ "seed",
+ "Seed value for random number generator",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("tiling",
+ "tiling",
+ "If set, the pattern generated will tile",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("perturb",
+ "perturb",
+ "If set, the pattern is a little more distorted...",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("colors",
+ "colors",
+ "where to take the colors (0=B&W, 1=fg/bg, 2=col1/col2)",
+ 0, 2, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("col1",
+ "col1",
+ "fist color (sometimes unused)",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("col2",
+ "col2",
+ "second color (sometimes unused)",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("alpha1",
+ "alpha1",
+ "alpha for the first color (used if the drawable has an alpha channel)",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("alpha2",
+ "alpha2",
+ "alpha for the second color (used if the drawable has an alpha channel)",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("blend",
+ "blend",
+ "0=linear, 1=bilinear, 2=sinusoidal",
+ 0, 2, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("blend-power",
+ "blend power",
+ "Power used to stretch the blend",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-sobel
+ */
+ procedure = gimp_procedure_new (plug_in_sobel_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-sobel");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-sobel",
+ "Specialized direction-dependent edge detection",
+ "This plug-in calculates the gradient with a sobel operator. The user can specify which direction to use. When both directions are used, the result is the RMS of the two gradients; if only one direction is used, the result either the absolute value of the gradient, or 127 + gradient (if the 'keep sign' switch is on). This way, information about the direction of the gradient is preserved. Resulting images are not autoscaled.\"",
+ "Compatibility procedure. Please see 'gegl:edge-sobel' for credits.",
+ "Compatibility procedure. Please see 'gegl:edge-sobel' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("horizontal",
+ "horizontal",
+ "Sobel in horizontal direction",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("vertical",
+ "vertical",
+ "Sobel in vertical direction",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("keep-sign",
+ "keep sign",
+ "Keep sign of result (one direction only)",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-solid-noise
+ */
+ procedure = gimp_procedure_new (plug_in_solid_noise_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-solid-noise");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-solid-noise",
+ "Create a random cloud-like texture",
+ "Generates 2D textures using Perlin's classic solid noise function.",
+ "Compatibility procedure. Please see 'gegl:noise-solid' for credits.",
+ "Compatibility procedure. Please see 'gegl:noise-solid' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("tileable",
+ "tileable",
+ "Create a tileable output",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("turbulent",
+ "turbulent",
+ "Make a turbulent noise",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("seed",
+ "seed",
+ "Random seed",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("detail",
+ "detail",
+ "Detail level",
+ 0, 15, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("xsize",
+ "xsize",
+ "Horizontal texture size",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("ysize",
+ "ysize",
+ "Vertical texture size",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-spread
+ */
+ procedure = gimp_procedure_new (plug_in_spread_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-spread");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-spread",
+ "Move pixels around randomly",
+ "Spreads the pixels of the specified drawable. Pixels are randomly moved to another location whose distance varies from the original by the horizontal and vertical spread amounts.",
+ "Compatibility procedure. Please see 'gegl:noise-spread' for credits.",
+ "Compatibility procedure. Please see 'gegl:noise-spread' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("spread-amount-x",
+ "spread amount x",
+ "Horizontal spread amount",
+ 0, 200, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("spread-amount-y",
+ "spread amount y",
+ "Vertical spread amount",
+ 0, 200, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-threshold-alpha
+ */
+ procedure = gimp_procedure_new (plug_in_threshold_alpha_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-threshold-alpha");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-threshold-alpha",
+ "Make transparency all-or-nothing",
+ "Make transparency all-or-nothing.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("threshold",
+ "threshold",
+ "Threshold",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-unsharp-mask
+ */
+ procedure = gimp_procedure_new (plug_in_unsharp_mask_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-unsharp-mask");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-unsharp-mask",
+ "The most widely useful method for sharpening an image",
+ "The unsharp mask is a sharpening filter that works by comparing using the difference of the image and a blurred version of the image. It is commonly used on photographic images, and is provides a much more pleasing result than the standard sharpen filter.",
+ "Compatibility procedure. Please see 'gegl:unsharp-mask' for credits.",
+ "Compatibility procedure. Please see 'gegl:unsharp-mask' for credits.",
+ "2018",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("radius",
+ "radius",
+ "Radius of gaussian blur",
+ 0.0, 300.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("amount",
+ "amount",
+ "Strength of effect",
+ 0.0, 300.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("threshold",
+ "threshold",
+ "Threshold",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-video
+ */
+ procedure = gimp_procedure_new (plug_in_video_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-video");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-video",
+ "Simulate distortion produced by a fuzzy or low-res monitor",
+ "This function simulates the degradation of being on an old low-dotpitch RGB video monitor to the specified drawable.",
+ "Compatibility procedure. Please see 'gegl:video-degradation' for credits.",
+ "Compatibility procedure. Please see 'gegl:video-degradation' for credits.",
+ "2014",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("pattern-number",
+ "pattern number",
+ "Type of RGB pattern to use",
+ 0, 8, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("additive",
+ "additive",
+ "Whether the function adds the result to the original image",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("rotated",
+ "rotated",
+ "Whether to rotate the RGB pattern by ninety degrees",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-vinvert
+ */
+ procedure = gimp_procedure_new (plug_in_vinvert_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-vinvert");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-vinvert",
+ "Invert the brightness of each pixel",
+ "This function takes an indexed/RGB image and inverts its 'value' in HSV space. The upshot of this is that the color and saturation at any given point remains the same, but its brightness is effectively inverted. Quite strange. Sometimes produces unpleasant color artifacts on images from lossy sources (ie. JPEG).",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-vpropagate
+ */
+ procedure = gimp_procedure_new (plug_in_vpropagate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-vpropagate");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-vpropagate",
+ "Propagate certain colors to neighboring pixels",
+ "Propagate values of the layer.",
+ "Compatibility procedure. Please see 'gegl:value-propagate' for credits.",
+ "Compatibility procedure. Please see 'gegl:value-propagate' for credits.",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("propagate-mode",
+ "propagate mode",
+ "Propagate mode { 0:white, 1:black, 2:middle value 3:foreground to peak, 4:foreground, 5:background, 6:opaque, 7:transparent }",
+ 0, 7, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("propagating-channel",
+ "propagating channel",
+ "Channels which values are propagated",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("propagating-rate",
+ "propagating rate",
+ "Propagating rate",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("direction-mask",
+ "direction mask",
+ "Direction mask",
+ 0, 15, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("lower-limit",
+ "lower limit",
+ "Lower limit",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("upper-limit",
+ "upper limit",
+ "Upper limit",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-dilate
+ */
+ procedure = gimp_procedure_new (plug_in_dilate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-dilate");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-dilate",
+ "Grow lighter areas of the image",
+ "Dilate image.",
+ "Compatibility procedure. Please see 'gegl:value-propagate' for credits.",
+ "Compatibility procedure. Please see 'gegl:value-propagate' for credits.",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("propagate-mode",
+ "propagate mode",
+ "Propagate mode { 0:white, 1:black, 2:middle value 3:foreground to peak, 4:foreground, 5:background, 6:opaque, 7:transparent }",
+ 0, 7, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("propagating-channel",
+ "propagating channel",
+ "Channels which values are propagated",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("propagating-rate",
+ "propagating rate",
+ "Propagating rate",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("direction-mask",
+ "direction mask",
+ "Direction mask",
+ 0, 15, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("lower-limit",
+ "lower limit",
+ "Lower limit",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("upper-limit",
+ "upper limit",
+ "Upper limit",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-erode
+ */
+ procedure = gimp_procedure_new (plug_in_erode_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-erode");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-erode",
+ "Shrink lighter areas of the image",
+ "Erode image.",
+ "Compatibility procedure. Please see 'gegl:value-propagate' for credits.",
+ "Compatibility procedure. Please see 'gegl:value-propagate' for credits.",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("propagate-mode",
+ "propagate mode",
+ "Propagate mode { 0:white, 1:black, 2:middle value 3:foreground to peak, 4:foreground, 5:background, 6:opaque, 7:transparent }",
+ 0, 7, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("propagating-channel",
+ "propagating channel",
+ "Channels which values are propagated",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("propagating-rate",
+ "propagating rate",
+ "Propagating rate",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("direction-mask",
+ "direction mask",
+ "Direction mask",
+ 0, 15, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("lower-limit",
+ "lower limit",
+ "Lower limit",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("upper-limit",
+ "upper limit",
+ "Upper limit",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-waves
+ */
+ procedure = gimp_procedure_new (plug_in_waves_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-waves");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-waves",
+ "Distort the image with waves",
+ "Distort the image with waves.",
+ "Compatibility procedure. Please see 'gegl:waves' for credits.",
+ "Compatibility procedure. Please see 'gegl:waves' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("amplitude",
+ "amplitude",
+ "The Amplitude of the Waves",
+ 0, 101, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("phase",
+ "phase",
+ "The Phase of the Waves",
+ -360, 360, -360,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("wavelength",
+ "wavelength",
+ "The Wavelength of the Waves",
+ 0.1, 50, 0.1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("type",
+ "type",
+ "Type of waves: { 0 = smeared, 1 = black }",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("reflective",
+ "reflective",
+ "Use Reflection (not implemented)",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-whirl-pinch
+ */
+ procedure = gimp_procedure_new (plug_in_whirl_pinch_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-whirl-pinch");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-whirl-pinch",
+ "Distort an image by whirling and pinching",
+ "Distorts the image by whirling and pinching, which are two common center-based, circular distortions. Whirling is like projecting the image onto the surface of water in a toilet and flushing. Pinching is similar to projecting the image onto an elastic surface and pressing or pulling on the center of the surface.",
+ "Compatibility procedure. Please see 'gegl:whirl-pinch' for credits.",
+ "Compatibility procedure. Please see 'gegl:whirl-pinch' for credits.",
+ "2013",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("whirl",
+ "whirl",
+ "Whirl angle (degrees)",
+ -720, 720, -720,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("pinch",
+ "pinch",
+ "Pinch amount",
+ -1, 1, -1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("radius",
+ "radius",
+ "Radius (1.0 is the largest circle that fits in the image, and 2.0 goes all the way to the corners)",
+ 0, 2, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-wind
+ */
+ procedure = gimp_procedure_new (plug_in_wind_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-wind");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-wind",
+ "Smear image to give windblown effect",
+ "Renders a wind effect.",
+ "Compatibility procedure. Please see 'gegl:wind' for credits.",
+ "Compatibility procedure. Please see 'gegl:wind' for credits.",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image (unused)",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "Input drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("threshold",
+ "threshold",
+ "Controls where blending will be done",
+ 0, 50, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("direction",
+ "direction",
+ "Wind direction { 0:left, 1:right, 2:top, 3:bottom }",
+ 0, 3, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("strength",
+ "strength",
+ "Controls the extent of the blending",
+ 1, 100, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("algorithm",
+ "algorithm",
+ "Algorithm { WIND (0), BLAST (1) }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("edge",
+ "edge",
+ "Affected edge { BOTH (0), LEADING (1), TRAILING (2) }",
+ 0, 2, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/procedural-db-cmds.c b/app/pdb/procedural-db-cmds.c
new file mode 100644
index 0000000..bb8896e
--- /dev/null
+++ b/app/pdb/procedural-db-cmds.c
@@ -0,0 +1,926 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpparamspecs-desc.h"
+#include "core/gimpparamspecs.h"
+#include "gimp-pdb-compat.h"
+#include "gimppdb-query.h"
+#include "plug-in/gimppluginmanager-data.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+procedural_db_temp_name_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gchar *temp_name = NULL;
+
+ static gint proc_number = 0;
+
+ temp_name = g_strdup_printf ("temp-procedure-number-%d", proc_number++);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_take_string (gimp_value_array_index (return_vals, 1), temp_name);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+procedural_db_dump_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *filename;
+
+ filename = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GFile *file = g_file_new_for_path (filename);
+
+ success = gimp_pdb_dump (gimp->pdb, file, error);
+
+ g_object_unref (file);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+procedural_db_query_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *name;
+ const gchar *blurb;
+ const gchar *help;
+ const gchar *author;
+ const gchar *copyright;
+ const gchar *date;
+ const gchar *proc_type;
+ gint32 num_matches = 0;
+ gchar **procedure_names = NULL;
+
+ name = g_value_get_string (gimp_value_array_index (args, 0));
+ blurb = g_value_get_string (gimp_value_array_index (args, 1));
+ help = g_value_get_string (gimp_value_array_index (args, 2));
+ author = g_value_get_string (gimp_value_array_index (args, 3));
+ copyright = g_value_get_string (gimp_value_array_index (args, 4));
+ date = g_value_get_string (gimp_value_array_index (args, 5));
+ proc_type = g_value_get_string (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ success = gimp_pdb_query (gimp->pdb,
+ name, blurb, help, author,
+ copyright, date, proc_type,
+ &num_matches, &procedure_names,
+ error);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_matches);
+ gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), procedure_names, num_matches);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+procedural_db_proc_exists_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *procedure_name;
+ gboolean exists = FALSE;
+
+ procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpProcedure *procedure;
+ gchar *canonical;
+
+ canonical = gimp_canonicalize_identifier (procedure_name);
+
+ procedure = gimp_pdb_lookup_procedure (gimp->pdb, canonical);
+
+ if (! procedure)
+ {
+ procedure_name = gimp_pdb_lookup_compat_proc_name (gimp->pdb, canonical);
+
+ if (procedure_name)
+ procedure = gimp_pdb_lookup_procedure (gimp->pdb, procedure_name);
+ }
+
+ g_free (canonical);
+
+ exists = (procedure != NULL);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), exists);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+procedural_db_proc_info_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *procedure_name;
+ gchar *blurb = NULL;
+ gchar *help = NULL;
+ gchar *author = NULL;
+ gchar *copyright = NULL;
+ gchar *date = NULL;
+ gint32 proc_type = 0;
+ gint32 num_args = 0;
+ gint32 num_values = 0;
+
+ procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPDBProcType ptype;
+ gchar *canonical;
+
+ canonical = gimp_canonicalize_identifier (procedure_name);
+
+ success = gimp_pdb_proc_info (gimp->pdb, canonical,
+ &blurb, &help, &author,
+ &copyright, &date, &ptype,
+ &num_args, &num_values,
+ error);
+ proc_type = ptype;
+
+ g_free (canonical);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_take_string (gimp_value_array_index (return_vals, 1), blurb);
+ g_value_take_string (gimp_value_array_index (return_vals, 2), help);
+ g_value_take_string (gimp_value_array_index (return_vals, 3), author);
+ g_value_take_string (gimp_value_array_index (return_vals, 4), copyright);
+ g_value_take_string (gimp_value_array_index (return_vals, 5), date);
+ g_value_set_enum (gimp_value_array_index (return_vals, 6), proc_type);
+ g_value_set_int (gimp_value_array_index (return_vals, 7), num_args);
+ g_value_set_int (gimp_value_array_index (return_vals, 8), num_values);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+procedural_db_proc_arg_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *procedure_name;
+ gint32 arg_num;
+ gint32 arg_type = 0;
+ gchar *arg_name = NULL;
+ gchar *arg_desc = NULL;
+
+ procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+ arg_num = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpProcedure *proc;
+ gchar *canonical;
+
+ canonical = gimp_canonicalize_identifier (procedure_name);
+
+ proc = gimp_pdb_lookup_procedure (gimp->pdb, canonical);
+
+ if (! proc)
+ {
+ const gchar *compat_name;
+
+ compat_name = gimp_pdb_lookup_compat_proc_name (gimp->pdb, canonical);
+
+ if (compat_name)
+ proc = gimp_pdb_lookup_procedure (gimp->pdb, compat_name);
+ }
+
+ g_free (canonical);
+
+ if (proc && (arg_num >= 0 && arg_num < proc->num_args))
+ {
+ GParamSpec *pspec = proc->args[arg_num];
+
+ arg_type = gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec));
+ arg_name = g_strdup (g_param_spec_get_name (pspec));
+ arg_desc = gimp_param_spec_get_desc (pspec);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), arg_type);
+ g_value_take_string (gimp_value_array_index (return_vals, 2), arg_name);
+ g_value_take_string (gimp_value_array_index (return_vals, 3), arg_desc);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+procedural_db_proc_val_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *procedure_name;
+ gint32 val_num;
+ gint32 val_type = 0;
+ gchar *val_name = NULL;
+ gchar *val_desc = NULL;
+
+ procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+ val_num = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpProcedure *proc;
+ gchar *canonical;
+
+ canonical = gimp_canonicalize_identifier (procedure_name);
+
+ proc = gimp_pdb_lookup_procedure (gimp->pdb, canonical);
+
+ if (! proc)
+ {
+ const gchar *compat_name;
+
+ compat_name = gimp_pdb_lookup_compat_proc_name (gimp->pdb, canonical);
+
+ if (compat_name)
+ proc = gimp_pdb_lookup_procedure (gimp->pdb, compat_name);
+ }
+
+ g_free (canonical);
+
+ if (proc && (val_num >= 0 && val_num < proc->num_values))
+ {
+ GParamSpec *pspec = proc->values[val_num];
+
+ val_type = gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec));
+ val_name = g_strdup (g_param_spec_get_name (pspec));
+ val_desc = gimp_param_spec_get_desc (pspec);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), val_type);
+ g_value_take_string (gimp_value_array_index (return_vals, 2), val_name);
+ g_value_take_string (gimp_value_array_index (return_vals, 3), val_desc);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+procedural_db_get_data_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *identifier;
+ gint32 bytes = 0;
+ guint8 *data = NULL;
+
+ identifier = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ gchar *canonical = gimp_canonicalize_identifier (identifier);
+ const guint8 *orig_data;
+
+ orig_data = gimp_plug_in_manager_get_data (gimp->plug_in_manager,
+ canonical, &bytes);
+
+ g_free (canonical);
+
+ if (orig_data)
+ data = g_memdup (orig_data, bytes);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), bytes);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 2), data, bytes);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+procedural_db_get_data_size_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *identifier;
+ gint32 bytes = 0;
+
+ identifier = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ gchar *canonical = gimp_canonicalize_identifier (identifier);
+
+ if (! gimp_plug_in_manager_get_data (gimp->plug_in_manager,
+ canonical, &bytes))
+ success = FALSE;
+
+ g_free (canonical);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), bytes);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+procedural_db_set_data_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *identifier;
+ gint32 bytes;
+ const guint8 *data;
+
+ identifier = g_value_get_string (gimp_value_array_index (args, 0));
+ bytes = g_value_get_int (gimp_value_array_index (args, 1));
+ data = gimp_value_get_int8array (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ gchar *canonical = gimp_canonicalize_identifier (identifier);
+
+ gimp_plug_in_manager_set_data (gimp->plug_in_manager,
+ canonical, bytes, data);
+
+ g_free (canonical);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_procedural_db_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-procedural-db-temp-name
+ */
+ procedure = gimp_procedure_new (procedural_db_temp_name_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-procedural-db-temp-name");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Andy Thomas",
+ "Andy Thomas",
+ "1998",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("temp-name",
+ "temp name",
+ "A unique temporary name for a temporary PDB entry",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-procedural-db-dump
+ */
+ procedure = gimp_procedure_new (procedural_db_dump_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-procedural-db-dump");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-procedural-db-dump",
+ "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.",
+ "Spencer Kimball & Josh MacDonald",
+ "Spencer Kimball & Josh MacDonald & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filename",
+ "filename",
+ "The dump filename",
+ TRUE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-procedural-db-query
+ */
+ procedure = gimp_procedure_new (procedural_db_query_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-procedural-db-query");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-procedural-db-query",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The regex for procedure name",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("blurb",
+ "blurb",
+ "The regex for procedure blurb",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("help",
+ "help",
+ "The regex for procedure help",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("author",
+ "author",
+ "The regex for procedure author",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("copyright",
+ "copyright",
+ "The regex for procedure copyright",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("date",
+ "date",
+ "The regex for procedure date",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("proc-type",
+ "proc type",
+ "The regex for procedure type: { 'Internal GIMP procedure', 'GIMP Plug-in', 'GIMP Extension', 'Temporary Procedure' }",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-matches",
+ "num matches",
+ "The number of matching procedures",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("procedure-names",
+ "procedure names",
+ "The list of procedure names",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-procedural-db-proc-exists
+ */
+ procedure = gimp_procedure_new (procedural_db_proc_exists_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-procedural-db-proc-exists");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-procedural-db-proc-exists",
+ "Checks if the specified procedure exists in the procedural database",
+ "This procedure checks if the specified procedure is registered in the procedural database.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("procedure-name",
+ "procedure name",
+ "The procedure name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("exists",
+ "exists",
+ "Whether a procedure of that name is registered",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-procedural-db-proc-info
+ */
+ procedure = gimp_procedure_new (procedural_db_proc_info_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-procedural-db-proc-info");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-procedural-db-proc-info",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("procedure-name",
+ "procedure name",
+ "The procedure name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("blurb",
+ "blurb",
+ "A short blurb",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("help",
+ "help",
+ "Detailed procedure help",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("author",
+ "author",
+ "Author(s) of the procedure",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("copyright",
+ "copyright",
+ "The copyright",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("date",
+ "date",
+ "Copyright date",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("proc-type",
+ "proc type",
+ "The procedure type",
+ GIMP_TYPE_PDB_PROC_TYPE,
+ GIMP_INTERNAL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-args",
+ "num args",
+ "The number of input arguments",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-values",
+ "num values",
+ "The number of return values",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-procedural-db-proc-arg
+ */
+ procedure = gimp_procedure_new (procedural_db_proc_arg_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-procedural-db-proc-arg");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-procedural-db-proc-arg",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("procedure-name",
+ "procedure name",
+ "The procedure name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("arg-num",
+ "arg num",
+ "The argument number",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_enum ("arg-type",
+ "arg type",
+ "The type of argument",
+ GIMP_TYPE_PDB_ARG_TYPE,
+ GIMP_PDB_INT32,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->values[0]),
+ GIMP_PDB_END);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("arg-name",
+ "arg name",
+ "The name of the argument",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("arg-desc",
+ "arg desc",
+ "A description of the argument",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-procedural-db-proc-val
+ */
+ procedure = gimp_procedure_new (procedural_db_proc_val_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-procedural-db-proc-val");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-procedural-db-proc-val",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("procedure-name",
+ "procedure name",
+ "The procedure name",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("val-num",
+ "val num",
+ "The return value number",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_enum ("val-type",
+ "val type",
+ "The type of return value",
+ GIMP_TYPE_PDB_ARG_TYPE,
+ GIMP_PDB_INT32,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->values[0]),
+ GIMP_PDB_END);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("val-name",
+ "val name",
+ "The name of the return value",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("val-desc",
+ "val desc",
+ "A description of the return value",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-procedural-db-get-data
+ */
+ procedure = gimp_procedure_new (procedural_db_get_data_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-procedural-db-get-data");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-procedural-db-get-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("identifier",
+ "identifier",
+ "The identifier associated with data",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("bytes",
+ "bytes",
+ "The number of bytes in the data",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("data",
+ "data",
+ "A byte array containing data",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-procedural-db-get-data-size
+ */
+ procedure = gimp_procedure_new (procedural_db_get_data_size_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-procedural-db-get-data-size");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-procedural-db-get-data-size",
+ "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.",
+ "Nick Lamb",
+ "Nick Lamb",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("identifier",
+ "identifier",
+ "The identifier associated with data",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("bytes",
+ "bytes",
+ "The number of bytes in the data",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-procedural-db-set-data
+ */
+ procedure = gimp_procedure_new (procedural_db_set_data_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-procedural-db-set-data");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-procedural-db-set-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'.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("identifier",
+ "identifier",
+ "The identifier associated with data",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("bytes",
+ "bytes",
+ "The number of bytes in the data",
+ 1, G_MAXINT32, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8_array ("data",
+ "data",
+ "A byte array containing data",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/progress-cmds.c b/app/pdb/progress-cmds.c
new file mode 100644
index 0000000..74b843e
--- /dev/null
+++ b/app/pdb/progress-cmds.c
@@ -0,0 +1,502 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpparamspecs.h"
+#include "plug-in/gimpplugin-progress.h"
+#include "plug-in/gimpplugin.h"
+#include "plug-in/gimppluginmanager.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+progress_init_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *message;
+ GimpObject *gdisplay;
+
+ message = g_value_get_string (gimp_value_array_index (args, 0));
+ gdisplay = gimp_value_get_display (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->open)
+ {
+ if (! gimp->no_interface)
+ gimp_plug_in_progress_start (plug_in, message, gdisplay);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+progress_update_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ gdouble percentage;
+
+ percentage = g_value_get_double (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->open)
+ {
+ if (! gimp->no_interface)
+ gimp_plug_in_progress_set_value (plug_in, percentage);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+progress_pulse_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->open)
+ {
+ if (! gimp->no_interface)
+ gimp_plug_in_progress_pulse (plug_in);
+ }
+ else
+ success = FALSE;
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+progress_set_text_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *message;
+
+ message = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->open)
+ {
+ if (! gimp->no_interface)
+ gimp_plug_in_progress_set_text (plug_in, message);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+progress_end_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->open)
+ {
+ GimpPlugInProcFrame *proc_frame = gimp_plug_in_get_proc_frame (plug_in);
+
+ gimp_plug_in_progress_end (plug_in, proc_frame);
+ }
+ else
+ success = FALSE;
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+progress_get_window_handle_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ gint32 window = 0;
+
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->open)
+ {
+ if (! gimp->no_interface)
+ window = gimp_plug_in_progress_get_window_id (plug_in);
+ }
+ else
+ success = FALSE;
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), window);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+progress_install_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *progress_callback;
+
+ progress_callback = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->open)
+ success = gimp_plug_in_progress_install (plug_in, progress_callback);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+progress_uninstall_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *progress_callback;
+
+ progress_callback = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->open)
+ success = gimp_plug_in_progress_uninstall (plug_in, progress_callback);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+progress_cancel_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *progress_callback;
+
+ progress_callback = g_value_get_string (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
+
+ if (plug_in && plug_in->open)
+ success = gimp_plug_in_progress_cancel (plug_in, progress_callback);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_progress_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-progress-init
+ */
+ procedure = gimp_procedure_new (progress_init_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-progress-init");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-progress-init",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("message",
+ "message",
+ "Message to use in the progress dialog",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_display_id ("gdisplay",
+ "gdisplay",
+ "GimpDisplay to update progressbar in, or -1 for a separate window",
+ pdb->gimp, TRUE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-progress-update
+ */
+ procedure = gimp_procedure_new (progress_update_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-progress-update");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-progress-update",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("percentage",
+ "percentage",
+ "Percentage of progress completed which must be between 0.0 and 1.0",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-progress-pulse
+ */
+ procedure = gimp_procedure_new (progress_pulse_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-progress-pulse");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2005",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-progress-set-text
+ */
+ procedure = gimp_procedure_new (progress_set_text_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-progress-set-text");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-progress-set-text",
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("message",
+ "message",
+ "Message to use in the progress dialog",
+ FALSE, TRUE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-progress-end
+ */
+ procedure = gimp_procedure_new (progress_end_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-progress-end");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2007",
+ NULL);
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-progress-get-window-handle
+ */
+ procedure = gimp_procedure_new (progress_get_window_handle_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-progress-get-window-handle");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("window",
+ "window",
+ "The progress bar's toplevel window",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-progress-install
+ */
+ procedure = gimp_procedure_new (progress_install_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-progress-install");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-progress-install",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("progress-callback",
+ "progress callback",
+ "The callback PDB proc to call",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-progress-uninstall
+ */
+ procedure = gimp_procedure_new (progress_uninstall_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-progress-uninstall");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-progress-uninstall",
+ "Uninstalls the progress callback for the current plug-in.",
+ "This function uninstalls any progress callback installed with 'gimp-progress-install' before.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("progress-callback",
+ "progress callback",
+ "The name of the callback registered for this progress",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-progress-cancel
+ */
+ procedure = gimp_procedure_new (progress_cancel_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-progress-cancel");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-progress-cancel",
+ "Cancels a running progress.",
+ "This function cancels the currently running progress.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("progress-callback",
+ "progress callback",
+ "The name of the callback registered for this progress",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/selection-cmds.c b/app/pdb/selection-cmds.c
new file mode 100644
index 0000000..fd24003
--- /dev/null
+++ b/app/pdb/selection-cmds.c
@@ -0,0 +1,1112 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpmath/gimpmath.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpchannel.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
+#include "core/gimplayer.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimppickable.h"
+#include "core/gimpselection.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+selection_bounds_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gboolean non_empty = FALSE;
+ gint32 x1 = 0;
+ gint32 y1 = 0;
+ gint32 x2 = 0;
+ gint32 y2 = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gint x, y, w, h;
+
+ non_empty = gimp_item_bounds (GIMP_ITEM (gimp_image_get_mask (image)),
+ &x, &y, &w, &h);
+
+ x1 = x;
+ y1 = y;
+ x2 = x + w;
+ y2 = y + h;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), non_empty);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), x1);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), y1);
+ g_value_set_int (gimp_value_array_index (return_vals, 4), x2);
+ g_value_set_int (gimp_value_array_index (return_vals, 5), y2);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+selection_value_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 x;
+ gint32 y;
+ gint32 value = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ x = g_value_get_int (gimp_value_array_index (args, 1));
+ y = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ gdouble val;
+
+ val= gimp_pickable_get_opacity_at (GIMP_PICKABLE (gimp_image_get_mask (image)),
+ x, y);
+
+ value = ROUND (CLAMP (val, 0.0, 1.0) * 255.0);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), value);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+selection_is_empty_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gboolean is_empty = FALSE;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ is_empty = gimp_channel_is_empty (gimp_image_get_mask (image));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), is_empty);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+selection_translate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 offx;
+ gint32 offy;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ offx = g_value_get_int (gimp_value_array_index (args, 1));
+ offy = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ gimp_item_translate (GIMP_ITEM (gimp_image_get_mask (image)),
+ offx, offy, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+selection_float_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 offx;
+ gint32 offy;
+ GimpLayer *layer = NULL;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ offx = g_value_get_int (gimp_value_array_index (args, 1));
+ offy = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+
+ layer = gimp_selection_float (GIMP_SELECTION (gimp_image_get_mask (image)),
+ drawable, context, TRUE, offx, offy,
+ error);
+ if (! layer)
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+selection_invert_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_channel_invert (gimp_image_get_mask (image), TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+selection_sharpen_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_channel_sharpen (gimp_image_get_mask (image), TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+selection_all_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_channel_all (gimp_image_get_mask (image), TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+selection_none_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_channel_clear (gimp_image_get_mask (image), NULL, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+selection_feather_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gdouble radius;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ radius = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ /* FIXME: "edge-lock" hardcoded to TRUE */
+ gimp_channel_feather (gimp_image_get_mask (image),
+ radius, radius, TRUE, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+selection_border_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 radius;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ radius = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ /* FIXME: "style" and "edge-lock" hardcoded to SMOOTH and TRUE, respectively. */
+ gimp_channel_border (gimp_image_get_mask (image),
+ radius, radius,
+ GIMP_CHANNEL_BORDER_STYLE_SMOOTH,
+ TRUE, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+selection_grow_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 steps;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ steps = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_channel_grow (gimp_image_get_mask (image),
+ steps, steps, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+selection_shrink_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 steps;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ steps = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gimp_channel_shrink (gimp_image_get_mask (image),
+ steps, steps, FALSE, TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+selection_flood_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ gimp_channel_flood (gimp_image_get_mask (image), TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+selection_layer_alpha_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, 0, error))
+ gimp_item_to_selection (GIMP_ITEM (layer),
+ GIMP_CHANNEL_OP_REPLACE,
+ TRUE, FALSE, 0.0, 0.0);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+selection_load_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpChannel *channel;
+
+ channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), NULL, 0, error))
+ gimp_item_to_selection (GIMP_ITEM (channel),
+ GIMP_CHANNEL_OP_REPLACE,
+ TRUE, FALSE, 0.0, 0.0);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+selection_save_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpChannel *channel = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ channel = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (gimp_image_get_mask (image)),
+ GIMP_TYPE_CHANNEL));
+
+ if (channel)
+ {
+ /* saved selections are not visible by default */
+ gimp_item_set_visible (GIMP_ITEM (channel), FALSE, FALSE);
+
+ gimp_image_add_channel (image, channel,
+ GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_channel (gimp_value_array_index (return_vals, 1), channel);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+selection_combine_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpChannel *channel;
+ gint32 operation;
+
+ channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp);
+ operation = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), NULL, 0, error))
+ gimp_item_to_selection (GIMP_ITEM (channel),
+ operation,
+ TRUE, FALSE, 0.0, 0.0);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_selection_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-selection-bounds
+ */
+ procedure = gimp_procedure_new (selection_bounds_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-bounds");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-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).",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("non-empty",
+ "non empty",
+ "TRUE if there is a selection",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("x1",
+ "x1",
+ "x coordinate of upper left corner of selection bounds",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("y1",
+ "y1",
+ "y coordinate of upper left corner of selection bounds",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("x2",
+ "x2",
+ "x coordinate of lower right corner of selection bounds",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("y2",
+ "y2",
+ "y coordinate of lower right corner of selection bounds",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-value
+ */
+ procedure = gimp_procedure_new (selection_value_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-value");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("x",
+ "x",
+ "x coordinate of value",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("y",
+ "y",
+ "y coordinate of value",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("value",
+ "value",
+ "Value of the selection",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-is-empty
+ */
+ procedure = gimp_procedure_new (selection_is_empty_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-is-empty");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-is-empty",
+ "Determine whether the selection is empty.",
+ "This procedure returns TRUE if the selection for the specified image is empty.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("is-empty",
+ "is empty",
+ "Is the selection empty?",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-translate
+ */
+ procedure = gimp_procedure_new (selection_translate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-translate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-translate",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offx",
+ "offx",
+ "x offset for translation",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offy",
+ "offy",
+ "y offset for translation",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-float
+ */
+ procedure = gimp_procedure_new (selection_float_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-float");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-float",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable from which to float selection",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offx",
+ "offx",
+ "x offset for translation",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("offy",
+ "offy",
+ "y offset for translation",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The floated layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-invert
+ */
+ procedure = gimp_procedure_new (selection_invert_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-invert");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-invert",
+ "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).",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-sharpen
+ */
+ procedure = gimp_procedure_new (selection_sharpen_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-sharpen");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-sharpen",
+ "Sharpen the selection mask.",
+ "This procedure sharpens the selection mask. For every pixel in the selection channel, if the value is > 127, the new pixel is assigned a value of 255. This removes any \"anti-aliasing\" that might exist in the selection mask's boundary.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-all
+ */
+ procedure = gimp_procedure_new (selection_all_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-all");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-all",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-none
+ */
+ procedure = gimp_procedure_new (selection_none_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-none");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-none",
+ "Deselect the entire image.",
+ "This procedure deselects the entire image. Every pixel in the selection channel is set to 0.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-feather
+ */
+ procedure = gimp_procedure_new (selection_feather_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-feather");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-feather",
+ "Feather the image's selection",
+ "This procedure feathers the selection. Feathering is implemented using a gaussian blur.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("radius",
+ "radius",
+ "Radius of feather (in pixels)",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-border
+ */
+ procedure = gimp_procedure_new (selection_border_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-border");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-border",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("radius",
+ "radius",
+ "Radius of border (in pixels)",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-grow
+ */
+ procedure = gimp_procedure_new (selection_grow_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-grow");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-grow",
+ "Grow the image's selection",
+ "This procedure grows the selection. Growing involves expanding the boundary in all directions by the specified pixel amount.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("steps",
+ "steps",
+ "Steps of grow (in pixels)",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-shrink
+ */
+ procedure = gimp_procedure_new (selection_shrink_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-shrink");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-shrink",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("steps",
+ "steps",
+ "Steps of shrink (in pixels)",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-flood
+ */
+ procedure = gimp_procedure_new (selection_flood_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-flood");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-flood",
+ "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.",
+ "Ell",
+ "Ell",
+ "2016",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-layer-alpha
+ */
+ procedure = gimp_procedure_new (selection_layer_alpha_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-layer-alpha");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-layer-alpha",
+ "Deprecated: Use 'gimp-image-select-item' instead.",
+ "Deprecated: Use 'gimp-image-select-item' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-select-item");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "Layer with alpha",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-load
+ */
+ procedure = gimp_procedure_new (selection_load_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-load");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-load",
+ "Deprecated: Use 'gimp-image-select-item' instead.",
+ "Deprecated: Use 'gimp-image-select-item' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-select-item");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-save
+ */
+ procedure = gimp_procedure_new (selection_save_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-save");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-save",
+ "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.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The new channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-selection-combine
+ */
+ procedure = gimp_procedure_new (selection_combine_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-selection-combine");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-selection-combine",
+ "Deprecated: Use 'gimp-image-select-item' instead.",
+ "Deprecated: Use 'gimp-image-select-item' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-select-item");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_channel_id ("channel",
+ "channel",
+ "The channel",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/selection-tools-cmds.c b/app/pdb/selection-tools-cmds.c
new file mode 100644
index 0000000..9ca50b5
--- /dev/null
+++ b/app/pdb/selection-tools-cmds.c
@@ -0,0 +1,1052 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <cairo.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpcolor/gimpcolor.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpchannel-select.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+by_color_select_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ GimpRGB color;
+ gint32 threshold;
+ gint32 operation;
+ gboolean antialias;
+ gboolean feather;
+ gdouble feather_radius;
+ gboolean sample_merged;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ gimp_value_get_rgb (gimp_value_array_index (args, 1), &color);
+ threshold = g_value_get_int (gimp_value_array_index (args, 2));
+ operation = g_value_get_enum (gimp_value_array_index (args, 3));
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 4));
+ feather = g_value_get_boolean (gimp_value_array_index (args, 5));
+ feather_radius = g_value_get_double (gimp_value_array_index (args, 6));
+ sample_merged = g_value_get_boolean (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+
+ gimp_channel_select_by_color (gimp_image_get_mask (image), drawable,
+ sample_merged,
+ &color,
+ threshold / 255.0,
+ FALSE /* don't select transparent */,
+ GIMP_SELECT_CRITERION_COMPOSITE,
+ operation,
+ antialias,
+ feather,
+ feather_radius,
+ feather_radius);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+by_color_select_full_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ GimpRGB color;
+ gint32 threshold;
+ gint32 operation;
+ gboolean antialias;
+ gboolean feather;
+ gdouble feather_radius_x;
+ gdouble feather_radius_y;
+ gboolean sample_merged;
+ gboolean select_transparent;
+ gint32 select_criterion;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ gimp_value_get_rgb (gimp_value_array_index (args, 1), &color);
+ threshold = g_value_get_int (gimp_value_array_index (args, 2));
+ operation = g_value_get_enum (gimp_value_array_index (args, 3));
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 4));
+ feather = g_value_get_boolean (gimp_value_array_index (args, 5));
+ feather_radius_x = g_value_get_double (gimp_value_array_index (args, 6));
+ feather_radius_y = g_value_get_double (gimp_value_array_index (args, 7));
+ sample_merged = g_value_get_boolean (gimp_value_array_index (args, 8));
+ select_transparent = g_value_get_boolean (gimp_value_array_index (args, 9));
+ select_criterion = g_value_get_enum (gimp_value_array_index (args, 10));
+
+ if (success)
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+
+ gimp_channel_select_by_color (gimp_image_get_mask (image), drawable,
+ sample_merged,
+ &color,
+ threshold / 255.0,
+ select_transparent,
+ select_criterion,
+ operation,
+ antialias,
+ feather,
+ feather_radius_x,
+ feather_radius_y);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+ellipse_select_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gdouble x;
+ gdouble y;
+ gdouble width;
+ gdouble height;
+ gint32 operation;
+ gboolean antialias;
+ gboolean feather;
+ gdouble feather_radius;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ x = g_value_get_double (gimp_value_array_index (args, 1));
+ y = g_value_get_double (gimp_value_array_index (args, 2));
+ width = g_value_get_double (gimp_value_array_index (args, 3));
+ height = g_value_get_double (gimp_value_array_index (args, 4));
+ operation = g_value_get_enum (gimp_value_array_index (args, 5));
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 6));
+ feather = g_value_get_boolean (gimp_value_array_index (args, 7));
+ feather_radius = g_value_get_double (gimp_value_array_index (args, 8));
+
+ if (success)
+ {
+ gimp_channel_select_ellipse (gimp_image_get_mask (image),
+ (gint) x, (gint) y,
+ (gint) width, (gint) height,
+ operation,
+ antialias,
+ feather,
+ feather_radius,
+ feather_radius,
+ TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+free_select_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 num_segs;
+ const gdouble *segs;
+ gint32 operation;
+ gboolean antialias;
+ gboolean feather;
+ gdouble feather_radius;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ num_segs = g_value_get_int (gimp_value_array_index (args, 1));
+ segs = gimp_value_get_floatarray (gimp_value_array_index (args, 2));
+ operation = g_value_get_enum (gimp_value_array_index (args, 3));
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 4));
+ feather = g_value_get_boolean (gimp_value_array_index (args, 5));
+ feather_radius = g_value_get_double (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ gimp_channel_select_polygon (gimp_image_get_mask (image),
+ _("Free Select"),
+ num_segs / 2,
+ (GimpVector2 *) segs,
+ operation,
+ antialias,
+ feather,
+ feather_radius,
+ feather_radius,
+ TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+fuzzy_select_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble x;
+ gdouble y;
+ gint32 threshold;
+ gint32 operation;
+ gboolean antialias;
+ gboolean feather;
+ gdouble feather_radius;
+ gboolean sample_merged;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ x = g_value_get_double (gimp_value_array_index (args, 1));
+ y = g_value_get_double (gimp_value_array_index (args, 2));
+ threshold = g_value_get_int (gimp_value_array_index (args, 3));
+ operation = g_value_get_enum (gimp_value_array_index (args, 4));
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 5));
+ feather = g_value_get_boolean (gimp_value_array_index (args, 6));
+ feather_radius = g_value_get_double (gimp_value_array_index (args, 7));
+ sample_merged = g_value_get_boolean (gimp_value_array_index (args, 8));
+
+ if (success)
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+
+ gimp_channel_select_fuzzy (gimp_image_get_mask (image),
+ drawable,
+ sample_merged,
+ x, y,
+ threshold / 255.0,
+ FALSE /* don't select transparent */,
+ GIMP_SELECT_CRITERION_COMPOSITE,
+ FALSE /* no diagonal neighbors */,
+ operation,
+ antialias,
+ feather,
+ feather_radius,
+ feather_radius);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+fuzzy_select_full_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble x;
+ gdouble y;
+ gint32 threshold;
+ gint32 operation;
+ gboolean antialias;
+ gboolean feather;
+ gdouble feather_radius_x;
+ gdouble feather_radius_y;
+ gboolean sample_merged;
+ gboolean select_transparent;
+ gint32 select_criterion;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ x = g_value_get_double (gimp_value_array_index (args, 1));
+ y = g_value_get_double (gimp_value_array_index (args, 2));
+ threshold = g_value_get_int (gimp_value_array_index (args, 3));
+ operation = g_value_get_enum (gimp_value_array_index (args, 4));
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 5));
+ feather = g_value_get_boolean (gimp_value_array_index (args, 6));
+ feather_radius_x = g_value_get_double (gimp_value_array_index (args, 7));
+ feather_radius_y = g_value_get_double (gimp_value_array_index (args, 8));
+ sample_merged = g_value_get_boolean (gimp_value_array_index (args, 9));
+ select_transparent = g_value_get_boolean (gimp_value_array_index (args, 10));
+ select_criterion = g_value_get_enum (gimp_value_array_index (args, 11));
+
+ if (success)
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+
+ gimp_channel_select_fuzzy (gimp_image_get_mask (image),
+ drawable,
+ sample_merged,
+ x, y,
+ threshold / 255.0,
+ select_transparent,
+ select_criterion,
+ FALSE /* no diagonal neighbors */,
+ operation,
+ antialias,
+ feather,
+ feather_radius_x,
+ feather_radius_y);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+rect_select_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gdouble x;
+ gdouble y;
+ gdouble width;
+ gdouble height;
+ gint32 operation;
+ gboolean feather;
+ gdouble feather_radius;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ x = g_value_get_double (gimp_value_array_index (args, 1));
+ y = g_value_get_double (gimp_value_array_index (args, 2));
+ width = g_value_get_double (gimp_value_array_index (args, 3));
+ height = g_value_get_double (gimp_value_array_index (args, 4));
+ operation = g_value_get_enum (gimp_value_array_index (args, 5));
+ feather = g_value_get_boolean (gimp_value_array_index (args, 6));
+ feather_radius = g_value_get_double (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ gimp_channel_select_rectangle (gimp_image_get_mask (image),
+ (gint) x, (gint) y,
+ (gint) width, (gint) height,
+ operation,
+ feather,
+ feather_radius,
+ feather_radius,
+ TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+round_rect_select_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gdouble x;
+ gdouble y;
+ gdouble width;
+ gdouble height;
+ gdouble corner_radius_x;
+ gdouble corner_radius_y;
+ gint32 operation;
+ gboolean antialias;
+ gboolean feather;
+ gdouble feather_radius_x;
+ gdouble feather_radius_y;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ x = g_value_get_double (gimp_value_array_index (args, 1));
+ y = g_value_get_double (gimp_value_array_index (args, 2));
+ width = g_value_get_double (gimp_value_array_index (args, 3));
+ height = g_value_get_double (gimp_value_array_index (args, 4));
+ corner_radius_x = g_value_get_double (gimp_value_array_index (args, 5));
+ corner_radius_y = g_value_get_double (gimp_value_array_index (args, 6));
+ operation = g_value_get_enum (gimp_value_array_index (args, 7));
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 8));
+ feather = g_value_get_boolean (gimp_value_array_index (args, 9));
+ feather_radius_x = g_value_get_double (gimp_value_array_index (args, 10));
+ feather_radius_y = g_value_get_double (gimp_value_array_index (args, 11));
+
+ if (success)
+ {
+ gimp_channel_select_round_rect (gimp_image_get_mask (image),
+ (gint) x, (gint) y,
+ (gint) width, (gint) height,
+ corner_radius_x,
+ corner_radius_y,
+ operation,
+ antialias,
+ feather,
+ feather_radius_x,
+ feather_radius_y,
+ TRUE);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_selection_tools_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-by-color-select
+ */
+ procedure = gimp_procedure_new (by_color_select_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-by-color-select");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-by-color-select",
+ "Deprecated: Use 'gimp-image-select-color' instead.",
+ "Deprecated: Use 'gimp-image-select-color' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-select-color");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The color to select",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("threshold",
+ "threshold",
+ "Threshold in intensity levels",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "Antialiasing",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("feather",
+ "feather",
+ "Feather option for selections",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius",
+ "feather radius",
+ "Radius for feather operation",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("sample-merged",
+ "sample merged",
+ "Use the composite image, not the drawable",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-by-color-select-full
+ */
+ procedure = gimp_procedure_new (by_color_select_full_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-by-color-select-full");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-by-color-select-full",
+ "Deprecated: Use 'gimp-image-select-color' instead.",
+ "Deprecated: Use 'gimp-image-select-color' instead.",
+ "David Gowers",
+ "David Gowers",
+ "2006",
+ "gimp-image-select-color");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The color to select",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("threshold",
+ "threshold",
+ "Threshold in intensity levels",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "Antialiasing",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("feather",
+ "feather",
+ "Feather option for selections",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius-x",
+ "feather radius x",
+ "Radius for feather operation in X direction",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius-y",
+ "feather radius y",
+ "Radius for feather operation in Y direction",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("sample-merged",
+ "sample merged",
+ "Use the composite image, not the drawable",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("select-transparent",
+ "select transparent",
+ "Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("select-criterion",
+ "select criterion",
+ "The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.",
+ GIMP_TYPE_SELECT_CRITERION,
+ GIMP_SELECT_CRITERION_COMPOSITE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-ellipse-select
+ */
+ procedure = gimp_procedure_new (ellipse_select_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-ellipse-select");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-ellipse-select",
+ "Deprecated: Use 'gimp-image-select-ellipse' instead.",
+ "Deprecated: Use 'gimp-image-select-ellipse' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-select-ellipse");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "x coordinate of upper-left corner of ellipse bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "y coordinate of upper-left corner of ellipse bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("width",
+ "width",
+ "The width of the ellipse",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("height",
+ "height",
+ "The height of the ellipse",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "Antialiasing",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("feather",
+ "feather",
+ "Feather option for selections",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius",
+ "feather radius",
+ "Radius for feather operation",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-free-select
+ */
+ procedure = gimp_procedure_new (free_select_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-free-select");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-free-select",
+ "Deprecated: Use 'gimp-image-select-polygon' instead.",
+ "Deprecated: Use 'gimp-image-select-polygon' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-select-polygon");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-segs",
+ "num segs",
+ "Number of points (count 1 coordinate as two points)",
+ 2, G_MAXINT32, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("segs",
+ "segs",
+ "Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "Antialiasing",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("feather",
+ "feather",
+ "Feather option for selections",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius",
+ "feather radius",
+ "Radius for feather operation",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-fuzzy-select
+ */
+ procedure = gimp_procedure_new (fuzzy_select_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-fuzzy-select");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-fuzzy-select",
+ "Deprecated: Use 'gimp-image-select-contiguous-color' instead.",
+ "Deprecated: Use 'gimp-image-select-contiguous-color' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-select-contiguous-color");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "x coordinate of initial seed fill point: (image coordinates)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "y coordinate of initial seed fill point: (image coordinates)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("threshold",
+ "threshold",
+ "Threshold in intensity levels",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "Antialiasing",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("feather",
+ "feather",
+ "Feather option for selections",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius",
+ "feather radius",
+ "Radius for feather operation",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("sample-merged",
+ "sample merged",
+ "Use the composite image, not the drawable",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-fuzzy-select-full
+ */
+ procedure = gimp_procedure_new (fuzzy_select_full_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-fuzzy-select-full");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-fuzzy-select-full",
+ "Deprecated: Use 'gimp-image-select-contiguous-color' instead.",
+ "Deprecated: Use 'gimp-image-select-contiguous-color' instead.",
+ "David Gowers",
+ "David Gowers",
+ "2006",
+ "gimp-image-select-contiguous-color");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "x coordinate of initial seed fill point: (image coordinates)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "y coordinate of initial seed fill point: (image coordinates)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("threshold",
+ "threshold",
+ "Threshold in intensity levels",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "Antialiasing",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("feather",
+ "feather",
+ "Feather option for selections",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius-x",
+ "feather radius x",
+ "Radius for feather operation in X direction",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius-y",
+ "feather radius y",
+ "Radius for feather operation in Y direction",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("sample-merged",
+ "sample merged",
+ "Use the composite image, not the drawable",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("select-transparent",
+ "select transparent",
+ "Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("select-criterion",
+ "select criterion",
+ "The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.",
+ GIMP_TYPE_SELECT_CRITERION,
+ GIMP_SELECT_CRITERION_COMPOSITE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-rect-select
+ */
+ procedure = gimp_procedure_new (rect_select_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-rect-select");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-rect-select",
+ "Deprecated: Use 'gimp-image-select-rectangle' instead.",
+ "Deprecated: Use 'gimp-image-select-rectangle' instead.",
+ "",
+ "",
+ "",
+ "gimp-image-select-rectangle");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "x coordinate of upper-left corner of rectangle",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "y coordinate of upper-left corner of rectangle",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("width",
+ "width",
+ "The width of the rectangle",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("height",
+ "height",
+ "The height of the rectangle",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("feather",
+ "feather",
+ "Feather option for selections",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius",
+ "feather radius",
+ "Radius for feather operation",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-round-rect-select
+ */
+ procedure = gimp_procedure_new (round_rect_select_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-round-rect-select");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-round-rect-select",
+ "Deprecated: Use 'gimp-image-select-round-rectangle' instead.",
+ "Deprecated: Use 'gimp-image-select-round-rectangle' instead.",
+ "Martin Nordholts",
+ "Martin Nordholts",
+ "2006",
+ "gimp-image-select-round-rectangle");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "x coordinate of upper-left corner of rectangle",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "y coordinate of upper-left corner of rectangle",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("width",
+ "width",
+ "The width of the rectangle",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("height",
+ "height",
+ "The height of the rectangle",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("corner-radius-x",
+ "corner radius x",
+ "The corner radius in X direction",
+ 0, GIMP_MAX_IMAGE_SIZE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("corner-radius-y",
+ "corner radius y",
+ "The corner radius in Y direction",
+ 0, GIMP_MAX_IMAGE_SIZE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The selection operation",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "Antialiasing",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("feather",
+ "feather",
+ "Feather option for selections",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius-x",
+ "feather radius x",
+ "Radius for feather operation in X direction",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius-y",
+ "feather radius y",
+ "Radius for feather operation in Y direction",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/text-layer-cmds.c b/app/pdb/text-layer-cmds.c
new file mode 100644
index 0000000..5e7d91d
--- /dev/null
+++ b/app/pdb/text-layer-cmds.c
@@ -0,0 +1,2196 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <cairo.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpcolor/gimpcolor.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpcontext.h"
+#include "core/gimpimage.h"
+#include "core/gimplayer.h"
+#include "core/gimpparamspecs.h"
+#include "text/gimptext.h"
+#include "text/gimptextlayer.h"
+
+#include "gimppdb.h"
+#include "gimppdberror.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+text_layer_new_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ const gchar *text;
+ const gchar *fontname;
+ gdouble size;
+ GimpUnit unit;
+ GimpLayer *layer = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ text = g_value_get_string (gimp_value_array_index (args, 1));
+ fontname = g_value_get_string (gimp_value_array_index (args, 2));
+ size = g_value_get_double (gimp_value_array_index (args, 3));
+ unit = g_value_get_int (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ GimpText *gimp_text;
+ GimpRGB color;
+
+ gimp_context_get_foreground (context, &color);
+
+ gimp_text = g_object_new (GIMP_TYPE_TEXT,
+ "text", text,
+ "font", fontname,
+ "font-size", size,
+ "font-size-unit", unit,
+ "color", &color,
+ NULL);
+
+ layer = gimp_text_layer_new (image, gimp_text);
+ g_object_unref (gimp_text);
+
+ if (! layer)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
+ _("Failed to create text layer"));
+
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_get_text_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gchar *text = NULL;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "text", &text,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), text);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_text_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ const gchar *text;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ text = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "text", text,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_get_markup_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gchar *markup = NULL;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "markup", &markup,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), markup);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_get_font_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gchar *font = NULL;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "font", &font,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), font);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_font_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ const gchar *font;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ font = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "font", font,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_get_font_size_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gdouble font_size = 0.0;
+ GimpUnit unit = 0;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "font-size", &font_size,
+ "font-size-unit", &unit,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_double (gimp_value_array_index (return_vals, 1), font_size);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), unit);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_font_size_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gdouble font_size;
+ GimpUnit unit;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ font_size = g_value_get_double (gimp_value_array_index (args, 1));
+ unit = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "font-size-unit", unit,
+ "font-size", font_size,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_get_antialias_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gboolean antialias = FALSE;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "antialias", &antialias,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), antialias);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_antialias_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gboolean antialias;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "antialias", antialias,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_get_hint_style_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gint32 style = 0;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "hint-style", &style,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), style);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_hint_style_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 style;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ style = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "hint-style", style,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_get_kerning_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gboolean kerning = FALSE;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "kerning", &kerning,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), kerning);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_kerning_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gboolean kerning;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ kerning = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "kerning", kerning,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_get_language_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gchar *language = NULL;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "language", &language,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), language);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_language_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ const gchar *language;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ language = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "language", language,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_get_base_direction_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gint32 direction = 0;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "base-direction", &direction,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), direction);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_base_direction_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 direction;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ direction = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "base-direction", direction,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_get_justification_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gint32 justify = 0;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "justify", &justify,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), justify);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_justification_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 justify;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ justify = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "justify", justify,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_get_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ GimpRGB color = { 0.0, 0.0, 0.0, 1.0 };
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ color = gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer))->color;
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &color);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_color_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ GimpRGB color;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ gimp_value_get_rgb (gimp_value_array_index (args, 1), &color);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "color", &color,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_get_indent_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gdouble indent = 0.0;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "indent", &indent,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), indent);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_indent_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gdouble indent;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ indent = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "indent", indent,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_get_line_spacing_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gdouble line_spacing = 0.0;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "line-spacing", &line_spacing,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), line_spacing);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_line_spacing_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gdouble line_spacing;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ line_spacing = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "line-spacing", line_spacing,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_get_letter_spacing_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gdouble letter_spacing = 0.0;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "letter-spacing", &letter_spacing,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), letter_spacing);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_letter_spacing_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gdouble letter_spacing;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ letter_spacing = g_value_get_double (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "letter-spacing", letter_spacing,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_resize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gdouble width;
+ gdouble height;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ width = g_value_get_double (gimp_value_array_index (args, 1));
+ height = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ GimpText *text = gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer));
+ gdouble xres, yres;
+
+ gimp_image_get_resolution (gimp_item_get_image (GIMP_ITEM (layer)),
+ &xres, &yres);
+
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "box-mode", GIMP_TEXT_BOX_FIXED,
+ "box-width", gimp_pixels_to_units (width,
+ text->box_unit,
+ xres),
+ "box-height", gimp_pixels_to_units (height,
+ text->box_unit,
+ yres),
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+text_layer_get_hinting_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpLayer *layer;
+ gboolean hinting = FALSE;
+ gboolean autohint = FALSE;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ g_object_get (gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)),
+ "hinting", &hinting,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), hinting);
+ g_value_set_boolean (gimp_value_array_index (return_vals, 2), autohint);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_layer_set_hinting_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gboolean hinting;
+
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp);
+ hinting = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, GIMP_PDB_ITEM_CONTENT, error))
+ {
+ gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
+ _("Set text layer attribute"),
+ "hinting", hinting,
+ NULL);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_text_layer_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-text-layer-new
+ */
+ procedure = gimp_procedure_new (text_layer_new_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-new");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-new",
+ "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'.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("text",
+ "text",
+ "The text to generate (in UTF-8 encoding)",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("fontname",
+ "fontname",
+ "The name of the font",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("size",
+ "size",
+ "The size of text in either pixels or points",
+ 0.0, 8192.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("unit",
+ "unit",
+ "The units of specified size",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The new text layer.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-text
+ */
+ procedure = gimp_procedure_new (text_layer_get_text_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-text");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-text",
+ "Get the text from a text layer as string.",
+ "This procedure returns the text from a text layer as a string.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("text",
+ "text",
+ "The text from the specified text layer.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-text
+ */
+ procedure = gimp_procedure_new (text_layer_set_text_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-text");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-text",
+ "Set the text of a text layer.",
+ "This procedure changes the text of a text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("text",
+ "text",
+ "The new text to set",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-markup
+ */
+ procedure = gimp_procedure_new (text_layer_get_markup_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-markup");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-markup",
+ "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.",
+ "Barak Itkin <lightningismyname@gmail.com>",
+ "Barak Itkin",
+ "2010",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("markup",
+ "markup",
+ "The markup which represents the style of the specified text layer.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-font
+ */
+ procedure = gimp_procedure_new (text_layer_get_font_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-font");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-font",
+ "Get the font from a text layer as string.",
+ "This procedure returns the name of the font from a text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("font",
+ "font",
+ "The font which is used in the specified text layer.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-font
+ */
+ procedure = gimp_procedure_new (text_layer_set_font_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-font");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-font",
+ "Set the font of a text layer.",
+ "This procedure modifies the font used in the specified text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("font",
+ "font",
+ "The new font to use",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-font-size
+ */
+ procedure = gimp_procedure_new (text_layer_get_font_size_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-font-size");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-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.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("font-size",
+ "font size",
+ "The font size",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_unit ("unit",
+ "unit",
+ "The unit used for the font size",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-font-size
+ */
+ procedure = gimp_procedure_new (text_layer_set_font_size_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-font-size");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-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.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("font-size",
+ "font size",
+ "The font size",
+ 0.0, 8192.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("unit",
+ "unit",
+ "The unit to use for the font size",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-antialias
+ */
+ procedure = gimp_procedure_new (text_layer_get_antialias_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-antialias");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-antialias",
+ "Check if antialiasing is used in the text layer.",
+ "This procedure checks if antialiasing is enabled in the specified text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "A flag which is true if antialiasing is used for rendering the font in the text layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-antialias
+ */
+ procedure = gimp_procedure_new (text_layer_set_antialias_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-antialias");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-antialias",
+ "Enable/disable anti-aliasing in a text layer.",
+ "This procedure enables or disables anti-aliasing of the text in a text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "Enable/disable antialiasing of the text",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-hint-style
+ */
+ procedure = gimp_procedure_new (text_layer_get_hint_style_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-hint-style");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-hint-style",
+ "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.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("style",
+ "style",
+ "The hint style used for font outlines",
+ GIMP_TYPE_TEXT_HINT_STYLE,
+ GIMP_TEXT_HINT_STYLE_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-hint-style
+ */
+ procedure = gimp_procedure_new (text_layer_set_hint_style_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-hint-style");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-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.",
+ "Sven Neumann <sven@gimp.org>",
+ "Sven Neumann",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("style",
+ "style",
+ "The new hint style",
+ GIMP_TYPE_TEXT_HINT_STYLE,
+ GIMP_TEXT_HINT_STYLE_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-kerning
+ */
+ procedure = gimp_procedure_new (text_layer_get_kerning_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-kerning");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-kerning",
+ "Check if kerning is used in the text layer.",
+ "This procedure checks if kerning is enabled in the specified text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("kerning",
+ "kerning",
+ "A flag which is true if kerning is used in the text layer.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-kerning
+ */
+ procedure = gimp_procedure_new (text_layer_set_kerning_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-kerning");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-kerning",
+ "Enable/disable kerning in a text layer.",
+ "This procedure enables or disables kerning in a text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("kerning",
+ "kerning",
+ "Enable/disable kerning in the text",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-language
+ */
+ procedure = gimp_procedure_new (text_layer_get_language_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-language");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-language",
+ "Get the language used in the text layer.",
+ "This procedure returns the language string which is set for the text in the text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("language",
+ "language",
+ "The language used in the text layer.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-language
+ */
+ procedure = gimp_procedure_new (text_layer_set_language_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-language");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-language",
+ "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.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("language",
+ "language",
+ "The new language to use for the text layer",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-base-direction
+ */
+ procedure = gimp_procedure_new (text_layer_get_base_direction_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-base-direction");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-base-direction",
+ "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",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("direction",
+ "direction",
+ "The based direction used for the text layer.",
+ GIMP_TYPE_TEXT_DIRECTION,
+ GIMP_TEXT_DIRECTION_LTR,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-base-direction
+ */
+ procedure = gimp_procedure_new (text_layer_set_base_direction_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-base-direction");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-base-direction",
+ "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.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("direction",
+ "direction",
+ "The base direction of the text.",
+ GIMP_TYPE_TEXT_DIRECTION,
+ GIMP_TEXT_DIRECTION_LTR,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-justification
+ */
+ procedure = gimp_procedure_new (text_layer_get_justification_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-justification");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-justification",
+ "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.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("justify",
+ "justify",
+ "The justification used in the text layer.",
+ GIMP_TYPE_TEXT_JUSTIFICATION,
+ GIMP_TEXT_JUSTIFY_LEFT,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-justification
+ */
+ procedure = gimp_procedure_new (text_layer_set_justification_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-justification");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-justification",
+ "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.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("justify",
+ "justify",
+ "The justification for your text.",
+ GIMP_TYPE_TEXT_JUSTIFICATION,
+ GIMP_TEXT_JUSTIFY_LEFT,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-color
+ */
+ procedure = gimp_procedure_new (text_layer_get_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-color",
+ "Get the color of the text in a text layer.",
+ "This procedure returns the color of the text in a text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The color of the text.",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-color
+ */
+ procedure = gimp_procedure_new (text_layer_set_color_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-color");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-color",
+ "Set the color of the text in the text layer.",
+ "This procedure sets the text color in the text layer 'layer'.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("color",
+ "color",
+ "The color to use for the text",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-indent
+ */
+ procedure = gimp_procedure_new (text_layer_get_indent_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-indent");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-indent",
+ "Get the line indentation of text layer.",
+ "This procedure returns the indentation of the first line in a text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("indent",
+ "indent",
+ "The indentation value of the first line.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-indent
+ */
+ procedure = gimp_procedure_new (text_layer_set_indent_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-indent");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-indent",
+ "Set the indentation of the first line in a text layer.",
+ "This procedure sets the indentation of the first line in the text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("indent",
+ "indent",
+ "The indentation for the first line.",
+ -8192.0, 8192.0, -8192.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-line-spacing
+ */
+ procedure = gimp_procedure_new (text_layer_get_line_spacing_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-line-spacing");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-line-spacing",
+ "Get the spacing between lines of text.",
+ "This procedure returns the line-spacing between lines of text in a text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("line-spacing",
+ "line spacing",
+ "The line-spacing value.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-line-spacing
+ */
+ procedure = gimp_procedure_new (text_layer_set_line_spacing_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-line-spacing");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-line-spacing",
+ "Adjust the line spacing in a text layer.",
+ "This procedure sets the additional spacing used between lines a text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("line-spacing",
+ "line spacing",
+ "The additional line spacing to use.",
+ -8192.0, 8192.0, -8192.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-letter-spacing
+ */
+ procedure = gimp_procedure_new (text_layer_get_letter_spacing_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-letter-spacing");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-letter-spacing",
+ "Get the letter spacing used in a text layer.",
+ "This procedure returns the additional spacing between the single glyphs in a text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("letter-spacing",
+ "letter spacing",
+ "The letter-spacing value.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-letter-spacing
+ */
+ procedure = gimp_procedure_new (text_layer_set_letter_spacing_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-letter-spacing");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-letter-spacing",
+ "Adjust the letter spacing in a text layer.",
+ "This procedure sets the additional spacing between the single glyphs in a text layer.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("letter-spacing",
+ "letter spacing",
+ "The additional letter spacing to use.",
+ -8192.0, 8192.0, -8192.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-resize
+ */
+ procedure = gimp_procedure_new (text_layer_resize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-resize");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-resize",
+ "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.",
+ "Barak Itkin <lightningismyname@gmail.com>",
+ "Barak Itkin",
+ "2009",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("width",
+ "width",
+ "The new box width in pixels",
+ 0.0, GIMP_MAX_IMAGE_SIZE, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("height",
+ "height",
+ "The new box height in pixels",
+ 0.0, GIMP_MAX_IMAGE_SIZE, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-get-hinting
+ */
+ procedure = gimp_procedure_new (text_layer_get_hinting_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-get-hinting");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-get-hinting",
+ "Deprecated: Use 'gimp-text-layer-get-hint-style' instead.",
+ "Deprecated: Use 'gimp-text-layer-get-hint-style' instead.",
+ "",
+ "",
+ "",
+ "gimp-text-layer-get-hint-style");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("hinting",
+ "hinting",
+ "A flag which is true if hinting is used on the font.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("autohint",
+ "autohint",
+ "A flag which is true if the text layer is forced to use the autohinter from FreeType.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-layer-set-hinting
+ */
+ procedure = gimp_procedure_new (text_layer_set_hinting_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-layer-set-hinting");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-layer-set-hinting",
+ "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.\n"
+ "\n"
+ "Deprecated: Use 'gimp-text-layer-set-hint-style' instead.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ "gimp-text-layer-set-hint-style");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("hinting",
+ "hinting",
+ "Enable/disable the use of hinting on the text",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("autohint",
+ "autohint",
+ "Force the use of the autohinter provided through FreeType",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/text-tool-cmds.c b/app/pdb/text-tool-cmds.c
new file mode 100644
index 0000000..e3c5210
--- /dev/null
+++ b/app/pdb/text-tool-cmds.c
@@ -0,0 +1,670 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
+#include "core/gimplayer.h"
+#include "core/gimpparamspecs.h"
+#include "text/gimptext-compat.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+text_fontname_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpDrawable *drawable;
+ gdouble x;
+ gdouble y;
+ const gchar *text;
+ gint32 border;
+ gboolean antialias;
+ gdouble size;
+ const gchar *fontname;
+ GimpLayer *text_layer = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 1), gimp);
+ x = g_value_get_double (gimp_value_array_index (args, 2));
+ y = g_value_get_double (gimp_value_array_index (args, 3));
+ text = g_value_get_string (gimp_value_array_index (args, 4));
+ border = g_value_get_int (gimp_value_array_index (args, 5));
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 6));
+ size = g_value_get_double (gimp_value_array_index (args, 7));
+ fontname = g_value_get_string (gimp_value_array_index (args, 9));
+
+ if (success)
+ {
+ if (drawable &&
+ (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), image,
+ GIMP_PDB_ITEM_CONTENT, error) ||
+ ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error)))
+ success = FALSE;
+
+ if (success)
+ {
+ gchar *real_fontname = g_strdup_printf ("%s %d", fontname, (gint) size);
+
+ text_layer = text_render (image, drawable, context,
+ x, y, real_fontname, text,
+ border, antialias);
+
+ g_free (real_fontname);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), text_layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_get_extents_fontname_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *text;
+ gdouble size;
+ const gchar *fontname;
+ gint32 width = 0;
+ gint32 height = 0;
+ gint32 ascent = 0;
+ gint32 descent = 0;
+
+ text = g_value_get_string (gimp_value_array_index (args, 0));
+ size = g_value_get_double (gimp_value_array_index (args, 1));
+ fontname = g_value_get_string (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ gchar *real_fontname = g_strdup_printf ("%s %d", fontname, (gint) size);
+
+ success = text_get_extents (gimp,
+ real_fontname, text,
+ &width, &height,
+ &ascent, &descent);
+
+ g_free (real_fontname);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), width);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), height);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), ascent);
+ g_value_set_int (gimp_value_array_index (return_vals, 4), descent);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpDrawable *drawable;
+ gdouble x;
+ gdouble y;
+ const gchar *text;
+ gint32 border;
+ gboolean antialias;
+ gdouble size;
+ const gchar *family;
+ GimpLayer *text_layer = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 1), gimp);
+ x = g_value_get_double (gimp_value_array_index (args, 2));
+ y = g_value_get_double (gimp_value_array_index (args, 3));
+ text = g_value_get_string (gimp_value_array_index (args, 4));
+ border = g_value_get_int (gimp_value_array_index (args, 5));
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 6));
+ size = g_value_get_double (gimp_value_array_index (args, 7));
+ family = g_value_get_string (gimp_value_array_index (args, 10));
+
+ if (success)
+ {
+ if (drawable &&
+ (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), image,
+ GIMP_PDB_ITEM_CONTENT, error) ||
+ ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error)))
+ success = FALSE;
+
+ if (success)
+ {
+ gchar *real_fontname = g_strdup_printf ("%s %d", family, (gint) size);
+
+ text_layer = text_render (image, drawable, context,
+ x, y, real_fontname, text,
+ border, antialias);
+
+ g_free (real_fontname);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_layer (gimp_value_array_index (return_vals, 1), text_layer);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+text_get_extents_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *text;
+ gdouble size;
+ const gchar *family;
+ gint32 width = 0;
+ gint32 height = 0;
+ gint32 ascent = 0;
+ gint32 descent = 0;
+
+ text = g_value_get_string (gimp_value_array_index (args, 0));
+ size = g_value_get_double (gimp_value_array_index (args, 1));
+ family = g_value_get_string (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ gchar *real_fontname = g_strdup_printf ("%s %d", family, (gint) size);
+
+ success = text_get_extents (gimp,
+ real_fontname, text,
+ &width, &height,
+ &ascent, &descent);
+
+ g_free (real_fontname);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), width);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), height);
+ g_value_set_int (gimp_value_array_index (return_vals, 3), ascent);
+ g_value_set_int (gimp_value_array_index (return_vals, 4), descent);
+ }
+
+ return return_vals;
+}
+
+void
+register_text_tool_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-text-fontname
+ */
+ procedure = gimp_procedure_new (text_fontname_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-fontname");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-fontname",
+ "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.",
+ "Martin Edlman & Sven Neumann",
+ "Spencer Kimball & Peter Mattis",
+ "1998- 2001",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable: (-1 for a new text layer)",
+ pdb->gimp, TRUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "The x coordinate for the left of the text bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "The y coordinate for the top of the text bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("text",
+ "text",
+ "The text to generate (in UTF-8 encoding)",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("border",
+ "border",
+ "The size of the border",
+ -1, G_MAXINT32, -1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "Antialiasing",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("size",
+ "size",
+ "The size of text in either pixels or points",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("size-type",
+ "size type",
+ "The units of specified size",
+ GIMP_TYPE_SIZE_TYPE,
+ GIMP_PIXELS,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("fontname",
+ "fontname",
+ "The name of the font",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("text-layer",
+ "text layer",
+ "The new text layer or -1 if no layer was created.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-get-extents-fontname
+ */
+ procedure = gimp_procedure_new (text_get_extents_fontname_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-get-extents-fontname");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-get-extents-fontname",
+ "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.",
+ "Martin Edlman & Sven Neumann",
+ "Spencer Kimball & Peter Mattis",
+ "1998- 2001",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("text",
+ "text",
+ "The text to generate (in UTF-8 encoding)",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("size",
+ "size",
+ "The size of text in either pixels or points",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("size-type",
+ "size type",
+ "The units of specified size",
+ GIMP_TYPE_SIZE_TYPE,
+ GIMP_PIXELS,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("fontname",
+ "fontname",
+ "The name of the font",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The width of the specified font",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The height of the specified font",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("ascent",
+ "ascent",
+ "The ascent of the specified font",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("descent",
+ "descent",
+ "The descent of the specified font",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text
+ */
+ procedure = gimp_procedure_new (text_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text",
+ "Deprecated: Use 'gimp-text-fontname' instead.",
+ "Deprecated: Use 'gimp-text-fontname' instead.",
+ "",
+ "",
+ "",
+ "gimp-text-fontname");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable: (-1 for a new text layer)",
+ pdb->gimp, TRUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x",
+ "x",
+ "The x coordinate for the left of the text bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y",
+ "y",
+ "The y coordinate for the top of the text bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("text",
+ "text",
+ "The text to generate (in UTF-8 encoding)",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("border",
+ "border",
+ "The size of the border",
+ -1, G_MAXINT32, -1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "Antialiasing",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("size",
+ "size",
+ "The size of text in either pixels or points",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("size-type",
+ "size type",
+ "The units of specified size",
+ GIMP_TYPE_SIZE_TYPE,
+ GIMP_PIXELS,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("foundry",
+ "foundry",
+ "The font foundry",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("family",
+ "family",
+ "The font family",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("weight",
+ "weight",
+ "The font weight",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("slant",
+ "slant",
+ "The font slant",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("set-width",
+ "set width",
+ "The font set-width",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("spacing",
+ "spacing",
+ "The font spacing",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("registry",
+ "registry",
+ "The font registry",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("encoding",
+ "encoding",
+ "The font encoding",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_layer_id ("text-layer",
+ "text layer",
+ "The new text layer or -1 if no layer was created.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-text-get-extents
+ */
+ procedure = gimp_procedure_new (text_get_extents_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-text-get-extents");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-text-get-extents",
+ "Deprecated: Use 'gimp-text-get-extents-fontname' instead.",
+ "Deprecated: Use 'gimp-text-get-extents-fontname' instead.",
+ "",
+ "",
+ "",
+ "gimp-text-get-extents-fontname");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("text",
+ "text",
+ "The text to generate (in UTF-8 encoding)",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("size",
+ "size",
+ "The size of text in either pixels or points",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("size-type",
+ "size type",
+ "The units of specified size",
+ GIMP_TYPE_SIZE_TYPE,
+ GIMP_PIXELS,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("foundry",
+ "foundry",
+ "The font foundry",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("family",
+ "family",
+ "The font family",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("weight",
+ "weight",
+ "The font weight",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("slant",
+ "slant",
+ "The font slant",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("set-width",
+ "set width",
+ "The font set-width",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("spacing",
+ "spacing",
+ "The font spacing",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("registry",
+ "registry",
+ "The font registry",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("encoding",
+ "encoding",
+ "The font encoding",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("width",
+ "width",
+ "The width of the specified font",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("height",
+ "height",
+ "The height of the specified font",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("ascent",
+ "ascent",
+ "The ascent of the specified font",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("descent",
+ "descent",
+ "The descent of the specified font",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/transform-tools-cmds.c b/app/pdb/transform-tools-cmds.c
new file mode 100644
index 0000000..793b10a
--- /dev/null
+++ b/app/pdb/transform-tools-cmds.c
@@ -0,0 +1,934 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpmath/gimpmath.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "config/gimpcoreconfig.h"
+#include "core/gimp-transform-utils.h"
+#include "core/gimp.h"
+#include "core/gimpchannel.h"
+#include "core/gimpdrawable-transform.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimpprogress.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+flip_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 flip_type;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ flip_type = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ gdouble axis;
+
+ gimp_transform_get_flip_axis (x, y, width, height,
+ flip_type, TRUE, &axis);
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_flip (drawable, context,
+ flip_type, axis, FALSE))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ gimp_item_flip (GIMP_ITEM (drawable), context,
+ flip_type, axis,
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE));
+ }
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+perspective_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean interpolation;
+ gdouble x0;
+ gdouble y0;
+ gdouble x1;
+ gdouble y1;
+ gdouble x2;
+ gdouble y2;
+ gdouble x3;
+ gdouble y3;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
+ x0 = g_value_get_double (gimp_value_array_index (args, 2));
+ y0 = g_value_get_double (gimp_value_array_index (args, 3));
+ x1 = g_value_get_double (gimp_value_array_index (args, 4));
+ y1 = g_value_get_double (gimp_value_array_index (args, 5));
+ x2 = g_value_get_double (gimp_value_array_index (args, 6));
+ y2 = g_value_get_double (gimp_value_array_index (args, 7));
+ x3 = g_value_get_double (gimp_value_array_index (args, 8));
+ y3 = g_value_get_double (gimp_value_array_index (args, 9));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_perspective (&matrix,
+ x, y, width, height,
+ x0, y0, x1, y1,
+ x2, y2, x3, y3);
+
+ if (interpolation)
+ interpolation_type = gimp->config->interpolation_type;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Perspective"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ FALSE, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation,
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+rotate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean interpolation;
+ gdouble angle;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
+ angle = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_rotate_rect (&matrix,
+ x, y, width, height,
+ angle);
+
+ if (interpolation)
+ interpolation_type = gimp->config->interpolation_type;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Rotating"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ FALSE, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation,
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+scale_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean interpolation;
+ gdouble x0;
+ gdouble y0;
+ gdouble x1;
+ gdouble y1;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
+ x0 = g_value_get_double (gimp_value_array_index (args, 2));
+ y0 = g_value_get_double (gimp_value_array_index (args, 3));
+ x1 = g_value_get_double (gimp_value_array_index (args, 4));
+ y1 = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error) &&
+ x0 < x1 && y0 < y1);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_scale (&matrix,
+ x, y, width, height,
+ x0, y0, x1 - x0, y1 - y0);
+
+ if (interpolation)
+ interpolation_type = gimp->config->interpolation_type;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Scaling"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ FALSE, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation,
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+shear_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean interpolation;
+ gint32 shear_type;
+ gdouble magnitude;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
+ shear_type = g_value_get_enum (gimp_value_array_index (args, 2));
+ magnitude = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
+ gint off_x, off_y;
+
+ gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
+
+ x += off_x;
+ y += off_y;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_transform_matrix_shear (&matrix,
+ x, y, width, height,
+ shear_type, magnitude);
+
+ if (interpolation)
+ interpolation_type = gimp->config->interpolation_type;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("Shearing"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ FALSE, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation,
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+transform_2d_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gboolean interpolation;
+ gdouble source_x;
+ gdouble source_y;
+ gdouble scale_x;
+ gdouble scale_y;
+ gdouble angle;
+ gdouble dest_x;
+ gdouble dest_y;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
+ source_x = g_value_get_double (gimp_value_array_index (args, 2));
+ source_y = g_value_get_double (gimp_value_array_index (args, 3));
+ scale_x = g_value_get_double (gimp_value_array_index (args, 4));
+ scale_y = g_value_get_double (gimp_value_array_index (args, 5));
+ angle = g_value_get_double (gimp_value_array_index (args, 6));
+ dest_x = g_value_get_double (gimp_value_array_index (args, 7));
+ dest_y = g_value_get_double (gimp_value_array_index (args, 8));
+
+ if (success)
+ {
+ gint x, y, width, height;
+
+ success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION, error);
+
+ if (success &&
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+ GimpChannel *mask = gimp_image_get_mask (image);
+ GimpMatrix3 matrix;
+ GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
+
+ /* Assemble the transformation matrix */
+ gimp_matrix3_identity (&matrix);
+ gimp_matrix3_translate (&matrix, -source_x, -source_y);
+ gimp_matrix3_scale (&matrix, scale_x, scale_y);
+ gimp_matrix3_rotate (&matrix, angle);
+ gimp_matrix3_translate (&matrix, dest_x, dest_y);
+
+ if (interpolation)
+ interpolation_type = gimp->config->interpolation_type;
+
+ if (progress)
+ gimp_progress_start (progress, FALSE, _("2D Transform"));
+
+ if (drawable != GIMP_DRAWABLE (mask) &&
+ ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
+ ! gimp_channel_is_empty (mask))
+ {
+ if (! gimp_drawable_transform_affine (drawable, context,
+ &matrix, GIMP_TRANSFORM_FORWARD,
+ interpolation_type,
+ FALSE, progress))
+ {
+ success = FALSE;
+ }
+ }
+ else
+ {
+ gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
+ GIMP_TRANSFORM_FORWARD,
+ interpolation,
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
+ }
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
+
+ return return_vals;
+}
+
+void
+register_transform_tools_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-flip
+ */
+ procedure = gimp_procedure_new (flip_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-flip");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-flip",
+ "Deprecated: Use 'gimp-item-transform-flip-simple' instead.",
+ "Deprecated: Use 'gimp-item-transform-flip-simple' instead.",
+ "",
+ "",
+ "",
+ "gimp-item-transform-flip-simple");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("flip-type",
+ "flip type",
+ "Type of flip",
+ GIMP_TYPE_ORIENTATION_TYPE,
+ GIMP_ORIENTATION_HORIZONTAL,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
+ GIMP_ORIENTATION_UNKNOWN);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The flipped drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-perspective
+ */
+ procedure = gimp_procedure_new (perspective_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-perspective");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-perspective",
+ "Deprecated: Use 'gimp-item-transform-perspective' instead.",
+ "Deprecated: Use 'gimp-item-transform-perspective' instead.",
+ "",
+ "",
+ "",
+ "gimp-item-transform-perspective");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("interpolation",
+ "interpolation",
+ "Whether to use interpolation",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "The new x coordinate of upper-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "The new y coordinate of upper-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "The new x coordinate of upper-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "The new y coordinate of upper-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x2",
+ "x2",
+ "The new x coordinate of lower-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y2",
+ "y2",
+ "The new y coordinate of lower-left corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x3",
+ "x3",
+ "The new x coordinate of lower-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y3",
+ "y3",
+ "The new y coordinate of lower-right corner of original bounding box",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The newly mapped drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-rotate
+ */
+ procedure = gimp_procedure_new (rotate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-rotate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-rotate",
+ "Deprecated: Use 'gimp-item-transform-rotate' instead.",
+ "Deprecated: Use 'gimp-item-transform-rotate' instead.",
+ "",
+ "",
+ "",
+ "gimp-item-transform-rotate");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("interpolation",
+ "interpolation",
+ "Whether to use interpolation",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "The angle of rotation (radians)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The rotated drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-scale
+ */
+ procedure = gimp_procedure_new (scale_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-scale");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-scale",
+ "Deprecated: Use 'gimp-item-transform-scale' instead.",
+ "Deprecated: Use 'gimp-item-transform-scale' instead.",
+ "",
+ "",
+ "",
+ "gimp-item-transform-scale");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("interpolation",
+ "interpolation",
+ "Whether to use interpolation",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "The new x coordinate of the upper-left corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "The new y coordinate of the upper-left corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "The new x coordinate of the lower-right corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "The new y coordinate of the lower-right corner of the scaled region",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The scaled drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-shear
+ */
+ procedure = gimp_procedure_new (shear_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-shear");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-shear",
+ "Deprecated: Use 'gimp-item-transform-shear' instead.",
+ "Deprecated: Use 'gimp-item-transform-shear' instead.",
+ "",
+ "",
+ "",
+ "gimp-item-transform-shear");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("interpolation",
+ "interpolation",
+ "Whether to use interpolation",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("shear-type",
+ "shear type",
+ "Type of shear",
+ GIMP_TYPE_ORIENTATION_TYPE,
+ GIMP_ORIENTATION_HORIZONTAL,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[2]),
+ GIMP_ORIENTATION_UNKNOWN);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("magnitude",
+ "magnitude",
+ "The magnitude of the shear",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The sheared drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-transform-2d
+ */
+ procedure = gimp_procedure_new (transform_2d_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-transform-2d");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-transform-2d",
+ "Deprecated: Use 'gimp-item-transform-2d' instead.",
+ "Deprecated: Use 'gimp-item-transform-2d' instead.",
+ "",
+ "",
+ "",
+ "gimp-item-transform-2d");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The affected drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("interpolation",
+ "interpolation",
+ "Whether to use interpolation",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("source-x",
+ "source x",
+ "X coordinate of the transformation center",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("source-y",
+ "source y",
+ "Y coordinate of the transformation center",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("scale-x",
+ "scale x",
+ "Amount to scale in x direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("scale-y",
+ "scale y",
+ "Amount to scale in y direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "The angle of rotation (radians)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("dest-x",
+ "dest x",
+ "X coordinate of where the centre goes",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("dest-y",
+ "dest y",
+ "Y coordinate of where the centre goes",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The transformed drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/unit-cmds.c b/app/pdb/unit-cmds.c
new file mode 100644
index 0000000..590de72
--- /dev/null
+++ b/app/pdb/unit-cmds.c
@@ -0,0 +1,782 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpparamspecs.h"
+#include "core/gimpunit.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+
+static GimpValueArray *
+unit_get_number_of_units_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 num_units = 0;
+
+ num_units = _gimp_unit_get_number_of_units (gimp);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_units);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+unit_get_number_of_built_in_units_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ GimpValueArray *return_vals;
+ gint32 num_units = 0;
+
+ num_units = _gimp_unit_get_number_of_built_in_units (gimp);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_units);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+unit_new_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ const gchar *identifier;
+ gdouble factor;
+ gint32 digits;
+ const gchar *symbol;
+ const gchar *abbreviation;
+ const gchar *singular;
+ const gchar *plural;
+ GimpUnit unit_id = 0;
+
+ identifier = g_value_get_string (gimp_value_array_index (args, 0));
+ factor = g_value_get_double (gimp_value_array_index (args, 1));
+ digits = g_value_get_int (gimp_value_array_index (args, 2));
+ symbol = g_value_get_string (gimp_value_array_index (args, 3));
+ abbreviation = g_value_get_string (gimp_value_array_index (args, 4));
+ singular = g_value_get_string (gimp_value_array_index (args, 5));
+ plural = g_value_get_string (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ unit_id = _gimp_unit_new (gimp, identifier, factor, digits,
+ symbol, abbreviation, singular, plural);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), unit_id);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+unit_get_deletion_flag_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpUnit unit_id;
+ gboolean deletion_flag = FALSE;
+
+ unit_id = g_value_get_int (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ deletion_flag = _gimp_unit_get_deletion_flag (gimp, unit_id);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_boolean (gimp_value_array_index (return_vals, 1), deletion_flag);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+unit_set_deletion_flag_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpUnit unit_id;
+ gboolean deletion_flag;
+
+ unit_id = g_value_get_int (gimp_value_array_index (args, 0));
+ deletion_flag = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ _gimp_unit_set_deletion_flag (gimp, unit_id, deletion_flag);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+unit_get_identifier_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpUnit unit_id;
+ gchar *identifier = NULL;
+
+ unit_id = g_value_get_int (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ identifier = g_strdup (_gimp_unit_get_identifier (gimp, unit_id));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), identifier);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+unit_get_factor_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpUnit unit_id;
+ gdouble factor = 0.0;
+
+ unit_id = g_value_get_int (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ factor = _gimp_unit_get_factor (gimp, unit_id);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), factor);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+unit_get_digits_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpUnit unit_id;
+ gint32 digits = 0;
+
+ unit_id = g_value_get_int (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ digits = _gimp_unit_get_digits (gimp, unit_id);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), digits);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+unit_get_symbol_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpUnit unit_id;
+ gchar *symbol = NULL;
+
+ unit_id = g_value_get_int (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ symbol = g_strdup (_gimp_unit_get_symbol (gimp, unit_id));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), symbol);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+unit_get_abbreviation_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpUnit unit_id;
+ gchar *abbreviation = NULL;
+
+ unit_id = g_value_get_int (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ abbreviation = g_strdup (_gimp_unit_get_abbreviation (gimp, unit_id));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), abbreviation);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+unit_get_singular_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpUnit unit_id;
+ gchar *singular = NULL;
+
+ unit_id = g_value_get_int (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ singular = g_strdup (_gimp_unit_get_singular (gimp, unit_id));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), singular);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+unit_get_plural_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpUnit unit_id;
+ gchar *plural = NULL;
+
+ unit_id = g_value_get_int (gimp_value_array_index (args, 0));
+
+ if (success)
+ {
+ plural = g_strdup (_gimp_unit_get_plural (gimp, unit_id));
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), plural);
+
+ return return_vals;
+}
+
+void
+register_unit_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-unit-get-number-of-units
+ */
+ procedure = gimp_procedure_new (unit_get_number_of_units_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-unit-get-number-of-units");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-unit-get-number-of-units",
+ "Returns the number of units.",
+ "This procedure returns the number of defined units.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1999",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-units",
+ "num units",
+ "The number of units",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-unit-get-number-of-built-in-units
+ */
+ procedure = gimp_procedure_new (unit_get_number_of_built_in_units_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-unit-get-number-of-built-in-units");
+ gimp_procedure_set_static_strings (procedure,
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1999",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-units",
+ "num units",
+ "The number of built-in units",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-unit-new
+ */
+ procedure = gimp_procedure_new (unit_new_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-unit-new");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-unit-new",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("identifier",
+ "identifier",
+ "The new unit's identifier",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("factor",
+ "factor",
+ "The new unit's factor",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("digits",
+ "digits",
+ "The new unit's digits",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("symbol",
+ "symbol",
+ "The new unit's symbol",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("abbreviation",
+ "abbreviation",
+ "The new unit's abbreviation",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("singular",
+ "singular",
+ "The new unit's singular form",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("plural",
+ "plural",
+ "The new unit's plural form",
+ FALSE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_unit ("unit-id",
+ "unit id",
+ "The new unit's ID",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-unit-get-deletion-flag
+ */
+ procedure = gimp_procedure_new (unit_get_deletion_flag_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-unit-get-deletion-flag");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-unit-get-deletion-flag",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("unit-id",
+ "unit id",
+ "The unit's integer ID",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("deletion-flag",
+ "deletion flag",
+ "The unit's deletion flag",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-unit-set-deletion-flag
+ */
+ procedure = gimp_procedure_new (unit_set_deletion_flag_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-unit-set-deletion-flag");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-unit-set-deletion-flag",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("unit-id",
+ "unit id",
+ "The unit's integer ID",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("deletion-flag",
+ "deletion flag",
+ "The new deletion flag of the unit",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-unit-get-identifier
+ */
+ procedure = gimp_procedure_new (unit_get_identifier_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-unit-get-identifier");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-unit-get-identifier",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("unit-id",
+ "unit id",
+ "The unit's integer ID",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("identifier",
+ "identifier",
+ "The unit's textual identifier",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-unit-get-factor
+ */
+ procedure = gimp_procedure_new (unit_get_factor_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-unit-get-factor");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-unit-get-factor",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("unit-id",
+ "unit id",
+ "The unit's integer ID",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("factor",
+ "factor",
+ "The unit's factor",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-unit-get-digits
+ */
+ procedure = gimp_procedure_new (unit_get_digits_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-unit-get-digits");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-unit-get-digits",
+ "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.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("unit-id",
+ "unit id",
+ "The unit's integer ID",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("digits",
+ "digits",
+ "The unit's number of digits",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-unit-get-symbol
+ */
+ procedure = gimp_procedure_new (unit_get_symbol_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-unit-get-symbol");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-unit-get-symbol",
+ "Returns the symbol of the unit.",
+ "This procedure returns the symbol of the unit (\"''\" for inches).",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("unit-id",
+ "unit id",
+ "The unit's integer ID",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("symbol",
+ "symbol",
+ "The unit's symbol",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-unit-get-abbreviation
+ */
+ procedure = gimp_procedure_new (unit_get_abbreviation_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-unit-get-abbreviation");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-unit-get-abbreviation",
+ "Returns the abbreviation of the unit.",
+ "This procedure returns the abbreviation of the unit (\"in\" for inches).",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("unit-id",
+ "unit id",
+ "The unit's integer ID",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("abbreviation",
+ "abbreviation",
+ "The unit's abbreviation",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-unit-get-singular
+ */
+ procedure = gimp_procedure_new (unit_get_singular_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-unit-get-singular");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-unit-get-singular",
+ "Returns the singular form of the unit.",
+ "This procedure returns the singular form of the unit.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("unit-id",
+ "unit id",
+ "The unit's integer ID",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("singular",
+ "singular",
+ "The unit's singular form",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-unit-get-plural
+ */
+ procedure = gimp_procedure_new (unit_get_plural_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-unit-get-plural");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-unit-get-plural",
+ "Returns the plural form of the unit.",
+ "This procedure returns the plural form of the unit.",
+ "Michael Natterer <mitch@gimp.org>",
+ "Michael Natterer",
+ "1999",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_unit ("unit-id",
+ "unit id",
+ "The unit's integer ID",
+ TRUE,
+ FALSE,
+ GIMP_UNIT_PIXEL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("plural",
+ "plural",
+ "The unit's plural form",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/vectors-cmds.c b/app/pdb/vectors-cmds.c
new file mode 100644
index 0000000..92afaeb
--- /dev/null
+++ b/app/pdb/vectors-cmds.c
@@ -0,0 +1,2518 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpimage-undo-push.h"
+#include "core/gimpimage.h"
+#include "core/gimplayer.h"
+#include "core/gimplist.h"
+#include "core/gimpparamspecs.h"
+#include "text/gimptext-vectors.h"
+#include "text/gimptextlayer.h"
+#include "vectors/gimpanchor.h"
+#include "vectors/gimpbezierstroke.h"
+#include "vectors/gimpstroke-new.h"
+#include "vectors/gimpvectors-export.h"
+#include "vectors/gimpvectors-import.h"
+#include "vectors/gimpvectors.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+vectors_new_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ const gchar *name;
+ GimpVectors *vectors = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ name = g_value_get_string (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ vectors = gimp_vectors_new (image, name);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_vectors (gimp_value_array_index (return_vals, 1), vectors);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vectors_new_from_text_layer_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpLayer *layer;
+ GimpVectors *vectors = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ layer = gimp_value_get_layer (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ if (gimp_pdb_layer_is_text_layer (layer, 0, error))
+ {
+ gint x, y;
+
+ vectors = gimp_text_vectors_new (image,
+ gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)));
+
+ gimp_item_get_offset (GIMP_ITEM (layer), &x, &y);
+ gimp_item_translate (GIMP_ITEM (vectors), x, y, FALSE);
+ }
+ else
+ {
+ success = FALSE;
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_vectors (gimp_value_array_index (return_vals, 1), vectors);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vectors_copy_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectors *vectors;
+ GimpVectors *vectors_copy = NULL;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ vectors_copy = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
+ G_TYPE_FROM_INSTANCE (vectors)));
+
+ if (! vectors_copy)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ gimp_value_set_vectors (gimp_value_array_index (return_vals, 1), vectors_copy);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vectors_get_strokes_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectors *vectors;
+ gint32 num_strokes = 0;
+ gint32 *stroke_ids = NULL;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ num_strokes = gimp_vectors_get_n_strokes (vectors);
+
+ if (num_strokes)
+ {
+ GimpStroke *cur_stroke;
+ gint i = 0;
+
+ stroke_ids = g_new (gint32, num_strokes);
+
+ for (cur_stroke = gimp_vectors_stroke_get_next (vectors, NULL);
+ cur_stroke;
+ cur_stroke = gimp_vectors_stroke_get_next (vectors, cur_stroke))
+ {
+ stroke_ids[i] = gimp_stroke_get_ID (cur_stroke);
+ i++;
+ }
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_strokes);
+ gimp_value_take_int32array (gimp_value_array_index (return_vals, 2), stroke_ids, num_strokes);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vectors_stroke_get_length_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+ gdouble precision;
+ gdouble length = 0.0;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+ precision = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, 0, error);
+
+ if (stroke)
+ length = gimp_stroke_get_length (stroke, precision);
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_double (gimp_value_array_index (return_vals, 1), length);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vectors_stroke_get_point_at_dist_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+ gdouble dist;
+ gdouble precision;
+ gdouble x_point = 0.0;
+ gdouble y_point = 0.0;
+ gdouble slope = 0.0;
+ gboolean valid = FALSE;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+ dist = g_value_get_double (gimp_value_array_index (args, 2));
+ precision = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, 0, error);
+
+ if (stroke)
+ {
+ GimpCoords coord;
+
+ valid = gimp_stroke_get_point_at_dist (stroke, dist, precision,
+ &coord, &slope);
+ x_point = valid ? coord.x : 0;
+ y_point = valid ? coord.y : 0;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_double (gimp_value_array_index (return_vals, 1), x_point);
+ g_value_set_double (gimp_value_array_index (return_vals, 2), y_point);
+ g_value_set_double (gimp_value_array_index (return_vals, 3), slope);
+ g_value_set_boolean (gimp_value_array_index (return_vals, 4), valid);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vectors_remove_stroke_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id,
+ GIMP_PDB_ITEM_CONTENT, error);
+
+ if (stroke)
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Remove path stroke"),
+ vectors);
+
+ gimp_vectors_stroke_remove (vectors, stroke);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vectors_stroke_close_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id,
+ GIMP_PDB_ITEM_CONTENT, error);
+
+ if (stroke)
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Close path stroke"),
+ vectors);
+
+ gimp_vectors_freeze (vectors);
+ gimp_stroke_close (stroke);
+ gimp_vectors_thaw (vectors);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vectors_stroke_translate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+ gint32 off_x;
+ gint32 off_y;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+ off_x = g_value_get_int (gimp_value_array_index (args, 2));
+ off_y = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION,
+ error);
+
+ if (stroke)
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Translate path stroke"),
+ vectors);
+
+ gimp_vectors_freeze (vectors);
+ gimp_stroke_translate (stroke, off_x, off_y);
+ gimp_vectors_thaw (vectors);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vectors_stroke_scale_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+ gdouble scale_x;
+ gdouble scale_y;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+ scale_x = g_value_get_double (gimp_value_array_index (args, 2));
+ scale_y = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION,
+ error);
+
+ if (stroke)
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Scale path stroke"),
+ vectors);
+
+ gimp_vectors_freeze (vectors);
+ gimp_stroke_scale (stroke, scale_x, scale_y);
+ gimp_vectors_thaw (vectors);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vectors_stroke_rotate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+ gdouble center_x;
+ gdouble center_y;
+ gdouble angle;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+ center_x = g_value_get_double (gimp_value_array_index (args, 2));
+ center_y = g_value_get_double (gimp_value_array_index (args, 3));
+ angle = g_value_get_double (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION,
+ error);
+
+ if (stroke)
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Rotate path stroke"),
+ vectors);
+
+ gimp_vectors_freeze (vectors);
+ gimp_stroke_rotate (stroke, center_x, center_y, angle);
+ gimp_vectors_thaw (vectors);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vectors_stroke_flip_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+ gint32 flip_type;
+ gdouble axis;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+ flip_type = g_value_get_enum (gimp_value_array_index (args, 2));
+ axis = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION,
+ error);
+
+ if (stroke)
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Flip path stroke"),
+ vectors);
+
+ gimp_vectors_freeze (vectors);
+ gimp_stroke_flip (stroke, flip_type, axis);
+ gimp_vectors_thaw (vectors);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vectors_stroke_flip_free_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+ gdouble x1;
+ gdouble y1;
+ gdouble x2;
+ gdouble y2;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+ x1 = g_value_get_double (gimp_value_array_index (args, 2));
+ y1 = g_value_get_double (gimp_value_array_index (args, 3));
+ x2 = g_value_get_double (gimp_value_array_index (args, 4));
+ y2 = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id,
+ GIMP_PDB_ITEM_CONTENT |
+ GIMP_PDB_ITEM_POSITION,
+ error);
+
+ if (stroke)
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Flip path stroke"),
+ vectors);
+
+ gimp_vectors_freeze (vectors);
+ gimp_stroke_flip_free (stroke, x1, y1, x2, y2);
+ gimp_vectors_thaw (vectors);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vectors_stroke_get_points_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+ gint32 type = 0;
+ gint32 num_points = 0;
+ gdouble *controlpoints = NULL;
+ gboolean closed = FALSE;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, 0, error);
+
+ if (GIMP_IS_BEZIER_STROKE (stroke))
+ {
+ GArray *points_array;
+ gint i;
+
+ points_array = gimp_stroke_control_points_get (stroke, &closed);
+
+ if (points_array)
+ {
+ num_points = points_array->len;
+ controlpoints = g_new (gdouble, num_points * 2);
+
+ type = GIMP_VECTORS_STROKE_TYPE_BEZIER;
+ for (i = 0; i < num_points; i++)
+ {
+ controlpoints[2*i] = g_array_index (points_array,
+ GimpAnchor, i).position.x;
+ controlpoints[2*i+1] = g_array_index (points_array,
+ GimpAnchor, i).position.y;
+ }
+ g_array_free (points_array, TRUE);
+ num_points *= 2;
+ }
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), type);
+ g_value_set_int (gimp_value_array_index (return_vals, 2), num_points);
+ gimp_value_take_floatarray (gimp_value_array_index (return_vals, 3), controlpoints, num_points);
+ g_value_set_boolean (gimp_value_array_index (return_vals, 4), closed);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vectors_stroke_new_from_points_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectors *vectors;
+ gint32 type;
+ gint32 num_points;
+ const gdouble *controlpoints;
+ gboolean closed;
+ gint32 stroke_id = 0;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ type = g_value_get_enum (gimp_value_array_index (args, 1));
+ num_points = g_value_get_int (gimp_value_array_index (args, 2));
+ controlpoints = gimp_value_get_floatarray (gimp_value_array_index (args, 3));
+ closed = g_value_get_boolean (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ GimpStroke *stroke;
+ GimpCoords *coords;
+ GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES;
+ gint i;
+
+ success = FALSE;
+
+ if (type == GIMP_VECTORS_STROKE_TYPE_BEZIER &&
+ num_points % 6 == 0)
+ {
+ coords = g_new (GimpCoords, num_points/2);
+ for (i = 0; i < num_points/2; i++)
+ {
+ coords[i] = default_coords;
+ coords[i].x = controlpoints[i*2];
+ coords[i].y = controlpoints[i*2+1];
+ }
+
+ stroke = gimp_stroke_new_from_coords (type, coords, num_points/2, closed);
+ if (stroke)
+ {
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Add path stroke"),
+ vectors);
+
+ gimp_vectors_stroke_add (vectors, stroke);
+ g_object_unref (stroke);
+
+ stroke_id = gimp_stroke_get_ID (stroke);
+
+ success = TRUE;
+ }
+
+ g_free (coords);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), stroke_id);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vectors_stroke_interpolate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+ gdouble precision;
+ gint32 num_coords = 0;
+ gdouble *coords = NULL;
+ gboolean closed = FALSE;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+ precision = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, 0, error);
+
+ if (stroke)
+ {
+ GArray *coords_array;
+ gint i;
+
+ coords_array = gimp_stroke_interpolate (stroke, precision, &closed);
+
+ if (coords_array)
+ {
+ num_coords = coords_array->len;
+ coords = g_new (gdouble, num_coords * 2);
+
+ for (i = 0; i < num_coords; i++)
+ {
+ coords[2*i] = g_array_index (coords_array, GimpCoords, i).x;
+ coords[2*i+1] = g_array_index (coords_array, GimpCoords, i).y;
+ }
+ g_array_free (coords_array, TRUE);
+ num_coords *= 2;
+ }
+ else
+ success = FALSE;
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_coords);
+ gimp_value_take_floatarray (gimp_value_array_index (return_vals, 2), coords, num_coords);
+ g_value_set_boolean (gimp_value_array_index (return_vals, 3), closed);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vectors_bezier_stroke_new_moveto_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectors *vectors;
+ gdouble x0;
+ gdouble y0;
+ gint32 stroke_id = 0;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ x0 = g_value_get_double (gimp_value_array_index (args, 1));
+ y0 = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_modifiable (GIMP_ITEM (vectors),
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (vectors), error))
+ {
+ GimpStroke *stroke;
+ GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES;
+
+ coord0.x = x0;
+ coord0.y = y0;
+
+ stroke = gimp_bezier_stroke_new_moveto (&coord0);
+
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Add path stroke"),
+ vectors);
+
+ gimp_vectors_stroke_add (vectors, stroke);
+ g_object_unref (stroke);
+
+ stroke_id = gimp_stroke_get_ID (stroke);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), stroke_id);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vectors_bezier_stroke_lineto_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+ gdouble x0;
+ gdouble y0;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+ x0 = g_value_get_double (gimp_value_array_index (args, 2));
+ y0 = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id,
+ GIMP_PDB_ITEM_CONTENT, error);
+
+ if (stroke)
+ {
+ GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES;
+
+ coord0.x = x0;
+ coord0.y = y0;
+
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Extend path stroke"),
+ vectors);
+
+ gimp_vectors_freeze (vectors);
+ gimp_bezier_stroke_lineto (stroke, &coord0);
+ gimp_vectors_thaw (vectors);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vectors_bezier_stroke_conicto_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+ gdouble x0;
+ gdouble y0;
+ gdouble x1;
+ gdouble y1;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+ x0 = g_value_get_double (gimp_value_array_index (args, 2));
+ y0 = g_value_get_double (gimp_value_array_index (args, 3));
+ x1 = g_value_get_double (gimp_value_array_index (args, 4));
+ y1 = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id,
+ GIMP_PDB_ITEM_CONTENT, error);
+
+ if (stroke)
+ {
+ GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES;
+ GimpCoords coord1 = GIMP_COORDS_DEFAULT_VALUES;
+
+ coord0.x = x0;
+ coord0.y = y0;
+
+ coord1.x = x1;
+ coord1.y = y1;
+
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Extend path stroke"),
+ vectors);
+
+ gimp_vectors_freeze (vectors);
+ gimp_bezier_stroke_conicto (stroke, &coord0, &coord1);
+ gimp_vectors_thaw (vectors);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vectors_bezier_stroke_cubicto_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectors *vectors;
+ gint32 stroke_id;
+ gdouble x0;
+ gdouble y0;
+ gdouble x1;
+ gdouble y1;
+ gdouble x2;
+ gdouble y2;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ stroke_id = g_value_get_int (gimp_value_array_index (args, 1));
+ x0 = g_value_get_double (gimp_value_array_index (args, 2));
+ y0 = g_value_get_double (gimp_value_array_index (args, 3));
+ x1 = g_value_get_double (gimp_value_array_index (args, 4));
+ y1 = g_value_get_double (gimp_value_array_index (args, 5));
+ x2 = g_value_get_double (gimp_value_array_index (args, 6));
+ y2 = g_value_get_double (gimp_value_array_index (args, 7));
+
+ if (success)
+ {
+ GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id,
+ GIMP_PDB_ITEM_CONTENT, error);
+
+ if (stroke)
+ {
+ GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES;
+ GimpCoords coord1 = GIMP_COORDS_DEFAULT_VALUES;
+ GimpCoords coord2 = GIMP_COORDS_DEFAULT_VALUES;
+
+ coord0.x = x0;
+ coord0.y = y0;
+
+ coord1.x = x1;
+ coord1.y = y1;
+
+ coord2.x = x2;
+ coord2.y = y2;
+
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Extend path stroke"),
+ vectors);
+
+ gimp_vectors_freeze (vectors);
+ gimp_bezier_stroke_cubicto (stroke, &coord0, &coord1, &coord2);
+ gimp_vectors_thaw (vectors);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vectors_bezier_stroke_new_ellipse_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpVectors *vectors;
+ gdouble x0;
+ gdouble y0;
+ gdouble radius_x;
+ gdouble radius_y;
+ gdouble angle;
+ gint32 stroke_id = 0;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ x0 = g_value_get_double (gimp_value_array_index (args, 1));
+ y0 = g_value_get_double (gimp_value_array_index (args, 2));
+ radius_x = g_value_get_double (gimp_value_array_index (args, 3));
+ radius_y = g_value_get_double (gimp_value_array_index (args, 4));
+ angle = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_modifiable (GIMP_ITEM (vectors),
+ GIMP_PDB_ITEM_CONTENT, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (vectors), error))
+ {
+ GimpStroke *stroke;
+ GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES;
+
+ coord0.x = x0;
+ coord0.y = y0;
+
+ stroke = gimp_bezier_stroke_new_ellipse (&coord0, radius_x, radius_y, angle);
+
+ if (gimp_item_is_attached (GIMP_ITEM (vectors)))
+ gimp_image_undo_push_vectors_mod (gimp_item_get_image (GIMP_ITEM (vectors)),
+ _("Add path stroke"),
+ vectors);
+
+ gimp_vectors_stroke_add (vectors, stroke);
+ g_object_unref (stroke);
+
+ stroke_id = gimp_stroke_get_ID (stroke);
+ }
+ else
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_int (gimp_value_array_index (return_vals, 1), stroke_id);
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vectors_to_selection_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpVectors *vectors;
+ gint32 operation;
+ gboolean antialias;
+ gboolean feather;
+ gdouble feather_radius_x;
+ gdouble feather_radius_y;
+
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 0), gimp);
+ operation = g_value_get_enum (gimp_value_array_index (args, 1));
+ antialias = g_value_get_boolean (gimp_value_array_index (args, 2));
+ feather = g_value_get_boolean (gimp_value_array_index (args, 3));
+ feather_radius_x = g_value_get_double (gimp_value_array_index (args, 4));
+ feather_radius_y = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), NULL, 0, error))
+ gimp_item_to_selection (GIMP_ITEM (vectors),
+ operation,
+ antialias,
+ feather,
+ feather_radius_x,
+ feather_radius_y);
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vectors_import_from_file_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ const gchar *filename;
+ gboolean merge;
+ gboolean scale;
+ gint32 num_vectors = 0;
+ gint32 *vectors_ids = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ filename = g_value_get_string (gimp_value_array_index (args, 1));
+ merge = g_value_get_boolean (gimp_value_array_index (args, 2));
+ scale = g_value_get_boolean (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ GFile *file = g_file_new_for_path (filename);
+ GList *vectors_list = NULL;
+
+ /* FIXME tree */
+ success = gimp_vectors_import_file (image, file,
+ merge, scale, NULL, -1,
+ &vectors_list, error);
+
+ g_object_unref (file);
+
+ if (success)
+ {
+ num_vectors = g_list_length (vectors_list);
+
+ if (num_vectors)
+ {
+ GList *list;
+ gint i;
+
+ vectors_ids = g_new (gint32, num_vectors);
+
+ list = vectors_list;
+ for (i = 0; i < num_vectors; i++, list = g_list_next (list))
+ vectors_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
+
+ g_list_free (vectors_list);
+ }
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_vectors);
+ gimp_value_take_int32array (gimp_value_array_index (return_vals, 2), vectors_ids, num_vectors);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vectors_import_from_string_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ const gchar *string;
+ gint32 length;
+ gboolean merge;
+ gboolean scale;
+ gint32 num_vectors = 0;
+ gint32 *vectors_ids = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ string = g_value_get_string (gimp_value_array_index (args, 1));
+ length = g_value_get_int (gimp_value_array_index (args, 2));
+ merge = g_value_get_boolean (gimp_value_array_index (args, 3));
+ scale = g_value_get_boolean (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ GList *list, *vectors_list = NULL;
+
+ /* FIXME tree */
+ success = gimp_vectors_import_buffer (image, string, length,
+ merge, scale, NULL, -1,
+ &vectors_list, error);
+
+ if (success)
+ {
+ num_vectors = g_list_length (vectors_list);
+
+ if (num_vectors)
+ {
+ gint i;
+
+ vectors_ids = g_new (gint32, num_vectors);
+
+ list = vectors_list;
+ for (i = 0; i < num_vectors; i++, list = g_list_next (list))
+ vectors_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
+
+ g_list_free (vectors_list);
+ }
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_vectors);
+ gimp_value_take_int32array (gimp_value_array_index (return_vals, 2), vectors_ids, num_vectors);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+vectors_export_to_file_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *filename;
+ GimpVectors *vectors;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ filename = g_value_get_string (gimp_value_array_index (args, 1));
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 2), gimp);
+
+ if (success)
+ {
+ GFile *file = g_file_new_for_path (filename);
+
+ success = gimp_vectors_export_file (image, vectors, file, error);
+
+ g_object_unref (file);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+vectors_export_to_string_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ GimpVectors *vectors;
+ gchar *string = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ vectors = gimp_value_get_vectors (gimp_value_array_index (args, 1), gimp);
+
+ if (success)
+ {
+ string = gimp_vectors_export_string (image, vectors);
+
+ success = (string != NULL);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_string (gimp_value_array_index (return_vals, 1), string);
+
+ return return_vals;
+}
+
+void
+register_vectors_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-vectors-new
+ */
+ procedure = gimp_procedure_new (vectors_new_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-new");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-new",
+ "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'.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "the name of the new vector object.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "the current vector object, 0 if no vector exists in the image.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-new-from-text-layer
+ */
+ procedure = gimp_procedure_new (vectors_new_from_text_layer_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-new-from-text-layer");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-new-from-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'.",
+ "Marcus Heese <heese@cip.ifi.lmu.de>",
+ "Marcus Heese",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The text layer.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors of the text layer.",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-copy
+ */
+ procedure = gimp_procedure_new (vectors_copy_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-copy");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-copy",
+ "Copy a vectors object.",
+ "This procedure copies the specified vectors object and returns the copy.",
+ "Barak Itkin <lightningismyname@gmail.com>",
+ "Barak Itkin",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object to copy",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_vectors_id ("vectors-copy",
+ "vectors copy",
+ "The newly copied vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-get-strokes
+ */
+ procedure = gimp_procedure_new (vectors_get_strokes_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-get-strokes");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-get-strokes",
+ "List the strokes associated with the passed path.",
+ "Returns an Array with the stroke-IDs associated with the passed path.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-strokes",
+ "num strokes",
+ "The number of strokes returned.",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32_array ("stroke-ids",
+ "stroke ids",
+ "List of the strokes belonging to the path.",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-stroke-get-length
+ */
+ procedure = gimp_procedure_new (vectors_stroke_get_length_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-stroke-get-length");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-stroke-get-length",
+ "Measure the length of the given stroke.",
+ "Measure the length of the given stroke.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("precision",
+ "precision",
+ "The precision used for the approximation",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("length",
+ "length",
+ "The length (in pixels) of the given stroke.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-stroke-get-point-at-dist
+ */
+ procedure = gimp_procedure_new (vectors_stroke_get_point_at_dist_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-stroke-get-point-at-dist");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-stroke-get-point-at-dist",
+ "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.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("dist",
+ "dist",
+ "The given distance.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("precision",
+ "precision",
+ "The precision used for the approximation",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("x-point",
+ "x point",
+ "The x position of the point.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("y-point",
+ "y point",
+ "The y position of the point.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("slope",
+ "slope",
+ "The slope (dy / dx) at the specified point.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("valid",
+ "valid",
+ "Indicator for the validity of the returned data.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-remove-stroke
+ */
+ procedure = gimp_procedure_new (vectors_remove_stroke_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-remove-stroke");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-remove-stroke",
+ "remove the stroke from a vectors object.",
+ "Remove the stroke from a vectors object.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-stroke-close
+ */
+ procedure = gimp_procedure_new (vectors_stroke_close_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-stroke-close");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-stroke-close",
+ "closes the specified stroke.",
+ "Closes the specified stroke.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-stroke-translate
+ */
+ procedure = gimp_procedure_new (vectors_stroke_translate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-stroke-translate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-stroke-translate",
+ "translate the given stroke.",
+ "Translate the given stroke.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("off-x",
+ "off x",
+ "Offset in x direction",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("off-y",
+ "off y",
+ "Offset in y direction",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-stroke-scale
+ */
+ procedure = gimp_procedure_new (vectors_stroke_scale_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-stroke-scale");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-stroke-scale",
+ "scales the given stroke.",
+ "Scale the given stroke.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("scale-x",
+ "scale x",
+ "Scale factor in x direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("scale-y",
+ "scale y",
+ "Scale factor in y direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-stroke-rotate
+ */
+ procedure = gimp_procedure_new (vectors_stroke_rotate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-stroke-rotate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-stroke-rotate",
+ "rotates the given stroke.",
+ "Rotates the given stroke around given center by angle (in degrees).",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2006",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("center-x",
+ "center x",
+ "X coordinate of the rotation center",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("center-y",
+ "center y",
+ "Y coordinate of the rotation center",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "angle to rotate about",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-stroke-flip
+ */
+ procedure = gimp_procedure_new (vectors_stroke_flip_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-stroke-flip");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-stroke-flip",
+ "flips the given stroke.",
+ "Rotates the given stroke around given center by angle (in degrees).",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2006",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_enum ("flip-type",
+ "flip type",
+ "Flip orientation, either vertical or horizontal",
+ GIMP_TYPE_ORIENTATION_TYPE,
+ GIMP_ORIENTATION_HORIZONTAL,
+ GIMP_PARAM_READWRITE));
+ gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[2]),
+ GIMP_ORIENTATION_UNKNOWN);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("axis",
+ "axis",
+ "axis coordinate about which to flip, in pixels",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-stroke-flip-free
+ */
+ procedure = gimp_procedure_new (vectors_stroke_flip_free_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-stroke-flip-free");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-stroke-flip-free",
+ "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.",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "Jo\xc3\xa3o S. O. Bueno",
+ "2006",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "X coordinate of the first point of the flipping axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "Y coordinate of the first point of the flipping axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x2",
+ "x2",
+ "X coordinate of the second point of the flipping axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y2",
+ "y2",
+ "Y coordinate of the second point of the flipping axis",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-stroke-get-points
+ */
+ procedure = gimp_procedure_new (vectors_stroke_get_points_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-stroke-get-points");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-stroke-get-points",
+ "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.",
+ "Simon Budig",
+ "Simon Budig",
+ "2006",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("type",
+ "type",
+ "type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now).",
+ GIMP_TYPE_VECTORS_STROKE_TYPE,
+ GIMP_VECTORS_STROKE_TYPE_BEZIER,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-points",
+ "num points",
+ "The number of floats returned.",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_float_array ("controlpoints",
+ "controlpoints",
+ "List of the control points for the stroke (x0, y0, x1, y1, ...).",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("closed",
+ "closed",
+ "Whether the stroke is closed or not.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-stroke-new-from-points
+ */
+ procedure = gimp_procedure_new (vectors_stroke_new_from_points_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-stroke-new-from-points");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-stroke-new-from-points",
+ "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...",
+ "Simon Budig",
+ "Simon Budig",
+ "2006",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("type",
+ "type",
+ "type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now).",
+ GIMP_TYPE_VECTORS_STROKE_TYPE,
+ GIMP_VECTORS_STROKE_TYPE_BEZIER,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-points",
+ "num points",
+ "The number of elements in the array, i.e. the number of controlpoints in the stroke * 2 (x- and y-coordinate).",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_float_array ("controlpoints",
+ "controlpoints",
+ "List of the x- and y-coordinates of the control points.",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("closed",
+ "closed",
+ "Whether the stroke is to be closed or not.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID of the newly created stroke.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-stroke-interpolate
+ */
+ procedure = gimp_procedure_new (vectors_stroke_interpolate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-stroke-interpolate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-stroke-interpolate",
+ "returns polygonal approximation of the stroke.",
+ "returns polygonal approximation of the stroke.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("precision",
+ "precision",
+ "The precision used for the approximation",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-coords",
+ "num coords",
+ "The number of floats returned.",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_float_array ("coords",
+ "coords",
+ "List of the coords along the path (x0, y0, x1, y1, ...).",
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_boolean ("closed",
+ "closed",
+ "Whether the stroke is closed or not.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-bezier-stroke-new-moveto
+ */
+ procedure = gimp_procedure_new (vectors_bezier_stroke_new_moveto_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-bezier-stroke-new-moveto");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-bezier-stroke-new-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.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "The x-coordinate of the moveto",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "The y-coordinate of the moveto",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The resulting stroke",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-bezier-stroke-lineto
+ */
+ procedure = gimp_procedure_new (vectors_bezier_stroke_lineto_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-bezier-stroke-lineto");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-bezier-stroke-lineto",
+ "Extends a bezier stroke with a lineto.",
+ "Extends a bezier stroke with a lineto.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "The x-coordinate of the lineto",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "The y-coordinate of the lineto",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-bezier-stroke-conicto
+ */
+ procedure = gimp_procedure_new (vectors_bezier_stroke_conicto_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-bezier-stroke-conicto");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-bezier-stroke-conicto",
+ "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.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "The x-coordinate of the control point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "The y-coordinate of the control point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "The x-coordinate of the end point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "The y-coordinate of the end point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-bezier-stroke-cubicto
+ */
+ procedure = gimp_procedure_new (vectors_bezier_stroke_cubicto_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-bezier-stroke-cubicto");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-bezier-stroke-cubicto",
+ "Extends a bezier stroke with a cubic bezier spline.",
+ "Extends a bezier stroke with a cubic bezier spline.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The stroke ID",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "The x-coordinate of the first control point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "The y-coordinate of the first control point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x1",
+ "x1",
+ "The x-coordinate of the second control point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y1",
+ "y1",
+ "The y-coordinate of the second control point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x2",
+ "x2",
+ "The x-coordinate of the end point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y2",
+ "y2",
+ "The y-coordinate of the end point",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-bezier-stroke-new-ellipse
+ */
+ procedure = gimp_procedure_new (vectors_bezier_stroke_new_ellipse_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-bezier-stroke-new-ellipse");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-bezier-stroke-new-ellipse",
+ "Adds a bezier stroke describing an ellipse the vectors object.",
+ "Adds a bezier stroke describing an ellipse the vectors object.",
+ "Simon Budig",
+ "Simon Budig",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("x0",
+ "x0",
+ "The x-coordinate of the center",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("y0",
+ "y0",
+ "The y-coordinate of the center",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("radius-x",
+ "radius x",
+ "The radius in x direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("radius-y",
+ "radius y",
+ "The radius in y direction",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("angle",
+ "angle",
+ "The angle the x-axis of the ellipse (radians, counterclockwise)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("stroke-id",
+ "stroke id",
+ "The resulting stroke",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-to-selection
+ */
+ procedure = gimp_procedure_new (vectors_to_selection_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-to-selection");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-to-selection",
+ "Deprecated: Use 'gimp-image-select-item' instead.",
+ "Deprecated: Use 'gimp-image-select-item' instead.",
+ "Simon Budig",
+ "Simon Budig",
+ "2006",
+ "gimp-image-select-item");
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object to render to the selection",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("operation",
+ "operation",
+ "The desired operation with current selection",
+ GIMP_TYPE_CHANNEL_OPS,
+ GIMP_CHANNEL_OP_ADD,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("antialias",
+ "antialias",
+ "Antialias selection.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("feather",
+ "feather",
+ "Feather selection.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius-x",
+ "feather radius x",
+ "Feather radius x.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("feather-radius-y",
+ "feather radius y",
+ "Feather radius y.",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-import-from-file
+ */
+ procedure = gimp_procedure_new (vectors_import_from_file_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-import-from-file");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-import-from-file",
+ "Import paths from an SVG file.",
+ "This procedure imports paths from an SVG file. SVG elements other than paths and basic shapes are ignored.",
+ "Simon Budig",
+ "Simon Budig",
+ "2006",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filename",
+ "filename",
+ "The name of the SVG file to import.",
+ TRUE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("merge",
+ "merge",
+ "Merge paths into a single vectors object.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("scale",
+ "scale",
+ "Scale the SVG to image dimensions.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-vectors",
+ "num vectors",
+ "The number of newly created vectors",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32_array ("vectors-ids",
+ "vectors ids",
+ "The list of newly created vectors",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-import-from-string
+ */
+ procedure = gimp_procedure_new (vectors_import_from_string_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-import-from-string");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-import-from-string",
+ "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.",
+ "Simon Budig",
+ "Simon Budig",
+ "2006",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("string",
+ "string",
+ "A string that must be a complete and valid SVG document.",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("length",
+ "length",
+ "Number of bytes in string or -1 if the string is NULL terminated.",
+ G_MININT32, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("merge",
+ "merge",
+ "Merge paths into a single vectors object.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("scale",
+ "scale",
+ "Scale the SVG to image dimensions.",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-vectors",
+ "num vectors",
+ "The number of newly created vectors",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32_array ("vectors-ids",
+ "vectors ids",
+ "The list of newly created vectors",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-export-to-file
+ */
+ procedure = gimp_procedure_new (vectors_export_to_file_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-export-to-file");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-export-to-file",
+ "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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2007",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("filename",
+ "filename",
+ "The name of the SVG file to create.",
+ TRUE, FALSE, TRUE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object to be saved, or 0 for all in the image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-vectors-export-to-string
+ */
+ procedure = gimp_procedure_new (vectors_export_to_string_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-vectors-export-to-string");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-vectors-export-to-string",
+ "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.",
+ "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
+ "Bill Skaggs",
+ "2007",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_vectors_id ("vectors",
+ "vectors",
+ "The vectors object to save, or 0 for all in the image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string ("string",
+ "string",
+ "A string whose contents are a complete SVG document.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}