Commit 3f4995d3 authored by Michael Natterer's avatar Michael Natterer 😴

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
parent 92a89780
......@@ -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"
......@@ -1562,6 +1563,62 @@ context_set_gradient_invoker (GimpProcedure *procedure,
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,
......@@ -4319,6 +4376,74 @@ register_context_procs (GimpPDB *pdb)
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
*/
......
......@@ -28,7 +28,7 @@
#include "internal-procs.h"
/* 828 procedures registered total */
/* 832 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
......
......@@ -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
......
......@@ -1906,6 +1906,130 @@ gimp_context_set_gradient (const gchar *name)
return success;
}
/**
* gimp_context_set_gradient_fg_bg_rgb:
*
* Sets the built-in FG-BG RGB gradient as the active gradient.
*
* This procedure sets the built-in FG-BG RGB gradient as the active
* gradient. The gradient will be used for subsequent gradient
* operations.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_context_set_gradient_fg_bg_rgb (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-bg-rgb",
&nreturn_vals,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_context_set_gradient_fg_bg_hsv_cw:
*
* Sets the built-in FG-BG HSV (cw) gradient as the active gradient.
*
* This procedure sets the built-in FG-BG HSV (cw) gradient as the
* active gradient. The gradient will be used for subsequent gradient
* operations.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_context_set_gradient_fg_bg_hsv_cw (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-bg-hsv-cw",
&nreturn_vals,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_context_set_gradient_fg_bg_hsv_ccw:
*
* Sets the built-in FG-BG HSV (ccw) gradient as the active gradient.
*
* This procedure sets the built-in FG-BG HSV (ccw) gradient as the
* active gradient. The gradient will be used for subsequent gradient
* operations.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_context_set_gradient_fg_bg_hsv_ccw (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-bg-hsv-ccw",
&nreturn_vals,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_context_set_gradient_fg_transparent:
*
* Sets the built-in FG-Transparent gradient as the active gradient.
*
* This procedure sets the built-in FG-Transparent gradient as the
* active gradient. The gradient will be used for subsequent gradient
* operations.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_context_set_gradient_fg_transparent (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-context-set-gradient-fg-transparent",
&nreturn_vals,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_context_get_gradient_blend_color_space:
*
......
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment