It is currently Fri Jun 21, 2024 12:50 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Baby's first GEGL plugin - a very basic GEGL plugin anyone can make.
PostPosted: Tue Jan 09, 2024 6:01 pm  (#1) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
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. :jumpclap 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 Effect
Attachment:
vibrance_meme.png
vibrance_meme.png [ 423.06 KiB | Viewed 3301 times ]


GEGL Syntax to create vibrance effect
id=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 do

https://gegl.org/operations/gegl-saturation.html
https://gegl.org/operations/gegl-hue-chroma
https://gegl.org/operations/gegl-add.html


Partially 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!


Attachments:
my_first_gegl_plugin_vibrance_for_compilers.zip [15.73 KiB]
Downloaded 54 times
Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Baby's first GEGL plugin - a very basic GEGL plugin anyone can mak
PostPosted: Sun Jan 14, 2024 6:54 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
. This plugin is very simple to develop. It does involving thinking but not deep thinking.

For example three GEGL Operation names need to go in the "???" section
static void attach (GeglOperation *operation)
{
  GeglNode *gegl = operation->node;
  GeglNode *input, *???, *???, *???,  *output;



Notice how *input, and *output are already defined operation names, but the three missing defined operation names might be the three GEGL operations I listed in the URL.
https://gegl.org/operations/gegl-saturation.html
https://gegl.org/operations/gegl-hue-chroma
https://gegl.org/operations/gegl-add.html

We can name these operation names anything we want as long as we do not use forbidden characters and spaces.
But in
/*you can find this blend modes operation name here https://gegl.org/operations/gegl-add.html*/
  ??? = gegl_node_new_child (gegl,
                                  "operation", "gegl:???",
                                  NULL);


We must use the literal GEGL operation name (gegl:???) the ??? is replaced by the info on GEGL's website.


This GEGL plugin exercise is VERY EASY TO DO. I completed the exercise in 4 minutes. This is the first GEGL plugin of 2024 btw.
Attachment:
vibrance_fun.png
vibrance_fun.png [ 693.63 KiB | Viewed 3013 times ]


Top
 Post subject: Re: Baby's first GEGL plugin - a very basic GEGL plugin anyone can mak
PostPosted: Mon Jan 15, 2024 12:04 pm  (#3) 
Offline
GimpChat Member
User avatar

Joined: May 24, 2021
Posts: 785
Location: SEA - South East Asia
As a starter you should explain what does mean those thing,

For example at https://gegl.org/operations/gegl-hue-chroma
Hue
Hue adjustment
name: hue type: double default: 0.00 minimum: -180.00 maximum: 180.00 ui-minimum: -180.00 ui-maximum: 180.00 ui-gamma: 1.00 ui-step-small: 1.00 ui-step-big: 10.00 ui-digits: 2
Chroma
Chroma adjustment
name: chroma type: double default: 0.00 minimum: -100.00 maximum: 100.00 ui-minimum: -100.00 ui-maximum: 100.00 ui-gamma: 1.00 ui-step-small: 1.00 ui-step-big: 10.00 ui-digits: 2
Lightness
Lightness adjustment
name: lightness type: double default: 0.00 minimum: -100.00 maximum: 100.00 ui-minimum: -100.00 ui-maximum: 100.00 ui-gamma: 1.00 ui-step-small: 1.00 ui-step-big: 10.00 ui-digits: 2

How do you read them?
name = hue type?
or
name = hue, then type = double default?
And what does those mean?
What a "double" mean

Explain wording like what does mean:
ui-minimum
ui-maximum
ui-step-big
ui-digits

You start with "static void attach" do you think it does make sense for a non programmer? you need to explain what does "static void attach" do
You need to put yourself in a mind of some one who never see a line of code... ever.

;)

_________________
Patrice


Top
 Post subject: Re: Baby's first GEGL plugin - a very basic GEGL plugin anyone can mak
PostPosted: Mon Jan 15, 2024 4:57 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
PixLab wrote:
As a starter you should explain what does mean those thing,

For example at https://gegl.org/operations/gegl-hue-chroma
Hue
Hue adjustment
name: hue type: double default: 0.00 minimum: -180.00 maximum: 180.00 ui-minimum: -180.00 ui-maximum: 180.00 ui-gamma: 1.00 ui-step-small: 1.00 ui-step-big: 10.00 ui-digits: 2
Chroma
Chroma adjustment
name: chroma type: double default: 0.00 minimum: -100.00 maximum: 100.00 ui-minimum: -100.00 ui-maximum: 100.00 ui-gamma: 1.00 ui-step-small: 1.00 ui-step-big: 10.00 ui-digits: 2
Lightness
Lightness adjustment
name: lightness type: double default: 0.00 minimum: -100.00 maximum: 100.00 ui-minimum: -100.00 ui-maximum: 100.00 ui-gamma: 1.00 ui-step-small: 1.00 ui-step-big: 10.00 ui-digits: 2

How do you read them?
name = hue type?
or
name = hue, then type = double default?
And what does those mean?
What a "double" mean

Explain wording like what does mean:
ui-minimum
ui-maximum
ui-step-big
ui-digits

You start with "static void attach" do you think it does make sense for a non programmer? you need to explain what does "static void attach" do
You need to put yourself in a mind of some one who never see a line of code... ever.

;)


ui-range
is the GUI's paramaters on the filter

value_range
is the full paramater of the filter. Like when a GEGL slider can still go beyond its GUIs max value.


ui-minimum
ui-maximum

are the same as ui-range


ui-step
is how fast a slider in GEGL moves

Double
means decimal numbers like 1.0, 2.1, 4.5

GEGL's UI list them as property_double

Int
means whole numbers like 1,2,3,4,5,9,12

GEGL's UI list them as property_int


Unless users are making a checkbox or enum list to update a graph they don't need to use static void attach My simple plugins just fill out the template.


----


Now about gegl:hue-chroma, it has three properties and we need the light boost. So what should we chose (1, 2, or 3?)


gegl:hue-chroma
1.hue=
2.chroma=
3.lightness=


Top
 Post subject: Re: Baby's first GEGL plugin - a very basic GEGL plugin anyone can mak
PostPosted: Fri Jan 19, 2024 3:54 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
I guess Jan 1st 2025 will arrive and no one will have yet made a GEGL plugin.

ok.....


Top
 Post subject: Re: Baby's first GEGL plugin - a very basic GEGL plugin anyone can mak
PostPosted: Fri Jan 19, 2024 6:11 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: Mar 23, 2012
Posts: 7313
Location: Göteborg at last!
I might have been interested but it all looks too complicated. I would need an A-B-C guide for idiots! Also, I often wonder if much of the plugin and filter creation now is really more of an exercise for filter makers than a useful addition to Gimp. With all the basic functions that Gimp already has, an imaginative person can create practically anything. Many of the filters look much the same as well, especially all the "artistic" filters. I can't tell the difference from one to another, with a few exceptions.


Top
 Post subject: Re: Baby's first GEGL plugin - a very basic GEGL plugin anyone can mak
PostPosted: Fri Jan 19, 2024 6:42 am  (#7) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
Let's take a random exercise inside here

/* 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;


I will make up three names. They can be anyname but I choose

GeglNode *input, *luma, *sat, *addition, *output;[/b]

now that I listed these three names, what goes in each "???" Remember that gegl:??? must contain an operation name like gegl:dropshadow or gegl:bloom but the "???" at the start of gegl_node_new_child can contain ANY NAME that we defined. Lets see if anyone can fill in these blanks. The URLs listed literally provide the answer to the GEGL operation name but not the name for gegl_node_new_child.


/*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);


Top
 Post subject: Re: Baby's first GEGL plugin - a very basic GEGL plugin anyone can mak
PostPosted: Fri Jan 19, 2024 6:49 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
I wish a professional could help me teach what I analytically know but can't properly explain. I don't even have terminology outside of "gegl operation" "node area" "gegl composer". and I've been doing this for well over two years.


Top
 Post subject: Re: Baby's first GEGL plugin - a very basic GEGL plugin anyone can mak
PostPosted: Fri Jan 19, 2024 7:27 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
This is just an example of my plugins "custom bevel" "glass over text" "edge smooth" and "glossy balloon" being used together with native Gimp filters to make amazing text. Said plugins contain many basic Gimp filters chained together and inside GEGL composers. If you guys take the time to learn and do basic exercises one day you will be able to write GEGL syntax like this effortlessly.

Attachment:
custom_bevel_bg_behind.png
custom_bevel_bg_behind.png [ 236.15 KiB | Viewed 2783 times ]


Attachment:
pasted_image174.png
pasted_image174.png [ 356.26 KiB | Viewed 2783 times ]


Top
 Post subject: Re: Baby's first GEGL plugin - a very basic GEGL plugin anyone can mak
PostPosted: Mon Jan 29, 2024 1:48 pm  (#10) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
I am going to release an actual Vibrance plugin soon that will have a lot more options not available in my tutorial, such as the ability to switch through blend modes and opacity above 100%. The plugin I am making is much more advance then this exercise.

Vibrance in split view mode on the turtle
Attachment:
vibrance_memes.png
vibrance_memes.png [ 614.34 KiB | Viewed 2587 times ]


Selection mask on the dress only applying Vibrance
Attachment:
vibrance_actual_filter.png
vibrance_actual_filter.png [ 573.31 KiB | Viewed 2587 times ]


Once the plugin is done it will have its own thread on GimpChat.


Top
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Please make a python plugin to combine my GEGL filters with GMIC

1

No new posts Attachment(s) GEGL Background on top (first public GEGL plugin of 2024)

0

No new posts GEGL plugin that outlines with a bevel and more

0

No new posts Attachment(s) GEGL Plastic Wrap plugin

1

No new posts Someone other then me made a GEGL plugin using my tactics

1



* Login  



Powered by phpBB3 © phpBB Group