[gimp] pdb: add procedures to set the built-in gradients
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] pdb: add procedures to set the built-in gradients
- Date: Mon, 16 Apr 2018 09:44:23 +0000 (UTC)
commit 3f4995d3d71f294271a71b707133e098243a7331
Author: Michael Natterer <mitch gimp org>
Date: Mon Apr 16 11:42:46 2018 +0200
pdb: add procedures to set the built-in gradients
gimp-context-set-gradient-fg-bg-rgb
gimp-context-set-gradient-fg-bg-hsv-cw
gimp-context-set-gradient-fg-bg-hsv-ccw
gimp-context-set-gradient-fg-transparent
app/pdb/context-cmds.c | 125 +++++++++++++++++++++++++++++++++++++++++++++
app/pdb/internal-procs.c | 2 +-
libgimp/gimp.def | 4 ++
libgimp/gimpcontext_pdb.c | 124 ++++++++++++++++++++++++++++++++++++++++++++
libgimp/gimpcontext_pdb.h | 4 ++
pdb/groups/context.pdb | 85 ++++++++++++++++++++++++++++++
6 files changed, 343 insertions(+), 1 deletions(-)
---
diff --git a/app/pdb/context-cmds.c b/app/pdb/context-cmds.c
index dbf9cad..6c06597 100644
--- a/app/pdb/context-cmds.c
+++ b/app/pdb/context-cmds.c
@@ -32,6 +32,7 @@
#include "pdb-types.h"
+#include "core/gimp-gradients.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpdashpattern.h"
@@ -1563,6 +1564,62 @@ context_set_gradient_invoker (GimpProcedure *procedure,
}
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,
@@ -4320,6 +4377,74 @@ register_context_procs (GimpPDB *pdb)
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);
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 28657e3..d2cc538 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 828 procedures registered total */
+/* 832 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index 3e198af..f3dbc7d 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -145,6 +145,10 @@ EXPORTS
gimp_context_set_foreground
gimp_context_set_gradient
gimp_context_set_gradient_blend_color_space
+ gimp_context_set_gradient_fg_bg_rgb
+ gimp_context_set_gradient_fg_bg_hsv_cw
+ gimp_context_set_gradient_fg_bg_hsv_ccw
+ gimp_context_set_gradient_fg_transparent
gimp_context_set_gradient_repeat_mode
gimp_context_set_gradient_reverse
gimp_context_set_ink_angle
diff --git a/libgimp/gimpcontext_pdb.c b/libgimp/gimpcontext_pdb.c
index 1102f7f..4cedbe0 100644
--- a/libgimp/gimpcontext_pdb.c
+++ b/libgimp/gimpcontext_pdb.c
@@ -1907,6 +1907,130 @@ gimp_context_set_gradient (const gchar *name)
}
/**
+ * gimp_context_set_gradient_fg_bg_rgb:
+ *
+ * Sets the built-in FG-BG RGB gradient as the active gradient.
+ *
+ * This procedure sets the built-in FG-BG RGB gradient as the active
+ * gradient. The gradient will be used for subsequent gradient
+ * operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_fg_bg_rgb (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-bg-rgb",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_gradient_fg_bg_hsv_cw:
+ *
+ * Sets the built-in FG-BG HSV (cw) gradient as the active gradient.
+ *
+ * This procedure sets the built-in FG-BG HSV (cw) gradient as the
+ * active gradient. The gradient will be used for subsequent gradient
+ * operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_fg_bg_hsv_cw (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-bg-hsv-cw",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_gradient_fg_bg_hsv_ccw:
+ *
+ * Sets the built-in FG-BG HSV (ccw) gradient as the active gradient.
+ *
+ * This procedure sets the built-in FG-BG HSV (ccw) gradient as the
+ * active gradient. The gradient will be used for subsequent gradient
+ * operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_fg_bg_hsv_ccw (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-bg-hsv-ccw",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_context_set_gradient_fg_transparent:
+ *
+ * Sets the built-in FG-Transparent gradient as the active gradient.
+ *
+ * This procedure sets the built-in FG-Transparent gradient as the
+ * active gradient. The gradient will be used for subsequent gradient
+ * operations.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_fg_transparent (void)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-transparent",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
* gimp_context_get_gradient_blend_color_space:
*
* Get the gradient blend color space.
diff --git a/libgimp/gimpcontext_pdb.h b/libgimp/gimpcontext_pdb.h
index 4869b53..0796048 100644
--- a/libgimp/gimpcontext_pdb.h
+++ b/libgimp/gimpcontext_pdb.h
@@ -92,6 +92,10 @@ gchar* gimp_context_get_pattern (void);
gboolean gimp_context_set_pattern (const gchar
*name);
gchar* gimp_context_get_gradient (void);
gboolean gimp_context_set_gradient (const gchar
*name);
+gboolean gimp_context_set_gradient_fg_bg_rgb (void);
+gboolean gimp_context_set_gradient_fg_bg_hsv_cw (void);
+gboolean gimp_context_set_gradient_fg_bg_hsv_ccw (void);
+gboolean gimp_context_set_gradient_fg_transparent (void);
GimpGradientBlendColorSpace gimp_context_get_gradient_blend_color_space (void);
gboolean gimp_context_set_gradient_blend_color_space (GimpGradientBlendColorSpace
blend_color_space);
GimpRepeatMode gimp_context_get_gradient_repeat_mode (void);
diff --git a/pdb/groups/context.pdb b/pdb/groups/context.pdb
index 0e834bb..0b883db 100644
--- a/pdb/groups/context.pdb
+++ b/pdb/groups/context.pdb
@@ -1692,6 +1692,86 @@ CODE
);
}
+sub context_set_gradient_fg_bg_rgb {
+ $blurb = 'Sets the built-in FG-BG RGB gradient as the active gradient.';
+
+ $help = <<'HELP';
+This procedure sets the built-in FG-BG RGB gradient as the active
+gradient. The gradient will be used for subsequent gradient operations.
+HELP
+
+ &mitch_pdb_misc('2018', '2.10');
+
+ %invoke = (
+ code => <<'CODE'
+{
+ gimp_context_set_gradient (context,
+ gimp_gradients_get_fg_bg_rgb (gimp));
+}
+CODE
+ );
+}
+
+sub context_set_gradient_fg_bg_hsv_cw {
+ $blurb = 'Sets the built-in FG-BG HSV (cw) gradient as the active gradient.';
+
+ $help = <<'HELP';
+This procedure sets the built-in FG-BG HSV (cw) gradient as the active
+gradient. The gradient will be used for subsequent gradient operations.
+HELP
+
+ &mitch_pdb_misc('2018', '2.10');
+
+ %invoke = (
+ code => <<'CODE'
+{
+ gimp_context_set_gradient (context,
+ gimp_gradients_get_fg_bg_hsv_cw (gimp));
+}
+CODE
+ );
+}
+
+sub context_set_gradient_fg_bg_hsv_ccw {
+ $blurb = 'Sets the built-in FG-BG HSV (ccw) gradient as the active gradient.';
+
+ $help = <<'HELP';
+This procedure sets the built-in FG-BG HSV (ccw) gradient as the active
+gradient. The gradient will be used for subsequent gradient operations.
+HELP
+
+ &mitch_pdb_misc('2018', '2.10');
+
+ %invoke = (
+ code => <<'CODE'
+{
+ gimp_context_set_gradient (context,
+ gimp_gradients_get_fg_bg_hsv_ccw (gimp));
+}
+CODE
+ );
+}
+
+sub context_set_gradient_fg_transparent {
+ $blurb = 'Sets the built-in FG-Transparent gradient as the active gradient.';
+
+ $help = <<'HELP';
+This procedure sets the built-in FG-Transparent gradient as the active
+gradient. The gradient will be used for subsequent gradient operations.
+HELP
+
+ &mitch_pdb_misc('2018', '2.10');
+
+ %invoke = (
+ code => <<'CODE'
+{
+ gimp_context_set_gradient (context,
+ gimp_gradients_get_fg_transparent (gimp));
+}
+CODE
+ );
+}
+
sub context_set_gradient_blend_color_space {
$blurb = 'Set the gradient blend color space.';
$help = 'Set the gradient blend color space for paint tools and the gradient tool.';
@@ -3261,6 +3341,7 @@ CODE
}
@headers = qw("core/gimp.h"
+ "core/gimp-gradients.h"
"core/gimpcontainer.h"
"core/gimpdashpattern.h"
"core/gimpdatafactory.h"
@@ -3306,6 +3387,10 @@ CODE
context_get_mypaint_brush context_set_mypaint_brush
context_get_pattern context_set_pattern
context_get_gradient context_set_gradient
+ context_set_gradient_fg_bg_rgb
+ context_set_gradient_fg_bg_hsv_cw
+ context_set_gradient_fg_bg_hsv_ccw
+ context_set_gradient_fg_transparent
context_get_gradient_blend_color_space context_set_gradient_blend_color_space
context_get_gradient_repeat_mode context_set_gradient_repeat_mode
context_get_gradient_reverse context_set_gradient_reverse
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]