Skip to content

Commit 245eac8

Browse files
authored
Add files via upload
1 parent 4c6b4a0 commit 245eac8

5 files changed

Lines changed: 299 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
## Compiling and Installing
3+
4+
### Linux
5+
6+
To compile and install you will need the GEGL header files (`libgegl-dev` on
7+
Debian based distributions or `gegl` on Arch Linux) and meson (`meson` on
8+
most distributions).
9+
10+
```bash
11+
meson setup --buildtype=release build
12+
ninja -C build
13+
14+
```
15+
16+
If you have an older version of gegl you may need to copy to `~/.local/share/gegl-0.3/plug-ins`
17+
instead (on Ubuntu 18.04 for example).
18+
19+
20+
21+
### Windows
22+
23+
The easiest way to compile this project on Windows is by using msys2. Download
24+
and install it from here: https://www.msys2.org/
25+
26+
Open a msys2 terminal with `C:\msys64\mingw64.exe`. Run the following to
27+
install required build dependencies:
28+
29+
```bash
30+
pacman --noconfirm -S base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-meson mingw-w64-x86_64-gegl
31+
```
32+
33+
Then build the same way you would on Linux:
34+
35+
```bash
36+
meson setup --buildtype=release build
37+
ninja -C build
38+
```
39+
40+
41+
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
/* This file is an image processing operation for GEGL
2+
*
3+
* GEGL is free software; you can redistribute it and/or
4+
* modify it under the terms of the GNU Lesser General Public
5+
* License as published by the Free Software Foundation; either
6+
* version 3 of the License, or (at your option) any later version.
7+
*
8+
* GEGL is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+
* Lesser General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU Lesser General Public
14+
* License along with GEGL; if not, see <https://www.gnu.org/licenses/>.
15+
*
16+
* Copyright 2006 Øyvind Kolås <pippin@gimp.org>
17+
* 2022 Beaver (GEGL Bevel) *2023 Beaver (GEGL Bevel 2 for GEGL Effects Continual Edition)
18+
*/
19+
20+
#include "config.h"
21+
#include <glib/gi18n-lib.h>
22+
23+
#ifdef GEGL_PROPERTIES
24+
25+
property_boolean (effectsswitchbevel, _("Enable Bevel (FOR GEGL EFFECTS ONLY)"), TRUE)
26+
description (_("This switch exist for GEGL Effects. You won't find it in stand alone bevel'"))
27+
ui_meta ("role", "output-extent")
28+
29+
property_boolean (embossmode, _("Emboss Mode (use Gimp's layer Grain Merge blend mode)"), FALSE)
30+
description (_("Make an embossed bevel'"))
31+
32+
33+
34+
35+
36+
37+
38+
39+
property_double (radius, _("Radius Normal Bevel"), 7.0)
40+
value_range (1.0, 40.0)
41+
ui_range (1.0, 12)
42+
ui_gamma (1.5)
43+
44+
property_int (radiussharp, _("Radius Sharp Bevel"), 0)
45+
description(_("Box Blur -0 means disabled by default"))
46+
value_range (0, 8)
47+
ui_range (0, 8)
48+
ui_gamma (1.5)
49+
50+
51+
property_double (elevation, _("Depth Angle"), 90.0)
52+
description (_("Elevation angle (degrees)"))
53+
value_range (0, 180)
54+
ui_meta ("unit", "degree")
55+
56+
property_int (depth, _("Depth"), 40)
57+
description (_("Filter width"))
58+
value_range (1, 100)
59+
60+
61+
property_double (th, _("Threshold of the Bevel's Transparency'"), 0.100)
62+
value_range (0.0, 1.0)
63+
ui_range (0.0, 0.5)
64+
65+
property_double (azimuth, _("Rotate Lighting"), 40.0)
66+
description (_("Light angle (degrees)"))
67+
value_range (0, 350)
68+
ui_meta ("unit", "degree")
69+
ui_meta ("direction", "ccw")
70+
71+
72+
#else
73+
74+
#define GEGL_OP_META
75+
#define GEGL_OP_NAME bevelbump
76+
#define GEGL_OP_C_SOURCE bevelbump.c
77+
78+
#include "gegl-op.h"
79+
80+
81+
typedef struct
82+
{
83+
GeglNode *input;
84+
GeglNode *blur;
85+
GeglNode *boxblur;
86+
GeglNode *emb;
87+
GeglNode *th;
88+
GeglNode *output;
89+
} State;
90+
91+
92+
static void attach (GeglOperation *operation)
93+
{
94+
GeglNode *gegl = operation->node;
95+
GeglProperties *o = GEGL_PROPERTIES (operation);
96+
GeglNode *input, *output, *boxblur, *blur, *emb, *th;
97+
98+
input = gegl_node_get_input_proxy (gegl, "input");
99+
output = gegl_node_get_output_proxy (gegl, "output");
100+
101+
blur = gegl_node_new_child (gegl,
102+
"operation", "gegl:gaussian-blur",
103+
NULL);
104+
105+
boxblur = gegl_node_new_child (gegl,
106+
"operation", "gegl:box-blur",
107+
NULL);
108+
109+
110+
111+
112+
emb = gegl_node_new_child (gegl,
113+
"operation", "gegl:emboss",
114+
NULL);
115+
116+
th = gegl_node_new_child (gegl,
117+
"operation", "gimp:threshold-alpha",
118+
NULL);
119+
120+
121+
122+
gegl_node_link_many (input, blur, boxblur, emb, th, output, NULL);
123+
gegl_operation_meta_redirect (operation, "radius", blur, "std-dev-x");
124+
gegl_operation_meta_redirect (operation, "radius", blur, "std-dev-y");
125+
gegl_operation_meta_redirect (operation, "elevation", emb, "elevation");
126+
gegl_operation_meta_redirect (operation, "depth", emb, "depth");
127+
gegl_operation_meta_redirect (operation, "azimuth", emb, "azimuth");
128+
gegl_operation_meta_redirect (operation, "radiussharp", boxblur, "radius");
129+
gegl_operation_meta_redirect (operation, "th", th, "value");
130+
131+
132+
133+
134+
/* Now save points to the various gegl nodes so we can rewire them in
135+
* update_graph() later
136+
*/
137+
State *state = g_malloc0 (sizeof (State));
138+
state->input = input;
139+
state->blur = blur;
140+
state->boxblur = boxblur;
141+
state->emb = emb;
142+
state->th = th;
143+
state->output = output;
144+
o->user_data = state;
145+
}
146+
147+
static void
148+
update_graph (GeglOperation *operation)
149+
{
150+
GeglProperties *o = GEGL_PROPERTIES (operation);
151+
State *state = o->user_data;
152+
if (!state) return;
153+
154+
if (o->effectsswitchbevel)
155+
if (o->embossmode)
156+
{
157+
gegl_node_link_many (state->blur, state->boxblur, state->emb, state->output, NULL);
158+
}
159+
else
160+
{
161+
gegl_node_link_many (state->blur, state->boxblur, state->emb, state->th, state->output, NULL);
162+
}
163+
else
164+
{
165+
gegl_node_link_many (state->input, state->output, NULL);
166+
}
167+
}
168+
169+
170+
171+
172+
173+
static void
174+
gegl_op_class_init (GeglOpClass *klass)
175+
{
176+
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
177+
GeglOperationMetaClass *operation_meta_class = GEGL_OPERATION_META_CLASS (klass);
178+
179+
operation_class->attach = attach;
180+
operation_meta_class->update = update_graph;
181+
182+
gegl_operation_class_set_keys (operation_class,
183+
"name", "gegl:bevelbump",
184+
"title", _("Bevel 2"),
185+
"categories", "Aristic",
186+
"reference-hash", "bev45ed5656a28a512570f0f25sb2ac",
187+
"description", _("GEGL Effects Continual Edition REQUIRES Bevel 2. Many other Beaver Plugins (chrome, goo, and default GEGL Effects) require Bevel. So you have to keep both bevel plugins if you want everything to work. Bevel 2 has new abilities such as the sharp bevel mode and emboss mode. Works best wiht blend modes multiply and grain merge."
188+
""),
189+
NULL);
190+
}
191+
192+
#endif
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
4+
meson setup --buildtype=release build && ninja -C build

