Commit 6ee7b221 authored by Michael Natterer's avatar Michael Natterer 😴

pdb: use the newly added GimpPDBContext paint options for painting

so all paint context settings take part in the push/pop logic.
parent 01344f81
This diff is collapsed.
......@@ -52,13 +52,15 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-airbrush", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-airbrush");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
g_object_set (options,
"pressure", pressure,
......@@ -66,7 +68,7 @@ HELP
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -99,17 +101,19 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-airbrush", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-airbrush");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -157,13 +161,15 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-clone", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-clone");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
g_object_set (options,
"clone-type", clone_type,
......@@ -171,7 +177,7 @@ HELP
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
"src-drawable", src_drawable,
"src-x", src_x,
"src-y", src_y,
......@@ -208,17 +214,19 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-clone", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-clone");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -251,17 +259,19 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-convolve", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-convolve");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -296,13 +306,15 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-convolve", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-convolve");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
g_object_set (options,
"type", convolve_type,
......@@ -311,7 +323,7 @@ HELP
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -342,17 +354,19 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-eraser");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -388,13 +402,15 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-eraser");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
g_object_set (options,
"application-mode", method,
......@@ -403,7 +419,7 @@ HELP
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -439,13 +455,15 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-eraser");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
g_object_set (options,
"application-mode", method,
......@@ -455,7 +473,7 @@ HELP
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -495,17 +513,19 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-heal", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-heal");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
"src-drawable", src_drawable,
"src-x", src_x,
"src-y", src_y,
......@@ -542,17 +562,19 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-heal", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-heal");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -596,15 +618,18 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-paintbrush", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-paintbrush");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
GimpDynamics *pdb_dynamics = GIMP_DYNAMICS (gimp_dynamics_new (context, "pdb"));
GimpDynamics *user_dynamics = gimp_context_get_dynamics (context);
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,
......@@ -613,8 +638,10 @@ HELP
if (fade_out > 0)
{
GimpDynamicsOutput *opacity_output = gimp_dynamics_get_output (pdb_dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY);
GimpDynamicsOutput *opacity_output =
gimp_dynamics_get_output (pdb_dynamics,
GIMP_DYNAMICS_OUTPUT_OPACITY);
g_object_set (opacity_output,
"use-fade", TRUE,
NULL);
......@@ -622,8 +649,9 @@ HELP
if (gradient_length > 0)
{
GimpDynamicsOutput *color_output = gimp_dynamics_get_output (pdb_dynamics,
GIMP_DYNAMICS_OUTPUT_COLOR);
GimpDynamicsOutput *color_output =
gimp_dynamics_get_output (pdb_dynamics,
GIMP_DYNAMICS_OUTPUT_COLOR);
g_object_set (color_output,
"use-fade", TRUE,
......@@ -634,7 +662,7 @@ HELP
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
gimp_context_set_dynamics (context, user_dynamics);
......@@ -679,17 +707,19 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-paintbrush", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-paintbrush");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -721,17 +751,19 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-pencil", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-pencil");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -762,13 +794,15 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-smudge", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-smudge");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
g_object_set (options,
"rate", pressure,
......@@ -776,7 +810,7 @@ HELP
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -809,17 +843,19 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-smudge", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-smudge");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -855,13 +891,15 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-dodge-burn", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-dodge-burn");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
g_object_set (options,
"type", dodgeburn_type,
......@@ -871,7 +909,7 @@ HELP
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -904,17 +942,19 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-dodge-burn", error);
GimpPaintOptions *options =
gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
"gimp-dodge-burn");
if (info &&
if (options &&
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GimpPaintOptions *options = gimp_paint_options_new (info);
options = gimp_config_duplicate (GIMP_CONFIG (options));
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, error,
"undo-desc", info->blurb,
"undo-desc", options->paint_info->blurb,
NULL);
}
else
......@@ -925,23 +965,6 @@ CODE
}
# Incomplete
sub ink {
$blurb = 'Paint in the current brush without sub-pixel sampling.';
$help = 'fixme fixme';
&std_pdb_misc;
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The affected drawable' },
&stroke_arg
);
}
$extra{app}->{code} = <<'CODE';
static const GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES;
......@@ -1012,12 +1035,14 @@ CODE
@headers = qw("libgimpmath/gimpmath.h"
"libgimpconfig/gimpconfig.h"
"core/gimpbrush.h"
"core/gimpdynamics.h"
"core/gimppaintinfo.h"
"paint/gimppaintcore.h"
"paint/gimppaintcore-stroke.h"
"paint/gimppaintoptions.h"
"gimppdbcontext.h"
"gimppdb-utils.h");
@procs = qw(airbrush airbrush_default
......
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