I have a simple challenge for everyone who wants to participate and I will help assist anyone who needs it. We are going to turn this basic gegl syntax into a very simple GEGL plugin named "Vibrance" that is already partially done by me. I will even compile the plugin for you if I determine it is correct by you pasting the .c files text into Gimp Chat. If successful you will earn the title of the first GEGL plugin developed in 2024.
![Clapping & jumping :jumpclap](./images/smilies/041.gif)
Just because this is easy doesn't mean it is braindead you will still have to do some basic thinking with my help.
Please follow the instructions and when you are done paste the .c file's data on gimpchat for me to inspect. If correct I will compile it for you and credit you as the first GEGL plugin dev of 2024.
Image of The Vibrance EffectAttachment:
vibrance_meme.png [ 423.06 KiB | Viewed 3301 times ]
GEGL Syntax to create vibrance effectid=1 add aux=[ ref=1 saturation scale=2 ]
hue-chroma lightness=-6
GEGL operations used in this exercise that you will need to simply look at to get info on what to dohttps://gegl.org/operations/gegl-saturation.htmlhttps://gegl.org/operations/gegl-hue-chromahttps://gegl.org/operations/gegl-add.htmlPartially complete .c file with instructions inside /**/'s for what to do (upload this back to me with your edits)/* 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 (gimpchat username here) with Beaver's help - Vibrance Saturation Effect.
This is a guide on how to make a very simple GEGL Plugin. Which is literally saturation on the "addition blend mode" with a lighting property. It is inspired by GMIC's "vibrance" filter"
THIS IS THE GRAPH THAT WE WILL TURN INTO A PLUGIN
id=1 add aux=[ ref=1 saturation scale=2 ]
hue-chroma lightness=-29
*/
#include "config.h"
#include <glib/gi18n-lib.h>
#ifdef GEGL_PROPERTIES
/*This is where Vibrances saturation GUI aspect goes
I gave it the correct parmaters in value_range and ui_range but you
the user has to give it the property_name and a slider name. Note if you are paying very close attention you will realize I intentionally limited the ui and value range that these filters
are capable of for the same of simplicity.*/
property_double (propertynamecorresponding, _("Name this slider"), 0.0)
description (_("description"))
value_range (0.0, 5.0)
ui_range (0.0, 5.0)
/*This is where Lightness slider goes
I gave it the correct parmaters in value_range and ui_range but you
the user has to give it the property_name and a slider name. */
property_double (propertynamecorresponding2, _("Name this slider"), 0.0)
description (_("description"))
value_range (-20.0, 10.0)
ui_range (-20.0, 10.0)
#else
#define GEGL_OP_META
#define GEGL_OP_NAME vibrance
#define GEGL_OP_C_SOURCE vibrance.c
#include "gegl-op.h"
/* This GEGL node list needs to include three seperate names of your choice So far it only contains "???" as substitutes for the following operations.
"1. gegl saturation" "2. gegl hue chroma" 3. gegl add .
The goal is to give these operations names three unique names of your choice while listing their true GEGL operation name.
"*input" and "*output" which is the default read image from gimp and render image from gimp are already done. */
static void attach (GeglOperation *operation)
{
GeglNode *gegl = operation->node;
GeglNode *input, *???, *???, *???, *output;
input = gegl_node_get_input_proxy (gegl, "input");
output = gegl_node_get_output_proxy (gegl, "output");
/*you can find this filters operation name here https://gegl.org/operations/gegl-hue-chroma*/
??? = gegl_node_new_child (gegl,
"operation", "gegl:???",
NULL);
/*you can find this filters operation name here https://gegl.org/operations/gegl-saturation.html*/
??? = gegl_node_new_child (gegl,
"operation", "gegl:???",
NULL);
/*you can find this blend modes operation name here https://gegl.org/operations/gegl-add.html*/
??? = gegl_node_new_child (gegl,
"operation", "gegl:???",
NULL);
/*This is the literal GEGL Graph. The goal is to recreate the GEGL syntax
id=1 add aux=[ ref=1 saturation scale=2 ]
hue-chroma lightness=-9
in a way the .c file understands. input and output are already done and I actually did one step because in this case "id=1" is the first input (the bookmark) and
the second input is "ref=1" which is the image called. */
gegl_node_link_many (input, ???, ???, output, NULL);
gegl_node_link_many (input, ???, NULL);
gegl_node_connect_from (???, "aux", ???, "output");
/*the property name is what you wrote on lines 38 and 48.
??? is the name you assigned to filters "hue chroma" and "saturation"
once again, the original property name can be found here listed after the |
https://gegl.org/operations/gegl-saturation.html
https://gegl.org/operations/gegl-hue-chroma (its the third one that has to do with light)
*/
gegl_operation_meta_redirect (operation, "saturationpropertynameyougave", ???, "property_name_of_gegl:saturation");
gegl_operation_meta_redirect (operation, "lightnesspropertynameyougave", ???, "property_name_of_gegl:hue-chromas_light");
}
static void
gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
operation_class = GEGL_OPERATION_CLASS (klass);
operation_class->attach = attach;
/*enter a name space like john:vibrance and then enter your plugins name and description. Do not use the names (gegl:, gimp: or svg:)*/
gegl_operation_class_set_keys (operation_class,
"name", "namespace:vibrance",
"title", _("My New GEGL Plugin's name"),
/*mash number buttons for reference hash*/
"reference-hash", "23489234jkfg8932ac",
"description", _("Template for GEGL Plugins"),
/*If you want to put your plugin in the menu of Gimp 2.99.16+ add a copy of the name here.*/
"gimp:menu-path", "<Image>/Filters/Menu_for_my_plugin",
"gimp:menu-label", _("Menu Plugin Name..."),
NULL);
}
#endif
For people who actually do want to compile the plugin you need mysys2 if you are on Windows. If you are on Linux it should easily compile. All the stuff is configured in this zip.
https://www.msys2.org/If you have any questions feel free to ask!