compile_bevelbumpmap_here/config.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Autogenerated by the Meson build system.
3+
* Do not edit, your changes will be lost.
4+
*/
5+
6+
#pragma once
7+
8+
#define ARCH_X86 1
9+
10+
#define ARCH_X86_64 1
11+
12+
#define GEGL_LIBRARY "gegl-0.4"
13+
14+
#define GEGL_MAJOR_VERSION 0
15+
16+
#define GEGL_MICRO_VERSION 34
17+
18+
#define GEGL_MINOR_VERSION 4
19+
20+
#undef GEGL_UNSTABLE
21+
22+
#define GETTEXT_PACKAGE "gegl-0.4"
23+
24+
#define HAVE_EXECINFO_H
25+
26+
#define HAVE_FSYNC
27+
28+
#undef HAVE_GEXIV2
29+
30+
#undef HAVE_LUA
31+
32+
#define HAVE_MALLOC_TRIM
33+
34+
#undef HAVE_MRG
35+
36+
#define HAVE_STRPTIME
37+
38+
#define HAVE_UNISTD_H
39+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
project('bevelbump', 'c',
2+
version : '0.1',
3+
license : 'GPL-3.0-or-later')
4+
5+
# These arguments are only used to build the shared library
6+
# not the executables that use the library.
7+
lib_args = ['-DBUILDING_EFFECTS']
8+
9+
gegl = dependency('gegl-0.3', required : false)
10+
if not gegl.found()
11+
gegl = dependency('gegl-0.4')
12+
endif
13+
shlib = shared_library('bevelbump', 'bevelbump.c', 'config.h',
14+
c_args : lib_args,
15+
dependencies : gegl,
16+
name_prefix : '',
17+
)
18+
19+
# Make this library usable as a Meson subproject.
20+
stroke_dep = declare_dependency(
21+
include_directories: include_directories('.'),
22+
link_with : shlib)
23+

0 commit comments

Comments
 (0)