Skip to content

Commit 4cc50c6

Browse files
author
Jehan
committed
app, pdb, plug-ins: replace (plug-in-cubism).
For plug-in developers reference: - (plug-in-cubism RUN-NONINTERACTIVE image layer tile_size saturation 0) + (gimp-drawable-merge-new-filter layer "gegl:cubism" 0 LAYER-MODE-REPLACE 1.0 "tile-size" tile_size "tile-saturation" saturation "bg-color" '(0 0 0)) Now you can even choose the bg-color (not just an int/enum of black and background color only).
1 parent f539f8f commit 4cc50c6

File tree

4 files changed

+2
-183
lines changed

4 files changed

+2
-183
lines changed

app/pdb/internal-procs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "internal-procs.h"
3131

3232

33-
/* 733 procedures registered total */
33+
/* 732 procedures registered total */
3434

3535
void
3636
internal_procs_init (GimpPDB *pdb)

app/pdb/plug-in-compat-cmds.c

-114
Original file line numberDiff line numberDiff line change
@@ -612,66 +612,6 @@ plug_in_bump_map_invoker (GimpProcedure *procedure,
612612
error ? *error : NULL);
613613
}
614614

615-
static GimpValueArray *
616-
plug_in_cubism_invoker (GimpProcedure *procedure,
617-
Gimp *gimp,
618-
GimpContext *context,
619-
GimpProgress *progress,
620-
const GimpValueArray *args,
621-
GError **error)
622-
{
623-
gboolean success = TRUE;
624-
GimpDrawable *drawable;
625-
gdouble tile_size;
626-
gdouble tile_saturation;
627-
gint bg_color;
628-
629-
drawable = g_value_get_object (gimp_value_array_index (args, 2));
630-
tile_size = g_value_get_double (gimp_value_array_index (args, 3));
631-
tile_saturation = g_value_get_double (gimp_value_array_index (args, 4));
632-
bg_color = g_value_get_int (gimp_value_array_index (args, 5));
633-
634-
if (success)
635-
{
636-
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
637-
GIMP_PDB_ITEM_CONTENT, error) &&
638-
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
639-
{
640-
GeglColor *color;
641-
GeglNode *node;
642-
643-
if (bg_color)
644-
{
645-
color = gegl_color_duplicate (gimp_context_get_background (context));
646-
gimp_color_set_alpha (color, 0.0);
647-
}
648-
else
649-
{
650-
color = gegl_color_new ("black");
651-
gegl_color_set_rgba_with_space (color, 0.0, 0.0, 0.0, 0.0, NULL);
652-
}
653-
654-
node = gegl_node_new_child (NULL,
655-
"operation", "gegl:cubism",
656-
"tile-size", tile_size,
657-
"tile-saturation", tile_saturation,
658-
"bg-color", color,
659-
NULL);
660-
g_object_unref (color);
661-
662-
gimp_drawable_apply_operation (drawable, progress,
663-
C_("undo-type", "Cubism"),
664-
node);
665-
g_object_unref (node);
666-
}
667-
else
668-
success = FALSE;
669-
}
670-
671-
return gimp_procedure_get_return_values (procedure, success,
672-
error ? *error : NULL);
673-
}
674-
675615
static GimpValueArray *
676616
plug_in_displace_invoker (GimpProcedure *procedure,
677617
Gimp *gimp,
@@ -1535,60 +1475,6 @@ register_plug_in_compat_procs (GimpPDB *pdb)
15351475
gimp_pdb_register_procedure (pdb, procedure);
15361476
g_object_unref (procedure);
15371477

1538-
/*
1539-
* gimp-plug-in-cubism
1540-
*/
1541-
procedure = gimp_procedure_new (plug_in_cubism_invoker);
1542-
gimp_object_set_static_name (GIMP_OBJECT (procedure),
1543-
"plug-in-cubism");
1544-
gimp_procedure_set_static_help (procedure,
1545-
"Convert the image into randomly rotated square blobs",
1546-
"Convert the image into randomly rotated square blobs.",
1547-
NULL);
1548-
gimp_procedure_set_static_attribution (procedure,
1549-
"Compatibility procedure. Please see 'gegl:cubism' for credits.",
1550-
"Compatibility procedure. Please see 'gegl:cubism' for credits.",
1551-
"2013");
1552-
gimp_procedure_add_argument (procedure,
1553-
g_param_spec_enum ("run-mode",
1554-
"run mode",
1555-
"The run mode",
1556-
GIMP_TYPE_RUN_MODE,
1557-
GIMP_RUN_INTERACTIVE,
1558-
GIMP_PARAM_READWRITE));
1559-
gimp_procedure_add_argument (procedure,
1560-
gimp_param_spec_image ("image",
1561-
"image",
1562-
"Input image (unused)",
1563-
FALSE,
1564-
GIMP_PARAM_READWRITE));
1565-
gimp_procedure_add_argument (procedure,
1566-
gimp_param_spec_drawable ("drawable",
1567-
"drawable",
1568-
"Input drawable",
1569-
FALSE,
1570-
GIMP_PARAM_READWRITE));
1571-
gimp_procedure_add_argument (procedure,
1572-
g_param_spec_double ("tile-size",
1573-
"tile size",
1574-
"Average diameter of each tile (in pixels)",
1575-
0.0, 100.0, 0.0,
1576-
GIMP_PARAM_READWRITE));
1577-
gimp_procedure_add_argument (procedure,
1578-
g_param_spec_double ("tile-saturation",
1579-
"tile saturation",
1580-
"Expand tiles by this amount",
1581-
0.0, 10.0, 0.0,
1582-
GIMP_PARAM_READWRITE));
1583-
gimp_procedure_add_argument (procedure,
1584-
g_param_spec_int ("bg-color",
1585-
"bg color",
1586-
"Background color { BLACK (0), BG (1) }",
1587-
0, 1, 0,
1588-
GIMP_PARAM_READWRITE));
1589-
gimp_pdb_register_procedure (pdb, procedure);
1590-
g_object_unref (procedure);
1591-
15921478
/*
15931479
* gimp-plug-in-displace
15941480
*/

pdb/groups/plug_in_compat.pdb

-67
Original file line numberDiff line numberDiff line change
@@ -225,72 +225,6 @@ CODE
225225
);
226226
}
227227

