 |
| GimpChat Member |
 |
Joined: Oct 31, 2020 Posts: 2014
|
The filter is done and appears to be working fine. It will be on Github tomorrow or later tonight. Attachment:
on_soon.png [ 603.75 KiB | Viewed 76435 times ]
Anyone is welcome to compile this early. The entire working code is here. /* 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 <[email protected]> * 2024 Beaver, Brushed Metal Wood
Recreate graph using this GEGL syntax
id=x over aux=[ ref=x color value=#59cbf3 noise-rgb red=1 green=1 blue=1 gaussian=true linear=true seed=223334 gray ] crop motion-blur length=70 unsharp-mask scale=5 opacity value=10 median-blur radius=0 abyss-policy=none clip-extent multiply aux=[ color value=#e98944] */
#include "config.h" #include <glib/gi18n-lib.h>
#ifdef GEGL_PROPERTIES
property_color (color, _("Color"), "#e98944") description (_("The color to paint over the brushed metal/wood. The default color makes wood"))
property_double (direction, _("Direction"), 0.0) description (_("Direction of brushed metal/wood")) value_range (-180, 180) ui_meta ("unit", "degree") ui_meta ("direction", "cw")
property_double (length, _("Length"), 70.0) description (_("Length of brushed metal/wood in pixels")) value_range (20.0, 120.0) ui_range (20.0, 120.0) ui_gamma (1.5) ui_meta ("unit", "pixel-distance")
property_double (sharpen, _("Sharpen"), 4.5) description(_("Sharpen the brushed metal/wood ")) value_range (2.0, 10.0) ui_range (2.0, 10.0) ui_gamma (3.0)
property_seed (seed, _("Random seed"), rand) description (_("The random seed for the noise function"))
property_double (desaturate, _("Desaturate (for brushed metal)"), 1.0) description(_("Desaturation option to make brushed metal")) value_range (0.0, 1.0) ui_range (0.0, 1.0)
#else
#define GEGL_OP_META #define GEGL_OP_NAME brushed_metal_wood #define GEGL_OP_C_SOURCE brushed_metal_wood.c
#include "gegl-op.h"
static void attach (GeglOperation *operation) { GeglNode *gegl = operation->node; GeglColor *hidden_color = gegl_color_new ("#a0a0a0"); GeglColor *default_color = gegl_color_new ("#e98944");
GeglNode *input = gegl_node_get_input_proxy (gegl, "input"); GeglNode *output = gegl_node_get_output_proxy (gegl, "output");
GeglNode *normal = gegl_node_new_child (gegl, "operation", "gegl:over", NULL); GeglNode *idref = gegl_node_new_child (gegl, "operation", "gegl:nop", NULL); GeglNode *hcolor = gegl_node_new_child (gegl, "operation", "gegl:color", "value", hidden_color, NULL); GeglNode *noise = gegl_node_new_child (gegl, "operation", "gegl:noise-rgb", "red", 1.0, "green", 1.0, "blue", 1.0, "gaussian", TRUE, "linear", TRUE, NULL); GeglNode *gray = gegl_node_new_child (gegl, "operation", "gegl:gray", NULL); GeglNode *crop = gegl_node_new_child (gegl, "operation", "gegl:crop", NULL); GeglNode *motion = gegl_node_new_child (gegl, "operation", "gegl:motion-blur-linear", NULL); GeglNode *sharpen = gegl_node_new_child (gegl, "operation", "gegl:unsharp-mask", NULL); GeglNode *opacity = gegl_node_new_child (gegl, "operation", "gegl:opacity", "value", 10.0, NULL); GeglNode *endfix = gegl_node_new_child (gegl, "operation", "gegl:median-blur", "radius", 0, "abyss-policy", 0, NULL); GeglNode *multiply = gegl_node_new_child (gegl, "operation", "gegl:multiply", NULL); GeglNode *color = gegl_node_new_child (gegl, "operation", "gegl:color", "value", default_color, NULL); GeglNode *desaturate = gegl_node_new_child (gegl, "operation", "gegl:saturation", NULL); /*main graph here. normal and multiply are composers (aka blend modes)*/ gegl_node_link_many (input, idref, normal, crop, motion, sharpen, opacity, endfix, multiply, desaturate, output, NULL); /*the normal blend mode has everything from idref to gray inside it*/ gegl_node_connect (normal, "aux", gray, "output"); gegl_node_link_many (idref, hcolor, noise, gray, NULL); /*the multiply blend mode has a color node inside of it. obviously to blend the color*/ gegl_node_connect (multiply, "aux", color, "output");
gegl_operation_meta_redirect (operation, "seed", noise, "seed"); gegl_operation_meta_redirect (operation, "sharpen", sharpen, "scale"); gegl_operation_meta_redirect (operation, "length", motion, "length"); gegl_operation_meta_redirect (operation, "direction", motion, "angle"); gegl_operation_meta_redirect (operation, "color", color, "value"); gegl_operation_meta_redirect (operation, "desaturate", desaturate, "scale");
}
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:woodmetal", "title", _("Brushed Metal and Wood"), "reference-hash", "dancingthroughthenightonthegroove", "description", _("The same background that makes brushed metal also makes wood texture."), "gimp:menu-path", "<Image>/Filters/Render/Fun", "gimp:menu-label", _("Brushed Metal and Wood Background..."), NULL); }
#endif
|
|