![Offline Offline](./styles/GimpChat/imageset/en/icon_user_offline.gif) |
GimpChat Member |
![User avatar](./download/file.php?avatar=7197_1689805100.png) |
Joined: Oct 31, 2020 Posts: 1458
|
Its done and it was renamed to "modify selection" I'll upload it on Github and provide binaries tomorrow but right now I'll link the source code for technical people to compile. Attachment:
gegl_selection_mask.png [ 432.65 KiB | Viewed 393 times ]
If you figure out how to compile the code below and put the binary in Windows C:\Users\(USERNAME)\AppData\Local\gegl-0.4\plug-ins Linux /home/(USERNAME)/.local/share/gegl-0.4/plug-ins Linux (Flatpak includes Chromebook) /home/(USERNAME)/.var/app/org.gimp.GIMP/data/gegl-0.4/plug-ins You'll have the filter I have. If not you'll have to wait several hours. lol /* This file is an image processing operation for GEGL * * GEGL is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * GEGL 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with GEGL; if not, see <https://www.gnu.org/licenses/>. * * Copyright 2006 Øyvind Kolås <pippin@gimp.org> * 2024 Beaver GEGL Grow Shrink Feather (GEGL Selection Mask modifier).
You can test this filter by pasting this code into GEGL Graph (ITS VERY SIMPLE) noise-spread amount-x=0 amount-y=0 median-blur radius=0 alpha-percentile=100 gaussian-blur std-dev-x=0 std-dev-y=0 */
#include "config.h" #include <glib/gi18n-lib.h>
#ifdef GEGL_PROPERTIES
property_double (feather, _("Gaussian Blur to Feather selection"), 0) description (_("Gaussian Blur will feather the selection when used appropriately with median blur.")) value_range (0.0, 20.0) ui_range (0.24, 20.0) ui_gamma (3.0)
enum_start (gegl_gimplayershadow_grow_shape2) enum_value (GEGL_DROPSHADOW_GROW_SHAPE_SQUARE, "square", N_("Square")) enum_value (GEGL_DROPSHADOW_GROW_SHAPE_CIRCLE, "circle", N_("Circle")) enum_value (GEGL_DROPSHADOW_GROW_SHAPE_DIAMOND, "diamond", N_("Diamond")) enum_end (GeglgimplayershadowGrowShape2)
property_enum (growshrinkshape, _("Grow to Shrink base shape"), GeglgimplayershadowGrowShape2, gegl_gimplayershadow_grow_shape2, GEGL_DROPSHADOW_GROW_SHAPE_CIRCLE) description (_("The base shape to expand or contract the selection in"))
property_int (growshrink, _("Grow to Shrink transition on selection"), 0) value_range (-50, 50) ui_range (-15, 15) ui_gamma (1.5) ui_meta ("unit", "pixel-distance") description (_("The distance to Grow or Shrink the selection. Left grows and right shrinks."))
property_double (opacity, _("Opacity of Mask"), 1.0) description (_("Decrease or increase the opacity of the mask using levels. 1 is default, 0 is completely transparent and 2 is double the default opacity.")) value_range (0.0, 3.0) ui_range (0.0, 2.0) ui_gamma (3.0)
property_int (distort, _("Noise Spread to Distort selection"), 0) description (_("Noise Spread will distort the selection. Works best when blur is very mild or disabled.")) value_range (0, 30) ui_range (0, 30) ui_gamma (3.0)
property_seed (distortseed, _("Random seed of Distort effect"), rand)
#else
#define GEGL_OP_META #define GEGL_OP_NAME quickmaskfilter #define GEGL_OP_C_SOURCE quickmaskfilter.c
#include "gegl-op.h"
static void attach (GeglOperation *operation) { GeglNode *gegl = operation->node;
GeglNode *input = gegl_node_get_input_proxy (gegl, "input"); GeglNode *output = gegl_node_get_output_proxy (gegl, "output");
GeglNode *spread = gegl_node_new_child (gegl, "operation", "gegl:noise-spread", NULL);
GeglNode *blur = gegl_node_new_child (gegl, "operation", "gegl:gaussian-blur", NULL);
GeglNode *median = gegl_node_new_child (gegl, "operation", "gegl:median-blur", "percentile", 100.0, "alpha-percentile", 50.0, NULL);
GeglNode *increaseopacity = gegl_node_new_child (gegl, "operation", "gegl:levels", NULL); gegl_node_link_many (input, spread, median, blur, increaseopacity, output, NULL);
gegl_operation_meta_redirect (operation, "opacity", increaseopacity, "out-high"); gegl_operation_meta_redirect (operation, "distort", spread, "amount-y"); gegl_operation_meta_redirect (operation, "distort", spread, "amount-x"); gegl_operation_meta_redirect (operation, "distortseed", spread, "seed"); gegl_operation_meta_redirect (operation, "feather", blur, "std-dev-x"); gegl_operation_meta_redirect (operation, "feather", blur, "std-dev-y"); gegl_operation_meta_redirect (operation, "growshrink", median, "radius"); gegl_operation_meta_redirect (operation, "growshrinkshape", median, "neighborhood");
}
static void gegl_op_class_init (GeglOpClass *klass) { GeglOperationClass *operation_class;
operation_class = GEGL_OPERATION_CLASS (klass);
operation_class->attach = attach;
gegl_operation_class_set_keys (operation_class, "name", "lb:modifyselection", "title", _("Modify Selection"), "reference-hash", "consciousnesscreatesreality0", "description", _("Apply a filter on a quick mask, layer mask, or erase blend mode to modify the selection. Fact 1: GEGL can apply filters on quick mask alone, but if you click on a Gimp layer it will then apply said effect to the layer you clicked. You can re-instruct GEGL to apply the filter on the quick mask by disabling and re-enabling the quick mask. Hint: When used unintendedly this filter can make a stained glass effect." ""), "gimp:menu-path", "<Image>/Select/", "gimp:menu-label", _("Selection Grow/Shrink and Feather with GEGL (apply on quick mask, layer mask, or erase blend mode)"), NULL); }
#endif
Last edited by contrast_ on Thu Feb 08, 2024 2:51 pm, edited 1 time in total.
|
|