228-
sub plug_in_cubism {
229-
$blurb = 'Convert the image into randomly rotated square blobs';
230-
231-
$help = <<'HELP';
232-
Convert the image into randomly rotated square blobs.
233-
HELP
234-
235-
&std_pdb_compat('gegl:cubism');
236-
$date = '2013';
237-
238-
@inargs = (
239-
{ name => 'run_mode', type => 'enum GimpRunMode', dead => 1,
240-
desc => 'The run mode' },
241-
{ name => 'image', type => 'image', dead => 1,
242-
desc => 'Input image (unused)' },
243-
{ name => 'drawable', type => 'drawable',
244-
desc => 'Input drawable' },
245-
{ name => 'tile_size', type => '0.0 <= double <= 100.0',
246-
desc => 'Average diameter of each tile (in pixels)' },
247-
{ name => 'tile_saturation', type => '0.0 <= double <= 10.0',
248-
desc => 'Expand tiles by this amount' },
249-
{ name => 'bg_color', type => '0 <= int32 <= 1',
250-
desc => 'Background color { BLACK (0), BG (1) }' }
251-
);
252-
253-
%invoke = (
254-
code => <<'CODE'
255-
{
256-
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
257-
GIMP_PDB_ITEM_CONTENT, error) &&
258-
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
259-
{
260-
GeglColor *color;
261-
GeglNode *node;
262-
263-
if (bg_color)
264-
{
265-
color = gegl_color_duplicate (gimp_context_get_background (context));
266-
gimp_color_set_alpha (color, 0.0);
267-
}
268-
else
269-
{
270-
color = gegl_color_new ("black");
271-
gegl_color_set_rgba_with_space (color, 0.0, 0.0, 0.0, 0.0, NULL);
272-
}
273-
274-
node = gegl_node_new_child (NULL,
275-
"operation", "gegl:cubism",
276-
"tile-size", tile_size,
277-
"tile-saturation", tile_saturation,
278-
"bg-color", color,
279-
NULL);
280-
g_object_unref (color);
281-
282-
gimp_drawable_apply_operation (drawable, progress,
283-
C_("undo-type", "Cubism"),
284-
node);
285-
g_object_unref (node);
286-
}
287-
else
288-
success = FALSE;
289-
}
290-
CODE
291-
);
292-
}
293-
294228
sub plug_in_displace {
295229
$blurb = 'Displace pixels as indicated by displacement maps';
296230

@@ -1469,7 +1403,6 @@ CODE
14691403
@procs = qw(plug_in_autocrop
14701404
plug_in_autocrop_layer
14711405
plug_in_bump_map
1472-
plug_in_cubism
14731406
plug_in_displace
14741407
plug_in_edge
14751408
plug_in_emboss

plug-ins/script-fu/scripts/lava.scm

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
)
101101

102102
(plug-in-solid-noise RUN-NONINTERACTIVE image active-layer FALSE TRUE seed 2 2 2)
103-
(plug-in-cubism RUN-NONINTERACTIVE image active-layer tile_size 2.5 0)
103+
(gimp-drawable-merge-new-filter active-layer "gegl:cubism" 0 LAYER-MODE-REPLACE 1.0 "tile-size" tile_size "tile-saturation" 2.5 "bg-color" '(0 0 0))
104104
(plug-in-oilify RUN-NONINTERACTIVE image active-layer mask_size 0)
105105
(plug-in-edge RUN-NONINTERACTIVE image active-layer 2 0 0)
106106
(plug-in-gauss RUN-NONINTERACTIVE image active-layer 0.64 0.64 0)

0 commit comments

Comments
 (0)