Skip to content

Commit f40b01f

Browse files
authored
Update bevel.c
Black Bevels are now allowed with a new slider
1 parent 20629a4 commit f40b01f

1 file changed

Lines changed: 45 additions & 5 deletions

File tree

compile_bevel_here/bevel.c

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ property_int (bevel2, _("Depth"), 40)
5858
value_range (1, 100)
5959

6060

61-
property_double (th, _("Threshold of the Bevel's Transparency'"), 0.100)
61+
property_double (th, _("Threshold of the Bevel's transparency"), 0.100)
6262
value_range (0.0, 1.0)
6363
ui_range (0.0, 0.5)
6464

@@ -69,6 +69,13 @@ property_double (azimuth, _("Rotate Lighting"), 40.0)
6969
ui_meta ("direction", "ccw")
7070

7171

72+
property_double (slideupblack, _("Slide up if Bevel is very dark or black. "), 0.00)
73+
description (_("GEGL Bevel works on black Bevels when using blend modes like Grain Merge and Hardlight. All you have to do is select those blend modes for black text and then move this slider up."))
74+
value_range (0.00, 0.999)
75+
ui_steps (0.01, 0.50)
76+
77+
78+
7279
#else
7380

7481
#define GEGL_OP_META
@@ -85,6 +92,10 @@ typedef struct
8592
GeglNode *boxblur;
8693
GeglNode *emb;
8794
GeglNode *th;
95+
GeglNode *whitecolor;
96+
GeglNode *normallayer;
97+
GeglNode *slideupblack;
98+
GeglNode *fix;
8899
GeglNode *output;
89100
} State;
90101

@@ -93,7 +104,8 @@ static void attach (GeglOperation *operation)
93104
{
94105
GeglNode *gegl = operation->node;
95106
GeglProperties *o = GEGL_PROPERTIES (operation);
96-
GeglNode *input, *output, *boxblur, *blur, *emb, *th;
107+
GeglNode *input, *output, *boxblur, *blur, *emb, *th, *fix, *whitecolor, *normallayer, *slideupblack;
108+
GeglColor *white_color = gegl_color_new ("#ffffff");
97109

98110
input = gegl_node_get_input_proxy (gegl, "input");
99111
output = gegl_node_get_output_proxy (gegl, "output");
@@ -118,15 +130,35 @@ static void attach (GeglOperation *operation)
118130
NULL);
119131

120132

133+
whitecolor = gegl_node_new_child (gegl,
134+
"operation", "gegl:color-overlay",
135+
"value", white_color, NULL);
136+
137+
138+
normallayer = gegl_node_new_child (gegl,
139+
"operation", "gimp:layer-mode", "layer-mode", 28, "composite-mode", 2, NULL);
140+
141+
142+
slideupblack = gegl_node_new_child (gegl,
143+
"operation", "gegl:opacity",
144+
NULL);
145+
146+
fix = gegl_node_new_child (gegl,
147+
"operation", "gegl:crop",
148+
NULL);
149+
150+
151+
152+
gegl_node_link_many (input, whitecolor, blur, boxblur, emb, th, fix, output, NULL);
121153

122-
gegl_node_link_many (input, blur, boxblur, emb, th, output, NULL);
123154
gegl_operation_meta_redirect (operation, "radius1", blur, "std-dev-x");
124155
gegl_operation_meta_redirect (operation, "radius1", blur, "std-dev-y");
125156
gegl_operation_meta_redirect (operation, "bevel1", emb, "elevation");
126157
gegl_operation_meta_redirect (operation, "bevel2", emb, "depth");
127158
gegl_operation_meta_redirect (operation, "azimuth", emb, "azimuth");
128159
gegl_operation_meta_redirect (operation, "radius2", boxblur, "radius");
129160
gegl_operation_meta_redirect (operation, "th", th, "value");
161+
gegl_operation_meta_redirect (operation, "slideupblack", slideupblack, "value");
130162

131163

132164

@@ -140,6 +172,10 @@ static void attach (GeglOperation *operation)
140172
state->boxblur = boxblur;
141173
state->emb = emb;
142174
state->th = th;
175+
state->whitecolor = whitecolor;
176+
state->normallayer = normallayer;
177+
state->slideupblack = slideupblack;
178+
state->fix = fix;
143179
state->output = output;
144180
o->user_data = state;
145181
}
@@ -154,11 +190,15 @@ update_graph (GeglOperation *operation)
154190
if (o->effectsswitchbevel)
155191
if (o->embossmode)
156192
{
157-
gegl_node_link_many (state->blur, state->boxblur, state->emb, state->output, NULL);
193+
gegl_node_link_many (state->input, state->normallayer, state->blur, state->boxblur, state->emb, state->fix, state->output, NULL);
194+
gegl_node_link_many (state->whitecolor, state->slideupblack, NULL);
195+
gegl_node_connect_from (state->normallayer, "aux", state->slideupblack, "output");
158196
}
159197
else
160198
{
161-
gegl_node_link_many (state->blur, state->boxblur, state->emb, state->th, state->output, NULL);
199+
gegl_node_link_many (state->input, state->normallayer, state->blur, state->boxblur, state->emb, state->th, state->fix, state->output, NULL);
200+
gegl_node_link_many (state->whitecolor, state->slideupblack, NULL);
201+
gegl_node_connect_from (state->normallayer, "aux", state->slideupblack, "output");
162202
}
163203
else
164204
{

0 commit comments

Comments
 (0)