-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c55578e
commit 33d9c3f
Showing
1 changed file
with
83 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,20 +14,38 @@ | |
* License along with GEGL; if not, see <https://www.gnu.org/licenses/>. | ||
* | ||
* Copyright 2006 Øyvind Kolås <[email protected]> | ||
* 2022 Beaver (GEGL Bevel) | ||
*/ | ||
|
||
#include "config.h" | ||
#include <glib/gi18n-lib.h> | ||
|
||
#ifdef GEGL_PROPERTIES | ||
|
||
property_boolean (effectsswitchbevel, _("Enable Bevel (FOR GEGL EFFECTS ONLY)"), TRUE) | ||
description (_("This switch exist for GEGL Effects testing. You won't find it in stand alone bevel'")) | ||
ui_meta ("role", "output-extent") | ||
|
||
property_boolean (embossmode, _("Emboss Mode (use Gimp's layer Grain Merge blend mode)"), FALSE) | ||
description (_("Make an embossed bevel'")) | ||
|
||
property_double (radius1, _("Radius"), 7.0) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
property_double (radius1, _("Radius Normal Bevel"), 7.0) | ||
value_range (1.0, 40.0) | ||
ui_range (1.0, 12) | ||
ui_gamma (1.5) | ||
|
||
property_int (radius2, _("Radius Sharp Bevel"), 0) | ||
description(_("Box Blur -0 means disabled by default")) | ||
value_range (0, 8) | ||
ui_range (0, 8) | ||
ui_gamma (1.5) | ||
|
||
|
||
property_double (bevel1, _("Depth Angle"), 90.0) | ||
|
@@ -59,10 +77,23 @@ property_double (azimuth, _("Rotate Lighting"), 40.0) | |
|
||
#include "gegl-op.h" | ||
|
||
|
||
typedef struct | ||
{ | ||
GeglNode *input; | ||
GeglNode *blur; | ||
GeglNode *boxblur; | ||
GeglNode *emb; | ||
GeglNode *th; | ||
GeglNode *output; | ||
} State; | ||
|
||
|
||
static void attach (GeglOperation *operation) | ||
{ | ||
GeglNode *gegl = operation->node; | ||
GeglNode *input, *output, *blur, *emb, *th; | ||
GeglProperties *o = GEGL_PROPERTIES (operation); | ||
GeglNode *input, *output, *boxblur, *blur, *emb, *th; | ||
|
||
input = gegl_node_get_input_proxy (gegl, "input"); | ||
output = gegl_node_get_output_proxy (gegl, "output"); | ||
|
@@ -71,6 +102,12 @@ static void attach (GeglOperation *operation) | |
"operation", "gegl:gaussian-blur", | ||
NULL); | ||
|
||
boxblur = gegl_node_new_child (gegl, | ||
"operation", "gegl:box-blur", | ||
NULL); | ||
|
||
|
||
|
||
|
||
emb = gegl_node_new_child (gegl, | ||
"operation", "gegl:emboss", | ||
|
@@ -82,40 +119,72 @@ static void attach (GeglOperation *operation) | |
|
||
|
||
|
||
gegl_node_link_many (input, blur, emb, th, output, NULL); | ||
|
||
gegl_node_link_many (input, blur, boxblur, emb, th, output, NULL); | ||
gegl_operation_meta_redirect (operation, "radius1", blur, "std-dev-x"); | ||
gegl_operation_meta_redirect (operation, "radius1", blur, "std-dev-y"); | ||
|
||
gegl_operation_meta_redirect (operation, "bevelhidden", emb, ""); | ||
|
||
gegl_operation_meta_redirect (operation, "bevel1", emb, "elevation"); | ||
|
||
gegl_operation_meta_redirect (operation, "bevel2", emb, "depth"); | ||
|
||
gegl_operation_meta_redirect (operation, "azimuth", emb, "azimuth"); | ||
gegl_operation_meta_redirect (operation, "radius2", boxblur, "radius"); | ||
gegl_operation_meta_redirect (operation, "th", th, "value"); | ||
|
||
|
||
gegl_operation_meta_redirect (operation, "th", th, "value"); | ||
|
||
|
||
/* Now save points to the various gegl nodes so we can rewire them in | ||
* update_graph() later | ||
*/ | ||
State *state = g_malloc0 (sizeof (State)); | ||
state->input = input; | ||
state->blur = blur; | ||
state->boxblur = boxblur; | ||
state->emb = emb; | ||
state->th = th; | ||
state->output = output; | ||
o->user_data = state; | ||
} | ||
|
||
static void | ||
gegl_op_class_init (GeglOpClass *klass) | ||
update_graph (GeglOperation *operation) | ||
{ | ||
GeglOperationClass *operation_class; | ||
GeglProperties *o = GEGL_PROPERTIES (operation); | ||
State *state = o->user_data; | ||
if (!state) return; | ||
|
||
if (o->effectsswitchbevel) | ||
if (o->embossmode) | ||
{ | ||
gegl_node_link_many (state->blur, state->boxblur, state->emb, state->output, NULL); | ||
} | ||
else | ||
{ | ||
gegl_node_link_many (state->blur, state->boxblur, state->emb, state->th, state->output, NULL); | ||
} | ||
else | ||
{ | ||
gegl_node_link_many (state->input, state->output, NULL); | ||
} | ||
} | ||
|
||
operation_class = GEGL_OPERATION_CLASS (klass); | ||
|
||
|
||
|
||
|
||
static void | ||
gegl_op_class_init (GeglOpClass *klass) | ||
{ | ||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass); | ||
GeglOperationMetaClass *operation_meta_class = GEGL_OPERATION_META_CLASS (klass); | ||
|
||
operation_class->attach = attach; | ||
operation_meta_class->update = update_graph; | ||
|
||
gegl_operation_class_set_keys (operation_class, | ||
"name", "gegl:bevel", | ||
"title", _("Bevel"), | ||
"categories", "Aristic", | ||
"reference-hash", "45ed5656a28a512570f0f25sb2ac", | ||
"description", _("Bevel Images using GEGL. Use the multiply blend mode " | ||
"description", _("You are expected to use GEGL or Gimp blend modes with this plugin. Works best with blend modes multiply and grain merge. Emboss mode requires non-GEGL Gimp blend modes" | ||
""), | ||
NULL); | ||
} | ||
|